Fix typo in cliconf get_config (#43553)
This commit is contained in:
parent
572a2187ab
commit
733e512f35
5 changed files with 11 additions and 11 deletions
|
@ -165,7 +165,7 @@ class CliconfBase(AnsiblePlugin):
|
||||||
self.response_logging = False
|
self.response_logging = False
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_config(self, source='running', flag=None, format=None):
|
def get_config(self, source='running', flags=None, format=None):
|
||||||
"""Retrieves the specified configuration from the device
|
"""Retrieves the specified configuration from the device
|
||||||
|
|
||||||
This method will retrieve the configuration specified by source and
|
This method will retrieve the configuration specified by source and
|
||||||
|
|
|
@ -75,7 +75,7 @@ class Cliconf(CliconfBase):
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
@enable_mode
|
@enable_mode
|
||||||
def get_config(self, source='running', format='text', flag=None):
|
def get_config(self, source='running', format='text', flags=None):
|
||||||
options_values = self.get_option_values()
|
options_values = self.get_option_values()
|
||||||
if format not in options_values['format']:
|
if format not in options_values['format']:
|
||||||
raise ValueError("'format' value %s is invalid. Valid values are %s" % (format, ','.join(options_values['format'])))
|
raise ValueError("'format' value %s is invalid. Valid values are %s" % (format, ','.join(options_values['format'])))
|
||||||
|
@ -88,7 +88,7 @@ class Cliconf(CliconfBase):
|
||||||
if format and format is not 'text':
|
if format and format is not 'text':
|
||||||
cmd += '| %s ' % format
|
cmd += '| %s ' % format
|
||||||
|
|
||||||
cmd += ' '.join(to_list(flag))
|
cmd += ' '.join(to_list(flags))
|
||||||
cmd = cmd.strip()
|
cmd = cmd.strip()
|
||||||
return self.send_command(cmd)
|
return self.send_command(cmd)
|
||||||
|
|
||||||
|
|
|
@ -37,21 +37,21 @@ from ansible.plugins.cliconf import CliconfBase, enable_mode
|
||||||
class Cliconf(CliconfBase):
|
class Cliconf(CliconfBase):
|
||||||
|
|
||||||
@enable_mode
|
@enable_mode
|
||||||
def get_config(self, source='running', flag=None, format=None):
|
def get_config(self, source='running', flags=None, format=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 format:
|
if format:
|
||||||
raise ValueError("'format' value %s is not supported for get_config" % format)
|
raise ValueError("'format' value %s is not supported for get_config" % format)
|
||||||
|
|
||||||
if not flag:
|
if not flags:
|
||||||
flag = []
|
flags = []
|
||||||
if source == 'running':
|
if source == 'running':
|
||||||
cmd = 'show running-config '
|
cmd = 'show running-config '
|
||||||
else:
|
else:
|
||||||
cmd = 'show startup-config '
|
cmd = 'show startup-config '
|
||||||
|
|
||||||
cmd += ' '.join(to_list(flag))
|
cmd += ' '.join(to_list(flags))
|
||||||
cmd = cmd.strip()
|
cmd = cmd.strip()
|
||||||
|
|
||||||
return self.send_command(cmd)
|
return self.send_command(cmd)
|
||||||
|
|
|
@ -131,7 +131,7 @@ class Cliconf(CliconfBase):
|
||||||
diff['config_diff'] = dumps(configdiffobjs, 'commands') if configdiffobjs else ''
|
diff['config_diff'] = dumps(configdiffobjs, 'commands') if configdiffobjs else ''
|
||||||
return diff
|
return diff
|
||||||
|
|
||||||
def get_config(self, source='running', format='text', flag=None):
|
def get_config(self, source='running', format='text', flags=None):
|
||||||
options_values = self.get_option_values()
|
options_values = self.get_option_values()
|
||||||
if format not in options_values['format']:
|
if format not in options_values['format']:
|
||||||
raise ValueError("'format' value %s is invalid. Valid values are %s" % (format, ','.join(options_values['format'])))
|
raise ValueError("'format' value %s is invalid. Valid values are %s" % (format, ','.join(options_values['format'])))
|
||||||
|
@ -144,8 +144,8 @@ class Cliconf(CliconfBase):
|
||||||
if format and format is not 'text':
|
if format and format is not 'text':
|
||||||
cmd += '| %s ' % format
|
cmd += '| %s ' % format
|
||||||
|
|
||||||
if flag:
|
if flags:
|
||||||
cmd += ' '.join(to_list(flag))
|
cmd += ' '.join(to_list(flags))
|
||||||
cmd = cmd.strip()
|
cmd = cmd.strip()
|
||||||
|
|
||||||
return self.send_command(cmd)
|
return self.send_command(cmd)
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Cliconf(CliconfBase):
|
||||||
|
|
||||||
return device_info
|
return device_info
|
||||||
|
|
||||||
def get_config(self, flag=None, format=None):
|
def get_config(self, flags=None, format=None):
|
||||||
if format:
|
if format:
|
||||||
option_values = self.get_option_values()
|
option_values = self.get_option_values()
|
||||||
if format not in option_values['format']:
|
if format not in option_values['format']:
|
||||||
|
|
Loading…
Reference in a new issue