Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding optional arguments for load_replace_candidate #508

Merged
merged 12 commits into from Nov 21, 2017
Merged
1 change: 1 addition & 0 deletions docs/support/index.rst
Expand Up @@ -125,6 +125,7 @@ ____________________________________
* :code:`alt_key_file` (ios, iosxr) - SSH host key file to use (if ``alt_host_keys`` is ``True``).
* :code:`keepalive` (junos, iosxr) - SSH keepalive interval, in seconds (default: ``30`` seconds).
* :code:`ignore_warning` (junos) - Allows to set `ignore_warning` when loading configuration to avoid exceptions via junos-pyez. (default: ``False``).
* :code:`eos_autoComplete` (eos) - Allows to set `autoComplete` when running commands. (default: ``None`` equivalent to ``False``)

The transport argument
______________________
Expand Down
7 changes: 6 additions & 1 deletion napalm/eos/eos.py
Expand Up @@ -88,6 +88,8 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None)

self.profile = ["eos"]

self.eos_autoComplete = optional_args.get('eos_autoComplete', None)

def open(self):
"""Implementation of NAPALM method open."""
try:
Expand Down Expand Up @@ -159,7 +161,10 @@ def _load_config(self, filename=None, config=None, replace=True):
commands.append(line)

try:
self.device.run_commands(commands)
if self.eos_autoComplete:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be if self.eos_autoComplete is not None in case False has to be enforced in the future.

self.devcie.run_commands(commands, autoComplete=self.eos_autoComplete)
else:
self.device.run_commands(commands)
except pyeapi.eapilib.CommandError as e:
self.discard_config()
if replace:
Expand Down