1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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'): if params.get('include_defaults'):
cmd += ' all' cmd += ' all'
return self.execute(cmd) 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) Cli = register_transport('cli', default=True)(Cli)

View file

@ -231,6 +231,8 @@ class CliBase(object):
def authorize(self, params, **kwargs): def authorize(self, params, **kwargs):
pass pass
### Command methods ###
def execute(self, commands, **kwargs): def execute(self, commands, **kwargs):
try: try:
return self.shell.send(commands) return self.shell.send(commands)
@ -240,3 +242,14 @@ class CliBase(object):
def run_commands(self, commands, **kwargs): def run_commands(self, commands, **kwargs):
return self.execute(to_list(commands)) 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