summaryrefslogtreecommitdiffstats
path: root/py/mock/backend.py
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2009-02-27 03:45:48 +0100
committerClark Williams <williams@redhat.com>2009-03-27 09:37:39 -0500
commit28027fc26d5258efe5034bb975157a3f61dfcfec (patch)
treebbfe5ba509d62b0fb9f107e368f25e1ecc6fa8e8 /py/mock/backend.py
parentd6a3d9400521f912ce57fc3d7ac84a950ce05167 (diff)
downloadmock-28027fc26d5258efe5034bb975157a3f61dfcfec.tar.gz
mock-28027fc26d5258efe5034bb975157a3f61dfcfec.tar.xz
mock-28027fc26d5258efe5034bb975157a3f61dfcfec.zip
Be able to resolve hostname
Copy /etc/hosts from host when resolver configuration is being copied, otherwise add hostname as a loopback alias.
Diffstat (limited to 'py/mock/backend.py')
-rw-r--r--py/mock/backend.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/py/mock/backend.py b/py/mock/backend.py
index 86b3fb7..78358c7 100644
--- a/py/mock/backend.py
+++ b/py/mock/backend.py
@@ -227,13 +227,19 @@ class Root(object):
pass
os.symlink('yum/yum.conf', self.makeChrootPath("etc", "yum.conf"))
- # set up resolv.conf
+ # set up resolver configuration
if self.use_host_resolv:
- resolvdir = self.makeChrootPath('etc')
- resolvpath = self.makeChrootPath('etc', 'resolv.conf')
- if os.path.exists(resolvpath):
- os.remove(resolvpath)
- shutil.copy2('/etc/resolv.conf', resolvdir)
+ etcdir = self.makeChrootPath('etc')
+
+ resolvconfpath = self.makeChrootPath('etc', 'resolv.conf')
+ if os.path.exists(resolvconfpath):
+ os.remove(resolvconfpath)
+ shutil.copy2('/etc/resolv.conf', etcdir)
+
+ hostspath = self.makeChrootPath('etc', 'hosts')
+ if os.path.exists(hostspath):
+ os.remove(hostspath)
+ shutil.copy2('/etc/hosts', etcdir)
# files in /etc that need doing
for key in self.chroot_file_contents: