summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Sprygada <privateip@users.noreply.github.com>2016-10-12 20:16:34 -0400
committerGitHub <noreply@github.com>2016-10-12 20:16:34 -0400
commit9c25a7f97ebd77953def9e47fa79031997bc0ebe (patch)
tree4ee4fbbd301110ff15fe0c2b653a49f2fb906a5a
parent275fa3f055aacf2286eed54c13bde17db5082035 (diff)
downloadansible-modules-core-9c25a7f97ebd77953def9e47fa79031997bc0ebe.tar.gz
fixes issue with pushing config to versions that do not support sessions (#5236)
earlier versions of eos do not support configuration sessions. this change will now check if sessions are supported and if not will fallback to not using config sessions fixes #4909
-rw-r--r--network/eos/eos_config.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/network/eos/eos_config.py b/network/eos/eos_config.py
index 6531a602..04d0c9f0 100644
--- a/network/eos/eos_config.py
+++ b/network/eos/eos_config.py
@@ -223,6 +223,11 @@ def check_args(module, warnings):
'match=none instead. This argument will be '
'removed in the future')
+ if not module.connection.supports_sessions():
+ warnings.append('The current version of EOS on the remote device does '
+ 'not support configuration sessions. The commit '
+ 'argument will be ignored')
+
def get_candidate(module):
candidate = NetworkConfig(indent=3)
if module.params['src']:
@@ -245,9 +250,11 @@ def load_config(module, commands, result):
diff = module.config.load_config(commands, replace=replace, commit=commit)
- if diff:
+ if diff and module.connection.supports_sessions():
result['diff'] = dict(prepared=diff)
result['changed'] = True
+ elif diff:
+ result['changed'] = True
def run(module, result):
match = module.params['match']
@@ -273,6 +280,7 @@ def run(module, result):
result['updates'] = commands
+ module.log('commands: %s' % commands)
load_config(module, commands, result)
if module.params['save']:
@@ -314,7 +322,6 @@ def main():
('replace', 'config', ['src'])]
module = NetworkModule(argument_spec=argument_spec,
- connect_on_load=False,
mutually_exclusive=mutually_exclusive,
required_if=required_if,
supports_check_mode=True)