Skip to content

Commit 17678c9

Browse files
committed
Restore behavior of image create with same name.
With 60e7c51 the behaviour of `openstack image create` changed so that you can't create an image with the same name. This patch restores the previous functionality. Story: 2008229 Task: 41069 Change-Id: Ia0f4920371a918e94d1ccf9fcfcbf90ff885a455
1 parent 098a3fe commit 17678c9

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

openstackclient/image/v2/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def take_action(self, parsed_args):
354354

355355
# Build an attribute dict from the parsed args, only include
356356
# attributes that were actually set on the command line
357-
kwargs = {}
357+
kwargs = {'allow_duplicates': True}
358358
copy_attrs = ('name', 'id',
359359
'container_format', 'disk_format',
360360
'min_disk', 'min_ram', 'tags', 'visibility')

openstackclient/tests/unit/image/v2/test_image.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def test_image_reserve_no_options(self, raw_input):
100100
# ImageManager.create(name=, **)
101101
self.client.create_image.assert_called_with(
102102
name=self.new_image.name,
103+
allow_duplicates=True,
103104
container_format=image.DEFAULT_CONTAINER_FORMAT,
104105
disk_format=image.DEFAULT_DISK_FORMAT,
105106
)
@@ -152,6 +153,7 @@ def test_image_reserve_options(self, raw_input):
152153
# ImageManager.create(name=, **)
153154
self.client.create_image.assert_called_with(
154155
name=self.new_image.name,
156+
allow_duplicates=True,
155157
container_format='ovf',
156158
disk_format='ami',
157159
min_disk=10,
@@ -239,14 +241,15 @@ def test_image_create_file(self):
239241
# ImageManager.create(name=, **)
240242
self.client.create_image.assert_called_with(
241243
name=self.new_image.name,
244+
allow_duplicates=True,
242245
container_format=image.DEFAULT_CONTAINER_FORMAT,
243246
disk_format=image.DEFAULT_DISK_FORMAT,
244247
is_protected=self.new_image.is_protected,
245248
visibility=self.new_image.visibility,
246249
Alpha='1',
247250
Beta='2',
248251
tags=self.new_image.tags,
249-
filename=imagefile.name
252+
filename=imagefile.name,
250253
)
251254

252255
self.assertEqual(
@@ -288,6 +291,7 @@ def test_image_create_import(self, raw_input):
288291
# ImageManager.create(name=, **)
289292
self.client.create_image.assert_called_with(
290293
name=self.new_image.name,
294+
allow_duplicates=True,
291295
container_format=image.DEFAULT_CONTAINER_FORMAT,
292296
disk_format=image.DEFAULT_DISK_FORMAT,
293297
use_import=True
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes default behaviour of `openstack image create` in allowing images
5+
with the same name. In version 5.2.0 this changed to not allow
6+
duplicates by default.

0 commit comments

Comments
 (0)