Fix passwordless workflow (#55441)
(cherry picked from commit 9f830b77fc
)
This commit is contained in:
parent
a85461e569
commit
c8037a541e
2 changed files with 6 additions and 3 deletions
2
changelogs/fragments/nxos_file_copy_fix.yaml
Normal file
2
changelogs/fragments/nxos_file_copy_fix.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- nxos_file_copy fix passwordless workflow (https://github.com/ansible/ansible/pull/55441).
|
|
@ -288,10 +288,11 @@ 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')
|
||||
if index == 1:
|
||||
child.sendline(password)
|
||||
child.expect('#')
|
||||
ldir = '/'
|
||||
|
|
Loading…
Reference in a new issue