aboutsummaryrefslogtreecommitdiff
path: root/python/reboot_hetzner_server.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-08-18 13:09:29 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2020-02-17 17:31:09 +0100
commit367c391a61091817cf34475f91a23ca286eec334 (patch)
tree616ee3d89d031032681844f5825c9d41eec8e9c0 /python/reboot_hetzner_server.py
parent64d41da73cce0005757ca0f7dd88151f9ba5cf4a (diff)
downloadPuppet-367c391a61091817cf34475f91a23ca286eec334.tar.gz
Puppet-367c391a61091817cf34475f91a23ca286eec334.tar.zst
Puppet-367c391a61091817cf34475f91a23ca286eec334.zip
Add hetzner server scripts
Diffstat (limited to 'python/reboot_hetzner_server.py')
-rw-r--r--python/reboot_hetzner_server.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/python/reboot_hetzner_server.py b/python/reboot_hetzner_server.py
new file mode 100644
index 0000000..7452afe
--- /dev/null
+++ b/python/reboot_hetzner_server.py
@@ -0,0 +1,18 @@
1import sys
2import hetzner_helper
3
4instance = sys.argv[-1]
5actions = []
6if "--rescue" in sys.argv:
7 actions.append("enable_rescue")
8elif "--local" in sys.argv:
9 actions.append("disable_rescue")
10
11if "--hard" in sys.argv:
12 actions.append("reset")
13else:
14 actions.append("reboot")
15
16for action in actions:
17 result = hetzner_helper.post("servers/{}/actions/{}".format(instance, action))
18 print(result)