From 6044325dec4c517176ba13b75097c60257ee3e30 Mon Sep 17 00:00:00 2001 From: Adharsh Srivats R Date: Tue, 14 Jan 2020 11:32:28 -0500 Subject: [PATCH] Bug fix for #53271 (return commands for cli_config) (#61808) * cli_config return commands bug fix * Spacing error * Added notes section * Spacing error * Spacing error * Spacing error * Spacing error --- lib/ansible/modules/network/cli/cli_config.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/network/cli/cli_config.py b/lib/ansible/modules/network/cli/cli_config.py index cd671f156b2..6ab3d6cb2e9 100644 --- a/lib/ansible/modules/network/cli/cli_config.py +++ b/lib/ansible/modules/network/cli/cli_config.py @@ -18,6 +18,9 @@ DOCUMENTATION = """ module: cli_config version_added: "2.7" author: "Trishna Guha (@trishnaguha)" +notes: + - The commands will be returned only for platforms that do not support onbox diff. + The C(--diff) option with the playbook will return the difference in configuration for devices that has support for onbox diff short_description: Push text based configuration to network devices over network_cli description: - This module provides platform agnostic way of pushing text based @@ -297,11 +300,16 @@ def run(module, device_operations, connection, candidate, running, rollback_id): else: candidate = config_diff.splitlines() - kwargs = {'candidate': candidate, 'commit': commit, 'replace': replace, - 'comment': commit_comment} + kwargs = { + 'candidate': candidate, + 'commit': commit, + 'replace': replace, + 'comment': commit_comment + } if commit: connection.edit_config(**kwargs) result['changed'] = True + result['commands'] = config_diff.split('\n') if banner_diff: candidate = json.dumps(banner_diff)