diff --git a/salt/modules/selinux.py b/salt/modules/selinux.py index 0330521d48..5e28f3941e 100644 --- a/salt/modules/selinux.py +++ b/salt/modules/selinux.py @@ -192,6 +192,7 @@ def list_sebool(): 'Description': ' '.join(comps[4:])} return ret + def getsemod(module): ''' Return the information on a specific selinux module @@ -201,6 +202,8 @@ def getsemod(module): .. code-block:: bash salt '*' selinux.getsemod mysql + + .. versionadded:: Boron ''' return list_semod().get(module, {}) @@ -214,6 +217,8 @@ def setsemod(module, state): .. code-block:: bash salt '*' selinux.setsemod nagios Enabled + + .. versionadded:: Boron ''' if state.lower() == 'enabled': cmd = 'semodule -e {0}'.format(module) @@ -232,6 +237,8 @@ def list_semod(): .. code-block:: bash salt '*' selinux.list_semod + + .. versionadded:: Boron ''' mdata = __salt__['cmd.run']('semodule -l').splitlines() ret = {} diff --git a/salt/states/selinux.py b/salt/states/selinux.py index 02a4b62445..3ae1650396 100644 --- a/salt/states/selinux.py +++ b/salt/states/selinux.py @@ -60,9 +60,11 @@ def _refine_value(value): return 'off' return None + def _refine_module_state(module_state): ''' Return a predictable value, or allow us to error out + .. versionadded:: Boron ''' module_state = str(module_state).lower() if module_state in ('1', 'on', 'yes', 'true', 'enabled'): @@ -174,6 +176,8 @@ def module(name, module_state='Enabled', version='any'): version Defaults to no preference, set to a specified value if required. Currently can only alert if the version is incorrect. + + .. versionadded:: Boron ''' ret = {'name': name, 'result': True, @@ -199,12 +203,12 @@ def module(name, module_state='Enabled', version='any'): return ret current_module_state = _refine_module_state(modules[name]['Enabled']) if rmodule_state == current_module_state: - ret['comment'] = 'Module {0} is in the desired state'.format(name) - return ret + ret['comment'] = 'Module {0} is in the desired state'.format(name) + return ret if __opts__['test']: ret['result'] = None ret['comment'] = 'Module {0} is set to be togggled to {1}'.format( - name, module_state) + name, module_state) return ret if __salt__['selinux.setsemod'](name, rmodule_state):