def check_managed(
        name,
        source,
        source_hash,
        source_hash_name,
        user,
        group,
        mode,
        attrs,
        template,
        context,
        defaults,
        saltenv,
        contents=None,
        skip_verify=False,
        seuser=None,
        serole=None,
        setype=None,
        serange=None,
        **kwargs):
    '''
    Check to see what changes need to be made for a file

    CLI Example:

    .. code-block:: bash

        salt '*' file.check_managed /etc/httpd/conf.d/httpd.conf salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' root, root, '755' jinja True None None base
    '''
    # If the source is a list then find which file exists
    source, source_hash = source_list(source,           # pylint: disable=W0633
                                      source_hash,
                                      saltenv)

    sfn = ''
    source_sum = None

    if contents is None:
        # Gather the source file from the server
        sfn, source_sum, comments = get_managed(
            name,
            template,
            source,
            source_hash,
            source_hash_name,
            user,
            group,
            mode,
            attrs,
            saltenv,
            context,
            defaults,
            skip_verify,
            **kwargs)
        if comments:
            __clean_tmp(sfn)
            return False, comments
    changes = check_file_meta(name, sfn, source, source_sum, user,
                              group, mode, attrs, saltenv, contents,
                              seuser=seuser, serole=serole, setype=setype,
                              serange=serange)
    # Ignore permission for files written temporary directories
    # Files in any path will still be set correctly using get_managed()
    if name.startswith(tempfile.gettempdir()):
        for key in ['user', 'group', 'mode']:
            changes.pop(key, None)
    __clean_tmp(sfn)
    if changes:
        log.info(changes)
        comments = ['The following values are set to be changed:\n']
        comments.extend('{0}: {1}\n'.format(key, val)
                        for key, val in six.iteritems(changes))
        return None, ''.join(comments)
    return True, 'The file {0} is in the correct state'.format(name)
def check_managed ( name , source , source_hash , source_hash_name , user , group , mode , attrs , template , context , defaults , saltenv , contents = None , skip_verify = False , seuser = None , serole = None , setype = None , serange = None , ** kwargs ) : source , source_hash = source_list ( source , source_hash , saltenv ) sfn = '' source_sum = None if contents is None : sfn , source_sum , comments = get_managed ( name , template , source , source_hash , source_hash_name , user , group , mode , attrs , saltenv , context , defaults , skip_verify , ** kwargs ) if comments : __clean_tmp ( sfn ) return False , comments changes = check_file_meta ( name , sfn , source , source_sum , user , group , mode , attrs , saltenv , contents , seuser = seuser , serole = serole , setype = setype , serange = serange ) if name . startswith ( tempfile . gettempdir ( ) ) : for key in [ 'user' , 'group' , 'mode' ] : changes . pop ( key , None ) __clean_tmp ( sfn ) if changes : log . info ( changes ) comments = [ 'The following values are set to be changed:\n' ] comments . extend ( '{0}: {1}\n' . format ( key , val ) for key , val in six . iteritems ( changes ) ) return None , '' . join ( comments ) return True , 'The file {0} is in the correct state' . format ( name )
Check to see what changes need to be made for a file

    CLI Example:

    .. code-block:: bash

        salt '*' file.check_managed /etc/httpd/conf.d/httpd.conf salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' root, root, '755' jinja True None None base