From db49e1e436e977fadee87dde70270c02dddec46e Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Mon, 5 Sep 2016 15:38:21 -0400 Subject: [PATCH] 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 --- lib/ansible/modules/network/ios/ios_config.py | 4 ++-- lib/ansible/modules/network/iosxr/iosxr_config.py | 4 ++-- lib/ansible/modules/network/openswitch/ops_config.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/network/ios/ios_config.py b/lib/ansible/modules/network/ios/ios_config.py index a48754dcf6a..3a3ff2ce419 100644 --- a/lib/ansible/modules/network/ios/ios_config.py +++ b/lib/ansible/modules/network/ios/ios_config.py @@ -288,7 +288,7 @@ def load_config(module, commands, result): if not module.check_mode and module.params['update'] != 'check': module.config(commands) result['changed'] = module.params['update'] != 'check' - result['updates'] = commands.split('\n') + result['updates'] = commands def run(module, result): match = module.params['match'] @@ -304,7 +304,7 @@ def run(module, result): configobjs = candidate.items if configobjs: - commands = dumps(configobjs, 'commands') + commands = dumps(configobjs, 'commands').split('\n') if module.params['before']: commands[:0] = module.params['before'] diff --git a/lib/ansible/modules/network/iosxr/iosxr_config.py b/lib/ansible/modules/network/iosxr/iosxr_config.py index 63c2a70218c..206b3c6ab85 100644 --- a/lib/ansible/modules/network/iosxr/iosxr_config.py +++ b/lib/ansible/modules/network/iosxr/iosxr_config.py @@ -264,7 +264,7 @@ def run(module, result): configobjs = candidate.items if configobjs: - commands = dumps(configobjs, 'commands') + commands = dumps(configobjs, 'commands').split('\n') if module.params['before']: commands[:0] = module.params['before'] @@ -272,7 +272,7 @@ def run(module, result): if module.params['after']: commands.extend(module.params['after']) - result['updates'] = commands.split('\n') + result['updates'] = commands if update != 'check': load_config(module, commands, result) diff --git a/lib/ansible/modules/network/openswitch/ops_config.py b/lib/ansible/modules/network/openswitch/ops_config.py index 864ff0a915c..fffa22f94b8 100644 --- a/lib/ansible/modules/network/openswitch/ops_config.py +++ b/lib/ansible/modules/network/openswitch/ops_config.py @@ -237,7 +237,7 @@ def load_config(module, commands, result): if not module.check_mode and module.params['update'] != 'check': module.config(commands) result['changed'] = module.params['update'] != 'check' - result['updates'] = commands.split('\n') + result['updates'] = commands def run(module, result): match = module.params['match'] @@ -253,7 +253,7 @@ def run(module, result): configobjs = candidate.items if configobjs: - commands = dumps(configobjs, 'commands') + commands = dumps(configobjs, 'commands').split('\n') if module.params['before']: commands[:0] = module.params['before']