mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 05:12:45 +00:00
Fix passwordless workflow (#55441)
This commit is contained in:
@@ -288,12 +288,13 @@ def copy_file_from_remote(module, local, local_file_directory, file_system='boot
|
||||
try:
|
||||
child = pexpect.spawn('ssh ' + username + '@' + hostname + ' -p' + str(port))
|
||||
# response could be unknown host addition or Password
|
||||
index = child.expect(['yes', '(?i)Password'])
|
||||
index = child.expect(['yes', '(?i)Password', '#'])
|
||||
if index == 0:
|
||||
child.sendline('yes')
|
||||
child.expect('(?i)Password')
|
||||
child.sendline(password)
|
||||
child.expect('#')
|
||||
if index == 1:
|
||||
child.sendline(password)
|
||||
child.expect('#')
|
||||
ldir = '/'
|
||||
if local_file_directory:
|
||||
dir_array = local_file_directory.split('/')
|
||||
|
||||
Reference in New Issue
Block a user