Add deprecation warnings to magnum client commands
In order to enforce the transition to the new OpenStack client, added deprecation warnings to the magnum cluster-list, cluster-show, cluster-update, cluster-delete, cluster-config, cluster-create, cluster-template-list, cluster-template-show, cluster-template-create, cluster-template-delete, cluster-template-update, ca-sign, ca-rotate, ca-show and stats-list, commands. Change-Id: I0103f686e0feb4dad4173ba7aa00768c8e25440d Partially-Implements: blueprint deprecate-magnum-client
This commit is contained in:
parent
35cef6ab75
commit
05ccd7f5fc
@ -50,6 +50,10 @@ CLUSTER_DEPRECATION_HELP = DEPRECATION_BASE % ('', 'cluster', 'cluster',
|
||||
CLUSTER_DEPRECATION_WARNING = DEPRECATION_BASE % (
|
||||
'WARNING: ', 'cluster', 'cluster', 'to avoid seeing this message')
|
||||
|
||||
MAGNUM_CLIENT_DEPRECATION_WARNING = (
|
||||
'WARNING: The magnum client is deprecated and will be removed in a future '
|
||||
'release.\nUse the OpenStack client to avoid seeing this message.')
|
||||
|
||||
|
||||
def deprecation_message(preamble, new_name):
|
||||
msg = ('%s This parameter is deprecated and will be removed in a future '
|
||||
|
@ -53,6 +53,7 @@ def _get_target_uuid(cs, args):
|
||||
default=None,
|
||||
help=(_('ID or name of the cluster. %s') %
|
||||
utils.CLUSTER_DEPRECATION_HELP))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_ca_show(cs, args):
|
||||
"""Show details about the CA certificate for a bay or cluster."""
|
||||
utils.validate_cluster_args(args.postional_cluster, args.cluster)
|
||||
@ -77,6 +78,7 @@ def do_ca_show(cs, args):
|
||||
required=False,
|
||||
metavar='<cluster>',
|
||||
help=_('ID or name of the cluster.'))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_ca_sign(cs, args):
|
||||
"""Generate the CA certificate for a bay or cluster."""
|
||||
opts = {
|
||||
@ -98,6 +100,7 @@ def do_ca_sign(cs, args):
|
||||
required=True,
|
||||
metavar='<cluster>',
|
||||
help=_('ID or name of the cluster.'))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_ca_rotate(cs, args):
|
||||
"""Rotate the CA certificate for a bay or cluster to revoke access."""
|
||||
cluster = cs.clusters.get(args.cluster)
|
||||
|
@ -187,6 +187,7 @@ def _show_cluster_template(cluster_template):
|
||||
@utils.arg('--insecure-registry',
|
||||
metavar='<insecure-registry>',
|
||||
help='url of docker registry')
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_cluster_template_create(cs, args):
|
||||
"""Create a cluster template."""
|
||||
args.command = 'cluster-template-create'
|
||||
@ -235,6 +236,7 @@ def do_cluster_template_create(cs, args):
|
||||
metavar='<cluster_templates>',
|
||||
nargs='+',
|
||||
help=_('ID or name of the (cluster template)s to delete.'))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_cluster_template_delete(cs, args):
|
||||
"""Delete specified cluster template."""
|
||||
for cluster_template in args.cluster_templates:
|
||||
@ -251,6 +253,7 @@ def do_cluster_template_delete(cs, args):
|
||||
@utils.arg('cluster_template',
|
||||
metavar='<cluster_template>',
|
||||
help=_('ID or name of the cluster template to show.'))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_cluster_template_show(cs, args):
|
||||
"""Show details about the given cluster template."""
|
||||
cluster_template = cs.cluster_templates.get(args.cluster_template)
|
||||
@ -280,6 +283,7 @@ def do_cluster_template_show(cs, args):
|
||||
action='store_true', default=False,
|
||||
help=_('Show detailed information about the cluster templates.')
|
||||
)
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_cluster_template_list(cs, args):
|
||||
"""Print a list of cluster templates."""
|
||||
nodes = cs.cluster_templates.list(limit=args.limit,
|
||||
@ -314,6 +318,7 @@ def do_cluster_template_list(cs, args):
|
||||
default=[],
|
||||
help=_("Attributes to add/replace or remove "
|
||||
"(only PATH is necessary on remove)"))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_cluster_template_update(cs, args):
|
||||
"""Updates one or more cluster template attributes."""
|
||||
patch = magnum_utils.args_array_to_patch(args.op, args.attributes[0])
|
||||
|
@ -57,6 +57,7 @@ def _show_cluster(cluster):
|
||||
'create_timeout'
|
||||
)
|
||||
)
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_cluster_list(cs, args):
|
||||
"""Print a list of available clusters."""
|
||||
clusters = cs.clusters.list(marker=args.marker, limit=args.limit,
|
||||
@ -129,6 +130,7 @@ def do_cluster_list(cs, args):
|
||||
default=60,
|
||||
help=_('The timeout for cluster creation in minutes. The default '
|
||||
'is 60 minutes.'))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_cluster_create(cs, args):
|
||||
"""Create a cluster."""
|
||||
args.command = 'cluster-create'
|
||||
@ -166,6 +168,7 @@ def do_cluster_create(cs, args):
|
||||
metavar='<cluster>',
|
||||
nargs='+',
|
||||
help=_('ID or name of the (cluster)s to delete.'))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_cluster_delete(cs, args):
|
||||
"""Delete specified cluster."""
|
||||
for id in args.cluster:
|
||||
@ -184,6 +187,7 @@ def do_cluster_delete(cs, args):
|
||||
@utils.arg('--long',
|
||||
action='store_true', default=False,
|
||||
help=_('Display extra associated cluster template info.'))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_cluster_show(cs, args):
|
||||
"""Show details about the given cluster."""
|
||||
cluster = cs.clusters.get(args.cluster)
|
||||
@ -216,6 +220,7 @@ def do_cluster_show(cs, args):
|
||||
default=[],
|
||||
help=_("Attributes to add/replace or remove "
|
||||
"(only PATH is necessary on remove)"))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_cluster_update(cs, args):
|
||||
"""Update information about the given cluster."""
|
||||
if args.rollback and args.magnum_api_version and \
|
||||
@ -246,6 +251,7 @@ def do_cluster_update(cs, args):
|
||||
@utils.arg('--force',
|
||||
action='store_true', default=False,
|
||||
help=_('Overwrite files if existing.'))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_cluster_config(cs, args):
|
||||
"""Configure native client to access cluster.
|
||||
|
||||
|
@ -18,6 +18,7 @@ from magnumclient.i18n import _
|
||||
required=False,
|
||||
metavar='<project-id>',
|
||||
help=_('Project ID'))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_stats_list(cs, args):
|
||||
"""Show stats for the given project_id"""
|
||||
opts = {
|
||||
|
Loading…
Reference in New Issue
Block a user