Skip to content

Commit 34f431b

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "compute: Fix flavor create --id auto"
2 parents a312e9c + 5feaa95 commit 34f431b

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

openstackclient/compute/v2/flavor.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,25 @@ def take_action(self, parsed_args):
156156
msg = _("--project is only allowed with --private")
157157
raise exceptions.CommandError(msg)
158158

159+
flavor_id = parsed_args.id
160+
if parsed_args.id == 'auto':
161+
# novaclient aliased 'auto' to mean "generate a UUID for me": we
162+
# do the same to avoid breaking existing users
163+
flavor_id = None
164+
165+
msg = _(
166+
"Passing '--id auto' is deprecated. Nova will automatically "
167+
"assign a UUID-like ID if no ID is provided. Omit the '--id' "
168+
"parameter instead."
169+
)
170+
self.log.warning(msg)
171+
159172
args = {
160173
'name': parsed_args.name,
161174
'ram': parsed_args.ram,
162175
'vcpus': parsed_args.vcpus,
163176
'disk': parsed_args.disk,
164-
'id': parsed_args.id,
177+
'id': flavor_id,
165178
'ephemeral': parsed_args.ephemeral,
166179
'swap': parsed_args.swap,
167180
'rxtx_factor': parsed_args.rxtx_factor,

openstackclient/tests/unit/compute/v2/test_flavor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def test_flavor_create_other_options(self):
247247
'ram': self.flavor.ram,
248248
'vcpus': self.flavor.vcpus,
249249
'disk': self.flavor.disk,
250-
'id': 'auto',
250+
'id': None,
251251
'ephemeral': self.flavor.ephemeral,
252252
'swap': self.flavor.swap,
253253
'rxtx_factor': self.flavor.rxtx_factor,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
deprecations:
3+
- |
4+
The ``--id auto`` alias for the ``flavor create`` command is deprecated
5+
for removal. Omit the option entirely to ensure the server creates the
6+
ID for you.

0 commit comments

Comments
 (0)