~openstack-charmers-next/charms/wily/swift-storage/trunk

« back to all changes in this revision

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

  • Committer: James Page
  • Date: 2016-06-17 11:01:16 UTC
  • Revision ID: james.page@ubuntu.com-20160617110116-q2rjj67vj2hr3mdh
Switch to using charm-store for amulet tests

All OpenStack charms are now directly published to the charm store
on landing; switch Amulet helper to resolve charms using the
charm store rather than bzr branches, removing the lag between
charm changes landing and being available for other charms to
use for testing.

This is also important for new layered charms where the charm must
be build and published prior to being consumable.

Change-Id: Iebb7837721f08a4f7cf0657ede5e6822045608b2

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
        self.openstack = openstack
44
44
        self.source = source
45
45
        self.stable = stable
46
 
        # Note(coreycb): this needs to be changed when new next branches come
47
 
        # out.
48
 
        self.current_next = "trusty"
49
46
 
50
47
    def get_logger(self, name="deployment-logger", level=logging.DEBUG):
51
48
        """Get a logger object that will log to stdout."""
72
69
 
73
70
        self.log.info('OpenStackAmuletDeployment:  determine branch locations')
74
71
 
75
 
        # Charms outside the lp:~openstack-charmers namespace
76
 
        base_charms = ['mysql', 'mongodb', 'nrpe']
77
 
 
78
 
        # Force these charms to current series even when using an older series.
79
 
        # ie. Use trusty/nrpe even when series is precise, as the P charm
80
 
        # does not possess the necessary external master config and hooks.
81
 
        force_series_current = ['nrpe']
82
 
 
83
 
        if self.series in ['precise', 'trusty']:
84
 
            base_series = self.series
85
 
        else:
86
 
            base_series = self.current_next
 
72
        # Charms outside the ~openstack-charmers
 
73
        base_charms = {
 
74
            'mysql': ['precise', 'trusty'],
 
75
            'mongodb': ['precise', 'trusty'],
 
76
            'nrpe': ['precise', 'trusty'],
 
77
        }
87
78
 
88
79
        for svc in other_services:
89
 
            if svc['name'] in force_series_current:
90
 
                base_series = self.current_next
91
80
            # If a location has been explicitly set, use it
92
81
            if svc.get('location'):
93
82
                continue
94
 
            if self.stable:
95
 
                temp = 'lp:charms/{}/{}'
96
 
                svc['location'] = temp.format(base_series,
97
 
                                              svc['name'])
 
83
            if svc['name'] in base_charms:
 
84
                # NOTE: not all charms have support for all series we
 
85
                #       want/need to test against, so fix to most recent
 
86
                #       that each base charm supports
 
87
                target_series = self.series
 
88
                if self.series not in base_charms[svc['name']]:
 
89
                    target_series = base_charms[svc['name']][-1]
 
90
                svc['location'] = 'cs:{}/{}'.format(target_series,
 
91
                                                    svc['name'])
 
92
            elif self.stable:
 
93
                svc['location'] = 'cs:{}/{}'.format(self.series,
 
94
                                                    svc['name'])
98
95
            else:
99
 
                if svc['name'] in base_charms:
100
 
                    temp = 'lp:charms/{}/{}'
101
 
                    svc['location'] = temp.format(base_series,
102
 
                                                  svc['name'])
103
 
                else:
104
 
                    temp = 'lp:~openstack-charmers/charms/{}/{}/next'
105
 
                    svc['location'] = temp.format(self.current_next,
106
 
                                                  svc['name'])
 
96
                svc['location'] = 'cs:~openstack-charmers-next/{}/{}'.format(
 
97
                    self.series,
 
98
                    svc['name']
 
99
                )
107
100
 
108
101
        return other_services
109
102