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

« back to all changes in this revision

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

  • Committer: James Page
  • Date: 2014-06-24 11:05:17 UTC
  • Revision ID: james.page@ubuntu.com-20140624110517-7chb3mwca2mtnmlp
Resync helpers, add standard targets to Makefile

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from charmhelpers.contrib.amulet.deployment import (
 
2
    AmuletDeployment
 
3
)
 
4
 
 
5
 
 
6
class OpenStackAmuletDeployment(AmuletDeployment):
 
7
    """This class inherits from AmuletDeployment and has additional support
 
8
       that is specifically for use by OpenStack charms."""
 
9
 
 
10
    def __init__(self, series=None, openstack=None):
 
11
        """Initialize the deployment environment."""
 
12
        self.openstack = None
 
13
        super(OpenStackAmuletDeployment, self).__init__(series)
 
14
 
 
15
        if openstack:
 
16
            self.openstack = openstack
 
17
 
 
18
    def _configure_services(self, configs):
 
19
        """Configure all of the services."""
 
20
        for service, config in configs.iteritems():
 
21
            if service == self.this_service:
 
22
                config['openstack-origin'] = self.openstack
 
23
            self.d.configure(service, config)
 
24
 
 
25
    def _get_openstack_release(self):
 
26
        """Return an integer representing the enum value of the openstack
 
27
           release."""
 
28
        self.precise_essex, self.precise_folsom, self.precise_grizzly, \
 
29
            self.precise_havana, self.precise_icehouse, \
 
30
            self.trusty_icehouse = range(6)
 
31
        releases = {
 
32
            ('precise', None): self.precise_essex,
 
33
            ('precise', 'cloud:precise-folsom'): self.precise_folsom,
 
34
            ('precise', 'cloud:precise-grizzly'): self.precise_grizzly,
 
35
            ('precise', 'cloud:precise-havana'): self.precise_havana,
 
36
            ('precise', 'cloud:precise-icehouse'): self.precise_icehouse,
 
37
            ('trusty', None): self.trusty_icehouse}
 
38
        return releases[(self.series, self.openstack)]