[Piuparts-commits] [piuparts] 04/04: p: only clear comments and whitespace from the host's resolv.conf
Holger Levsen
holger at moszumanska.debian.org
Wed Dec 3 13:09:36 UTC 2014
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch develop
in repository piuparts.
commit 428d16ef560da2821fbbb5dcdc7889330adf0513
Author: Andreas Beckmann <anbe at debian.org>
Date: Wed Dec 3 13:47:01 2014 +0100
p: only clear comments and whitespace from the host's resolv.conf
Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
debian/changelog | 4 ++--
piuparts.py | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index f993ac8..c460e92 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -22,8 +22,8 @@ piuparts (0.61) UNRELEASED; urgency=medium
* piuparts.py:
- Add to ignored_files:
+ /etc/modules-load.d/modules.conf (dangling symlink to ../modules)
- - Create /etc/resolv.conf in the chroot using only the domain and
- nameserver entries found on the host.
+ - Place an up-to-date copy of the host's /etc/resolv.conf (with comments
+ stripped and whitespace normalized) in the chroot.
* piuparts.conf:
- Add flags-start-jessie, flags-end-jessie global variables.
- Use --scriptsdir .../scripts-jessie for tests ending in jessie.
diff --git a/piuparts.py b/piuparts.py
index bd1f1d1..0450cf0 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -943,14 +943,14 @@ class Chroot:
logging.debug("Created policy-rc.d and chmodded it.")
def create_resolv_conf(self):
- """Create a resolv.conf containing the nameservers from the host system."""
+ """Update resolv.conf based on the current configuration in the host system. Strip comments and whitespace."""
full_name = self.relative("etc/resolv.conf")
- nameservers = ""
+ resolvconf = ""
with open("/etc/resolv.conf", "r") as f:
for line in f:
- if line.startswith("nameserver") or line.startswith("domain"):
- nameservers += line
- create_file(full_name, nameservers)
+ if line.strip() and not line.startswith(('#', ';')):
+ resolvconf += line.strip() + '\n'
+ create_file(full_name, resolvconf)
logging.debug("Created resolv.conf.")
def setup_minimal_chroot(self):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git
More information about the Piuparts-commits
mailing list