Merge "Fix KeyError raised when max hostname length exceeded"
This commit is contained in:
commit
8fa414e1f8
@ -370,8 +370,8 @@ def _add_container_hosts(assignment, config, container_name, container_type,
|
||||
type_and_name = '{}_{}'.format(host_type, container_name)
|
||||
logger.debug("Generated container name %s", type_and_name)
|
||||
max_hostname_len = 52
|
||||
if len(type_and_name) > max_hostname_len and \
|
||||
not properties['is_metal']:
|
||||
is_metal = properties.get('is_metal', False)
|
||||
if len(type_and_name) > max_hostname_len and not is_metal:
|
||||
raise SystemExit(
|
||||
'The resulting combination of [ "{}" + "{}" ] is longer than'
|
||||
' {} characters. This combination will result in a container'
|
||||
@ -383,7 +383,7 @@ def _add_container_hosts(assignment, config, container_name, container_type,
|
||||
host_type, container_name, max_hostname_len
|
||||
)
|
||||
)
|
||||
elif len(host_type) > 63 and properties['is_metal']:
|
||||
elif len(host_type) > 63 and is_metal:
|
||||
raise SystemExit(
|
||||
'The resulting hostname "{0}" is longer than 63 characters.'
|
||||
' This combination may result in a name that is longer than'
|
||||
|
Loading…
x
Reference in New Issue
Block a user