foreman_rh_cloud 11.0.1 → 11.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ad60942e47521d64a7a896a330d8d03471fc7d6fc6f54e29937fa619614846e
4
- data.tar.gz: 66e1f83283d36cf8e9d48d7719411c99cf027643453924fd7792580030c7e7ae
3
+ metadata.gz: 9feba25e71b2e6db50de3b2f32665a4889dce130fa44dcc7ef461116ba2abf62
4
+ data.tar.gz: ec6ce86e970247fab7b565831b414b2a15cb3e2e7ac2f678ccbbd2a43b6692d9
5
5
  SHA512:
6
- metadata.gz: 25b4d4e6a5503ae59fafd7c4a9d2ab61391a6fc7df458415f3b28eb19a9da411d086693aa1f130a97dd814ee4c3e1292628e82eff12f333b146eb2ecec930741
7
- data.tar.gz: a7327156fe02cd95ce112d1a3a8d4260f99cdca7af1e101f2b77a44d422d24be4424f873ac0da8e342f9b1d1e42b66d004404819addd8940da1d242386b4ce93
6
+ metadata.gz: d98ca68b9fde700bbc66dd6bdfad34bbd50d8d9b6558e47f9f2c13a538330b53bea3b319e4e9861c41884f9c6397b21c882de7a255bffab45c3a157196fe60e4
7
+ data.tar.gz: bbafd13720bb8e60ae2e9c2af9d8888cc231fcba509f046f76d5b3c560cb78642c7f8a12fbe6d9feb489fb6a11d955739568f9effb9447201e8411980f7a6989
@@ -33,7 +33,8 @@ module ForemanRhCloud
33
33
  }
34
34
  ),
35
35
  }
36
- base_params.merge(path_params(original_request.path, certs))
36
+ requested_url = original_request.original_fullpath.end_with?('/') ? original_request.path + '/' : original_request.path
37
+ base_params.merge(path_params(requested_url, certs))
37
38
  end
38
39
 
39
40
  def prepare_forward_payload(original_request, controller_name)
@@ -1,3 +1,5 @@
1
+ require "#{ForemanRhCloud::Engine.root}/lib/foreman_rh_cloud/version"
2
+
1
3
  Rails.autoloaders.main.ignore(
2
4
  ForemanRhCloud::Engine.root.join('lib/foreman_rh_cloud/version.rb')
3
5
  )
@@ -7,6 +7,7 @@ module ForemanInventoryUpload
7
7
  include ::ForemanRhCloud::Async::ExponentialBackoff
8
8
 
9
9
  def plan(instance_label, more_inputs = {})
10
+ clear_task_output(instance_label)
10
11
  inputs = more_inputs.merge(instance_label: instance_label)
11
12
  plan_self(inputs)
12
13
  end
@@ -53,6 +54,11 @@ module ForemanInventoryUpload
53
54
  Dynflow::Action::Rescue::Fail
54
55
  end
55
56
 
57
+ def clear_task_output(label)
58
+ TaskOutputLine.where(label: label).delete_all
59
+ TaskOutputStatus.where(label: label).delete_all
60
+ end
61
+
56
62
  private
57
63
 
58
64
  def preprocess_command(command)
@@ -28,6 +28,16 @@ module ForemanInventoryUpload
28
28
  'insights_client::hostname',
29
29
  'insights_client::ips',
30
30
  'insights_id',
31
+ 'conversions::activity',
32
+ 'conversions::packages::0::nevra',
33
+ 'conversions::packages::0::signature',
34
+ 'conversions::activity_started',
35
+ 'conversions::activity_ended',
36
+ 'conversions::success',
37
+ 'conversions::source_os::name',
38
+ 'conversions::source_os::version',
39
+ 'conversions::target_os::name',
40
+ 'conversions::target_os::version',
31
41
  ]).pluck(:name, :id)
32
42
  ]
33
43
  end
@@ -40,6 +40,16 @@ module ForemanInventoryUpload
40
40
  end
41
41
  end
42
42
 
43
+ def report_conversions(host)
44
+ @stream.simple_field('convert2rhel_through_foreman', host.subscription_facet&.convert2rhel_through_foreman)
45
+ @stream.simple_field('activity', fact_value(host, 'conversions::activity'))
46
+ @stream.simple_field('packages_0_nevra', fact_value(host, 'conversions::packages::0::nevra'))
47
+ @stream.simple_field('packages_0_signature', fact_value(host, 'conversions::packages::0::signature'))
48
+ @stream.simple_field('activity_started', fact_value(host, 'conversions::activity_started'))
49
+ @stream.simple_field('activity_ended', fact_value(host, 'conversions::activity_ended'))
50
+ @stream.simple_field('success', fact_value(host, 'conversions::success') || false, :last)
51
+ end
52
+
43
53
  def report_host(host)
44
54
  host_ips_cache = host_ips(host)
45
55
  @stream.object do
@@ -47,7 +57,19 @@ module ForemanInventoryUpload
47
57
  @stream.simple_field('account', account_id(host.organization).to_s)
48
58
  @stream.simple_field('subscription_manager_id', uuid_value!(host.subscription_facet&.uuid))
49
59
  @stream.simple_field('satellite_id', uuid_value!(host.subscription_facet&.uuid))
50
- @stream.simple_field('convert2rhel_through_foreman', host.subscription_facet&.convert2rhel_through_foreman)
60
+ if host.subscription_facet&.convert2rhel_through_foreman.present?
61
+ @stream.object_field('conversions') do
62
+ @stream.object_field('source_os') do
63
+ @stream.simple_field('name', fact_value(host, 'conversions::source_os::name'))
64
+ @stream.simple_field('version', fact_value(host, 'conversions::source_os::version') || 'Unknown - Fact not reported', :last)
65
+ end
66
+ @stream.object_field('target_os') do
67
+ @stream.simple_field('name', fact_value(host, 'conversions::target_os::name'))
68
+ @stream.simple_field('version', fact_value(host, 'conversions::target_os::version') || 'Unknown - Fact not reported', :last)
69
+ end
70
+ report_conversions(host)
71
+ end
72
+ end
51
73
  @stream.simple_field('bios_uuid', bios_uuid(host))
52
74
  @stream.simple_field('vm_uuid', uuid_value(fact_value(host, 'virt::uuid')))
53
75
  @stream.simple_field('insights_id', uuid_value(fact_value(host, 'insights_id')))
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '11.0.1'.freeze
2
+ VERSION = '11.0.3'.freeze
3
3
  end
@@ -28,6 +28,16 @@ module InventorySync
28
28
  output[:host_statuses] = host_statuses
29
29
  end
30
30
 
31
+ def clear_inventory_statuses_for_hosts_with_insights_false
32
+ host_ids_to_delete = Host.joins(:host_parameters).where(id: InventorySync::InventoryStatus.select(:host_id), host_parameters: { name: 'host_registration_insights', value: false })
33
+ if host_ids_to_delete.present?
34
+ InventorySync::InventoryStatus.where(host_id: host_ids_to_delete).delete_all
35
+ Host.where(id: host_ids_to_delete).find_each(&:refresh_global_status!)
36
+ else
37
+ logger.debug('No hosts with host_registration_insights set to false found')
38
+ end
39
+ end
40
+
31
41
  def update_statuses_batch
32
42
  results = yield
33
43
 
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "11.0.1",
3
+ "version": "11.0.3",
4
4
  "description": "Inventory Upload =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,12 +22,11 @@
22
22
  "@theforeman/vendor": ">= 10.1.1"
23
23
  },
24
24
  "devDependencies": {
25
- "@babel/core": "~7.7.0",
25
+ "@babel/core": "^7.7.0",
26
26
  "@theforeman/builder": ">= 10.1.1",
27
27
  "@theforeman/test": ">= 10.1.1",
28
28
  "@theforeman/eslint-plugin-foreman": ">= 10.1.1",
29
29
  "babel-eslint": "~10.0.0",
30
- "cosmiconfig-typescript-loader": "~4.3.0",
31
30
  "eslint": "~6.7.2",
32
31
  "eslint-plugin-spellcheck": "~0.0.17",
33
32
  "jed": "~1.1.1",
@@ -8,19 +8,19 @@ export const PageDescription = () => (
8
8
  <div id="inventory_page_description">
9
9
  <Text>
10
10
  {__(
11
- 'The Red Hat Hybrid Cloud Console provides a set of cloud services, including Red Hat Insights and Subscriptions, that provide predictive analysis, remediation of issues, and unified subscription reporting for this Satellite instance.'
11
+ 'The Red Hat Hybrid Cloud Console provides a set of cloud services, including Red Hat Insights and Subscriptions, that provide predictive analysis, remediation of issues, and unified subscription reporting for this Foreman instance.'
12
12
  )}
13
13
  </Text>
14
14
  <Text>
15
15
  {__(
16
- 'The Satellite inventory upload plugin automatically uploads Satellite host inventory data to the Inventory service of Insights, where it can also be used by the Subscriptions service for subscription reporting. If you use the Subscriptions service, enabling inventory uploads is required.'
16
+ 'The Foreman inventory upload plugin automatically uploads Foreman host inventory data to the Inventory service of Insights, where it can also be used by the Subscriptions service for subscription reporting. If you use the Subscriptions service, enabling inventory uploads is required.'
17
17
  )}
18
18
  </Text>
19
19
  <Text>
20
20
  <FormattedMessage
21
21
  id="enable-upload-hint"
22
22
  defaultMessage={__(
23
- 'To enable this reporting for all Satellite organizations, set {uploadButtonName} to on. The data will be reported automatically once per day.'
23
+ 'To enable this reporting for all Foreman organizations, set {uploadButtonName} to on. The data will be reported automatically once per day.'
24
24
  )}
25
25
  values={{
26
26
  uploadButtonName: <strong>{__('Automatic inventory upload')}</strong>,
@@ -42,7 +42,7 @@ export const PageDescription = () => (
42
42
  {__('For more information about the Subscriptions service, see:')}
43
43
  &nbsp;
44
44
  <a
45
- href="https://access.redhat.com/documentation/en-us/subscription_central/2020-04/html/getting_started_with_subscription_watch/assembly-about-subscriptionwatch"
45
+ href="https://docs.redhat.com/en/documentation/subscription_central/1-latest/html/getting_started_with_the_subscriptions_service/index"
46
46
  target="_blank"
47
47
  rel="noopener noreferrer"
48
48
  >
@@ -5,14 +5,14 @@ exports[`PageDescription rendering render without Props 1`] = `
5
5
  id="inventory_page_description"
6
6
  >
7
7
  <Text>
8
- The Red Hat Hybrid Cloud Console provides a set of cloud services, including Red Hat Insights and Subscriptions, that provide predictive analysis, remediation of issues, and unified subscription reporting for this Satellite instance.
8
+ The Red Hat Hybrid Cloud Console provides a set of cloud services, including Red Hat Insights and Subscriptions, that provide predictive analysis, remediation of issues, and unified subscription reporting for this Foreman instance.
9
9
  </Text>
10
10
  <Text>
11
- The Satellite inventory upload plugin automatically uploads Satellite host inventory data to the Inventory service of Insights, where it can also be used by the Subscriptions service for subscription reporting. If you use the Subscriptions service, enabling inventory uploads is required.
11
+ The Foreman inventory upload plugin automatically uploads Foreman host inventory data to the Inventory service of Insights, where it can also be used by the Subscriptions service for subscription reporting. If you use the Subscriptions service, enabling inventory uploads is required.
12
12
  </Text>
13
13
  <Text>
14
14
  <FormattedMessage
15
- defaultMessage="To enable this reporting for all Satellite organizations, set {uploadButtonName} to on. The data will be reported automatically once per day."
15
+ defaultMessage="To enable this reporting for all Foreman organizations, set {uploadButtonName} to on. The data will be reported automatically once per day."
16
16
  id="enable-upload-hint"
17
17
  values={
18
18
  Object {
@@ -40,7 +40,7 @@ exports[`PageDescription rendering render without Props 1`] = `
40
40
  For more information about the Subscriptions service, see:
41
41
   
42
42
  <a
43
- href="https://access.redhat.com/documentation/en-us/subscription_central/2020-04/html/getting_started_with_subscription_watch/assembly-about-subscriptionwatch"
43
+ href="https://docs.redhat.com/en/documentation/subscription_central/1-latest/html/getting_started_with_the_subscriptions_service/index"
44
44
  rel="noopener noreferrer"
45
45
  target="_blank"
46
46
  >
@@ -2,7 +2,8 @@ import React from 'react';
2
2
  import { addGlobalFill } from 'foremanReact/components/common/Fill/GlobalFill';
3
3
  import InventoryAutoUploadSwitcher from './ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload';
4
4
  import NewHostDetailsTab from './InsightsHostDetailsTab/NewHostDetailsTab';
5
- import InsightsTotalRiskCard from './InsightsHostDetailsTab/InsightsTotalRiskChart';
5
+ import { InsightsTotalRiskChartWrapper } from './InsightsHostDetailsTab/InsightsTotalRiskChartWrapper';
6
+ import { isNotRhelHost } from './ForemanRhCloudHelpers';
6
7
 
7
8
  const fills = [
8
9
  {
@@ -16,22 +17,27 @@ const fills = [
16
17
  name: 'Insights',
17
18
  component: props => <NewHostDetailsTab {...props} />,
18
19
  weight: 400,
20
+ metadata: {
21
+ hideTab: isNotRhelHost,
22
+ },
19
23
  },
20
24
  {
21
25
  slot: 'host-overview-cards',
22
26
  name: 'insights-total-risk-chart',
23
- component: props => <InsightsTotalRiskCard {...props} />,
27
+ component: props => <InsightsTotalRiskChartWrapper {...props} />,
24
28
  weight: 2800,
25
29
  },
26
30
  ];
27
31
 
28
32
  export const registerFills = () => {
29
- fills.forEach(({ slot, name, component: Component, weight }, index) =>
30
- addGlobalFill(
31
- slot,
32
- name,
33
- <Component key={`rh-cloud-fill-${index}`} />,
34
- weight
35
- )
33
+ fills.forEach(
34
+ ({ slot, name, component: Component, weight, metadata }, index) =>
35
+ addGlobalFill(
36
+ slot,
37
+ name,
38
+ <Component key={`rh-cloud-fill-${index}`} />,
39
+ weight,
40
+ metadata
41
+ )
36
42
  );
37
43
  };
@@ -4,3 +4,10 @@
4
4
  * should be imported once core moves it to the ReactApp folder.
5
5
  */
6
6
  export const foremanUrl = path => `${window.URL_PREFIX}${path}`;
7
+
8
+ export const isNotRhelHost = ({ hostDetails }) =>
9
+ // This regex tries matches sane variations of "RedHat", "RHEL" and "RHCOS"
10
+ !new RegExp('red[\\s\\-]?hat|rh[\\s\\-]?el|rhc[\\s\\-]?os', 'i').test(
11
+ // eslint-disable-next-line camelcase
12
+ hostDetails?.operatingsystem_name
13
+ );
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import InsightsTotalRiskChart from './InsightsTotalRiskChart';
4
+ import { isNotRhelHost } from '../ForemanRhCloudHelpers';
5
+
6
+ export const InsightsTotalRiskChartWrapper = props => {
7
+ if (props.status === 'RESOLVED') {
8
+ return (
9
+ !isNotRhelHost(props) && <InsightsTotalRiskChart {...props} /> // check for RHEL hosts
10
+ );
11
+ }
12
+ return null;
13
+ };
14
+
15
+ InsightsTotalRiskChartWrapper.propTypes = {
16
+ status: PropTypes.string,
17
+ hostDetails: PropTypes.object,
18
+ };
19
+
20
+ InsightsTotalRiskChartWrapper.defaultProps = {
21
+ status: 'PENDING',
22
+ hostDetails: {},
23
+ };
@@ -37,7 +37,7 @@ const NewHostDetailsTab = ({ hostName, router }) => {
37
37
 
38
38
  const dropdownItems = [
39
39
  <DropdownItem key="insights-link" ouiaId="insights-link">
40
- <a onClick={onSatInsightsClick}>{__('Go to Satellite Insights page')}</a>
40
+ <a onClick={onSatInsightsClick}>{__('Go to Foreman Insights page')}</a>
41
41
  </DropdownItem>,
42
42
  ];
43
43
 
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: 11.0.1
4
+ version: 11.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Red Hat Cloud team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-25 00:00:00.000000000 Z
11
+ date: 2024-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman_ansible
@@ -585,6 +585,7 @@ files:
585
585
  - webpack/InsightsHostDetailsTab/InsightsTabReducer.js
586
586
  - webpack/InsightsHostDetailsTab/InsightsTabSelectors.js
587
587
  - webpack/InsightsHostDetailsTab/InsightsTotalRiskChart.js
588
+ - webpack/InsightsHostDetailsTab/InsightsTotalRiskChartWrapper.js
588
589
  - webpack/InsightsHostDetailsTab/NewHostDetailsTab.js
589
590
  - webpack/InsightsHostDetailsTab/__tests__/InsightsTab.fixtures.js
590
591
  - webpack/InsightsHostDetailsTab/__tests__/InsightsTab.test.js
@@ -639,7 +640,7 @@ homepage: https://github.com/theforeman/foreman_rh_cloud
639
640
  licenses:
640
641
  - GPL-3.0
641
642
  metadata: {}
642
- post_install_message:
643
+ post_install_message:
643
644
  rdoc_options: []
644
645
  require_paths:
645
646
  - lib
@@ -657,8 +658,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
657
658
  - !ruby/object:Gem::Version
658
659
  version: '0'
659
660
  requirements: []
660
- rubygems_version: 3.3.27
661
- signing_key:
661
+ rubygems_version: 3.2.33
662
+ signing_key:
662
663
  specification_version: 4
663
664
  summary: Summary of ForemanRhCloud.
664
665
  test_files: