1
from charmhelpers.contrib.amulet.deployment import (
6
class OpenStackAmuletDeployment(AmuletDeployment):
7
"""OpenStack amulet deployment.
9
This class inherits from AmuletDeployment and has additional support
10
that is specifically for use by OpenStack charms.
13
def __init__(self, series=None, openstack=None, source=None, stable=True):
14
"""Initialize the deployment environment."""
15
super(OpenStackAmuletDeployment, self).__init__(series)
16
self.openstack = openstack
19
# Note(coreycb): this needs to be changed when new next branches come
21
self.current_next = "trusty"
23
def _determine_branch_locations(self, other_services):
24
"""Determine the branch locations for the other services.
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'])
41
temp = 'lp:~openstack-charmers/charms/{}/{}/next'
42
svc['location'] = temp.format(self.current_next,
46
def _add_services(self, this_service, other_services):
47
"""Add services to the deployment and set openstack-origin/source."""
48
other_services = self._determine_branch_locations(other_services)
50
super(OpenStackAmuletDeployment, self)._add_services(this_service,
53
services = other_services
54
services.append(this_service)
55
use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
56
'ceph-osd', 'ceph-radosgw']
60
if svc['name'] not in use_source:
61
config = {'openstack-origin': self.openstack}
62
self.d.configure(svc['name'], config)
66
if svc['name'] in use_source:
67
config = {'source': self.source}
68
self.d.configure(svc['name'], config)
70
def _configure_services(self, configs):
71
"""Configure all of the services."""
72
for service, config in configs.iteritems():
73
self.d.configure(service, config)
75
def _get_openstack_release(self):
76
"""Get openstack release.
78
Return an integer representing the enum value of the openstack
81
(self.precise_essex, self.precise_folsom, self.precise_grizzly,
82
self.precise_havana, self.precise_icehouse,
83
self.trusty_icehouse) = range(6)
85
('precise', None): self.precise_essex,
86
('precise', 'cloud:precise-folsom'): self.precise_folsom,
87
('precise', 'cloud:precise-grizzly'): self.precise_grizzly,
88
('precise', 'cloud:precise-havana'): self.precise_havana,
89
('precise', 'cloud:precise-icehouse'): self.precise_icehouse,
90
('trusty', None): self.trusty_icehouse}
91
return releases[(self.series, self.openstack)]