X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=client%2Fescalatorclient%2Fv1%2Fshell.py;h=401ad76adcfeef68ac840692b0d927a595520603;hb=c1783221873845d072b739c7ebd8d0a75fe00bb9;hp=9f9ea4f0539a0b198a80c9c616f31112a67dc132;hpb=3f262284f3ce78ce23b4e3c8e9fed112fc56e37d;p=escalator.git diff --git a/client/escalatorclient/v1/shell.py b/client/escalatorclient/v1/shell.py index 9f9ea4f..401ad76 100644 --- a/client/escalatorclient/v1/shell.py +++ b/client/escalatorclient/v1/shell.py @@ -17,15 +17,9 @@ from __future__ import print_function import copy import functools -import pprint -import os -import json - -from oslo_utils import encodeutils from oslo_utils import strutils import escalatorclient.v1.versions from escalatorclient.common import utils -from escalatorclient import exc _bool_strict = functools.partial(strutils.bool_from_string, strict=True) @@ -47,96 +41,12 @@ def do_version(dc, args): fields = dict(filter(lambda x: x[1] is not None, vars(args).items())) # Filter out values we can't use - VERSION_PARAMS = escalatorclient.v1.version.VERSION_PARAMS + VERSION_PARAMS = escalatorclient.v1.versions.VERSION_PARAMS fields = dict(filter(lambda x: x[0] in VERSION_PARAMS, fields.items())) - version = dc.version.version(**fields) - _escalator_show(version) - - -@utils.arg('id', metavar='', - help='Filter version to those that have this id.') -def do_version_detail(dc, args): - """Get backend_types of escalator.""" - version = utils.find_resource(dc.versions, args.id) + version = dc.versions.version(**fields) _escalator_show(version) -@utils.arg('name', metavar='', - help='name of version.') -@utils.arg('type', metavar='', - help='version type.eg redhat7.0...') -@utils.arg('--size', metavar='', - help='size of the version file.') -@utils.arg('--checksum', metavar='', - help='md5 of version file') -@utils.arg('--version', metavar='', - help='version number of version file') -@utils.arg('--description', metavar='', - help='description of version file') -@utils.arg('--status', metavar='', - help='version file status.default:init') -def do_version_add(dc, args): - """Add a version.""" - - fields = dict(filter(lambda x: x[1] is not None, vars(args).items())) - - # Filter out values we can't use - CREATE_PARAMS = escalatorclient.v1.versions.CREATE_PARAMS - fields = dict(filter(lambda x: x[0] in CREATE_PARAMS, fields.items())) - - version = dc.versions.add(**fields) - _escalator_show(version) - - -@utils.arg('id', metavar='', - help='ID of versions.') -@utils.arg('--name', metavar='', - help='name of version.') -@utils.arg('--type', metavar='', - help='version type.eg redhat7.0...') -@utils.arg('--size', metavar='', - help='size of the version file.') -@utils.arg('--checksum', metavar='', - help='md5 of version file') -@utils.arg('--version', metavar='', - help='version number of version file') -@utils.arg('--description', metavar='', - help='description of version file') -@utils.arg('--status', metavar='', - help='version file status.default:init') -def do_version_update(dc, args): - """Add a version.""" - - fields = dict(filter(lambda x: x[1] is not None, vars(args).items())) - - # Filter out values we can't use - CREATE_PARAMS = escalatorclient.v1.versions.CREATE_PARAMS - fields = dict(filter(lambda x: x[0] in CREATE_PARAMS, fields.items())) - version_id = fields.get('id', None) - version = dc.versions.update(version_id, **fields) - _escalator_show(version) - - -@utils.arg('id', metavar='', nargs='+', - help='ID of versions.') -def do_version_delete(dc, args): - """Delete specified template(s).""" - fields = dict(filter(lambda x: x[1] is not None, vars(args).items())) - versions = fields.get('id', None) - for version in versions: - try: - if args.verbose: - print('Requesting version delete for %s ...' % - encodeutils.safe_decode(version), end=' ') - dc.versions.delete(version) - if args.verbose: - print('[Done]') - except exc.HTTPException as e: - if args.verbose: - print('[Fail]') - print('%s: Unable to delete version %s' % (e, version)) - - @utils.arg('--name', metavar='', help='Filter version to those that have this name.') @utils.arg('--status', metavar='', @@ -153,7 +63,7 @@ def do_version_delete(dc, args): @utils.arg('--sort-dir', default='asc', choices=escalatorclient.v1.versions.SORT_DIR_VALUES, help='Sort version list in specified direction.') -def do_version_list(dc, args): +def do_cluster_version_list(dc, args): """List hosts you can access.""" filter_keys = ['name', 'type', 'status', 'version'] filter_items = [(key, getattr(args, key)) for key in filter_keys] @@ -172,11 +82,3 @@ def do_version_list(dc, args): 'checksum', 'description', 'status', 'VERSION_PATCH'] utils.print_list(versions, columns) - - -@utils.arg('id', metavar='', - help='Filter version patch to those that have this id.') -def do_version_patch_detail(dc, args): - """Get version_patch of escalator.""" - version = utils.find_resource(dc.version_patchs, args.id) - _escalator_show(version)