Wizard: use oscap profiles from major version for beta versions
This commit is contained in:
parent
c4170102cd
commit
6ab32d1555
2 changed files with 16 additions and 3 deletions
|
|
@ -18,9 +18,11 @@ import { v4 as uuidv4 } from 'uuid';
|
|||
|
||||
import OscapProfileInformation from './OscapProfileInformation';
|
||||
|
||||
import { RHEL_9_BETA, RHEL_9 } from '../../../../constants';
|
||||
import { usePoliciesQuery, PolicyRead } from '../../../../store/complianceApi';
|
||||
import { useAppDispatch, useAppSelector } from '../../../../store/hooks';
|
||||
import {
|
||||
Distributions,
|
||||
DistributionProfileItem,
|
||||
Filesystem,
|
||||
OpenScapProfile,
|
||||
|
|
@ -82,7 +84,7 @@ const ProfileSelector = () => {
|
|||
const policyID = useAppSelector(selectCompliancePolicyID);
|
||||
const policyTitle = useAppSelector(selectCompliancePolicyTitle);
|
||||
const profileID = useAppSelector(selectComplianceProfileID);
|
||||
const release = useAppSelector(selectDistribution);
|
||||
const release = removeBetaFromRelease(useAppSelector(selectDistribution));
|
||||
const majorVersion = release.split('-')[1];
|
||||
const hasWslTargetOnly = useHasSpecificTargetOnly('wsl');
|
||||
const dispatch = useAppDispatch();
|
||||
|
|
@ -454,6 +456,17 @@ const ComplianceSelectOption = ({ policy }: ComplianceSelectOptionPropType) => {
|
|||
);
|
||||
};
|
||||
|
||||
// The beta releases won't have any oscap profiles associated with them,
|
||||
// so just use the ones from the major release.
|
||||
export const removeBetaFromRelease = (dist: Distributions): Distributions => {
|
||||
switch (dist) {
|
||||
case RHEL_9_BETA:
|
||||
return RHEL_9;
|
||||
default:
|
||||
return dist;
|
||||
}
|
||||
};
|
||||
|
||||
export const Oscap = () => {
|
||||
const oscapProfile = useAppSelector(selectComplianceProfileID);
|
||||
const environments = useAppSelector(selectImageTypes);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import {
|
|||
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
|
||||
import { useFlag } from '@unleash/proxy-client-react';
|
||||
|
||||
import { Oscap } from './Oscap';
|
||||
import { Oscap, removeBetaFromRelease } from './Oscap';
|
||||
|
||||
import {
|
||||
COMPLIANCE_AND_VULN_SCANNING_URL,
|
||||
|
|
@ -47,7 +47,7 @@ const OscapStep = () => {
|
|||
{}
|
||||
);
|
||||
const { isProd } = useGetEnvironment();
|
||||
const release = useAppSelector(selectDistribution);
|
||||
const release = removeBetaFromRelease(useAppSelector(selectDistribution));
|
||||
const { data: currentProfileData } = useGetOscapCustomizationsQuery(
|
||||
{
|
||||
distribution: release,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue