-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #910 - Insights tab displayed for non-RHEL hosts #911
Fixes #910 - Insights tab displayed for non-RHEL hosts #911
Conversation
- Add helper-function isNotRhelHost - Hide insights tab based on host-OS - Hide TotalRisk card based on host-OS
|
||
export const isNotRhelHost = ({ hostDetails }) => | ||
// eslint-disable-next-line camelcase | ||
!new RegExp('red\\s?hat', 'i').test(hostDetails?.operatingsystem_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operatingsystem_name
is not safe as this value can be changed by the user. As this plugin depends on Katello anyways, you can use hostDetails?.operatingsystem_family
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you will get the OS type Redhat for Alma, Rocky, etc. as well, so this is tricky... But maybe you can use it for a sanity check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no better check for this right now. I would just go with this solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about checking at least for RHEL
? I don't know how people are naming their OSes these days.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on Redhat, these OS are created automatically from the imported Manifest.
Other areas will not work if OS name was changed, like https://github.com/theforeman/foreman/blob/develop/app/views/unattended/provisioning_templates/snippet/insights.erb#L10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, adding the metadata field looks like a good solution to me.
Will take a look |
ACK, works great. Thanks @Thorben-D I am not seeing the insights tab for my Ubuntu 24.04 box |
@Thorben-D I am not seeing the insights tab for a normal RHEL host now, is this something you are able to investigate? |
@chris1984 Thanks for having a look! Does the OS name of your RHEL host not contain any permutation of "Red Hat"? |
#911 (comment) That is what is was talking about :) |
@Thorben-D my host name is |
The Icon way, would work as well I think |
@Thorben-D Do you think you can revisit this next week? Otherwise, I will prob have to revert the commit, so it does not affect our tests downstream when we do our weekly nightly/stream builds. |
@chris1984 Not before wednesday I'm afraid. If that is too late, you'll have to revert the commit. |
Fixes #910
Changes made
The isNotRhelHost check is not the nicest but this is similar to how it is done in:
provisioning_templates/snippet/insights.erb:<% if @host.operatingsystem.name == 'RedHat' -%>