mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
adds the cli transport back to the ios modules (#20949)
the cli transport was initially removed to aid in the transition to network_cli. This adds the function back to the provider can be specified.
This commit is contained in:
@@ -46,15 +46,12 @@ ios_cli_argument_spec = {
|
||||
'username': dict(fallback=(env_fallback, ['ANSIBLE_NET_USERNAME'])),
|
||||
'password': dict(fallback=(env_fallback, ['ANSIBLE_NET_PASSWORD']), no_log=True),
|
||||
|
||||
'authorize': dict(default=False, fallback=(env_fallback, ['ANSIBLE_NET_AUTHORIZE']), type='bool'),
|
||||
'auth_pass': dict(no_log=True, fallback=(env_fallback, ['ANSIBLE_NET_AUTH_PASS'])),
|
||||
'authorize': dict(fallback=(env_fallback, ['ANSIBLE_NET_AUTHORIZE']), type='bool'),
|
||||
'auth_pass': dict(fallback=(env_fallback, ['ANSIBLE_NET_AUTH_PASS']), no_log=True),
|
||||
|
||||
'timeout': dict(type='int', default=10),
|
||||
|
||||
'provider': dict(type='dict'),
|
||||
|
||||
# deprecated in Ansible 2.3
|
||||
'transport': dict(),
|
||||
}
|
||||
|
||||
def check_args(module):
|
||||
@@ -79,8 +76,6 @@ class Cli(CliBase):
|
||||
re.compile(r"[^\r\n]+ not found", re.I),
|
||||
]
|
||||
|
||||
NET_PASSWD_RE = re.compile(r"[\r\n]?password: $", re.I)
|
||||
|
||||
def __init__(self, module):
|
||||
self._module = module
|
||||
super(Cli, self).__init__()
|
||||
@@ -106,7 +101,12 @@ class Cli(CliBase):
|
||||
|
||||
def authorize(self):
|
||||
passwd = self._module.params['auth_pass']
|
||||
self.execute(Command('enable', prompt=self.NET_PASSWD_RE, response=passwd))
|
||||
if passwd:
|
||||
prompt = "[\r\n]?Password: $"
|
||||
self.exec_command(dict(command='enable', prompt=prompt, response=passwd))
|
||||
else:
|
||||
self.exec_command('enable')
|
||||
|
||||
|
||||
|
||||
def connection(module):
|
||||
|
||||
Reference in New Issue
Block a user