Add job-binary-data-create to CLI
The /job-binary-internals endpoint is used to store data in an internal Savanna data store for later retrieval when a job is run. It should only be used when Swift is not available. Implements: blueprint python-savannaclient-cli Change-Id: I8bb7ca72b3e3009a531cc06d20c2c70414c0ddde
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import inspect
|
||||
import json
|
||||
from savannaclient.nova import utils
|
||||
@@ -489,6 +490,22 @@ def do_job_binary_data_list(cs, args):
|
||||
_show_job_binary_data(cs.job_binary_internals.list())
|
||||
|
||||
|
||||
@utils.arg('--file',
|
||||
default=sys.stdin,
|
||||
type=argparse.FileType('r'),
|
||||
help='Data to store')
|
||||
def do_job_binary_data_create(cs, args):
|
||||
"""Store data in Savanna's internal DB.
|
||||
Use 'swift upload' instead of this command.
|
||||
Use this command only if Swift is not available.
|
||||
"""
|
||||
# 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'),
|
||||
args.file.read()),)
|
||||
)
|
||||
|
||||
|
||||
@utils.arg('--id',
|
||||
required=True,
|
||||
help='Id of internally stored job binary data')
|
||||
|
||||
Reference in New Issue
Block a user