def getenforce():
 try:
  enforce = os.path.join(selinux_fs_path(), 'enforce')
  with salt.utils.fopen(enforce, 'r') as _fp:
   if (_fp.readline().strip() == '0'):
    return 'Permissive'
   else:
    return 'Enforcing'
 except (IOError, OSError, AttributeError):
  return 'Disabled'

def getenforce ( ) : try : enforce = os . path . join ( selinux_fs_path ( ) , 'enforce' ) with salt . utils . fopen ( enforce , 'r' ) as _fp : if ( _fp . readline ( ) . strip ( ) == '0' ) : return 'Permissive' else : return 'Enforcing' except ( IOError , OSError , AttributeError ) : return 'Disabled'
return the mode selinux is running in cli example: .