Merge lp:~james-page/charm-helpers/amulet-switch-to-cs into lp:charm-helpers

Proposed by James Page
Status: Merged
Merged at revision: 582
Proposed branch: lp:~james-page/charm-helpers/amulet-switch-to-cs
Merge into: lp:charm-helpers
Diff against target: 73 lines (+22/-29)
1 file modified
charmhelpers/contrib/openstack/amulet/deployment.py (+22/-29)
To merge this branch: bzr merge lp:~james-page/charm-helpers/amulet-switch-to-cs
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+297060@code.launchpad.net

Description of the change

Update amulet helpers to deploy charms from the charm store

As part of the migration to git/gerrit and with the introduction of
layered charms, the charm store really needs to be the definative
source of truth for all charms during test.

Switch the charm resolver code to pick the correct charms from the
charm store for amulet tests.

This does change behaviour in that base charms are deployed aligned
to the test series where possible; otherwise the most recent Ubuntu
series is used instead - results in mysql/trusty + keystone/xenial
for example.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/openstack/amulet/deployment.py'
2--- charmhelpers/contrib/openstack/amulet/deployment.py 2016-03-22 17:26:45 +0000
3+++ charmhelpers/contrib/openstack/amulet/deployment.py 2016-06-10 13:40:53 +0000
4@@ -43,9 +43,6 @@
5 self.openstack = openstack
6 self.source = source
7 self.stable = stable
8- # Note(coreycb): this needs to be changed when new next branches come
9- # out.
10- self.current_next = "trusty"
11
12 def get_logger(self, name="deployment-logger", level=logging.DEBUG):
13 """Get a logger object that will log to stdout."""
14@@ -72,38 +69,34 @@
15
16 self.log.info('OpenStackAmuletDeployment: determine branch locations')
17
18- # Charms outside the lp:~openstack-charmers namespace
19- base_charms = ['mysql', 'mongodb', 'nrpe']
20-
21- # Force these charms to current series even when using an older series.
22- # ie. Use trusty/nrpe even when series is precise, as the P charm
23- # does not possess the necessary external master config and hooks.
24- force_series_current = ['nrpe']
25-
26- if self.series in ['precise', 'trusty']:
27- base_series = self.series
28- else:
29- base_series = self.current_next
30+ # Charms outside the ~openstack-charmers
31+ base_charms = {
32+ 'mysql': ['precise', 'trusty'],
33+ 'mongodb': ['precise', 'trusty'],
34+ 'nrpe': ['precise', 'trusty'],
35+ }
36
37 for svc in other_services:
38- if svc['name'] in force_series_current:
39- base_series = self.current_next
40 # If a location has been explicitly set, use it
41 if svc.get('location'):
42 continue
43- if self.stable:
44- temp = 'lp:charms/{}/{}'
45- svc['location'] = temp.format(base_series,
46- svc['name'])
47+ if svc['name'] in base_charms:
48+ # NOTE: not all charms have support for all series we
49+ # want/need to test against, so fix to most recent
50+ # that each base charm supports
51+ target_series = self.series
52+ if self.series not in base_charms[svc['name']]:
53+ target_series = base_charms[svc['name']][-1]
54+ svc['location'] = 'cs:{}/{}'.format(target_series,
55+ svc['name'])
56+ elif self.stable:
57+ svc['location'] = 'cs:{}/{}'.format(self.series,
58+ svc['name'])
59 else:
60- if svc['name'] in base_charms:
61- temp = 'lp:charms/{}/{}'
62- svc['location'] = temp.format(base_series,
63- svc['name'])
64- else:
65- temp = 'lp:~openstack-charmers/charms/{}/{}/next'
66- svc['location'] = temp.format(self.current_next,
67- svc['name'])
68+ svc['location'] = 'cs:~openstack-charmers-next/{}/{}'.format(
69+ self.series,
70+ svc['name']
71+ )
72
73 return other_services
74

Subscribers

People subscribed via source and target branches