foreman_rh_cloud 4.0.36 → 5.0.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/inventory_upload/report_actions.rb +1 -1
  3. data/app/controllers/foreman_inventory_upload/reports_controller.rb +1 -1
  4. data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +5 -16
  5. data/app/models/setting/rh_cloud.rb +0 -1
  6. data/app/models/task_output_line.rb +2 -0
  7. data/app/models/task_output_status.rb +2 -0
  8. data/app/services/foreman_rh_cloud/cloud_ping_service.rb +1 -4
  9. data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +5 -16
  10. data/config/package-lock.json.plugin +10551 -7500
  11. data/db/migrate/20211027000001_create_task_output.foreman_rh_cloud.rb +18 -0
  12. data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +11 -7
  13. data/lib/foreman_inventory_upload/async/generate_report_job.rb +24 -12
  14. data/lib/foreman_inventory_upload/async/progress_output.rb +5 -28
  15. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +20 -5
  16. data/lib/foreman_inventory_upload/async/shell_process.rb +17 -4
  17. data/lib/foreman_inventory_upload/async/upload_report_job.rb +22 -13
  18. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +1 -3
  19. data/lib/foreman_inventory_upload/generators/queries.rb +0 -1
  20. data/lib/foreman_inventory_upload/generators/tags.rb +1 -8
  21. data/lib/foreman_rh_cloud/engine.rb +12 -22
  22. data/lib/foreman_rh_cloud/version.rb +1 -1
  23. data/lib/insights_cloud/async/insights_scheduled_sync.rb +11 -7
  24. data/lib/inventory_sync/async/host_result.rb +5 -0
  25. data/lib/inventory_sync/async/inventory_full_sync.rb +9 -14
  26. data/lib/inventory_sync/async/inventory_hosts_sync.rb +6 -2
  27. data/lib/tasks/rh_cloud_inventory.rake +2 -2
  28. data/package.json +7 -12
  29. data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +0 -23
  30. data/test/controllers/inventory_upload/cloud_status_controller_test.rb +0 -2
  31. data/test/jobs/inventory_full_sync_test.rb +2 -28
  32. data/test/jobs/inventory_hosts_sync_test.rb +0 -15
  33. data/test/jobs/upload_report_job_test.rb +5 -3
  34. data/test/unit/fact_helpers_test.rb +2 -2
  35. data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +0 -19
  36. data/test/unit/services/foreman_rh_cloud/cloud_status_service_test.rb +0 -4
  37. data/test/unit/shell_process_job_test.rb +3 -1
  38. data/test/unit/slice_generator_test.rb +0 -12
  39. data/test/unit/tags_generator_test.rb +0 -15
  40. data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +8 -0
  41. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +17 -4
  42. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +29 -17
  43. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +58 -47
  44. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js +1 -1
  45. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +12 -10
  46. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap +10 -10
  47. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/__snapshots__/InventoryAutoUpload.test.js.snap +1 -1
  48. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +4 -1
  49. data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap +24 -13
  50. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +1 -1
  51. data/webpack/__mocks__/foremanReact/components/Head.js +11 -0
  52. data/webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap +1 -0
  53. metadata +7 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 224802f19d8eb36625b3d80121e6325d2733920417d1b45d229b448e20cd8164
4
- data.tar.gz: 3ffe588112a4638c952b7dc11786e811dd484aba2f013b03fd070b09cd5292d0
3
+ metadata.gz: 012fcceed18a6413326df32052bee870b299682bc114d5c3e59954bda33b2475
4
+ data.tar.gz: bb72b384fc54d6c19951c453c69b0ecaae5d26bf844fc85b4d4b56f04e1e76bd
5
5
  SHA512:
6
- metadata.gz: '08abdef66a17843cec33bf0a6fa84c689ecdceab413df010936c0b9b7226ce9b2ed00d1853c23838b49faa01a96ab86673d59554910ba78ebbfd654ecc439d8e'
7
- data.tar.gz: 3f432ee32d4d1e81b1f5dddccd98265be4e62422ca28a062264be78dd3ce3c58f657aae55dd572a27cc8d88c38ac8b6250f328f17d9951572340af694644259b
6
+ metadata.gz: 70904b446fce3a2ca3a794c418aaa1591f4276bd35d1636a629e7361b75c62163fc76ad45caa024752a763ef6a9e6344e979dff8f9e9a017c19ac878f667a649
7
+ data.tar.gz: 4fd0e25610e4848565178f19e5a3ffb1da2d9b1505cd604f18a9276bba931f6fea3fbbddcd6c1e375a9d655a4c0b506c3937d89e9e7899b4aed37ae05c72b542
@@ -11,7 +11,7 @@ module InventoryUpload
11
11
  end
12
12
 
13
13
  def start_report_generation(organization_id)
14
- ForemanInventoryUpload::Async::GenerateReportJob.perform_later(ForemanInventoryUpload.generated_reports_folder, organization_id)
14
+ ForemanTasks.async_task(ForemanInventoryUpload::Async::GenerateReportJob, ForemanInventoryUpload.generated_reports_folder, organization_id)
15
15
  end
16
16
 
17
17
  def report_file(organization_id)
@@ -7,7 +7,7 @@ module ForemanInventoryUpload
7
7
  def last
8
8
  label = ForemanInventoryUpload::Async::GenerateReportJob.output_label(params[:organization_id])
9
9
  output = ForemanInventoryUpload::Async::ProgressOutput.get(label)&.full_output
10
- task_label = ForemanInventoryUpload::Async::GenerateAllReportsJob.singleton_job_name
10
+ task_label = ForemanInventoryUpload::Async::GenerateAllReportsJob.name
11
11
  scheduled = ForemanTasks::Task.where(
12
12
  :label => task_label,
13
13
  :state => 'scheduled'
@@ -33,25 +33,14 @@ module InsightsCloud::Api
33
33
  }, status: @cloud_response.code
34
34
  end
35
35
 
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_')
36
+ if @cloud_response.headers[:content_disposition]
37
+ return send_data @cloud_response, disposition: @cloud_response.headers[:content_disposition], type: @cloud_response.headers[:content_type]
39
38
  end
40
- # Append general headers
39
+
41
40
  assign_header(response, @cloud_response, :x_resource_count, true)
42
- headers[Rack::ETAG] = @cloud_response.headers[:etag]
41
+ assign_header(response, @cloud_response, :x_rh_insights_request_id, false)
43
42
 
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
43
+ render json: @cloud_response, status: @cloud_response.code
55
44
  end
56
45
 
57
46
  def branch_info
@@ -12,7 +12,6 @@ class Setting::RhCloud < Setting
12
12
  end
13
13
 
14
14
  def self.default_settings
15
- return unless ActiveRecord::Base.connection.table_exists?('settings')
16
15
  [
17
16
  set('allow_auto_inventory_upload', N_('Enable automatic upload of your host inventory to the Red Hat cloud'), true, N_('Automatic inventory upload')),
18
17
  set('allow_auto_insights_sync', N_('Enable automatic synchronization of Insights recommendations from the Red Hat cloud'), false, N_('Synchronize recommendations Automatically')),
@@ -0,0 +1,2 @@
1
+ class TaskOutputLine < ApplicationRecord
2
+ end
@@ -0,0 +1,2 @@
1
+ class TaskOutputStatus < ApplicationRecord
2
+ end
@@ -39,9 +39,6 @@ module ForemanRhCloud
39
39
  certs = candlepin_id_cert(@org)
40
40
  return StandardError.new('certificate missing') unless certs
41
41
 
42
- cert_checker = Katello::UpstreamConnectionChecker.new(@org)
43
- cert_checker.assert_connection
44
-
45
42
  execute_cloud_request(
46
43
  method: :get,
47
44
  url: ForemanRhCloud.cert_base_url + "/api/apicast-tests/ping",
@@ -75,7 +72,7 @@ module ForemanRhCloud
75
72
  org,
76
73
  {
77
74
  success: cert_response.is_a?(RestClient::Response),
78
- error: (cert_response.is_a?(Exception) ? cert_response&.message || cert_response.inspect : nil),
75
+ error: (cert_response.is_a?(Exception) ? cert_response.inspect : nil),
79
76
  },
80
77
  ]
81
78
  end
@@ -25,12 +25,11 @@ module ForemanRhCloud
25
25
  base_params = {
26
26
  method: original_request.method,
27
27
  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
- }),
28
+ headers: {
29
+ params: forward_params,
30
+ user_agent: http_user_agent(original_request),
31
+ content_type: original_request.media_type,
32
+ },
34
33
  }
35
34
  base_params.merge(path_params(original_request.path, certs))
36
35
  end
@@ -81,16 +80,6 @@ module ForemanRhCloud
81
80
  end
82
81
  end
83
82
 
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
92
- end
93
-
94
83
  def platform_request?
95
84
  ->(request_path) { request_path.include? '/platform' }
96
85
  end