mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fixes guess_os for netconf connections (#33671)
* fixes guess_os for netconf connections This change fixes invalid calls to play_context when the network_os is not set and the connection attempts to guess the network_os. The method will now check the correct values for ssh key file and allow agent instead of returning errors. * fix up pep8 issues
This commit is contained in:
parent
012a96dabd
commit
1699a39ad0
3 changed files with 6 additions and 5 deletions
|
@ -164,6 +164,7 @@ class Connection(ConnectionBase):
|
|||
allow_agent = True
|
||||
if self._play_context.password is not None:
|
||||
allow_agent = False
|
||||
setattr(self._play_context, 'allow_agent', allow_agent)
|
||||
|
||||
key_filename = None
|
||||
if self._play_context.private_key_file:
|
||||
|
@ -195,7 +196,7 @@ class Connection(ConnectionBase):
|
|||
key_filename=str(key_filename),
|
||||
hostkey_verify=C.HOST_KEY_CHECKING,
|
||||
look_for_keys=C.PARAMIKO_LOOK_FOR_KEYS,
|
||||
allow_agent=allow_agent,
|
||||
allow_agent=self._play_context.allow_agent,
|
||||
timeout=self._play_context.timeout,
|
||||
device_params={'name': network_os},
|
||||
ssh_config=ssh_config
|
||||
|
|
|
@ -141,10 +141,10 @@ class Netconf(NetconfBase):
|
|||
port=obj._play_context.port or 830,
|
||||
username=obj._play_context.remote_user,
|
||||
password=obj._play_context.password,
|
||||
key_filename=str(obj.key_filename),
|
||||
key_filename=obj._play_context.private_key_file,
|
||||
hostkey_verify=C.HOST_KEY_CHECKING,
|
||||
look_for_keys=C.PARAMIKO_LOOK_FOR_KEYS,
|
||||
allow_agent=obj.allow_agent,
|
||||
allow_agent=obj._play_context.allow_agent,
|
||||
timeout=obj._play_context.timeout
|
||||
)
|
||||
except SSHUnknownHostError as exc:
|
||||
|
|
|
@ -107,10 +107,10 @@ class Netconf(NetconfBase):
|
|||
port=obj._play_context.port or 830,
|
||||
username=obj._play_context.remote_user,
|
||||
password=obj._play_context.password,
|
||||
key_filename=str(obj.key_filename),
|
||||
key_filename=obj._play_context.private_key_file,
|
||||
hostkey_verify=C.HOST_KEY_CHECKING,
|
||||
look_for_keys=C.PARAMIKO_LOOK_FOR_KEYS,
|
||||
allow_agent=obj.allow_agent,
|
||||
allow_agent=obj._play_context.allow_agent,
|
||||
timeout=obj._play_context.timeout
|
||||
)
|
||||
except SSHUnknownHostError as exc:
|
||||
|
|
Loading…
Reference in a new issue