Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import pexpect
- up = pexpect.spawn('sudo dnf update')
- if up.expect(['(?i)password.*']) == 0:
- up.sendline('crazyhardpassword')
- time.sleep(2)
- else:
- print("Permissions already elevated...")
- if up.expect(['.*[y/N].*']) == 0:
- up.sendline('Y')
- time.sleep(2)
- else:
- print("No upgrade approval prompt displayed!")
- if up.expect(['(?i)^nothing.*rnComplete!.*']) == 0:
- print("No updates available...")
- else:
- raise AssertionError("Upgrade request failed!!!")
Add Comment
Please, Sign In to add comment