Project

General

Profile

Feature #19401

Allow choice of target shell in Remote Execution

Added by Adam Ruzicka over 5 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1445807

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.

How reproducible:

Always.

Steps to Reproduce:
1. Set target host shell to csh
2. Run a simple command (i.e. ls) via REx against that host

Actual results:

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'

Expected results:

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:
-------
1:
Loaded plugins: langpacks, package_upload, product-id, search-disabled-repos,
2:
: subscription-manager
3:
Package ksh-20120801-26.el7.x86_64 already installed and latest version
4:
Nothing to do
5:
Illegal variable name.
6:
Exit status: 1
-------


Related issues

Related to Foreman Remote Execution - Bug #19584: Some shells complain about heredoc ended by EOFClosed2017-05-18

Associated revisions

Revision aaa02f6e (diff)
Added by adamruzicka about 5 years ago

Fixes #19401 - Compatibility fix for t?csh (#245)

  • Fixes #19401 - Compatibility fix for t?csh

History

#1 Updated by Adam Ruzicka over 5 years ago

  • Target version set to 1.13.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

#3 Updated by The Foreman Bot about 5 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_remote_execution/pull/245 added

#4 Updated by Anonymous about 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Ivan Necas about 5 years ago

  • Related to Bug #19584: Some shells complain about heredoc ended by EOF added

#6 Updated by Ivan Necas about 5 years ago

  • Legacy Backlogs Release (now unused) set to 263

Also available in: Atom PDF