diff options
author | asteroide <thomas.duval@orange.com> | 2015-09-24 11:21:23 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2015-09-24 11:21:23 +0200 |
commit | 0fddb81961d1a5fc671953c79448a9f51f151dca (patch) | |
tree | 0051fe0de41c0bd1481b14cb7969a9e20e6b7f12 /moonclient | |
parent | e35decd4e989773c96a9abb263257291bd51ae1e (diff) |
Create user in Keystone database when needed.
Change-Id: Ie898bd663e572785bd98b4d9143caa6a9bc5cead
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 ( |