[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:40 UTC 2013
The following commit has been merged in the master branch:
commit d901e4d7a5307535d226585ca42776a596752baa
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date: Sat Apr 14 13:44:49 2012 -0700
Rewrite Euare class, AddUserToGroup
diff --git a/bin/euare-groupadduser b/bin/euare-groupadduser
index 31cb6ab..38858ec 100755
--- a/bin/euare-groupadduser
+++ b/bin/euare-groupadduser
@@ -1,7 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import euca2ools.commands.euare.addusertogroup
if __name__ == '__main__':
- r = euca2ools.commands.euare.addusertogroup.AddUserToGroup()
- r.main_cli()
+ euca2ools.commands.euare.addusertogroup.AddUserToGroup().do_cli()
diff --git a/euca2ools/commands/euare/__init__.py b/euca2ools/commands/euare/__init__.py
index af62f1c..c8e6048 100644
--- a/euca2ools/commands/euare/__init__.py
+++ b/euca2ools/commands/euare/__init__.py
@@ -1,6 +1,6 @@
# Software License Agreement (BSD License)
#
-# Copyright (c) 2009-2011, Eucalyptus Systems, Inc.
+# Copyright (c) 2009-2012, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms, with or
@@ -27,22 +27,36 @@
# 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: Mitch Garnaat mgarnaat at eucalyptus.com
-
-from boto.roboto.awsqueryservice import AWSQueryService
-class Euare(AWSQueryService):
+from requestbuilder import Arg, STD_AUTH_ARGS, CONNECTION
+import requestbuilder.service
+from .. import Euca2oolsRequest
- Name = 'euare'
+class Euare(requestbuilder.service.BaseService):
Description = 'Eucalyptus User, Authorization and Reporting Environment'
APIVersion = '2010-05-08'
- Authentication = 'sign-v2'
- Path = '/'
- Port = 443
- Provider = 'aws'
EnvURL = 'EUARE_URL'
- Regions = [{"endpoint": "iam.amazonaws.com",
- "name": "us-east-1",
- "description": "US-East (Northern Virginia)"}]
+ Endpoints = {None: 'iam.amazonaws.com'}
+
+class EuareRequest(Euca2oolsRequest):
+ ServiceClass = Euare
+ Args = [Arg('-U', '--url', route_to=CONNECTION,
+ help='EUARE service URL')] + STD_AUTH_ARGS
+
+ def parse_http_response(self, response_body):
+ response = Euca2oolsRequest.parse_http_response(self, response_body)
+ # EUARE responses enclose their useful data inside FooResponse
+ # elements. If that's all we have after stripping out ResponseMetadata
+ # then just return its contents.
+ useful_keys = filter(lambda x: x != 'ResponseMetadata',
+ response.keys())
+ if len(useful_keys) == 1:
+ return response[useful_keys[0]]
+ else:
+ return response
+
+DELEGATE = Arg('--delegate', dest='DelegateAccount', metavar='ACCOUNT',
+ help='''[Eucalyptus only] interpret this command as if the
+ administrator of a different account had run it (only
+ usable by cloud administrators)''')
diff --git a/euca2ools/commands/euare/addusertogroup.py b/euca2ools/commands/euare/addusertogroup.py
index 35d9e1d..5e0a933 100644
--- a/euca2ools/commands/euare/addusertogroup.py
+++ b/euca2ools/commands/euare/addusertogroup.py
@@ -1,6 +1,6 @@
# Software License Agreement (BSD License)
#
-# Copyright (c) 2009-2011, Eucalyptus Systems, Inc.
+# Copyright (c) 2009-2012, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms, with or
@@ -27,53 +27,14 @@
# 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 AddUserToGroup(AWSQueryRequest):
-
- ServiceClass = euca2ools.commands.euare.Euare
-
- Description = """AddUserToGroup"""
- Params = [
- Param(name='GroupName',
- short_name='g',
- long_name='group-name',
- ptype='string',
- optional=False,
- doc=""" Name of the group to update. """),
- Param(name='UserName',
- short_name='u',
- long_name='user-name',
- ptype='string',
- cardinality='+',
- optional=False,
- doc=""" Name of the User to add. """),
- 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 cli_formatter(self, data):
- pass
-
- def main(self, **args):
- data = []
- if self.cli_options and self.cli_options.user_name:
- for user_name in self.cli_options.user_name:
- data.append(self.send(user_name=user_name, **args))
- else:
- data = self.send(**args)
- return data
+from requestbuilder import Arg
+from . import EuareRequest, DELEGATE
- def main_cli(self):
- euca2ools.utils.print_version_if_necessary()
- self.do_cli()
+class AddUserToGroup(EuareRequest):
+ Description = 'Add a user to a group'
+ Args = [Arg('-g', '--group-name', dest='GroupName', required=True,
+ help='group to add the user to'),
+ Arg('-u', '--user-name', dest='UserName', required=True,
+ help='user to add'),
+ DELEGATE]
--
managing cloud instances for Eucalyptus
More information about the pkg-eucalyptus-commits
mailing list