Project

General

Profile

Actions

Feature #19401

closed

Allow choice of target shell in Remote Execution

Added by Adam Ruzicka over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
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 1 (0 open1 closed)

Related to Foreman Remote Execution - Bug #19584: Some shells complain about heredoc ended by EOFClosedAdam Ruzicka05/18/2017Actions
Actions #1

Updated by Adam Ruzicka over 7 years ago

  • Target version set to 1.13.1
Actions #2

Updated by Adam Ruzicka over 7 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

Actions #3

Updated by The Foreman Bot over 7 years ago

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

Updated by Anonymous over 7 years ago

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

Updated by Ivan Necas over 7 years ago

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

Updated by Ivan Necas over 7 years ago

  • Translation missing: en.field_release set to 263
Actions

Also available in: Atom PDF