summaryrefslogtreecommitdiffstats
path: root/ipaplatform/base
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2016-04-19 18:36:32 +0200
committerMartin Basti <mbasti@redhat.com>2016-04-26 14:01:42 +0200
commitc5686295f14c955d34d9598ddb80b30cb9df663c (patch)
tree5421aa91c6f5d645e7d9cbeff8fb4378a34577f7 /ipaplatform/base
parent14ee02dcbd6cbb6c221ac7526e471a9fc58fcc82 (diff)
downloadfreeipa-c5686295f14c955d34d9598ddb80b30cb9df663c.tar.gz
freeipa-c5686295f14c955d34d9598ddb80b30cb9df663c.tar.xz
freeipa-c5686295f14c955d34d9598ddb80b30cb9df663c.zip
Always set hostname
This prevents cases when hostname on system is set inconsistently (transient and static hostname differs) and may cause IPA errors. This commit ensures that all hostnames are set properly. https://fedorahosted.org/freeipa/ticket/5794 Reviewed-By: David Kupka <dkupka@redhat.com>
Diffstat (limited to 'ipaplatform/base')
-rw-r--r--ipaplatform/base/paths.py2
-rw-r--r--ipaplatform/base/tasks.py12
2 files changed, 11 insertions, 3 deletions
diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index 585a5d26e..62d9e703d 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -25,7 +25,7 @@ This base platform module exports default filesystem paths.
class BasePathNamespace(object):
BASH = "/bin/bash"
BIN_FALSE = "/bin/false"
- BIN_HOSTNAME = "/bin/hostname"
+ BIN_HOSTNAMECTL = "/bin/hostnamectl"
LS = "/bin/ls"
SH = "/bin/sh"
SYSTEMCTL = "/bin/systemctl"
diff --git a/ipaplatform/base/tasks.py b/ipaplatform/base/tasks.py
index f5fb2b155..7c3008863 100644
--- a/ipaplatform/base/tasks.py
+++ b/ipaplatform/base/tasks.py
@@ -48,7 +48,7 @@ class BaseTaskNamespace(object):
def backup_and_replace_hostname(self, fstore, statestore, hostname):
"""
Backs up the current hostname in the statestore (so that it can be
- restored by the restore_network_configuration platform task).
+ restored by the restore_hostname platform task).
Makes sure that new hostname (passed via hostname argument) is set
as a new pemanent hostname for this host.
@@ -106,7 +106,7 @@ class BaseTaskNamespace(object):
return
- def restore_network_configuration(self, fstore, statestore):
+ def restore_hostname(self, fstore, statestore):
"""
Restores the original hostname as backed up in the
backup_and_replace_hostname platform task.
@@ -237,6 +237,14 @@ class BaseTaskNamespace(object):
"""
return parse_version(version)
+ def set_hostname(self, hostname):
+ """
+ Set hostname for the system
+
+ No return value expected, raise CalledProcessError when error occurred
+ """
+ return
+
def configure_httpd_service_ipa_conf(self):
"""Configure httpd service to work with IPA"""
raise NotImplementedError()