[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:30:21 UTC 2013


The following commit has been merged in the master branch:
commit 2a007265e551224d868323a124127ac5aeb2cf72
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Tue Feb 19 17:16:19 2013 -0800

    Port ListSigningCertificates

diff --git a/bin/euare-userlistcerts b/bin/euare-userlistcerts
index 92949a9..dcc46af 100755
--- a/bin/euare-userlistcerts
+++ b/bin/euare-userlistcerts
@@ -1,7 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import euca2ools.commands.euare.listsigningcertificates
 
 if __name__ == '__main__':
-    r = euca2ools.commands.euare.listsigningcertificates.ListSigningCertificates()
-    r.main_cli()
+    euca2ools.commands.euare.listsigningcertificates.ListSigningCertificates.run()
diff --git a/euca2ools/commands/euare/listsigningcertificates.py b/euca2ools/commands/euare/listsigningcertificates.py
index 1e4b8c5..a30bb59 100644
--- a/euca2ools/commands/euare/listsigningcertificates.py
+++ b/euca2ools/commands/euare/listsigningcertificates.py
@@ -1,6 +1,6 @@
 # Software License Agreement (BSD License)
 #
-# Copyright (c) 2009-2011, Eucalyptus Systems, Inc.
+# Copyright (c) 2009-2013, Eucalyptus Systems, Inc.
 # All rights reserved.
 #
 # Redistribution and use of this software in source and binary forms, with or
@@ -27,71 +27,35 @@
 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
-#
-# Author: Neil Soman neil at eucalyptus.com
-#         Mitch Garnaat mgarnaat at eucalyptus.com
 
-from boto.roboto.awsqueryrequest import AWSQueryRequest
-from boto.roboto.param import Param
-import euca2ools.commands.euare
-import euca2ools.utils
+from requestbuilder import Arg
+from requestbuilder.response import PaginatedResponse
+from . import EuareRequest, DELEGATE
+
 
+class ListSigningCertificates(EuareRequest):
+    DESCRIPTION = "List a user's signing certificates"
+    ARGS = [Arg('-u', '--user-name', dest='UserName', metavar='USER',
+                help='user to list certificates for (default: current user)'),
+            Arg('-v', '--verbose', action='store_true', route_to=None,
+                help="also show certificates' contents"),
+            DELEGATE]
+    LIST_MARKERS = ['Certificates']
 
-class ListSigningCertificates(AWSQueryRequest):
+    def main(self):
+        return PaginatedResponse(self, (None,), ('Certificates',))
 
-    ServiceClass = euca2ools.commands.euare.Euare
+    def prepare_for_page(self, page):
+        # Pages are defined by markers
+        self.params['Marker'] = page
 
-    Description = """ListSigningCertificates"""
-    Params = [Param(
-        name='UserName',
-        short_name='u',
-        long_name='user-name',
-        ptype='string',
-        optional=True,
-        doc=""" The name of the User. """,
-        ), Param(
-        name='_verbose',
-        short_name='v',
-        long_name='verbose',
-        ptype='boolean',
-        optional=True,
-        request_param=False,
-        doc='Causes output to include the certificate body',
-        ), Param(
-        name='Marker',
-        short_name='m',
-        long_name='marker',
-        ptype='string',
-        optional=True,
-        doc=""" Use this only when paginating results, and only in a subsequent request after you've received a response where the results are truncated. Set it to the value of the Marker element in the response you just received. """ ,
-        ), Param(
-        name='MaxItems',
-        short_name=None,
-        long_name='max-items',
-        ptype='integer',
-        optional=True,
-        doc=""" Use this only when paginating results to indicate the maximum number of certificate IDs you want in the response. If there are additional certificate IDs beyond the maximum you specify, the IsTruncated response element is true. """ ,
-        ), Param(
-        name='DelegateAccount',
-        short_name=None,
-        long_name='delegate',
-        ptype='string',
-        optional=True,
-        doc=""" [Eucalyptus extension] Process this command as if the administrator of the specified account had run it. This option is only usable by cloud administrators. """,
-        )]
+    def get_next_page(self, response):
+        if response.get('IsTruncatated') == 'true':
+            return response['Marker']
 
-    def cli_formatter(self, data):
-        for cert in data.Certificates:
+    def print_result(self, result):
+        for cert in result.get('Certificates', []):
             print cert['CertificateId']
-            if self.cli_options.verbose:
+            if self.args['verbose']:
                 print cert['CertificateBody']
             print cert['Status']
-            
-    def main(self, **args):
-        self.list_markers.append('Certificates')
-        self.item_markers.append('member')
-        return self.send(**args)
-
-    def main_cli(self):
-        euca2ools.utils.print_version_if_necessary()
-        self.do_cli()

-- 
managing cloud instances for Eucalyptus



More information about the pkg-eucalyptus-commits mailing list