~ionutbalutoiu/charms/trusty/neutron-api/next

« back to all changes in this revision

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

  • Committer: Liam Young
  • Date: 2014-07-29 07:06:21 UTC
  • mfrom: (35.2.12 trunk)
  • Revision ID: liam.young@canonical.com-20140729070621-h535klsdxdfrvmxv
[jamespage,r=gnuoy] Add support for multiple network configuration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
    """This class inherits from AmuletDeployment and has additional support
8
8
       that is specifically for use by OpenStack charms."""
9
9
 
10
 
    def __init__(self, series=None, openstack=None):
 
10
    def __init__(self, series=None, openstack=None, source=None):
11
11
        """Initialize the deployment environment."""
12
 
        self.openstack = None
13
12
        super(OpenStackAmuletDeployment, self).__init__(series)
14
 
 
15
 
        if openstack:
16
 
            self.openstack = openstack
 
13
        self.openstack = openstack
 
14
        self.source = source
 
15
 
 
16
    def _add_services(self, this_service, other_services):
 
17
        """Add services to the deployment and set openstack-origin."""
 
18
        super(OpenStackAmuletDeployment, self)._add_services(this_service,
 
19
                                                             other_services)
 
20
        name = 0
 
21
        services = other_services
 
22
        services.append(this_service)
 
23
        use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph']
 
24
 
 
25
        if self.openstack:
 
26
            for svc in services:
 
27
                if svc[name] not in use_source:
 
28
                    config = {'openstack-origin': self.openstack}
 
29
                    self.d.configure(svc[name], config)
 
30
 
 
31
        if self.source:
 
32
            for svc in services:
 
33
                if svc[name] in use_source:
 
34
                    config = {'source': self.source}
 
35
                    self.d.configure(svc[name], config)
17
36
 
18
37
    def _configure_services(self, configs):
19
38
        """Configure all of the services."""
20
39
        for service, config in configs.iteritems():
21
 
            if service == self.this_service:
22
 
                config['openstack-origin'] = self.openstack
23
40
            self.d.configure(service, config)
24
41
 
25
42
    def _get_openstack_release(self):