[pkg-eucalyptus-commits] [SCM] managing cloud instances for Eucalyptus branch, master, updated. 3.0.0-alpha3-257-g1da8e3a

Garrett Holmstrom gholms at fedoraproject.org
Sun Jun 16 02:29:55 UTC 2013


The following commit has been merged in the master branch:
commit 3466048fc451b2b7bf680ff05ca202fa9ebf4eac
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Sat May 19 15:42:12 2012 -0700

    Make DescribeImages default to owned+executable

diff --git a/euca2ools/commands/euca/describeimages.py b/euca2ools/commands/euca/describeimages.py
index 5f04d84..49ef836 100644
--- a/euca2ools/commands/euca/describeimages.py
+++ b/euca2ools/commands/euca/describeimages.py
@@ -32,12 +32,17 @@ from requestbuilder import Arg, Filter, GenericTagFilter
 from . import EucalyptusRequest
 
 class DescribeImages(EucalyptusRequest):
-    Description = 'Show information about images'
+    Description = '''\
+        Show information about images
+
+        By default, only images the caller owns and images for which the caller
+        has explicit launch permissions are shown.'''
+
     APIVersion = '2010-08-31'
     Args = [Arg('ImageId', metavar='IMAGE', nargs='*',
                 help='limit results to one or more images'),
             Arg('-a', '--all', action='store_true', route_to=None,
-                help='describe all images (default)'),
+                help='describe all images'),
             Arg('-o', '--owner', dest='Owner', action='append',
                 help='describe images owned by the specified owner'),
             Arg('-x', '--executable-by', dest='ExecutableBy', action='append',
@@ -93,16 +98,27 @@ class DescribeImages(EucalyptusRequest):
     ItemMarkers = ['item']
 
     def main(self):
+        if not any(self.args.get(item) for item in ('all', 'ImageId',
+                                                    'ExecutableBy', 'Owner')):
+            # Default to owned images and images with explicit launch perms
+            self.params = {'Owner': 'self'}
+            owned = self.send()
+            self.params = {'ExecutableBy': 'self'}
+            executable = self.send()
+            self.params = None
+            owned['imagesSet'] = (owned.get(     'imagesSet', []) +
+                                  executable.get('imagesSet', []))
+            return owned
         if self.args['all']:
             if self.args.get('ImageId'):
-                self._cli_parser.error('argument -a/--all cannot be used with '
+                self._cli_parser.error('argument -a/--all: not allowed with '
                                        'a list of images')
             if self.args.get('ExecutableBy'):
-                self._cli_parser.error('argument -a/--all cannot be used with '
-                                       '-x/--executable-by')
+                self._cli_parser.error('argument -a/--all: not allowed with '
+                                       'argument -x/--executable-by')
             if self.args.get('Owner'):
-                self._cli_parser.error('argument -a/--all cannot be used with '
-                                       '-o/--owner')
+                self._cli_parser.error('argument -a/--all: not allowed with '
+                                       'argument -o/--owner')
         return self.send()
 
     def print_result(self, result):

-- 
managing cloud instances for Eucalyptus



More information about the pkg-eucalyptus-commits mailing list