foreman_rh_cloud 13.0.6 → 13.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/concerns/foreman_rh_cloud/registration_manager_extensions.rb +39 -0
- data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +3 -2
- data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +1 -1
- data/lib/foreman_inventory_upload.rb +6 -2
- data/lib/foreman_rh_cloud/engine.rb +1 -0
- data/lib/foreman_rh_cloud/plugin.rb +4 -0
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/tasks/rh_cloud_inventory.rake +11 -1
- data/package.json +1 -1
- data/test/jobs/cloud_connector_announce_task_test.rb +3 -2
- data/test/jobs/connector_playbook_execution_reporter_task_test.rb +32 -20
- data/test/jobs/create_missing_insights_facets_test.rb +151 -0
- data/test/jobs/exponential_backoff_test.rb +9 -8
- data/test/jobs/generate_host_report_test.rb +100 -0
- data/test/jobs/generate_report_job_test.rb +146 -0
- data/test/jobs/host_inventory_report_job_test.rb +244 -0
- data/test/jobs/insights_client_status_aging_test.rb +3 -2
- data/test/jobs/insights_full_sync_test.rb +13 -7
- data/test/jobs/insights_resolutions_sync_test.rb +9 -5
- data/test/jobs/insights_rules_sync_test.rb +5 -3
- data/test/jobs/inventory_full_sync_test.rb +9 -5
- data/test/jobs/inventory_hosts_sync_test.rb +11 -6
- data/test/jobs/inventory_scheduled_sync_test.rb +10 -6
- data/test/jobs/inventory_self_host_sync_test.rb +1 -1
- data/test/jobs/queue_for_upload_job_test.rb +9 -7
- data/test/jobs/remove_insights_hosts_job_test.rb +14 -15
- data/test/jobs/single_host_report_job_test.rb +155 -0
- data/test/jobs/upload_report_job_test.rb +5 -4
- data/test/unit/lib/foreman_rh_cloud/registration_manager_extensions_test.rb +192 -0
- data/webpack/ForemanColumnExtensions/index.js +2 -0
- data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettings.js +3 -3
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +3 -9
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js +13 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +2 -2
- data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +3 -3
- data/webpack/InsightsCloudSync/InsightsCloudSync.js +3 -3
- data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +10 -0
- data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +1 -1
- data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +5 -5
- data/webpack/InsightsVulnerabilityHostIndexExtensions/CVECountCell.js +2 -2
- data/webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js +7 -7
- data/webpack/common/Hooks/ConfigHooks.js +3 -16
- metadata +14 -1
|
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import PageLayout from 'foremanReact/routes/common/PageLayout/PageLayout';
|
|
4
4
|
import { ScalprumComponent, ScalprumProvider } from '@scalprum/react-core';
|
|
5
5
|
import InsightsTable from './Components/InsightsTable';
|
|
6
|
-
import {
|
|
6
|
+
import { useIopConfig } from '../common/Hooks/ConfigHooks';
|
|
7
7
|
import { foremanUrl } from '../ForemanRhCloudHelpers';
|
|
8
8
|
import RemediationModal from './Components/RemediationModal';
|
|
9
9
|
import {
|
|
@@ -85,9 +85,9 @@ const IopRecommendationsPageWrapped = props => (
|
|
|
85
85
|
);
|
|
86
86
|
|
|
87
87
|
const RecommendationsPage = props => {
|
|
88
|
-
const
|
|
88
|
+
const isIop = useIopConfig();
|
|
89
89
|
|
|
90
|
-
return
|
|
90
|
+
return isIop ? (
|
|
91
91
|
<IopRecommendationsPageWrapped {...props} />
|
|
92
92
|
) : (
|
|
93
93
|
<InsightsCloudSync {...props} />
|
|
@@ -2,6 +2,16 @@ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
|
2
2
|
import { noop } from 'foremanReact/common/helpers';
|
|
3
3
|
import InsightsCloudSync from './InsightsCloudSync';
|
|
4
4
|
|
|
5
|
+
jest.mock('foremanReact/Root/Context/ForemanContext', () => ({
|
|
6
|
+
useForemanContext: () => ({
|
|
7
|
+
metadata: {
|
|
8
|
+
foreman_rh_cloud: {
|
|
9
|
+
iop: true,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
}),
|
|
13
|
+
}));
|
|
14
|
+
|
|
5
15
|
const fixtures = {
|
|
6
16
|
render: {
|
|
7
17
|
status: 'RESOLVED',
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
selectHits,
|
|
22
22
|
} from '../InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors';
|
|
23
23
|
import { redHatAdvisorSystems } from '../InsightsCloudSync/InsightsCloudSyncHelpers';
|
|
24
|
-
import {
|
|
24
|
+
import { useIopConfig } from '../common/Hooks/ConfigHooks';
|
|
25
25
|
import { generateRuleUrl } from '../InsightsCloudSync/InsightsCloudSync';
|
|
26
26
|
import { providerOptions } from '../common/ScalprumModule/ScalprumContext';
|
|
27
27
|
|
|
@@ -30,7 +30,7 @@ const NewHostDetailsTab = ({ hostName, router }) => {
|
|
|
30
30
|
const dispatch = useDispatch();
|
|
31
31
|
const query = useSelector(selectSearch);
|
|
32
32
|
const hits = useSelector(selectHits);
|
|
33
|
-
const
|
|
33
|
+
const isIop = useIopConfig();
|
|
34
34
|
|
|
35
35
|
useEffect(() => () => router.replace({ search: null }), [router]);
|
|
36
36
|
|
|
@@ -46,7 +46,7 @@ const NewHostDetailsTab = ({ hostName, router }) => {
|
|
|
46
46
|
</DropdownItem>,
|
|
47
47
|
];
|
|
48
48
|
|
|
49
|
-
if (hits.length && !
|
|
49
|
+
if (hits.length && !isIop) {
|
|
50
50
|
const { host_uuid: uuid } = hits[0];
|
|
51
51
|
dropdownItems.push(
|
|
52
52
|
<DropdownItem key="insights-advisor-link" ouiaId="insights-advisor-link">
|
|
@@ -131,9 +131,9 @@ const IopInsightsTabWrapped = props => (
|
|
|
131
131
|
);
|
|
132
132
|
|
|
133
133
|
const InsightsTab = props => {
|
|
134
|
-
const
|
|
134
|
+
const isIop = useIopConfig();
|
|
135
135
|
|
|
136
|
-
return
|
|
136
|
+
return isIop ? (
|
|
137
137
|
<IopInsightsTabWrapped {...props} />
|
|
138
138
|
) : (
|
|
139
139
|
<NewHostDetailsTab {...props} />
|
|
@@ -4,13 +4,13 @@ import { UnknownIcon } from '@patternfly/react-icons';
|
|
|
4
4
|
import { Link } from 'react-router-dom';
|
|
5
5
|
import { useAPI } from 'foremanReact/common/hooks/API/APIHooks';
|
|
6
6
|
import { insightsCloudUrl } from '../InsightsCloudSync/InsightsCloudSyncHelpers';
|
|
7
|
-
import {
|
|
7
|
+
import { useIopConfig } from '../common/Hooks/ConfigHooks';
|
|
8
8
|
|
|
9
9
|
const vulnerabilityApiPath = path =>
|
|
10
10
|
insightsCloudUrl(`api/vulnerability/v1/${path}`);
|
|
11
11
|
|
|
12
12
|
export const CVECountCell = ({ hostDetails }) => {
|
|
13
|
-
const isIopEnabled =
|
|
13
|
+
const isIopEnabled = useIopConfig();
|
|
14
14
|
|
|
15
15
|
// eslint-disable-next-line camelcase
|
|
16
16
|
const uuid = hostDetails?.subscription_facet_attributes?.uuid;
|
|
@@ -26,7 +26,7 @@ const hostDetailsMock = {
|
|
|
26
26
|
|
|
27
27
|
describe('CVECountCell', () => {
|
|
28
28
|
beforeEach(() => {
|
|
29
|
-
ConfigHooks.
|
|
29
|
+
ConfigHooks.useIopConfig.mockReturnValue(true);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
afterEach(() => {
|
|
@@ -45,15 +45,15 @@ describe('CVECountCell', () => {
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
it('renders UnknownIcon when IoP is not enabled', () => {
|
|
48
|
-
ConfigHooks.
|
|
48
|
+
ConfigHooks.useIopConfig.mockReturnValue(false);
|
|
49
49
|
render(<CVECountCell hostDetails={hostDetailsMock} />);
|
|
50
50
|
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
|
|
51
|
-
expect(ConfigHooks.
|
|
51
|
+
expect(ConfigHooks.useIopConfig).toHaveBeenCalled();
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
it('renders UnknownIcon when IoP is enabled but CVE API call fails', () => {
|
|
55
55
|
// Mock successful IoP config
|
|
56
|
-
ConfigHooks.
|
|
56
|
+
ConfigHooks.useIopConfig.mockReturnValue(true);
|
|
57
57
|
// Mock CVE API failure - override the global mock for this test
|
|
58
58
|
API.get.mockImplementationOnce(async () => {
|
|
59
59
|
throw new Error('CVE API call failed');
|
|
@@ -62,13 +62,13 @@ describe('CVECountCell', () => {
|
|
|
62
62
|
render(<CVECountCell hostDetails={hostDetailsMock} />);
|
|
63
63
|
// Should render UnknownIcon when CVE API fails
|
|
64
64
|
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
|
|
65
|
-
expect(ConfigHooks.
|
|
65
|
+
expect(ConfigHooks.useIopConfig).toHaveBeenCalled();
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
it('renders UnknownIcon when IoP is undefined (API call pending)', () => {
|
|
69
|
-
ConfigHooks.
|
|
69
|
+
ConfigHooks.useIopConfig.mockReturnValue(undefined);
|
|
70
70
|
render(<CVECountCell hostDetails={hostDetailsMock} />);
|
|
71
71
|
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
|
|
72
|
-
expect(ConfigHooks.
|
|
72
|
+
expect(ConfigHooks.useIopConfig).toHaveBeenCalled();
|
|
73
73
|
});
|
|
74
74
|
});
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
ADVISOR_ENGINE_CONFIG_KEY,
|
|
4
|
-
ADVISOR_ENGINE_CONFIG_PATH,
|
|
5
|
-
} from '../../InsightsCloudSync/Components/InsightsTable/InsightsTableConstants';
|
|
6
|
-
|
|
7
|
-
export const useAdvisorEngineConfig = () => {
|
|
8
|
-
const { response: advisorEngineConfig } = useAPI(
|
|
9
|
-
'get',
|
|
10
|
-
ADVISOR_ENGINE_CONFIG_PATH,
|
|
11
|
-
{
|
|
12
|
-
key: ADVISOR_ENGINE_CONFIG_KEY,
|
|
13
|
-
}
|
|
14
|
-
);
|
|
1
|
+
import { useForemanContext } from 'foremanReact/Root/Context/ForemanContext';
|
|
15
2
|
|
|
3
|
+
export const useIopConfig = () =>
|
|
16
4
|
// eslint-disable-next-line camelcase
|
|
17
|
-
|
|
18
|
-
};
|
|
5
|
+
useForemanContext().metadata?.foreman_rh_cloud?.iop;
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foreman_rh_cloud
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 13.0.
|
|
4
|
+
version: 13.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Foreman Red Hat Cloud team
|
|
@@ -99,6 +99,7 @@ files:
|
|
|
99
99
|
- app/controllers/api/v2/rh_cloud/cloud_request_controller.rb
|
|
100
100
|
- app/controllers/api/v2/rh_cloud/inventory_controller.rb
|
|
101
101
|
- app/controllers/concerns/foreman_rh_cloud/iop_smart_proxy_access.rb
|
|
102
|
+
- app/controllers/concerns/foreman_rh_cloud/registration_manager_extensions.rb
|
|
102
103
|
- app/controllers/concerns/insights_cloud/candlepin_cache.rb
|
|
103
104
|
- app/controllers/concerns/insights_cloud/client_authentication.rb
|
|
104
105
|
- app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb
|
|
@@ -262,7 +263,11 @@ files:
|
|
|
262
263
|
- test/factories/inventory_upload_factories.rb
|
|
263
264
|
- test/jobs/cloud_connector_announce_task_test.rb
|
|
264
265
|
- test/jobs/connector_playbook_execution_reporter_task_test.rb
|
|
266
|
+
- test/jobs/create_missing_insights_facets_test.rb
|
|
265
267
|
- test/jobs/exponential_backoff_test.rb
|
|
268
|
+
- test/jobs/generate_host_report_test.rb
|
|
269
|
+
- test/jobs/generate_report_job_test.rb
|
|
270
|
+
- test/jobs/host_inventory_report_job_test.rb
|
|
266
271
|
- test/jobs/insights_client_status_aging_test.rb
|
|
267
272
|
- test/jobs/insights_full_sync_test.rb
|
|
268
273
|
- test/jobs/insights_resolutions_sync_test.rb
|
|
@@ -273,6 +278,7 @@ files:
|
|
|
273
278
|
- test/jobs/inventory_self_host_sync_test.rb
|
|
274
279
|
- test/jobs/queue_for_upload_job_test.rb
|
|
275
280
|
- test/jobs/remove_insights_hosts_job_test.rb
|
|
281
|
+
- test/jobs/single_host_report_job_test.rb
|
|
276
282
|
- test/jobs/upload_report_job_test.rb
|
|
277
283
|
- test/models/insights_client_report_status_test.rb
|
|
278
284
|
- test/test_plugin_helper.rb
|
|
@@ -280,6 +286,7 @@ files:
|
|
|
280
286
|
- test/unit/fact_helpers_test.rb
|
|
281
287
|
- test/unit/foreman_rh_cloud_self_host_test.rb
|
|
282
288
|
- test/unit/insights_facet_test.rb
|
|
289
|
+
- test/unit/lib/foreman_rh_cloud/registration_manager_extensions_test.rb
|
|
283
290
|
- test/unit/lib/insights_cloud/async/vmaas_reposcan_sync_test.rb
|
|
284
291
|
- test/unit/metadata_generator_test.rb
|
|
285
292
|
- test/unit/playbook_progress_generator_test.rb
|
|
@@ -717,7 +724,11 @@ test_files:
|
|
|
717
724
|
- test/factories/inventory_upload_factories.rb
|
|
718
725
|
- test/jobs/cloud_connector_announce_task_test.rb
|
|
719
726
|
- test/jobs/connector_playbook_execution_reporter_task_test.rb
|
|
727
|
+
- test/jobs/create_missing_insights_facets_test.rb
|
|
720
728
|
- test/jobs/exponential_backoff_test.rb
|
|
729
|
+
- test/jobs/generate_host_report_test.rb
|
|
730
|
+
- test/jobs/generate_report_job_test.rb
|
|
731
|
+
- test/jobs/host_inventory_report_job_test.rb
|
|
721
732
|
- test/jobs/insights_client_status_aging_test.rb
|
|
722
733
|
- test/jobs/insights_full_sync_test.rb
|
|
723
734
|
- test/jobs/insights_resolutions_sync_test.rb
|
|
@@ -728,6 +739,7 @@ test_files:
|
|
|
728
739
|
- test/jobs/inventory_self_host_sync_test.rb
|
|
729
740
|
- test/jobs/queue_for_upload_job_test.rb
|
|
730
741
|
- test/jobs/remove_insights_hosts_job_test.rb
|
|
742
|
+
- test/jobs/single_host_report_job_test.rb
|
|
731
743
|
- test/jobs/upload_report_job_test.rb
|
|
732
744
|
- test/models/insights_client_report_status_test.rb
|
|
733
745
|
- test/test_plugin_helper.rb
|
|
@@ -735,6 +747,7 @@ test_files:
|
|
|
735
747
|
- test/unit/fact_helpers_test.rb
|
|
736
748
|
- test/unit/foreman_rh_cloud_self_host_test.rb
|
|
737
749
|
- test/unit/insights_facet_test.rb
|
|
750
|
+
- test/unit/lib/foreman_rh_cloud/registration_manager_extensions_test.rb
|
|
738
751
|
- test/unit/lib/insights_cloud/async/vmaas_reposcan_sync_test.rb
|
|
739
752
|
- test/unit/metadata_generator_test.rb
|
|
740
753
|
- test/unit/playbook_progress_generator_test.rb
|