foreman_rh_cloud 13.2.10 → 14.0.1

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +61 -61
  3. data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +68 -68
  4. data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +9 -9
  5. data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +60 -60
  6. data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +60 -60
  7. data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +0 -9
  8. data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +10 -13
  9. data/app/controllers/insights_cloud/ui_requests_controller.rb +7 -3
  10. data/app/models/concerns/rh_cloud_host.rb +3 -35
  11. data/app/models/insights_client_report_status.rb +1 -9
  12. data/app/models/inventory_sync/inventory_status.rb +4 -16
  13. data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +5 -12
  14. data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +2 -8
  15. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +4 -34
  16. data/lib/foreman_inventory_upload/generators/queries.rb +1 -1
  17. data/lib/foreman_inventory_upload/generators/slice.rb +1 -1
  18. data/lib/foreman_inventory_upload.rb +1 -8
  19. data/lib/foreman_rh_cloud/engine.rb +0 -1
  20. data/lib/foreman_rh_cloud/version.rb +1 -1
  21. data/lib/foreman_rh_cloud.rb +9 -36
  22. data/lib/insights_cloud/async/insights_generate_notifications.rb +1 -10
  23. data/lib/insights_cloud/async/vmaas_reposcan_sync.rb +8 -23
  24. data/lib/inventory_sync/async/inventory_full_sync.rb +3 -39
  25. data/lib/inventory_sync/async/inventory_self_host_sync.rb +2 -12
  26. data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  27. data/locale/fr/foreman_rh_cloud.edit.po +1032 -0
  28. data/locale/fr/foreman_rh_cloud.po +65 -66
  29. data/locale/fr/foreman_rh_cloud.po.time_stamp +0 -0
  30. data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  31. data/locale/ja/foreman_rh_cloud.edit.po +1026 -0
  32. data/locale/ja/foreman_rh_cloud.po +70 -72
  33. data/locale/ja/foreman_rh_cloud.po.time_stamp +0 -0
  34. data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  35. data/locale/ka/foreman_rh_cloud.edit.po +1025 -0
  36. data/locale/ka/foreman_rh_cloud.po +10 -11
  37. data/locale/ka/foreman_rh_cloud.po.time_stamp +0 -0
  38. data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  39. data/locale/ko/foreman_rh_cloud.edit.po +1029 -0
  40. data/locale/ko/foreman_rh_cloud.po +63 -64
  41. data/locale/ko/foreman_rh_cloud.po.time_stamp +0 -0
  42. data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  43. data/locale/zh_CN/foreman_rh_cloud.edit.po +1031 -0
  44. data/locale/zh_CN/foreman_rh_cloud.po +64 -65
  45. data/locale/zh_CN/foreman_rh_cloud.po.time_stamp +0 -0
  46. data/package.json +1 -1
  47. data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +3 -57
  48. data/test/controllers/insights_cloud/ui_requests_controller_test.rb +2 -16
  49. data/test/jobs/insights_client_status_aging_test.rb +0 -40
  50. data/test/jobs/inventory_full_sync_test.rb +4 -219
  51. data/test/jobs/inventory_hosts_sync_test.rb +5 -7
  52. data/test/jobs/inventory_self_host_sync_test.rb +1 -10
  53. data/test/models/insights_client_report_status_test.rb +0 -109
  54. data/test/unit/archived_report_generator_test.rb +1 -2
  55. data/test/unit/fact_helpers_test.rb +0 -16
  56. data/test/unit/foreman_rh_cloud_self_host_test.rb +2 -50
  57. data/test/unit/lib/insights_cloud/async/vmaas_reposcan_sync_test.rb +25 -80
  58. data/test/unit/metadata_generator_test.rb +1 -24
  59. data/test/unit/rh_cloud_host_test.rb +0 -214
  60. data/test/unit/services/foreman_rh_cloud/branch_info_test.rb +1 -1
  61. data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +1 -1
  62. data/test/unit/slice_generator_test.rb +2 -21
  63. data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js +3 -30
  64. data/webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js +10 -112
  65. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +1 -3
  66. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +2 -8
  67. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +0 -1
  68. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js +0 -1
  69. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js +17 -43
  70. data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +0 -7
  71. data/webpack/ForemanRhCloudHelpers.js +0 -22
  72. data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +15 -71
  73. metadata +16 -18
  74. data/app/controllers/concerns/insights_cloud/candlepin_proxies_extensions.rb +0 -23
  75. data/test/controllers/insights_cloud/candlepin_proxies_extensions_test.rb +0 -70
  76. data/test/jobs/insights_generate_notifications_test.rb +0 -26
  77. data/test/models/inventory_sync/inventory_status_test.rb +0 -85
  78. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/__tests__/Toast.test.js +0 -82
  79. data/webpack/InsightsHostDetailsTab/__tests__/NewHostDetailsTab.test.js +0 -266
@@ -7,8 +7,6 @@ import { getDocsURL } from 'foremanReact/common/helpers';
7
7
  import { FormattedMessage } from 'react-intl';
8
8
  import { selectSubscriptionConnectionEnabled } from '../../../InventorySettings/InventorySettingsSelectors';
9
9
 
10
- import { getSubscriptionServiceDocsUrl } from '../../../../ForemanInventoryHelpers';
11
-
12
10
  export const PageDescription = () => {
13
11
  const subscriptionConnectionEnabled = useSelector(
14
12
  selectSubscriptionConnectionEnabled
@@ -82,7 +80,7 @@ export const PageDescription = () => {
82
80
  {__('For more information about the Subscriptions service, see:')}
83
81
   
84
82
  <a
85
- href={getSubscriptionServiceDocsUrl()}
83
+ href="https://docs.redhat.com/en/documentation/subscription_central/1-latest/html/getting_started_with_the_subscriptions_service/index"
86
84
  target="_blank"
87
85
  rel="noopener noreferrer"
88
86
  >
@@ -39,20 +39,14 @@ export const setupInventorySyncTaskPolling = (id, dispatch) =>
39
39
  key: INVENTORY_SYNC_TASK_UPDATE,
40
40
  onTaskSuccess: ({
41
41
  output: {
42
- host_statuses: { sync, disconnect, user_omitted: userOmitted },
42
+ host_statuses: { sync, disconnect },
43
43
  },
44
44
  }) =>
45
45
  dispatch(
46
46
  addToast({
47
47
  sticky: true,
48
48
  type: 'success',
49
- message: (
50
- <Toast
51
- syncHosts={sync}
52
- disconnectHosts={disconnect}
53
- userOmittedHosts={userOmitted}
54
- />
55
- ),
49
+ message: <Toast syncHosts={sync} disconnectHosts={disconnect} />,
56
50
  })
57
51
  ),
58
52
  dispatch,
@@ -9,7 +9,6 @@ Array [
9
9
  "message": <Toast
10
10
  disconnectHosts={2}
11
11
  syncHosts={0}
12
- userOmittedHosts={1}
13
12
  />,
14
13
  "sticky": true,
15
14
  "type": "success",
@@ -30,7 +30,6 @@ describe('SyncButton integration test', () => {
30
30
  host_statuses: {
31
31
  sync: 0,
32
32
  disconnect: 2,
33
- user_omitted: 1,
34
33
  },
35
34
  },
36
35
  result: 'success',
@@ -1,55 +1,33 @@
1
1
  import React from 'react';
2
- import { Link } from 'react-router-dom';
3
2
  import PropTypes from 'prop-types';
4
3
  import { translate as __ } from 'foremanReact/common/I18n';
4
+ import { foremanUrl } from '../../../../../../ForemanRhCloudHelpers';
5
5
 
6
- const statusSearchParams = statusName =>
7
- `/new/hosts?search=insights_inventory_sync_status+%3D+${statusName}&page=1`;
8
- const DISCONNECT = 'disconnect';
9
- const SYNC = 'sync';
10
- const USER_OMITTED = 'user_omitted';
11
- const HostsWithStatusLink = ({ statusName, children }) => (
12
- <Link to={statusSearchParams(statusName)}>{children}</Link>
13
- );
14
- HostsWithStatusLink.propTypes = {
15
- statusName: PropTypes.string.isRequired,
16
- children: PropTypes.node.isRequired,
17
- };
18
-
19
- const Toast = ({ syncHosts, disconnectHosts, userOmittedHosts }) => {
20
- const totalHosts = syncHosts + disconnectHosts + userOmittedHosts;
6
+ const Toast = ({ syncHosts, disconnectHosts }) => {
7
+ const totalHosts = syncHosts + disconnectHosts;
21
8
  return (
22
9
  <span>
23
10
  <p>
24
- {__('Registered hosts in organization: ')}
25
- <Link to="/new/hosts?search=set%3F+subscription_uuid&page=1">
26
- {totalHosts}
27
- </Link>
11
+ {__('Hosts with subscription in organization: ')}
12
+ <strong>{totalHosts}</strong>
28
13
  </p>
29
14
  <p>
30
- {__('Uploaded and present on console.redhat.com Inventory service: ')}
31
- <HostsWithStatusLink statusName={SYNC}>{syncHosts}</HostsWithStatusLink>
15
+ {__('Successfully synced hosts: ')}
16
+ <strong>{syncHosts}</strong>
32
17
  </p>
33
18
  <p>
34
- {__('Not present on console.redhat.com Inventory service: ')}
35
- <HostsWithStatusLink statusName={DISCONNECT}>
36
- {disconnectHosts}
37
- </HostsWithStatusLink>
19
+ {__('Disconnected hosts: ')}
20
+ <strong>{disconnectHosts}</strong>
38
21
  </p>
39
- {!!userOmittedHosts && (
40
- <p>
41
- {__(
42
- 'Excluded from upload to console.redhat.com Inventory service because host_registration_insights_inventory parameter value is false: '
43
- )}
44
- <HostsWithStatusLink statusName={USER_OMITTED}>
45
- {userOmittedHosts}
46
- </HostsWithStatusLink>
47
- </p>
48
- )}
49
22
  <p>
50
- {__(
51
- 'You can review this information later by looking at the Inventory status of each host.'
52
- )}
23
+ {__('For more info, please visit the')}{' '}
24
+ <a
25
+ href={foremanUrl('/hosts')}
26
+ target="_blank"
27
+ rel="noopener noreferrer"
28
+ >
29
+ {__('hosts page')}
30
+ </a>
53
31
  </p>
54
32
  </span>
55
33
  );
@@ -58,10 +36,6 @@ const Toast = ({ syncHosts, disconnectHosts, userOmittedHosts }) => {
58
36
  Toast.propTypes = {
59
37
  syncHosts: PropTypes.number.isRequired,
60
38
  disconnectHosts: PropTypes.number.isRequired,
61
- userOmittedHosts: PropTypes.number,
62
- };
63
- Toast.defaultProps = {
64
- userOmittedHosts: 0,
65
39
  };
66
40
 
67
41
  export default Toast;
@@ -11,13 +11,6 @@ export const getInventoryDocsUrl = () =>
11
11
  )}`
12
12
  );
13
13
 
14
- export const getSubscriptionServiceDocsUrl = () =>
15
- foremanUrl(
16
- `/links/manual/?root_url=${URI.encode(
17
- 'https://docs.redhat.com/en/documentation/subscription_central/1-latest/html-single/getting_started_with_the_subscriptions_service/index'
18
- )}`
19
- );
20
-
21
14
  export const getActionsHistoryUrl = () =>
22
15
  foremanUrl(
23
16
  '/foreman_tasks/tasks?search=label+%3D+ForemanInventoryUpload%3A%3AAsync%3A%3AHostInventoryReportJob+or+label+%3D+ForemanInventoryUpload%3A%3AAsync%3A%3AGenerateAllReportsJob&page=1'
@@ -1,6 +1,3 @@
1
- import { useEffect } from 'react';
2
- import { useHistory } from 'react-router-dom';
3
-
4
1
  /**
5
2
  * copied from core, since it's not in the ReactApp folder,
6
3
  * it's complicated to import it and mock it in tests.
@@ -8,25 +5,6 @@ import { useHistory } from 'react-router-dom';
8
5
  */
9
6
  export const foremanUrl = path => `${window.URL_PREFIX}${path}`;
10
7
 
11
- export const OVERVIEW_TAB_PATH = '/Overview';
12
-
13
- /**
14
- * Redirects to Overview tab when the current tab should be hidden
15
- * @param {boolean} shouldRedirect - Whether to redirect (e.g., host loaded AND tab should hide)
16
- * @returns {boolean} - Returns shouldRedirect for convenience
17
- */
18
- export const useTabRedirect = shouldRedirect => {
19
- const history = useHistory();
20
-
21
- useEffect(() => {
22
- if (shouldRedirect && history) {
23
- history.replace(OVERVIEW_TAB_PATH);
24
- }
25
- }, [shouldRedirect, history]);
26
-
27
- return shouldRedirect;
28
- };
29
-
30
8
  export const isNotRhelHost = ({ hostDetails }) =>
31
9
  // This regex tries matches sane variations of "RedHat", "RHEL" and "RHCOS"
32
10
  !new RegExp('red[\\s\\-]?hat|rh[\\s\\-]?el|rhc[\\s\\-]?os', 'i').test(
@@ -25,11 +25,6 @@ import { useIopConfig } from '../common/Hooks/ConfigHooks';
25
25
  import { generateRuleUrl } from '../InsightsCloudSync/InsightsCloudSync';
26
26
  import { createProviderOptions } from '../common/ScalprumModule/ScalprumContext';
27
27
  import { useInsightsPermissions } from '../common/Hooks/PermissionsHooks';
28
- import {
29
- isNotRhelHost,
30
- hasNoInsightsFacet,
31
- useTabRedirect,
32
- } from '../ForemanRhCloudHelpers';
33
28
 
34
29
  // Hosted Insights advisor
35
30
  const NewHostDetailsTab = ({ hostName, router }) => {
@@ -38,28 +33,13 @@ const NewHostDetailsTab = ({ hostName, router }) => {
38
33
  const hits = useSelector(selectHits);
39
34
  const isIop = useIopConfig();
40
35
 
41
- useEffect(
42
- () => () => {
43
- // Preserve hash when clearing search params to prevent tab navigation bugs
44
- if (router && typeof router.replace === 'function') {
45
- const replaceOptions = { search: null };
46
- if (router.location && router.location.hash) {
47
- replaceOptions.hash = router.location.hash;
48
- }
49
- router.replace(replaceOptions);
50
- }
51
- },
52
- [router]
53
- );
36
+ useEffect(() => () => router.replace({ search: null }), [router]);
54
37
 
55
38
  const onSearch = q => dispatch(fetchInsights({ query: q, page: 1 }));
56
39
 
57
40
  const [isDropdownOpen, setIsDropdownOpen] = useState(false);
58
- const onSatInsightsClick = () => {
59
- if (router && typeof router.push === 'function') {
60
- router.push({ pathname: '/foreman_rh_cloud/insights_cloud' });
61
- }
62
- };
41
+ const onSatInsightsClick = () =>
42
+ router.push({ pathname: '/foreman_rh_cloud/insights_cloud' });
63
43
 
64
44
  const dropdownItems = [
65
45
  <DropdownItem key="insights-link" ouiaId="insights-link">
@@ -133,32 +113,17 @@ NewHostDetailsTab.defaultProps = {
133
113
  const scope = 'advisor';
134
114
  const module = './SystemDetailWrapped';
135
115
 
136
- const IopInsightsTab = props => {
137
- // eslint-disable-next-line camelcase
138
- const systemId = props.response?.subscription_facet_attributes?.uuid;
139
- return (
140
- <div className="advisor">
141
- <ScalprumComponent
142
- key={systemId || props.hostName}
143
- scope={scope}
144
- module={module}
145
- IopRemediationModal={RemediationModal}
146
- generateRuleUrl={generateRuleUrl}
147
- {...props}
148
- />
149
- </div>
150
- );
151
- };
152
-
153
- IopInsightsTab.propTypes = {
154
- hostName: PropTypes.string,
155
- response: PropTypes.object,
156
- };
157
-
158
- IopInsightsTab.defaultProps = {
159
- hostName: '',
160
- response: {},
161
- };
116
+ const IopInsightsTab = props => (
117
+ <div className="advisor">
118
+ <ScalprumComponent
119
+ scope={scope}
120
+ module={module}
121
+ IopRemediationModal={RemediationModal}
122
+ generateRuleUrl={generateRuleUrl}
123
+ {...props}
124
+ />
125
+ </div>
126
+ );
162
127
 
163
128
  const IopInsightsTabWrapped = props => {
164
129
  const permissions = useInsightsPermissions();
@@ -170,18 +135,7 @@ const IopInsightsTabWrapped = props => {
170
135
  };
171
136
 
172
137
  const InsightsTab = props => {
173
- const { response } = props;
174
138
  const isIop = useIopConfig();
175
- const isHostDataLoaded = Boolean(response?.id);
176
- const shouldHideTab = useTabRedirect(
177
- isHostDataLoaded &&
178
- (isNotRhelHost({ hostDetails: response }) ||
179
- hasNoInsightsFacet({ response, hostDetails: response }))
180
- );
181
-
182
- if (shouldHideTab) {
183
- return null;
184
- }
185
139
 
186
140
  return isIop ? (
187
141
  <IopInsightsTabWrapped {...props} />
@@ -190,16 +144,6 @@ const InsightsTab = props => {
190
144
  );
191
145
  };
192
146
 
193
- InsightsTab.propTypes = {
194
- response: PropTypes.shape({
195
- id: PropTypes.number,
196
- operatingsystem_name: PropTypes.string,
197
- insights_attributes: PropTypes.object,
198
- }),
199
- };
200
-
201
- InsightsTab.defaultProps = {
202
- response: {},
203
- };
147
+ InsightsTab.defaultProps = {};
204
148
 
205
149
  export default InsightsTab;
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_rh_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.2.10
4
+ version: 14.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Red Hat Cloud team
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-02-25 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: foreman_ansible
@@ -30,9 +31,6 @@ dependencies:
30
31
  - - ">="
31
32
  - !ruby/object:Gem::Version
32
33
  version: 10.0.0
33
- - - "<"
34
- - !ruby/object:Gem::Version
35
- version: 13.0.0
36
34
  type: :runtime
37
35
  prerelease: false
38
36
  version_requirements: !ruby/object:Gem::Requirement
@@ -40,9 +38,6 @@ dependencies:
40
38
  - - ">="
41
39
  - !ruby/object:Gem::Version
42
40
  version: 10.0.0
43
- - - "<"
44
- - !ruby/object:Gem::Version
45
- version: 13.0.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: katello
48
43
  requirement: !ruby/object:Gem::Requirement
@@ -107,7 +102,6 @@ files:
107
102
  - app/controllers/concerns/foreman_rh_cloud/iop_smart_proxy_access.rb
108
103
  - app/controllers/concerns/foreman_rh_cloud/registration_manager_extensions.rb
109
104
  - app/controllers/concerns/insights_cloud/candlepin_cache.rb
110
- - app/controllers/concerns/insights_cloud/candlepin_proxies_extensions.rb
111
105
  - app/controllers/concerns/insights_cloud/client_authentication.rb
112
106
  - app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb
113
107
  - app/controllers/concerns/inventory_upload/report_actions.rb
@@ -240,22 +234,31 @@ files:
240
234
  - locale/Makefile
241
235
  - locale/foreman_rh_cloud.pot
242
236
  - locale/fr/LC_MESSAGES/foreman_rh_cloud.mo
237
+ - locale/fr/foreman_rh_cloud.edit.po
243
238
  - locale/fr/foreman_rh_cloud.po
239
+ - locale/fr/foreman_rh_cloud.po.time_stamp
244
240
  - locale/gemspec.rb
245
241
  - locale/ja/LC_MESSAGES/foreman_rh_cloud.mo
242
+ - locale/ja/foreman_rh_cloud.edit.po
246
243
  - locale/ja/foreman_rh_cloud.po
244
+ - locale/ja/foreman_rh_cloud.po.time_stamp
247
245
  - locale/ka/LC_MESSAGES/foreman_rh_cloud.mo
246
+ - locale/ka/foreman_rh_cloud.edit.po
248
247
  - locale/ka/foreman_rh_cloud.po
248
+ - locale/ka/foreman_rh_cloud.po.time_stamp
249
249
  - locale/ko/LC_MESSAGES/foreman_rh_cloud.mo
250
+ - locale/ko/foreman_rh_cloud.edit.po
250
251
  - locale/ko/foreman_rh_cloud.po
252
+ - locale/ko/foreman_rh_cloud.po.time_stamp
251
253
  - locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo
254
+ - locale/zh_CN/foreman_rh_cloud.edit.po
252
255
  - locale/zh_CN/foreman_rh_cloud.po
256
+ - locale/zh_CN/foreman_rh_cloud.po.time_stamp
253
257
  - package.json
254
258
  - test/controllers/accounts_controller_test.rb
255
259
  - test/controllers/insights_cloud/api/advisor_engine_controller_test.rb
256
260
  - test/controllers/insights_cloud/api/cloud_request_controller_test.rb
257
261
  - test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
258
- - test/controllers/insights_cloud/candlepin_proxies_extensions_test.rb
259
262
  - test/controllers/insights_cloud/ui_requests_controller_test.rb
260
263
  - test/controllers/insights_sync/settings_controller_test.rb
261
264
  - test/controllers/inventory_upload/api/inventory_controller_test.rb
@@ -271,7 +274,6 @@ files:
271
274
  - test/jobs/host_inventory_report_job_test.rb
272
275
  - test/jobs/insights_client_status_aging_test.rb
273
276
  - test/jobs/insights_full_sync_test.rb
274
- - test/jobs/insights_generate_notifications_test.rb
275
277
  - test/jobs/insights_resolutions_sync_test.rb
276
278
  - test/jobs/insights_rules_sync_test.rb
277
279
  - test/jobs/inventory_full_sync_test.rb
@@ -283,7 +285,6 @@ files:
283
285
  - test/jobs/single_host_report_job_test.rb
284
286
  - test/jobs/upload_report_direct_job_test.rb
285
287
  - test/models/insights_client_report_status_test.rb
286
- - test/models/inventory_sync/inventory_status_test.rb
287
288
  - test/test_plugin_helper.rb
288
289
  - test/unit/archived_report_generator_test.rb
289
290
  - test/unit/fact_helpers_test.rb
@@ -458,7 +459,6 @@ files:
458
459
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap
459
460
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js
460
461
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js
461
- - webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/__tests__/Toast.test.js
462
462
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/index.js
463
463
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js
464
464
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/ToolbarButtons.test.js
@@ -597,7 +597,6 @@ files:
597
597
  - webpack/InsightsHostDetailsTab/__tests__/InsightsTabReducer.test.js
598
598
  - webpack/InsightsHostDetailsTab/__tests__/InsightsTabSelectors.test.js
599
599
  - webpack/InsightsHostDetailsTab/__tests__/InsightsTotalRiskChart.test.js
600
- - webpack/InsightsHostDetailsTab/__tests__/NewHostDetailsTab.test.js
601
600
  - webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTab.test.js.snap
602
601
  - webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTabActions.test.js.snap
603
602
  - webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTabReducer.test.js.snap
@@ -663,6 +662,7 @@ homepage: https://github.com/theforeman/foreman_rh_cloud
663
662
  licenses:
664
663
  - GPL-3.0
665
664
  metadata: {}
665
+ post_install_message:
666
666
  rdoc_options: []
667
667
  require_paths:
668
668
  - lib
@@ -680,7 +680,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
680
680
  - !ruby/object:Gem::Version
681
681
  version: '0'
682
682
  requirements: []
683
- rubygems_version: 4.0.16
683
+ rubygems_version: 3.2.33
684
+ signing_key:
684
685
  specification_version: 4
685
686
  summary: Summary of ForemanRhCloud.
686
687
  test_files:
@@ -688,7 +689,6 @@ test_files:
688
689
  - test/controllers/insights_cloud/api/advisor_engine_controller_test.rb
689
690
  - test/controllers/insights_cloud/api/cloud_request_controller_test.rb
690
691
  - test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
691
- - test/controllers/insights_cloud/candlepin_proxies_extensions_test.rb
692
692
  - test/controllers/insights_cloud/ui_requests_controller_test.rb
693
693
  - test/controllers/insights_sync/settings_controller_test.rb
694
694
  - test/controllers/inventory_upload/api/inventory_controller_test.rb
@@ -704,7 +704,6 @@ test_files:
704
704
  - test/jobs/host_inventory_report_job_test.rb
705
705
  - test/jobs/insights_client_status_aging_test.rb
706
706
  - test/jobs/insights_full_sync_test.rb
707
- - test/jobs/insights_generate_notifications_test.rb
708
707
  - test/jobs/insights_resolutions_sync_test.rb
709
708
  - test/jobs/insights_rules_sync_test.rb
710
709
  - test/jobs/inventory_full_sync_test.rb
@@ -716,7 +715,6 @@ test_files:
716
715
  - test/jobs/single_host_report_job_test.rb
717
716
  - test/jobs/upload_report_direct_job_test.rb
718
717
  - test/models/insights_client_report_status_test.rb
719
- - test/models/inventory_sync/inventory_status_test.rb
720
718
  - test/test_plugin_helper.rb
721
719
  - test/unit/archived_report_generator_test.rb
722
720
  - test/unit/fact_helpers_test.rb
@@ -1,23 +0,0 @@
1
- module InsightsCloud
2
- module CandlepinProxiesExtensions
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- # Update insights client status when hosts check in via subscription-manager facts upload
7
- # rubocop:disable Rails/LexicallyScopedActionFilter
8
- after_action :update_insights_client_status, only: [:facts]
9
- # rubocop:enable Rails/LexicallyScopedActionFilter
10
- end
11
-
12
- def update_insights_client_status
13
- # Update InsightsClientReportStatus whenever host checks in via subscription-manager
14
- # This ensures USER_OMITTED status gets set even when insights-client isn't installed
15
- # (parameter=false means insights-client won't be installed, so it won't hit MachineTelemetriesController)
16
- hoststatus = @host.get_status(InsightsClientReportStatus)
17
- Rails.logger.debug "Current status: #{hoststatus.to_label}"
18
- @host.get_status(InsightsClientReportStatus).refresh!
19
- @host.refresh_global_status!
20
- Rails.logger.debug "New status: #{hoststatus.to_label}"
21
- end
22
- end
23
- end
@@ -1,70 +0,0 @@
1
- require 'test_plugin_helper'
2
-
3
- module InsightsCloud
4
- class CandlepinProxiesExtensionsTest < ActiveSupport::TestCase
5
- setup do
6
- @organization = FactoryBot.create(:organization)
7
- @host = FactoryBot.create(:host, :with_subscription, :managed, organization: @organization)
8
- end
9
-
10
- test 'updates InsightsClientReportStatus to USER_OMITTED when parameter is false' do
11
- # Set parameter to false so status should be USER_OMITTED
12
- FactoryBot.create(:common_parameter, name: 'host_registration_insights', key_type: 'boolean', value: false)
13
-
14
- # Simulate what the callback does
15
- @host.get_status(InsightsClientReportStatus).refresh!
16
- @host.refresh_global_status!
17
-
18
- # Verify the status was updated
19
- @host.reload
20
- insights_status = @host.get_status(InsightsClientReportStatus)
21
- assert insights_status.persisted?, 'InsightsClientReportStatus should be persisted'
22
- assert_equal InsightsClientReportStatus::USER_OMITTED, insights_status.status,
23
- 'Status should be USER_OMITTED when host_registration_insights=false'
24
- end
25
-
26
- test 'sets USER_OMITTED status when parameter is inherited from hostgroup' do
27
- # Create hostgroup with parameter
28
- hostgroup = FactoryBot.create(:hostgroup)
29
- hostgroup.group_parameters << GroupParameter.create(
30
- name: 'host_registration_insights',
31
- value: 'false',
32
- key_type: 'boolean'
33
- )
34
- hostgroup.save!
35
-
36
- @host.hostgroup = hostgroup
37
- @host.save!
38
-
39
- # Simulate what the callback does
40
- @host.get_status(InsightsClientReportStatus).refresh!
41
- @host.refresh_global_status!
42
-
43
- # Verify status respects inherited parameter
44
- @host.reload
45
- insights_status = @host.get_status(InsightsClientReportStatus)
46
- assert_equal InsightsClientReportStatus::USER_OMITTED, insights_status.status,
47
- 'Status should be USER_OMITTED when host_registration_insights=false is inherited from hostgroup'
48
- end
49
-
50
- test 'refreshes global status' do
51
- FactoryBot.create(:common_parameter, name: 'host_registration_insights', key_type: 'boolean', value: true)
52
-
53
- # Simulate what the callback does
54
- @host.get_status(InsightsClientReportStatus).refresh!
55
- @host.refresh_global_status!
56
-
57
- # Verify global status was updated
58
- @host.reload
59
- assert_not_nil @host.global_status, 'Global status should be set'
60
- end
61
-
62
- test 'CandlepinProxiesController includes the update_insights_client_status method' do
63
- # Verify the concern is included and method is available
64
- controller = Katello::Api::Rhsm::CandlepinProxiesController.new
65
-
66
- assert_respond_to controller, :update_insights_client_status,
67
- 'CandlepinProxiesController should have update_insights_client_status method from concern'
68
- end
69
- end
70
- end
@@ -1,26 +0,0 @@
1
- require 'test_plugin_helper'
2
- require 'foreman_tasks/test_helpers'
3
-
4
- class InsightsGenerateNotificationsTest < ActiveSupport::TestCase
5
- include Dynflow::Testing::Factories
6
-
7
- setup do
8
- User.current = User.find_by(login: 'secret_admin')
9
- end
10
-
11
- test 'skips notifications when foreman_host is nil' do
12
- ForemanRhCloud.stubs(:foreman_host).returns(nil)
13
-
14
- # Ensure blueprint exists or create it
15
- NotificationBlueprint.find_or_create_by(name: 'insights_satellite_hits') do |bp|
16
- bp.message = 'Test message'
17
- bp.level = 'info'
18
- bp.expires_in = 7.days
19
- end
20
-
21
- plan = ForemanTasks.sync_task(InsightsCloud::Async::InsightsGenerateNotifications)
22
-
23
- # Should not raise an error, task completes successfully
24
- assert_includes ['success', 'stopped'], plan.state, "Task should complete without error"
25
- end
26
- end
@@ -1,85 +0,0 @@
1
- require 'test_plugin_helper'
2
-
3
- module InventorySync
4
- class InventoryStatusTest < ActiveSupport::TestCase
5
- setup do
6
- @host = FactoryBot.create(:host, :managed)
7
- end
8
-
9
- test 'status constants are defined correctly' do
10
- assert_equal 0, InventorySync::InventoryStatus::DISCONNECT
11
- assert_equal 1, InventorySync::InventoryStatus::SYNC
12
- assert_equal 2, InventorySync::InventoryStatus::USER_OMITTED
13
- end
14
-
15
- test 'to_global returns OK for USER_OMITTED status' do
16
- status = @host.get_status(InventorySync::InventoryStatus)
17
- status.status = InventorySync::InventoryStatus::USER_OMITTED
18
- status.save!
19
-
20
- assert_equal HostStatus::Global::OK, status.to_global
21
- end
22
-
23
- test 'to_global returns WARN for DISCONNECT status' do
24
- status = @host.get_status(InventorySync::InventoryStatus)
25
- status.status = InventorySync::InventoryStatus::DISCONNECT
26
- status.save!
27
-
28
- assert_equal HostStatus::Global::WARN, status.to_global
29
- end
30
-
31
- test 'to_global returns OK for SYNC status' do
32
- status = @host.get_status(InventorySync::InventoryStatus)
33
- status.status = InventorySync::InventoryStatus::SYNC
34
- status.save!
35
-
36
- assert_equal HostStatus::Global::OK, status.to_global
37
- end
38
-
39
- test 'to_label returns appropriate messages for each status' do
40
- status = @host.get_status(InventorySync::InventoryStatus)
41
-
42
- # Test DISCONNECT label
43
- status.status = InventorySync::InventoryStatus::DISCONNECT
44
- status.save!
45
- label = status.to_label
46
- assert_match(/not present/, label.downcase)
47
- assert_match(/console\.redhat\.com/, label)
48
-
49
- # Test SYNC label
50
- status.status = InventorySync::InventoryStatus::SYNC
51
- status.save!
52
- label = status.to_label
53
- assert_match(/uploaded.*present/, label.downcase)
54
- assert_match(/console\.redhat\.com/, label)
55
-
56
- # Test USER_OMITTED label
57
- status.status = InventorySync::InventoryStatus::USER_OMITTED
58
- status.save!
59
- label = status.to_label
60
- assert_match(/excluded/, label.downcase)
61
- assert_match(/host parameter/, label.downcase)
62
- assert_match(/console\.redhat\.com/, label)
63
- end
64
-
65
- test 'relevant? returns true in regular (non-IoP) mode' do
66
- ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(false)
67
-
68
- status = @host.get_status(InventorySync::InventoryStatus)
69
- status.status = InventorySync::InventoryStatus::SYNC
70
- status.save!
71
-
72
- assert status.relevant?, 'Inventory status should be relevant in regular mode'
73
- end
74
-
75
- test 'relevant? returns false in IoP mode' do
76
- ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(true)
77
-
78
- status = @host.get_status(InventorySync::InventoryStatus)
79
- status.status = InventorySync::InventoryStatus::SYNC
80
- status.save!
81
-
82
- refute status.relevant?, 'Inventory status should NOT be relevant in IoP mode'
83
- end
84
- end
85
- end