foreman_rh_cloud 13.0.7 → 13.0.9

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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/foreman_rh_cloud/registration_manager_extensions.rb +39 -0
  3. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +1 -1
  4. data/app/controllers/foreman_inventory_upload/uploads_controller.rb +1 -1
  5. data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +3 -2
  6. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +1 -23
  7. data/lib/foreman_inventory_upload/async/upload_report_direct_job.rb +200 -0
  8. data/lib/foreman_inventory_upload.rb +6 -6
  9. data/lib/foreman_rh_cloud/engine.rb +1 -0
  10. data/lib/foreman_rh_cloud/plugin.rb +4 -0
  11. data/lib/foreman_rh_cloud/version.rb +1 -1
  12. data/lib/inventory_sync/async/inventory_hosts_sync.rb +0 -2
  13. data/lib/tasks/rh_cloud_inventory.rake +11 -1
  14. data/package.json +1 -1
  15. data/test/controllers/accounts_controller_test.rb +1 -1
  16. data/test/controllers/uploads_controller_test.rb +1 -1
  17. data/test/jobs/cloud_connector_announce_task_test.rb +3 -2
  18. data/test/jobs/connector_playbook_execution_reporter_task_test.rb +32 -20
  19. data/test/jobs/create_missing_insights_facets_test.rb +151 -0
  20. data/test/jobs/exponential_backoff_test.rb +9 -8
  21. data/test/jobs/generate_host_report_test.rb +100 -0
  22. data/test/jobs/generate_report_job_test.rb +146 -0
  23. data/test/jobs/host_inventory_report_job_test.rb +244 -0
  24. data/test/jobs/insights_client_status_aging_test.rb +3 -2
  25. data/test/jobs/insights_full_sync_test.rb +13 -7
  26. data/test/jobs/insights_resolutions_sync_test.rb +9 -5
  27. data/test/jobs/insights_rules_sync_test.rb +5 -3
  28. data/test/jobs/inventory_full_sync_test.rb +9 -5
  29. data/test/jobs/inventory_hosts_sync_test.rb +11 -6
  30. data/test/jobs/inventory_scheduled_sync_test.rb +10 -6
  31. data/test/jobs/inventory_self_host_sync_test.rb +1 -1
  32. data/test/jobs/queue_for_upload_job_test.rb +10 -19
  33. data/test/jobs/remove_insights_hosts_job_test.rb +14 -15
  34. data/test/jobs/single_host_report_job_test.rb +155 -0
  35. data/test/jobs/upload_report_direct_job_test.rb +399 -0
  36. data/test/unit/lib/foreman_rh_cloud/registration_manager_extensions_test.rb +192 -0
  37. data/webpack/ForemanColumnExtensions/index.js +2 -0
  38. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +1 -1
  39. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js +4 -5
  40. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +4 -2
  41. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +9 -10
  42. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +4 -1
  43. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +24 -17
  44. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js +178 -8
  45. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +3 -1
  46. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/ToolbarButtons.test.js +69 -51
  47. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettings.js +3 -3
  48. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +3 -9
  49. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js +12 -7
  50. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +2 -2
  51. data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +3 -3
  52. data/webpack/InsightsCloudSync/InsightsCloudSync.js +3 -3
  53. data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +10 -0
  54. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +1 -1
  55. data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +5 -5
  56. data/webpack/InsightsVulnerabilityHostIndexExtensions/CVECountCell.js +2 -2
  57. data/webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js +77 -22
  58. data/webpack/common/Hooks/ConfigHooks.js +3 -16
  59. metadata +17 -8
  60. data/lib/foreman_inventory_upload/async/upload_report_job.rb +0 -97
  61. data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +0 -55
  62. data/test/jobs/upload_report_job_test.rb +0 -37
  63. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +0 -36
  64. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +0 -112
  65. data/webpack/__mocks__/foremanReact/common/hooks/API/APIHooks.js +0 -3
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
- import { render, screen } from '@testing-library/react';
2
+ import { screen } from '@testing-library/react';
3
+ import { rtlHelpers } from 'foremanReact/common/rtlTestHelpers';
3
4
  import { API } from 'foremanReact/redux/API';
4
5
  import { CVECountCell } from '../CVECountCell';
5
- import * as ConfigHooks from '../../common/Hooks/ConfigHooks';
6
6
 
7
7
  jest.mock('foremanReact/redux/API');
8
8
  jest.mock('../../common/Hooks/ConfigHooks');
9
9
 
10
+ const { renderWithStore } = rtlHelpers;
11
+
10
12
  API.get.mockImplementation(async () => ({
11
13
  data: [
12
14
  {
@@ -18,17 +20,13 @@ API.get.mockImplementation(async () => ({
18
20
  }));
19
21
 
20
22
  const hostDetailsMock = {
21
- name: 'test-host.example.com',
22
- subscription_facet_attributes: {
23
- uuid: 'test-uuid-123',
24
- },
25
- };
23
+ name: 'test-host.example.com',
24
+ subscription_facet_attributes: {
25
+ uuid: 'test-uuid-123',
26
+ },
27
+ };
26
28
 
27
29
  describe('CVECountCell', () => {
28
- beforeEach(() => {
29
- ConfigHooks.useAdvisorEngineConfig.mockReturnValue(true);
30
- });
31
-
32
30
  afterEach(() => {
33
31
  jest.clearAllMocks();
34
32
  });
@@ -40,35 +38,92 @@ describe('CVECountCell', () => {
40
38
  uuid: null, // no subscription
41
39
  },
42
40
  };
43
- render(<CVECountCell hostDetails={hostDetailsMockIoP} />);
41
+ renderWithStore(<CVECountCell hostDetails={hostDetailsMockIoP} />, {
42
+ router: {
43
+ location: {
44
+ pathname: '/',
45
+ search: '',
46
+ hash: '',
47
+ query: {},
48
+ },
49
+ },
50
+ API: {
51
+ ADVISOR_ENGINE_CONFIG: {
52
+ response: { use_iop_mode: true },
53
+ status: 'RESOLVED',
54
+ },
55
+ },
56
+ });
44
57
  expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
45
58
  });
46
59
 
47
60
  it('renders UnknownIcon when IoP is not enabled', () => {
48
- ConfigHooks.useAdvisorEngineConfig.mockReturnValue(false);
49
- render(<CVECountCell hostDetails={hostDetailsMock} />);
61
+ renderWithStore(<CVECountCell hostDetails={hostDetailsMock} />, {
62
+ router: {
63
+ location: {
64
+ pathname: '/',
65
+ search: '',
66
+ hash: '',
67
+ query: {},
68
+ },
69
+ },
70
+ API: {
71
+ ADVISOR_ENGINE_CONFIG: {
72
+ response: { use_iop_mode: false },
73
+ status: 'RESOLVED',
74
+ },
75
+ },
76
+ });
50
77
  expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
51
- expect(ConfigHooks.useAdvisorEngineConfig).toHaveBeenCalled();
52
78
  });
53
79
 
54
80
  it('renders UnknownIcon when IoP is enabled but CVE API call fails', () => {
55
- // Mock successful IoP config
56
- ConfigHooks.useAdvisorEngineConfig.mockReturnValue(true);
57
81
  // Mock CVE API failure - override the global mock for this test
58
82
  API.get.mockImplementationOnce(async () => {
59
83
  throw new Error('CVE API call failed');
60
84
  });
61
85
 
62
- render(<CVECountCell hostDetails={hostDetailsMock} />);
86
+ renderWithStore(<CVECountCell hostDetails={hostDetailsMock} />, {
87
+ router: {
88
+ location: {
89
+ pathname: '/',
90
+ search: '',
91
+ hash: '',
92
+ query: {},
93
+ },
94
+ },
95
+ API: {
96
+ ADVISOR_ENGINE_CONFIG: {
97
+ response: { use_iop_mode: true },
98
+ status: 'RESOLVED',
99
+ },
100
+ // Mock the API failure state for the CVE endpoint
101
+ [`HOST_CVE_COUNT_${hostDetailsMock.subscription_facet_attributes.uuid}`]: {
102
+ status: 'ERROR',
103
+ error: 'CVE API call failed',
104
+ },
105
+ },
106
+ });
63
107
  // Should render UnknownIcon when CVE API fails
64
108
  expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
65
- expect(ConfigHooks.useAdvisorEngineConfig).toHaveBeenCalled();
66
109
  });
67
110
 
68
111
  it('renders UnknownIcon when IoP is undefined (API call pending)', () => {
69
- ConfigHooks.useAdvisorEngineConfig.mockReturnValue(undefined);
70
- render(<CVECountCell hostDetails={hostDetailsMock} />);
112
+ renderWithStore(<CVECountCell hostDetails={hostDetailsMock} />, {
113
+ router: {
114
+ location: {
115
+ pathname: '/',
116
+ search: '',
117
+ hash: '',
118
+ query: {},
119
+ },
120
+ },
121
+ API: {
122
+ ADVISOR_ENGINE_CONFIG: {
123
+ status: 'PENDING',
124
+ },
125
+ },
126
+ });
71
127
  expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
72
- expect(ConfigHooks.useAdvisorEngineConfig).toHaveBeenCalled();
73
128
  });
74
129
  });
@@ -1,18 +1,5 @@
1
- import { useAPI } from 'foremanReact/common/hooks/API/APIHooks';
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
- return advisorEngineConfig?.use_iop_mode;
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.7
4
+ version: 13.0.9
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
@@ -195,7 +196,7 @@ files:
195
196
  - lib/foreman_inventory_upload/async/remove_insights_hosts_job.rb
196
197
  - lib/foreman_inventory_upload/async/shell_process.rb
197
198
  - lib/foreman_inventory_upload/async/single_host_report_job.rb
198
- - lib/foreman_inventory_upload/async/upload_report_job.rb
199
+ - lib/foreman_inventory_upload/async/upload_report_direct_job.rb
199
200
  - lib/foreman_inventory_upload/generators/archived_report.rb
200
201
  - lib/foreman_inventory_upload/generators/fact_helpers.rb
201
202
  - lib/foreman_inventory_upload/generators/json_stream.rb
@@ -204,7 +205,6 @@ files:
204
205
  - lib/foreman_inventory_upload/generators/slice.rb
205
206
  - lib/foreman_inventory_upload/generators/tags.rb
206
207
  - lib/foreman_inventory_upload/notifications/manifest_import_success_notification_override.rb
207
- - lib/foreman_inventory_upload/scripts/uploader.sh.erb
208
208
  - lib/foreman_rh_cloud.rb
209
209
  - lib/foreman_rh_cloud/async/exponential_backoff.rb
210
210
  - lib/foreman_rh_cloud/engine.rb
@@ -262,7 +262,11 @@ files:
262
262
  - test/factories/inventory_upload_factories.rb
263
263
  - test/jobs/cloud_connector_announce_task_test.rb
264
264
  - test/jobs/connector_playbook_execution_reporter_task_test.rb
265
+ - test/jobs/create_missing_insights_facets_test.rb
265
266
  - test/jobs/exponential_backoff_test.rb
267
+ - test/jobs/generate_host_report_test.rb
268
+ - test/jobs/generate_report_job_test.rb
269
+ - test/jobs/host_inventory_report_job_test.rb
266
270
  - test/jobs/insights_client_status_aging_test.rb
267
271
  - test/jobs/insights_full_sync_test.rb
268
272
  - test/jobs/insights_resolutions_sync_test.rb
@@ -273,13 +277,15 @@ files:
273
277
  - test/jobs/inventory_self_host_sync_test.rb
274
278
  - test/jobs/queue_for_upload_job_test.rb
275
279
  - test/jobs/remove_insights_hosts_job_test.rb
276
- - test/jobs/upload_report_job_test.rb
280
+ - test/jobs/single_host_report_job_test.rb
281
+ - test/jobs/upload_report_direct_job_test.rb
277
282
  - test/models/insights_client_report_status_test.rb
278
283
  - test/test_plugin_helper.rb
279
284
  - test/unit/archived_report_generator_test.rb
280
285
  - test/unit/fact_helpers_test.rb
281
286
  - test/unit/foreman_rh_cloud_self_host_test.rb
282
287
  - test/unit/insights_facet_test.rb
288
+ - test/unit/lib/foreman_rh_cloud/registration_manager_extensions_test.rb
283
289
  - test/unit/lib/insights_cloud/async/vmaas_reposcan_sync_test.rb
284
290
  - test/unit/metadata_generator_test.rb
285
291
  - test/unit/playbook_progress_generator_test.rb
@@ -436,7 +442,6 @@ files:
436
442
  - webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js
437
443
  - webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js
438
444
  - webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageTitle.test.js
439
- - webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap
440
445
  - webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap
441
446
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorActions.js
442
447
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorButton.js
@@ -581,7 +586,6 @@ files:
581
586
  - webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js
582
587
  - webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableActions.test.js
583
588
  - webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableSelectors.test.js
584
- - webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap
585
589
  - webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableActions.test.js.snap
586
590
  - webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableSelectors.test.js.snap
587
591
  - webpack/InsightsCloudSync/Components/InsightsTable/__tests__/fixtures.js
@@ -641,7 +645,6 @@ files:
641
645
  - webpack/__mocks__/foremanReact/common/I18n.js
642
646
  - webpack/__mocks__/foremanReact/common/MountingService.js
643
647
  - webpack/__mocks__/foremanReact/common/helpers.js
644
- - webpack/__mocks__/foremanReact/common/hooks/API/APIHooks.js
645
648
  - webpack/__mocks__/foremanReact/components/ConfirmModal/index.js
646
649
  - webpack/__mocks__/foremanReact/components/Head.js
647
650
  - webpack/__mocks__/foremanReact/components/Layout/LayoutConstants.js
@@ -717,7 +720,11 @@ test_files:
717
720
  - test/factories/inventory_upload_factories.rb
718
721
  - test/jobs/cloud_connector_announce_task_test.rb
719
722
  - test/jobs/connector_playbook_execution_reporter_task_test.rb
723
+ - test/jobs/create_missing_insights_facets_test.rb
720
724
  - test/jobs/exponential_backoff_test.rb
725
+ - test/jobs/generate_host_report_test.rb
726
+ - test/jobs/generate_report_job_test.rb
727
+ - test/jobs/host_inventory_report_job_test.rb
721
728
  - test/jobs/insights_client_status_aging_test.rb
722
729
  - test/jobs/insights_full_sync_test.rb
723
730
  - test/jobs/insights_resolutions_sync_test.rb
@@ -728,13 +735,15 @@ test_files:
728
735
  - test/jobs/inventory_self_host_sync_test.rb
729
736
  - test/jobs/queue_for_upload_job_test.rb
730
737
  - test/jobs/remove_insights_hosts_job_test.rb
731
- - test/jobs/upload_report_job_test.rb
738
+ - test/jobs/single_host_report_job_test.rb
739
+ - test/jobs/upload_report_direct_job_test.rb
732
740
  - test/models/insights_client_report_status_test.rb
733
741
  - test/test_plugin_helper.rb
734
742
  - test/unit/archived_report_generator_test.rb
735
743
  - test/unit/fact_helpers_test.rb
736
744
  - test/unit/foreman_rh_cloud_self_host_test.rb
737
745
  - test/unit/insights_facet_test.rb
746
+ - test/unit/lib/foreman_rh_cloud/registration_manager_extensions_test.rb
738
747
  - test/unit/lib/insights_cloud/async/vmaas_reposcan_sync_test.rb
739
748
  - test/unit/metadata_generator_test.rb
740
749
  - test/unit/playbook_progress_generator_test.rb
@@ -1,97 +0,0 @@
1
- require 'tempfile'
2
-
3
- module ForemanInventoryUpload
4
- module Async
5
- class UploadReportJob < ShellProcess
6
- def self.output_label(label)
7
- "upload_for_#{label}"
8
- end
9
-
10
- def plan(filename, organization_id)
11
- label = UploadReportJob.output_label(organization_id)
12
- super(label, filename: filename, organization_id: organization_id)
13
- end
14
-
15
- def try_execute
16
- if content_disconnected?
17
- progress_output do |progress_output|
18
- progress_output.write_line("Report was not moved and upload was canceled because connection to Insights is not enabled. Report location: #{filename}.")
19
- progress_output.status = "Task aborted, exit 1"
20
- done!
21
- end
22
- return
23
- end
24
-
25
- unless organization.owner_details&.fetch('upstreamConsumer')&.fetch('idCert')
26
- logger.info("Skipping organization '#{organization}', no candlepin certificate defined.")
27
- progress_output do |progress_output|
28
- progress_output.write_line("Skipping organization #{organization}, no candlepin certificate defined.")
29
- progress_output.status = "Task aborted, exit 1"
30
- done!
31
- end
32
- return
33
- end
34
-
35
- Tempfile.create([organization.name, '.pem']) do |cer_file|
36
- cer_file.write(certificate[:cert])
37
- cer_file.write(certificate[:key])
38
- cer_file.flush
39
- @cer_path = cer_file.path
40
- super
41
- end
42
- end
43
-
44
- def command
45
- ['/bin/bash', File.join(File.dirname(filename), ForemanInventoryUpload.upload_script_file)]
46
- end
47
-
48
- def env
49
- env_vars = super.merge(
50
- 'FILES' => filename,
51
- 'CER_PATH' => @cer_path,
52
- 'ORG_ID' => organization.label
53
- )
54
-
55
- http_proxy_string = ForemanRhCloud.http_proxy_string
56
- if http_proxy_string
57
- env_vars['http_proxy'] = http_proxy_string
58
- env_vars['https_proxy'] = http_proxy_string
59
- end
60
- env_vars
61
- end
62
-
63
- def certificate
64
- ForemanRhCloud.with_iop_smart_proxy? ? foreman_certificate : manifest_certificate
65
- end
66
-
67
- def manifest_certificate
68
- @manifest_certificate ||= begin
69
- candlepin_id_certificate = organization.owner_details['upstreamConsumer']['idCert']
70
- {
71
- cert: candlepin_id_certificate['cert'],
72
- key: candlepin_id_certificate['key'],
73
- }
74
- end
75
- end
76
-
77
- def foreman_certificate
78
- @foreman_certificate ||= {
79
- cert: File.read(Setting[:ssl_certificate]),
80
- key: File.read(Setting[:ssl_priv_key]),
81
- }
82
- end
83
-
84
- def filename
85
- input[:filename]
86
- end
87
-
88
- def organization
89
- @organization ||= Organization.find(input[:organization_id])
90
- end
91
-
92
- def content_disconnected?
93
- !Setting[:subscription_connection_enabled]
94
- end
95
- end
96
- end
97
- end
@@ -1,55 +0,0 @@
1
- #! /bin/bash
2
-
3
- DEST=<%= @upload_url %>
4
- RH_USERNAME=<%= @rh_username %>
5
-
6
- if [ -z "$FILES" ]
7
- then
8
- FILES=./*.tar.gz
9
- fi
10
-
11
- if [ -n "$CER_PATH" ]
12
- then
13
- AUTH_KEY="--cert"
14
- AUTH_VAL="$CER_PATH"
15
- else
16
- if [ -z "$RH_USERNAME" ]
17
- then
18
- IFS= read -rp "Enter username: " RH_USERNAME
19
- fi
20
-
21
- if [ -z "$RH_PASSWORD" ]
22
- then
23
- IFS= read -rsp "Enter password: " RH_PASSWORD
24
- fi
25
-
26
- AUTH_KEY="-u"
27
- AUTH_VAL="\"$RH_USERNAME\":\"$RH_PASSWORD\""
28
- fi
29
-
30
- ORG_HEADER=()
31
- if [ -n "$ORG_ID" ]
32
- then
33
- ORG_HEADER=("-H" "X-Org-Id: $ORG_ID")
34
- fi
35
-
36
- # /tmp/a b/x.pem
37
- # curl --cert /tmp/a\ b/x.pem
38
-
39
- SCRIPT_DIR=$(realpath "$(dirname "${BASH_SOURCE:-0}")")
40
- DONE_DIR="$SCRIPT_DIR/done/"
41
- mkdir -p $DONE_DIR
42
-
43
- for f in $FILES
44
- do
45
- curl -k -vvv -# --fail -F "file=@$f;type=application/vnd.redhat.qpc.tar+tgz" $DEST "$AUTH_KEY" "$AUTH_VAL" "${ORG_HEADER[@]}"
46
- status=$?
47
- if [ $status -eq 0 ]; then
48
- mv $f $DONE_DIR
49
- echo "Done: $f"
50
- fi
51
- done
52
- echo "Uploaded files moved to done/ folder"
53
-
54
- # return the error code from the curl command
55
- exit $status
@@ -1,37 +0,0 @@
1
- require 'test_plugin_helper'
2
- require 'foreman_tasks/test_helpers'
3
-
4
- class UploadReportJobTest < ActiveSupport::TestCase
5
- include ForemanTasks::TestHelpers::WithInThreadExecutor
6
- include FolderIsolation
7
-
8
- test 'returns aborted state when disconnected' do
9
- organization = FactoryBot.create(:organization)
10
- Organization.any_instance.stubs(:owner_details).returns(
11
- 'upstreamConsumer' => {
12
- 'idCert' => 'TEST_CERT',
13
- }
14
- )
15
- ForemanInventoryUpload::Async::UploadReportJob.any_instance.expects(:content_disconnected?).returns(true)
16
-
17
- ForemanTasks.sync_task(ForemanInventoryUpload::Async::UploadReportJob, '', organization.id)
18
-
19
- label = ForemanInventoryUpload::Async::UploadReportJob.output_label(organization.id)
20
- progress_output = ForemanInventoryUpload::Async::ProgressOutput.get(label)
21
- assert_match(/upload was canceled because connection to Insights is not enabled/, progress_output.full_output)
22
- assert_match(/Report location:/, progress_output.full_output)
23
- assert_match(/exit 1/, progress_output.status)
24
- end
25
-
26
- test 'returns aborted state when no certificate defined on organization' do
27
- organization = FactoryBot.create(:organization)
28
- Organization.any_instance.expects(:owner_details).returns(nil)
29
-
30
- ForemanTasks.sync_task(ForemanInventoryUpload::Async::UploadReportJob, '', organization.id)
31
-
32
- label = ForemanInventoryUpload::Async::UploadReportJob.output_label(organization.id)
33
- progress_output = ForemanInventoryUpload::Async::ProgressOutput.get(label)
34
- assert_match(/Skipping organization/, progress_output.full_output)
35
- assert_match(/exit 1/, progress_output.status)
36
- end
37
- end
@@ -1,36 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`PageHeader rendering render without Props 1`] = `
4
- <div
5
- className="inventory-upload-header"
6
- >
7
- <ConnectedSettingsWarning />
8
- <PageTitle />
9
- <div
10
- className="inventory-upload-header-description"
11
- >
12
- <ConnectedInventorySettings />
13
- <PageDescription />
14
- </div>
15
- <Row
16
- bsClass="row"
17
- componentClass="div"
18
- >
19
- <Col
20
- bsClass="col"
21
- componentClass="div"
22
- xs={4}
23
- >
24
- <Connect(InventoryFilter) />
25
- </Col>
26
- <Col
27
- bsClass="col"
28
- componentClass="div"
29
- xs={7}
30
- xsOffset={1}
31
- >
32
- <ToolbarButtons />
33
- </Col>
34
- </Row>
35
- </div>
36
- `;
@@ -1,112 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`InsightsTable rendering render with Props 1`] = `
4
- <Fragment>
5
- <SelectAllAlert
6
- clearAllSelection={[Function]}
7
- isAllSelected={false}
8
- selectAll={[Function]}
9
- selectedIds={Object {}}
10
- showSelectAllAlert={false}
11
- />
12
- <Table
13
- actionsMenuAppendTo="inline"
14
- aria-label="Recommendations Table"
15
- borders={true}
16
- canCollapseAll={false}
17
- canSelectAll={false}
18
- canSortFavorites={true}
19
- cells={
20
- Array [
21
- Object {
22
- "id": "hostname",
23
- "sortKey": "hostname",
24
- "title": "Hostname",
25
- "transforms": Array [
26
- [Function],
27
- [Function],
28
- ],
29
- },
30
- Object {
31
- "id": "recommendation",
32
- "sortKey": "title",
33
- "title": "Recommendation",
34
- "transforms": Array [
35
- [Function],
36
- [Function],
37
- ],
38
- },
39
- Object {
40
- "cellTransforms": Array [
41
- [Function],
42
- ],
43
- "id": "total risk",
44
- "sortKey": "total_risk",
45
- "title": "Total risk",
46
- "transforms": Array [
47
- [Function],
48
- [Function],
49
- ],
50
- },
51
- Object {
52
- "cellTransforms": Array [
53
- [Function],
54
- ],
55
- "id": "remediate",
56
- "title": "Remediate",
57
- "transforms": Array [
58
- [Function],
59
- ],
60
- },
61
- Object {
62
- "cellTransforms": Array [
63
- [Function],
64
- ],
65
- "id": "actions",
66
- "title": "",
67
- "transforms": Array [
68
- [Function],
69
- ],
70
- },
71
- ]
72
- }
73
- className="rh-cloud-recommendations-table"
74
- collapseAllAriaLabel=""
75
- contentId="expanded-content"
76
- dropdownDirection="down"
77
- dropdownPosition="right"
78
- expandId="expandable-toggle"
79
- gridBreakPoint="grid-md"
80
- isHeaderSelectDisabled={false}
81
- isNested={false}
82
- isStickyHeader={false}
83
- isTreeTable={false}
84
- onSelect={[Function]}
85
- onSort={[Function]}
86
- ouiaId="rh-cloud-recommendations-table"
87
- ouiaSafe={true}
88
- role="grid"
89
- rowLabeledBy="simple-node"
90
- rows={Array []}
91
- selectVariant="checkbox"
92
- sortBy={
93
- Object {
94
- "direction": "desc",
95
- "index": 3,
96
- }
97
- }
98
- variant="compact"
99
- >
100
- <TableHeader />
101
- <TableBody />
102
- </Table>
103
- <TableEmptyState
104
- error={null}
105
- rowsLength={0}
106
- status="RESOLVED"
107
- />
108
- <Pagination
109
- variant="bottom"
110
- />
111
- </Fragment>
112
- `;
@@ -1,3 +0,0 @@
1
- export const useAPI = jest.fn(() => ({
2
- response: {},
3
- }));