summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openstackclient/image/v2/image.py2
-rw-r--r--openstackclient/tests/unit/image/v2/test_image.py6
-rw-r--r--releasenotes/notes/restore-create-image-duplicates-92e06f64038b120c.yaml6
3 files changed, 12 insertions, 2 deletions
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py
index 029f57a3..4f3e9d0b 100644
--- a/openstackclient/image/v2/image.py
+++ b/openstackclient/image/v2/image.py
@@ -354,7 +354,7 @@ class CreateImage(command.ShowOne):
# Build an attribute dict from the parsed args, only include
# attributes that were actually set on the command line
- kwargs = {}
+ kwargs = {'allow_duplicates': True}
copy_attrs = ('name', 'id',
'container_format', 'disk_format',
'min_disk', 'min_ram', 'tags', 'visibility')
diff --git a/openstackclient/tests/unit/image/v2/test_image.py b/openstackclient/tests/unit/image/v2/test_image.py
index 310f6b76..b094817e 100644
--- a/openstackclient/tests/unit/image/v2/test_image.py
+++ b/openstackclient/tests/unit/image/v2/test_image.py
@@ -100,6 +100,7 @@ class TestImageCreate(TestImage):
# ImageManager.create(name=, **)
self.client.create_image.assert_called_with(
name=self.new_image.name,
+ allow_duplicates=True,
container_format=image.DEFAULT_CONTAINER_FORMAT,
disk_format=image.DEFAULT_DISK_FORMAT,
)
@@ -152,6 +153,7 @@ class TestImageCreate(TestImage):
# ImageManager.create(name=, **)
self.client.create_image.assert_called_with(
name=self.new_image.name,
+ allow_duplicates=True,
container_format='ovf',
disk_format='ami',
min_disk=10,
@@ -239,6 +241,7 @@ class TestImageCreate(TestImage):
# ImageManager.create(name=, **)
self.client.create_image.assert_called_with(
name=self.new_image.name,
+ allow_duplicates=True,
container_format=image.DEFAULT_CONTAINER_FORMAT,
disk_format=image.DEFAULT_DISK_FORMAT,
is_protected=self.new_image.is_protected,
@@ -246,7 +249,7 @@ class TestImageCreate(TestImage):
Alpha='1',
Beta='2',
tags=self.new_image.tags,
- filename=imagefile.name
+ filename=imagefile.name,
)
self.assertEqual(
@@ -288,6 +291,7 @@ class TestImageCreate(TestImage):
# ImageManager.create(name=, **)
self.client.create_image.assert_called_with(
name=self.new_image.name,
+ allow_duplicates=True,
container_format=image.DEFAULT_CONTAINER_FORMAT,
disk_format=image.DEFAULT_DISK_FORMAT,
use_import=True
diff --git a/releasenotes/notes/restore-create-image-duplicates-92e06f64038b120c.yaml b/releasenotes/notes/restore-create-image-duplicates-92e06f64038b120c.yaml
new file mode 100644
index 00000000..7f36e29c
--- /dev/null
+++ b/releasenotes/notes/restore-create-image-duplicates-92e06f64038b120c.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+ - |
+ Fixes default behaviour of `openstack image create` in allowing images
+ with the same name. In version 5.2.0 this changed to not allow
+ duplicates by default.