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
=== modified file 'charmhelpers/contrib/openstack/utils.py'
--- charmhelpers/contrib/openstack/utils.py 2013-12-04 13:25:24 +0000
+++ charmhelpers/contrib/openstack/utils.py 2013-12-11 10:26:16 +0000
@@ -212,73 +212,79 @@
212212
213def configure_installation_source(rel):213def configure_installation_source(rel):
214 '''Configure apt installation source.'''214 '''Configure apt installation source.'''
215 if rel == 'distro':215 list = rel.replace(", ", ",").split(",")
216 return216 open('/etc/apt/sources.list.d/juju_deb.list', 'w').close()
217 elif rel == 'distro-proposed':217 for each in list:
218 ubuntu_rel = lsb_release()['DISTRIB_CODENAME']218 if each == 'distro':
219 with open('/etc/apt/sources.list.d/juju_deb.list', 'w') as f:
220 f.write(DISTRO_PROPOSED % ubuntu_rel)
221 elif rel[:4] == "ppa:":
222 src = rel
223 subprocess.check_call(["add-apt-repository", "-y", src])
224 elif rel[:3] == "deb":
225 l = len(rel.split('|'))
226 if l == 2:
227 src, key = rel.split('|')
228 juju_log("Importing PPA key from keyserver for %s" % src)
229 import_key(key)
230 elif l == 1:
231 src = rel
232 with open('/etc/apt/sources.list.d/juju_deb.list', 'w') as f:
233 f.write(src)
234 elif rel[:6] == 'cloud:':
235 ubuntu_rel = lsb_release()['DISTRIB_CODENAME']
236 rel = rel.split(':')[1]
237 u_rel = rel.split('-')[0]
238 ca_rel = rel.split('-')[1]
239
240 if u_rel != ubuntu_rel:
241 e = 'Cannot install from Cloud Archive pocket %s on this Ubuntu '\
242 'version (%s)' % (ca_rel, ubuntu_rel)
243 error_out(e)
244
245 if 'staging' in ca_rel:
246 # staging is just a regular PPA.
247 os_rel = ca_rel.split('/')[0]
248 ppa = 'ppa:ubuntu-cloud-archive/%s-staging' % os_rel
249 cmd = 'add-apt-repository -y %s' % ppa
250 subprocess.check_call(cmd.split(' '))
251 return219 return
252220 elif each == 'distro-proposed':
253 # map charm config options to actual archive pockets.221 ubuntu_rel = lsb_release()['DISTRIB_CODENAME']
254 pockets = {222 with open('/etc/apt/sources.list.d/juju_deb.list', 'a') as f:
255 'folsom': 'precise-updates/folsom',223 f.write(DISTRO_PROPOSED % ubuntu_rel)
256 'folsom/updates': 'precise-updates/folsom',224 f.write('\n')
257 'folsom/proposed': 'precise-proposed/folsom',225 elif each[:4] == "ppa:":
258 'grizzly': 'precise-updates/grizzly',226 src = each
259 'grizzly/updates': 'precise-updates/grizzly',227 subprocess.check_call(["add-apt-repository", "-y", src])
260 'grizzly/proposed': 'precise-proposed/grizzly',228 elif each[:3] == "deb":
261 'havana': 'precise-updates/havana',229 l = len(each.split('|'))
262 'havana/updates': 'precise-updates/havana',230 if l == 2:
263 'havana/proposed': 'precise-proposed/havana',231 src, key = each.split('|')
264 'icehouse': 'precise-updates/icehouse',232 juju_log("Importing PPA key from keyserver for %s" % src)
265 'icehouse/updates': 'precise-updates/icehouse',233 import_key(key)
266 'icehouse/proposed': 'precise-proposed/icehouse',234 elif l == 1:
267 }235 src = each
268236 with open('/etc/apt/sources.list.d/juju_deb.list', 'a') as f:
269 try:237 f.write(src)
270 pocket = pockets[ca_rel]238 f.write('\n')
271 except KeyError:239 elif each[:6] == 'cloud:':
272 e = 'Invalid Cloud Archive release specified: %s' % rel240 ubuntu_rel = lsb_release()['DISTRIB_CODENAME']
273 error_out(e)241 each = each.split(':')[1]
274242 u_rel = each.split('-')[0]
275 src = "deb %s %s main" % (CLOUD_ARCHIVE_URL, pocket)243 ca_rel = each.split('-')[1]
276 apt_install('ubuntu-cloud-keyring', fatal=True)244
277245 if u_rel != ubuntu_rel:
278 with open('/etc/apt/sources.list.d/cloud-archive.list', 'w') as f:246 e = 'Cannot install from Cloud Archive pocket %s on this Ubuntu '\
279 f.write(src)247 'version (%s)' % (ca_rel, ubuntu_rel)
280 else:248 error_out(e)
281 error_out("Invalid openstack-release specified: %s" % rel)249
250 if 'staging' in ca_rel:
251 # staging is just a regular PPA.
252 os_rel = ca_rel.split('/')[0]
253 ppa = 'ppa:ubuntu-cloud-archive/%s-staging' % os_rel
254 cmd = 'add-apt-repository -y %s' % ppa
255 subprocess.check_call(cmd.split(' '))
256 return
257
258 # map charm config options to actual archive pockets.
259 pockets = {
260 'folsom': 'precise-updates/folsom',
261 'folsom/updates': 'precise-updates/folsom',
262 'folsom/proposed': 'precise-proposed/folsom',
263 'grizzly': 'precise-updates/grizzly',
264 'grizzly/updates': 'precise-updates/grizzly',
265 'grizzly/proposed': 'precise-proposed/grizzly',
266 'havana': 'precise-updates/havana',
267 'havana/updates': 'precise-updates/havana',
268 'havana/proposed': 'precise-proposed/havana',
269 'icehouse': 'precise-updates/icehouse',
270 'icehouse/updates': 'precise-updates/icehouse',
271 'icehouse/proposed': 'precise-proposed/icehouse',
272 }
273
274 try:
275 pocket = pockets[ca_rel]
276 except KeyError:
277 e = 'Invalid Cloud Archive release specified: %s' % each
278 error_out(e)
279
280 src = "deb %s %s main" % (CLOUD_ARCHIVE_URL, pocket)
281 apt_install('ubuntu-cloud-keyring', fatal=True)
282
283 with open('/etc/apt/sources.list.d/cloud-archive.list', 'a') as f:
284 f.write(src)
285 f.write('\n')
286 else:
287 error_out("Invalid openstack-release specified: %s" % each)
282288
283289
284def save_script_rc(script_path="scripts/scriptrc", **env_vars):290def save_script_rc(script_path="scripts/scriptrc", **env_vars):

Subscribers

People subscribed via source and target branches