mirror of
https://github.com/ansible/awx.git
synced 2026-03-11 06:29:31 -02:30
Fix an issue where passing an empty yaml file (or ---) would cause an
error if including a port specifier on a hostname
This commit is contained in:
@@ -947,6 +947,8 @@ class HostSerializer(BaseSerializerWithVariables):
|
|||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
try:
|
try:
|
||||||
vars_dict = yaml.safe_load(variables)
|
vars_dict = yaml.safe_load(variables)
|
||||||
|
if vars_dict is None:
|
||||||
|
vars_dict = {}
|
||||||
vars_dict['ansible_ssh_port'] = port
|
vars_dict['ansible_ssh_port'] = port
|
||||||
attrs['variables'] = yaml.dump(vars_dict)
|
attrs['variables'] = yaml.dump(vars_dict)
|
||||||
except (yaml.YAMLError, TypeError):
|
except (yaml.YAMLError, TypeError):
|
||||||
|
|||||||
Reference in New Issue
Block a user