foreman_rh_cloud 11.4.0 → 12.1.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/controllers/api/v2/rh_cloud/inventory_controller.rb +2 -2
- data/app/controllers/concerns/inventory_upload/report_actions.rb +1 -1
- data/app/controllers/foreman_inventory_upload/accounts_controller.rb +2 -0
- data/app/controllers/foreman_inventory_upload/uploads_settings_controller.rb +2 -0
- data/app/services/foreman_rh_cloud/cloud_request.rb +4 -0
- data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +7 -1
- data/app/services/foreman_rh_cloud/rules_ingester.rb +12 -1
- data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +3 -3
- data/lib/foreman_inventory_upload/async/upload_report_job.rb +4 -4
- data/lib/foreman_inventory_upload/generators/queries.rb +2 -0
- data/lib/foreman_inventory_upload/generators/slice.rb +83 -42
- data/lib/foreman_inventory_upload.rb +5 -0
- data/lib/foreman_rh_cloud/engine.rb +15 -3
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/foreman_rh_cloud.rb +2 -0
- data/package.json +5 -5
- data/test/controllers/inventory_upload/api/inventory_controller_test.rb +1 -1
- data/test/jobs/upload_report_job_test.rb +1 -1
- data/test/unit/slice_generator_test.rb +212 -4
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +1 -7
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +1 -5
- data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +3 -3
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +5 -1
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/Dashboard.test.js.snap +2 -1
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/inventoryFilter.scss +1 -1
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/AdvancedSettingsConstants.js +27 -8
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js +11 -3
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.js +71 -10
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettingsSelectors.js +13 -1
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/MinimalInventoryDropdown.js +107 -0
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +9 -2
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js +8 -0
- data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +53 -9
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +5 -5
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +5 -4
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js +18 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +72 -58
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/PageDescription.test.js +61 -6
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +18 -6
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/ToolbarButtons.test.js +54 -6
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.fixtures.js +2 -0
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.js +8 -0
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/__snapshots__/ReportGenerate.test.js.snap +4 -2
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.js +1 -8
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/__snapshots__/ReportUpload.test.js.snap +4 -2
- data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js +47 -28
- data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +46 -8
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/InventoryAutoUpload.js +2 -7
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/__snapshots__/InventoryAutoUpload.test.js.snap +3 -16
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +5 -1
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +1 -1
- data/webpack/InsightsCloudSync/Components/InsightsTable/Pagination.js +7 -7
- data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +1 -1
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +5 -1
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationTableConstants.js +8 -1
- data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +8 -2
- data/webpack/InsightsCloudSync/InsightsCloudSync.scss +1 -1
- data/webpack/InsightsHostDetailsTab/InsightsTotalRiskChart.js +11 -2
- data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +5 -4
- data/webpack/common/DropdownToggle.js +2 -2
- data/webpack/common/Switcher/HelpLabel.js +1 -1
- data/webpack/common/Switcher/SwitcherPF4.js +11 -1
- data/webpack/common/Switcher/SwitcherPF4.scss +1 -1
- data/webpack/common/Switcher/__tests__/__snapshots__/HelpLabel.test.js.snap +2 -6
- data/webpack/common/table/EmptyState.js +25 -18
- metadata +4 -43
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/InventorySettings.test.js +0 -13
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettings.test.js.snap +0 -31
- data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +0 -89
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap +0 -62
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/__snapshots__/ToolbarButtons.test.js.snap +0 -10
- data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/__snapshots__/TabHeader.test.js.snap +0 -43
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/components/AdvancedSettings/AdvancedSettings.js +0 -72
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/components/AdvancedSettings/index.js +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc6fa218e9a87166dd1b6ea44dc00f52dc4a0ee28edaa6363bfd74fd0e93c17c
|
4
|
+
data.tar.gz: 80d9b1dcfa4a2e1589d2273b895360d237e84101d0e2a216a18ffc0d9259e14d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e76e623f5509cd2bedab0fcd8abf926d7380eee120d1c73fc7f3be32ec9fe97cfc3948f56e93436ac21431ec8a5f85b4f8f349d1fe5df05bcad9d4e043eb332
|
7
|
+
data.tar.gz: d6f0d6140787ba18bc69bcf4de2161795a4404530fd24bd4502c352d1e87e1d13bd447049b220901edc48f0fbb9fde78ce73b737dea5435fc841d70f6c1a38bf
|
@@ -18,10 +18,10 @@ module Api
|
|
18
18
|
|
19
19
|
api :POST, "/organizations/:organization_id/rh_cloud/report", N_("Start report generation")
|
20
20
|
param :organization_id, Integer, required: true, desc: N_("Set the current organization context for the request")
|
21
|
-
param :
|
21
|
+
param :no_upload, :bool, required: false, default: false, desc: N_('Generate the report, but do not upload')
|
22
22
|
def generate_report
|
23
23
|
organization_id = params[:organization_id]
|
24
|
-
disconnected = params[:
|
24
|
+
disconnected = params[:no_upload] || false
|
25
25
|
|
26
26
|
start_report_generation(organization_id, disconnected)
|
27
27
|
|
@@ -16,7 +16,7 @@ module InventoryUpload
|
|
16
16
|
|
17
17
|
def report_file(organization_id)
|
18
18
|
filename = ForemanInventoryUpload.facts_archive_name(organization_id)
|
19
|
-
files =
|
19
|
+
files = ForemanInventoryUpload.report_file_paths(organization_id)
|
20
20
|
|
21
21
|
raise ReportMissingError.new(filename: filename) if files.empty?
|
22
22
|
|
@@ -8,12 +8,14 @@ module ForemanInventoryUpload
|
|
8
8
|
labels.map do |id, label|
|
9
9
|
generate_report_status = status_for(id, ForemanInventoryUpload::Async::GenerateReportJob)
|
10
10
|
upload_report_status = status_for(id, ForemanInventoryUpload::Async::UploadReportJob)
|
11
|
+
report_file_paths = ForemanInventoryUpload.report_file_paths(id)
|
11
12
|
|
12
13
|
[
|
13
14
|
label,
|
14
15
|
{
|
15
16
|
generate_report_status: generate_report_status,
|
16
17
|
upload_report_status: upload_report_status,
|
18
|
+
report_file_paths: report_file_paths,
|
17
19
|
id: id,
|
18
20
|
},
|
19
21
|
]
|
@@ -2,7 +2,9 @@ module ForemanInventoryUpload
|
|
2
2
|
class UploadsSettingsController < ::ApplicationController
|
3
3
|
def index
|
4
4
|
render json: {
|
5
|
+
insightsMinimalDataCollection: Setting[:insights_minimal_data_collection],
|
5
6
|
autoUploadEnabled: Setting[:allow_auto_inventory_upload],
|
7
|
+
subscriptionConnectionEnabled: Setting[:subscription_connection_enabled],
|
6
8
|
hostObfuscationEnabled: Setting[:obfuscate_inventory_hostnames],
|
7
9
|
ipsObfuscationEnabled: Setting[:obfuscate_inventory_ips],
|
8
10
|
excludePackagesEnabled: Setting[:exclude_installed_packages],
|
@@ -8,6 +8,10 @@ module ForemanRhCloud
|
|
8
8
|
proxy: ForemanRhCloud.transformed_http_proxy_string,
|
9
9
|
}.deep_merge(params)
|
10
10
|
|
11
|
+
if ForemanRhCloud.with_local_advisor_engine?
|
12
|
+
final_params[:ssl_ca_file] ||= ForemanRhCloud.ca_cert
|
13
|
+
end
|
14
|
+
|
11
15
|
response = RestClient::Request.execute(final_params)
|
12
16
|
|
13
17
|
logger.debug("Response headers for request url #{final_params[:url]} are: #{response.headers}")
|
@@ -34,7 +34,13 @@ module ForemanRhCloud
|
|
34
34
|
),
|
35
35
|
}
|
36
36
|
requested_url = original_request.original_fullpath.end_with?('/') ? original_request.path + '/' : original_request.path
|
37
|
-
|
37
|
+
params = path_params(requested_url, certs)
|
38
|
+
|
39
|
+
if ForemanRhCloud.with_local_advisor_engine?
|
40
|
+
params[:ssl_ca_file] = ForemanRhCloud.ca_cert
|
41
|
+
end
|
42
|
+
|
43
|
+
base_params.merge(params)
|
38
44
|
end
|
39
45
|
|
40
46
|
def prepare_forward_payload(original_request, controller_name)
|
@@ -13,7 +13,18 @@ module ForemanRhCloud
|
|
13
13
|
|
14
14
|
def fetch_rules_data
|
15
15
|
advisor_url = "#{ForemanRhCloud.on_premise_url}/r/insights/v1/static/release/content.json"
|
16
|
-
|
16
|
+
uri = URI.parse(advisor_url)
|
17
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
18
|
+
http.use_ssl = true
|
19
|
+
|
20
|
+
# Set CA certificate
|
21
|
+
http.ca_file = ForemanRhCloud.ca_cert
|
22
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
23
|
+
|
24
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
25
|
+
|
26
|
+
response = http.request(request)
|
27
|
+
JSON.parse(response.body, symbolize_names: true)
|
17
28
|
end
|
18
29
|
|
19
30
|
def fetch_rules_and_resolutions
|
@@ -3,7 +3,7 @@ module ForemanInventoryUpload
|
|
3
3
|
class QueueForUploadJob < ::Actions::EntryAction
|
4
4
|
def plan(base_folder, report_file, organization_id, disconnected)
|
5
5
|
enqueue_task = plan_self(base_folder: base_folder, report_file: report_file)
|
6
|
-
plan_upload_report(enqueue_task.output[:enqueued_file_name], organization_id
|
6
|
+
plan_upload_report(enqueue_task.output[:enqueued_file_name], organization_id, disconnected)
|
7
7
|
end
|
8
8
|
|
9
9
|
def run
|
@@ -59,8 +59,8 @@ module ForemanInventoryUpload
|
|
59
59
|
input[:report_file]
|
60
60
|
end
|
61
61
|
|
62
|
-
def plan_upload_report(enqueued_file_name, organization_id)
|
63
|
-
plan_action(UploadReportJob, enqueued_file_name, organization_id)
|
62
|
+
def plan_upload_report(enqueued_file_name, organization_id, disconnected)
|
63
|
+
plan_action(UploadReportJob, enqueued_file_name, organization_id, disconnected)
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -7,15 +7,15 @@ module ForemanInventoryUpload
|
|
7
7
|
"upload_for_#{label}"
|
8
8
|
end
|
9
9
|
|
10
|
-
def plan(filename, organization_id)
|
10
|
+
def plan(filename, organization_id, disconnected = false)
|
11
11
|
label = UploadReportJob.output_label(organization_id)
|
12
|
-
super(label, filename: filename, organization_id: organization_id)
|
12
|
+
super(label, filename: filename, organization_id: organization_id, disconnected: disconnected)
|
13
13
|
end
|
14
14
|
|
15
15
|
def try_execute
|
16
16
|
if content_disconnected?
|
17
17
|
progress_output do |progress_output|
|
18
|
-
progress_output.write_line('Upload
|
18
|
+
progress_output.write_line('Upload canceled because connection to Insights is not enabled or the --no-upload option was passed.')
|
19
19
|
progress_output.status = "Task aborted, exit 1"
|
20
20
|
done!
|
21
21
|
end
|
@@ -78,7 +78,7 @@ module ForemanInventoryUpload
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def content_disconnected?
|
81
|
-
!Setting[:subscription_connection_enabled]
|
81
|
+
input[:disconnected] || !Setting[:subscription_connection_enabled]
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
@@ -50,56 +50,97 @@ module ForemanInventoryUpload
|
|
50
50
|
@stream.simple_field('success', ActiveModel::Type::Boolean.new.cast(fact_value(host, 'conversions::success')), :last)
|
51
51
|
end
|
52
52
|
|
53
|
+
def insights_minimal_data_collection(host)
|
54
|
+
@stream.simple_field('account', account_id(host.organization).to_s)
|
55
|
+
@stream.simple_field('subscription_manager_id', uuid_value!(host.subscription_facet&.uuid))
|
56
|
+
@stream.simple_field('insights_id', uuid_value(fact_value(host, 'insights_id')))
|
57
|
+
@stream.simple_field('bios_uuid', bios_uuid(host))
|
58
|
+
@stream.simple_field('bios_vendor', fact_value(host, 'dmi::bios::vendor'))
|
59
|
+
@stream.simple_field('bios_version', fact_value(host, 'dmi::bios::version'))
|
60
|
+
@stream.simple_field('arch', host.architecture&.name)
|
61
|
+
@stream.simple_field(
|
62
|
+
'infrastructure_type',
|
63
|
+
ActiveModel::Type::Boolean.new.cast(fact_value(host, 'virt::is_guest')) ? 'virtual' : 'physical'
|
64
|
+
)
|
65
|
+
@stream.object_field('system_profile') do
|
66
|
+
unless (installed_products = host.subscription_facet&.installed_products).empty?
|
67
|
+
@stream.array_field('installed_products') do
|
68
|
+
@stream.raw(installed_products.map do |product|
|
69
|
+
{
|
70
|
+
'name': product.name,
|
71
|
+
'id': product.cp_product_id,
|
72
|
+
}.to_json
|
73
|
+
end.join(', '))
|
74
|
+
end
|
75
|
+
end
|
76
|
+
@stream.simple_field('cores_per_socket', fact_value(host, 'cpu::core(s)_per_socket')) { |v| v.to_i } if fact_value(host, 'cpu::core(s)_per_socket').present?
|
77
|
+
@stream.simple_field('system_memory_bytes', fact_value(host, 'memory::memtotal')) { |v| kilobytes_to_bytes(v.to_i) } if fact_value(host, 'memory::memtotal').present?
|
78
|
+
@stream.simple_field('number_of_cpus', fact_value(host, 'cpu::cpu(s)')) { |v| v.to_i } if fact_value(host, 'cpu::cpu(s)').present?
|
79
|
+
@stream.simple_field('number_of_sockets', fact_value(host, 'cpu::cpu_socket(s)'), :last) { |v| v.to_i } if fact_value(host, 'cpu::cpu_socket(s)').present?
|
80
|
+
end
|
81
|
+
if host.subscription_facet.hypervisor?
|
82
|
+
@stream.simple_field('cpu_socket(s)', fact_value(host, 'cpu::cpu_socket(s)'))
|
83
|
+
@stream.simple_field('hypervisor_type', fact_value(host, 'hypervisor::type'))
|
84
|
+
@stream.simple_field('hypervisor_version', fact_value(host, 'hypervisor::version'), :last)
|
85
|
+
else
|
86
|
+
@stream.simple_field('cpu_socket(s)', fact_value(host, 'cpu::cpu_socket(s)'), :last)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
53
90
|
def report_host(host)
|
54
91
|
host_ips_cache = host_ips(host)
|
55
92
|
@stream.object do
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
@stream.
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
93
|
+
if Setting[:insights_minimal_data_collection]
|
94
|
+
insights_minimal_data_collection(host)
|
95
|
+
else
|
96
|
+
@stream.simple_field('fqdn', fqdn(host))
|
97
|
+
@stream.simple_field('account', account_id(host.organization).to_s)
|
98
|
+
@stream.simple_field('subscription_manager_id', uuid_value!(host.subscription_facet&.uuid))
|
99
|
+
@stream.simple_field('satellite_id', uuid_value!(host.subscription_facet&.uuid))
|
100
|
+
if host.subscription_facet&.convert2rhel_through_foreman.present?
|
101
|
+
@stream.object_field('conversions') do
|
102
|
+
@stream.object_field('source_os') do
|
103
|
+
@stream.simple_field('name', fact_value(host, 'conversions::source_os::name'))
|
104
|
+
@stream.simple_field('version', fact_value(host, 'conversions::source_os::version') || 'Unknown - Fact not reported', :last)
|
105
|
+
end
|
106
|
+
@stream.object_field('target_os') do
|
107
|
+
@stream.simple_field('name', fact_value(host, 'conversions::target_os::name'))
|
108
|
+
@stream.simple_field('version', fact_value(host, 'conversions::target_os::version') || 'Unknown - Fact not reported', :last)
|
109
|
+
end
|
110
|
+
report_conversions(host)
|
69
111
|
end
|
70
|
-
report_conversions(host)
|
71
112
|
end
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
report_system_profile(host, host_ips_cache)
|
80
|
-
end
|
81
|
-
@stream.array_field('facts') do
|
82
|
-
@stream.object do
|
83
|
-
@stream.simple_field('namespace', SATELLITE_NAMESPACE)
|
84
|
-
@stream.object_field('facts', :last) do
|
85
|
-
report_satellite_facts(host)
|
86
|
-
end
|
113
|
+
@stream.simple_field('bios_uuid', bios_uuid(host))
|
114
|
+
@stream.simple_field('vm_uuid', uuid_value(fact_value(host, 'virt::uuid')))
|
115
|
+
@stream.simple_field('insights_id', uuid_value(fact_value(host, 'insights_id')))
|
116
|
+
report_ip_addresses(host, host_ips_cache)
|
117
|
+
report_mac_addresses(host)
|
118
|
+
@stream.object_field('system_profile') do
|
119
|
+
report_system_profile(host, host_ips_cache)
|
87
120
|
end
|
88
|
-
end
|
89
121
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
122
|
+
@stream.array_field('facts') do
|
123
|
+
@stream.object do
|
124
|
+
@stream.simple_field('namespace', SATELLITE_NAMESPACE)
|
125
|
+
@stream.object_field('facts', :last) do
|
126
|
+
report_satellite_facts(host)
|
127
|
+
end
|
128
|
+
end
|
96
129
|
end
|
97
130
|
|
98
|
-
tags
|
99
|
-
|
100
|
-
|
101
|
-
key, value
|
102
|
-
|
131
|
+
@stream.array_field('tags', :last) do
|
132
|
+
tags_generator = Tags.new(host)
|
133
|
+
host_params_tags = tags_generator.generate_parameters
|
134
|
+
host_params_tags.each do |key, value|
|
135
|
+
report_tag(SATELLITE_PARAMS_NAMESPACE, key, value)
|
136
|
+
end
|
137
|
+
|
138
|
+
tags = tags_generator.generate
|
139
|
+
last_index = tags.count - 1
|
140
|
+
tags.each_with_index do |pair, index|
|
141
|
+
key, value = pair
|
142
|
+
report_tag(SATELLITE_NAMESPACE, key, value, index == last_index)
|
143
|
+
end
|
103
144
|
end
|
104
145
|
end
|
105
146
|
end
|
@@ -165,7 +206,7 @@ module ForemanInventoryUpload
|
|
165
206
|
end.join(', '))
|
166
207
|
end
|
167
208
|
end
|
168
|
-
|
209
|
+
if !Setting[:insights_minimal_data_collection] && !Setting[:exclude_installed_packages]
|
169
210
|
@stream.array_field('installed_packages') do
|
170
211
|
first = true
|
171
212
|
host.installed_packages.each do |package|
|
@@ -30,6 +30,11 @@ module ForemanInventoryUpload
|
|
30
30
|
File.join(ForemanInventoryUpload.done_folder, filename)
|
31
31
|
end
|
32
32
|
|
33
|
+
def self.report_file_paths(organization_id)
|
34
|
+
filename = facts_archive_name(organization_id)
|
35
|
+
Dir[ForemanInventoryUpload.uploads_file_path(filename), ForemanInventoryUpload.done_file_path(filename)]
|
36
|
+
end
|
37
|
+
|
33
38
|
def self.generated_reports_folder
|
34
39
|
@generated_reports_folder ||= ensure_folder(
|
35
40
|
File.join(
|
@@ -44,11 +44,12 @@ module ForemanRhCloud
|
|
44
44
|
setting('allow_auto_inventory_upload', type: :boolean, description: N_('Enable automatic upload of your host inventory to the Red Hat cloud'), default: true, full_name: N_('Automatic inventory upload'))
|
45
45
|
setting('allow_auto_insights_sync', type: :boolean, description: N_('Enable automatic synchronization of Insights recommendations from the Red Hat cloud'), default: true, full_name: N_('Synchronize recommendations Automatically'))
|
46
46
|
setting('allow_auto_insights_mismatch_delete', type: :boolean, description: N_('Enable automatic deletion of mismatched host records from the Red Hat cloud'), default: false, full_name: N_('Automatic mismatch deletion'))
|
47
|
-
setting('obfuscate_inventory_hostnames', type: :boolean, description: N_('Obfuscate host names sent to the Red Hat cloud'), default: false, full_name: N_('Obfuscate host names'))
|
48
|
-
setting('obfuscate_inventory_ips', type: :boolean, description: N_('Obfuscate ipv4 addresses sent to the Red Hat cloud'), default: false, full_name: N_('Obfuscate host ipv4 addresses'))
|
49
|
-
setting('exclude_installed_packages', type: :boolean, description: N_('Exclude installed packages from being uploaded to the Red Hat cloud'), default: false, full_name: N_("Exclude installed
|
47
|
+
setting('obfuscate_inventory_hostnames', type: :boolean, description: N_('Obfuscate host names sent to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored and host names are always obfuscated.)'), default: false, full_name: N_('Obfuscate host names'))
|
48
|
+
setting('obfuscate_inventory_ips', type: :boolean, description: N_('Obfuscate ipv4 addresses sent to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored and host ipv4 addresses are always obfuscated.)'), default: false, full_name: N_('Obfuscate host ipv4 addresses.'))
|
49
|
+
setting('exclude_installed_packages', type: :boolean, description: N_('Exclude installed packages from being uploaded to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored and installed packages are always excluded.)'), default: false, full_name: N_("Exclude installed packages"))
|
50
50
|
setting('include_parameter_tags', type: :boolean, description: N_('Should import include parameter tags from Foreman?'), default: false, full_name: N_('Include parameters in insights-client reports'))
|
51
51
|
setting('rhc_instance_id', type: :string, description: N_('RHC daemon id'), default: nil, full_name: N_('ID of the RHC(Yggdrasil) daemon'))
|
52
|
+
setting('insights_minimal_data_collection', type: :boolean, default: false, full_name: N_('Minimal data collection'), description: N_('Only send the minimum required data to Red Hat cloud, and obfuscate wherever possible. When this is true, hostnames and IPv4 addresses are always obfuscated and installed packages are excluded, regardless of those settings.'))
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
@@ -212,4 +213,15 @@ module ForemanRhCloud
|
|
212
213
|
def self.with_local_advisor_engine?
|
213
214
|
SETTINGS.dig(:foreman_rh_cloud, :use_local_advisor_engine) || false
|
214
215
|
end
|
216
|
+
|
217
|
+
def self.ca_cert
|
218
|
+
# The reference to candlepin ca_cert_file can be removed
|
219
|
+
# once the setting is dropped. Foreman 3.15 introduces
|
220
|
+
# a single CA file that bundles all CAs.
|
221
|
+
if ::SETTINGS.dig(:katello, :candlepin, :ca_cert_file)
|
222
|
+
::SETTINGS[:katello][:candlepin][:ca_cert_file]
|
223
|
+
else
|
224
|
+
::SETTINGS[:ssl_ca_file]
|
225
|
+
end
|
226
|
+
end
|
215
227
|
end
|
data/lib/foreman_rh_cloud.rb
CHANGED
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "foreman_rh_cloud",
|
3
|
-
"version": "
|
3
|
+
"version": "12.1.0",
|
4
4
|
"description": "Inventory Upload =============",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -19,13 +19,13 @@
|
|
19
19
|
"url": "http://projects.theforeman.org/projects/foreman_rh_cloud/issues"
|
20
20
|
},
|
21
21
|
"peerDependencies": {
|
22
|
-
"@theforeman/vendor": ">=
|
22
|
+
"@theforeman/vendor": ">= 15.0.1"
|
23
23
|
},
|
24
24
|
"devDependencies": {
|
25
25
|
"@babel/core": "^7.7.0",
|
26
|
-
"@theforeman/builder": ">=
|
27
|
-
"@theforeman/test": ">=
|
28
|
-
"@theforeman/eslint-plugin-foreman": ">=
|
26
|
+
"@theforeman/builder": ">= 15.0.1",
|
27
|
+
"@theforeman/test": ">= 15.0.1",
|
28
|
+
"@theforeman/eslint-plugin-foreman": ">= 15.0.1",
|
29
29
|
"babel-eslint": "~10.0.0",
|
30
30
|
"eslint": "~6.7.2",
|
31
31
|
"eslint-plugin-spellcheck": "~0.0.17",
|
@@ -14,7 +14,7 @@ module InventoryUpload::Api
|
|
14
14
|
.expects(:start_report_generation)
|
15
15
|
.with(@test_org.id.to_s, @disconnected)
|
16
16
|
|
17
|
-
post :generate_report, params: { organization_id: @test_org.id,
|
17
|
+
post :generate_report, params: { organization_id: @test_org.id, no_upload: @disconnected }
|
18
18
|
|
19
19
|
assert_response :success
|
20
20
|
end
|
@@ -18,7 +18,7 @@ class UploadReportJobTest < ActiveSupport::TestCase
|
|
18
18
|
|
19
19
|
label = ForemanInventoryUpload::Async::UploadReportJob.output_label(organization.id)
|
20
20
|
progress_output = ForemanInventoryUpload::Async::ProgressOutput.get(label)
|
21
|
-
assert_match(/Upload
|
21
|
+
assert_match(/Upload canceled/, progress_output.full_output)
|
22
22
|
assert_match(/exit 1/, progress_output.status)
|
23
23
|
end
|
24
24
|
|