blob: 1be59abacfb528458aeb6d399f39a0ba943231fc [file] [log] [blame]
Andy Bavier8d51c6c2015-04-01 11:40:22 -04001#!/usr/bin/python
2
3import subprocess
4import time
5import argparse
6
7sleep_interval = 1
8
9relations = ["keystone mysql",
10 "nova-cloud-controller mysql",
11 "nova-cloud-controller rabbitmq-server",
12 "nova-cloud-controller glance",
13 "nova-cloud-controller keystone",
14 "glance mysql",
15 "glance keystone",
16 "quantum-gateway mysql",
17 "quantum-gateway rabbitmq-server",
18 "quantum-gateway nova-cloud-controller",
19 "openstack-dashboard keystone",
20 "ntp nova-cloud-controller",
21 "mysql nagios",
22 "rabbitmq-server nagios",
23 "keystone nagios",
24 "glance nagios",
25 "nova-cloud-controller nagios",
26 "quantum-gateway nagios",
27 "openstack-dashboard nagios",
28 "nagios nrpe",
29 "mysql nrpe",
30 "rabbitmq-server nrpe",
31 "keystone nrpe",
32 "glance nrpe",
33 "nova-cloud-controller nrpe",
34 "quantum-gateway nrpe",
35 "openstack-dashboard nrpe",
36 "ceilometer mongodb",
37 "ceilometer rabbitmq-server",
38 "ceilometer:identity-service keystone:identity-service",
39 "ceilometer:ceilometer-service ceilometer-agent:ceilometer-service",
40 "ceilometer nagios",
41 "ceilometer nrpe",
42 ]
43
44def addrelation(relation):
45 subprocess.check_call("juju add-relation %s" % relation, shell=True)
46
47def destroyrelation(relation):
48 subprocess.check_call("juju destroy-relation %s" % relation, shell=True)
49
50def addrelations():
51 for relation in relations:
52 print "Adding relation %s" % relation
53 try:
54 addrelation(relation)
55 time.sleep(sleep_interval)
56 except:
57 pass
58
59def destroyrelations():
60 for relation in relations:
61 print "Destroying relation %s" % relation
62 try:
63 destroyrelation(relation)
64 time.sleep(sleep_interval)
65 except:
66 pass
67
68def main():
69 parser = argparse.ArgumentParser(description='Deploy OpenStack controller services')
70 parser.add_argument('--destroy', action='store_true',
71 help='Destroy the relations instead of adding them')
72
73 args = parser.parse_args()
74 if args.destroy:
75 destroyrelations()
76 else:
77 addrelations()
78
79if __name__ =='__main__':
80 main()