mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 04:40:22 -07:00
add normalize_interface in module_utils and fix nxos_l3_interface module (#40598)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
012003c871
commit
0b7932db30
4 changed files with 50 additions and 85 deletions
|
@ -90,7 +90,7 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
from ansible.module_utils.network.common.config import CustomNetworkConfig
|
||||
from ansible.module_utils.network.common.utils import remove_default_spec
|
||||
from ansible.module_utils.network.nxos.nxos import get_config, load_config
|
||||
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec
|
||||
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, normalize_interface
|
||||
|
||||
|
||||
def search_obj_in_list(name, lst):
|
||||
|
@ -151,10 +151,14 @@ def map_params_to_obj(module):
|
|||
if item.get(key) is None:
|
||||
item[key] = module.params[key]
|
||||
|
||||
obj.append(item.copy())
|
||||
d = item.copy()
|
||||
name = d['name']
|
||||
d['name'] = normalize_interface(name)
|
||||
obj.append(d)
|
||||
|
||||
else:
|
||||
obj.append({
|
||||
'name': module.params['name'],
|
||||
'name': normalize_interface(module.params['name']),
|
||||
'ipv4': module.params['ipv4'],
|
||||
'ipv6': module.params['ipv6'],
|
||||
'state': module.params['state']
|
||||
|
@ -175,7 +179,7 @@ def map_config_to_obj(want, module):
|
|||
if config:
|
||||
match_name = re.findall(r'interface (\S+)', config, re.M)
|
||||
if match_name:
|
||||
obj['name'] = match_name[0]
|
||||
obj['name'] = normalize_interface(match_name[0])
|
||||
|
||||
match_ipv4 = re.findall(r'ip address (\S+)', config, re.M)
|
||||
if match_ipv4:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue