Bug 647758

Summary: wrong return code if bad hostname is used
Product: Red Hat Enterprise MRG Reporter: Lubos Trilety <ltrilety>
Component: condorAssignee: Matthew Farrellee <matt>
Status: CLOSED ERRATA QA Contact: Tomas Rusnak <trusnak>
Severity: low Docs Contact:
Priority: low    
Version: 1.3CC: iboverma, ltoscano, matt, trusnak
Target Milestone: 2.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: condor-7.5.6-0.1 Doc Type: Bug Fix
Doc Text:
C: Some command-line tools would not consistently report errors via their return code. C: Scripting the tools can be more complicated than is necessary. F: A number of tools (mentioned in BZ) were updated to report errors when provided with a bad hostname. R: The tools are now easier to script as they report errors when provided a bad hostname.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-23 15:41:18 UTC Type: ---
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: 693778    

Description Lubos Trilety 2010-10-29 10:46:38 UTC
Description of problem:
Some of condor scripts accept host name as argument, if bad host name is used they return 0 instead of some error number.
Involved condor scripts:
condor_reschedule
condor_vacate
condor_off
condor_on
condor_reconfig
condor_restart


Version-Release number of selected component (if applicable):
condor-7.4.4-0.16

How reproducible:
100%

Steps to Reproduce:
1. run 'condor_off -name nohost; echo $?'
# condor_off -name nohost; echo $?
condor_off: unknown host nohost
0
  
Actual results:
script returns 0

Expected results:
script should return 1

Additional info:

Comment 1 Matthew Farrellee 2011-02-03 19:21:56 UTC
Upstream at https://condor-wiki.cs.wisc.edu/index.cgi/tktview?tn=1895

Comment 2 Matthew Farrellee 2011-02-03 19:23:51 UTC
Fixed upstream for 7.5.6

commit 5654df23c99e9ac58e163eae9e4bb5644c2840a9
Author: Matthew Farrellee <matt@redhat>
Date:   Thu Feb 3 14:22:20 2011 -0500

    Report errors via tool exit codes if everything doesn't work, #1895

diff --git a/src/condor_tools/tool.cpp b/src/condor_tools/tool.cpp

Comment 3 Matthew Farrellee 2011-02-14 17:16:28 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
C: Some command-line tools would not consistently report errors via their return code.
C: Scripting the tools can be more complicated than is necessary.
F: A number of tools (mentioned in BZ) were updated to report errors when provided with a bad hostname.
R: The tools are now easier to script as they report errors when provided a bad hostname.

Comment 5 Tomas Rusnak 2011-05-04 13:01:48 UTC
Reproduced on:

$CondorVersion: 7.4.5 Feb  4 2011 BuildID: RH-7.4.5-0.8.el5 PRE-RELEASE $
$CondorPlatform: X86_64-LINUX_RHEL5 $

# condor_off -name nohost; echo $?
condor_off: unknown host nohost
0
# condor_reschedule  -name nohost; echo $?
condor_reschedule: unknown host nohost
0
# condor_vacate  -name nohost; echo $?
condor_vacate: unknown host nohost
0
# condor_off -name nohost; echo $?
condor_off: unknown host nohost
0
# condor_on -name nohost; echo $?
condor_on: unknown host nohost
0
# condor_reconfig -name nohost; echo $?
condor_reconfig: unknown host nohost
0
# condor_restart -name nohost; echo $?
condor_restart: unknown host nohost
0

Comment 6 Tomas Rusnak 2011-05-04 13:05:35 UTC
Retested over all supported platforms x86,x86_64/RHEL5,RHEL6:

condor-7.6.1-0.4

# condor_off -name nohost; echo $?
condor_off: unknown host nohost
1
# condor_reschedule  -name nohost; echo $?
condor_reschedule: unknown host nohost
1
# condor_vacate  -name nohost; echo $?
condor_vacate: unknown host nohost
1
# condor_off -name nohost; echo $?
condor_off: unknown host nohost
1
# condor_on -name nohost; echo $?
condor_on: unknown host nohost
1
# condor_reconfig -name nohost; echo $?
condor_reconfig: unknown host nohost
1
# condor_restart -name nohost; echo $?
condor_restart: unknown host nohost
1

Return code in all tools was corrected for unknown host parameter.

>>> VERIFIED

Comment 7 errata-xmlrpc 2011-06-23 15:41:18 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2011-0889.html