Merge lp:~ivoks/charm-helpers/multiple-origins into lp:charm-helpers

Proposed by Ante Karamatić
Status: Superseded
Proposed branch: lp:~ivoks/charm-helpers/multiple-origins
Merge into: lp:charm-helpers
Diff against target: 149 lines (+72/-66)
1 file modified
charmhelpers/contrib/openstack/utils.py (+72/-66)
To merge this branch: bzr merge lp:~ivoks/charm-helpers/multiple-origins
Reviewer Review Type Date Requested Status
Charm Helper Maintainers Pending
Review via email: mp+198529@code.launchpad.net

This proposal has been superseded by a proposal from 2013-12-11.

Description of the change

Allow setting multiple sources for openstack-origin. By accepting this change, openstack-origin could be defined as:

quantum-gateway:
 openstack-origin: 'cloud:precise-havana/updates, ppa:ivoks/cool-neutron-ppa, ppa:joe/cool-openvswitch-ppa'

To post a comment you must log in.
Revision history for this message
Ante Karamatić (ivoks) wrote :

Maybe a better approach would be to add additional 'additional-origins' or something, cause openstack-origin is used to guess the version of OpenStack that's being installed. That info is later on used to figure out stuff like Neutron or Quantum.

Unmerged revisions

107. By Ante Karamatić

Allow setting multiple sources for openstack-origin.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/openstack/utils.py'
2--- charmhelpers/contrib/openstack/utils.py 2013-12-04 13:25:24 +0000
3+++ charmhelpers/contrib/openstack/utils.py 2013-12-11 10:26:16 +0000
4@@ -212,73 +212,79 @@
5
6 def configure_installation_source(rel):
7 '''Configure apt installation source.'''
8- if rel == 'distro':
9- return
10- elif rel == 'distro-proposed':
11- ubuntu_rel = lsb_release()['DISTRIB_CODENAME']
12- with open('/etc/apt/sources.list.d/juju_deb.list', 'w') as f:
13- f.write(DISTRO_PROPOSED % ubuntu_rel)
14- elif rel[:4] == "ppa:":
15- src = rel
16- subprocess.check_call(["add-apt-repository", "-y", src])
17- elif rel[:3] == "deb":
18- l = len(rel.split('|'))
19- if l == 2:
20- src, key = rel.split('|')
21- juju_log("Importing PPA key from keyserver for %s" % src)
22- import_key(key)
23- elif l == 1:
24- src = rel
25- with open('/etc/apt/sources.list.d/juju_deb.list', 'w') as f:
26- f.write(src)
27- elif rel[:6] == 'cloud:':
28- ubuntu_rel = lsb_release()['DISTRIB_CODENAME']
29- rel = rel.split(':')[1]
30- u_rel = rel.split('-')[0]
31- ca_rel = rel.split('-')[1]
32-
33- if u_rel != ubuntu_rel:
34- e = 'Cannot install from Cloud Archive pocket %s on this Ubuntu '\
35- 'version (%s)' % (ca_rel, ubuntu_rel)
36- error_out(e)
37-
38- if 'staging' in ca_rel:
39- # staging is just a regular PPA.
40- os_rel = ca_rel.split('/')[0]
41- ppa = 'ppa:ubuntu-cloud-archive/%s-staging' % os_rel
42- cmd = 'add-apt-repository -y %s' % ppa
43- subprocess.check_call(cmd.split(' '))
44+ list = rel.replace(", ", ",").split(",")
45+ open('/etc/apt/sources.list.d/juju_deb.list', 'w').close()
46+ for each in list:
47+ if each == 'distro':
48 return
49-
50- # map charm config options to actual archive pockets.
51- pockets = {
52- 'folsom': 'precise-updates/folsom',
53- 'folsom/updates': 'precise-updates/folsom',
54- 'folsom/proposed': 'precise-proposed/folsom',
55- 'grizzly': 'precise-updates/grizzly',
56- 'grizzly/updates': 'precise-updates/grizzly',
57- 'grizzly/proposed': 'precise-proposed/grizzly',
58- 'havana': 'precise-updates/havana',
59- 'havana/updates': 'precise-updates/havana',
60- 'havana/proposed': 'precise-proposed/havana',
61- 'icehouse': 'precise-updates/icehouse',
62- 'icehouse/updates': 'precise-updates/icehouse',
63- 'icehouse/proposed': 'precise-proposed/icehouse',
64- }
65-
66- try:
67- pocket = pockets[ca_rel]
68- except KeyError:
69- e = 'Invalid Cloud Archive release specified: %s' % rel
70- error_out(e)
71-
72- src = "deb %s %s main" % (CLOUD_ARCHIVE_URL, pocket)
73- apt_install('ubuntu-cloud-keyring', fatal=True)
74-
75- with open('/etc/apt/sources.list.d/cloud-archive.list', 'w') as f:
76- f.write(src)
77- else:
78- error_out("Invalid openstack-release specified: %s" % rel)
79+ elif each == 'distro-proposed':
80+ ubuntu_rel = lsb_release()['DISTRIB_CODENAME']
81+ with open('/etc/apt/sources.list.d/juju_deb.list', 'a') as f:
82+ f.write(DISTRO_PROPOSED % ubuntu_rel)
83+ f.write('\n')
84+ elif each[:4] == "ppa:":
85+ src = each
86+ subprocess.check_call(["add-apt-repository", "-y", src])
87+ elif each[:3] == "deb":
88+ l = len(each.split('|'))
89+ if l == 2:
90+ src, key = each.split('|')
91+ juju_log("Importing PPA key from keyserver for %s" % src)
92+ import_key(key)
93+ elif l == 1:
94+ src = each
95+ with open('/etc/apt/sources.list.d/juju_deb.list', 'a') as f:
96+ f.write(src)
97+ f.write('\n')
98+ elif each[:6] == 'cloud:':
99+ ubuntu_rel = lsb_release()['DISTRIB_CODENAME']
100+ each = each.split(':')[1]
101+ u_rel = each.split('-')[0]
102+ ca_rel = each.split('-')[1]
103+
104+ if u_rel != ubuntu_rel:
105+ e = 'Cannot install from Cloud Archive pocket %s on this Ubuntu '\
106+ 'version (%s)' % (ca_rel, ubuntu_rel)
107+ error_out(e)
108+
109+ if 'staging' in ca_rel:
110+ # staging is just a regular PPA.
111+ os_rel = ca_rel.split('/')[0]
112+ ppa = 'ppa:ubuntu-cloud-archive/%s-staging' % os_rel
113+ cmd = 'add-apt-repository -y %s' % ppa
114+ subprocess.check_call(cmd.split(' '))
115+ return
116+
117+ # map charm config options to actual archive pockets.
118+ pockets = {
119+ 'folsom': 'precise-updates/folsom',
120+ 'folsom/updates': 'precise-updates/folsom',
121+ 'folsom/proposed': 'precise-proposed/folsom',
122+ 'grizzly': 'precise-updates/grizzly',
123+ 'grizzly/updates': 'precise-updates/grizzly',
124+ 'grizzly/proposed': 'precise-proposed/grizzly',
125+ 'havana': 'precise-updates/havana',
126+ 'havana/updates': 'precise-updates/havana',
127+ 'havana/proposed': 'precise-proposed/havana',
128+ 'icehouse': 'precise-updates/icehouse',
129+ 'icehouse/updates': 'precise-updates/icehouse',
130+ 'icehouse/proposed': 'precise-proposed/icehouse',
131+ }
132+
133+ try:
134+ pocket = pockets[ca_rel]
135+ except KeyError:
136+ e = 'Invalid Cloud Archive release specified: %s' % each
137+ error_out(e)
138+
139+ src = "deb %s %s main" % (CLOUD_ARCHIVE_URL, pocket)
140+ apt_install('ubuntu-cloud-keyring', fatal=True)
141+
142+ with open('/etc/apt/sources.list.d/cloud-archive.list', 'a') as f:
143+ f.write(src)
144+ f.write('\n')
145+ else:
146+ error_out("Invalid openstack-release specified: %s" % each)
147
148
149 def save_script_rc(script_path="scripts/scriptrc", **env_vars):

Subscribers

People subscribed via source and target branches