SaaShup / netbox-docker-agent

Agent for Netbox Docker Plugin
https://saashup.com
BSD 3-Clause "New" or "Revised" License
34 stars 1 forks source link

Endpoint "/api/engine/containers/{containerId}/exec" not returning "stderr" #133

Open somediego opened 1 day ago

somediego commented 1 day ago

Command works fine, but output will return "stdout" without "stderr". What make it harder to debug.

To replicate, body example:

{
    "cmd": [
        "ls",
        "bb"
    ]
}

returns: {"stdout":""}

while stderr output: "ls: bb: No such file or directory"

lvenier commented 1 day ago

hello,

Thanks for your issue.

We can easily add the stderr in the response. By adding AttachStderr=true in the exec command.

for the same command you will get :

ls: bb: No such file or directory

with the following json format :

{"stdout":"ls: bb: No such file or directory\n"}

splitting the response as

 {"stdout":"","stderr":"No such file or directory"} 

will be quite an effort.