Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting dns_name in cobbler inventory #12150

Merged
merged 1 commit into from
Sep 1, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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