Skip to content

Commit

Permalink
Fix setting dns_name in cobbler inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
opoplawski committed Aug 28, 2015
1 parent ee7f7a8 commit 3b17efe
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions contrib/inventory/cobbler.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,15 @@ def update_cache(self):
dns_name = host['hostname'] #None
ksmeta = None
interfaces = host['interfaces']

if dns_name is None:
# 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 == '':
continue

status = host['status']
Expand Down

0 comments on commit 3b17efe

Please sign in to comment.