Bug 1002743

Summary: remote command worked with expected output, but event history returned error
Product: Red Hat Satellite 5 Reporter: DzungDo <ddo>
Component: APIAssignee: Tomas Lestach <tlestach>
Status: CLOSED NOTABUG QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 550CC: cperry
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-03 11:13:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 462714    

Description DzungDo 2013-08-29 20:59:14 UTC
Description of problem:
remote command worked with expected output, but event history returned error
From satellite server, run a remote command to a rhel 6 client:
yum check-update

Version-Release number of selected component (if applicable):
satellite-5.5.0-20120911

How reproducible:
always

Steps to Reproduce:
1. System -> select a system -> remote command
2. Enter "yum check-update" in the script text entry box
3. schedule a remote command and check the event history

Actual results:
command return the expected output (list of packages need to update), but status is: Failed


Expected results:
Action's status should be: Completed

Additional info:

Comment 1 Tomas Lestach 2013-09-03 11:13:26 UTC
Well, the status of the return command depends on the return code of the remote command.

On my machine:
* if there're no updates:
# yum check-update > /dev/null; echo $?
0
* if there're updates available:
# yum check-update > /dev/null; echo $?
100

So, if your script returns a non-zero value, the remote command is considered as failed.

Recommended usage:
=======================================================
#!/bin/sh 

yum check-update 
RET=$? 
if [ $RET -eq 100 ]; then exit 0; else exit $RET; fi
=======================================================

Closing as NOTABUG.