1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

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:
Matthew Jones 2015-05-28 09:42:41 -04:00
parent 58b3f4360c
commit f5391cab11

View File

@ -947,6 +947,8 @@ class HostSerializer(BaseSerializerWithVariables):
except (ValueError, TypeError):
try:
vars_dict = yaml.safe_load(variables)
if vars_dict is None:
vars_dict = {}
vars_dict['ansible_ssh_port'] = port
attrs['variables'] = yaml.dump(vars_dict)
except (yaml.YAMLError, TypeError):