foreman_rh_cloud 3.0.33 → 4.0.21.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_inventory_upload/reports_controller.rb +1 -3
  3. data/app/controllers/foreman_inventory_upload/tasks_controller.rb +13 -5
  4. data/app/controllers/foreman_inventory_upload/uploads_controller.rb +4 -4
  5. data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +7 -29
  6. data/app/controllers/insights_cloud/hits_controller.rb +3 -7
  7. data/app/models/insights_client_report_status.rb +22 -11
  8. data/app/services/foreman_rh_cloud/cloud_auth.rb +0 -16
  9. data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +17 -27
  10. data/app/services/foreman_rh_cloud/remediations_retriever.rb +4 -6
  11. data/app/subscribers/foreman_rh_cloud/insights_subscriber.rb +9 -0
  12. data/config/Gemfile.lock.gh_test +95 -93
  13. data/config/database.yml.example +2 -2
  14. data/config/routes.rb +1 -20
  15. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +1 -22
  16. data/lib/foreman_inventory_upload/generators/queries.rb +0 -1
  17. data/lib/foreman_inventory_upload/generators/slice.rb +5 -6
  18. data/lib/foreman_inventory_upload/generators/tags.rb +2 -11
  19. data/lib/foreman_inventory_upload.rb +1 -9
  20. data/lib/foreman_rh_cloud/engine.rb +10 -17
  21. data/lib/foreman_rh_cloud/version.rb +1 -1
  22. data/lib/foreman_rh_cloud.rb +1 -12
  23. data/lib/insights_cloud/async/insights_full_sync.rb +14 -9
  24. data/lib/insights_cloud/async/insights_resolutions_sync.rb +6 -13
  25. data/lib/insights_cloud/async/insights_rules_sync.rb +9 -13
  26. data/lib/inventory_sync/async/host_result.rb +5 -4
  27. data/lib/inventory_sync/async/inventory_full_sync.rb +10 -21
  28. data/lib/inventory_sync/async/inventory_hosts_sync.rb +3 -18
  29. data/lib/inventory_sync/async/inventory_scheduled_sync.rb +0 -12
  30. data/lib/inventory_sync/async/query_inventory_job.rb +5 -6
  31. data/lib/tasks/insights.rake +0 -15
  32. data/lib/tasks/rh_cloud_inventory.rake +1 -8
  33. data/package.json +3 -3
  34. data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +0 -41
  35. data/test/factories/inventory_upload_factories.rb +1 -1
  36. data/test/jobs/insights_full_sync_test.rb +0 -1
  37. data/test/jobs/insights_resolutions_sync_test.rb +1 -11
  38. data/test/jobs/insights_rules_sync_test.rb +0 -1
  39. data/test/jobs/inventory_full_sync_test.rb +2 -38
  40. data/test/models/insights_client_report_status_test.rb +72 -70
  41. data/test/test_plugin_helper.rb +0 -55
  42. data/test/unit/fact_helpers_test.rb +2 -2
  43. data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +3 -21
  44. data/test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb +0 -1
  45. data/test/unit/slice_generator_test.rb +27 -70
  46. data/test/unit/tags_generator_test.rb +0 -56
  47. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +0 -11
  48. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap +0 -11
  49. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +63 -28
  50. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +3 -2
  51. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js +19 -19
  52. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableActions.test.js.snap +14 -14
  53. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js +0 -1
  54. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.scss +0 -14
  55. data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap +13 -20
  56. data/webpack/InsightsCloudSync/InsightsCloudSync.js +1 -4
  57. data/webpack/InsightsCloudSync/InsightsCloudSyncActions.js +20 -44
  58. data/webpack/InsightsCloudSync/InsightsCloudSyncConstants.js +0 -2
  59. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +2 -2
  60. data/webpack/InsightsCloudSync/__tests__/__snapshots__/InsightsCloudSyncActions.test.js.snap +7 -11
  61. metadata +4 -32
  62. data/app/controllers/api/v2/rh_cloud/inventory_controller.rb +0 -50
  63. data/app/controllers/concerns/inventory_upload/report_actions.rb +0 -26
  64. data/app/controllers/concerns/inventory_upload/task_actions.rb +0 -25
  65. data/app/helpers/foreman_insights_deprecations_helper.rb +0 -9
  66. data/app/helpers/foreman_insights_host_helper.rb +0 -19
  67. data/app/overrides/old_plugin_deprecation.rb +0 -20
  68. data/app/services/foreman_rh_cloud/cloud_request.rb +0 -14
  69. data/app/services/foreman_rh_cloud/insights_status_cleaner.rb +0 -17
  70. data/config/package-lock.json.plugin +0 -32774
  71. data/db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb +0 -6
  72. data/lib/insights_cloud/async/insights_client_status_aging.rb +0 -23
  73. data/lib/inventory_sync/async/inventory_self_host_sync.rb +0 -39
  74. data/test/controllers/inventory_upload/api/inventory_controller_test.rb +0 -53
  75. data/test/jobs/insights_client_status_aging_test.rb +0 -33
  76. data/test/jobs/inventory_hosts_sync_test.rb +0 -283
  77. data/test/jobs/inventory_scheduled_sync_test.rb +0 -22
  78. data/test/jobs/inventory_self_host_sync_test.rb +0 -104
  79. data/test/unit/foreman_rh_cloud_self_host_test.rb +0 -28
  80. data/test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb +0 -31
  81. data/webpack/common/ForemanTasks/ForemanTasksActions.js +0 -64
  82. data/webpack/common/ForemanTasks/ForemanTasksHelpers.js +0 -7
  83. data/webpack/common/ForemanTasks/index.js +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f5ec744a85ab1dc41ab93fc5949cd4f86df921c6141848fd4a1f2de7d26e0f6
4
- data.tar.gz: a9754dcaa8eb46f7260bccd6ba6e4fb730793df4caf2dff18370e19f7a8a62cf
3
+ metadata.gz: 97882071192995f2da93032050b9ecdfa616dba407c8d032bfd29f6741ea9d56
4
+ data.tar.gz: 88bca49cea9ee2abac2d2dc9d608a33329ad9e214d57035424e8e24984691537
5
5
  SHA512:
6
- metadata.gz: a22b012bf970556113871948f939b034ca9a2487bd2bbb23118cbdfa475d46a4481a3f7b5934a49d2ca6871fb8fa3bd3d4ab2dd692f35024c7623f85491fa259
7
- data.tar.gz: 1153735dba9d5f08046e331e4b560620a9d463270942e919c32d5f1d1b36f2fe674d25b605af9681eeecb06deacbc9a3c04dcf6fe4a998bf3d23b53bb92ecfa5
6
+ metadata.gz: 67dd2ada55ac862b2d57ddf893e7408d002c40c2f89a141e6bf8c115d6eeee32d19b156e7668751f591665f948fa04d628719e5f6f5ab9e4609c02f0a14a93f4
7
+ data.tar.gz: 54ded7bb163e4a38cd3fa4a62dfe101484b98e87c016514b985190f77a07c7556e980dd8574dc5fb70cacb3fcc521a37a1f4f2325e5360cdbb2ddd6f38816804
@@ -2,8 +2,6 @@
2
2
 
3
3
  module ForemanInventoryUpload
4
4
  class ReportsController < ::ApplicationController
5
- include InventoryUpload::ReportActions
6
-
7
5
  def last
8
6
  label = ForemanInventoryUpload::Async::GenerateReportJob.output_label(params[:organization_id])
9
7
  output = ForemanInventoryUpload::Async::ProgressOutput.get(label)&.full_output
@@ -22,7 +20,7 @@ module ForemanInventoryUpload
22
20
  def generate
23
21
  organization_id = params[:organization_id]
24
22
 
25
- start_report_generation(organization_id)
23
+ ForemanInventoryUpload::Async::GenerateReportJob.perform_later(ForemanInventoryUpload.generated_reports_folder, organization_id)
26
24
 
27
25
  render json: {
28
26
  action_status: 'success',
@@ -1,17 +1,25 @@
1
1
  module ForemanInventoryUpload
2
2
  class TasksController < ::ApplicationController
3
- include InventoryUpload::TaskActions
4
-
5
3
  def create
6
4
  selected_org = Organization.current
5
+ subscribed_hosts_ids = Set.new(
6
+ ForemanInventoryUpload::Generators::Queries.for_slice(
7
+ Host.unscoped.where(organization: selected_org)
8
+ ).pluck(:id)
9
+ )
7
10
 
8
- task = start_inventory_sync(selected_org)
11
+ if subscribed_hosts_ids.empty?
12
+ return render json: {
13
+ message: N_('Nothing to sync, there are no hosts with subscription for this organization.'),
14
+ }, status: :method_not_allowed
15
+ else
16
+ task = ForemanTasks.async_task(InventorySync::Async::InventoryFullSync, selected_org)
17
+ end
18
+ return render json: { message: N_('there was an issue triggering the task') }, status: :internal_server_error unless task
9
19
 
10
20
  render json: {
11
21
  task: task,
12
22
  }, status: :ok
13
- rescue InventoryUpload::TaskActions::NothingToSyncError => error
14
- render json: { message: error.message }, status: :internal_server_error
15
23
  end
16
24
 
17
25
  def show
@@ -1,7 +1,5 @@
1
1
  module ForemanInventoryUpload
2
2
  class UploadsController < ::ApplicationController
3
- include InventoryUpload::ReportActions
4
-
5
3
  def last
6
4
  label = ForemanInventoryUpload::Async::UploadReportJob.output_label(params[:organization_id])
7
5
  output = ForemanInventoryUpload::Async::ProgressOutput.get(label)&.full_output
@@ -12,9 +10,11 @@ module ForemanInventoryUpload
12
10
  end
13
11
 
14
12
  def download_file
15
- filename, file = report_file(params[:organization_id])
13
+ filename = ForemanInventoryUpload.facts_archive_name(params[:organization_id])
14
+ files = Dir["{#{ForemanInventoryUpload.uploads_file_path(filename)},#{ForemanInventoryUpload.done_file_path(filename)}}"]
16
15
 
17
- send_file file, disposition: 'attachment', filename: filename
16
+ return send_file files.first, disposition: 'attachment', filename: filename unless files.empty?
17
+ raise ::Foreman::Exception.new("The report file doesn't exist")
18
18
  end
19
19
 
20
20
  def enable_cloud_connector
@@ -5,7 +5,6 @@ module InsightsCloud::Api
5
5
  include ::InsightsCloud::ClientAuthentication
6
6
  include ::InsightsCloud::CandlepinCache
7
7
 
8
- before_action :set_admin_user, only: [:forward_request]
9
8
  before_action :cert_uuid, :ensure_org, :ensure_branch_id, :only => [:forward_request, :branch_info]
10
9
  before_action :ensure_telemetry_enabled_for_consumer, :only => [:forward_request]
11
10
 
@@ -25,33 +24,14 @@ module InsightsCloud::Api
25
24
  }, status: :bad_gateway
26
25
  end
27
26
 
28
- if @cloud_response.code >= 300
29
- return render json: {
30
- :message => 'Cloud request failed',
31
- :headers => {},
32
- :response => @cloud_response,
33
- }, status: @cloud_response.code
27
+ if @cloud_response.headers[:content_disposition]
28
+ return send_data @cloud_response, disposition: @cloud_response.headers[:content_disposition], type: @cloud_response.headers[:content_type]
34
29
  end
35
30
 
36
- # Append redhat-specific headers
37
- @cloud_response.headers.each do |key, value|
38
- assign_header(response, @cloud_response, key, false) if key.to_s.start_with?('x_rh_')
39
- end
40
- # Append general headers
41
31
  assign_header(response, @cloud_response, :x_resource_count, true)
42
- headers[Rack::ETAG] = @cloud_response.headers[:etag]
32
+ assign_header(response, @cloud_response, :x_rh_insights_request_id, false)
43
33
 
44
- if @cloud_response.headers[:content_disposition]
45
- # If there is a Content-Disposition header, it means we are forwarding binary data, send the raw data with proper
46
- # content type
47
- send_data @cloud_response, disposition: @cloud_response.headers[:content_disposition], type: @cloud_response.headers[:content_type]
48
- elsif @cloud_response.headers[:content_type] =~ /zip/
49
- # if there is no Content-Disposition, but the content type is binary according the content type,
50
- # forward the request as binry too
51
- send_data @cloud_response, type: @cloud_response.headers[:content_type]
52
- else
53
- render json: @cloud_response, status: @cloud_response.code
54
- end
34
+ render json: @cloud_response, status: @cloud_response.code
55
35
  end
56
36
 
57
37
  def branch_info
@@ -95,11 +75,9 @@ module InsightsCloud::Api
95
75
  return unless request.path == '/redhat_access/r/insights/platform/ingress/v1/upload' ||
96
76
  request.path.include?('/redhat_access/r/insights/uploads/')
97
77
 
98
- return unless @cloud_response.code.to_s.start_with?('2')
99
-
100
- # create insights status if it wasn't there in the first place and refresh its reporting date
101
- @host.get_status(InsightsClientReportStatus).refresh!
102
- @host.refresh_global_status!
78
+ data = @cloud_response.code.to_s.start_with?('2')
79
+ host_status = @host.get_status(InsightsClientReportStatus)
80
+ host_status.update(reported_at: Time.now.utc, status: host_status.to_status(data: data))
103
81
  end
104
82
  end
105
83
  end
@@ -3,7 +3,7 @@ module InsightsCloud
3
3
  include Foreman::Controller::AutoCompleteSearch
4
4
 
5
5
  def index
6
- hits = resource_base_search_and_page.preload(:host, :rule)
6
+ hits = resource_base_search_and_page.where(host: Host.authorized).preload(:host, :rule)
7
7
 
8
8
  render json: {
9
9
  hasToken: !Setting[:rh_cloud_token].empty?,
@@ -23,9 +23,9 @@ module InsightsCloud
23
23
 
24
24
  def resolutions
25
25
  if remediation_all_selected_param
26
- hits = resource_base.with_playbook.search_for(params[:query])
26
+ hits = InsightsHit.with_playbook.search_for(params[:query])
27
27
  else
28
- hits = resource_base_search_and_page.with_playbook.where(id: remediation_ids_param)
28
+ hits = resource_base_search_and_page.where(id: remediation_ids_param)
29
29
  end
30
30
 
31
31
  hits.preload(:host, rule: :resolutions)
@@ -74,9 +74,5 @@ module InsightsCloud
74
74
  def remediation_all_selected_param
75
75
  ActiveModel::Type::Boolean.new.cast(params[:isAllSelected])
76
76
  end
77
-
78
- def resource_base
79
- super.where(host: Host.authorized)
80
- end
81
77
  end
82
78
  end
@@ -1,11 +1,10 @@
1
1
  class InsightsClientReportStatus < HostStatus::Status
2
2
  REPORT_INTERVAL = 48.hours
3
3
 
4
- REPORTING = 0
5
- NO_REPORT = 1
6
-
7
- scope :stale, -> { where.not(reported_at: (Time.now - REPORT_INTERVAL)..Time.now) }
8
- scope :reporting, -> { where(status: REPORTING) }
4
+ REPORTING = 0 # host_registration_insights = true & getting data
5
+ NO_REPORT = 1 # host_registration_insights = true & not getting data
6
+ NOT_MANAGED = 2 # host_registration_insights = false
7
+ NOT_MANAGED_WITH_DATA = 3 # host_registration_insights = false & getting data
9
8
 
10
9
  def self.status_name
11
10
  N_('Insights')
@@ -17,6 +16,10 @@ class InsightsClientReportStatus < HostStatus::Status
17
16
  N_('Reporting')
18
17
  when NO_REPORT
19
18
  N_('Not reporting')
19
+ when NOT_MANAGED
20
+ N_('Not reporting (not set by registration)')
21
+ when NOT_MANAGED_WITH_DATA
22
+ N_('Reporting (not set by registration)')
20
23
  end
21
24
  end
22
25
 
@@ -26,16 +29,20 @@ class InsightsClientReportStatus < HostStatus::Status
26
29
  ::HostStatus::Global::OK
27
30
  when NO_REPORT
28
31
  ::HostStatus::Global::ERROR
32
+ when NOT_MANAGED
33
+ ::HostStatus::Global::OK
34
+ when NOT_MANAGED_WITH_DATA
35
+ ::HostStatus::Global::WARN
29
36
  end
30
37
  end
31
38
 
32
- def to_status
33
- in_interval? ? REPORTING : NO_REPORT
34
- end
39
+ def to_status(data: false)
40
+ if insights_param
41
+ return REPORTING if data
42
+ return in_interval? ? REPORTING : NO_REPORT
43
+ end
35
44
 
36
- # prevent creation of the status on global refresh, but show it if the record already exists
37
- def relevant?(_options = {})
38
- persisted?
45
+ data ? NOT_MANAGED_WITH_DATA : NOT_MANAGED
39
46
  end
40
47
 
41
48
  private
@@ -44,4 +51,8 @@ class InsightsClientReportStatus < HostStatus::Status
44
51
  return false unless reported_at
45
52
  (Time.now.utc - reported_at).to_i < REPORT_INTERVAL.to_i
46
53
  end
54
+
55
+ def insights_param
56
+ host.host_params_hash.dig('host_registration_insights', :value)
57
+ end
47
58
  end
@@ -2,12 +2,6 @@ module ForemanRhCloud
2
2
  module CloudAuth
3
3
  extend ActiveSupport::Concern
4
4
 
5
- include CloudRequest
6
-
7
- def cloud_auth_available?
8
- Setting[:rh_cloud_token].present?
9
- end
10
-
11
5
  def rh_credentials
12
6
  @rh_credentials ||= query_refresh_token
13
7
  end
@@ -30,15 +24,5 @@ module ForemanRhCloud
30
24
  Foreman::Logging.exception('Unable to authenticate using rh_cloud_token setting', e)
31
25
  raise ::Foreman::WrappedException.new(e, N_('Unable to authenticate using rh_cloud_token setting'))
32
26
  end
33
-
34
- def execute_cloud_request(params)
35
- final_params = {
36
- headers: {
37
- Authorization: "Bearer #{rh_credentials}",
38
- },
39
- }.deep_merge(params)
40
-
41
- super(final_params)
42
- end
43
27
  end
44
28
  end
@@ -2,7 +2,7 @@ require 'rest-client'
2
2
 
3
3
  module ForemanRhCloud
4
4
  class CloudRequestForwarder
5
- include ForemanRhCloud::CloudRequest
5
+ include ::ForemanRhCloud::CloudAuth
6
6
 
7
7
  def forward_request(original_request, controller_name, branch_id, certs)
8
8
  forward_params = prepare_forward_params(original_request, branch_id)
@@ -17,24 +17,26 @@ module ForemanRhCloud
17
17
  logger.debug("Sending request to: #{request_opts[:url]}")
18
18
 
19
19
  execute_cloud_request(request_opts)
20
- rescue RestClient::Exception => error_response
21
- error_response.response
22
20
  end
23
21
 
24
22
  def prepare_request_opts(original_request, forward_payload, forward_params, certs)
25
23
  base_params = {
26
24
  method: original_request.method,
25
+ verify_ssl: ForemanRhCloud.verify_ssl_method,
27
26
  payload: forward_payload,
28
- headers: original_headers(original_request).merge(
29
- {
30
- params: forward_params,
31
- user_agent: http_user_agent(original_request),
32
- content_type: original_request.media_type.presence || original_request.format.to_s,
33
- }),
27
+ headers: {
28
+ params: forward_params,
29
+ user_agent: http_user_agent(original_request),
30
+ content_type: original_request.media_type,
31
+ },
34
32
  }
35
33
  base_params.merge(path_params(original_request.path, certs))
36
34
  end
37
35
 
36
+ def execute_cloud_request(request_opts)
37
+ RestClient::Request.execute request_opts
38
+ end
39
+
38
40
  def prepare_forward_payload(original_request, controller_name)
39
41
  forward_payload = original_request.request_parameters[controller_name]
40
42
 
@@ -59,15 +61,13 @@ module ForemanRhCloud
59
61
 
60
62
  def path_params(request_path, certs)
61
63
  case request_path
62
- when platform_request?
64
+ when metadata_request?
63
65
  {
64
- url: ForemanRhCloud.cert_base_url + request_path.sub('/redhat_access/r/insights/platform', '/api'),
65
- ssl_client_cert: OpenSSL::X509::Certificate.new(certs[:cert]),
66
- ssl_client_key: OpenSSL::PKey::RSA.new(certs[:key]),
66
+ url: ForemanRhCloud.base_url + request_path.sub('/redhat_access/r/insights', '/api'),
67
67
  }
68
- when connection_test_request?
68
+ when platform_request?
69
69
  {
70
- url: ForemanRhCloud.cert_base_url + '/api/apicast-tests/ping',
70
+ url: ForemanRhCloud.cert_base_url + request_path.sub('/redhat_access/r/insights/platform', '/api'),
71
71
  ssl_client_cert: OpenSSL::X509::Certificate.new(certs[:cert]),
72
72
  ssl_client_key: OpenSSL::PKey::RSA.new(certs[:key]),
73
73
  }
@@ -81,24 +81,14 @@ module ForemanRhCloud
81
81
  end
82
82
  end
83
83
 
84
- def original_headers(original_request)
85
- headers = {
86
- if_none_match: original_request.if_none_match,
87
- if_modified_since: original_request.if_modified_since,
88
- }.compact
89
-
90
- logger.debug("Sending headers: #{headers}")
91
- headers
84
+ def metadata_request?
85
+ ->(request_path) { request_path.include? '/static' }
92
86
  end
93
87
 
94
88
  def platform_request?
95
89
  ->(request_path) { request_path.include? '/platform' }
96
90
  end
97
91
 
98
- def connection_test_request?
99
- ->(request_path) { request_path =~ /redhat_access\/r\/insights\/?$/ }
100
- end
101
-
102
92
  def prepare_forward_cloud_url(base_url, request_path)
103
93
  cloud_path = request_path.sub('/redhat_access/r/insights/platform/', '')
104
94
  .sub('/redhat_access/r/insights/', '')
@@ -12,11 +12,6 @@ module ForemanRhCloud
12
12
  end
13
13
 
14
14
  def create_playbook
15
- unless cloud_auth_available?
16
- logger.debug('Cloud authentication is not available, cannot continue')
17
- return
18
- end
19
-
20
15
  response = query_playbook
21
16
 
22
17
  logger.debug("Got playbook response: #{response.body}")
@@ -67,11 +62,14 @@ module ForemanRhCloud
67
62
  end
68
63
 
69
64
  def query_playbook
70
- execute_cloud_request(
65
+ RestClient::Request.execute(
71
66
  method: :post,
72
67
  url: InsightsCloud.playbook_url,
68
+ verify_ssl: ForemanRhCloud.verify_ssl_method,
69
+ proxy: ForemanRhCloud.transformed_http_proxy_string(logger: logger),
73
70
  headers: {
74
71
  content_type: :json,
72
+ Authorization: "Bearer #{rh_credentials}",
75
73
  },
76
74
  payload: playbook_request.to_json
77
75
  )
@@ -0,0 +1,9 @@
1
+ module ForemanRhCloud
2
+ class InsightsSubscriber < ::Foreman::BaseSubscriber
3
+ def call(*args)
4
+ host = args.first.payload[:object]
5
+ host_status = host.get_status(InsightsClientReportStatus)
6
+ host_status.update(status: host_status.to_status)
7
+ end
8
+ end
9
+ end