Allow choice of target shell in Remote Execution
Description of problem:
Executing remote commands against hosts using cshell (csh) yields the following results:
- The command executes fine
- However, the exit code is 1
- "Illegal variable name" is output regardless of variable definitions
- Job status reverts to failed
This makes determining which jobs have failed on which hosts nearly impossible in an environment running primarily csh.
Steps to Reproduce:
1. Set target host shell to csh
2. Run a simple command (i.e. ls) via REx against that host
The output indicates that the 'ls' command actually succeeded, however the job will always return as failed and the output shown will always complain about an 'Illegal variable name'
These results are "expected" given that REx templates appear to be written for bash, however it would be helpful in some environments if there were a set of script template equivalents with command syntax which could be used for different shells.
Below is the output received when sending a simple package installation task to a host:
Loaded plugins: langpacks, package_upload, product-id, search-disabled-repos,
Package ksh-20120801-26.el7.x86_64 already installed and latest version
Nothing to do
Illegal variable name.
Exit status: 1
#2 Updated by Adam Ruzicka over 5 years ago
To get the exit code we read it from a file where it is stored like this:
$ tcsh $ echo foo > bar # The error we're encountering $ echo $(cat bar) Illegal variable name. $ echo $? 1 # Solution 1 $ echo `cat bar` foo # Solution 2 $ cat bar | xargs echo foo
t?csh apparently doesn't understand $(command), we'd have to use `command` or
#4 Updated by Anonymous about 5 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset foreman_plugin|aaa02f6eb0a8e5d77e5a6b2717d2d540f70a297b.