From 0fddb81961d1a5fc671953c79448a9f51f151dca Mon Sep 17 00:00:00 2001 From: asteroide Date: Thu, 24 Sep 2015 11:21:23 +0200 Subject: Create user in Keystone database when needed. Change-Id: Ie898bd663e572785bd98b4d9143caa6a9bc5cead --- moonclient/moonclient/subjects.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'moonclient') 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='', help='Subject description', ) + parser.add_argument( + '--password', + metavar='', + help='Password for subject (if not given, user will be prompted for one)', + ) + parser.add_argument( + '--email', + metavar='', + 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 ( -- cgit 1.2.3-korg