~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: 2015-09-28 12:41:31 UTC
  • mfrom: (142.2.1 trunk)
  • Revision ID: liam.young@canonical.com-20150928124131-hzlbsw4n1ligxsm2
[hopem, r=gnuoy] Sync charmhelpers to get fix for bug 1499643

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
           Determine if the local branch being tested is derived from its
45
45
           stable or next (dev) branch, and based on this, use the corresonding
46
46
           stable or next branches for the other_services."""
 
47
 
 
48
        # Charms outside the lp:~openstack-charmers namespace
47
49
        base_charms = ['mysql', 'mongodb', 'nrpe']
48
50
 
 
51
        # Force these charms to current series even when using an older series.
 
52
        # ie. Use trusty/nrpe even when series is precise, as the P charm
 
53
        # does not possess the necessary external master config and hooks.
 
54
        force_series_current = ['nrpe']
 
55
 
49
56
        if self.series in ['precise', 'trusty']:
50
57
            base_series = self.series
51
58
        else:
52
59
            base_series = self.current_next
53
60
 
54
 
        if self.stable:
55
 
            for svc in other_services:
 
61
        for svc in other_services:
 
62
            if svc['name'] in force_series_current:
 
63
                base_series = self.current_next
 
64
            # If a location has been explicitly set, use it
 
65
            if svc.get('location'):
 
66
                continue
 
67
            if self.stable:
56
68
                temp = 'lp:charms/{}/{}'
57
69
                svc['location'] = temp.format(base_series,
58
70
                                              svc['name'])
59
 
        else:
60
 
            for svc in other_services:
 
71
            else:
61
72
                if svc['name'] in base_charms:
62
73
                    temp = 'lp:charms/{}/{}'
63
74
                    svc['location'] = temp.format(base_series,
66
77
                    temp = 'lp:~openstack-charmers/charms/{}/{}/next'
67
78
                    svc['location'] = temp.format(self.current_next,
68
79
                                                  svc['name'])
 
80
 
69
81
        return other_services
70
82
 
71
83
    def _add_services(self, this_service, other_services):
77
89
 
78
90
        services = other_services
79
91
        services.append(this_service)
 
92
 
 
93
        # Charms which should use the source config option
80
94
        use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
81
95
                      'ceph-osd', 'ceph-radosgw']
82
 
        # Most OpenStack subordinate charms do not expose an origin option
83
 
        # as that is controlled by the principle.
84
 
        ignore = ['cinder-ceph', 'hacluster', 'neutron-openvswitch', 'nrpe']
 
96
 
 
97
        # Charms which can not use openstack-origin, ie. many subordinates
 
98
        no_origin = ['cinder-ceph', 'hacluster', 'neutron-openvswitch', 'nrpe']
85
99
 
86
100
        if self.openstack:
87
101
            for svc in services:
88
 
                if svc['name'] not in use_source + ignore:
 
102
                if svc['name'] not in use_source + no_origin:
89
103
                    config = {'openstack-origin': self.openstack}
90
104
                    self.d.configure(svc['name'], config)
91
105
 
92
106
        if self.source:
93
107
            for svc in services:
94
 
                if svc['name'] in use_source and svc['name'] not in ignore:
 
108
                if svc['name'] in use_source and svc['name'] not in no_origin:
95
109
                    config = {'source': self.source}
96
110
                    self.d.configure(svc['name'], config)
97
111