# Buggy code
def hash_and_stat_file(self, path, saltenv="base"):
    """
    The same as hash_file, but also return the file's mode, or None if no
    mode data is present.
    """
    hash_result = self.hash_file(path, saltenv)
    try:
        path = self._check_proto(path)
    except MinionError as err:
        if not os.path.isfile(path):
            return hash_result, None
        else:
            try:
                return hash_result, list(os.stat(path))
            except Exception:
                return hash_result, None
    load = {"path": path, "saltenv": saltenv, "cmd": "_file_find"}
    fnd = self.channel.send(load)
    stat_result = fnd.get("stat")
    return hash_result, stat_result


# 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"):
    """
    The same as hash_file, but also return the file's mode, or None if no
    mode data is present.
    """
    hash_result = self.hash_file(path, saltenv)
    try:
        path = self._check_proto(path)
    except MinionError as err:
        if not os.path.isfile(path):
            return hash_result, None
        else:
            try:
                return hash_result, list(os.stat(path))
            except Exception:
                return hash_result, None
    load = {"path": path, "saltenv": saltenv, "cmd": "_file_find"}
    fnd = self.channel.send(load)
    try:
        stat_result = fnd.get("stat")
    except AttributeError:
        stat_result = None
    return hash_result, stat_result