~james-page/charms/trusty/cinder/https-multi-network

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/amulet/deployment.py

  • Committer: james.page at ubuntu
  • Date: 2014-10-01 22:07:44 UTC
  • mfrom: (45.1.1 cinder)
  • Revision ID: james.page@ubuntu.com-20141001220744-v35hu9iblt15phc7
Rebase and resync

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
       that is specifically for use by OpenStack charms.
11
11
       """
12
12
 
13
 
    def __init__(self, series=None, openstack=None, source=None):
 
13
    def __init__(self, series=None, openstack=None, source=None, stable=True):
14
14
        """Initialize the deployment environment."""
15
15
        super(OpenStackAmuletDeployment, self).__init__(series)
16
16
        self.openstack = openstack
17
17
        self.source = source
 
18
        self.stable = stable
 
19
        # Note(coreycb): this needs to be changed when new next branches come
 
20
        # out.
 
21
        self.current_next = "trusty"
 
22
 
 
23
    def _determine_branch_locations(self, other_services):
 
24
        """Determine the branch locations for the other services.
 
25
 
 
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']
 
30
 
 
31
        if self.stable:
 
32
            for svc in other_services:
 
33
                temp = 'lp:charms/{}'
 
34
                svc['location'] = temp.format(svc['name'])
 
35
        else:
 
36
            for svc in other_services:
 
37
                if svc['name'] in base_charms:
 
38
                    temp = 'lp:charms/{}'
 
39
                    svc['location'] = temp.format(svc['name'])
 
40
                else:
 
41
                    temp = 'lp:~openstack-charmers/charms/{}/{}/next'
 
42
                    svc['location'] = temp.format(self.current_next,
 
43
                                                  svc['name'])
 
44
        return other_services
18
45
 
19
46
    def _add_services(self, this_service, other_services):
20
 
        """Add services to the deployment and set openstack-origin."""
 
47
        """Add services to the deployment and set openstack-origin/source."""
 
48
        other_services = self._determine_branch_locations(other_services)
 
49
 
21
50
        super(OpenStackAmuletDeployment, self)._add_services(this_service,
22
51
                                                             other_services)
23
 
        name = 0
 
52
 
24
53
        services = other_services
25
54
        services.append(this_service)
26
 
        use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph']
 
55
        use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
 
56
                      'ceph-osd', 'ceph-radosgw']
27
57
 
28
58
        if self.openstack:
29
59
            for svc in services:
30
 
                if svc[name] not in use_source:
 
60
                if svc['name'] not in use_source:
31
61
                    config = {'openstack-origin': self.openstack}
32
 
                    self.d.configure(svc[name], config)
 
62
                    self.d.configure(svc['name'], config)
33
63
 
34
64
        if self.source:
35
65
            for svc in services:
36
 
                if svc[name] in use_source:
 
66
                if svc['name'] in use_source:
37
67
                    config = {'source': self.source}
38
 
                    self.d.configure(svc[name], config)
 
68
                    self.d.configure(svc['name'], config)
39
69
 
40
70
    def _configure_services(self, configs):
41
71
        """Configure all of the services."""