From c5686295f14c955d34d9598ddb80b30cb9df663c Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Tue, 19 Apr 2016 18:36:32 +0200 Subject: 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 --- ipapython/ipautil.py | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'ipapython/ipautil.py') 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. -- cgit