diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2009-02-27 03:45:48 +0100 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2009-03-27 09:37:39 -0500 |
commit | 28027fc26d5258efe5034bb975157a3f61dfcfec (patch) | |
tree | bbfe5ba509d62b0fb9f107e368f25e1ecc6fa8e8 /py/mock.py | |
parent | d6a3d9400521f912ce57fc3d7ac84a950ce05167 (diff) | |
download | mock-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.py')
-rwxr-xr-x | py/mock.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -40,6 +40,7 @@ import pwd import sys import time from optparse import OptionParser +from socket import gethostname # all of the variables below are substituted by the build system __VERSION__ = "unreleased_version" @@ -268,7 +269,6 @@ def setup_default_config_opts(config_opts, unprivUid): config_opts['yum.conf'] = '' config_opts['more_buildreqs'] = {} config_opts['files'] = {} - config_opts['files']['etc/hosts'] = "127.0.0.1 localhost localhost.localdomain\n" config_opts['macros'] = { '%_topdir': '%s/build' % config_opts['chroothome'], '%_rpmfilename': '%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm', @@ -519,6 +519,10 @@ def main(ret): # cmdline options override config options set_config_opts_per_cmdline(config_opts, options, args) + # default /etc/hosts contents + if not config_opts['use_host_resolv'] and not config_opts['files'].has_key('etc/hosts'): + config_opts['files']['etc/hosts'] = "127.0.0.1 localhost localhost.localdomain %s\n" % gethostname(); + # elevate privs uidManager._becomeUser(0, 0) |