1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #12150 from opoplawski/cobbler

Fix setting dns_name in cobbler inventory
This commit is contained in:
James Cammarata 2015-09-01 12:06:57 -04:00
commit ae865b9480

View file

@ -169,8 +169,15 @@ class CobblerInventory(object):
dns_name = host['hostname'] #None dns_name = host['hostname'] #None
ksmeta = None ksmeta = None
interfaces = host['interfaces'] interfaces = host['interfaces']
# hostname is often empty for non-static IP hosts
if dns_name == '':
for (iname, ivalue) in interfaces.iteritems():
if ivalue['management'] or not ivalue['static']:
this_dns_name = ivalue.get('dns_name', None)
if this_dns_name is not None and this_dns_name is not "":
dns_name = this_dns_name
if dns_name is None: if dns_name == '':
continue continue
status = host['status'] status = host['status']