# Buggy code
def shell_jobber(self):
    """
    Shell jobber start!
    """
    while self.fun.value:
        msg = self.fun.value.popleft()
        data = msg.get("pub")
        match = getattr(
            self.matcher.value, "{0}_match".format(data.get("tgt_type", "glob"))
        )(data["tgt"])
        if not match:
            continue
        fun = data["fun"]
        if fun in self.modules.value:
            func = self.modules.value[fun]
        else:
            continue
        args, kwargs = salt.minion.load_args_and_kwargs(
            func, salt.utils.args.parse_input(data["arg"]), data
        )
        cmd = [
            "salt-call",
            "--out",
            "json",
            "--metadata",
            "-c",
            salt.syspaths.CONFIG_DIR,
        ]
        if "return" in data:
            cmd.append("--return")
            cmd.append(data["return"])
        cmd.append(fun)
        for arg in args:
            cmd.append(arg)
        for key in kwargs:
            cmd.append("{0}={1}".format(key, kwargs[key]))
        que = {"pub": data, "msg": msg}
        que["proc"] = subprocess.Popen(
            cmd, shell=False, stderr=subprocess.PIPE, stdout=subprocess.PIPE
        )
        self.shells.value[data["jid"]] = que


# Traceback (RestException)
2017-03-13 11:19:26.095 [INFO] 10.234.112.46 >> POST http://10.234.112.107/api/1.8/host/salt-host
{
"wwnlist":"['0011223344556677', '1122334455667788']"
}
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pure/rest/controller/util.py", line 97, in execute
(command, args) = get_args(command_list, version, params)
File "/usr/lib/python2.7/dist-packages/pure/rest/controller/util.py", line 392, in get_args
raise RestException("Value of argument {} needs to be one of {}.".format(key, arg.arg_type), Code.BAD_REQUEST)
RestException: Value of argument wwnlist needs to be one of ['list'].
2017-03-13 11:19:26.101 [WARNING] << 400 BAD REQUEST
{
"msg":"Value of argument wwnlist needs to be one of ['list']."
}

# Fixed code
def shell_jobber(self):
    """
    Shell jobber start!
    """
    while self.fun.value:
        msg = self.fun.value.popleft()
        data = msg.get("pub")
        match = getattr(
            self.matcher.value, "{0}_match".format(data.get("tgt_type", "glob"))
        )(data["tgt"])
        if not match:
            continue
        fun = data["fun"]
        if fun in self.modules.value:
            func = self.modules.value[fun]
        else:
            continue
        args, kwargs = salt.minion.load_args_and_kwargs(
            func,
            salt.utils.args.parse_input(data["arg"], no_parse=data.get("no_parse", [])),
            data,
        )
        cmd = [
            "salt-call",
            "--out",
            "json",
            "--metadata",
            "-c",
            salt.syspaths.CONFIG_DIR,
        ]
        if "return" in data:
            cmd.append("--return")
            cmd.append(data["return"])
        cmd.append(fun)
        for arg in args:
            cmd.append(arg)
        for key in kwargs:
            cmd.append("{0}={1}".format(key, kwargs[key]))
        que = {"pub": data, "msg": msg}
        que["proc"] = subprocess.Popen(
            cmd, shell=False, stderr=subprocess.PIPE, stdout=subprocess.PIPE
        )
        self.shells.value[data["jid"]] = que