From 6f3969a0c8a608236a6f7258aa213c12af060a9d Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 21 Jan 2021 12:06:57 +0000 Subject: [PATCH] compute: Deprecate 'server create --file' The parameter isn't actually deprecated, since we need to support older API microversion, however, we now emit an error if someone attempts to boot a server with the wrong microversion. This would happen server-side anyway since this parameter was removed entirely in API microversion 2.57. Change-Id: I73864ccbf5bf181fecf505ca168c1a35a8b0af3a Signed-off-by: Stephen Finucane --- openstackclient/compute/v2/server.py | 12 +++++++++++- ...d-server-create-file-option-80246b13bd3c1b43.yaml | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/deprecated-server-create-file-option-80246b13bd3c1b43.yaml diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index 111c4a6b04..48f5b7cf16 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -989,8 +989,9 @@ class CreateServer(command.ShowOne): action='append', default=[], help=_( - 'File to inject into image before boot ' + 'File(s) to inject into image before boot ' '(repeat option to set multiple files)' + '(supported by --os-compute-api-version 2.57 or below)' ), ) parser.add_argument( @@ -1201,6 +1202,15 @@ class CreateServer(command.ShowOne): flavor = utils.find_resource( compute_client.flavors, parsed_args.flavor) + if parsed_args.file: + if compute_client.api_version >= api_versions.APIVersion('2.57'): + msg = _( + 'Personality files are deprecated and are not supported ' + 'for --os-compute-api-version greater than 2.56; use ' + 'user data instead' + ) + raise exceptions.CommandError(msg) + files = {} for f in parsed_args.file: dst, src = f.split('=', 1) diff --git a/releasenotes/notes/deprecated-server-create-file-option-80246b13bd3c1b43.yaml b/releasenotes/notes/deprecated-server-create-file-option-80246b13bd3c1b43.yaml new file mode 100644 index 0000000000..93de724461 --- /dev/null +++ b/releasenotes/notes/deprecated-server-create-file-option-80246b13bd3c1b43.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - | + The ``server create`` command will now error out if the ``--file`` option + is specified alongside ``--os-compute-api-version`` of ``2.57`` or greater. + This reflects the removal of this feature from the compute service in this + microversion.