]> git.ipfire.org Git - pakfire.git/commitdiff
Add domain part to hostname if it has not got one.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 7 Apr 2012 09:47:07 +0000 (11:47 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 7 Apr 2012 09:47:07 +0000 (11:47 +0200)
python/pakfire/system.py

index 36d5da459e8098858d41881f9cf1392986a8d007..70f9cd15609998d4b6100f6b307ac8420b55e928 100644 (file)
@@ -34,7 +34,13 @@ class System(object):
        """
        @property
        def hostname(self):
-               return socket.gethostname()
+               hn = socket.gethostname()
+
+               # If a host has got no domain part, we add one.
+               if not "." in hn:
+                       hn = "%s.localdomain" % hn
+
+               return hn
 
        @property
        def native_arch(self):