def fcontext_policy_applied(name, recursive=False):
 ret = {'name': name, 'result': False, 'changes': {}, 'comment': ''}
 changes_text = __salt__['selinux.fcontext_policy_is_applied'](name, recursive)
 if (changes_text == ''):
  ret.update({'result': True, 'comment': 'SElinux policies are already applied for filespec "{0}"'.format(name)})
  return ret
 if __opts__['test']:
  ret.update({'result': None})
 else:
  apply_ret = __salt__['selinux.fcontext_apply_policy'](name, recursive)
  if (apply_ret['retcode'] != 0):
   ret.update({'comment': apply_ret})
  else:
   ret.update({'result': True})
   ret.update({'changes': apply_ret.get('changes')})
 return ret

def fcontext_policy_applied ( name , recursive = False ) : ret = { 'name' : name , 'result' : False , 'changes' : { } , 'comment' : '' } changes_text = __salt__ [ 'selinux.fcontext_policy_is_applied' ] ( name , recursive ) if ( changes_text == '' ) : ret . update ( { 'result' : True , 'comment' : 'SElinux policies are already applied for filespec "{0}"' . format ( name ) } ) return ret if __opts__ [ 'test' ] : ret . update ( { 'result' : None } ) else : apply_ret = __salt__ [ 'selinux.fcontext_apply_policy' ] ( name , recursive ) if ( apply_ret [ 'retcode' ] != 0 ) : ret . update ( { 'comment' : apply_ret } ) else : ret . update ( { 'result' : True } ) ret . update ( { 'changes' : apply_ret . get ( 'changes' ) } ) return ret
checks and makes sure the selinux policies for a given filespec are applied .