aboutsummaryrefslogtreecommitdiff
path: root/python/reboot_hetzner_server.py
blob: 7452afe393810ef5568b8de7d6e643b12c63f697 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sys
import hetzner_helper

instance = sys.argv[-1]
actions = []
if "--rescue" in sys.argv:
    actions.append("enable_rescue")
elif "--local" in sys.argv:
    actions.append("disable_rescue")

if "--hard" in sys.argv:
    actions.append("reset")
else:
    actions.append("reboot")

for action in actions:
    result = hetzner_helper.post("servers/{}/actions/{}".format(instance, action))
    print(result)