aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)
)