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

Minor changes to HPE iLO collection #5804

Merged
merged 4 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- ilo_redfish_config - Change input type of attribute_value (https://github.com/ansible-collections/community.general/pull/5804).
- ilo_redfish_utils - Change implementation of DNS Server IP and NTP Server IP update (https://github.com/ansible-collections/community.general/pull/5804).
Bhavya06 marked this conversation as resolved.
Show resolved Hide resolved
35 changes: 16 additions & 19 deletions plugins/module_utils/ilo_redfish_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,16 @@ def set_ntp_server(self, mgr_attributes):

datetime_uri = self.manager_uri + "DateTime"

response = self.get_request(self.root_uri + datetime_uri)
if not response['ret']:
return response
listofips = mgr_attributes['mgr_attr_value'].split(" ")
if len(listofips) > 2:
return {'ret': False, 'changed': False, 'msg': "More than 2 NTP Servers mentioned"}

data = response['data']
ntp_list = []
for ips in listofips:
ntp_list.append(ips)

ntp_list = data[setkey]
if len(ntp_list) == 2:
ntp_list.pop(0)

ntp_list.append(mgr_attributes['mgr_attr_value'])
while len(ntp_list) < 2:
ntp_list.append("0.0.0.0")

payload = {setkey: ntp_list}

Expand Down Expand Up @@ -137,18 +136,16 @@ def set_dns_server(self, attr):
nic_info = self.get_manager_ethernet_uri()
uri = nic_info["nic_addr"]

response = self.get_request(self.root_uri + uri)
if not response['ret']:
return response

data = response['data']

dns_list = data["Oem"]["Hpe"]["IPv4"][key]
listofips = attr['mgr_attr_value'].split(" ")
if len(listofips) > 3:
return {'ret': False, 'changed': False, 'msg': "More than 3 DNS Servers mentioned"}

if len(dns_list) == 3:
dns_list.pop(0)
dns_list = []
for ips in listofips:
dns_list.append(ips)

dns_list.append(attr['mgr_attr_value'])
while len(dns_list) < 3:
dns_list.append("0.0.0.0")

payload = {
"Oem": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/ilo_redfish_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def main():
password=dict(no_log=True),
auth_token=dict(no_log=True),
attribute_name=dict(required=True),
attribute_value=dict(),
attribute_value=dict(type='str'),
timeout=dict(type='int', default=10)
),
required_together=[
Expand Down