mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Minor changes to HPE iLO collection (#5804)
* Minor changes to setting IPs of servers * Lint fix * Added change log * Update changelogs/fragments/5804-minor-changes-to-hpe-ilo-collection.yml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
4a40f99cd6
commit
b92542dea2
3 changed files with 19 additions and 20 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- ilo_redfish_utils module utils - change implementation of DNS Server IP and NTP Server IP update (https://github.com/ansible-collections/community.general/pull/5804).
|
|
@ -85,17 +85,16 @@ class iLORedfishUtils(RedfishUtils):
|
||||||
|
|
||||||
datetime_uri = self.manager_uri + "DateTime"
|
datetime_uri = self.manager_uri + "DateTime"
|
||||||
|
|
||||||
response = self.get_request(self.root_uri + datetime_uri)
|
listofips = mgr_attributes['mgr_attr_value'].split(" ")
|
||||||
if not response['ret']:
|
if len(listofips) > 2:
|
||||||
return response
|
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]
|
while len(ntp_list) < 2:
|
||||||
if len(ntp_list) == 2:
|
ntp_list.append("0.0.0.0")
|
||||||
ntp_list.pop(0)
|
|
||||||
|
|
||||||
ntp_list.append(mgr_attributes['mgr_attr_value'])
|
|
||||||
|
|
||||||
payload = {setkey: ntp_list}
|
payload = {setkey: ntp_list}
|
||||||
|
|
||||||
|
@ -137,18 +136,16 @@ class iLORedfishUtils(RedfishUtils):
|
||||||
nic_info = self.get_manager_ethernet_uri()
|
nic_info = self.get_manager_ethernet_uri()
|
||||||
uri = nic_info["nic_addr"]
|
uri = nic_info["nic_addr"]
|
||||||
|
|
||||||
response = self.get_request(self.root_uri + uri)
|
listofips = attr['mgr_attr_value'].split(" ")
|
||||||
if not response['ret']:
|
if len(listofips) > 3:
|
||||||
return response
|
return {'ret': False, 'changed': False, 'msg': "More than 3 DNS Servers mentioned"}
|
||||||
|
|
||||||
data = response['data']
|
dns_list = []
|
||||||
|
for ips in listofips:
|
||||||
|
dns_list.append(ips)
|
||||||
|
|
||||||
dns_list = data["Oem"]["Hpe"]["IPv4"][key]
|
while len(dns_list) < 3:
|
||||||
|
dns_list.append("0.0.0.0")
|
||||||
if len(dns_list) == 3:
|
|
||||||
dns_list.pop(0)
|
|
||||||
|
|
||||||
dns_list.append(attr['mgr_attr_value'])
|
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"Oem": {
|
"Oem": {
|
||||||
|
|
|
@ -125,7 +125,7 @@ def main():
|
||||||
password=dict(no_log=True),
|
password=dict(no_log=True),
|
||||||
auth_token=dict(no_log=True),
|
auth_token=dict(no_log=True),
|
||||||
attribute_name=dict(required=True),
|
attribute_name=dict(required=True),
|
||||||
attribute_value=dict(),
|
attribute_value=dict(type='str'),
|
||||||
timeout=dict(type='int', default=10)
|
timeout=dict(type='int', default=10)
|
||||||
),
|
),
|
||||||
required_together=[
|
required_together=[
|
||||||
|
|
Loading…
Reference in a new issue