mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 04:40:22 -07:00
Remove cliconf from httpapi connection (#46813)
* Bare minimum rip out cliconf * nxapi changeover * Update documentation, move options * Memoize device_info * Gratuitous rename to underscore use of local api implementation Fixup eos module_utils like nxos * Streamline version and image scans * Expose get_capabilities through module_utils * Add load_config to module_utils * Support rpcs using both args and kwargs * Add get_config for nxos * Add get_diff * module context, pulled from nxapi We could probably do this correctly later * Fix eos issues * Limit connection._sub_plugin to only one plugin
This commit is contained in:
parent
32dbb99bb8
commit
02432565cd
14 changed files with 568 additions and 255 deletions
|
@ -297,7 +297,7 @@ class NetworkConnectionBase(ConnectionBase):
|
|||
self._local = connection_loader.get('local', play_context, '/dev/null')
|
||||
self._local.set_options()
|
||||
|
||||
self._sub_plugins = []
|
||||
self._sub_plugin = {}
|
||||
self._cached_variables = (None, None, None)
|
||||
|
||||
# reconstruct the socket_path and set instance values accordingly
|
||||
|
@ -309,8 +309,9 @@ class NetworkConnectionBase(ConnectionBase):
|
|||
return self.__dict__[name]
|
||||
except KeyError:
|
||||
if not name.startswith('_'):
|
||||
for plugin in self._sub_plugins:
|
||||
method = getattr(plugin['obj'], name, None)
|
||||
plugin = self._sub_plugin.get('obj')
|
||||
if plugin:
|
||||
method = getattr(plugin, name, None)
|
||||
if method is not None:
|
||||
return method
|
||||
raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, name))
|
||||
|
@ -342,12 +343,11 @@ class NetworkConnectionBase(ConnectionBase):
|
|||
def set_options(self, task_keys=None, var_options=None, direct=None):
|
||||
super(NetworkConnectionBase, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct)
|
||||
|
||||
for plugin in self._sub_plugins:
|
||||
if plugin['type'] != 'external':
|
||||
try:
|
||||
plugin['obj'].set_options(task_keys=task_keys, var_options=var_options, direct=direct)
|
||||
except AttributeError:
|
||||
pass
|
||||
if self._sub_plugin.get('obj') and self._sub_plugin.get('type') != 'external':
|
||||
try:
|
||||
self._sub_plugin['obj'].set_options(task_keys=task_keys, var_options=var_options, direct=direct)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
def _update_connection_state(self):
|
||||
'''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue