diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-04-21 13:16:49 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-04-21 13:16:49 +0000 |
commit | eede2e1f715a3cda9df9d70f6aec1c06de568109 (patch) | |
tree | d974f4463032759c673dc084427db3114730ee59 /saharaclient/api/shell.py | |
parent | 163f6e8d0470eefe4bb61284f8c7c5bbda6452c5 (diff) | |
parent | 67b4e76be82874cd9237efb846731729cd268b47 (diff) | |
download | python-saharaclient-eede2e1f715a3cda9df9d70f6aec1c06de568109.tar.gz |
Merge "add --name option to assign name to job-binary-internal"0.9.0
Diffstat (limited to 'saharaclient/api/shell.py')
-rw-r--r-- | saharaclient/api/shell.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/saharaclient/api/shell.py b/saharaclient/api/shell.py index 057a10f..546cb5d 100644 --- a/saharaclient/api/shell.py +++ b/saharaclient/api/shell.py @@ -17,6 +17,7 @@ import argparse import datetime import inspect import json +import os.path import sys from saharaclient.openstack.common.apiclient import exceptions @@ -547,7 +548,7 @@ def do_data_source_delete(cs, args): # ~~~~~~~~~~~~~~~~~~~~ # job-binary-data-list # -# job-binary-data-create [--file <file>] +# job-binary-data-create [--file <file>] [--name <name>] # # job-binary-data-delete --id <id> # @@ -561,15 +562,23 @@ def do_job_binary_data_list(cs, args): default=sys.stdin, type=argparse.FileType('r'), help='Data to store.') +@utils.arg('--name', + help="Name of the job binary internal.") def do_job_binary_data_create(cs, args): """Store data in the internal DB. Use 'swift upload' instead of this command. Use this command only if Swift is not available. """ + if args.name: + name = args.name + elif args.file is not sys.stdin: + name = os.path.basename(args.file.name) + else: + name = datetime.datetime.now().strftime('d%Y%m%d%H%M%S') # Should be %F-%T except for type validation errors _show_job_binary_data((cs.job_binary_internals.create( - datetime.datetime.now().strftime('d%Y%m%d%H%M%S'), + name, args.file.read()),) ) |