Bug 1214190 - Add rlIsCentOS to do the right thing on CentOS, similar to rlIsRHEL
Summary: Add rlIsCentOS to do the right thing on CentOS, similar to rlIsRHEL
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: 24
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
Assignee: Ales Zelinka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1173652 Fedora-beakerlib 1214412
TreeView+ depends on / blocked
 
Reported: 2015-04-22 08:20 UTC by Jan Pazdziora
Modified: 2017-02-16 08:48 UTC (History)
6 users (show)

Fixed In Version: beakerlib-1.13-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1214412 (view as bug list)
Environment:
Last Closed: 2017-02-16 08:48:27 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 1214191 None None None Never

Internal Links: 1214191

Description Jan Pazdziora 2015-04-22 08:20:49 UTC
Description of problem:

On CentOS 7 machine, rlIsRHEL 7 exists with 1, and reading beakerlib man page, there does not seem to be an easy way (similar in complexity to rlIsRHEL) to check the OS and its version.

Please consider adding rlIsCentOS.

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

beakerlib-1.10-2.el7eso.noarch

How reproducible:

Deterministic.

Steps to Reproduce:
1. Have CentOS 7 machine (CentOS Linux release 7.1.1503 (Core))
2. Try to check for CentOS 7

Actual results:

No rlIs* way.

Expected results:

There is rlIsCentOS.

Additional info:

Alternatively, rlIsRHEL could be modified to identify CentOS as RHEL but that could open its own set of issues.

Comment 2 Dalibor Pospíšil 2015-04-23 13:38:03 UTC
(In reply to Ales Zelinka from comment #1)
> patch adding rlIsCentOS on review:
> 
> https://git.fedorahosted.org/cgit/beakerlib.git/commit/
> ?h=devel&id=cce2b41b68f9b0559d4f58d01edd5407ee70f77e

This is bad:
- if [[ "$arg" == "$major" || "$arg" == "$whole" ]]
+ if [[ "$whole" =~ ^${arg}.* ]]

Comment 3 Ales Zelinka 2015-04-23 14:02:22 UTC
(In reply to Dalibor Pospíšil from comment #2)

> This is bad:
> - if [[ "$arg" == "$major" || "$arg" == "$whole" ]]
> + if [[ "$whole" =~ ^${arg}.* ]]

um, why? What did I miss?

Comment 4 Dalibor Pospíšil 2015-04-23 14:45:08 UTC
(In reply to Ales Zelinka from comment #3)
> (In reply to Dalibor Pospíšil from comment #2)
> 
> > This is bad:
> > - if [[ "$arg" == "$major" || "$arg" == "$whole" ]]
> > + if [[ "$whole" =~ ^${arg}.* ]]
> 
> um, why? What did I miss?

# whole=5.10
# arg=5.1
# [[ "$whole" =~ ^${arg}.* ]]; echo $?
0

BTW, what was wrong on the old one?

Comment 5 Ales Zelinka 2015-04-23 14:55:08 UTC
I see, that is a bug. 

> BTW, what was wrong on the old one?

It assumed that $whole - $major = $minor which is incorrect for CentOS7.1 because it has 3rd number in the release (7.1.1503).

I'll just rewrite the function to use proper $major $minor parsing instead of the $whole thingie.

Comment 6 Dalibor Pospíšil 2015-04-23 15:07:23 UTC
(In reply to Ales Zelinka from comment #5)
> I see, that is a bug. 
> 
> > BTW, what was wrong on the old one?
> 
> It assumed that $whole - $major = $minor which is incorrect for CentOS7.1
> because it has 3rd number in the release (7.1.1503).
> 
> I'll just rewrite the function to use proper $major $minor parsing instead
> of the $whole thingie.

rlTestVersion is able to handle unlimited number of dots. The problem comes to play if we want to compare just at the level of minors or in this case possibli lower. I think it would be nice to implement some universal approach, like to cut content of whole to match expected number of dots...

Comment 7 Fedora End Of Life 2015-11-04 15:35:14 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Jan Kurik 2016-02-24 15:48:38 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase


Note You need to log in before you can comment on or make changes to this bug.