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.
This commit is contained in:
parent
eb162bdf7f
commit
fb6a8c0133
14 changed files with 16 additions and 15 deletions
|
@ -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':
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue