latest 3006.15 and 3006.16 salt minion version are throwing the error below when using "cmd.run" module
search cancel

latest 3006.15 and 3006.16 salt minion version are throwing the error below when using "cmd.run" module

book

Article ID: 412402

calendar_today

Updated On:

Products

VCF Automation

Issue/Introduction

When running the following command the error occurs:

salt-call cmd.run "cd /opt; ls -al"
[INFO    ] detected datacenter grain: cs4_barrie
[INFO    ] detected region grain: canada
[INFO    ] start executing 'env' grain ...
[INFO    ] hostname = xxx

[INFO    ] env_flag: i
[INFO    ] secondary_flag: 0
[INFO    ] found match for xxx
[INFO    ] Not a GCP instance
[INFO    ] No GCP metadata found
[INFO    ] Executing command 'cd' in directory '/root'
[ERROR   ] Command 'cd' failed with return code: 1
[ERROR   ] stdout: /bin/cd: line 2: cd: too many arguments
[ERROR   ] retcode: 1
[ERROR   ] Command 'cd' failed with return code: 1
[ERROR   ] output: /bin/cd: line 2: cd: too many arguments
local:
    /bin/cd: line 2: cd: too many arguments

Environment

salt minion 3006.15 and 3006.16

Resolution

The behavior of how these commands are processed has changed. Engineering is aware of this issue and will address it in a future release. In the meantime, the command can be run in the following ways:

  • salt-call cmd.run 'ls -al' cwd='/opt'
  • salt-call cmd.run "cd /opt; ls -al" python_shell=True