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


The following commit has been merged in the master branch:
commit c879244e686486a2f564f83c9d6a2c53cdc64fb7
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Mon Feb 18 23:02:39 2013 -0800

    Port PutAccountPolicy

diff --git a/bin/euare-accountuploadpolicy b/bin/euare-accountuploadpolicy
index f8487b6..4b820c2 100755
--- a/bin/euare-accountuploadpolicy
+++ b/bin/euare-accountuploadpolicy
@@ -1,7 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import euca2ools.commands.euare.putaccountpolicy
 
 if __name__ == '__main__':
-    r = euca2ools.commands.euare.putaccountpolicy.PutAccountPolicy()
-    r.main_cli()
+    euca2ools.commands.euare.putaccountpolicy.PutAccountPolicy.run()
diff --git a/euca2ools/commands/euare/putaccountpolicy.py b/euca2ools/commands/euare/putaccountpolicy.py
index 2cd7b6c..0bc23f7 100644
--- a/euca2ools/commands/euare/putaccountpolicy.py
+++ b/euca2ools/commands/euare/putaccountpolicy.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,57 +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 PutAccountPolicy(AWSQueryRequest):
-
-    ServiceClass = euca2ools.commands.euare.Euare
-
-    Description = """PutAccountPolicy"""
-    Params = [Param(
-        name='AccountName',
-        short_name='a',
-        long_name='account-name',
-        ptype='string',
-        optional=False,
-        doc=""" Name of the account to associate the policy with. """,
-        ), Param(
-        name='PolicyName',
-        short_name='p',
-        long_name='policy-name',
-        ptype='string',
-        optional=False,
-        doc=""" Name of the policy document. """,
-        ), Param(
-        name='PolicyDocument',
-        short_name='o',
-        long_name='policy-content',
-        ptype='string',
-        optional=True,
-        doc=""" The policy document content. """,
-        ), Param(
-        name='PolicyDocument',
-        short_name='f',
-        long_name='policy-document',
-        ptype='file',
-        optional=True,
-        doc=""" The policy document as file. """,
-        )]
-
-    def cli_formatter(self, data):
-        pass
-
-    def main(self, **args):
-        return self.send(**args)
 
-    def main_cli(self):
-        euca2ools.utils.print_version_if_necessary()
-        self.do_cli()
+from requestbuilder import Arg, MutuallyExclusiveArgList
+from . import EuareRequest
+
+
+class PutAccountPolicy(EuareRequest):
+    DESCRIPTION = ('[Eucalyptus only] Attach a policy to an account. This '
+                   'command is only usable by cloud administrators.')
+    ARGS = [Arg('-a', '--account-name', dest='AccountName', metavar='ACCOUNT',
+                required=True,
+                help='account to attach the policy to (required)'),
+            Arg('-p', '--policy-name', dest='PolicyName', metavar='POLICY',
+                required=True, help='name of the policy (required)'),
+            MutuallyExclusiveArgList(True,
+                Arg('-o', '--policy-content', dest='PolicyDocument',
+                    metavar='POLICY_CONTENT', help='the policy to attach'),
+                Arg('-f', '--policy-document', dest='PolicyDocument',
+                    metavar='FILE', type=open,
+                    help='file containing the policy to attach'))]

-- 
managing cloud instances for Eucalyptus



More information about the pkg-eucalyptus-commits mailing list