Repository: ultrabug/py3status

Issue:
selinux module install check refers to binary not in user path
The selinux module tries to check whether selinux is installed.

`if not self.py3.check_commands(['getenforce']):`

this effectively runs `which getenforce`. The getenforce binary is installed under /usr/sbin (gentoo, also fedora as far as i read) which is not in the regular user path and therefore not found, resulting in the message `selinux: isn't installed`.
Removing the check makes the module work as expected.


Discussion:

Resolving patch:
diff --git a/py3status/modules/selinux.py b/py3status/modules/selinux.py
--- a/py3status/modules/selinux.py
+++ b/py3status/modules/selinux.py
@@ -3,11 +3,11 @@
 Display SELinux state.
 
 This module displays the state of SELinux on your machine:
-Enforcing (good), Permissive (bad), or Disabled (bad).
+Enforcing (good), Permissive (degraded), or Disabled (bad).
 
 Configuration parameters:
     cache_timeout: refresh interval for this module (default 10)
-    format: display format for this module (default 'selinux: {state}')
+    format: display format for this module (default 'SELinux: {state}')
     state_disabled: show when no SELinux policy is loaded.
         (default 'disabled')
     state_enforcing: show when SELinux security policy is enforced.
@@ -30,17 +30,17 @@
 @license BSD
 
 SAMPLE OUTPUT
-{'full_text': 'selinux: enforcing', 'color': '#00FF00'}
+{'full_text': 'SELinux: enforcing', 'color': '#00FF00'}
 
 permissive
-{'full_text': 'selinux: permissive', 'color': '#FFFF00'}
+{'full_text': 'SELinux: permissive', 'color': '#FFFF00'}
 
 disabled
-{'full_text': 'selinux: disabled', 'color': '#FF0000'}
+{'full_text': 'SELinux: disabled', 'color': '#FF0000'}
 """
+
 from __future__ import absolute_import
 import selinux
-STRING_UNAVAILABLE = "selinux: isn't installed"
 
 
 class Py3status:
@@ -48,30 +48,28 @@ class Py3status:
     """
     # available configuration parameters
     cache_timeout = 10
-    format = 'selinux: {state}'
+    format = 'SELinux: {state}'
     state_disabled = 'disabled'
     state_enforcing = 'enforcing'
     state_permissive = 'permissive'
 
     def selinux(self):
-        if not self.py3.check_commands(['getenforce']):
-            return {'cache_until': self.py3.CACHE_FOREVER,
-                    'color': self.py3.COLOR_BAD,
-                    'full_text': STRING_UNAVAILABLE}
         try:
             if selinux.security_getenforce():
                 state = self.state_enforcing
                 color = self.py3.COLOR_GOOD
             else:
                 state = self.state_permissive
-                color = self.py3.COLOR_BAD
+                color = self.py3.COLOR_DEGRADED
         except:
             state = self.state_disabled
             color = self.py3.COLOR_BAD
 
-        return {'cached_until': self.py3.time_in(self.cache_timeout),
-                'full_text': self.py3.safe_format(self.format, {'state': state}),
-                'color': color}
+        return {
+            'cached_until': self.py3.time_in(self.cache_timeout),
+            'full_text': self.py3.safe_format(self.format, {'state': state}),
+            'color': color
+        }
 
 
 if __name__ == '__main__':


Test patch: