mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-03 06:49:10 -07:00
fixes issue where the configobjs are not deserialized to a list
When the configuration is compared and the results deserialized, the dumps() function returns a string. This cohereces the return to a list in case before and/or after needs to be applied fixes 4707
This commit is contained in:
parent
87b839e1f8
commit
db49e1e436
3 changed files with 6 additions and 6 deletions
|
@ -288,7 +288,7 @@ def load_config(module, commands, result):
|
||||||
if not module.check_mode and module.params['update'] != 'check':
|
if not module.check_mode and module.params['update'] != 'check':
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
result['changed'] = module.params['update'] != 'check'
|
result['changed'] = module.params['update'] != 'check'
|
||||||
result['updates'] = commands.split('\n')
|
result['updates'] = commands
|
||||||
|
|
||||||
def run(module, result):
|
def run(module, result):
|
||||||
match = module.params['match']
|
match = module.params['match']
|
||||||
|
@ -304,7 +304,7 @@ def run(module, result):
|
||||||
configobjs = candidate.items
|
configobjs = candidate.items
|
||||||
|
|
||||||
if configobjs:
|
if configobjs:
|
||||||
commands = dumps(configobjs, 'commands')
|
commands = dumps(configobjs, 'commands').split('\n')
|
||||||
|
|
||||||
if module.params['before']:
|
if module.params['before']:
|
||||||
commands[:0] = module.params['before']
|
commands[:0] = module.params['before']
|
||||||
|
|
|
@ -264,7 +264,7 @@ def run(module, result):
|
||||||
configobjs = candidate.items
|
configobjs = candidate.items
|
||||||
|
|
||||||
if configobjs:
|
if configobjs:
|
||||||
commands = dumps(configobjs, 'commands')
|
commands = dumps(configobjs, 'commands').split('\n')
|
||||||
|
|
||||||
if module.params['before']:
|
if module.params['before']:
|
||||||
commands[:0] = module.params['before']
|
commands[:0] = module.params['before']
|
||||||
|
@ -272,7 +272,7 @@ def run(module, result):
|
||||||
if module.params['after']:
|
if module.params['after']:
|
||||||
commands.extend(module.params['after'])
|
commands.extend(module.params['after'])
|
||||||
|
|
||||||
result['updates'] = commands.split('\n')
|
result['updates'] = commands
|
||||||
|
|
||||||
if update != 'check':
|
if update != 'check':
|
||||||
load_config(module, commands, result)
|
load_config(module, commands, result)
|
||||||
|
|
|
@ -237,7 +237,7 @@ def load_config(module, commands, result):
|
||||||
if not module.check_mode and module.params['update'] != 'check':
|
if not module.check_mode and module.params['update'] != 'check':
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
result['changed'] = module.params['update'] != 'check'
|
result['changed'] = module.params['update'] != 'check'
|
||||||
result['updates'] = commands.split('\n')
|
result['updates'] = commands
|
||||||
|
|
||||||
def run(module, result):
|
def run(module, result):
|
||||||
match = module.params['match']
|
match = module.params['match']
|
||||||
|
@ -253,7 +253,7 @@ def run(module, result):
|
||||||
configobjs = candidate.items
|
configobjs = candidate.items
|
||||||
|
|
||||||
if configobjs:
|
if configobjs:
|
||||||
commands = dumps(configobjs, 'commands')
|
commands = dumps(configobjs, 'commands').split('\n')
|
||||||
|
|
||||||
if module.params['before']:
|
if module.params['before']:
|
||||||
commands[:0] = module.params['before']
|
commands[:0] = module.params['before']
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue