]>
git.immae.eu Git - perso/Immae/Projets/Puppet.git/blob - python/reboot_ovh_cloud_instance.py
1 # -*- encoding: utf-8 -*-
6 # In case it's installed globally
9 from ovh_helper
import find_cloud_instance
11 # Credentials are stored in ~/.ovh.conf
15 project
, instance
= find_cloud_instance(client
, sys
.argv
[-1])
17 if "--rescue" in sys
.argv
:
19 elif "--local" in sys
.argv
:
24 if netboot_mode
is not None:
25 result
= client
.post("/cloud/project/{}/instance/{}/rescueMode".format(project
,
26 instance
["id"]), imageId
=instance
["imageId"], rescue
=(netboot_mode
== "rescue"))
29 result
= client
.post("/cloud/project/{}/instance/{}/reboot".format(project
, instance
["id"]), type="soft")
33 #result = client.post("/cloud/project/{}/instance/{}/reboot".format(project, instance["id"]), type="soft")