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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +24 -78
- data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +24 -78
- data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +23 -77
- data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +23 -77
- data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +23 -77
- data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +3 -2
- data/app/models/insights_hit.rb +1 -1
- data/app/services/foreman_rh_cloud/cert_auth.rb +3 -13
- data/app/services/foreman_rh_cloud/gateway_request.rb +26 -0
- data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +1 -3
- data/app/services/foreman_rh_cloud/tags_auth.rb +1 -2
- data/lib/foreman_inventory_upload/async/generate_report_job.rb +8 -13
- data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +4 -4
- data/lib/foreman_inventory_upload/async/upload_report_job.rb +5 -6
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +2 -2
- data/lib/foreman_inventory_upload/generators/slice.rb +3 -3
- data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +1 -7
- data/lib/foreman_rh_cloud/engine.rb +15 -33
- data/lib/foreman_rh_cloud/plugin.rb +9 -9
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/tasks/rh_cloud_inventory.rake +31 -14
- data/locale/foreman_rh_cloud.pot +157 -261
- data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/fr/foreman_rh_cloud.po +26 -79
- data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ja/foreman_rh_cloud.po +26 -79
- data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ka/foreman_rh_cloud.po +24 -77
- data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ko/foreman_rh_cloud.po +25 -78
- data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/zh_CN/foreman_rh_cloud.po +25 -78
- data/package.json +1 -1
- data/test/jobs/upload_report_job_test.rb +1 -2
- data/test/unit/fact_helpers_test.rb +0 -47
- data/test/unit/slice_generator_test.rb +0 -57
- data/webpack/ForemanRhCloudFills.js +2 -6
- data/webpack/ForemanRhCloudHelpers.js +0 -4
- data/webpack/InsightsHostDetailsTab/InsightsTab.scss +0 -4
- data/webpack/InsightsHostDetailsTab/InsightsTotalRiskChart.js +23 -59
- data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +16 -3
- data/webpack/InsightsVulnerabilityHostIndexExtensions/CVECountCell.js +2 -8
- data/webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js +2 -48
- data/webpack/__tests__/ForemanRhCloudHelpers.test.js +1 -16
- data/webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap +0 -6
- metadata +4 -10
- data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +0 -29
- data/lib/foreman_inventory_upload/async/generate_host_report.rb +0 -20
- data/lib/foreman_inventory_upload/async/host_inventory_report_job.rb +0 -39
- data/lib/foreman_inventory_upload/async/single_host_report_job.rb +0 -20
- data/test/jobs/queue_for_upload_job_test.rb +0 -63
- 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:
|
25
|
-
|
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
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
-
|
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
|