aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorasteroide <thomas.duval@orange.com>2015-09-15 11:23:50 +0200
committerasteroide <thomas.duval@orange.com>2015-09-15 11:23:50 +0200
commitef481c3a12ea5ef8ff3caf6832ca54a6140cdd03 (patch)
treedaa8e7d1b4dfaec2be8b30d5eb876999496065fa
parent0c488612d6e33c5c03794d9858ace0d116b78fb4 (diff)
Correct all the subject commands.
Change-Id: I54b29c7cee95b39d55f5bd9a722d5a20f6e5d2e2
-rw-r--r--moonclient/moonclient/subjects.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/moonclient/moonclient/subjects.py b/moonclient/moonclient/subjects.py
index 21987907..69286343 100644
--- a/moonclient/moonclient/subjects.py
+++ b/moonclient/moonclient/subjects.py
@@ -28,11 +28,9 @@ class SubjectsList(Lister):
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subjects".format(parsed_args.intraextension),
authtoken=True)
- if "subjects" not in data:
- raise Exception("Error in command {}: {}".format("SubjectsList", data))
return (
- ("subjects",),
- ((_uuid, ) for _uuid in data["subjects"])
+ ("id", "name", "Keystone ID"),
+ ((_uuid, data[_uuid]["name"], data[_uuid]["keystone_id"]) for _uuid in data)
)
@@ -45,8 +43,8 @@ class SubjectsAdd(Command):
parser = super(SubjectsAdd, self).get_parser(prog_name)
parser.add_argument(
'subject',
- metavar='<subject-uuid>',
- help='Subject UUID',
+ metavar='<subject-name>',
+ help='Subject name',
)
parser.add_argument(
'--intraextension',
@@ -59,13 +57,11 @@ class SubjectsAdd(Command):
if not parsed_args.intraextension:
parsed_args.intraextension = self.app.intraextension
data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subjects".format(parsed_args.intraextension),
- post_data={"subject_id": parsed_args.subject},
+ post_data={"subject_name": parsed_args.subject},
authtoken=True)
- if "subjects" not in data:
- raise Exception("Error in command {}".format(data))
return (
- ("subjects",),
- ((_uuid, ) for _uuid in data["subjects"])
+ ("id", "name", "Keystone ID"),
+ ((_uuid, data[_uuid]["name"], data[_uuid]["keystone_id"]) for _uuid in data)
)