# Buggy code
def absent(name):
    """
    Make sure that the named file or directory is absent. If it exists, it will
    be deleted. This will work to reverse any of the functions in the file
    state module.

    name
        The path which should be deleted
    """
    ret = {"name": name, "changes": {}, "result": True, "comment": ""}
    if not os.path.isabs(name):
        return _error(ret, "Specified file {0} is not an absolute path".format(name))
    if name == "/":
        return _error(ret, 'Refusing to make "/" absent')
    if os.path.isfile(name) or os.path.islink(name):
        if __opts__["test"]:
            ret["result"] = None
            ret["comment"] = "File {0} is set for removal".format(name)
            return ret
        try:
            __salt__["file.remove"](name)
            ret["comment"] = "Removed file {0}".format(name)
            ret["changes"]["removed"] = name
            return ret
        except CommandExecutionError as exc:
            return _error(ret, "{0}".format(exc))

    elif os.path.isdir(name):
        if __opts__["test"]:
            ret["result"] = None
            ret["comment"] = "Directory {0} is set for removal".format(name)
            return ret
        try:
            shutil.rmtree(name)
            ret["comment"] = "Removed directory {0}".format(name)
            ret["changes"]["removed"] = name
            return ret
        except (OSError, IOError):
            return _error(ret, "Failed to remove directory {0}".format(name))

    ret["comment"] = "File {0} is not present".format(name)
    return ret


# Traceback (TypeError)
2014-11-24 16:03:42,245 [salt.minion      ][WARNING ] TypeError encountered executing state.highstate: expected string or buffer. See debug log for more info.  Possibly a missing arguments issue:  ArgSpec(args=['test', 'queue'], varargs=None, keywords='kwargs', defaults=(None, False))
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/salt/minion.py", line 809, in _thread_return
return_data = func(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/salt/modules/state.py", line 275, in highstate
force=kwargs.get('force', False)
File "/usr/lib/pymodules/python2.7/salt/state.py", line 2546, in call_highstate
return self.state.call_high(high)
File "/usr/lib/pymodules/python2.7/salt/state.py", line 1715, in call_high
ret = self.call_chunks(chunks)
File "/usr/lib/pymodules/python2.7/salt/state.py", line 1437, in call_chunks
running = self.call_chunk(low, running, chunks)
File "/usr/lib/pymodules/python2.7/salt/state.py", line 1562, in call_chunk
status = self.check_requisite(low, running, chunks, True)
File "/usr/lib/pymodules/python2.7/salt/state.py", line 1489, in check_requisite
if (fnmatch.fnmatch(chunk['name'], req_val) or
File "/usr/lib/python2.7/fnmatch.py", line 43, in fnmatch
return fnmatchcase(name, pat)
File "/usr/lib/python2.7/fnmatch.py", line 79, in fnmatchcase
return _cache[pat].match(name) is not None
TypeError: expected string or buffer

# Fixed code
def absent(name):
    """
    Make sure that the named file or directory is absent. If it exists, it will
    be deleted. This will work to reverse any of the functions in the file
    state module.

    name
        The path which should be deleted
    """
    ret = {"name": name, "changes": {}, "result": True, "comment": ""}
    if not name:
        return _error(ret, "Must provide name to file.absent")
    if not os.path.isabs(name):
        return _error(ret, "Specified file {0} is not an absolute path".format(name))
    if name == "/":
        return _error(ret, 'Refusing to make "/" absent')
    if os.path.isfile(name) or os.path.islink(name):
        if __opts__["test"]:
            ret["result"] = None
            ret["comment"] = "File {0} is set for removal".format(name)
            return ret
        try:
            __salt__["file.remove"](name)
            ret["comment"] = "Removed file {0}".format(name)
            ret["changes"]["removed"] = name
            return ret
        except CommandExecutionError as exc:
            return _error(ret, "{0}".format(exc))

    elif os.path.isdir(name):
        if __opts__["test"]:
            ret["result"] = None
            ret["comment"] = "Directory {0} is set for removal".format(name)
            return ret
        try:
            shutil.rmtree(name)
            ret["comment"] = "Removed directory {0}".format(name)
            ret["changes"]["removed"] = name
            return ret
        except (OSError, IOError):
            return _error(ret, "Failed to remove directory {0}".format(name))

    ret["comment"] = "File {0} is not present".format(name)
    return ret