summaryrefslogtreecommitdiffstats
path: root/ipapython
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 /ipapython
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 'ipapython')
-rw-r--r--ipapython/ipautil.py12
1 files changed, 0 insertions, 12 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index e595d80ca..eef4d8020 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -1475,18 +1475,6 @@ def dn_attribute_property(private_name):
return property(getter, setter)
-def restore_hostname(statestore):
- """
- Restore hostname of a machine, if it was set before
- """
- old_hostname = statestore.restore_state('network','hostname')
- system_hostname = socket.gethostname()
- if old_hostname is not None and old_hostname != system_hostname:
- try:
- run([paths.BIN_HOSTNAME, old_hostname])
- except CalledProcessError as e:
- print("Failed to set this machine hostname back to %s: %s" % (old_hostname, str(e)), file=sys.stderr)
-
def posixify(string):
"""
Convert a string to a more strict alpha-numeric representation.