foreman_rh_cloud 4.0.23 → 4.0.25.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/foreman_inventory_upload/cloud_status_controller.rb +26 -0
- data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +15 -7
- data/app/controllers/insights_cloud/hits_controller.rb +0 -1
- data/app/models/insights_client_report_status.rb +11 -22
- data/app/services/foreman_rh_cloud/cloud_auth.rb +4 -0
- data/app/services/foreman_rh_cloud/cloud_ping_service.rb +83 -0
- data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +1 -9
- data/app/services/foreman_rh_cloud/insights_status_cleaner.rb +17 -0
- data/app/services/foreman_rh_cloud/remediations_retriever.rb +5 -0
- data/config/Gemfile.lock.gh_test +0 -8
- data/config/rh_cert-api_chain.pem +74 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb +6 -0
- data/lib/foreman_inventory_upload.rb +9 -1
- data/lib/foreman_inventory_upload/generators/queries.rb +1 -16
- data/lib/foreman_inventory_upload/generators/slice.rb +1 -0
- data/lib/foreman_inventory_upload/generators/tags.rb +3 -1
- data/lib/foreman_rh_cloud.rb +4 -0
- data/lib/foreman_rh_cloud/engine.rb +14 -12
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/insights_cloud.rb +4 -0
- data/lib/insights_cloud/async/insights_client_status_aging.rb +23 -0
- data/lib/insights_cloud/async/insights_full_sync.rb +5 -0
- data/lib/insights_cloud/async/insights_resolutions_sync.rb +9 -0
- data/lib/insights_cloud/async/insights_rules_sync.rb +5 -0
- data/lib/inventory_sync/async/host_result.rb +4 -0
- data/lib/inventory_sync/async/inventory_full_sync.rb +5 -0
- data/lib/inventory_sync/async/inventory_hosts_sync.rb +15 -0
- data/lib/inventory_sync/async/inventory_self_host_sync.rb +39 -0
- data/lib/inventory_sync/async/query_inventory_job.rb +5 -1
- data/lib/tasks/insights.rake +15 -0
- data/lib/tasks/rh_cloud_inventory.rake +2 -9
- data/package.json +2 -2
- data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +45 -0
- data/test/controllers/inventory_upload/cloud_status_controller_test.rb +44 -0
- data/test/jobs/insights_client_status_aging_test.rb +33 -0
- data/test/jobs/insights_full_sync_test.rb +1 -0
- data/test/jobs/insights_resolutions_sync_test.rb +1 -0
- data/test/jobs/insights_rules_sync_test.rb +1 -0
- data/test/jobs/inventory_full_sync_test.rb +10 -0
- data/test/jobs/inventory_hosts_sync_test.rb +3 -0
- data/test/jobs/inventory_self_host_sync_test.rb +104 -0
- data/test/models/insights_client_report_status_test.rb +70 -72
- data/test/test_plugin_helper.rb +53 -0
- data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +6 -37
- data/test/unit/services/foreman_rh_cloud/cloud_status_service_test.rb +66 -0
- data/test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb +31 -0
- data/test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb +1 -0
- data/test/unit/slice_generator_test.rb +15 -0
- data/test/unit/tags_generator_test.rb +41 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/__snapshots__/EmptyState.test.js.snap +1 -2
- data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.js +3 -1
- data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/__snapshots__/FileDownload.test.js.snap +2 -1
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +1 -2
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterConstants.js +3 -1
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.scss +0 -4
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +12 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +10 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js +144 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.scss +5 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Modal.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js +4 -3
- data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +2 -0
- data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/InventoryAutoUpload.js +3 -1
- data/webpack/InsightsCloudSync/Components/InsightsHeader/InsightsHeader.scss +5 -1
- data/webpack/InsightsCloudSync/Components/InsightsHeader/index.js +6 -4
- data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettings.js +9 -5
- data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettings.test.js.snap +6 -6
- data/webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss +0 -14
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +4 -22
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +25 -4
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js +0 -3
- data/webpack/InsightsCloudSync/Components/InsightsTable/Pagination.js +51 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js +1 -1
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +3 -68
- data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +10 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +11 -10
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.scss +14 -0
- data/webpack/InsightsCloudSync/Components/RemediationModal/index.js +0 -2
- data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +32 -0
- data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap +5 -4
- data/webpack/InsightsCloudSync/InsightsCloudSync.js +17 -13
- data/webpack/InsightsCloudSync/InsightsCloudSync.scss +82 -2
- data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +15 -6
- data/webpack/InsightsHostDetailsTab/InsightsTab.js +3 -2
- data/webpack/InsightsHostDetailsTab/InsightsTab.scss +4 -4
- data/webpack/InsightsHostDetailsTab/components/ListItem/ListItem.js +9 -7
- data/webpack/common/Switcher/SwitcherPF4.js +1 -1
- data/webpack/common/Switcher/SwitcherPF4.scss +6 -7
- data/webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap +1 -1
- metadata +23 -24
- data/app/subscribers/foreman_rh_cloud/insights_subscriber.rb +0 -9
- data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.fixtures.js +0 -1
- data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.js +0 -45
- data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/InsightsSyncSwitcher.test.js +0 -17
- data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/__snapshots__/InsightsSyncSwitcher.test.js.snap +0 -38
- data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/index.js +0 -1
- data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/insightsSyncSwitcher.scss +0 -3
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf14938ab96483d5b90b699ad095664ccda999db645f3d0e4b868b8e6066f268
|
4
|
+
data.tar.gz: 90062d9c4bf632a9d856d17e16639d6920e6a9b9d0bbad1334202041122fd19f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46eb0bfffd3853da3d4d0254756469e07f6f690166e96732bcb77a027d9cf3370cbe3d3f72e59a801cf85338fd2b2a042e45dd4a74907df3b66969a1006cb8c8
|
7
|
+
data.tar.gz: 1464b0f05e778e6b0a002114175b0c0a3f95b51c78af5fecd00395c42d6cd4196dffb0362724bcc62989403500e9994afe9012552e6e0ad00f0c0fe8f2e2fc5e
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ForemanInventoryUpload
|
2
|
+
class CloudStatusController < ::ApplicationController
|
3
|
+
def index
|
4
|
+
organizations = User.current.my_organizations
|
5
|
+
|
6
|
+
ping_service = ForemanRhCloud::CloudPingService.new(organizations, logger)
|
7
|
+
ping_result = ping_service.ping
|
8
|
+
ping_result[:cert_auth] = ping_result[:cert_auth].map do |org, status_hash|
|
9
|
+
status_hash.merge(
|
10
|
+
{
|
11
|
+
org_id: org.id,
|
12
|
+
org_name: org.name,
|
13
|
+
}
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
render json: {
|
18
|
+
ping: ping_result,
|
19
|
+
}, status: :ok
|
20
|
+
end
|
21
|
+
|
22
|
+
def logger
|
23
|
+
Foreman::Logging.logger('app')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -49,13 +49,19 @@ module InsightsCloud::Api
|
|
49
49
|
private
|
50
50
|
|
51
51
|
def ensure_telemetry_enabled_for_consumer
|
52
|
-
|
52
|
+
unless (config = telemetry_config(@host))
|
53
|
+
logger.debug("Rejected telemetry forwarding for host #{@host.name}, insights param is set to: #{config}")
|
54
|
+
render_message 'Telemetry is not enabled for this host', :status => 403
|
55
|
+
end
|
56
|
+
config
|
53
57
|
end
|
54
58
|
|
55
|
-
def telemetry_config
|
56
|
-
|
57
|
-
|
59
|
+
def telemetry_config(host)
|
60
|
+
param_value = nil
|
61
|
+
User.as_anonymous_admin do
|
62
|
+
param_value = host.host_param(InsightsCloud.enable_client_param)
|
58
63
|
end
|
64
|
+
param_value
|
59
65
|
end
|
60
66
|
|
61
67
|
def cert_uuid
|
@@ -76,9 +82,11 @@ module InsightsCloud::Api
|
|
76
82
|
return unless request.path == '/redhat_access/r/insights/platform/ingress/v1/upload' ||
|
77
83
|
request.path.include?('/redhat_access/r/insights/uploads/')
|
78
84
|
|
79
|
-
|
80
|
-
|
81
|
-
|
85
|
+
return unless @cloud_response.code.to_s.start_with?('2')
|
86
|
+
|
87
|
+
# create insights status if it wasn't there in the first place and refresh its reporting date
|
88
|
+
@host.get_status(InsightsClientReportStatus).refresh!
|
89
|
+
@host.refresh_global_status!
|
82
90
|
end
|
83
91
|
end
|
84
92
|
end
|
@@ -9,7 +9,6 @@ module InsightsCloud
|
|
9
9
|
hasToken: !Setting[:rh_cloud_token].empty?,
|
10
10
|
hits: hits.map { |hit| hit.attributes.merge(hostname: hit.host&.name, has_playbook: hit.has_playbook?) },
|
11
11
|
itemCount: hits.count,
|
12
|
-
isExperimentalMode: Setting[:lab_features],
|
13
12
|
}, status: :ok
|
14
13
|
end
|
15
14
|
|
@@ -1,10 +1,11 @@
|
|
1
1
|
class InsightsClientReportStatus < HostStatus::Status
|
2
2
|
REPORT_INTERVAL = 48.hours
|
3
3
|
|
4
|
-
REPORTING = 0
|
5
|
-
NO_REPORT = 1
|
6
|
-
|
7
|
-
|
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) }
|
8
9
|
|
9
10
|
def self.status_name
|
10
11
|
N_('Insights')
|
@@ -16,10 +17,6 @@ class InsightsClientReportStatus < HostStatus::Status
|
|
16
17
|
N_('Reporting')
|
17
18
|
when NO_REPORT
|
18
19
|
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)')
|
23
20
|
end
|
24
21
|
end
|
25
22
|
|
@@ -29,20 +26,16 @@ class InsightsClientReportStatus < HostStatus::Status
|
|
29
26
|
::HostStatus::Global::OK
|
30
27
|
when NO_REPORT
|
31
28
|
::HostStatus::Global::ERROR
|
32
|
-
when NOT_MANAGED
|
33
|
-
::HostStatus::Global::OK
|
34
|
-
when NOT_MANAGED_WITH_DATA
|
35
|
-
::HostStatus::Global::WARN
|
36
29
|
end
|
37
30
|
end
|
38
31
|
|
39
|
-
def to_status
|
40
|
-
|
41
|
-
|
42
|
-
return in_interval? ? REPORTING : NO_REPORT
|
43
|
-
end
|
32
|
+
def to_status
|
33
|
+
in_interval? ? REPORTING : NO_REPORT
|
34
|
+
end
|
44
35
|
|
45
|
-
|
36
|
+
# prevent creation of the status on global refresh, but show it if the record already exists
|
37
|
+
def relevant?(_options = {})
|
38
|
+
persisted?
|
46
39
|
end
|
47
40
|
|
48
41
|
private
|
@@ -51,8 +44,4 @@ class InsightsClientReportStatus < HostStatus::Status
|
|
51
44
|
return false unless reported_at
|
52
45
|
(Time.now.utc - reported_at).to_i < REPORT_INTERVAL.to_i
|
53
46
|
end
|
54
|
-
|
55
|
-
def insights_param
|
56
|
-
host.host_params_hash.dig('host_registration_insights', :value)
|
57
|
-
end
|
58
47
|
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
|
3
|
+
module ForemanRhCloud
|
4
|
+
class CloudPingService
|
5
|
+
class TokenPing
|
6
|
+
include ForemanRhCloud::CloudAuth
|
7
|
+
|
8
|
+
attr_accessor :logger
|
9
|
+
|
10
|
+
def initialize(logger)
|
11
|
+
@logger = logger
|
12
|
+
end
|
13
|
+
|
14
|
+
def ping
|
15
|
+
execute_cloud_request(
|
16
|
+
method: :get,
|
17
|
+
url: ForemanRhCloud.base_url + "/api/inventory/v1/hosts?per_page=1",
|
18
|
+
headers: {
|
19
|
+
content_type: :json,
|
20
|
+
}
|
21
|
+
)
|
22
|
+
rescue StandardError => ex
|
23
|
+
ex
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class CertPing
|
28
|
+
include ForemanRhCloud::CloudRequest
|
29
|
+
include InsightsCloud::CandlepinCache
|
30
|
+
|
31
|
+
attr_accessor :logger
|
32
|
+
|
33
|
+
def initialize(org, logger)
|
34
|
+
@org = org
|
35
|
+
@logger = logger
|
36
|
+
end
|
37
|
+
|
38
|
+
def ping
|
39
|
+
certs = candlepin_id_cert(@org)
|
40
|
+
return StandardError.new('certificate missing') unless certs
|
41
|
+
|
42
|
+
execute_cloud_request(
|
43
|
+
method: :get,
|
44
|
+
url: ForemanRhCloud.cert_base_url + "/api/apicast-tests/ping",
|
45
|
+
headers: {
|
46
|
+
content_type: :json,
|
47
|
+
},
|
48
|
+
ssl_client_cert: OpenSSL::X509::Certificate.new(certs[:cert]),
|
49
|
+
ssl_client_key: OpenSSL::PKey::RSA.new(certs[:key])
|
50
|
+
)
|
51
|
+
rescue StandardError => ex
|
52
|
+
ex
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def initialize(organizations, logger)
|
57
|
+
@organizations = organizations
|
58
|
+
@logger = logger
|
59
|
+
end
|
60
|
+
|
61
|
+
def ping
|
62
|
+
token_response = TokenPing.new(@logger).ping
|
63
|
+
{
|
64
|
+
token_auth: {
|
65
|
+
success: token_response.is_a?(RestClient::Response),
|
66
|
+
error: (token_response.is_a?(Exception) ? token_response.inspect : nil),
|
67
|
+
},
|
68
|
+
cert_auth: Hash[
|
69
|
+
@organizations.map do |org|
|
70
|
+
cert_response = CertPing.new(org, @logger).ping
|
71
|
+
[
|
72
|
+
org,
|
73
|
+
{
|
74
|
+
success: cert_response.is_a?(RestClient::Response),
|
75
|
+
error: (cert_response.is_a?(Exception) ? cert_response.inspect : nil),
|
76
|
+
},
|
77
|
+
]
|
78
|
+
end
|
79
|
+
],
|
80
|
+
}
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -56,10 +56,6 @@ module ForemanRhCloud
|
|
56
56
|
|
57
57
|
def path_params(request_path, certs)
|
58
58
|
case request_path
|
59
|
-
when metadata_request?
|
60
|
-
{
|
61
|
-
url: ForemanRhCloud.base_url + request_path.sub('/redhat_access/r/insights', '/api'),
|
62
|
-
}
|
63
59
|
when platform_request?
|
64
60
|
{
|
65
61
|
url: ForemanRhCloud.cert_base_url + request_path.sub('/redhat_access/r/insights/platform', '/api'),
|
@@ -71,15 +67,11 @@ module ForemanRhCloud
|
|
71
67
|
url: ForemanRhCloud.legacy_insights_url + request_path.sub('/redhat_access/r/insights', '/r/insights'),
|
72
68
|
ssl_client_cert: OpenSSL::X509::Certificate.new(certs[:cert]),
|
73
69
|
ssl_client_key: OpenSSL::PKey::RSA.new(certs[:key]),
|
74
|
-
ssl_ca_file:
|
70
|
+
ssl_ca_file: ForemanRhCloud.legacy_insights_ca,
|
75
71
|
}
|
76
72
|
end
|
77
73
|
end
|
78
74
|
|
79
|
-
def metadata_request?
|
80
|
-
->(request_path) { request_path.include? '/static' }
|
81
|
-
end
|
82
|
-
|
83
75
|
def platform_request?
|
84
76
|
->(request_path) { request_path.include? '/platform' }
|
85
77
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ForemanRhCloud
|
2
|
+
class InsightsStatusCleaner
|
3
|
+
def clean(host_search)
|
4
|
+
host_ids = Host.search_for(host_search).pluck(:id)
|
5
|
+
|
6
|
+
# delete all insights status records for the hosts
|
7
|
+
deleted_count = InsightsClientReportStatus.where(host_id: host_ids).delete_all
|
8
|
+
|
9
|
+
# refresh global status
|
10
|
+
Host.where(id: host_ids).preload(:host_statuses).find_in_batches do |hosts|
|
11
|
+
hosts.each { |host| host.refresh_global_status! }
|
12
|
+
end
|
13
|
+
|
14
|
+
deleted_count
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -12,6 +12,11 @@ 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
|
+
|
15
20
|
response = query_playbook
|
16
21
|
|
17
22
|
logger.debug("Got playbook response: #{response.body}")
|
data/config/Gemfile.lock.gh_test
CHANGED
@@ -4,7 +4,6 @@ PATH
|
|
4
4
|
foreman_rh_cloud (3.0.15)
|
5
5
|
foreman_ansible
|
6
6
|
katello
|
7
|
-
redhat_access
|
8
7
|
|
9
8
|
PATH
|
10
9
|
remote: ../katello
|
@@ -541,13 +540,6 @@ GEM
|
|
541
540
|
rdoc (6.3.0)
|
542
541
|
record_tag_helper (1.0.1)
|
543
542
|
actionview (>= 5)
|
544
|
-
redhat_access (2.2.18)
|
545
|
-
angular-rails-templates (>= 0.0.4)
|
546
|
-
foreman-tasks
|
547
|
-
katello
|
548
|
-
redhat_access_lib (>= 1.1.5)
|
549
|
-
redhat_access_lib (1.1.5)
|
550
|
-
rest-client (>= 1.6.3)
|
551
543
|
redis (4.1.4)
|
552
544
|
regexp_parser (1.8.2)
|
553
545
|
representable (3.0.4)
|
@@ -0,0 +1,74 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIHZDCCBUygAwIBAgIJAOb+QiglyeZeMA0GCSqGSIb3DQEBBQUAMIGwMQswCQYD
|
3
|
+
VQQGEwJVUzEXMBUGA1UECAwOTm9ydGggQ2Fyb2xpbmExEDAOBgNVBAcMB1JhbGVp
|
4
|
+
Z2gxFjAUBgNVBAoMDVJlZCBIYXQsIEluYy4xGDAWBgNVBAsMD1JlZCBIYXQgTmV0
|
5
|
+
d29yazEeMBwGA1UEAwwVRW50aXRsZW1lbnQgTWFzdGVyIENBMSQwIgYJKoZIhvcN
|
6
|
+
AQkBFhVjYS1zdXBwb3J0QHJlZGhhdC5jb20wHhcNMTAwMzE3MTkwMDQ0WhcNMzAw
|
7
|
+
MzEyMT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aBBJ2PxECNiWLCRQJWmyff1O5zMT0daS2lBdEGUNhBZ0hnX13Q
|
68
|
+
kabUp0bxRrNRq+WkomP7onZhfZS6SjKm0UmwoV6o3V1ED6y7muQNRmgDpA5PcbvO
|
69
|
+
gl7OexNL4zcpyfMdAmTYf5yTRSvB42Yg5hVfuzPEnOIqupwES3mWkEHRlqbMUkHw
|
70
|
+
qIQAxIwQqZd5PdPpElQ/6j/ZT9DwW/I6zgndX2rsS0oGYcwFTkSj0/rKKkC13hk7
|
71
|
+
LchXMZu5ckdustM79U6OZIBairrJaL2OpR08un2nwIjgEGqhVFYc44UK1VpkE8mr
|
72
|
+
qvqJS6OHVlTlKcEDnhVkPS3i5qjuS/PtSq0CwH8bzYKFJayLDY/z36Zv6PdttzmU
|
73
|
+
Yb1NSDcJejHJ80pMINutyYQ=
|
74
|
+
-----END CERTIFICATE-----
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,6 @@
|
|
1
|
+
class RemoveOldInsightsStatuses < ActiveRecord::Migration[5.2]
|
2
|
+
def up
|
3
|
+
InsightsClientReportStatus.where(status: 2).update_all(status: InsightsClientReportStatus::NO_REPORT)
|
4
|
+
InsightsClientReportStatus.where(status: 3).update_all(status: InsightsClientReportStatus::REPORTING)
|
5
|
+
end
|
6
|
+
end
|
@@ -70,8 +70,16 @@ module ForemanInventoryUpload
|
|
70
70
|
folder
|
71
71
|
end
|
72
72
|
|
73
|
+
def self.inventory_base_url
|
74
|
+
ForemanRhCloud.base_url + "/api/inventory/v1/hosts"
|
75
|
+
end
|
76
|
+
|
73
77
|
def self.inventory_export_url
|
74
78
|
tags = URI.encode("satellite/satellite_instance_id=#{Foreman.instance_id}")
|
75
|
-
|
79
|
+
inventory_base_url + "?tags=#{tags}"
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.inventory_self_url
|
83
|
+
inventory_base_url + "?hostname_or_id=#{ForemanRhCloud.foreman_host.fqdn}"
|
76
84
|
end
|
77
85
|
end
|
@@ -27,6 +27,7 @@ module ForemanInventoryUpload
|
|
27
27
|
'insights_client::obfuscate_ip_enabled',
|
28
28
|
'insights_client::hostname',
|
29
29
|
'insights_client::ips',
|
30
|
+
'insights_id',
|
30
31
|
]).pluck(:name, :id)
|
31
32
|
]
|
32
33
|
end
|
@@ -44,26 +45,10 @@ module ForemanInventoryUpload
|
|
44
45
|
)
|
45
46
|
end
|
46
47
|
|
47
|
-
def self.for_report(portal_user)
|
48
|
-
org_ids = organizations_for_user(portal_user).pluck(:id)
|
49
|
-
for_org(org_ids)
|
50
|
-
end
|
51
|
-
|
52
48
|
def self.for_org(organization_id, use_batches: true)
|
53
49
|
base_query = for_slice(Host.unscoped.where(organization_id: organization_id))
|
54
50
|
use_batches ? base_query.in_batches(of: ForemanInventoryUpload.slice_size) : base_query
|
55
51
|
end
|
56
|
-
|
57
|
-
def self.organizations_for_user(portal_user)
|
58
|
-
Organization
|
59
|
-
.joins(:telemetry_configuration)
|
60
|
-
.where(
|
61
|
-
redhat_access_telemetry_configurations: {
|
62
|
-
portal_user: portal_user,
|
63
|
-
enable_telemetry: true,
|
64
|
-
}
|
65
|
-
)
|
66
|
-
end
|
67
52
|
end
|
68
53
|
end
|
69
54
|
end
|