mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #27147 from rallytime/fix-11669
Enforce bounds in the GCE Regex
This commit is contained in:
commit
097fcd1017
1 changed files with 3 additions and 4 deletions
|
@ -115,7 +115,7 @@ list_nodes = namespaced_function(list_nodes, globals())
|
|||
list_nodes_full = namespaced_function(list_nodes_full, globals())
|
||||
list_nodes_select = namespaced_function(list_nodes_select, globals())
|
||||
|
||||
GCE_VM_NAME_REGEX = re.compile(r'(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)')
|
||||
GCE_VM_NAME_REGEX = re.compile(r'^(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)$')
|
||||
|
||||
|
||||
# Only load in this module if the GCE configurations are in place
|
||||
|
@ -2023,9 +2023,8 @@ def create(vm_=None, call=None):
|
|||
|
||||
if not GCE_VM_NAME_REGEX.match(vm_['name']):
|
||||
raise SaltCloudSystemExit(
|
||||
'The allowed VM names must match the following regular expression: {0}'.format(
|
||||
GCE_VM_NAME_REGEX.pattern
|
||||
)
|
||||
'VM names must start with a letter, only contain letters, numbers, or dashes '
|
||||
'and cannot end in a dash.'
|
||||
)
|
||||
|
||||
conn = get_conn()
|
||||
|
|
Loading…
Add table
Reference in a new issue