From 7afd04f1c9ad03e3de5605fb95ee492ee1e52212 Mon Sep 17 00:00:00 2001 From: Anders Ingemann Date: Sun, 29 Dec 2013 22:50:35 +0100 Subject: [PATCH] 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. --- base/bootstrapinfo.py | 4 +++- base/manifest-schema.json | 1 + base/manifest.py | 2 -- common/tasks/bootstrap.py | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/base/bootstrapinfo.py b/base/bootstrapinfo.py index 9ae6c6f..82695bd 100644 --- a/base/bootstrapinfo.py +++ b/base/bootstrapinfo.py @@ -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 diff --git a/base/manifest-schema.json b/base/manifest-schema.json index 5355336..f705020 100644 --- a/base/manifest-schema.json +++ b/base/manifest-schema.json @@ -29,6 +29,7 @@ "packages": { "type": "object", "properties": { + "mirror": { "type": "string", "format": "uri" }, "sources": { "type": "object", "patternProperties": { diff --git a/base/manifest.py b/base/manifest.py index a452a96..a54b935 100644 --- a/base/manifest.py +++ b/base/manifest.py @@ -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'] diff --git a/common/tasks/bootstrap.py b/common/tasks/bootstrap.py index a45f7e7..c48c2e0 100644 --- a/common/tasks/bootstrap.py +++ b/common/tasks/bootstrap.py @@ -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