]>
git.immae.eu Git - perso/Immae/Projets/Puppet.git/blob - python/reboot_vps_server.py
7ea301a3445b5d9e6a2573ca510ebb84944f56d9
1 # -*- encoding: utf-8 -*-
7 # Credentials are stored in ~/.ovh.conf
11 vps_list
= client
.get('/vps/')
12 if sys
.argv
[-1] in vps_list
:
15 print("VPS not in list:")
20 if "--rescue" in sys
.argv
:
22 elif "--local" in sys
.argv
:
27 current_state
=client
.get("/vps/{}".format(vps
))["netbootMode"]
29 if netboot_mode
is None or current_state
== netboot_mode
:
30 client
.post("/vps/{}/reboot".format(vps
))
33 client
.put("/vps/{}".format(vps
), netbootMode
=netboot_mode
)
34 task_type
="setNetboot"
36 ovh_helper
.show_progress(client
, vps
, task_type
)