]>
git.immae.eu Git - perso/Immae/Projets/Puppet.git/blob - python/get_initial_configuration_ovh_cloud_instance.py
1 # -*- encoding: utf-8 -*-
6 # In case it's installed globally
9 from ovh_helper
import find_cloud_instance
13 # Credentials are stored in ~/.ovh.conf
17 _
, instance
= find_cloud_instance(client
, sys
.argv
[-1])
20 for ip_infos
in instance
["ipAddresses"]:
21 ip_infos
["ipAddress"] = ip_infos
.pop("ip")
22 ip_infos
["gateway"] = ip_infos
.pop("gatewayIp")
24 if ip_infos
["version"] == 4:
25 infos
["ips"]["v4"] = ip_infos
27 infos
["ips"]["v6"] = ip_infos
28 infos
["ips"]["v6"]["mask"] = 128
30 print(json
.dumps(infos
))