

def mode(name):
    '\n    Verifies the mode SELinux is running in, can be set to enforcing,\n    permissive, or disabled\n        Note: A change to or from disabled mode requires a system reboot.\n            You will need to perform this yourself.\n\n    name\n        The mode to run SELinux in, permissive, enforcing, or disabled.\n    '
    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
    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