def mode(name):
    '''
    Verifies the mode SELinux is running in, can be set to enforcing,
    permissive, or disabled
        Note: A change to or from disabled mode requires a system reboot.
            You will need to perform this yourself.

    name
        The mode to run SELinux in, permissive, enforcing, or disabled.
    '''
    ret = {'name': name,
           'result': False,
           'comment': '',
           'changes': {}}
    tmode = _refine_mode(name)
    if tmode == 'unknown':
        ret['comment'] = '{0} is not an accepted mode'.format(name)
        return ret
    mode = __salt__['selinux.getenforce']()
    if mode == tmode:
        ret['result'] = True
        ret['comment'] = 'SELinux is already in {0} mode'.format(tmode)
        return ret
    # The mode needs to change...
    if __opts__['test']:
        ret['comment'] = 'SELinux mode is set to be changed to {0}'.format(
                tmode)
        ret['result'] = None
        return ret

    mode = __salt__['selinux.setenforce'](tmode)
    if mode == tmode:
        ret['result'] = True
        ret['comment'] = 'SELinux has been set to {0} mode'.format(tmode)
        return ret
    ret['comment'] = 'Failed to set SELinux to {0} mode'.format(tmode)
    return ret
dataset/ETHPy150Open saltstack/salt/salt/states/selinux.py/mode/original