blob: 535b5d4b74e6b71004b7553255d3d3f84b566c54 [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",
Andy Bavier093e6a82015-08-21 13:31:31 -040014 "nova-compute neutron-openvswitch",
Andy Bavier8d51c6c2015-04-01 11:40:22 -040015 "ntp nova-compute",
16 "nova-compute nagios",
17 "nova-compute nrpe",
18 "nova-compute:nova-ceilometer ceilometer-agent:nova-ceilometer",
19 ]
20
21def addrelation(relation):
22 subprocess.check_call("juju add-relation %s" % relation, shell=True)
23
24def destroyrelation(relation):
25 subprocess.check_call("juju destroy-relation %s" % relation, shell=True)
26
27def addrelations():
28 for relation in relations:
29 print "Adding relation %s" % relation
30 try:
31 addrelation(relation)
32 time.sleep(sleep_interval)
33 except:
34 pass
Andy Bavier093e6a82015-08-21 13:31:31 -040035
Andy Bavier8d51c6c2015-04-01 11:40:22 -040036def destroyrelations():
37 for relation in relations:
38 print "Destroying relation %s" % relation
39 try:
40 destroyrelation(relation)
41 time.sleep(sleep_interval)
42 except:
43 pass
44
45def main():
46 parser = argparse.ArgumentParser(description='Deploy OpenStack controller services')
47 parser.add_argument('--destroy', action='store_true',
48 help='Destroy the relations instead of adding them')
49
50 args = parser.parse_args()
51 if args.destroy:
52 destroyrelations()
53 else:
54 addrelations()
Andy Bavier093e6a82015-08-21 13:31:31 -040055
Andy Bavier8d51c6c2015-04-01 11:40:22 -040056if __name__ =='__main__':
57 main()