Browse Source

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
tags/2.10.0
Daniel Abad 1 year ago
parent
commit
05ccd7f5fc

+ 4
- 0
magnumclient/common/cliutils.py View File

@@ -50,6 +50,10 @@ CLUSTER_DEPRECATION_HELP = DEPRECATION_BASE % ('', 'cluster', 'cluster',
50 50
 CLUSTER_DEPRECATION_WARNING = DEPRECATION_BASE % (
51 51
     'WARNING: ', 'cluster', 'cluster', 'to avoid seeing this message')
52 52
 
53
+MAGNUM_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
 
54 58
 def deprecation_message(preamble, new_name):
55 59
     msg = ('%s This parameter is deprecated and will be removed in a future '

+ 3
- 0
magnumclient/v1/certificates_shell.py View File

@@ -53,6 +53,7 @@ def _get_target_uuid(cs, args):
53 53
            default=None,
54 54
            help=(_('ID or name of the cluster. %s') %
55 55
                  utils.CLUSTER_DEPRECATION_HELP))
56
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
56 57
 def do_ca_show(cs, args):
57 58
     """Show details about the CA certificate for a bay or cluster."""
58 59
     utils.validate_cluster_args(args.postional_cluster, args.cluster)
@@ -77,6 +78,7 @@ def do_ca_show(cs, args):
77 78
            required=False,
78 79
            metavar='<cluster>',
79 80
            help=_('ID or name of the cluster.'))
81
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
80 82
 def do_ca_sign(cs, args):
81 83
     """Generate the CA certificate for a bay or cluster."""
82 84
     opts = {
@@ -98,6 +100,7 @@ def do_ca_sign(cs, args):
98 100
            required=True,
99 101
            metavar='<cluster>',
100 102
            help=_('ID or name of the cluster.'))
103
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
101 104
 def do_ca_rotate(cs, args):
102 105
     """Rotate the CA certificate for a bay or cluster to revoke access."""
103 106
     cluster = cs.clusters.get(args.cluster)

+ 5
- 0
magnumclient/v1/cluster_templates_shell.py View File

@@ -187,6 +187,7 @@ def _show_cluster_template(cluster_template):
187 187
 @utils.arg('--insecure-registry',
188 188
            metavar='<insecure-registry>',
189 189
            help='url of docker registry')
190
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
190 191
 def do_cluster_template_create(cs, args):
191 192
     """Create a cluster template."""
192 193
     args.command = 'cluster-template-create'
@@ -235,6 +236,7 @@ def do_cluster_template_create(cs, args):
235 236
            metavar='<cluster_templates>',
236 237
            nargs='+',
237 238
            help=_('ID or name of the (cluster template)s to delete.'))
239
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
238 240
 def do_cluster_template_delete(cs, args):
239 241
     """Delete specified cluster template."""
240 242
     for cluster_template in args.cluster_templates:
@@ -251,6 +253,7 @@ def do_cluster_template_delete(cs, args):
251 253
 @utils.arg('cluster_template',
252 254
            metavar='<cluster_template>',
253 255
            help=_('ID or name of the cluster template to show.'))
256
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
254 257
 def do_cluster_template_show(cs, args):
255 258
     """Show details about the given cluster template."""
256 259
     cluster_template = cs.cluster_templates.get(args.cluster_template)
@@ -280,6 +283,7 @@ def do_cluster_template_show(cs, args):
280 283
            action='store_true', default=False,
281 284
            help=_('Show detailed information about the cluster templates.')
282 285
            )
286
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
283 287
 def do_cluster_template_list(cs, args):
284 288
     """Print a list of cluster templates."""
285 289
     nodes = cs.cluster_templates.list(limit=args.limit,
@@ -314,6 +318,7 @@ def do_cluster_template_list(cs, args):
314 318
     default=[],
315 319
     help=_("Attributes to add/replace or remove "
316 320
            "(only PATH is necessary on remove)"))
321
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
317 322
 def do_cluster_template_update(cs, args):
318 323
     """Updates one or more cluster template attributes."""
319 324
     patch = magnum_utils.args_array_to_patch(args.op, args.attributes[0])

+ 6
- 0
magnumclient/v1/clusters_shell.py View File

@@ -57,6 +57,7 @@ def _show_cluster(cluster):
57 57
                   'create_timeout'
58 58
                   )
59 59
            )
60
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
60 61
 def do_cluster_list(cs, args):
61 62
     """Print a list of available clusters."""
62 63
     clusters = cs.clusters.list(marker=args.marker, limit=args.limit,
@@ -129,6 +130,7 @@ def do_cluster_list(cs, args):
129 130
            default=60,
130 131
            help=_('The timeout for cluster creation in minutes. The default '
131 132
                   'is 60 minutes.'))
133
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
132 134
 def do_cluster_create(cs, args):
133 135
     """Create a cluster."""
134 136
     args.command = 'cluster-create'
@@ -166,6 +168,7 @@ def do_cluster_create(cs, args):
166 168
            metavar='<cluster>',
167 169
            nargs='+',
168 170
            help=_('ID or name of the (cluster)s to delete.'))
171
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
169 172
 def do_cluster_delete(cs, args):
170 173
     """Delete specified cluster."""
171 174
     for id in args.cluster:
@@ -184,6 +187,7 @@ def do_cluster_delete(cs, args):
184 187
 @utils.arg('--long',
185 188
            action='store_true', default=False,
186 189
            help=_('Display extra associated cluster template info.'))
190
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
187 191
 def do_cluster_show(cs, args):
188 192
     """Show details about the given cluster."""
189 193
     cluster = cs.clusters.get(args.cluster)
@@ -216,6 +220,7 @@ def do_cluster_show(cs, args):
216 220
     default=[],
217 221
     help=_("Attributes to add/replace or remove "
218 222
            "(only PATH is necessary on remove)"))
223
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
219 224
 def do_cluster_update(cs, args):
220 225
     """Update information about the given cluster."""
221 226
     if args.rollback and args.magnum_api_version and \
@@ -246,6 +251,7 @@ def do_cluster_update(cs, args):
246 251
 @utils.arg('--force',
247 252
            action='store_true', default=False,
248 253
            help=_('Overwrite files if existing.'))
254
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
249 255
 def do_cluster_config(cs, args):
250 256
     """Configure native client to access cluster.
251 257
 

+ 1
- 0
magnumclient/v1/stats_shell.py View File

@@ -18,6 +18,7 @@ from magnumclient.i18n import _
18 18
            required=False,
19 19
            metavar='<project-id>',
20 20
            help=_('Project ID'))
21
+@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
21 22
 def do_stats_list(cs, args):
22 23
     """Show stats for the given project_id"""
23 24
     opts = {

Loading…
Cancel
Save