Remove abort_config and commit_config

Also move unimplemented command methods to CliBase, where they can be overridden
as needed
This commit is contained in:
Nathaniel Case 2016-08-23 11:24:48 -04:00
parent a35296a42d
commit f5ff3e3add
2 changed files with 13 additions and 15 deletions

View file

@ -85,19 +85,4 @@ class Cli(CliBase):
if params.get('include_defaults'):
cmd += ' all'
return self.execute(cmd)
def load_config(self, commands, **kwargs):
raise NotImplementedError
def replace_config(self, commands, **kwargs):
raise NotImplementedError
def commit_config(self, **kwargs):
raise NotImplementedError
def abort_config(self, **kwargs):
raise NotImplementedError
def save_config(self):
raise NotImplementedError
Cli = register_transport('cli', default=True)(Cli)

View file

@ -231,6 +231,8 @@ class CliBase(object):
def authorize(self, params, **kwargs):
pass
### Command methods ###
def execute(self, commands, **kwargs):
try:
return self.shell.send(commands)
@ -240,3 +242,14 @@ class CliBase(object):
def run_commands(self, commands, **kwargs):
return self.execute(to_list(commands))
### Config methods ###
def load_config(self, commands, **kwargs):
raise NotImplementedError
def replace_config(self, commands, **kwargs):
raise NotImplementedError
def save_config(self):
raise NotImplementedError