Skip to content

Commit

Permalink
Fix passwordless workflow (ansible#55441)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9f830b7)
  • Loading branch information
mikewiebe authored and trishnaguha committed May 8, 2019
1 parent 0829325 commit e3b3deb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/nxos_file_copy_fix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- nxos_file_copy fix passwordless workflow (https://github.com/ansible/ansible/pull/55441).
7 changes: 4 additions & 3 deletions lib/ansible/modules/network/nxos/nxos_file_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('/')
Expand Down

0 comments on commit e3b3deb

Please sign in to comment.