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 when Domain Name is currently set through DHCP #186

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions examples/ca/hpilo_ca
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,19 @@ def sign_certificates(hosts, openssl, login, password, opts):
cn = ilo.get_cert_subject_info()['csr_subject_common_name']

hn, dn = hostname.split('.', 1)
if network_settings['dns_name'] != hn or dn and network_settings['domain_name'] != dn:
print("Hostname misconfigured on the ilo, fixing")
ilo.mod_network_settings(dns_name=hn, domain_name=dn)
todo.append(hostname)
continue
if network_settings["dhcp_domain_name"]:
# Note: Domain Name is currently set through DHCP, if enabled then domain_name is empty and hpilo_ca can't update. Avoiding loop.
if network_settings['dns_name'] != hn:
print("Hostname misconfigured on the ilo - hn:[%s] dn:[%s], fixing") % (network_settings['dns_name'], hn)
ilo.mod_network_settings(dns_name=hn, domain_name=dn)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still trying to update the domain name, isn't that incorrect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will update the domain name if iLO is not set to use DHCP. The loop happens when iLO is set to use DHCP. See attached screenshot for better understanding.

screen shot 2018-08-23 at 2 40 35 pm

todo.append(hostname)
continue
else:
if network_settings['dns_name'] != hn or dn and network_settings['domain_name'] != dn:
print("Hostname misconfigured on the ilo - hn:[%s] dn:[%s] vs hn:[%s] dn:[%s], fixing") % (network_settings['dns_name'], network_settings['domain_name'], hn, dn)
ilo.mod_network_settings(dns_name=hn, domain_name=dn)
todo.append(hostname)
continue

print("(2/5) Retrieving certificate signing request")
if fw_version['management_processor'].lower() == 'ilo2':
Expand Down
1 change: 1 addition & 0 deletions hpilo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,7 @@ def mod_dir_config(self, dir_authentication_enabled=None,
dir_kerberos_enabled=None,dir_kerberos_realm=None,
dir_kerberos_kdc_address=None,dir_kerberos_kdc_port=None,
dir_kerberos_keytab=None,
dir_generic_ldap_enabled=None,
dir_grpacct1_name=None,dir_grpacct1_sid=None,
dir_grpacct1_priv=None,dir_grpacct2_name=None,
dir_grpacct2_sid=None,dir_grpacct2_priv=None,
Expand Down