diff options
author | Ruan HE <ruan.he@orange.com> | 2015-09-16 08:57:54 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-09-16 08:57:54 +0000 |
commit | 0267f97ab0e5d5e13eeee18339d43e636f60564e (patch) | |
tree | b21eaee10d4a816c7802ba97f7fca39ffa478d38 /moonclient | |
parent | 451454bed17c832740f32cfd8235661e3f5390c3 (diff) | |
parent | 1fb10be977b5de6d2f0d77714da3a83e4da7885d (diff) |
Merge "Correct all the action commands."
Diffstat (limited to 'moonclient')
-rw-r--r-- | moonclient/moonclient/actions.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/moonclient/moonclient/actions.py b/moonclient/moonclient/actions.py index a35b6947..f5947b32 100644 --- a/moonclient/moonclient/actions.py +++ b/moonclient/moonclient/actions.py @@ -28,11 +28,9 @@ class ActionsList(Lister): parsed_args.intraextension = self.app.intraextension data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/actions".format(parsed_args.intraextension), authtoken=True) - if "actions" not in data: - raise Exception("Error in command {}: {}".format("ActionsList", data)) return ( - ("actions",), - ((_uuid, ) for _uuid in data["actions"]) + ("id", "name", "description"), + ((_uuid, data[_uuid]['name'], data[_uuid]['description']) for _uuid in data) ) @@ -44,28 +42,34 @@ class ActionsAdd(Command): def get_parser(self, prog_name): parser = super(ActionsAdd, self).get_parser(prog_name) parser.add_argument( - 'action', - metavar='<action-uuid>', - help='Action UUID', + 'action_name', + metavar='<action-name>', + help='Action name', ) parser.add_argument( '--intraextension', metavar='<intraextension-uuid>', help='IntraExtension UUID', ) + parser.add_argument( + '--description', + metavar='<description-str>', + help='Action description', + ) return parser def take_action(self, parsed_args): if not parsed_args.intraextension: parsed_args.intraextension = self.app.intraextension data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/actions".format(parsed_args.intraextension), - post_data={"action_id": parsed_args.action}, + post_data={ + "action_name": parsed_args.action_name, + "action_description": parsed_args.description, + }, authtoken=True) - if "actions" not in data: - raise Exception("Error in command {}".format(data)) return ( - ("actions",), - ((_uuid, ) for _uuid in data["actions"]) + ("id", "name", "description"), + ((_uuid, data[_uuid]['name'], data[_uuid]['description']) for _uuid in data) ) |