Commits

marklap committed 368029b

resolve a few bugs with linux impl

  • Participants
  • Parent commits a9a586e
  • Tags 0.1.3

Comments (0)

Files changed (3)

File src/pyhai/plugins/linux/__init__.py

 @organization: Mind Squared Design / www.mindmind.com
 """
 import abc
-import subprocess.Popen as Popen
-import subprocess.PIPE as PIPE
+from subprocess import Popen, PIPE
 import shlex
 import logging
 

File src/pyhai/plugins/linux/network.py

                 network_info[nic]['name'] = nic
                 network_info[nic]['label'] = nic
                 network_info[nic]['device_id'] = nic
-                network_info[nic]['mac_address'] = row[4]
+                try:
+                    network_info[nic]['mac_address'] = row[4]
+                except IndexError:
+                    network_info[nic]['mac_address'] = ''
+
 
             if nic is not None:
                 if row[0] == 'inet' and row[1].startswith('addr:'):

File src/pyhai/plugins/linux/system.py

 """
 from pyhai.plugins import AuditorPlugin
 import platform
-try:
-    import platform.linux_distribution as distribution
-except: import platform.dist as distribution
+
+distribution = getattr(platform, 'linux_distribution', None)
+if distribution is None:
+    distribution = getattr(platform, 'dist', None)
+if distribution is None:
+    distribution = lambda: ('', '', '')
+
 import logging
 
 # set some default logging behavior