Does anyone know why a multi argument bash command fails but a single argument command does not fail? It almost acts as if the “md5sum” command in this example is ran without taking into consideration the filepath.
$basicAuthValue = "Basic $base64"
$headers = @{ Authorization = $basicAuthValue }
$Contenttype = "application/json"
$Body = '{
"kind": "tm:util:bash:runstate",
"command":"run",
"utilCmdArgs":"-c md5sum /shared/images/IMAGENAME"
}'
Invoke-RestMethod -Header $headers -Uri https://localhost/mgmt/tm/util/bash -ContentType $Contenttype -Method Post -Body $Body | format-table -Wrap
This code will result in a 500 error, however, if I change the utilCmdArgs to a command such as “pwd” it succeeds.
kind command utilCmdArgs commandResult
---- ------- ----------- -------------
tm:util:bash:runstate run -c pwd /var/service/icrd
Has anyone experienced this before or ran into a similar issue?