Distinguish between bootstrap and apt mirror

They can both be set independently now.
If the bootstrap mirror is not set, it falls back to the apt mirror,
which in turn falls back to the geo redirector.
This commit is contained in:
Anders Ingemann 2013-12-29 22:50:35 +01:00
parent d9a7f3d1e4
commit 7afd04f1c9
4 changed files with 6 additions and 4 deletions

View file

@ -14,6 +14,8 @@ class BootstrapInformation(object):
from fs import load_volume
self.volume = load_volume(self.manifest.volume)
self.apt_mirror = self.manifest.packages.get('mirror', 'http://http.debian.net/debian')
class DictClass(dict):
def __getattr__(self, name):
return self[name]
@ -31,7 +33,7 @@ class BootstrapInformation(object):
obj[key] = value
self.manifest_vars = {}
self.manifest_vars['apt_mirror'] = 'http://http.debian.net/debian'
self.manifest_vars['apt_mirror'] = self.apt_mirror
set_manifest_vars(self.manifest_vars, self.manifest.data)
from datetime import datetime

View file

@ -29,6 +29,7 @@
"packages": {
"type": "object",
"properties": {
"mirror": { "type": "string", "format": "uri" },
"sources": {
"type": "object",
"patternProperties": {

View file

@ -48,8 +48,6 @@ class Manifest(object):
self.data = data
self.provider = data['provider']
self.bootstrapper = data['bootstrapper']
if 'mirror' not in self.bootstrapper:
self.bootstrapper['mirror'] = 'http://http.debian.net/debian'
self.volume = data['volume']
self.system = data['system']
self.packages = data['packages']

View file

@ -12,7 +12,8 @@ def get_bootstrap_args(info):
options.append('--include=' + ','.join(info.include_packages))
if len(info.exclude_packages) > 0:
options.append('--exclude=' + ','.join(info.exclude_packages))
arguments = [info.manifest.system['release'], info.root, info.manifest.bootstrapper['mirror']]
mirror = info.manifest.bootstrapper.get('mirror', info.apt_mirror)
arguments = [info.manifest.system['release'], info.root, mirror]
return executable, options, arguments