diff options
Diffstat (limited to 'network.py')
-rw-r--r-- | network.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/network.py b/network.py index c903a255b..e7e5962d6 100644 --- a/network.py +++ b/network.py @@ -67,6 +67,18 @@ def sanityCheckHostname(hostname): return None +# Try to determine what the hostname should be for this system +def getDefaultHostname(anaconda): + hn = anaconda.id.network.hostname + + if hn is None or hn == '': + hn = socket.gethostname() + + if hn is None or hn == '': + hn = 'localhost.localdomain' + + return hn + # return if the device is of a type that requires a ptpaddr to be specified def isPtpDev(devname): if (devname.startswith("ctc") or devname.startswith("iucv")): @@ -208,6 +220,7 @@ class Network: self.netdevices[dev].set(('BOOTPROTO', 'dhcp')) else: self.netdevices[dev].unset('BOOTPROTO') + bus = dbus.SystemBus() config_path = props.Get(isys.NM_MANAGER_IFACE, 'Ip4Config') config = bus.get_object(isys.NM_SERVICE, config_path) config_props = dbus.Interface(config, isys.DBUS_PROPS_IFACE) |