Replace invalid_params with ValueError (#44545)
This commit is contained in:
parent
d4e15d40e8
commit
6c05e03fea
5 changed files with 6 additions and 6 deletions
|
@ -54,7 +54,7 @@ class Cliconf(CliconfBase):
|
|||
|
||||
def get_config(self, source='running', flags=None):
|
||||
if source not in ('running', 'startup'):
|
||||
return self.invalid_params("fetching configuration from %s is not supported" % source)
|
||||
raise ValueError("fetching configuration from %s is not supported" % source)
|
||||
if source == 'running':
|
||||
cmd = 'show configuration'
|
||||
else:
|
||||
|
|
|
@ -51,7 +51,7 @@ class Cliconf(CliconfBase):
|
|||
@enable_mode
|
||||
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)
|
||||
raise ValueError("fetching configuration from %s is not supported" % source)
|
||||
|
||||
if source == 'running':
|
||||
cmd = b'show running-config'
|
||||
|
@ -61,7 +61,7 @@ class Cliconf(CliconfBase):
|
|||
else:
|
||||
cmd = b'show configuration'
|
||||
if flags is not None:
|
||||
return self.invalid_params("flags are only supported with running-config")
|
||||
raise ValueError("flags are only supported with running-config")
|
||||
|
||||
return self.send_command(cmd)
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class Cliconf(CliconfBase):
|
|||
|
||||
def get_config(self, source='running', flags=None):
|
||||
if source not in 'running':
|
||||
return self.invalid_params("fetching configuration from %s is not supported" % source)
|
||||
raise ValueError("fetching configuration from %s is not supported" % source)
|
||||
if source == 'running':
|
||||
cmd = 'show running-config'
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class Cliconf(CliconfBase):
|
|||
|
||||
def get_config(self, source='running', flags=None):
|
||||
if source not in ('running', 'startup'):
|
||||
return self.invalid_params("fetching configuration from %s is not supported" % source)
|
||||
raise ValueError("fetching configuration from %s is not supported" % source)
|
||||
if source == 'running':
|
||||
cmd = 'show running-config'
|
||||
else:
|
||||
|
|
|
@ -35,7 +35,7 @@ class Cliconf(CliconfBase):
|
|||
@enable_mode
|
||||
def get_config(self, source='running', flags=None, format=None):
|
||||
if source not in ('running', 'startup'):
|
||||
return self.invalid_params("fetching configuration from %s is not supported" % source)
|
||||
raise ValueError("fetching configuration from %s is not supported" % source)
|
||||
|
||||
if format:
|
||||
raise ValueError("'format' value %s is not supported for get_config" % format)
|
||||
|
|
Loading…
Reference in a new issue