summaryrefslogtreecommitdiff
path: root/lib/ansible/module_utils/network/eos
diff options
context:
space:
mode:
authorNathaniel Case <ncase@redhat.com>2019-10-24 15:01:05 -0400
committerGitHub <noreply@github.com>2019-10-24 15:01:05 -0400
commit7f5d1ab2b730f1a2cbe7b4d578ec72a49636a282 (patch)
tree8614793f0dc6099853d591504b0538c9d8e45af8 /lib/ansible/module_utils/network/eos
parent553767ef50bcd73cf8c1443373608724f5f7c74f (diff)
downloadansible-7f5d1ab2b730f1a2cbe7b4d578ec72a49636a282.tar.gz
Removed in 29 (#63680)
* Eh, 2.10 is close enough * drop top-level authorize * Remove from documentation * Remove load_params * Centralize this junos thing * Fixup user modules * I'm 95% sure this did not do what it was supposed to * nxos_hsrp: I don't think this is an actual module parameter * Try to fix junos_package tests * Move local params to provider * Promote 'timeout' to a real parameter for eos_eapi * Don't assume provider exists? * move another timeout * Provider now always has auth_pass * Fix junos tests to avoid NameErrors
Diffstat (limited to 'lib/ansible/module_utils/network/eos')
-rw-r--r--lib/ansible/module_utils/network/eos/eos.py52
1 files changed, 12 insertions, 40 deletions
diff --git a/lib/ansible/module_utils/network/eos/eos.py b/lib/ansible/module_utils/network/eos/eos.py
index ee8a13a6ce..438554ebdf 100644
--- a/lib/ansible/module_utils/network/eos/eos.py
+++ b/lib/ansible/module_utils/network/eos/eos.py
@@ -36,7 +36,6 @@ from ansible.module_utils.basic import env_fallback
from ansible.module_utils.connection import Connection, ConnectionError
from ansible.module_utils.network.common.config import NetworkConfig, dumps
from ansible.module_utils.network.common.utils import to_list, ComplexList
-from ansible.module_utils.six import iteritems
from ansible.module_utils.urls import fetch_url
_DEVICE_CONNECTION = None
@@ -61,41 +60,15 @@ eos_provider_spec = {
eos_argument_spec = {
'provider': dict(type='dict', options=eos_provider_spec),
}
-eos_top_spec = {
- 'host': dict(removed_in_version=2.9),
- 'port': dict(removed_in_version=2.9, type='int'),
- 'username': dict(removed_in_version=2.9),
- 'password': dict(removed_in_version=2.9, no_log=True),
- 'ssh_keyfile': dict(removed_in_version=2.9, type='path'),
-
- 'authorize': dict(fallback=(env_fallback, ['ANSIBLE_NET_AUTHORIZE']), type='bool'),
- 'auth_pass': dict(removed_in_version=2.9, no_log=True),
-
- 'use_ssl': dict(removed_in_version=2.9, type='bool'),
- 'validate_certs': dict(removed_in_version=2.9, type='bool'),
- 'timeout': dict(removed_in_version=2.9, type='int'),
-
- 'transport': dict(removed_in_version=2.9, choices=['cli', 'eapi'])
-}
-eos_argument_spec.update(eos_top_spec)
def get_provider_argspec():
return eos_provider_spec
-def load_params(module):
- provider = module.params.get('provider') or dict()
- for key, value in iteritems(provider):
- if key in eos_argument_spec:
- if module.params.get(key) is None and value is not None:
- module.params[key] = value
-
-
def get_connection(module):
global _DEVICE_CONNECTION
if not _DEVICE_CONNECTION:
- load_params(module)
if is_local_eapi(module):
conn = LocalEapi(module)
else:
@@ -210,23 +183,24 @@ class LocalEapi:
self._session_support = None
self._device_configs = {}
- host = module.params['provider']['host']
- port = module.params['provider']['port']
+ provider = module.params.get("provider") or {}
+ host = provider.get('host')
+ port = provider.get('port')
- self._module.params['url_username'] = self._module.params['username']
- self._module.params['url_password'] = self._module.params['password']
+ self._module.params['url_username'] = provider.get('username')
+ self._module.params['url_password'] = provider.get('password')
- if module.params['provider']['use_ssl']:
+ if provider.get('use_ssl'):
proto = 'https'
else:
proto = 'http'
- module.params['validate_certs'] = module.params['provider']['validate_certs']
+ module.params['validate_certs'] = provider.get('validate_certs')
self._url = '%s://%s:%s/command-api' % (proto, host, port)
- if module.params['auth_pass']:
- self._enable = {'cmd': 'enable', 'input': module.params['auth_pass']}
+ if provider.get("auth_pass"):
+ self._enable = {'cmd': 'enable', 'input': provider.get('auth_pass')}
else:
self._enable = 'enable'
@@ -251,7 +225,7 @@ class LocalEapi:
data = self._module.jsonify(body)
headers = {'Content-Type': 'application/json-rpc'}
- timeout = self._module.params['timeout']
+ timeout = self._module.params['provider']['timeout']
use_proxy = self._module.params['provider']['use_proxy']
response, headers = fetch_url(
@@ -595,12 +569,10 @@ def is_json(cmd):
def is_local_eapi(module):
- transports = []
- transports.append(module.params.get('transport', ""))
provider = module.params.get('provider')
if provider:
- transports.append(provider.get('transport', ""))
- return 'eapi' in transports
+ return provider.get('transport') == 'eapi'
+ return False
def to_command(module, commands):