mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Net mod ios (#16426)
* Update IOS with new NetworkModule * Remove redundant EOS code * `authorize` can get rolled into NetCli * Fix up IOS to where EOS is. * Update IOSXR for NetworkModule * collections is unnecessary
This commit is contained in:
@@ -20,20 +20,16 @@
|
||||
import re
|
||||
|
||||
from ansible.module_utils.basic import json, get_exception, AnsibleModule
|
||||
from ansible.module_utils.network import NetCli, NetworkError, get_module, Command
|
||||
from ansible.module_utils.network import Command, NetCli, NetworkError, get_module
|
||||
from ansible.module_utils.network import add_argument, register_transport, to_list
|
||||
from ansible.module_utils.netcfg import NetworkConfig
|
||||
from ansible.module_utils.urls import fetch_url, url_argument_spec
|
||||
|
||||
NET_PASSWD_RE = re.compile(r"[\r\n]?password: $", re.I)
|
||||
|
||||
EAPI_FORMATS = ['json', 'text']
|
||||
|
||||
add_argument('use_ssl', dict(default=True, type='bool'))
|
||||
add_argument('validate_certs', dict(default=True, type='bool'))
|
||||
|
||||
ModuleStub = AnsibleModule
|
||||
|
||||
def argument_spec():
|
||||
return dict(
|
||||
# config options
|
||||
@@ -204,7 +200,7 @@ class Eapi(EosConfigMixin):
|
||||
|
||||
def __init__(self):
|
||||
self.url = None
|
||||
self.url_args = ModuleStub(url_argument_spec())
|
||||
self.url_args = AnsibleModule(url_argument_spec())
|
||||
self.url_args.fail_json = self._error
|
||||
self.enable = None
|
||||
self.default_output = 'json'
|
||||
@@ -343,17 +339,11 @@ class Cli(NetCli, EosConfigMixin):
|
||||
re.compile(r"[^\r\n]\/bin\/(?:ba)?sh")
|
||||
]
|
||||
|
||||
def __init__(self):
|
||||
super(Cli, self).__init__()
|
||||
NET_PASSWD_RE = re.compile(r"[\r\n]?password: $", re.I)
|
||||
|
||||
def connect(self, params, **kwargs):
|
||||
super(Cli, self).connect(params, kickstart=True, **kwargs)
|
||||
self.shell.send('terminal length 0')
|
||||
self._connected = True
|
||||
|
||||
def authorize(self, params, **kwargs):
|
||||
passwd = params['auth_pass']
|
||||
self.execute(Command('enable', prompt=NET_PASSWD_RE, response=passwd))
|
||||
|
||||
### implementation of network.Cli ###
|
||||
|
||||
|
||||
Reference in New Issue
Block a user