From b86f07324e349ae407c2c6bf706f4fb2a81e7deb Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Mon, 26 Feb 2018 10:56:22 -0500 Subject: [PATCH] fix cliconf get_config method to match base signature (#36682) This commit fixes up the get_config method to match the minimum method signature as defined by the base class. Without this patch, the get_config method calls will fail in some cirumstances. (cherry picked from commit fb6a8c0133267ee7d4ad825d5ff9f0e11a999381) --- lib/ansible/plugins/cliconf/aireos.py | 2 +- lib/ansible/plugins/cliconf/aruba.py | 2 +- lib/ansible/plugins/cliconf/asa.py | 2 +- lib/ansible/plugins/cliconf/dellos10.py | 2 +- lib/ansible/plugins/cliconf/dellos6.py | 2 +- lib/ansible/plugins/cliconf/dellos9.py | 2 +- lib/ansible/plugins/cliconf/edgeos.py | 2 +- lib/ansible/plugins/cliconf/enos.py | 2 +- lib/ansible/plugins/cliconf/ios.py | 2 +- lib/ansible/plugins/cliconf/iosxr.py | 2 +- lib/ansible/plugins/cliconf/ironware.py | 2 +- lib/ansible/plugins/cliconf/nxos.py | 5 +++-- lib/ansible/plugins/cliconf/onyx.py | 2 +- lib/ansible/plugins/cliconf/vyos.py | 2 +- 14 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/ansible/plugins/cliconf/aireos.py b/lib/ansible/plugins/cliconf/aireos.py index 46df3b33bb4..1496977832d 100644 --- a/lib/ansible/plugins/cliconf/aireos.py +++ b/lib/ansible/plugins/cliconf/aireos.py @@ -55,7 +55,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running'): + def get_config(self, source='running', format='text'): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) if source == 'running': diff --git a/lib/ansible/plugins/cliconf/aruba.py b/lib/ansible/plugins/cliconf/aruba.py index 89fe8f49018..580e20580ca 100644 --- a/lib/ansible/plugins/cliconf/aruba.py +++ b/lib/ansible/plugins/cliconf/aruba.py @@ -56,7 +56,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running'): + def get_config(self, source='running', format='text'): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) if source == 'running': diff --git a/lib/ansible/plugins/cliconf/asa.py b/lib/ansible/plugins/cliconf/asa.py index e8de50b9318..575c9745449 100644 --- a/lib/ansible/plugins/cliconf/asa.py +++ b/lib/ansible/plugins/cliconf/asa.py @@ -53,7 +53,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running'): + def get_config(self, source='running', format='text'): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) if source == 'running': diff --git a/lib/ansible/plugins/cliconf/dellos10.py b/lib/ansible/plugins/cliconf/dellos10.py index 98291b52f8c..f5ea7ec487f 100644 --- a/lib/ansible/plugins/cliconf/dellos10.py +++ b/lib/ansible/plugins/cliconf/dellos10.py @@ -57,7 +57,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running'): + def get_config(self, source='running', format='text'): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) if source == 'running': diff --git a/lib/ansible/plugins/cliconf/dellos6.py b/lib/ansible/plugins/cliconf/dellos6.py index df9d64fea19..6952e02dba3 100644 --- a/lib/ansible/plugins/cliconf/dellos6.py +++ b/lib/ansible/plugins/cliconf/dellos6.py @@ -57,7 +57,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running'): + def get_config(self, source='running', format='text'): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) # if source == 'running': diff --git a/lib/ansible/plugins/cliconf/dellos9.py b/lib/ansible/plugins/cliconf/dellos9.py index e445da3f14b..96815ca84e3 100644 --- a/lib/ansible/plugins/cliconf/dellos9.py +++ b/lib/ansible/plugins/cliconf/dellos9.py @@ -57,7 +57,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running'): + def get_config(self, source='running', format='text'): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) # if source == 'running': diff --git a/lib/ansible/plugins/cliconf/edgeos.py b/lib/ansible/plugins/cliconf/edgeos.py index d0958b01b37..34dbf03d594 100644 --- a/lib/ansible/plugins/cliconf/edgeos.py +++ b/lib/ansible/plugins/cliconf/edgeos.py @@ -38,7 +38,7 @@ class Cliconf(CliconfBase): return device_info - def get_config(self): + def get_config(self, source='running', format='text'): return self.send_command(b'show configuration commands') def edit_config(self, command): diff --git a/lib/ansible/plugins/cliconf/enos.py b/lib/ansible/plugins/cliconf/enos.py index b4e943d38a1..882e4c0eab1 100644 --- a/lib/ansible/plugins/cliconf/enos.py +++ b/lib/ansible/plugins/cliconf/enos.py @@ -58,7 +58,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running'): + def get_config(self, source='running', format='text'): if source not in ('running', 'startup'): msg = "fetching configuration from %s is not supported" return self.invalid_params(msg % source) diff --git a/lib/ansible/plugins/cliconf/ios.py b/lib/ansible/plugins/cliconf/ios.py index 6f3fe20651b..f8b3deb9b94 100644 --- a/lib/ansible/plugins/cliconf/ios.py +++ b/lib/ansible/plugins/cliconf/ios.py @@ -53,7 +53,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running', flags=None): + def get_config(self, source='running', format='text', flags=None): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) if source == 'running': diff --git a/lib/ansible/plugins/cliconf/iosxr.py b/lib/ansible/plugins/cliconf/iosxr.py index 37afb3f21ca..9f4746681ea 100644 --- a/lib/ansible/plugins/cliconf/iosxr.py +++ b/lib/ansible/plugins/cliconf/iosxr.py @@ -56,7 +56,7 @@ class Cliconf(CliconfBase): return device_info - def get_config(self, source='running', filter=None): + def get_config(self, source='running', format='text', filter=None): lookup = {'running': 'running-config'} if source not in lookup: return self.invalid_params("fetching configuration from %s is not supported" % source) diff --git a/lib/ansible/plugins/cliconf/ironware.py b/lib/ansible/plugins/cliconf/ironware.py index 66c52e25728..10dfa6b71ef 100644 --- a/lib/ansible/plugins/cliconf/ironware.py +++ b/lib/ansible/plugins/cliconf/ironware.py @@ -49,7 +49,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running', flags=None): + def get_config(self, source='running', format='text', flags=None): if source not in ('running', 'startup'): return self.invalid_params("fetching configuration from %s is not supported" % source) diff --git a/lib/ansible/plugins/cliconf/nxos.py b/lib/ansible/plugins/cliconf/nxos.py index 27de3d60bf1..1b056a04a42 100644 --- a/lib/ansible/plugins/cliconf/nxos.py +++ b/lib/ansible/plugins/cliconf/nxos.py @@ -50,11 +50,12 @@ class Cliconf(CliconfBase): return device_info - def get_config(self, source='running', flags=None): + def get_config(self, source='running', format='text', flags=None): lookup = {'running': 'running-config', 'startup': 'startup-config'} cmd = 'show {} '.format(lookup[source]) - cmd += ' '.join(flags) + if flags: + cmd += ' '.join(flags) cmd = cmd.strip() return self.send_command(cmd) diff --git a/lib/ansible/plugins/cliconf/onyx.py b/lib/ansible/plugins/cliconf/onyx.py index b487254db46..6754a7a6bf8 100644 --- a/lib/ansible/plugins/cliconf/onyx.py +++ b/lib/ansible/plugins/cliconf/onyx.py @@ -48,7 +48,7 @@ class Cliconf(CliconfBase): return device_info @enable_mode - def get_config(self, source='running'): + def get_config(self, source='running', format='text'): if source not in ('running',): return self.invalid_params("fetching configuration from %s is not supported" % source) cmd = b'show running-config' diff --git a/lib/ansible/plugins/cliconf/vyos.py b/lib/ansible/plugins/cliconf/vyos.py index d341a2bd35e..f4ad687dc8a 100644 --- a/lib/ansible/plugins/cliconf/vyos.py +++ b/lib/ansible/plugins/cliconf/vyos.py @@ -51,7 +51,7 @@ class Cliconf(CliconfBase): return device_info - def get_config(self): + def get_config(self, source='running', format='text'): return self.send_command(b'show configuration commands') def edit_config(self, command):