Change network configuration file

Fedora+systemd changed deprecated /etc/sysconfig/network which was
used by IPA to store static hostname for the IPA machine. See
https://bugzilla.redhat.com/show_bug.cgi?id=881785 for details.

Change Fedora platform files to store the hostname to /etc/hostname
instead.

https://fedorahosted.org/freeipa/ticket/3279
This commit is contained in:
Martin Kosek committed 2012-12-05 13:30:31 +01:00
1 parent c6efd4c7aa
commit 3896bf370a
7 files changed
+154 -18

No files matched your search

+12
View File
@@ -1162,3 +1162,15 @@ def dn_attribute_property(private_name):
return value
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(['/bin/hostname', old_hostname])
except CalledProcessError, e:
print >>sys.stderr, "Failed to set this machine hostname back to %s: %s" % (old_hostname, str(e))