foreman_rh_cloud 3.0.26 → 4.0.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/foreman_inventory_upload/reports_controller.rb +1 -3
- data/app/controllers/foreman_inventory_upload/tasks_controller.rb +13 -5
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +4 -4
- data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +3 -6
- data/app/controllers/insights_cloud/hits_controller.rb +3 -7
- data/app/models/insights_client_report_status.rb +22 -11
- data/app/services/foreman_rh_cloud/cloud_auth.rb +0 -16
- data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +14 -11
- data/app/services/foreman_rh_cloud/remediations_retriever.rb +4 -6
- data/app/subscribers/foreman_rh_cloud/insights_subscriber.rb +9 -0
- data/config/Gemfile.lock.gh_test +95 -93
- data/config/routes.rb +1 -20
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +0 -19
- data/lib/foreman_inventory_upload/generators/queries.rb +0 -1
- data/lib/foreman_inventory_upload/generators/slice.rb +5 -6
- data/lib/foreman_inventory_upload/generators/tags.rb +1 -3
- data/lib/foreman_inventory_upload.rb +1 -9
- data/lib/foreman_rh_cloud/engine.rb +10 -17
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/insights_cloud/async/insights_full_sync.rb +14 -9
- data/lib/insights_cloud/async/insights_resolutions_sync.rb +6 -13
- data/lib/insights_cloud/async/insights_rules_sync.rb +9 -13
- data/lib/inventory_sync/async/host_result.rb +0 -4
- data/lib/inventory_sync/async/inventory_full_sync.rb +1 -7
- data/lib/inventory_sync/async/inventory_hosts_sync.rb +2 -21
- data/lib/inventory_sync/async/inventory_scheduled_sync.rb +0 -12
- data/lib/inventory_sync/async/query_inventory_job.rb +5 -6
- data/lib/tasks/insights.rake +0 -15
- data/lib/tasks/rh_cloud_inventory.rake +1 -8
- data/package.json +1 -1
- data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +0 -41
- data/test/factories/inventory_upload_factories.rb +1 -1
- data/test/jobs/insights_full_sync_test.rb +0 -1
- data/test/jobs/insights_resolutions_sync_test.rb +1 -11
- data/test/jobs/insights_rules_sync_test.rb +0 -1
- data/test/jobs/inventory_full_sync_test.rb +0 -10
- data/test/models/insights_client_report_status_test.rb +72 -70
- data/test/test_plugin_helper.rb +0 -2
- data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +3 -4
- data/test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb +0 -1
- data/test/unit/slice_generator_test.rb +27 -70
- data/test/unit/tags_generator_test.rb +0 -41
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +0 -11
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap +0 -11
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +63 -28
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +3 -2
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js +19 -19
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableActions.test.js.snap +14 -14
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js +0 -1
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.scss +0 -14
- data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap +13 -20
- data/webpack/InsightsCloudSync/InsightsCloudSync.js +1 -4
- data/webpack/InsightsCloudSync/InsightsCloudSyncActions.js +20 -44
- data/webpack/InsightsCloudSync/InsightsCloudSyncConstants.js +0 -2
- data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +2 -2
- data/webpack/InsightsCloudSync/__tests__/__snapshots__/InsightsCloudSyncActions.test.js.snap +7 -11
- metadata +4 -30
- data/app/controllers/api/v2/rh_cloud/inventory_controller.rb +0 -50
- data/app/controllers/concerns/inventory_upload/report_actions.rb +0 -26
- data/app/controllers/concerns/inventory_upload/task_actions.rb +0 -25
- data/app/helpers/foreman_insights_deprecations_helper.rb +0 -9
- data/app/helpers/foreman_insights_host_helper.rb +0 -19
- data/app/overrides/old_plugin_deprecation.rb +0 -20
- data/app/services/foreman_rh_cloud/cloud_request.rb +0 -14
- data/app/services/foreman_rh_cloud/insights_status_cleaner.rb +0 -17
- data/config/package-lock.json.plugin +0 -32774
- data/db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb +0 -6
- data/lib/insights_cloud/async/insights_client_status_aging.rb +0 -23
- data/lib/inventory_sync/async/inventory_self_host_sync.rb +0 -39
- data/test/controllers/inventory_upload/api/inventory_controller_test.rb +0 -53
- data/test/jobs/insights_client_status_aging_test.rb +0 -33
- data/test/jobs/inventory_hosts_sync_test.rb +0 -268
- data/test/jobs/inventory_scheduled_sync_test.rb +0 -22
- data/test/jobs/inventory_self_host_sync_test.rb +0 -104
- data/test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb +0 -31
- data/webpack/common/ForemanTasks/ForemanTasksActions.js +0 -64
- data/webpack/common/ForemanTasks/ForemanTasksHelpers.js +0 -7
- data/webpack/common/ForemanTasks/index.js +0 -1
data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap
CHANGED
@@ -190,28 +190,21 @@ exports[`NoTokenEmptyState render 1`] = `
|
|
190
190
|
onClick={[Function]}
|
191
191
|
variant="primary"
|
192
192
|
>
|
193
|
-
<
|
194
|
-
|
195
|
-
|
193
|
+
<button
|
194
|
+
aria-disabled={true}
|
195
|
+
aria-label={null}
|
196
|
+
className="pf-c-button pf-m-primary pf-m-disabled"
|
197
|
+
data-ouia-component-id="OUIA-Generated-Button-primary-1"
|
198
|
+
data-ouia-component-type="PF4/Button"
|
199
|
+
data-ouia-safe={true}
|
200
|
+
disabled={true}
|
196
201
|
onClick={[Function]}
|
197
|
-
|
202
|
+
role={null}
|
203
|
+
tabIndex={null}
|
204
|
+
type="button"
|
198
205
|
>
|
199
|
-
|
200
|
-
|
201
|
-
aria-label={null}
|
202
|
-
className="pf-c-button pf-m-primary pf-m-disabled"
|
203
|
-
data-ouia-component-id="OUIA-Generated-Button-primary-1"
|
204
|
-
data-ouia-component-type="PF4/Button"
|
205
|
-
data-ouia-safe={true}
|
206
|
-
disabled={true}
|
207
|
-
onClick={[Function]}
|
208
|
-
role={null}
|
209
|
-
tabIndex={null}
|
210
|
-
type="button"
|
211
|
-
>
|
212
|
-
Save setting and sync recommendations
|
213
|
-
</button>
|
214
|
-
</ButtonBase>
|
206
|
+
Save setting and sync recommendations
|
207
|
+
</button>
|
215
208
|
</Button>
|
216
209
|
</div>
|
217
210
|
</div>
|
@@ -36,10 +36,7 @@ const InsightsCloudSync = ({
|
|
36
36
|
toolbarButtons={
|
37
37
|
<>
|
38
38
|
<RemediationModal />
|
39
|
-
<Button
|
40
|
-
variant="secondary"
|
41
|
-
onClick={() => syncInsights(fetchInsights, query)}
|
42
|
-
>
|
39
|
+
<Button variant="secondary" onClick={syncInsights}>
|
43
40
|
{__('Start recommendations sync')}
|
44
41
|
</Button>
|
45
42
|
</>
|
@@ -1,49 +1,25 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
import { post } from 'foremanReact/redux/API';
|
2
3
|
import { translate as __ } from 'foremanReact/common/I18n';
|
3
4
|
import { insightsCloudUrl } from './InsightsCloudSyncHelpers';
|
4
|
-
import {
|
5
|
-
|
6
|
-
INSIGHTS_CLOUD_SYNC_TASK,
|
7
|
-
} from './InsightsCloudSyncConstants';
|
8
|
-
import { setupTaskPolling, taskRelatedToast } from '../common/ForemanTasks';
|
5
|
+
import { INSIGHTS_CLOUD_SYNC } from './InsightsCloudSyncConstants';
|
6
|
+
import { foremanUrl } from '../ForemanRhCloudHelpers';
|
9
7
|
|
10
|
-
export const syncInsights = (
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
const syncInsightsError = error =>
|
28
|
-
`${__('Recommendation sync has failed: ')} ${error}`;
|
29
|
-
|
30
|
-
const syncInsightsStartedToast = taskId =>
|
31
|
-
taskRelatedToast(taskId, 'info', __('Recommendation sync has started: '));
|
32
|
-
|
33
|
-
const setupInsightsTaskPolling = (taskId, fetchInsights, query, dispatch) =>
|
34
|
-
setupTaskPolling({
|
35
|
-
taskId,
|
36
|
-
key: INSIGHTS_CLOUD_SYNC_TASK,
|
37
|
-
onTaskSuccess: () => {
|
38
|
-
fetchInsights({ query, page: 1 });
|
39
|
-
dispatch(
|
40
|
-
taskRelatedToast(
|
41
|
-
taskId,
|
42
|
-
'success',
|
43
|
-
__('Recommendations synced successfully')
|
44
|
-
)
|
45
|
-
);
|
46
|
-
},
|
47
|
-
taskErrorMessage: data => syncInsightsError(data.humanized.errors),
|
48
|
-
dispatch,
|
8
|
+
export const syncInsights = () =>
|
9
|
+
post({
|
10
|
+
key: INSIGHTS_CLOUD_SYNC,
|
11
|
+
url: insightsCloudUrl('tasks'),
|
12
|
+
successToast: response => (
|
13
|
+
<span>
|
14
|
+
{__('Recommendation sync has started: ')}
|
15
|
+
<a
|
16
|
+
target="_blank"
|
17
|
+
rel="noopener noreferrer"
|
18
|
+
href={foremanUrl(`/foreman_tasks/tasks/${response.data?.task?.id}`)}
|
19
|
+
>
|
20
|
+
{__('view the task in progress')}
|
21
|
+
</a>
|
22
|
+
</span>
|
23
|
+
),
|
24
|
+
errorToast: error => `${__('Recommendation sync has failed: ')} ${error}`,
|
49
25
|
});
|
@@ -4,8 +4,6 @@ import { foremanUrl } from '../ForemanRhCloudHelpers';
|
|
4
4
|
|
5
5
|
export const INSIGHTS_CLOUD_SYNC = 'INSIGHTS_CLOUD_SYNC';
|
6
6
|
|
7
|
-
export const INSIGHTS_CLOUD_SYNC_TASK = 'INSIGHTS_CLOUD_SYNC_TASK';
|
8
|
-
|
9
7
|
export const INSIGHTS_SYNC_PAGE_TITLE = __('Red Hat Insights');
|
10
8
|
|
11
9
|
export const INSIGHTS_PATH = foremanUrl('/foreman_rh_cloud/insights_cloud');
|
@@ -29,12 +29,12 @@ exports[`InsightsCloudSync render 1`] = `
|
|
29
29
|
toolbarButtons={
|
30
30
|
<React.Fragment>
|
31
31
|
<UNDEFINED />
|
32
|
-
<
|
32
|
+
<Button
|
33
33
|
onClick={[Function]}
|
34
34
|
variant="secondary"
|
35
35
|
>
|
36
36
|
Start recommendations sync
|
37
|
-
</
|
37
|
+
</Button>
|
38
38
|
</React.Fragment>
|
39
39
|
}
|
40
40
|
>
|
data/webpack/InsightsCloudSync/__tests__/__snapshots__/InsightsCloudSyncActions.test.js.snap
CHANGED
@@ -1,15 +1,11 @@
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
2
|
|
3
3
|
exports[`Insights cloud sync actions should syncInsights 1`] = `
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
"url": "/insights_cloud/tasks",
|
12
|
-
},
|
13
|
-
],
|
14
|
-
]
|
4
|
+
Object {
|
5
|
+
"errorToast": [Function],
|
6
|
+
"key": "INSIGHTS_CLOUD_SYNC",
|
7
|
+
"successToast": [Function],
|
8
|
+
"type": "post-some-type",
|
9
|
+
"url": "/insights_cloud/tasks",
|
10
|
+
}
|
15
11
|
`;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_rh_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.21.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katello
|
@@ -146,11 +146,8 @@ files:
|
|
146
146
|
- LICENSE
|
147
147
|
- README.md
|
148
148
|
- Rakefile
|
149
|
-
- app/controllers/api/v2/rh_cloud/inventory_controller.rb
|
150
149
|
- app/controllers/concerns/insights_cloud/candlepin_cache.rb
|
151
150
|
- app/controllers/concerns/insights_cloud/client_authentication.rb
|
152
|
-
- app/controllers/concerns/inventory_upload/report_actions.rb
|
153
|
-
- app/controllers/concerns/inventory_upload/task_actions.rb
|
154
151
|
- app/controllers/foreman_inventory_upload/accounts_controller.rb
|
155
152
|
- app/controllers/foreman_inventory_upload/reports_controller.rb
|
156
153
|
- app/controllers/foreman_inventory_upload/tasks_controller.rb
|
@@ -160,8 +157,6 @@ files:
|
|
160
157
|
- app/controllers/insights_cloud/hits_controller.rb
|
161
158
|
- app/controllers/insights_cloud/settings_controller.rb
|
162
159
|
- app/controllers/insights_cloud/tasks_controller.rb
|
163
|
-
- app/helpers/foreman_insights_deprecations_helper.rb
|
164
|
-
- app/helpers/foreman_insights_host_helper.rb
|
165
160
|
- app/helpers/foreman_inventory_upload_helper.rb
|
166
161
|
- app/helpers/foreman_inventory_upload_host_helper.rb
|
167
162
|
- app/models/concerns/rh_cloud_host.rb
|
@@ -174,22 +169,19 @@ files:
|
|
174
169
|
- app/models/setting/rh_cloud.rb
|
175
170
|
- app/overrides/hosts_list.rb
|
176
171
|
- app/overrides/layouts/base/styles.html.erb.deface
|
177
|
-
- app/overrides/old_plugin_deprecation.rb
|
178
172
|
- app/services/foreman_rh_cloud/branch_info.rb
|
179
173
|
- app/services/foreman_rh_cloud/cloud_auth.rb
|
180
174
|
- app/services/foreman_rh_cloud/cloud_connector.rb
|
181
|
-
- app/services/foreman_rh_cloud/cloud_request.rb
|
182
175
|
- app/services/foreman_rh_cloud/cloud_request_forwarder.rb
|
183
|
-
- app/services/foreman_rh_cloud/insights_status_cleaner.rb
|
184
176
|
- app/services/foreman_rh_cloud/remediations_retriever.rb
|
185
177
|
- app/services/foreman_rh_cloud/template_renderer_helper.rb
|
178
|
+
- app/subscribers/foreman_rh_cloud/insights_subscriber.rb
|
186
179
|
- app/views/hosts/_insights_tab.html.erb
|
187
180
|
- app/views/job_templates/rh_cloud_remediations.erb
|
188
181
|
- app/views/layouts/foreman_rh_cloud/application.html.erb
|
189
182
|
- config/Gemfile.lock.gh_test
|
190
183
|
- config/database.yml.example
|
191
184
|
- config/package-lock.json.gh_test
|
192
|
-
- config/package-lock.json.plugin
|
193
185
|
- config/routes.rb
|
194
186
|
- db/migrate/20191215104806_create_insights_hits.foreman_inventory_upload.rb
|
195
187
|
- db/migrate/20191216062008_create_insights_facets.foreman_inventory_upload.rb
|
@@ -200,7 +192,6 @@ files:
|
|
200
192
|
- db/migrate/20210214000002_add_rule_id_to_hits.foreman_rh_cloud.rb
|
201
193
|
- db/migrate/20210307000001_add_unique_to_insights_facet.foreman_rh_cloud.rb
|
202
194
|
- db/migrate/20210404000001_change_resolutions.foreman_rh_cloud.rb
|
203
|
-
- db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb
|
204
195
|
- db/seeds.d/179_ui_notifications.rb
|
205
196
|
- db/seeds.d/50_job_templates.rb
|
206
197
|
- lib/foreman_inventory_upload.rb
|
@@ -224,7 +215,6 @@ files:
|
|
224
215
|
- lib/foreman_rh_cloud/engine.rb
|
225
216
|
- lib/foreman_rh_cloud/version.rb
|
226
217
|
- lib/insights_cloud.rb
|
227
|
-
- lib/insights_cloud/async/insights_client_status_aging.rb
|
228
218
|
- lib/insights_cloud/async/insights_full_sync.rb
|
229
219
|
- lib/insights_cloud/async/insights_generate_notifications.rb
|
230
220
|
- lib/insights_cloud/async/insights_resolutions_sync.rb
|
@@ -235,7 +225,6 @@ files:
|
|
235
225
|
- lib/inventory_sync/async/inventory_full_sync.rb
|
236
226
|
- lib/inventory_sync/async/inventory_hosts_sync.rb
|
237
227
|
- lib/inventory_sync/async/inventory_scheduled_sync.rb
|
238
|
-
- lib/inventory_sync/async/inventory_self_host_sync.rb
|
239
228
|
- lib/inventory_sync/async/query_inventory_job.rb
|
240
229
|
- lib/tasks/foreman_rh_cloud_tasks.rake
|
241
230
|
- lib/tasks/insights.rake
|
@@ -248,20 +237,15 @@ files:
|
|
248
237
|
- test/controllers/accounts_controller_test.rb
|
249
238
|
- test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
|
250
239
|
- test/controllers/insights_sync/settings_controller_test.rb
|
251
|
-
- test/controllers/inventory_upload/api/inventory_controller_test.rb
|
252
240
|
- test/controllers/reports_controller_test.rb
|
253
241
|
- test/controllers/uploads_controller_test.rb
|
254
242
|
- test/controllers/uploads_settings_controller_test.rb
|
255
243
|
- test/factories/insights_factories.rb
|
256
244
|
- test/factories/inventory_upload_factories.rb
|
257
|
-
- test/jobs/insights_client_status_aging_test.rb
|
258
245
|
- test/jobs/insights_full_sync_test.rb
|
259
246
|
- test/jobs/insights_resolutions_sync_test.rb
|
260
247
|
- test/jobs/insights_rules_sync_test.rb
|
261
248
|
- test/jobs/inventory_full_sync_test.rb
|
262
|
-
- test/jobs/inventory_hosts_sync_test.rb
|
263
|
-
- test/jobs/inventory_scheduled_sync_test.rb
|
264
|
-
- test/jobs/inventory_self_host_sync_test.rb
|
265
249
|
- test/jobs/upload_report_job_test.rb
|
266
250
|
- test/models/insights_client_report_status_test.rb
|
267
251
|
- test/test_plugin_helper.rb
|
@@ -272,7 +256,6 @@ files:
|
|
272
256
|
- test/unit/rh_cloud_http_proxy_test.rb
|
273
257
|
- test/unit/services/foreman_rh_cloud/branch_info_test.rb
|
274
258
|
- test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb
|
275
|
-
- test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb
|
276
259
|
- test/unit/services/foreman_rh_cloud/remediations_retriever_test.rb
|
277
260
|
- test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
|
278
261
|
- test/unit/shell_process_job_test.rb
|
@@ -637,9 +620,6 @@ files:
|
|
637
620
|
- webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap
|
638
621
|
- webpack/__tests__/__snapshots__/ForemanRhCloudSelectors.test.js.snap
|
639
622
|
- webpack/__tests__/__snapshots__/ForemanRhCloudTestHelpers.test.js.snap
|
640
|
-
- webpack/common/ForemanTasks/ForemanTasksActions.js
|
641
|
-
- webpack/common/ForemanTasks/ForemanTasksHelpers.js
|
642
|
-
- webpack/common/ForemanTasks/index.js
|
643
623
|
- webpack/common/Switcher/HelpLabel.js
|
644
624
|
- webpack/common/Switcher/SwitcherPF4.js
|
645
625
|
- webpack/common/Switcher/SwitcherPF4.scss
|
@@ -671,7 +651,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
671
651
|
- !ruby/object:Gem::Version
|
672
652
|
version: '0'
|
673
653
|
requirements: []
|
674
|
-
rubygems_version: 3.2.
|
654
|
+
rubygems_version: 3.2.3
|
675
655
|
signing_key:
|
676
656
|
specification_version: 4
|
677
657
|
summary: Summary of ForemanRhCloud.
|
@@ -679,20 +659,15 @@ test_files:
|
|
679
659
|
- test/controllers/accounts_controller_test.rb
|
680
660
|
- test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
|
681
661
|
- test/controllers/insights_sync/settings_controller_test.rb
|
682
|
-
- test/controllers/inventory_upload/api/inventory_controller_test.rb
|
683
662
|
- test/controllers/reports_controller_test.rb
|
684
663
|
- test/controllers/uploads_controller_test.rb
|
685
664
|
- test/controllers/uploads_settings_controller_test.rb
|
686
665
|
- test/factories/insights_factories.rb
|
687
666
|
- test/factories/inventory_upload_factories.rb
|
688
|
-
- test/jobs/insights_client_status_aging_test.rb
|
689
667
|
- test/jobs/insights_full_sync_test.rb
|
690
668
|
- test/jobs/insights_resolutions_sync_test.rb
|
691
669
|
- test/jobs/insights_rules_sync_test.rb
|
692
670
|
- test/jobs/inventory_full_sync_test.rb
|
693
|
-
- test/jobs/inventory_hosts_sync_test.rb
|
694
|
-
- test/jobs/inventory_scheduled_sync_test.rb
|
695
|
-
- test/jobs/inventory_self_host_sync_test.rb
|
696
671
|
- test/jobs/upload_report_job_test.rb
|
697
672
|
- test/models/insights_client_report_status_test.rb
|
698
673
|
- test/test_plugin_helper.rb
|
@@ -703,7 +678,6 @@ test_files:
|
|
703
678
|
- test/unit/rh_cloud_http_proxy_test.rb
|
704
679
|
- test/unit/services/foreman_rh_cloud/branch_info_test.rb
|
705
680
|
- test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb
|
706
|
-
- test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb
|
707
681
|
- test/unit/services/foreman_rh_cloud/remediations_retriever_test.rb
|
708
682
|
- test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
|
709
683
|
- test/unit/shell_process_job_test.rb
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module Api
|
2
|
-
module V2
|
3
|
-
module RhCloud
|
4
|
-
class InventoryController < ::Api::V2::BaseController
|
5
|
-
include ::Api::Version2
|
6
|
-
include InventoryUpload::ReportActions
|
7
|
-
include InventoryUpload::TaskActions
|
8
|
-
|
9
|
-
api :GET, "/organizations/:organization_id/rh_cloud/report", N_("Download latest report")
|
10
|
-
def download_file
|
11
|
-
filename, file = report_file(params[:organization_id])
|
12
|
-
|
13
|
-
send_file file, disposition: 'attachment', filename: filename
|
14
|
-
rescue InventoryUpload::ReportActions::ReportMissingError => error
|
15
|
-
render json: { message: error.message }, status: :not_found
|
16
|
-
end
|
17
|
-
|
18
|
-
api :POST, "/organizations/:organization_id/rh_cloud/report", N_("Start report generation")
|
19
|
-
def generate_report
|
20
|
-
organization_id = params[:organization_id]
|
21
|
-
|
22
|
-
start_report_generation(organization_id)
|
23
|
-
|
24
|
-
render json: {
|
25
|
-
action_status: 'success',
|
26
|
-
}, status: :ok
|
27
|
-
end
|
28
|
-
|
29
|
-
api :POST, "/organizations/:organization_id/rh_cloud/inventory_sync", N_("Start inventory synchronization")
|
30
|
-
def sync_inventory_status
|
31
|
-
selected_org = Organization.find(params[:organization_id])
|
32
|
-
|
33
|
-
task = start_inventory_sync(selected_org)
|
34
|
-
|
35
|
-
render json: {
|
36
|
-
task: task,
|
37
|
-
}, status: :ok
|
38
|
-
rescue InventoryUpload::TaskActions::NothingToSyncError => error
|
39
|
-
render json: { message: error.message }, status: :bad_request
|
40
|
-
end
|
41
|
-
|
42
|
-
api :POST, "rh_cloud/enable_connector", N_("Enable cloud connector")
|
43
|
-
def enable_cloud_connector
|
44
|
-
cloud_connector = ForemanRhCloud::CloudConnector.new
|
45
|
-
render json: cloud_connector.install.to_json
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module InventoryUpload
|
2
|
-
module ReportActions
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
class ReportMissingError < Foreman::Exception
|
6
|
-
MESSAGE = N_("The report file %{filename} doesn't exist")
|
7
|
-
|
8
|
-
def initialize(**params)
|
9
|
-
super(self.class::MESSAGE % params, params)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def start_report_generation(organization_id)
|
14
|
-
ForemanInventoryUpload::Async::GenerateReportJob.perform_later(ForemanInventoryUpload.generated_reports_folder, organization_id)
|
15
|
-
end
|
16
|
-
|
17
|
-
def report_file(organization_id)
|
18
|
-
filename = ForemanInventoryUpload.facts_archive_name(organization_id)
|
19
|
-
files = Dir["{#{ForemanInventoryUpload.uploads_file_path(filename)},#{ForemanInventoryUpload.done_file_path(filename)}}"]
|
20
|
-
|
21
|
-
raise ReportMissingError.new(filename: filename) if files.empty?
|
22
|
-
|
23
|
-
[filename, files.first]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module InventoryUpload
|
2
|
-
module TaskActions
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
class NothingToSyncError < Foreman::Exception
|
6
|
-
MESSAGE = N_('Nothing to sync, there are no hosts with subscription for this organization.')
|
7
|
-
|
8
|
-
def initialize(**params)
|
9
|
-
super(self.class::MESSAGE, params)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def start_inventory_sync(selected_org)
|
14
|
-
subscribed_hosts = ForemanInventoryUpload::Generators::Queries.for_slice(
|
15
|
-
Host.unscoped.where(organization: selected_org)
|
16
|
-
)
|
17
|
-
|
18
|
-
if subscribed_hosts.empty?
|
19
|
-
raise NothingToSyncError
|
20
|
-
end
|
21
|
-
|
22
|
-
ForemanTasks.async_task(InventorySync::Async::InventoryFullSync, selected_org)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
module ForemanInsightsDeprecationsHelper
|
2
|
-
def old_plugin_deprecation_warning
|
3
|
-
alert(
|
4
|
-
class: 'alert-warning',
|
5
|
-
close: false,
|
6
|
-
text: _('redhat_access plugin is deprecated and will be removed in Satellite 6.10. You can find recommendations for your hosts on hosts index and details pages.')
|
7
|
-
)
|
8
|
-
end
|
9
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module ForemanInsightsHostHelper
|
2
|
-
def insights_host_overview_buttons(host)
|
3
|
-
search_condition = "hostname=#{host.fqdn}"
|
4
|
-
[
|
5
|
-
{
|
6
|
-
button: link_to_if_authorized(
|
7
|
-
_("Recommendations"),
|
8
|
-
hash_for_foreman_rh_cloud_insights_cloud_path(
|
9
|
-
search: search_condition,
|
10
|
-
select_all: true
|
11
|
-
),
|
12
|
-
title: _("Host Insights recommendations"),
|
13
|
-
class: 'btn btn-default'
|
14
|
-
),
|
15
|
-
priority: 1000,
|
16
|
-
},
|
17
|
-
]
|
18
|
-
end
|
19
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Deface::Override.new(
|
2
|
-
virtual_path: 'redhat_access/analytics_dashboard/welcome',
|
3
|
-
name: 'deprecation_warning',
|
4
|
-
insert_before: 'div#welcome',
|
5
|
-
text: '<%= old_plugin_deprecation_warning %>'
|
6
|
-
)
|
7
|
-
|
8
|
-
Deface::Override.new(
|
9
|
-
virtual_path: 'redhat_access/analytics_dashboard/index',
|
10
|
-
name: 'deprecation_warning_index_not_met',
|
11
|
-
insert_before: 'article#content',
|
12
|
-
text: '<%= old_plugin_deprecation_warning %>'
|
13
|
-
)
|
14
|
-
|
15
|
-
Deface::Override.new(
|
16
|
-
virtual_path: 'redhat_access/analytics_dashboard/index',
|
17
|
-
name: 'deprecation_warning_index_met',
|
18
|
-
insert_before: 'div.main-content',
|
19
|
-
text: '<%= old_plugin_deprecation_warning %>'
|
20
|
-
)
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module ForemanRhCloud
|
2
|
-
module CloudRequest
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
def execute_cloud_request(params)
|
6
|
-
final_params = {
|
7
|
-
verify_ssl: ForemanRhCloud.verify_ssl_method,
|
8
|
-
proxy: ForemanRhCloud.transformed_http_proxy_string(logger: logger),
|
9
|
-
}.deep_merge(params)
|
10
|
-
|
11
|
-
RestClient::Request.execute(final_params)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module ForemanRhCloud
|
2
|
-
class InsightsStatusCleaner
|
3
|
-
def clean(host_search)
|
4
|
-
host_ids = Host.search_for(host_search).pluck(:id)
|
5
|
-
|
6
|
-
# delete all insights status records for the hosts
|
7
|
-
deleted_count = InsightsClientReportStatus.where(host_id: host_ids).delete_all
|
8
|
-
|
9
|
-
# refresh global status
|
10
|
-
Host.where(id: host_ids).preload(:host_statuses).find_in_batches do |hosts|
|
11
|
-
hosts.each { |host| host.refresh_global_status! }
|
12
|
-
end
|
13
|
-
|
14
|
-
deleted_count
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|