summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/module_utils/network/common/network.py25
-rw-r--r--lib/ansible/module_utils/network/eos/eos.py5
-rw-r--r--lib/ansible/module_utils/network/eos/facts/legacy/base.py7
-rw-r--r--lib/ansible/module_utils/network/eos/facts/vlans/vlans.py3
-rw-r--r--lib/ansible/utils/jsonrpc.py2
5 files changed, 6 insertions, 36 deletions
diff --git a/lib/ansible/module_utils/network/common/network.py b/lib/ansible/module_utils/network/common/network.py
index 315a663762..e76d31e983 100644
--- a/lib/ansible/module_utils/network/common/network.py
+++ b/lib/ansible/module_utils/network/common/network.py
@@ -30,23 +30,12 @@ import json
from ansible.module_utils._text import to_text, to_native
from ansible.module_utils.basic import AnsibleModule
-from ansible.module_utils.basic import env_fallback, missing_required_lib
+from ansible.module_utils.basic import env_fallback
from ansible.module_utils.connection import Connection, ConnectionError
from ansible.module_utils.network.common.netconf import NetconfConnection
from ansible.module_utils.network.common.parsing import Cli
from ansible.module_utils.six import iteritems
-try:
- from ansible.module_utils.network.eos import eos
- HAS_EOS = True
-except ImportError:
- HAS_EOS = False
-
-try:
- from ansible.module_utils.network.nxos import nxos
- HAS_NXOS = True
-except ImportError:
- HAS_NXOS = False
NET_TRANSPORT_ARGS = dict(
host=dict(required=True),
@@ -223,17 +212,7 @@ def get_resource_connection(module):
capabilities = get_capabilities(module)
network_api = capabilities.get('network_api')
- if network_api == 'eapi':
- if HAS_EOS:
- module._connection = eos.get_connection(module)
- else:
- module.fail_json(msg=missing_required_lib("collection arista.eos"))
- elif network_api == 'nxapi':
- if HAS_NXOS:
- module._connection = nxos.get_connection(module)
- else:
- module.fail_json(msg=missing_required_lib("collection cisco.nxos"))
- elif network_api in ('cliconf', 'exosapi'):
+ if network_api in ('cliconf', 'nxapi', 'eapi', 'exosapi'):
module._connection = Connection(module._socket_path)
elif network_api == 'netconf':
module._connection = NetconfConnection(module._socket_path)
diff --git a/lib/ansible/module_utils/network/eos/eos.py b/lib/ansible/module_utils/network/eos/eos.py
index 6721c0e54c..22c675153e 100644
--- a/lib/ansible/module_utils/network/eos/eos.py
+++ b/lib/ansible/module_utils/network/eos/eos.py
@@ -418,9 +418,6 @@ class HttpApi:
self._session_support = self._connection.supports_sessions()
return self._session_support
- def get(self, command, **kwargs):
- return self._connection.send_request(command)
-
def run_commands(self, commands, check_rc=True):
"""Runs list of commands on remote device and returns results
"""
@@ -514,7 +511,7 @@ class HttpApi:
"""
return self.edit_config(config, commit, replace)
- def edit_config(self, config, commit=True, replace=False):
+ def edit_config(self, config, commit=False, replace=False):
"""Loads the configuration onto the remote devices
If the device doesn't support configuration sessions, this will
diff --git a/lib/ansible/module_utils/network/eos/facts/legacy/base.py b/lib/ansible/module_utils/network/eos/facts/legacy/base.py
index 6093dedd09..50bb82e849 100644
--- a/lib/ansible/module_utils/network/eos/facts/legacy/base.py
+++ b/lib/ansible/module_utils/network/eos/facts/legacy/base.py
@@ -130,13 +130,6 @@ class Interfaces(FactsBase):
self.facts['all_ipv6_addresses'] = list()
data = self.responses[0]
- if not isinstance(data, dict):
- # EAPI kills the whole request on an error.
- self.COMMANDS.pop()
- super(Interfaces, self).populate()
- self.responses.append(None)
- data = self.responses[0]
-
self.facts['interfaces'] = self.populate_interfaces(data)
data = self.responses[1]
diff --git a/lib/ansible/module_utils/network/eos/facts/vlans/vlans.py b/lib/ansible/module_utils/network/eos/facts/vlans/vlans.py
index 63d21b169b..0e01b6c216 100644
--- a/lib/ansible/module_utils/network/eos/facts/vlans/vlans.py
+++ b/lib/ansible/module_utils/network/eos/facts/vlans/vlans.py
@@ -63,7 +63,8 @@ class VlansFacts(object):
if obj:
objs.extend(obj)
- facts = {'vlans': []}
+ ansible_facts['ansible_network_resources'].pop('vlans', None)
+ facts = {}
if objs:
params = utils.validate_config(self.argument_spec, {'config': objs})
facts['vlans'] = [utils.remove_empties(cfg) for cfg in params['config']]
diff --git a/lib/ansible/utils/jsonrpc.py b/lib/ansible/utils/jsonrpc.py
index 0a97c61054..e48c979d4c 100644
--- a/lib/ansible/utils/jsonrpc.py
+++ b/lib/ansible/utils/jsonrpc.py
@@ -39,7 +39,7 @@ class JsonRpcServer(object):
break
if not rpc_method:
- error = self.method_not_found(rpc_method)
+ error = self.method_not_found()
response = json.dumps(error)
else:
try: