diff options
author | Ruan HE <ruan.he@orange.com> | 2015-09-24 09:29:08 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-09-24 09:29:08 +0000 |
commit | 6309a9cc4e84a93c5d29bd2acde019f659bc9c22 (patch) | |
tree | 587044597c818ac940f664125ac81f89a3c7d209 /moonclient | |
parent | 69ff6e3d1bbdd1ecb094344a0894bd8d100947d0 (diff) | |
parent | 0fddb81961d1a5fc671953c79448a9f51f151dca (diff) |
Merge "Create user in Keystone database when needed."
Diffstat (limited to 'moonclient')
-rw-r--r-- | moonclient/moonclient/subjects.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/moonclient/moonclient/subjects.py b/moonclient/moonclient/subjects.py index 6eebcfb8..29ce745d 100644 --- a/moonclient/moonclient/subjects.py +++ b/moonclient/moonclient/subjects.py @@ -7,6 +7,7 @@ import logging from cliff.lister import Lister from cliff.command import Command +import getpass class SubjectsList(Lister): @@ -56,15 +57,29 @@ class SubjectsAdd(Command): metavar='<description-str>', help='Subject description', ) + parser.add_argument( + '--password', + metavar='<password-str>', + help='Password for subject (if not given, user will be prompted for one)', + ) + parser.add_argument( + '--email', + metavar='<email-str>', + help='Email for the user', + ) return parser def take_action(self, parsed_args): if not parsed_args.intraextension: parsed_args.intraextension = self.app.intraextension + if not parsed_args.password: + parsed_args.password = getpass.getpass("Password for user {}:".format(parsed_args.subject_name)) data = self.app.get_url("/v3/OS-MOON/intra_extensions/{}/subjects".format(parsed_args.intraextension), post_data={ "subject_name": parsed_args.subject_name, - "subject_description": parsed_args.description + "subject_description": parsed_args.description, + "subject_password": parsed_args.password, + "subject_email": parsed_args.email }, authtoken=True) return ( |