Bug 1136206

Summary: rlIsRHEL should report the syntax error better
Product: [Fedora] Fedora Reporter: Karel Srot <ksrot>
Component: beakerlibAssignee: Dalibor Pospíšil <dapospis>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 20CC: dapospis, pmuller, psplicha
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: beakerlib-1.10-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-12-12 14:48:00 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: 1136360, 1136362    

Description Karel Srot 2014-09-02 07:32:08 UTC
Description of problem:

I had a problem with debugging one test. The test incorrectly uses

rlIsRHEL "<=" 6 

call but since I didn't encounter the problem on the first sight it took me several minutes to find out the root cause.

IMHO the problem is that rlIsRHEL returns exit code 1 on syntax error which is similar to the case when the RHEL version simply doesn't match.

E.g. __INTERNAL_rlIsDistro() contains

  echo $distro | grep -q "$1" || return 1

or

    # sanity check - version needs to consist of numbers/dots/<=>
    [[ "$arg" =~ ^([\<=\>]*)([0-9][0-9\.]*)$ ]] || return 1


I would propose to use different exit code (99 or so) for syntax errors. Some error message on the output would be even better.

version:
beakerlib-1.9-3.el6eso.noarch