summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Abad <d.abad@cern.ch>2018-02-26 12:34:06 +0000
committerDaniel Abad <d.abad@cern.ch>2018-02-27 12:24:35 +0000
commit05ccd7f5fc20adae89330971c7c0cca2a1e354bb (patch)
treea7915ff159a9b4a41fc1ebc302c2013ad6550a1c
parent35cef6ab758a6a5a6a980aa4dea95a41be285d17 (diff)
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
Notes
Notes (review): Code-Review+2: Spyros Trigazis (strigazi) <strigazi@gmail.com> Workflow+1: Spyros Trigazis (strigazi) <strigazi@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 27 Feb 2018 14:39:46 +0000 Reviewed-on: https://review.openstack.org/548019 Project: openstack/python-magnumclient Branch: refs/heads/master
-rw-r--r--magnumclient/common/cliutils.py4
-rw-r--r--magnumclient/v1/certificates_shell.py3
-rw-r--r--magnumclient/v1/cluster_templates_shell.py5
-rw-r--r--magnumclient/v1/clusters_shell.py6
-rw-r--r--magnumclient/v1/stats_shell.py1
5 files changed, 19 insertions, 0 deletions
diff --git a/magnumclient/common/cliutils.py b/magnumclient/common/cliutils.py
index 8db1cb1..34ab129 100644
--- a/magnumclient/common/cliutils.py
+++ b/magnumclient/common/cliutils.py
@@ -50,6 +50,10 @@ CLUSTER_DEPRECATION_HELP = DEPRECATION_BASE % ('', 'cluster', 'cluster',
50CLUSTER_DEPRECATION_WARNING = DEPRECATION_BASE % ( 50CLUSTER_DEPRECATION_WARNING = DEPRECATION_BASE % (
51 'WARNING: ', 'cluster', 'cluster', 'to avoid seeing this message') 51 'WARNING: ', 'cluster', 'cluster', 'to avoid seeing this message')
52 52
53MAGNUM_CLIENT_DEPRECATION_WARNING = (
54 'WARNING: The magnum client is deprecated and will be removed in a future '
55 'release.\nUse the OpenStack client to avoid seeing this message.')
56
53 57
54def deprecation_message(preamble, new_name): 58def deprecation_message(preamble, new_name):
55 msg = ('%s This parameter is deprecated and will be removed in a future ' 59 msg = ('%s This parameter is deprecated and will be removed in a future '
diff --git a/magnumclient/v1/certificates_shell.py b/magnumclient/v1/certificates_shell.py
index f953032..f73f643 100644
--- a/magnumclient/v1/certificates_shell.py
+++ b/magnumclient/v1/certificates_shell.py
@@ -53,6 +53,7 @@ def _get_target_uuid(cs, args):
53 default=None, 53 default=None,
54 help=(_('ID or name of the cluster. %s') % 54 help=(_('ID or name of the cluster. %s') %
55 utils.CLUSTER_DEPRECATION_HELP)) 55 utils.CLUSTER_DEPRECATION_HELP))
56@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
56def do_ca_show(cs, args): 57def do_ca_show(cs, args):
57 """Show details about the CA certificate for a bay or cluster.""" 58 """Show details about the CA certificate for a bay or cluster."""
58 utils.validate_cluster_args(args.postional_cluster, args.cluster) 59 utils.validate_cluster_args(args.postional_cluster, args.cluster)
@@ -77,6 +78,7 @@ def do_ca_show(cs, args):
77 required=False, 78 required=False,
78 metavar='<cluster>', 79 metavar='<cluster>',
79 help=_('ID or name of the cluster.')) 80 help=_('ID or name of the cluster.'))
81@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
80def do_ca_sign(cs, args): 82def do_ca_sign(cs, args):
81 """Generate the CA certificate for a bay or cluster.""" 83 """Generate the CA certificate for a bay or cluster."""
82 opts = { 84 opts = {
@@ -98,6 +100,7 @@ def do_ca_sign(cs, args):
98 required=True, 100 required=True,
99 metavar='<cluster>', 101 metavar='<cluster>',
100 help=_('ID or name of the cluster.')) 102 help=_('ID or name of the cluster.'))
103@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
101def do_ca_rotate(cs, args): 104def do_ca_rotate(cs, args):
102 """Rotate the CA certificate for a bay or cluster to revoke access.""" 105 """Rotate the CA certificate for a bay or cluster to revoke access."""
103 cluster = cs.clusters.get(args.cluster) 106 cluster = cs.clusters.get(args.cluster)
diff --git a/magnumclient/v1/cluster_templates_shell.py b/magnumclient/v1/cluster_templates_shell.py
index 16ea9fe..32a1aa5 100644
--- a/magnumclient/v1/cluster_templates_shell.py
+++ b/magnumclient/v1/cluster_templates_shell.py
@@ -187,6 +187,7 @@ def _show_cluster_template(cluster_template):
187@utils.arg('--insecure-registry', 187@utils.arg('--insecure-registry',
188 metavar='<insecure-registry>', 188 metavar='<insecure-registry>',
189 help='url of docker registry') 189 help='url of docker registry')
190@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
190def do_cluster_template_create(cs, args): 191def do_cluster_template_create(cs, args):
191 """Create a cluster template.""" 192 """Create a cluster template."""
192 args.command = 'cluster-template-create' 193 args.command = 'cluster-template-create'
@@ -235,6 +236,7 @@ def do_cluster_template_create(cs, args):
235 metavar='<cluster_templates>', 236 metavar='<cluster_templates>',
236 nargs='+', 237 nargs='+',
237 help=_('ID or name of the (cluster template)s to delete.')) 238 help=_('ID or name of the (cluster template)s to delete.'))
239@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
238def do_cluster_template_delete(cs, args): 240def do_cluster_template_delete(cs, args):
239 """Delete specified cluster template.""" 241 """Delete specified cluster template."""
240 for cluster_template in args.cluster_templates: 242 for cluster_template in args.cluster_templates:
@@ -251,6 +253,7 @@ def do_cluster_template_delete(cs, args):
251@utils.arg('cluster_template', 253@utils.arg('cluster_template',
252 metavar='<cluster_template>', 254 metavar='<cluster_template>',
253 help=_('ID or name of the cluster template to show.')) 255 help=_('ID or name of the cluster template to show.'))
256@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
254def do_cluster_template_show(cs, args): 257def do_cluster_template_show(cs, args):
255 """Show details about the given cluster template.""" 258 """Show details about the given cluster template."""
256 cluster_template = cs.cluster_templates.get(args.cluster_template) 259 cluster_template = cs.cluster_templates.get(args.cluster_template)
@@ -280,6 +283,7 @@ def do_cluster_template_show(cs, args):
280 action='store_true', default=False, 283 action='store_true', default=False,
281 help=_('Show detailed information about the cluster templates.') 284 help=_('Show detailed information about the cluster templates.')
282 ) 285 )
286@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
283def do_cluster_template_list(cs, args): 287def do_cluster_template_list(cs, args):
284 """Print a list of cluster templates.""" 288 """Print a list of cluster templates."""
285 nodes = cs.cluster_templates.list(limit=args.limit, 289 nodes = cs.cluster_templates.list(limit=args.limit,
@@ -314,6 +318,7 @@ def do_cluster_template_list(cs, args):
314 default=[], 318 default=[],
315 help=_("Attributes to add/replace or remove " 319 help=_("Attributes to add/replace or remove "
316 "(only PATH is necessary on remove)")) 320 "(only PATH is necessary on remove)"))
321@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
317def do_cluster_template_update(cs, args): 322def do_cluster_template_update(cs, args):
318 """Updates one or more cluster template attributes.""" 323 """Updates one or more cluster template attributes."""
319 patch = magnum_utils.args_array_to_patch(args.op, args.attributes[0]) 324 patch = magnum_utils.args_array_to_patch(args.op, args.attributes[0])
diff --git a/magnumclient/v1/clusters_shell.py b/magnumclient/v1/clusters_shell.py
index bbdb31b..81e77e7 100644
--- a/magnumclient/v1/clusters_shell.py
+++ b/magnumclient/v1/clusters_shell.py
@@ -57,6 +57,7 @@ def _show_cluster(cluster):
57 'create_timeout' 57 'create_timeout'
58 ) 58 )
59 ) 59 )
60@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
60def do_cluster_list(cs, args): 61def do_cluster_list(cs, args):
61 """Print a list of available clusters.""" 62 """Print a list of available clusters."""
62 clusters = cs.clusters.list(marker=args.marker, limit=args.limit, 63 clusters = cs.clusters.list(marker=args.marker, limit=args.limit,
@@ -129,6 +130,7 @@ def do_cluster_list(cs, args):
129 default=60, 130 default=60,
130 help=_('The timeout for cluster creation in minutes. The default ' 131 help=_('The timeout for cluster creation in minutes. The default '
131 'is 60 minutes.')) 132 'is 60 minutes.'))
133@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
132def do_cluster_create(cs, args): 134def do_cluster_create(cs, args):
133 """Create a cluster.""" 135 """Create a cluster."""
134 args.command = 'cluster-create' 136 args.command = 'cluster-create'
@@ -166,6 +168,7 @@ def do_cluster_create(cs, args):
166 metavar='<cluster>', 168 metavar='<cluster>',
167 nargs='+', 169 nargs='+',
168 help=_('ID or name of the (cluster)s to delete.')) 170 help=_('ID or name of the (cluster)s to delete.'))
171@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
169def do_cluster_delete(cs, args): 172def do_cluster_delete(cs, args):
170 """Delete specified cluster.""" 173 """Delete specified cluster."""
171 for id in args.cluster: 174 for id in args.cluster:
@@ -184,6 +187,7 @@ def do_cluster_delete(cs, args):
184@utils.arg('--long', 187@utils.arg('--long',
185 action='store_true', default=False, 188 action='store_true', default=False,
186 help=_('Display extra associated cluster template info.')) 189 help=_('Display extra associated cluster template info.'))
190@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
187def do_cluster_show(cs, args): 191def do_cluster_show(cs, args):
188 """Show details about the given cluster.""" 192 """Show details about the given cluster."""
189 cluster = cs.clusters.get(args.cluster) 193 cluster = cs.clusters.get(args.cluster)
@@ -216,6 +220,7 @@ def do_cluster_show(cs, args):
216 default=[], 220 default=[],
217 help=_("Attributes to add/replace or remove " 221 help=_("Attributes to add/replace or remove "
218 "(only PATH is necessary on remove)")) 222 "(only PATH is necessary on remove)"))
223@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
219def do_cluster_update(cs, args): 224def do_cluster_update(cs, args):
220 """Update information about the given cluster.""" 225 """Update information about the given cluster."""
221 if args.rollback and args.magnum_api_version and \ 226 if args.rollback and args.magnum_api_version and \
@@ -246,6 +251,7 @@ def do_cluster_update(cs, args):
246@utils.arg('--force', 251@utils.arg('--force',
247 action='store_true', default=False, 252 action='store_true', default=False,
248 help=_('Overwrite files if existing.')) 253 help=_('Overwrite files if existing.'))
254@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
249def do_cluster_config(cs, args): 255def do_cluster_config(cs, args):
250 """Configure native client to access cluster. 256 """Configure native client to access cluster.
251 257
diff --git a/magnumclient/v1/stats_shell.py b/magnumclient/v1/stats_shell.py
index a5f25d0..f70a3fd 100644
--- a/magnumclient/v1/stats_shell.py
+++ b/magnumclient/v1/stats_shell.py
@@ -18,6 +18,7 @@ from magnumclient.i18n import _
18 required=False, 18 required=False,
19 metavar='<project-id>', 19 metavar='<project-id>',
20 help=_('Project ID')) 20 help=_('Project ID'))
21@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
21def do_stats_list(cs, args): 22def do_stats_list(cs, args):
22 """Show stats for the given project_id""" 23 """Show stats for the given project_id"""
23 opts = { 24 opts = {