summaryrefslogtreecommitdiff
path: root/lib/ansible/plugins/cliconf
diff options
context:
space:
mode:
authorGanesh Nalawade <ganesh634@gmail.com>2019-09-13 18:52:33 +0530
committerGitHub <noreply@github.com>2019-09-13 18:52:33 +0530
commit200ed25648d403fdaa86c459cd89bc12ad85bbcc (patch)
tree267073b489baa77b162a106d8035ddf7ecb5bd88 /lib/ansible/plugins/cliconf
parent2d19150757beb8233154bb8472ed6b0da037ef1d (diff)
downloadansible-200ed25648d403fdaa86c459cd89bc12ad85bbcc.tar.gz
Fix for junos cli_config replace option (#62131)
* Fix for junos cli_config replace option * For device that support replace option by loading configuration from a file on device `config` option is not required and value of `replace` option is the path of configuration file on device. This fix allows invoking run() function in cli_config if `config` option is None and `replace` option is not boolean * The command to replace running config on junos device is `load override <filename>` and not `load replace <filename>` This is fixed in the junos cliconf plugin. * Add integration test
Diffstat (limited to 'lib/ansible/plugins/cliconf')
-rw-r--r--lib/ansible/plugins/cliconf/junos.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ansible/plugins/cliconf/junos.py b/lib/ansible/plugins/cliconf/junos.py
index c800539a72..35d264f99a 100644
--- a/lib/ansible/plugins/cliconf/junos.py
+++ b/lib/ansible/plugins/cliconf/junos.py
@@ -109,7 +109,7 @@ class Cliconf(CliconfBase):
requests = []
if replace:
- candidate = 'load replace {0}'.format(replace)
+ candidate = 'load override {0}'.format(replace)
for line in to_list(candidate):
if not isinstance(line, Mapping):
@@ -133,8 +133,8 @@ class Cliconf(CliconfBase):
self.discard_changes()
else:
- for cmd in ['top', 'exit']:
- self.send_command(cmd)
+ self.send_command('top')
+ self.discard_changes()
resp['request'] = requests
resp['response'] = results
@@ -193,7 +193,7 @@ class Cliconf(CliconfBase):
resp = self.send_command(command)
r = resp.splitlines()
- if len(r) == 1 and '[edit]' in r[0]:
+ if len(r) == 1 and '[edit]' in r[0] or len(r) == 4 and r[1].startswith('- version'):
resp = ''
return resp