# Buggy code
def usage(args=None):
    """
    Return usage information for volumes mounted on this minion

    CLI Example:

    .. code-block:: bash

        salt '*' disk.usage
    """
    flags = _clean_flags(args, "disk.usage")
    if __grains__["kernel"] == "Linux":
        cmd = "df -P"
    elif __grains__["kernel"] == "OpenBSD":
        cmd = "df -kP"
    else:
        cmd = "df"
    if flags:
        cmd += " -{0}".format(flags)
    ret = {}
    out = __salt__["cmd.run"](cmd).splitlines()
    for line in out:
        if not line:
            continue
        if line.startswith("Filesystem"):
            continue
        comps = line.split()
        while not comps[1].isdigit():
            comps[0] = "{0} {1}".format(comps[0], comps[1])
            comps.pop(1)
        try:
            if __grains__["kernel"] == "Darwin":
                ret[comps[8]] = {
                    "filesystem": comps[0],
                    "512-blocks": comps[1],
                    "used": comps[2],
                    "available": comps[3],
                    "capacity": comps[4],
                    "iused": comps[5],
                    "ifree": comps[6],
                    "%iused": comps[7],
                }
            else:
                ret[comps[5]] = {
                    "filesystem": comps[0],
                    "1K-blocks": comps[1],
                    "used": comps[2],
                    "available": comps[3],
                    "capacity": comps[4],
                }
        except IndexError:
            log.warn("Problem parsing disk usage information")
            ret = {}
    return ret


# Traceback (IndexError)
salt '*' disk.usage
minion:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/minion.py", line 659, in _thread_return
return_data = func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/modules/disk.py", line 71, in usage
while not comps[1].isdigit():
IndexError: list index out of range

# Fixed code
def usage(args=None):
    """
    Return usage information for volumes mounted on this minion

    CLI Example:

    .. code-block:: bash

        salt '*' disk.usage
    """
    flags = _clean_flags(args, "disk.usage")
    if not os.path.isfile("/etc/mtab"):
        log.warn("df cannot run without /etc/mtab ")
        if __grains__.get("virtual_subtype") == "LXC":
            log.warn(
                "df command failed and LXC detected. If you are running a Docker container, consider linking /proc/mounts to /etc/mtab or running with consider running Docker with -privileged"
            )
        return {}
    if __grains__["kernel"] == "Linux":
        cmd = "df -P"
    elif __grains__["kernel"] == "OpenBSD":
        cmd = "df -kP"
    else:
        cmd = "df"
    if flags:
        cmd += " -{0}".format(flags)
    ret = {}
    out = __salt__["cmd.run"](cmd).splitlines()
    for line in out:
        if not line:
            continue
        if line.startswith("Filesystem"):
            continue
        comps = line.split()
        while not comps[1].isdigit():
            comps[0] = "{0} {1}".format(comps[0], comps[1])
            comps.pop(1)
        try:
            if __grains__["kernel"] == "Darwin":
                ret[comps[8]] = {
                    "filesystem": comps[0],
                    "512-blocks": comps[1],
                    "used": comps[2],
                    "available": comps[3],
                    "capacity": comps[4],
                    "iused": comps[5],
                    "ifree": comps[6],
                    "%iused": comps[7],
                }
            else:
                ret[comps[5]] = {
                    "filesystem": comps[0],
                    "1K-blocks": comps[1],
                    "used": comps[2],
                    "available": comps[3],
                    "capacity": comps[4],
                }
        except IndexError:
            log.warn("Problem parsing disk usage information")
            ret = {}
    return ret