mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
parent
2f33c1a1a1
commit
5553b20828
206 changed files with 1853 additions and 1870 deletions
|
@ -52,7 +52,7 @@ except ImportError:
|
|||
display = Display()
|
||||
|
||||
|
||||
AUTHENTICITY_MSG="""
|
||||
AUTHENTICITY_MSG = """
|
||||
paramiko: The authenticity of host '%s' can't be established.
|
||||
The %s key fingerprint is %s.
|
||||
Are you sure you want to continue connecting (yes/no)?
|
||||
|
@ -62,12 +62,12 @@ Are you sure you want to continue connecting (yes/no)?
|
|||
SETTINGS_REGEX = re.compile(r'(\w+)(?:\s*=\s*|\s+)(.+)')
|
||||
|
||||
# prevent paramiko warning noise -- see http://stackoverflow.com/questions/3920502/
|
||||
HAVE_PARAMIKO=False
|
||||
HAVE_PARAMIKO = False
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore")
|
||||
try:
|
||||
import paramiko
|
||||
HAVE_PARAMIKO=True
|
||||
HAVE_PARAMIKO = True
|
||||
logging.getLogger("paramiko").setLevel(logging.WARNING)
|
||||
except ImportError:
|
||||
pass
|
||||
|
@ -109,7 +109,7 @@ class MyAddPolicy(object):
|
|||
|
||||
self.connection.connection_unlock()
|
||||
|
||||
if inp not in ['yes','y','']:
|
||||
if inp not in ['yes', 'y', '']:
|
||||
raise AnsibleError("host connection rejected by user")
|
||||
|
||||
key._added_by_ansible_this_time = True
|
||||
|
@ -213,11 +213,11 @@ class Connection(ConnectionBase):
|
|||
if C.HOST_KEY_CHECKING:
|
||||
for ssh_known_hosts in ("/etc/ssh/ssh_known_hosts", "/etc/openssh/ssh_known_hosts"):
|
||||
try:
|
||||
#TODO: check if we need to look at several possible locations, possible for loop
|
||||
# TODO: check if we need to look at several possible locations, possible for loop
|
||||
ssh.load_system_host_keys(ssh_known_hosts)
|
||||
break
|
||||
except IOError:
|
||||
pass # file was not found, but not required to function
|
||||
pass # file was not found, but not required to function
|
||||
ssh.load_system_host_keys()
|
||||
|
||||
sock_kwarg = self._parse_proxy_command(port)
|
||||
|
@ -305,10 +305,10 @@ class Connection(ConnectionBase):
|
|||
display.debug("chunk is: %s" % chunk)
|
||||
if not chunk:
|
||||
if b'unknown user' in become_output:
|
||||
raise AnsibleError( 'user %s does not exist' % self._play_context.become_user)
|
||||
raise AnsibleError('user %s does not exist' % self._play_context.become_user)
|
||||
else:
|
||||
break
|
||||
#raise AnsibleError('ssh connection closed waiting for password prompt')
|
||||
# raise AnsibleError('ssh connection closed waiting for password prompt')
|
||||
become_output += chunk
|
||||
|
||||
# need to check every line because we might get lectured
|
||||
|
@ -441,7 +441,7 @@ class Connection(ConnectionBase):
|
|||
# (This doesn't acquire the connection lock because it needs
|
||||
# to exclude only other known_hosts writers, not connections
|
||||
# that are starting up.)
|
||||
lockfile = self.keyfile.replace("known_hosts",".known_hosts.lock")
|
||||
lockfile = self.keyfile.replace("known_hosts", ".known_hosts.lock")
|
||||
dirname = os.path.dirname(self.keyfile)
|
||||
makedirs_safe(dirname)
|
||||
|
||||
|
@ -457,7 +457,7 @@ class Connection(ConnectionBase):
|
|||
# gather information about the current key file, so
|
||||
# we can ensure the new file has the correct mode/owner
|
||||
|
||||
key_dir = os.path.dirname(self.keyfile)
|
||||
key_dir = os.path.dirname(self.keyfile)
|
||||
if os.path.exists(self.keyfile):
|
||||
key_stat = os.stat(self.keyfile)
|
||||
mode = key_stat.st_mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue