Add upload workbook definition
* Added ability to upload workbook definition using one command - workbook-create * Fix some error messages Partially implements blueprint mistral-cli-enhancements Change-Id: I387d8c6c9aae03d59e779128c5e0d1f8fd8d6ea6
This commit is contained in:
parent
f403e29d5c
commit
9cb1ce4984
@ -79,7 +79,8 @@ class Client(object):
|
|||||||
|
|
||||||
if "v2.0" in auth_url:
|
if "v2.0" in auth_url:
|
||||||
raise RuntimeError('Mistral supports only v3 '
|
raise RuntimeError('Mistral supports only v3 '
|
||||||
'keystone API.')
|
'keystone API. Please see help and '
|
||||||
|
'configure the correct auth url.')
|
||||||
|
|
||||||
keystone = keystone_client.Client(username=username,
|
keystone = keystone_client.Client(username=username,
|
||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
|
@ -88,8 +88,14 @@ class Create(ShowCommand):
|
|||||||
help='Workbook description')
|
help='Workbook description')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'tags',
|
'tags',
|
||||||
nargs='*',
|
nargs='?',
|
||||||
help='Workbook tags')
|
help='Workbook tags separated by ","')
|
||||||
|
parser.add_argument(
|
||||||
|
'definition',
|
||||||
|
nargs='?',
|
||||||
|
type=argparse.FileType('r'),
|
||||||
|
help='Workbook definition file'
|
||||||
|
)
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -97,7 +103,12 @@ class Create(ShowCommand):
|
|||||||
workbook = WorkbookManager(self.app.client)\
|
workbook = WorkbookManager(self.app.client)\
|
||||||
.create(parsed_args.name,
|
.create(parsed_args.name,
|
||||||
parsed_args.description,
|
parsed_args.description,
|
||||||
parsed_args.tags)
|
str(parsed_args.tags).split(','))
|
||||||
|
|
||||||
|
if parsed_args.definition:
|
||||||
|
WorkbookManager(self.app.client)\
|
||||||
|
.upload_definition(parsed_args.name,
|
||||||
|
parsed_args.definition.read())
|
||||||
|
|
||||||
return format(workbook)
|
return format(workbook)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user