Commit ee045466 authored by Michael Hanselmann's avatar Michael Hanselmann

Move constant for /etc/hosts to pathutils

Needed for coming patches.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 7ca67731
......@@ -200,7 +200,7 @@ def _BuildUploadFileList():
"""
allowed_files = set([
pathutils.CLUSTER_CONF_FILE,
constants.ETC_HOSTS,
pathutils.ETC_HOSTS,
pathutils.SSH_KNOWN_HOSTS_FILE,
pathutils.VNC_PASSWORD_FILE,
pathutils.RAPI_CERT_FILE,
......
......@@ -329,7 +329,7 @@ def InitCluster(cluster_name, mac_prefix, # pylint: disable=R0913, R0914
if ipcls.IsLoopback(hostname.ip):
raise errors.OpPrereqError("This host's IP (%s) resolves to a loopback"
" address. Please fix DNS or %s." %
(hostname.ip, constants.ETC_HOSTS),
(hostname.ip, pathutils.ETC_HOSTS),
errors.ECODE_ENVIRON)
if not ipcls.Own(hostname.ip):
......
......@@ -4311,7 +4311,7 @@ def _ComputeAncillaryFiles(cluster, redist):
files_all.update(ssconf.SimpleStore().GetFileList())
if cluster.modify_etc_hosts:
files_all.add(constants.ETC_HOSTS)
files_all.add(pathutils.ETC_HOSTS)
if cluster.use_external_mip_script:
files_all.add(pathutils.EXTERNAL_MASTER_SETUP_SCRIPT)
......
......@@ -136,7 +136,6 @@ RUN_DIRS_MODE = 0775
SECURE_DIR_MODE = 0700
SECURE_FILE_MODE = 0600
ADOPTABLE_BLOCKDEV_ROOT = "/dev/disk/"
ETC_HOSTS = "/etc/hosts"
ENABLE_FILE_STORAGE = _autoconf.ENABLE_FILE_STORAGE
ENABLE_SHARED_FILE_STORAGE = _autoconf.ENABLE_SHARED_FILE_STORAGE
ENABLE_CONFD = _autoconf.ENABLE_CONFD
......
......@@ -45,6 +45,7 @@ KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper"
KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup"
SETUP_SSH = _autoconf.TOOLSDIR + "/setup-ssh"
XM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xm-console-wrapper"
ETC_HOSTS = "/etc/hosts"
# Top-level paths
DATA_DIR = LOCALSTATEDIR + "/lib/ganeti"
......
......@@ -24,7 +24,7 @@
from cStringIO import StringIO
from ganeti import constants
from ganeti import pathutils
from ganeti.utils import algo
from ganeti.utils import io
......@@ -71,12 +71,12 @@ def AddHostToEtcHosts(hostname, ip):
@type hostname: str
@param hostname: a hostname that will be resolved and added to
L{constants.ETC_HOSTS}
L{pathutils.ETC_HOSTS}
@type ip: str
@param ip: The ip address of the host
"""
SetEtcHostsEntry(constants.ETC_HOSTS, ip, hostname, [hostname.split(".")[0]])
SetEtcHostsEntry(pathutils.ETC_HOSTS, ip, hostname, [hostname.split(".")[0]])
def RemoveEtcHostsEntry(file_name, hostname):
......@@ -115,8 +115,8 @@ def RemoveHostFromEtcHosts(hostname):
@type hostname: str
@param hostname: hostname that will be resolved and its
full and shot name will be removed from
L{constants.ETC_HOSTS}
L{pathutils.ETC_HOSTS}
"""
RemoveEtcHostsEntry(constants.ETC_HOSTS, hostname)
RemoveEtcHostsEntry(constants.ETC_HOSTS, hostname.split(".")[0])
RemoveEtcHostsEntry(pathutils.ETC_HOSTS, hostname)
RemoveEtcHostsEntry(pathutils.ETC_HOSTS, hostname.split(".")[0])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment