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 fb6a8c0133)
pull/36765/head
Peter Sprygada 7 years ago committed by Peter Sprygada
parent eb12520854
commit b86f07324e

@ -55,7 +55,7 @@ class Cliconf(CliconfBase):
return device_info return device_info
@enable_mode @enable_mode
def get_config(self, source='running'): def get_config(self, source='running', format='text'):
if source not in ('running', 'startup'): if source not in ('running', 'startup'):
return self.invalid_params("fetching configuration from %s is not supported" % source) return self.invalid_params("fetching configuration from %s is not supported" % source)
if source == 'running': if source == 'running':

@ -56,7 +56,7 @@ class Cliconf(CliconfBase):
return device_info return device_info
@enable_mode @enable_mode
def get_config(self, source='running'): def get_config(self, source='running', format='text'):
if source not in ('running', 'startup'): if source not in ('running', 'startup'):
return self.invalid_params("fetching configuration from %s is not supported" % source) return self.invalid_params("fetching configuration from %s is not supported" % source)
if source == 'running': if source == 'running':

@ -53,7 +53,7 @@ class Cliconf(CliconfBase):
return device_info return device_info
@enable_mode @enable_mode
def get_config(self, source='running'): def get_config(self, source='running', format='text'):
if source not in ('running', 'startup'): if source not in ('running', 'startup'):
return self.invalid_params("fetching configuration from %s is not supported" % source) return self.invalid_params("fetching configuration from %s is not supported" % source)
if source == 'running': if source == 'running':

@ -57,7 +57,7 @@ class Cliconf(CliconfBase):
return device_info return device_info
@enable_mode @enable_mode
def get_config(self, source='running'): def get_config(self, source='running', format='text'):
if source not in ('running', 'startup'): if source not in ('running', 'startup'):
return self.invalid_params("fetching configuration from %s is not supported" % source) return self.invalid_params("fetching configuration from %s is not supported" % source)
if source == 'running': if source == 'running':

@ -57,7 +57,7 @@ class Cliconf(CliconfBase):
return device_info return device_info
@enable_mode @enable_mode
def get_config(self, source='running'): def get_config(self, source='running', format='text'):
if source not in ('running', 'startup'): if source not in ('running', 'startup'):
return self.invalid_params("fetching configuration from %s is not supported" % source) return self.invalid_params("fetching configuration from %s is not supported" % source)
# if source == 'running': # if source == 'running':

@ -57,7 +57,7 @@ class Cliconf(CliconfBase):
return device_info return device_info
@enable_mode @enable_mode
def get_config(self, source='running'): def get_config(self, source='running', format='text'):
if source not in ('running', 'startup'): if source not in ('running', 'startup'):
return self.invalid_params("fetching configuration from %s is not supported" % source) return self.invalid_params("fetching configuration from %s is not supported" % source)
# if source == 'running': # if source == 'running':

@ -38,7 +38,7 @@ class Cliconf(CliconfBase):
return device_info return device_info
def get_config(self): def get_config(self, source='running', format='text'):
return self.send_command(b'show configuration commands') return self.send_command(b'show configuration commands')
def edit_config(self, command): def edit_config(self, command):

@ -58,7 +58,7 @@ class Cliconf(CliconfBase):
return device_info return device_info
@enable_mode @enable_mode
def get_config(self, source='running'): def get_config(self, source='running', format='text'):
if source not in ('running', 'startup'): if source not in ('running', 'startup'):
msg = "fetching configuration from %s is not supported" msg = "fetching configuration from %s is not supported"
return self.invalid_params(msg % source) return self.invalid_params(msg % source)

@ -53,7 +53,7 @@ class Cliconf(CliconfBase):
return device_info return device_info
@enable_mode @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'): if source not in ('running', 'startup'):
return self.invalid_params("fetching configuration from %s is not supported" % source) return self.invalid_params("fetching configuration from %s is not supported" % source)
if source == 'running': if source == 'running':

@ -56,7 +56,7 @@ class Cliconf(CliconfBase):
return device_info 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'} lookup = {'running': 'running-config'}
if source not in lookup: if source not in lookup:
return self.invalid_params("fetching configuration from %s is not supported" % source) return self.invalid_params("fetching configuration from %s is not supported" % source)

@ -49,7 +49,7 @@ class Cliconf(CliconfBase):
return device_info return device_info
@enable_mode @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'): if source not in ('running', 'startup'):
return self.invalid_params("fetching configuration from %s is not supported" % source) return self.invalid_params("fetching configuration from %s is not supported" % source)

@ -50,11 +50,12 @@ class Cliconf(CliconfBase):
return device_info 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'} lookup = {'running': 'running-config', 'startup': 'startup-config'}
cmd = 'show {} '.format(lookup[source]) cmd = 'show {} '.format(lookup[source])
cmd += ' '.join(flags) if flags:
cmd += ' '.join(flags)
cmd = cmd.strip() cmd = cmd.strip()
return self.send_command(cmd) return self.send_command(cmd)

@ -48,7 +48,7 @@ class Cliconf(CliconfBase):
return device_info return device_info
@enable_mode @enable_mode
def get_config(self, source='running'): def get_config(self, source='running', format='text'):
if source not in ('running',): if source not in ('running',):
return self.invalid_params("fetching configuration from %s is not supported" % source) return self.invalid_params("fetching configuration from %s is not supported" % source)
cmd = b'show running-config' cmd = b'show running-config'

@ -51,7 +51,7 @@ class Cliconf(CliconfBase):
return device_info return device_info
def get_config(self): def get_config(self, source='running', format='text'):
return self.send_command(b'show configuration commands') return self.send_command(b'show configuration commands')
def edit_config(self, command): def edit_config(self, command):

Loading…
Cancel
Save