]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] allow sysinfo to provide some generic output on unknown system
authorJeremy C. Reed <jreed@isc.org>
Wed, 6 Feb 2013 15:52:50 +0000 (09:52 -0600)
committerJeremy C. Reed <jreed@isc.org>
Wed, 6 Feb 2013 15:52:50 +0000 (09:52 -0600)
This is for ticket #2128. It was reviewed and discussed on jabber.

This extends SysInfoPOSIX to get the hostname and the load average.
Then as a fallback for unknown systems it uses the SysInfoPOSIX.

(By the way, some information is looked up twice, but this
happened before this patch, but now happens for a couple more things.)

src/lib/python/isc/sysinfo/sysinfo.py

index 771400a846b33dc0f6d5eff0e66cfeaebc07f120..3a59801a4d44724970d796beea641903bd13dc1f 100644 (file)
@@ -162,9 +162,12 @@ class SysInfoPOSIX(SysInfo):
 
         u = os.uname()
         self._platform_name = u[0]
+        self._hostname = u[1]
         self._platform_version = u[2]
         self._platform_machine = u[4]
 
+        self._loadavg = os.getloadavg()
+
 class SysInfoLinux(SysInfoPOSIX):
     """Linux implementation of the SysInfo class.
     See the SysInfo class documentation for more information.
@@ -508,4 +511,4 @@ def SysInfoFromFactory():
     elif osname == 'BIND10Testcase':
         return SysInfoTestcase()
     else:
-        return SysInfo()
+        return SysInfoPOSIX()