.. versionadded:: 2017.7.0

    Checks and makes sure the SELinux policies for a given filespec are
    applied.

def fcontext_policy_applied(name, recursive=False):
    '''
    .. versionadded:: 2017.7.0

    Checks and makes sure the SELinux policies for a given filespec are
    applied.
    '''
    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