Restrict environment name

New murano engine makes environment name - heat stack name, so need to prevent failed deployments by restrict environnt name.

Change-Id: I7b9ec00c384e22996cd0c993723f0146c43aabc9
Closes-Bug: #1310522
This commit is contained in:
Ekaterina Fedorova 2014-04-28 19:32:56 +04:00
parent 6f6c1b5855
commit 96f0156cb6
1 changed files with 8 additions and 1 deletions

View File

@ -14,6 +14,7 @@
import logging
from django.core import validators
from django.utils.translation import ugettext as _
from horizon import exceptions
@ -53,7 +54,13 @@ class SelectProjectUser(workflows.Step):
class ConfigureEnvironmentAction(workflows.Action):
name = forms.CharField(label=_("Environment Name"), required=True)
name = forms.CharField(
label=_("Environment Name"),
required=True,
validators=[validators.RegexValidator('^[a-zA-Z]+[\w-]*$')],
error_messages={'invalid': 'Environment name must contain only '
'alphanumeric or "_-." characters,'
' must start with alpha'})
class Meta:
name = _("Environment")