summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatiana Ovchinnikova <t.v.ovtchinnikova@gmail.com>2022-11-02 14:13:30 -0500
committerTatiana Ovchinnikova <t.v.ovtchinnikova@gmail.com>2022-12-08 15:03:34 +0000
commitd1927e172bc95d96932f33c1f8f08aaf4f3aaaaa (patch)
tree8c726e5c1433c856a6bd1d4456a060f0f6b51631
parenta7f95784785408afdd2273de7aef33cee31793e1 (diff)
downloadhorizon-d1927e172bc95d96932f33c1f8f08aaf4f3aaaaa.tar.gz
Fix flavor id auto generation
Currently the flavor creation form always check for the uniqueness of the UUID field, even when it is set to "auto". That means that if we create a flavor with UUID value of "auto", the check will fail. This patch disable the check when UUID is automatically generated. Change-Id: Ie31307d67cf3857e3bb80c124e92c81e0c6a2982 (cherry picked from commit af7e6c4f75299b9e47db059dc7ddbaf2e0b1a3fc)
-rw-r--r--openstack_dashboard/dashboards/admin/flavors/workflows.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/openstack_dashboard/dashboards/admin/flavors/workflows.py b/openstack_dashboard/dashboards/admin/flavors/workflows.py
index 5bec75503..a186ab716 100644
--- a/openstack_dashboard/dashboards/admin/flavors/workflows.py
+++ b/openstack_dashboard/dashboards/admin/flavors/workflows.py
@@ -30,7 +30,7 @@ class CreateFlavorInfoAction(workflows.Action):
_flavor_id_regex = (r'^[a-zA-Z0-9. _-]+$')
_flavor_id_help_text = _("flavor id can only contain alphanumeric "
"characters, underscores, periods, hyphens, "
- "spaces.")
+ "spaces. Use 'auto' to automatically generate id")
name = forms.CharField(
label=_("Name"),
max_length=255)
@@ -93,7 +93,7 @@ class CreateFlavorInfoAction(workflows.Action):
error_msg = _('The name "%s" is already used by '
'another flavor.') % name
self._errors['name'] = self.error_class([error_msg])
- if flavor.id == flavor_id:
+ if (flavor.id != 'auto') and (flavor.id == flavor_id):
error_msg = _('The ID "%s" is already used by '
'another flavor.') % flavor_id
self._errors['flavor_id'] = self.error_class([error_msg])