blob: 49d0cdcb6048717803a85e2018260f7ce6c0cd17 [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 = [
10 "nova-compute:shared-db mysql:shared-db",
11 "nova-compute:amqp rabbitmq-server:amqp",
12 "nova-compute glance",
13 "nova-compute nova-cloud-controller",
14 "ntp nova-compute",
15 "nova-compute nagios",
16 "nova-compute nrpe",
17 "nova-compute:nova-ceilometer ceilometer-agent:nova-ceilometer",
18 ]
19
20def addrelation(relation):
21 subprocess.check_call("juju add-relation %s" % relation, shell=True)
22
23def destroyrelation(relation):
24 subprocess.check_call("juju destroy-relation %s" % relation, shell=True)
25
26def addrelations():
27 for relation in relations:
28 print "Adding relation %s" % relation
29 try:
30 addrelation(relation)
31 time.sleep(sleep_interval)
32 except:
33 pass
34
35def destroyrelations():
36 for relation in relations:
37 print "Destroying relation %s" % relation
38 try:
39 destroyrelation(relation)
40 time.sleep(sleep_interval)
41 except:
42 pass
43
44def main():
45 parser = argparse.ArgumentParser(description='Deploy OpenStack controller services')
46 parser.add_argument('--destroy', action='store_true',
47 help='Destroy the relations instead of adding them')
48
49 args = parser.parse_args()
50 if args.destroy:
51 destroyrelations()
52 else:
53 addrelations()
54
55if __name__ =='__main__':
56 main()