Fix passwordless workflow (#55441)
This commit is contained in:
parent
de8ce08fd8
commit
9f830b77fc
1 changed files with 4 additions and 3 deletions
|
@ -288,12 +288,13 @@ def copy_file_from_remote(module, local, local_file_directory, file_system='boot
|
||||||
try:
|
try:
|
||||||
child = pexpect.spawn('ssh ' + username + '@' + hostname + ' -p' + str(port))
|
child = pexpect.spawn('ssh ' + username + '@' + hostname + ' -p' + str(port))
|
||||||
# response could be unknown host addition or Password
|
# response could be unknown host addition or Password
|
||||||
index = child.expect(['yes', '(?i)Password'])
|
index = child.expect(['yes', '(?i)Password', '#'])
|
||||||
if index == 0:
|
if index == 0:
|
||||||
child.sendline('yes')
|
child.sendline('yes')
|
||||||
child.expect('(?i)Password')
|
child.expect('(?i)Password')
|
||||||
child.sendline(password)
|
if index == 1:
|
||||||
child.expect('#')
|
child.sendline(password)
|
||||||
|
child.expect('#')
|
||||||
ldir = '/'
|
ldir = '/'
|
||||||
if local_file_directory:
|
if local_file_directory:
|
||||||
dir_array = local_file_directory.split('/')
|
dir_array = local_file_directory.split('/')
|
||||||
|
|
Loading…
Reference in a new issue