foreman_rh_cloud 3.0.32 → 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 +15 -12
- 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/database.yml.example +2 -2
- data/config/routes.rb +1 -20
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +1 -22
- 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 +2 -11
- 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/foreman_rh_cloud.rb +1 -12
- 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 +5 -4
- data/lib/inventory_sync/async/inventory_full_sync.rb +10 -21
- data/lib/inventory_sync/async/inventory_hosts_sync.rb +3 -18
- 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 +3 -3
- 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 +2 -38
- data/test/models/insights_client_report_status_test.rb +72 -70
- data/test/test_plugin_helper.rb +0 -2
- data/test/unit/fact_helpers_test.rb +2 -2
- data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +3 -21
- 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 -56
- 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 -33
- 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 +0 -41822
- 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 -283
- data/test/jobs/inventory_scheduled_sync_test.rb +0 -22
- data/test/jobs/inventory_self_host_sync_test.rb +0 -104
- data/test/unit/foreman_rh_cloud_self_host_test.rb +0 -28
- 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/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { post } from 'foremanReact/redux/API';
|
2
|
+
import { get, post } from 'foremanReact/redux/API';
|
3
|
+
import { withInterval } from 'foremanReact/redux/middlewares/IntervalMiddleware';
|
3
4
|
import { addToast } from 'foremanReact/redux/actions/toasts';
|
4
5
|
import { translate as __ } from 'foremanReact/common/I18n';
|
5
6
|
import { inventoryUrl } from '../../../../ForemanInventoryHelpers';
|
@@ -8,10 +9,7 @@ import {
|
|
8
9
|
INVENTORY_SYNC,
|
9
10
|
INVENTORY_SYNC_TASK_UPDATE,
|
10
11
|
} from './SyncButtonConstants';
|
11
|
-
import {
|
12
|
-
setupTaskPolling,
|
13
|
-
taskRelatedToast,
|
14
|
-
} from '../../../../../common/ForemanTasks';
|
12
|
+
import { foremanUrl } from '../../../../../ForemanRhCloudHelpers';
|
15
13
|
|
16
14
|
export const handleSync = () => dispatch => {
|
17
15
|
dispatch(
|
@@ -23,9 +21,9 @@ export const handleSync = () => dispatch => {
|
|
23
21
|
task: { id },
|
24
22
|
},
|
25
23
|
}) => {
|
26
|
-
dispatch(
|
24
|
+
dispatch(getSyncTaskInterval(id));
|
27
25
|
return dispatch(
|
28
|
-
|
26
|
+
taskPageRefererToast(id, 'info', __('Inventory sync has started:'))
|
29
27
|
);
|
30
28
|
},
|
31
29
|
errorToast: inventorySyncErrorToast,
|
@@ -33,25 +31,62 @@ export const handleSync = () => dispatch => {
|
|
33
31
|
);
|
34
32
|
};
|
35
33
|
|
36
|
-
export const
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
34
|
+
export const getSyncTaskInterval = id => dispatch => {
|
35
|
+
dispatch(
|
36
|
+
withInterval(
|
37
|
+
get({
|
38
|
+
key: INVENTORY_SYNC_TASK_UPDATE,
|
39
|
+
url: inventoryUrl(`tasks/${id}`),
|
40
|
+
handleSuccess: ({ data: { result, output } }, stopTaskInterval) => {
|
41
|
+
if (result === 'success') {
|
42
|
+
const {
|
43
|
+
host_statuses: { sync, disconnect },
|
44
|
+
} = output;
|
45
|
+
dispatch(
|
46
|
+
addToast({
|
47
|
+
sticky: true,
|
48
|
+
type: 'success',
|
49
|
+
message: (
|
50
|
+
<Toast syncHosts={sync} disconnectHosts={disconnect} />
|
51
|
+
),
|
52
|
+
})
|
53
|
+
);
|
54
|
+
}
|
55
|
+
if (result === 'error') {
|
56
|
+
dispatch(
|
57
|
+
taskPageRefererToast(
|
58
|
+
id,
|
59
|
+
'error',
|
60
|
+
__('Inventory sync has failed:'),
|
61
|
+
true
|
62
|
+
)
|
63
|
+
);
|
64
|
+
}
|
65
|
+
stopTaskInterval();
|
66
|
+
},
|
67
|
+
errorToast: inventorySyncErrorToast,
|
68
|
+
})
|
69
|
+
)
|
70
|
+
);
|
71
|
+
};
|
54
72
|
|
55
|
-
const inventorySyncErrorToast = message =>
|
56
|
-
`${__('Inventory sync has failed: ')} ${
|
57
|
-
|
73
|
+
const inventorySyncErrorToast = ({ message, response }) =>
|
74
|
+
`${__('Inventory sync has failed: ')} ${response.data?.message || message}`;
|
75
|
+
|
76
|
+
const taskPageRefererToast = (taskID, toastType, prefix, sticky = false) =>
|
77
|
+
addToast({
|
78
|
+
sticky,
|
79
|
+
type: toastType,
|
80
|
+
message: (
|
81
|
+
<span>
|
82
|
+
{prefix}{' '}
|
83
|
+
<a
|
84
|
+
target="_blank"
|
85
|
+
rel="noopener noreferrer"
|
86
|
+
href={foremanUrl(`/foreman_tasks/tasks/${taskID}`)}
|
87
|
+
>
|
88
|
+
{__('view the task page for more details')}
|
89
|
+
</a>
|
90
|
+
</span>
|
91
|
+
),
|
92
|
+
});
|
@@ -22,7 +22,7 @@ Array [
|
|
22
22
|
"errorToast": [Function],
|
23
23
|
"interval": 3000,
|
24
24
|
"type": "API_GET",
|
25
|
-
"url": "/
|
25
|
+
"url": "/foreman_inventory_upload/tasks/1",
|
26
26
|
},
|
27
27
|
],
|
28
28
|
Array [
|
@@ -31,7 +31,7 @@ Array [
|
|
31
31
|
"message": Object {
|
32
32
|
"message": <span>
|
33
33
|
Inventory sync has started:
|
34
|
-
|
34
|
+
|
35
35
|
<a
|
36
36
|
href="/foreman_tasks/tasks/1"
|
37
37
|
rel="noopener noreferrer"
|
@@ -40,6 +40,7 @@ Array [
|
|
40
40
|
view the task page for more details
|
41
41
|
</a>
|
42
42
|
</span>,
|
43
|
+
"sticky": false,
|
43
44
|
"type": "info",
|
44
45
|
},
|
45
46
|
},
|
@@ -19,6 +19,25 @@ export const fetchInsights = (queryParams = {}) => (dispatch, getState) => {
|
|
19
19
|
...queryParams,
|
20
20
|
};
|
21
21
|
|
22
|
+
dispatch(
|
23
|
+
get({
|
24
|
+
key: INSIGHTS_HITS_API_KEY,
|
25
|
+
url: INSIGHTS_HITS_PATH,
|
26
|
+
params: {
|
27
|
+
page,
|
28
|
+
per_page: perPage,
|
29
|
+
search: query,
|
30
|
+
order: `${sortBy} ${sortOrder}`,
|
31
|
+
},
|
32
|
+
handleSuccess: response => {
|
33
|
+
if (isSelectAll) {
|
34
|
+
selectAllIds(dispatch, response.data.hits || []);
|
35
|
+
dispatch(selectAll());
|
36
|
+
}
|
37
|
+
},
|
38
|
+
})
|
39
|
+
);
|
40
|
+
|
22
41
|
const uri = new URI();
|
23
42
|
uri.search({
|
24
43
|
page,
|
@@ -39,25 +58,6 @@ export const fetchInsights = (queryParams = {}) => (dispatch, getState) => {
|
|
39
58
|
if (!isSelectAll) {
|
40
59
|
dispatch(setSelectAllAlert(false));
|
41
60
|
}
|
42
|
-
|
43
|
-
return dispatch(
|
44
|
-
get({
|
45
|
-
key: INSIGHTS_HITS_API_KEY,
|
46
|
-
url: INSIGHTS_HITS_PATH,
|
47
|
-
params: {
|
48
|
-
page,
|
49
|
-
per_page: perPage,
|
50
|
-
search: query,
|
51
|
-
order: `${sortBy} ${sortOrder}`,
|
52
|
-
},
|
53
|
-
handleSuccess: response => {
|
54
|
-
if (isSelectAll) {
|
55
|
-
selectAllIds(dispatch, response.data.hits || []);
|
56
|
-
dispatch(selectAll());
|
57
|
-
}
|
58
|
-
},
|
59
|
-
})
|
60
|
-
);
|
61
61
|
};
|
62
62
|
|
63
63
|
const selectAllIds = (dispatch, results, prevSelectedIds = {}) => {
|
@@ -26,20 +26,6 @@ Array [
|
|
26
26
|
|
27
27
|
exports[`insights table actions should fetchInsights 1`] = `
|
28
28
|
Array [
|
29
|
-
Array [
|
30
|
-
Object {
|
31
|
-
"payload": Object {
|
32
|
-
"args": Array [
|
33
|
-
Object {
|
34
|
-
"pathname": "/foreman_rh_cloud/insights_cloud",
|
35
|
-
"search": "?page=2&per_page=7&search=&sort_by=&sort_order=&select_all=true",
|
36
|
-
},
|
37
|
-
],
|
38
|
-
"method": "push",
|
39
|
-
},
|
40
|
-
"type": "@@router/CALL_HISTORY_METHOD",
|
41
|
-
},
|
42
|
-
],
|
43
29
|
Array [
|
44
30
|
Object {
|
45
31
|
"payload": Object {
|
@@ -75,6 +61,20 @@ Array [
|
|
75
61
|
"url": "/insights_cloud/hits",
|
76
62
|
},
|
77
63
|
],
|
64
|
+
Array [
|
65
|
+
Object {
|
66
|
+
"payload": Object {
|
67
|
+
"args": Array [
|
68
|
+
Object {
|
69
|
+
"pathname": "/foreman_rh_cloud/insights_cloud",
|
70
|
+
"search": "?page=2&per_page=7&search=&sort_by=&sort_order=&select_all=true",
|
71
|
+
},
|
72
|
+
],
|
73
|
+
"method": "push",
|
74
|
+
},
|
75
|
+
"type": "@@router/CALL_HISTORY_METHOD",
|
76
|
+
},
|
77
|
+
],
|
78
78
|
]
|
79
79
|
`;
|
80
80
|
|
@@ -34,7 +34,6 @@ const RemediateButton = ({ isExperimentalMode, selectedIds, toggleModal }) => {
|
|
34
34
|
button = (
|
35
35
|
<Popover
|
36
36
|
isVisible={isVisible}
|
37
|
-
aria-label={__('Please enable lab features to use this button')}
|
38
37
|
bodyContent={
|
39
38
|
<div dangerouslySetInnerHTML={{ __html: popoverContent }} />
|
40
39
|
}
|
@@ -6,18 +6,4 @@
|
|
6
6
|
margin-top: 5px;
|
7
7
|
}
|
8
8
|
}
|
9
|
-
|
10
|
-
// applies to the backdrop parent of the modal
|
11
|
-
@at-root .pf-c-backdrop {
|
12
|
-
width: calc(100% - 200px) !important;
|
13
|
-
left: 200px !important;
|
14
|
-
}
|
15
|
-
|
16
|
-
// where the vertical nav breaks: https://github.com/theforeman/foreman/blob/3347fa49d500964f0209122d8d36c920d1feafcc/webpack/assets/javascripts/react_app/components/Layout/components/Toolbar/HeaderToolbar.scss#L26
|
17
|
-
@media (max-width: 768px) {
|
18
|
-
@at-root .pf-c-backdrop {
|
19
|
-
width: 100% !important;
|
20
|
-
left: 0 !important;
|
21
|
-
}
|
22
|
-
}
|
23
9
|
}
|
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:
|
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,23 +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
|
-
- config/package-lock.json
|
192
184
|
- config/package-lock.json.gh_test
|
193
|
-
- config/package-lock.json.plugin
|
194
185
|
- config/routes.rb
|
195
186
|
- db/migrate/20191215104806_create_insights_hits.foreman_inventory_upload.rb
|
196
187
|
- db/migrate/20191216062008_create_insights_facets.foreman_inventory_upload.rb
|
@@ -201,7 +192,6 @@ files:
|
|
201
192
|
- db/migrate/20210214000002_add_rule_id_to_hits.foreman_rh_cloud.rb
|
202
193
|
- db/migrate/20210307000001_add_unique_to_insights_facet.foreman_rh_cloud.rb
|
203
194
|
- db/migrate/20210404000001_change_resolutions.foreman_rh_cloud.rb
|
204
|
-
- db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb
|
205
195
|
- db/seeds.d/179_ui_notifications.rb
|
206
196
|
- db/seeds.d/50_job_templates.rb
|
207
197
|
- lib/foreman_inventory_upload.rb
|
@@ -225,7 +215,6 @@ files:
|
|
225
215
|
- lib/foreman_rh_cloud/engine.rb
|
226
216
|
- lib/foreman_rh_cloud/version.rb
|
227
217
|
- lib/insights_cloud.rb
|
228
|
-
- lib/insights_cloud/async/insights_client_status_aging.rb
|
229
218
|
- lib/insights_cloud/async/insights_full_sync.rb
|
230
219
|
- lib/insights_cloud/async/insights_generate_notifications.rb
|
231
220
|
- lib/insights_cloud/async/insights_resolutions_sync.rb
|
@@ -236,7 +225,6 @@ files:
|
|
236
225
|
- lib/inventory_sync/async/inventory_full_sync.rb
|
237
226
|
- lib/inventory_sync/async/inventory_hosts_sync.rb
|
238
227
|
- lib/inventory_sync/async/inventory_scheduled_sync.rb
|
239
|
-
- lib/inventory_sync/async/inventory_self_host_sync.rb
|
240
228
|
- lib/inventory_sync/async/query_inventory_job.rb
|
241
229
|
- lib/tasks/foreman_rh_cloud_tasks.rake
|
242
230
|
- lib/tasks/insights.rake
|
@@ -249,32 +237,25 @@ files:
|
|
249
237
|
- test/controllers/accounts_controller_test.rb
|
250
238
|
- test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
|
251
239
|
- test/controllers/insights_sync/settings_controller_test.rb
|
252
|
-
- test/controllers/inventory_upload/api/inventory_controller_test.rb
|
253
240
|
- test/controllers/reports_controller_test.rb
|
254
241
|
- test/controllers/uploads_controller_test.rb
|
255
242
|
- test/controllers/uploads_settings_controller_test.rb
|
256
243
|
- test/factories/insights_factories.rb
|
257
244
|
- test/factories/inventory_upload_factories.rb
|
258
|
-
- test/jobs/insights_client_status_aging_test.rb
|
259
245
|
- test/jobs/insights_full_sync_test.rb
|
260
246
|
- test/jobs/insights_resolutions_sync_test.rb
|
261
247
|
- test/jobs/insights_rules_sync_test.rb
|
262
248
|
- test/jobs/inventory_full_sync_test.rb
|
263
|
-
- test/jobs/inventory_hosts_sync_test.rb
|
264
|
-
- test/jobs/inventory_scheduled_sync_test.rb
|
265
|
-
- test/jobs/inventory_self_host_sync_test.rb
|
266
249
|
- test/jobs/upload_report_job_test.rb
|
267
250
|
- test/models/insights_client_report_status_test.rb
|
268
251
|
- test/test_plugin_helper.rb
|
269
252
|
- test/unit/archived_report_generator_test.rb
|
270
253
|
- test/unit/fact_helpers_test.rb
|
271
|
-
- test/unit/foreman_rh_cloud_self_host_test.rb
|
272
254
|
- test/unit/insights_facet_test.rb
|
273
255
|
- test/unit/metadata_generator_test.rb
|
274
256
|
- test/unit/rh_cloud_http_proxy_test.rb
|
275
257
|
- test/unit/services/foreman_rh_cloud/branch_info_test.rb
|
276
258
|
- test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb
|
277
|
-
- test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb
|
278
259
|
- test/unit/services/foreman_rh_cloud/remediations_retriever_test.rb
|
279
260
|
- test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
|
280
261
|
- test/unit/shell_process_job_test.rb
|
@@ -639,9 +620,6 @@ files:
|
|
639
620
|
- webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap
|
640
621
|
- webpack/__tests__/__snapshots__/ForemanRhCloudSelectors.test.js.snap
|
641
622
|
- webpack/__tests__/__snapshots__/ForemanRhCloudTestHelpers.test.js.snap
|
642
|
-
- webpack/common/ForemanTasks/ForemanTasksActions.js
|
643
|
-
- webpack/common/ForemanTasks/ForemanTasksHelpers.js
|
644
|
-
- webpack/common/ForemanTasks/index.js
|
645
623
|
- webpack/common/Switcher/HelpLabel.js
|
646
624
|
- webpack/common/Switcher/SwitcherPF4.js
|
647
625
|
- webpack/common/Switcher/SwitcherPF4.scss
|
@@ -673,7 +651,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
673
651
|
- !ruby/object:Gem::Version
|
674
652
|
version: '0'
|
675
653
|
requirements: []
|
676
|
-
rubygems_version: 3.2.
|
654
|
+
rubygems_version: 3.2.3
|
677
655
|
signing_key:
|
678
656
|
specification_version: 4
|
679
657
|
summary: Summary of ForemanRhCloud.
|
@@ -681,32 +659,25 @@ test_files:
|
|
681
659
|
- test/controllers/accounts_controller_test.rb
|
682
660
|
- test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
|
683
661
|
- test/controllers/insights_sync/settings_controller_test.rb
|
684
|
-
- test/controllers/inventory_upload/api/inventory_controller_test.rb
|
685
662
|
- test/controllers/reports_controller_test.rb
|
686
663
|
- test/controllers/uploads_controller_test.rb
|
687
664
|
- test/controllers/uploads_settings_controller_test.rb
|
688
665
|
- test/factories/insights_factories.rb
|
689
666
|
- test/factories/inventory_upload_factories.rb
|
690
|
-
- test/jobs/insights_client_status_aging_test.rb
|
691
667
|
- test/jobs/insights_full_sync_test.rb
|
692
668
|
- test/jobs/insights_resolutions_sync_test.rb
|
693
669
|
- test/jobs/insights_rules_sync_test.rb
|
694
670
|
- test/jobs/inventory_full_sync_test.rb
|
695
|
-
- test/jobs/inventory_hosts_sync_test.rb
|
696
|
-
- test/jobs/inventory_scheduled_sync_test.rb
|
697
|
-
- test/jobs/inventory_self_host_sync_test.rb
|
698
671
|
- test/jobs/upload_report_job_test.rb
|
699
672
|
- test/models/insights_client_report_status_test.rb
|
700
673
|
- test/test_plugin_helper.rb
|
701
674
|
- test/unit/archived_report_generator_test.rb
|
702
675
|
- test/unit/fact_helpers_test.rb
|
703
|
-
- test/unit/foreman_rh_cloud_self_host_test.rb
|
704
676
|
- test/unit/insights_facet_test.rb
|
705
677
|
- test/unit/metadata_generator_test.rb
|
706
678
|
- test/unit/rh_cloud_http_proxy_test.rb
|
707
679
|
- test/unit/services/foreman_rh_cloud/branch_info_test.rb
|
708
680
|
- test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb
|
709
|
-
- test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb
|
710
681
|
- test/unit/services/foreman_rh_cloud/remediations_retriever_test.rb
|
711
682
|
- test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
|
712
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
|