# Buggy code
def hash_and_stat_file(self, path, saltenv="base"):
    """
    Return the hash of a file, to get the hash of a file in the file_roots
    prepend the path with salt://<file on server> otherwise, prepend the
    file with / for a local file.

    Additionally, return the stat result of the file, or None if no stat
    results were found.
    """
    ret = {}
    fnd = self.__get_file_path(path, saltenv)
    if fnd is None:
        return ret, None

    try:
        # Remote file path (self._find_file() invoked)
        fnd_path = fnd["path"]
        fnd_stat = fnd.get("stat")
    except TypeError:
        # Local file path
        fnd_path = fnd
        try:
            fnd_stat = list(os.stat(fnd_path))
        except Exception:
            fnd_stat = None

    hash_type = self.opts.get("hash_type", "md5")
    ret["hsum"] = salt.utils.get_hash(fnd_path, form=hash_type)
    ret["hash_type"] = hash_type
    return ret


# Traceback (AttributeError)
root@nmadhok.local:~/salt/salt# salt-call state.sls sample.state test=true
[WARNING ] Key 'file_ignore_glob' with value None has an invalid type of NoneType, a list or basestring is required for this value
[WARNING ] Key 'file_ignore_regex' with value None has an invalid type of NoneType, a list or basestring is required for this value
[INFO    ] Loading fresh modules for state activity
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
AttributeError: 'bool' object has no attribute 'get'
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 352, in salt_call
client.run()
File "/usr/lib/python2.6/site-packages/salt/cli/call.py", line 58, in run
caller.run()
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 134, in run
ret = self.call()
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 197, in call
ret['return'] = func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/modules/state.py", line 985, in sls
high_, errors = st_.render_highstate({saltenv: mods})
File "/usr/lib/python2.6/site-packages/salt/state.py", line 3149, in render_highstate
sls, saltenv, mods, matches)
File "/usr/lib/python2.6/site-packages/salt/state.py", line 2803, in render_state
state_data = self.client.get_state(sls, saltenv)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 394, in get_state
dest = self.cache_file(path, saltenv, cachedir=cachedir)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 177, in cache_file
return self.get_url(path, '', True, saltenv, cachedir=cachedir)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 475, in get_url
url, dest, makedirs, saltenv, cachedir=cachedir)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 972, in get_file
hash_server, stat_server = self.hash_and_stat_file(path, saltenv)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 1282, in hash_and_stat_file
stat_result = fnd.get('stat')
AttributeError: 'bool' object has no attribute 'get'
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 352, in salt_call
client.run()
File "/usr/lib/python2.6/site-packages/salt/cli/call.py", line 58, in run
caller.run()
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 134, in run
ret = self.call()
File "/usr/lib/python2.6/site-packages/salt/cli/caller.py", line 197, in call
ret['return'] = func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/modules/state.py", line 985, in sls
high_, errors = st_.render_highstate({saltenv: mods})
File "/usr/lib/python2.6/site-packages/salt/state.py", line 3149, in render_highstate
sls, saltenv, mods, matches)
File "/usr/lib/python2.6/site-packages/salt/state.py", line 2803, in render_state
state_data = self.client.get_state(sls, saltenv)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 394, in get_state
dest = self.cache_file(path, saltenv, cachedir=cachedir)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 177, in cache_file
return self.get_url(path, '', True, saltenv, cachedir=cachedir)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 475, in get_url
url, dest, makedirs, saltenv, cachedir=cachedir)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 972, in get_file
hash_server, stat_server = self.hash_and_stat_file(path, saltenv)
File "/usr/lib/python2.6/site-packages/salt/fileclient.py", line 1282, in hash_and_stat_file
stat_result = fnd.get('stat')
AttributeError: 'bool' object has no attribute 'get'

# Fixed code
def hash_and_stat_file(self, path, saltenv="base"):
    """
    Return the hash of a file, to get the hash of a file in the file_roots
    prepend the path with salt://<file on server> otherwise, prepend the
    file with / for a local file.

    Additionally, return the stat result of the file, or None if no stat
    results were found.
    """
    ret = {}
    fnd = self.__get_file_path(path, saltenv)
    if fnd is None:
        return ret, None

    try:
        # Remote file path (self._find_file() invoked)
        fnd_path = fnd["path"]
        fnd_stat = fnd.get("stat")
    except TypeError:
        # Local file path
        fnd_path = fnd
        try:
            fnd_stat = list(os.stat(fnd_path))
        except Exception:
            fnd_stat = None

    hash_type = self.opts.get("hash_type", "md5")
    ret["hsum"] = salt.utils.get_hash(fnd_path, form=hash_type)
    ret["hash_type"] = hash_type
    return ret, fnd_stat