foreman_rh_cloud 12.2.12 → 13.0.0

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +24 -78
  3. data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +24 -78
  4. data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +23 -77
  5. data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +23 -77
  6. data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +23 -77
  7. data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +3 -2
  8. data/app/models/insights_hit.rb +1 -1
  9. data/app/services/foreman_rh_cloud/cert_auth.rb +3 -13
  10. data/app/services/foreman_rh_cloud/gateway_request.rb +26 -0
  11. data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +1 -3
  12. data/app/services/foreman_rh_cloud/tags_auth.rb +1 -2
  13. data/lib/foreman_inventory_upload/async/generate_report_job.rb +8 -13
  14. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +4 -4
  15. data/lib/foreman_inventory_upload/async/upload_report_job.rb +5 -6
  16. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +2 -2
  17. data/lib/foreman_inventory_upload/generators/slice.rb +3 -3
  18. data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +1 -7
  19. data/lib/foreman_rh_cloud/engine.rb +15 -33
  20. data/lib/foreman_rh_cloud/plugin.rb +9 -9
  21. data/lib/foreman_rh_cloud/version.rb +1 -1
  22. data/lib/tasks/rh_cloud_inventory.rake +31 -14
  23. data/locale/foreman_rh_cloud.pot +157 -261
  24. data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  25. data/locale/fr/foreman_rh_cloud.po +26 -79
  26. data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  27. data/locale/ja/foreman_rh_cloud.po +26 -79
  28. data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  29. data/locale/ka/foreman_rh_cloud.po +24 -77
  30. data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  31. data/locale/ko/foreman_rh_cloud.po +25 -78
  32. data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  33. data/locale/zh_CN/foreman_rh_cloud.po +25 -78
  34. data/package.json +1 -1
  35. data/test/jobs/upload_report_job_test.rb +1 -2
  36. data/test/unit/fact_helpers_test.rb +0 -47
  37. data/test/unit/slice_generator_test.rb +0 -57
  38. data/webpack/ForemanRhCloudFills.js +2 -6
  39. data/webpack/ForemanRhCloudHelpers.js +0 -4
  40. data/webpack/InsightsHostDetailsTab/InsightsTab.scss +0 -4
  41. data/webpack/InsightsHostDetailsTab/InsightsTotalRiskChart.js +23 -59
  42. data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +16 -3
  43. data/webpack/InsightsVulnerabilityHostIndexExtensions/CVECountCell.js +2 -8
  44. data/webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js +2 -48
  45. data/webpack/__tests__/ForemanRhCloudHelpers.test.js +1 -16
  46. data/webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap +0 -6
  47. metadata +4 -10
  48. data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +0 -29
  49. data/lib/foreman_inventory_upload/async/generate_host_report.rb +0 -20
  50. data/lib/foreman_inventory_upload/async/host_inventory_report_job.rb +0 -39
  51. data/lib/foreman_inventory_upload/async/single_host_report_job.rb +0 -20
  52. data/test/jobs/queue_for_upload_job_test.rb +0 -63
  53. data/webpack/InsightsHostDetailsTab/__tests__/InsightsTotalRiskChart.test.js +0 -194
@@ -9,20 +9,22 @@ namespace :rh_cloud_inventory do
9
9
  else
10
10
  organizations = [Organization.where(:id => ENV['organization_id']).first]
11
11
  end
12
+ disconnected = ForemanRhCloud.with_iop_smart_proxy?
12
13
  User.as_anonymous_admin do
13
14
  organizations.each do |organization|
14
15
  ForemanTasks.async_task(
15
16
  ForemanInventoryUpload::Async::GenerateReportJob,
16
17
  ForemanInventoryUpload.generated_reports_folder,
17
- organization.id
18
+ organization.id,
19
+ disconnected
18
20
  )
19
21
  puts "Generated and uploaded inventory report for organization '#{organization.name}'"
20
22
  end
21
23
  end
22
24
  end
23
25
  desc 'Generate inventory report to be sent to Red Hat cloud'
24
- task generate: [:environment, 'dynflow:client'] do
25
- organization_ids = [ENV['organization_id']]
26
+ task generate: :environment do
27
+ organizations = [ENV['organization_id']]
26
28
  base_folder = ENV['target'] || Dir.pwd
27
29
  filter = ENV['hosts_filter']
28
30
 
@@ -32,22 +34,36 @@ namespace :rh_cloud_inventory do
32
34
  puts "Using #{base_folder} for the output"
33
35
  end
34
36
 
35
- if organization_ids.empty?
37
+ if organizations.empty?
36
38
  puts "Must specify organization_id"
37
39
  return
38
40
  end
39
41
 
40
42
  User.as_anonymous_admin do
41
- organization_ids.each do |organization_id|
42
- ForemanTasks.sync_task(
43
- ForemanInventoryUpload::Async::HostInventoryReportJob,
44
- base_folder,
45
- organization_id,
46
- filter,
47
- false # don't upload; the user ran report:generate and not report:generate_upload
48
- )
43
+ organizations.each do |organization|
44
+ target = File.join(base_folder, ForemanInventoryUpload.facts_archive_name(organization, filter))
45
+ archived_report_generator = ForemanInventoryUpload::Generators::ArchivedReport.new(target, Logger.new(STDOUT))
46
+ archived_report_generator.render(organization: organization, filter: filter)
47
+ puts "Successfully generated #{target} for organization id #{organization}"
48
+
49
+ next unless ForemanRhCloud.with_iop_smart_proxy?
50
+
51
+ puts 'Creating missing insights facets'
52
+ hosts_without_facets = ForemanInventoryUpload::Generators::Queries.for_org(organization, hosts_query: 'null? insights_uuid')
53
+ hosts_without_facets.each do |batch|
54
+ facets = batch.pluck(:id, 'katello_subscription_facets.uuid').map do |host_id, uuid|
55
+ {
56
+ host_id: host_id,
57
+ uuid: uuid,
58
+ }
59
+ end
60
+ # We don't need to validate the facets here as we create the necessary fields.
61
+ # rubocop:disable Rails/SkipsModelValidations
62
+ InsightsFacet.upsert_all(facets, unique_by: :host_id) unless facets.empty?
63
+ # rubocop:enable Rails/SkipsModelValidations
64
+ end
65
+ puts 'Missing Insights facets created'
49
66
  end
50
- puts "Check the Uploading tab for report uploading status." if Setting[:subscription_connection_enabled]
51
67
  end
52
68
  end
53
69
  desc 'Upload generated inventory report to Red Hat cloud'
@@ -55,7 +71,8 @@ namespace :rh_cloud_inventory do
55
71
  base_folder = ENV['target'] || ForemanInventoryUpload.generated_reports_folder
56
72
  organization_id = ENV['organization_id']
57
73
  report_file = ForemanInventoryUpload.facts_archive_name(organization_id)
58
- ForemanTasks.sync_task(ForemanInventoryUpload::Async::QueueForUploadJob, base_folder, report_file, organization_id)
74
+ disconnected = ForemanRhCloud.with_iop_smart_proxy?
75
+ ForemanTasks.sync_task(ForemanInventoryUpload::Async::QueueForUploadJob, base_folder, report_file, organization_id, disconnected)
59
76
  puts "Uploaded #{report_file}"
60
77
  end
61
78
  end