]>
git.immae.eu Git - perso/Immae/Projets/Puppet.git/blob - python/reboot_ovh_vps_ssd.py
1 # -*- encoding: utf-8 -*-
6 # In case it's installed globally
11 # Credentials are stored in ~/.ovh.conf
15 vps_list
= client
.get('/vps/')
16 if sys
.argv
[-1] in vps_list
:
19 print("VPS not in list:")
24 if "--rescue" in sys
.argv
:
26 elif "--local" in sys
.argv
:
31 current_state
=client
.get("/vps/{}".format(vps
))["netbootMode"]
33 if netboot_mode
is None or current_state
== netboot_mode
:
34 client
.post("/vps/{}/reboot".format(vps
))
37 client
.put("/vps/{}".format(vps
), netbootMode
=netboot_mode
)
38 task_type
="setNetboot"
40 ovh_helper
.show_progress(client
, vps
, task_type
)