Merge "Strip whitespace added to flavor name in create and update flavor."
This commit is contained in:
commit
04f88bd550
@ -68,15 +68,18 @@ class CreateFlavorInfoAction(workflows.Action):
|
|||||||
"cores, and other resources and can be selected when "
|
"cores, and other resources and can be selected when "
|
||||||
"users deploy instances.")
|
"users deploy instances.")
|
||||||
|
|
||||||
|
def clean_name(self):
|
||||||
|
name = self.cleaned_data.get('name').strip()
|
||||||
|
if not name:
|
||||||
|
msg = _('Flavor name cannot be empty.')
|
||||||
|
self._errors['name'] = self.error_class([msg])
|
||||||
|
return name
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
cleaned_data = super(CreateFlavorInfoAction, self).clean()
|
cleaned_data = super(CreateFlavorInfoAction, self).clean()
|
||||||
name = cleaned_data.get('name')
|
name = cleaned_data.get('name')
|
||||||
flavor_id = cleaned_data.get('flavor_id')
|
flavor_id = cleaned_data.get('flavor_id')
|
||||||
|
|
||||||
if name and name.isspace():
|
|
||||||
msg = _('Flavor name cannot be empty.')
|
|
||||||
self._errors['name'] = self.error_class([msg])
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
flavors = api.nova.flavor_list(self.request, None)
|
flavors = api.nova.flavor_list(self.request, None)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user