13
10
that is specifically for use by OpenStack charms.
16
def __init__(self, series=None, openstack=None, source=None):
13
def __init__(self, series=None, openstack=None, source=None, stable=True):
17
14
"""Initialize the deployment environment."""
18
15
super(OpenStackAmuletDeployment, self).__init__(series)
19
16
self.openstack = openstack
20
17
self.source = source
22
def _is_dev_branch(self):
23
"""Determine if branch being tested is a dev (i.e. next) branch."""
24
branch = Branch.open(os.getcwd())
25
parent = branch.get_parent()
26
pattern = re.compile("^.*/next/$")
27
if (pattern.match(parent)):
19
# Note(coreycb): this needs to be changed when new next branches come
21
self.current_next = "trusty"
32
23
def _determine_branch_locations(self, other_services):
33
24
"""Determine the branch locations for the other services.
35
If the branch being tested is a dev branch, then determine the
36
development branch locations for the other services. Otherwise,
37
the default charm store branches will be used."""
39
if self._is_dev_branch():
41
for svc in other_services:
42
if svc[name] in ['mysql', 'mongodb', 'rabbitmq-server']:
43
location = 'lp:charms/{}'.format(svc[name])
26
Determine if the local branch being tested is derived from its
27
stable or next (dev) branch, and based on this, use the corresonding
28
stable or next branches for the other_services."""
29
base_charms = ['mysql', 'mongodb', 'rabbitmq-server']
32
for svc in other_services:
34
svc['location'] = temp.format(svc['name'])
36
for svc in other_services:
37
if svc['name'] in base_charms:
39
svc['location'] = temp.format(svc['name'])
45
temp = 'lp:~openstack-charmers/charms/trusty/{}/next'
46
location = temp.format(svc[name])
47
updated_services.append(svc + (location,))
48
other_services = updated_services
41
temp = 'lp:~openstack-charmers/charms/{}/{}/next'
42
svc['location'] = temp.format(self.current_next,
49
44
return other_services
51
46
def _add_services(self, this_service, other_services):
52
47
"""Add services to the deployment and set openstack-origin/source."""
54
48
other_services = self._determine_branch_locations(other_services)
55
50
super(OpenStackAmuletDeployment, self)._add_services(this_service,
57
53
services = other_services
58
54
services.append(this_service)
59
use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph']
55
use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
56
'ceph-osd', 'ceph-radosgw']
62
59
for svc in services:
63
if svc[name] not in use_source:
60
if svc['name'] not in use_source:
64
61
config = {'openstack-origin': self.openstack}
65
self.d.configure(svc[name], config)
62
self.d.configure(svc['name'], config)
68
65
for svc in services:
69
if svc[name] in use_source:
66
if svc['name'] in use_source:
70
67
config = {'source': self.source}
71
self.d.configure(svc[name], config)
68
self.d.configure(svc['name'], config)
73
70
def _configure_services(self, configs):
74
71
"""Configure all of the services."""