Skip to content

Commit

Permalink
Fixes #919 - isNotRhelHost regex too restrictive
Browse files Browse the repository at this point in the history
- Changed regex to be more wide-ranging
- Fixed a bug in InsightsTotalRiskChartWrapper
where the wrong parameter was passed to isNotRhelHost
  • Loading branch information
Thorben-D committed Nov 2, 2024
1 parent 87ba0f9 commit a902fa1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions webpack/ForemanRhCloudHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
export const foremanUrl = path => `${window.URL_PREFIX}${path}`;

export const isNotRhelHost = ({ hostDetails }) =>
// eslint-disable-next-line camelcase
!new RegExp('red\\s?hat', 'i').test(hostDetails?.operatingsystem_name);
// This regex tries matches sane variations of "RedHat", "RHEL" and "RHCOS"
!new RegExp('red[\\s\\-]?hat|rh[\\s\\-]?el|rhc[\\s\\-]?os', 'i').test(

Check failure on line 10 in webpack/ForemanRhCloudHelpers.js

View workflow job for this annotation

GitHub Actions / test_js

You have a misspelled word: rhc on String
// eslint-disable-next-line camelcase
hostDetails?.operatingsystem_name
);
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { isNotRhelHost } from '../ForemanRhCloudHelpers';
export const InsightsTotalRiskChartWrapper = props => {
if (props.status === 'RESOLVED') {
return (
!isNotRhelHost(props.hostDetails) && <InsightsTotalRiskChart {...props} /> // check for RHEL hosts
!isNotRhelHost(props) && <InsightsTotalRiskChart {...props} /> // check for RHEL hosts
);
}
return null;
Expand Down

0 comments on commit a902fa1

Please sign in to comment.