aboutsummaryrefslogtreecommitdiffstats
path: root/moonclient
diff options
context:
space:
mode:
authorasteroide <thomas.duval@orange.com>2015-09-16 10:43:33 +0200
committerasteroide <thomas.duval@orange.com>2015-09-16 10:43:33 +0200
commit1fb10be977b5de6d2f0d77714da3a83e4da7885d (patch)
treed7a33f431e24369b2d8ba122f2eff34a447bb0ee /moonclient
parentabe028e7984be2d7f9dff7aabe461cc82a3b60c0 (diff)
Correct all the action commands.
Change-Id: Ife449552171a995b36c168fa516428b0d7c4058e
Diffstat (limited to 'moonclient')
-rw-r--r--moonclient/moonclient/actions.py28
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)
)