56
55
'icehouse/proposed': 'precise-proposed/icehouse',
57
56
'precise-icehouse/proposed': 'precise-proposed/icehouse',
58
57
'precise-proposed/icehouse': 'precise-proposed/icehouse',
59
'juno': 'trusty-updates/juno',
60
'trusty-juno': 'trusty-updates/juno',
61
'trusty-juno/updates': 'trusty-updates/juno',
62
'trusty-updates/juno': 'trusty-updates/juno',
63
'juno/proposed': 'trusty-proposed/juno',
64
'juno/proposed': 'trusty-proposed/juno',
65
'trusty-juno/proposed': 'trusty-proposed/juno',
66
'trusty-proposed/juno': 'trusty-proposed/juno',
61
69
# The order of this list is very important. Handlers should be listed in from
226
235
sources_var='install_sources',
227
236
keys_var='install_keys'):
229
Configure multiple sources from charm configuration
238
Configure multiple sources from charm configuration.
240
The lists are encoded as yaml fragments in the configuration.
241
The frament needs to be included as a string.
234
246
- "http://example.com/repo precise main"
239
251
Note that 'null' (a.k.a. None) should not be quoted.
241
sources = safe_load(config(sources_var))
242
keys = config(keys_var)
244
keys = safe_load(keys)
245
if isinstance(sources, basestring) and (
246
keys is None or isinstance(keys, basestring)):
247
add_source(sources, keys)
253
sources = safe_load((config(sources_var) or '').strip()) or []
254
keys = safe_load((config(keys_var) or '').strip()) or None
256
if isinstance(sources, basestring):
260
for source in sources:
261
add_source(source, None)
249
if not len(sources) == len(keys):
250
msg = 'Install sources and keys lists are different lengths'
251
raise SourceConfigError(msg)
252
for src_num in range(len(sources)):
253
add_source(sources[src_num], keys[src_num])
263
if isinstance(keys, basestring):
266
if len(sources) != len(keys):
267
raise SourceConfigError(
268
'Install sources and keys lists are different lengths')
269
for source, key in zip(sources, keys):
270
add_source(source, key)
255
272
apt_update(fatal=True)