Browse Source

[master] allow sysinfo to provide some generic output on unknown system

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.)
Jeremy C. Reed 12 years ago
parent
commit
89fbc1a1f4
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/lib/python/isc/sysinfo/sysinfo.py

+ 4 - 1
src/lib/python/isc/sysinfo/sysinfo.py

@@ -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()