Skip to content

Commit e67c002

Browse files
committed
Fix for server.reboot operation: remove any askpass file at execute time.
1 parent 1937ca4 commit e67c002

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

pyinfra/operations/server.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,13 @@ def reboot(delay=10, interval=1, reboot_timeout=300, state=None, host=None):
6868
)
6969
'''
7070

71-
# Remove this now, before we reboot the server - if the reboot fails (expected or not)
72-
# we'll error if we don't clean this up now. Will simply be re-uploaded if needed later.
73-
remove_any_sudo_askpass_file(host)
71+
# Remove this now, before we reboot the server - if the reboot fails (expected or
72+
# not) we'll error if we don't clean this up now. Will simply be re-uploaded if
73+
# needed later.
74+
def remove_any_askpass_file(state, host):
75+
remove_any_sudo_askpass_file(host)
76+
77+
yield FunctionCommand(remove_any_askpass_file, (), {})
7478

7579
yield StringCommand('reboot', success_exit_codes=[0, -1]) # -1 being error/disconnected
7680

tests/operations/server.reboot/reboot.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"args": [],
33
"commands": [
4+
["remove_any_askpass_file", [], {}],
45
{
56
"command": "reboot",
67
"success_exit_codes": [0, -1]

0 commit comments

Comments
 (0)