diff --git a/lib/backend.py b/lib/backend.py index aafe45649ad515401d7f85c287d7ea88c615210d..e1a410fee5f8611d973cf1bd11993a487a4144dd 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -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, diff --git a/lib/bootstrap.py b/lib/bootstrap.py index dfd415b3e7be074a2de7ed0d8c9bcf34d75f0d40..5a784b92cf9aca6b08f0e8f41b2ca6fadf3a0762 100644 --- a/lib/bootstrap.py +++ b/lib/bootstrap.py @@ -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): diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 916f243166f156cc80fb85599a33ed3725d72f37..62ba065bb2b7d3999fe5a8b0de9f161af220d9f4 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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) diff --git a/lib/constants.py b/lib/constants.py index f3e1870f48ea98cbb97d339a5ca656e17ae1e66f..86b4fd651f735a899a253991995e0766beac7e2c 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -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 diff --git a/lib/pathutils.py b/lib/pathutils.py index 457b2273cc6b034f25f1ac4022823aada5a87f5d..0efbc4c10e1bcf0383075d5fe2bbc149ad8ffc1f 100644 --- a/lib/pathutils.py +++ b/lib/pathutils.py @@ -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" diff --git a/lib/utils/nodesetup.py b/lib/utils/nodesetup.py index 5dfc62187ae631549de222872cde05d47bb30b92..d34741f08b5235f3b1fe0837cab6313e0da2464b 100644 --- a/lib/utils/nodesetup.py +++ b/lib/utils/nodesetup.py @@ -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])