aboutsummaryrefslogtreecommitdiffstats
path: root/moonclient
diff options
context:
space:
mode:
authorRuan HE <ruan.he@orange.com>2015-09-15 09:25:06 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2015-09-15 09:25:06 +0000
commit04c559f97556fd03054b2cfc835f0628bed6740c (patch)
tree301c8b84228a23567b122bb80d065e4d5978f7dd /moonclient
parente6342366f5141ca5da775d5dc1a6b68af012caad (diff)
parentef481c3a12ea5ef8ff3caf6832ca54a6140cdd03 (diff)
Merge "Correct all the subject commands."
Diffstat (limited to 'moonclient')
-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)
)