From 5abaa600ab3fe65d18c15e228cc0e36ba4d690c7 Mon Sep 17 00:00:00 2001 From: "Anthony G. Basile" Date: Sun, 9 Aug 2015 17:47:13 -0400 Subject: Remove CONST.namervers[]. To be provided by grs repo. --- conf/systems.conf | 4 ---- grs/Constants.py | 7 +++---- grs/Interpret.py | 3 +-- grs/Populate.py | 11 +---------- tests/test-constants.py | 1 - 5 files changed, 5 insertions(+), 21 deletions(-) diff --git a/conf/systems.conf b/conf/systems.conf index c2f0b51..e80b6b8 100644 --- a/conf/systems.conf +++ b/conf/systems.conf @@ -1,19 +1,15 @@ [desktop-amd64-uclibc-hardened] -nameserver : 8.8.8.8 repo_uri : git://anongit.gentoo.org/proj/grs.git stage_uri : http://distfiles.gentoo.org/pub/gentoo/releases/amd64/autobuilds/current-stage3-amd64-uclibc-hardened/stage3-amd64-uclibc-hardened-20150705.tar.bz2 [desktop-amd64-musl-hardened] -nameserver : 8.8.8.8 repo_uri : git://anongit.gentoo.org/proj/grs.git stage_uri : http://distfiles.gentoo.org/experimental/amd64/musl/stage3-amd64-musl-hardened-20150609.tar.bz2 [desktop-amd64-hardened] -nameserver : 8.8.8.8 repo_uri : git://anongit.gentoo.org/proj/grs.git stage_uri : http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-hardened+nomultilib/stage3-amd64-hardened+nomultilib-20150723.tar.bz2 [stages-amd64-hardened] -nameserver : 8.8.8.8 repo_uri : git://anongit.gentoo.org/proj/grs.git stage_uri : http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-hardened/stage3-amd64-hardened-20150702.tar.bz2 diff --git a/grs/Constants.py b/grs/Constants.py index 79551f9..0025eb4 100644 --- a/grs/Constants.py +++ b/grs/Constants.py @@ -26,7 +26,6 @@ class Constants(): """ Read a global configuration file and set/override constants for each GRS spec. These constants are exported in the form: - CONST.nameservers[x] contains the namserver for the xth GRS spec CONST.repo_uris[x] contains the repo_uri for the xth GRS spec etc. @@ -44,13 +43,14 @@ class Constants(): kernelroot : /tmp/kernel_src_tree [my-cool-server] - nameserver : 192.168.100.1 + package : /var/tmp/my-packages Then CONST.kernelroots[0] is '/tmp/kernel_src_tree' rather than the default value '/var/tmp/grs/my-cool-desktop/kernel'. The remainder of the constants default as delineated in the space[] dictionary with %s replaced by 'my-cool-desktop'. Similarly CONST.my-cool-servers[1] - is 192.168.100.1 rather than 8.8.8.8. + has package directory '/var/tmp/my-package' rather than the default + value '/var/tmp/grs/my-cool-server/packages', Finally, the that class overrides __setattr__, __gettattr__ and __delattr__ so that you cannot add/change/delete constants in @@ -75,7 +75,6 @@ class Constants(): # This is the space of all possible constants for any given GRS namespace space = { - 'nameserver' : '8.8.8.8', 'repo_uri' : 'git://anongit.gentoo.org/proj/grs.git', 'stage_uri' : default_stage_uri, 'libdir' : '/var/lib/grs/%s', diff --git a/grs/Interpret.py b/grs/Interpret.py index a7c0915..5f06fe9 100644 --- a/grs/Interpret.py +++ b/grs/Interpret.py @@ -106,7 +106,6 @@ class Interpret(Daemon): signal.signal(signal.SIGTERM, handler) # Grab all the GRS namespace variables - nameserver = CONST.nameservers[self.run_number] repo_uri = CONST.repo_uris[self.run_number] stage_uri = CONST.stage_uris[self.run_number] @@ -126,7 +125,7 @@ class Interpret(Daemon): sy = Synchronize(repo_uri, name, libdir, logfile) se = Seed(stage_uri, tmpdir, portage_configroot, package, logfile) md = MountDirectories(portage_configroot, package, logfile) - po = Populate(nameserver, libdir, workdir, portage_configroot, logfile) + po = Populate(libdir, workdir, portage_configroot, logfile) ru = RunScript(libdir, portage_configroot, logfile) pc = PivotChroot(tmpdir, portage_configroot, logfile) ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile) diff --git a/grs/Populate.py b/grs/Populate.py index c24fd63..fc7e799 100644 --- a/grs/Populate.py +++ b/grs/Populate.py @@ -27,16 +27,12 @@ class Populate(): for a particular cycle number. """ - def __init__(self, nameserver, libdir = CONST.LIBDIR, workdir = CONST.WORKDIR, \ + def __init__(self, libdir = CONST.LIBDIR, workdir = CONST.WORKDIR, \ portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE): - self.nameserver = nameserver self.libdir = libdir self.workdir = workdir self.portage_configroot = portage_configroot self.logfile = logfile - # We need /etc and /etc/resolv.conf for the system's portage configroot. - self.etc = os.path.join(self.portage_configroot, 'etc') - self.resolv_conf = os.path.join(self.etc, 'resolv.conf') def populate(self, cycle = True): @@ -55,11 +51,6 @@ class Populate(): cmd = 'rsync -av %s/ %s' % (self.workdir, self.portage_configroot) Execute(cmd, timeout=60, logfile = self. logfile) - # Add /etc/resolv.conf. We need this when we emerge within the chroot. - os.makedirs(self.etc, mode=0o755, exist_ok=True) - with open(self.resolv_conf, 'w') as f: - f.write('nameserver %s' % self.nameserver) - def select_cycle(self, cycle): """ Select files with the matching cycle number. If a file has form diff --git a/tests/test-constants.py b/tests/test-constants.py index cefb9cb..a6f0d72 100755 --- a/tests/test-constants.py +++ b/tests/test-constants.py @@ -42,7 +42,6 @@ if __name__ == "__main__": del CONST.I_AM_NEW assert CONST.I_AM_NEW == original - print(CONST.nameservers) print(CONST.repo_uris) print(CONST.stage_uris) print(CONST.names) -- cgit v1.2.3-65-gdbad