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


The following commit has been merged in the master branch:
commit d3c4937ee8e7ca4d2d286fb76772901ae731ac3b
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Mon Feb 18 22:20:25 2013 -0800

    Port GetUserInfo

diff --git a/bin/euare-usergetinfo b/bin/euare-usergetinfo
index 87aee6f..3015cbc 100755
--- a/bin/euare-usergetinfo
+++ b/bin/euare-usergetinfo
@@ -1,7 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import euca2ools.commands.euare.getuserinfo
 
 if __name__ == '__main__':
-    r = euca2ools.commands.euare.getuserinfo.GetUserInfo()
-    r.main_cli()
+    euca2ools.commands.euare.getuserinfo.GetUserInfo.run()
diff --git a/euca2ools/commands/euare/getuserinfo.py b/euca2ools/commands/euare/getuserinfo.py
index 66ead87..52eb3c9 100644
--- a/euca2ools/commands/euare/getuserinfo.py
+++ b/euca2ools/commands/euare/getuserinfo.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,53 +27,22 @@
 # 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
-
-
-class GetUserInfo(AWSQueryRequest):
-
-    ServiceClass = euca2ools.commands.euare.Euare
 
-    Description = """GetUserInfo"""
-    Params = [Param(
-        name='UserName',
-        short_name='u',
-        long_name='user-name',
-        ptype='string',
-        optional=True,
-        doc=""" Name of the User. """,
-        ), Param(
-        name='InfoKey',
-        short_name='k',
-        long_name='info-key',
-        ptype='string',
-        optional=True,
-        doc=""" Specify the name of the user information to get. """,
-        ), 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. """,
-        )]
+from requestbuilder import Arg
+from requestbuilder.mixins import TabifyingCommand
+from . import EuareRequest, DELEGATE
 
-    def cli_formatter(self, data):
-        for info in data.Infos:
-            print info['Key'], "\t", info['Value']
 
-    def main(self, **args):
-        self.list_markers.append('Infos')
-        self.item_markers.append('member')
-        return self.send(**args)
+class GetUserInfo(EuareRequest, TabifyingCommand):
+    DESCRIPTION = '[Eucalyptus only] Display information about a user'
+    ARGS = [Arg('-u', '--user-name', dest='UserName', metavar='USER',
+                help='''name of the user to display info for (default: current
+                        user)'''),
+            Arg('-k', '--info-key', dest='InfoKey',
+                help='name of the piece of user info to show'),
+            DELEGATE]
+    LIST_MARKERS = ['Infos']
 
-    def main_cli(self):
-        euca2ools.utils.print_version_if_necessary()
-        self.do_cli()
+    def print_result(self, result):
+        for info in data.get('Infos', []):
+            print self.tabify((info.get('Key'), info.get('Value')))

-- 
managing cloud instances for Eucalyptus



More information about the pkg-eucalyptus-commits mailing list