Backport to fix nios member module param bug fix (#56387)
* Update nios_member.py (#54419)
* Update nios_member.py
* Update api.py
* Update nios_member.py
* Update nios_member.py
* Update api.py
(cherry picked from commit 25f485f79d
)
* nios_member param fix
Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
This commit is contained in:
parent
faee6a3676
commit
a52bce11d2
3 changed files with 37 additions and 27 deletions
2
changelogs/fragments/54419-nios-member-updates.yaml
Normal file
2
changelogs/fragments/54419-nios-member-updates.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- To fix the nios member module params - https://github.com/ansible/ansible/pull/54419
|
|
@ -151,8 +151,16 @@ def member_normalize(member_spec):
|
||||||
It will remove any arguments that are set to None since WAPI will error on
|
It will remove any arguments that are set to None since WAPI will error on
|
||||||
that condition.
|
that condition.
|
||||||
The remainder of the value validation is performed by WAPI
|
The remainder of the value validation is performed by WAPI
|
||||||
|
Some parameters in ib_spec are passed as a list in order to pass the validation for elements.
|
||||||
|
In this function, they are converted to dictionary.
|
||||||
'''
|
'''
|
||||||
|
member_elements = ['vip_setting', 'ipv6_setting', 'lan2_port_setting', 'mgmt_port_setting',
|
||||||
|
'pre_provisioning', 'network_setting', 'v6_network_setting',
|
||||||
|
'ha_port_setting', 'lan_port_setting', 'lan2_physical_setting',
|
||||||
|
'lan_ha_port_setting', 'mgmt_network_setting', 'v6_mgmt_network_setting']
|
||||||
for key in member_spec.keys():
|
for key in member_spec.keys():
|
||||||
|
if key in member_elements:
|
||||||
|
member_spec[key] = member_spec[key][0]
|
||||||
if isinstance(member_spec[key], dict):
|
if isinstance(member_spec[key], dict):
|
||||||
member_spec[key] = member_normalize(member_spec[key])
|
member_spec[key] = member_normalize(member_spec[key])
|
||||||
elif isinstance(member_spec[key], list):
|
elif isinstance(member_spec[key], list):
|
||||||
|
|
|
@ -305,9 +305,9 @@ EXAMPLES = '''
|
||||||
nios_member:
|
nios_member:
|
||||||
host_name: member01.localdomain
|
host_name: member01.localdomain
|
||||||
vip_setting:
|
vip_setting:
|
||||||
address: 192.168.1.100
|
- address: 192.168.1.100
|
||||||
subnet_mask: 255.255.255.0
|
subnet_mask: 255.255.255.0
|
||||||
gateway: 192.168.1.1
|
gateway: 192.168.1.1
|
||||||
config_addr_type: IPV4
|
config_addr_type: IPV4
|
||||||
platform: VNIOS
|
platform: VNIOS
|
||||||
comment: "Created by Ansible"
|
comment: "Created by Ansible"
|
||||||
|
@ -321,9 +321,9 @@ EXAMPLES = '''
|
||||||
nios_member:
|
nios_member:
|
||||||
host_name: memberha.localdomain
|
host_name: memberha.localdomain
|
||||||
vip_setting:
|
vip_setting:
|
||||||
address: 192.168.1.100
|
- address: 192.168.1.100
|
||||||
subnet_mask: 255.255.255.0
|
subnet_mask: 255.255.255.0
|
||||||
gateway: 192.168.1.1
|
gateway: 192.168.1.1
|
||||||
config_addr_type: IPV4
|
config_addr_type: IPV4
|
||||||
platform: VNIOS
|
platform: VNIOS
|
||||||
enable_ha: true
|
enable_ha: true
|
||||||
|
@ -346,14 +346,14 @@ EXAMPLES = '''
|
||||||
nios_member:
|
nios_member:
|
||||||
name: member01.localdomain
|
name: member01.localdomain
|
||||||
pre_provisioning:
|
pre_provisioning:
|
||||||
hardware_info:
|
- hardware_info:
|
||||||
- hwmodel: IB-VM-820
|
- hwmodel: IB-VM-820
|
||||||
hwtype: IB-VNIOS
|
hwtype: IB-VNIOS
|
||||||
licenses:
|
licenses:
|
||||||
- dns
|
- dns
|
||||||
- dhcp
|
- dhcp
|
||||||
- enterprise
|
- enterprise
|
||||||
- vnios
|
- vnios
|
||||||
comment: "Updated by Ansible"
|
comment: "Updated by Ansible"
|
||||||
state: present
|
state: present
|
||||||
provider:
|
provider:
|
||||||
|
@ -403,23 +403,23 @@ def main():
|
||||||
|
|
||||||
lan2_port_spec = dict(
|
lan2_port_spec = dict(
|
||||||
enabled=dict(type='bool'),
|
enabled=dict(type='bool'),
|
||||||
network_setting=dict(type='dict', elements='dict', options=ipv4_spec),
|
network_setting=dict(type='list', elements='dict', options=ipv4_spec),
|
||||||
v6_network_setting=dict(type='dict', elements='dict', options=ipv6_spec),
|
v6_network_setting=dict(type='list', elements='dict', options=ipv6_spec),
|
||||||
)
|
)
|
||||||
|
|
||||||
ha_port_spec = dict(
|
ha_port_spec = dict(
|
||||||
ha_ip_address=dict(),
|
ha_ip_address=dict(),
|
||||||
ha_port_setting=dict(type='dict', elements='dict', options=port_spec),
|
ha_port_setting=dict(type='list', elements='dict', options=port_spec),
|
||||||
lan_port_setting=dict(type='dict', elements='dict', options=port_spec),
|
lan_port_setting=dict(type='list', elements='dict', options=port_spec),
|
||||||
mgmt_lan=dict(),
|
mgmt_lan=dict(),
|
||||||
mgmt_ipv6addr=dict(),
|
mgmt_ipv6addr=dict(),
|
||||||
)
|
)
|
||||||
|
|
||||||
node_spec = dict(
|
node_spec = dict(
|
||||||
lan2_physical_setting=dict(type='dict', elements='dict', options=port_spec),
|
lan2_physical_setting=dict(type='list', elements='dict', options=port_spec),
|
||||||
lan_ha_port_setting=dict(type='dict', elements='dict', options=ha_port_spec),
|
lan_ha_port_setting=dict(type='list', elements='dict', options=ha_port_spec),
|
||||||
mgmt_network_setting=dict(type='dict', elements='dict', options=ipv4_spec),
|
mgmt_network_setting=dict(type='list', elements='dict', options=ipv4_spec),
|
||||||
v6_mgmt_network_setting=dict(type='dict', elements='dict', options=ipv6_spec),
|
v6_mgmt_network_setting=dict(type='list', elements='dict', options=ipv6_spec),
|
||||||
)
|
)
|
||||||
|
|
||||||
mgmt_port_spec = dict(
|
mgmt_port_spec = dict(
|
||||||
|
@ -452,22 +452,22 @@ def main():
|
||||||
|
|
||||||
ib_spec = dict(
|
ib_spec = dict(
|
||||||
host_name=dict(required=True, aliases=['name'], ib_req=True),
|
host_name=dict(required=True, aliases=['name'], ib_req=True),
|
||||||
vip_setting=dict(type='dict', elements='dict', options=ipv4_spec),
|
vip_setting=dict(type='list', elements='dict', options=ipv4_spec),
|
||||||
ipv6_setting=dict(type='dict', elements='dict', options=ipv6_spec),
|
ipv6_setting=dict(type='list', elements='dict', options=ipv6_spec),
|
||||||
config_addr_type=dict(default='IPV4'),
|
config_addr_type=dict(default='IPV4'),
|
||||||
comment=dict(),
|
comment=dict(),
|
||||||
enable_ha=dict(type='bool', default=False),
|
enable_ha=dict(type='bool', default=False),
|
||||||
router_id=dict(type='int'),
|
router_id=dict(type='int'),
|
||||||
lan2_enabled=dict(type='bool', default=False),
|
lan2_enabled=dict(type='bool', default=False),
|
||||||
lan2_port_setting=dict(type='dict', elements='dict', options=lan2_port_spec),
|
lan2_port_setting=dict(type='list', elements='dict', options=lan2_port_spec),
|
||||||
platform=dict(default='INFOBLOX'),
|
platform=dict(default='INFOBLOX'),
|
||||||
node_info=dict(type='list', elements='dict', options=node_spec),
|
node_info=dict(type='list', elements='dict', options=node_spec),
|
||||||
mgmt_port_setting=dict(type='dict', elements='dict', options=mgmt_port_spec),
|
mgmt_port_setting=dict(type='list', elements='dict', options=mgmt_port_spec),
|
||||||
upgrade_group=dict(default='Default'),
|
upgrade_group=dict(default='Default'),
|
||||||
use_syslog_proxy_setting=dict(type='bool'),
|
use_syslog_proxy_setting=dict(type='bool'),
|
||||||
external_syslog_server_enable=dict(type='bool'),
|
external_syslog_server_enable=dict(type='bool'),
|
||||||
syslog_servers=dict(type='list', elements='dict', options=syslog_spec),
|
syslog_servers=dict(type='list', elements='dict', options=syslog_spec),
|
||||||
pre_provisioning=dict(type='dict', elements='dict', options=pre_prov_spec),
|
pre_provisioning=dict(type='list', elements='dict', options=pre_prov_spec),
|
||||||
extattrs=dict(type='dict'),
|
extattrs=dict(type='dict'),
|
||||||
create_token=dict(type='bool', default=False),
|
create_token=dict(type='bool', default=False),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue