Cleanup openswitch

Also bump get_config in vyos, to pick up the addition of **kwargs

Closes #17415
This commit is contained in:
Nathaniel Case 2016-09-12 13:35:57 -04:00 committed by GitHub
parent 1e7e3aad0e
commit fcd4be28ee
3 changed files with 7 additions and 5 deletions

View file

@ -73,6 +73,7 @@ class Response(object):
except ValueError: except ValueError:
return None return None
class Rest(object): class Rest(object):
DEFAULT_HEADERS = { DEFAULT_HEADERS = {
@ -221,7 +222,7 @@ class Cli(CliBase):
responses = self.execute(cmds) responses = self.execute(cmds)
return responses[1:] return responses[1:]
def get_config(self): def get_config(self, **kwargs):
return self.execute('show running-config')[0] return self.execute('show running-config')[0]
def load_config(self, commands, **kwargs): def load_config(self, commands, **kwargs):
@ -232,6 +233,7 @@ class Cli(CliBase):
Cli = register_transport('cli')(Cli) Cli = register_transport('cli')(Cli)
class Ssh(object): class Ssh(object):
def __init__(self): def __init__(self):
@ -239,6 +241,7 @@ class Ssh(object):
msg = 'ops.dc lib is required but does not appear to be available' msg = 'ops.dc lib is required but does not appear to be available'
raise NetworkError(msg) raise NetworkError(msg)
self._opsidl = None self._opsidl = None
self._extschema = None
def configure(self, config): def configure(self, config):
if not self._opsidl: if not self._opsidl:

View file

@ -259,7 +259,7 @@ class CliBase(object):
def configure(self, commands): def configure(self, commands):
raise NotImplementedError raise NotImplementedError
def get_config(self, commands): def get_config(self, **kwargs):
raise NotImplementedError raise NotImplementedError
def load_config(self, commands, **kwargs): def load_config(self, commands, **kwargs):

View file

@ -29,7 +29,7 @@
import re import re
from ansible.module_utils.network import NetworkModule, NetworkError from ansible.module_utils.network import NetworkModule, NetworkError
from ansible.module_utils.network import register_transport, to_list, get_exception from ansible.module_utils.network import register_transport, to_list
from ansible.module_utils.shell import CliBase from ansible.module_utils.shell import CliBase
@ -96,7 +96,7 @@ class Cli(CliBase):
return diff return diff
def get_config(self, output='text'): def get_config(self, output='text', **kwargs):
if output not in ['text', 'set']: if output not in ['text', 'set']:
raise ValueError('invalid output format specified') raise ValueError('invalid output format specified')
if output == 'set': if output == 'set':
@ -104,5 +104,4 @@ class Cli(CliBase):
else: else:
return self.execute(['show configuration'])[0] return self.execute(['show configuration'])[0]
Cli = register_transport('cli', default=True)(Cli) Cli = register_transport('cli', default=True)(Cli)