# Buggy code
def _active_mounts_openbsd(ret):
    """
    List active mounts on OpenBSD systems
    """
    for line in __salt__["cmd.run_stdout"]("mount -v").split("\n"):
        comps = re.sub(r"\s+", " ", line).split()
        nod = __salt__["cmd.run_stdout"]("ls -l {0}".format(comps[0]))
        nod = " ".join(nod.split()).split(" ")
        parens = re.findall(r"\((.*?)\)", line, re.DOTALL)
        if len(parens) > 1:
            ret[comps[3]] = {
                "device": comps[0],
                "fstype": comps[5],
                "opts": _resolve_user_group_names(parens[1].split(", ")),
                "major": str(nod[4].strip(",")),
                "minor": str(nod[5]),
                "device_uuid": parens[0],
            }
        else:
            ret[comps[2]] = {
                "device": comps[0],
                "fstype": comps[4],
                "opts": _resolve_user_group_names(parens[1].split(", ")),
            }
    return ret


# Traceback (IndexError)
$ sudo salt-call -l debug --local mount.active
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Including configuration from '/etc/salt/minion.d/startup_states.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/startup_states.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: builder.viq.vc
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Including configuration from '/etc/salt/minion.d/startup_states.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/startup_states.conf
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded mount.active
[DEBUG   ] LazyLoaded cmd.run_stdout
[INFO    ] Executing command 'mount -v' in directory '/home/viq'
[DEBUG   ] stdout: /dev/sd0a (bd15538f0bff9935.a) on / type ffs (rw, local, softdep, ctime=Tue Jun 14 20:32:10 2016)
/dev/sd0k (bd15538f0bff9935.k) on /home type ffs (rw, NFS exported, local, nosuid, softdep, ctime=Tue Jun 14 20:32:10 2016)
/dev/sd0d (bd15538f0bff9935.d) on /tmp type ffs (rw, local, nodev, nosuid, softdep, ctime=Tue Jun 14 20:32:10 2016)
/dev/sd0f (bd15538f0bff9935.f) on /usr type ffs (rw, local, nodev, softdep, ctime=Tue Jun 14 20:32:10 2016)
/dev/sd0g (bd15538f0bff9935.g) on /usr/X11R6 type ffs (rw, local, nodev, softdep, ctime=Tue Jun 14 20:32:11 2016)
/dev/sd0h (bd15538f0bff9935.h) on /usr/local type ffs (rw, local, nodev, wxallowed, softdep, ctime=Tue Jun 14 20:32:11 2016)
/dev/sd0j (bd15538f0bff9935.j) on /usr/obj type ffs (rw, local, nodev, nosuid, softdep, ctime=Tue Jun 14 20:32:11 2016)
/dev/sd0i (bd15538f0bff9935.i) on /usr/src type ffs (rw, local, nodev, nosuid, softdep, ctime=Tue Jun 14 20:32:11 2016)
/dev/sd0e (bd15538f0bff9935.e) on /var type ffs (rw, local, nodev, nosuid, softdep, ctime=Tue Jun 14 20:32:11 2016)
tmpfs on /etc/secrets type tmpfs (rw, local, ctime=Tue Jun 14 20:32:02 2016)
[INFO    ] Executing command 'ls -l /dev/sd0a' in directory '/home/viq'
[DEBUG   ] stdout: brw-r-----  1 root  operator    4,   0 Jun 14 20:32 /dev/sd0a
[INFO    ] Executing command 'ls -l /dev/sd0k' in directory '/home/viq'
[DEBUG   ] stdout: brw-r-----  1 root  operator    4,  10 Jun 14 20:32 /dev/sd0k
[INFO    ] Executing command 'ls -l /dev/sd0d' in directory '/home/viq'
[DEBUG   ] stdout: brw-r-----  1 root  operator    4,   3 Jun 14 20:32 /dev/sd0d
[INFO    ] Executing command 'ls -l /dev/sd0f' in directory '/home/viq'
[DEBUG   ] stdout: brw-r-----  1 root  operator    4,   5 Jun 14 20:32 /dev/sd0f
[INFO    ] Executing command 'ls -l /dev/sd0g' in directory '/home/viq'
[DEBUG   ] stdout: brw-r-----  1 root  operator    4,   6 Jun 14 20:32 /dev/sd0g
[INFO    ] Executing command 'ls -l /dev/sd0h' in directory '/home/viq'
[DEBUG   ] stdout: brw-r-----  1 root  operator    4,   7 Jun 14 20:32 /dev/sd0h
[INFO    ] Executing command 'ls -l /dev/sd0j' in directory '/home/viq'
[DEBUG   ] stdout: brw-r-----  1 root  operator    4,   9 Jun 14 20:32 /dev/sd0j
[INFO    ] Executing command 'ls -l /dev/sd0i' in directory '/home/viq'
[DEBUG   ] stdout: brw-r-----  1 root  operator    4,   8 Jun 14 20:32 /dev/sd0i
[INFO    ] Executing command 'ls -l /dev/sd0e' in directory '/home/viq'
[DEBUG   ] stdout: brw-r-----  1 root  operator    4,   4 Jun 14 20:32 /dev/sd0e
[INFO    ] Executing command 'ls -l tmpfs' in directory '/home/viq'
[ERROR   ] Command 'ls -l tmpfs' failed with return code: 1
[ERROR   ] stderr: ls: tmpfs: No such file or directory
[ERROR   ] retcode: 1
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
IndexError: list index out of range
Traceback (most recent call last):
File "/usr/local/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/local/lib/python2.7/site-packages/salt/scripts.py", line 345, in salt_call
client.run()
File "/usr/local/lib/python2.7/site-packages/salt/cli/call.py", line 58, in run
caller.run()
File "/usr/local/lib/python2.7/site-packages/salt/cli/caller.py", line 134, in run
ret = self.call()
File "/usr/local/lib/python2.7/site-packages/salt/cli/caller.py", line 197, in call
ret['return'] = func(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/salt/modules/mount.py", line 208, in active
_active_mounts_openbsd(ret)
File "/usr/local/lib/python2.7/site-packages/salt/modules/mount.py", line 156, in _active_mounts_openbsd
'opts': _resolve_user_group_names(parens[1].split(", "))}
IndexError: list index out of range
Traceback (most recent call last):
File "/usr/local/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/local/lib/python2.7/site-packages/salt/scripts.py", line 345, in salt_call
client.run()
File "/usr/local/lib/python2.7/site-packages/salt/cli/call.py", line 58, in run
caller.run()
File "/usr/local/lib/python2.7/site-packages/salt/cli/caller.py", line 134, in run
ret = self.call()
File "/usr/local/lib/python2.7/site-packages/salt/cli/caller.py", line 197, in call
ret['return'] = func(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/salt/modules/mount.py", line 208, in active
_active_mounts_openbsd(ret)
File "/usr/local/lib/python2.7/site-packages/salt/modules/mount.py", line 156, in _active_mounts_openbsd
'opts': _resolve_user_group_names(parens[1].split(", "))}
IndexError: list index out of range

# Fixed code
def _active_mounts_openbsd(ret):
    """
    List active mounts on OpenBSD systems
    """
    for line in __salt__["cmd.run_stdout"]("mount -v").split("\n"):
        comps = re.sub(r"\s+", " ", line).split()
        parens = re.findall(r"\((.*?)\)", line, re.DOTALL)
        if len(parens) > 1:
            nod = __salt__["cmd.run_stdout"]("ls -l {0}".format(comps[0]))
            nod = " ".join(nod.split()).split(" ")
            ret[comps[3]] = {
                "device": comps[0],
                "fstype": comps[5],
                "opts": _resolve_user_group_names(parens[1].split(", ")),
                "major": str(nod[4].strip(",")),
                "minor": str(nod[5]),
                "device_uuid": parens[0],
            }
        else:
            ret[comps[2]] = {
                "device": comps[0],
                "fstype": comps[4],
                "opts": _resolve_user_group_names(parens[0].split(", ")),
            }
    return ret