Fix nxos_ospf_vrf module auto-cost idempotency and module check mode (#47190)
* fixing idempotency and check mode
* modified to avoid repetitive code
(cherry picked from commit dcb35c4270
)
This commit is contained in:
parent
039cde8460
commit
b5a887aa5e
2 changed files with 7 additions and 7 deletions
2
changelogs/fragments/nxos_ospf_vrf_idempotence.yaml
Normal file
2
changelogs/fragments/nxos_ospf_vrf_idempotence.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- Fix nxos_ospf_vrf module auto-cost idempotency and module check mode (https://github.com/ansible/ansible/pull/47190).
|
|
@ -204,7 +204,7 @@ def get_existing(module, args):
|
|||
elif 'auto' in line:
|
||||
cost = re.search(r'auto-cost reference-bandwidth (\d+) (\S+)', line).group(1)
|
||||
if 'Gbps' in line:
|
||||
cost *= 1000
|
||||
cost = int(cost) * 1000
|
||||
existing['auto_cost'] = str(cost)
|
||||
elif 'timers throttle lsa' in line:
|
||||
tmp = re.search(r'timers throttle lsa (\S+) (\S+) (\S+)', line)
|
||||
|
@ -377,7 +377,7 @@ def main():
|
|||
|
||||
warnings = list()
|
||||
check_args(module, warnings)
|
||||
result = dict(changed=False, warnings=warnings)
|
||||
result = dict(changed=False, commands=[], warnings=warnings)
|
||||
|
||||
state = module.params['state']
|
||||
args = PARAM_TO_COMMAND_KEYMAP.keys()
|
||||
|
@ -407,12 +407,10 @@ def main():
|
|||
|
||||
if candidate:
|
||||
candidate = candidate.items_text()
|
||||
load_config(module, candidate)
|
||||
result['changed'] = True
|
||||
result['commands'] = candidate
|
||||
|
||||
else:
|
||||
result['commands'] = []
|
||||
if not module.check_mode:
|
||||
load_config(module, candidate)
|
||||
result['changed'] = True
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue