Guest User

Untitled

a guest
Feb 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import time
  2. import pexpect
  3.  
  4. up = pexpect.spawn('sudo dnf update')
  5.  
  6. if up.expect(['(?i)password.*']) == 0:
  7. up.sendline('crazyhardpassword')
  8. time.sleep(2)
  9. else:
  10. print("Permissions already elevated...")
  11.  
  12. if up.expect(['.*[y/N].*']) == 0:
  13. up.sendline('Y')
  14. time.sleep(2)
  15. else:
  16. print("No upgrade approval prompt displayed!")
  17.  
  18. if up.expect(['(?i)^nothing.*rnComplete!.*']) == 0:
  19. print("No updates available...")
  20. else:
  21. raise AssertionError("Upgrade request failed!!!")
Add Comment
Please, Sign In to add comment