Replace invalid_params with ValueError (#44545)

This commit is contained in:
Lindsay Hill 2018-08-23 06:49:08 -07:00 committed by Ricardo Carrillo Cruz
parent d4e15d40e8
commit 6c05e03fea
5 changed files with 6 additions and 6 deletions

View file

@ -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:

View file

@ -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)

View file

@ -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'

View file

@ -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:

View file

@ -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)