def fcontext_add_or_delete_policy(action, name, filetype=None, sel_type=None, sel_user=None, sel_level=None):
 if (action not in ['add', 'delete']):
  raise SaltInvocationError('Actions supported are "add" and "delete", not "{0}".'.format(action))
 cmd = 'semanage fcontext --{0}'.format(action)
 if (filetype is not None):
  _validate_filetype(filetype)
  cmd += ' --ftype {0}'.format(filetype)
 if (sel_type is not None):
  cmd += ' --type {0}'.format(sel_type)
 if (sel_user is not None):
  cmd += ' --seuser {0}'.format(sel_user)
 if (sel_level is not None):
  cmd += ' --range {0}'.format(sel_level)
 cmd += (' ' + re.escape(name))
 return __salt__['cmd.run_all'](cmd)

def fcontext_add_or_delete_policy ( action , name , filetype = None , sel_type = None , sel_user = None , sel_level = None ) : if ( action not in [ 'add' , 'delete' ] ) : raise SaltInvocationError ( 'Actions supported are "add" and "delete", not "{0}".' . format ( action ) ) cmd = 'semanage fcontext --{0}' . format ( action ) if ( filetype is not None ) : _validate_filetype ( filetype ) cmd += ' --ftype {0}' . format ( filetype ) if ( sel_type is not None ) : cmd += ' --type {0}' . format ( sel_type ) if ( sel_user is not None ) : cmd += ' --seuser {0}' . format ( sel_user ) if ( sel_level is not None ) : cmd += ' --range {0}' . format ( sel_level ) cmd += ( ' ' + re . escape ( name ) ) return __salt__ [ 'cmd.run_all' ] ( cmd )
sets or deletes the selinux policy for a given filespec and other optional parameters .