foreman_rh_cloud 13.2.10 → 14.0.1
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 +61 -61
- data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +68 -68
- data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +9 -9
- data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +60 -60
- data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +60 -60
- data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +0 -9
- data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +10 -13
- data/app/controllers/insights_cloud/ui_requests_controller.rb +7 -3
- data/app/models/concerns/rh_cloud_host.rb +3 -35
- data/app/models/insights_client_report_status.rb +1 -9
- data/app/models/inventory_sync/inventory_status.rb +4 -16
- data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +5 -12
- data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +2 -8
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +4 -34
- data/lib/foreman_inventory_upload/generators/queries.rb +1 -1
- data/lib/foreman_inventory_upload/generators/slice.rb +1 -1
- data/lib/foreman_inventory_upload.rb +1 -8
- data/lib/foreman_rh_cloud/engine.rb +0 -1
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/foreman_rh_cloud.rb +9 -36
- data/lib/insights_cloud/async/insights_generate_notifications.rb +1 -10
- data/lib/insights_cloud/async/vmaas_reposcan_sync.rb +8 -23
- data/lib/inventory_sync/async/inventory_full_sync.rb +3 -39
- data/lib/inventory_sync/async/inventory_self_host_sync.rb +2 -12
- data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/fr/foreman_rh_cloud.edit.po +1032 -0
- data/locale/fr/foreman_rh_cloud.po +65 -66
- data/locale/fr/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ja/foreman_rh_cloud.edit.po +1026 -0
- data/locale/ja/foreman_rh_cloud.po +70 -72
- data/locale/ja/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ka/foreman_rh_cloud.edit.po +1025 -0
- data/locale/ka/foreman_rh_cloud.po +10 -11
- data/locale/ka/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ko/foreman_rh_cloud.edit.po +1029 -0
- data/locale/ko/foreman_rh_cloud.po +63 -64
- data/locale/ko/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/zh_CN/foreman_rh_cloud.edit.po +1031 -0
- data/locale/zh_CN/foreman_rh_cloud.po +64 -65
- data/locale/zh_CN/foreman_rh_cloud.po.time_stamp +0 -0
- data/package.json +1 -1
- data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +3 -57
- data/test/controllers/insights_cloud/ui_requests_controller_test.rb +2 -16
- data/test/jobs/insights_client_status_aging_test.rb +0 -40
- data/test/jobs/inventory_full_sync_test.rb +4 -219
- data/test/jobs/inventory_hosts_sync_test.rb +5 -7
- data/test/jobs/inventory_self_host_sync_test.rb +1 -10
- data/test/models/insights_client_report_status_test.rb +0 -109
- data/test/unit/archived_report_generator_test.rb +1 -2
- data/test/unit/fact_helpers_test.rb +0 -16
- data/test/unit/foreman_rh_cloud_self_host_test.rb +2 -50
- data/test/unit/lib/insights_cloud/async/vmaas_reposcan_sync_test.rb +25 -80
- data/test/unit/metadata_generator_test.rb +1 -24
- data/test/unit/rh_cloud_host_test.rb +0 -214
- data/test/unit/services/foreman_rh_cloud/branch_info_test.rb +1 -1
- data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +1 -1
- data/test/unit/slice_generator_test.rb +2 -21
- data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js +3 -30
- data/webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js +10 -112
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +1 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +2 -8
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js +17 -43
- data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +0 -7
- data/webpack/ForemanRhCloudHelpers.js +0 -22
- data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +15 -71
- metadata +16 -18
- data/app/controllers/concerns/insights_cloud/candlepin_proxies_extensions.rb +0 -23
- data/test/controllers/insights_cloud/candlepin_proxies_extensions_test.rb +0 -70
- data/test/jobs/insights_generate_notifications_test.rb +0 -26
- data/test/models/inventory_sync/inventory_status_test.rb +0 -85
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/__tests__/Toast.test.js +0 -82
- data/webpack/InsightsHostDetailsTab/__tests__/NewHostDetailsTab.test.js +0 -266
|
@@ -28,14 +28,6 @@ module ForemanInventoryUpload
|
|
|
28
28
|
@organization_accounts[organization.id] ||= organization.pools.where.not(account_number: nil).pluck(:account_number).first
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def golden_ticket?(organization)
|
|
32
|
-
result = organization.try(:golden_ticket?)
|
|
33
|
-
result = organization.content_access_mode == 'org_environment' if result.nil?
|
|
34
|
-
|
|
35
|
-
@organization_golden_tickets ||= {}
|
|
36
|
-
@organization_golden_tickets[organization.id] ||= result
|
|
37
|
-
end
|
|
38
|
-
|
|
39
31
|
def cloud_provider(host)
|
|
40
32
|
bios_version = fact_value(host, 'dmi::bios::version')
|
|
41
33
|
|
|
@@ -114,7 +106,6 @@ module ForemanInventoryUpload
|
|
|
114
106
|
|
|
115
107
|
def host_ips(host)
|
|
116
108
|
# Determines and returns the IP addresses associated with a host, applying obfuscation if enabled.
|
|
117
|
-
return {} if host.nil?
|
|
118
109
|
|
|
119
110
|
# If IP obfuscation is enabled for the host return a representation of obfuscated IP addresses.
|
|
120
111
|
return obfuscated_ips(host) if obfuscate_ips?(host)
|
|
@@ -164,29 +155,10 @@ module ForemanInventoryUpload
|
|
|
164
155
|
|
|
165
156
|
def hostname_match
|
|
166
157
|
bash_hostname = `uname -n`.chomp
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return fqdn(foreman_host)
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
# If no foreman_host, try foreman_host_name from Setting[:foreman_url]
|
|
175
|
-
unless foreman_host
|
|
176
|
-
foreman_hostname_from_setting = ForemanRhCloud.foreman_host_name
|
|
177
|
-
if foreman_hostname_from_setting
|
|
178
|
-
# Apply obfuscation if enabled
|
|
179
|
-
return obfuscate_fqdn(foreman_hostname_from_setting) if Setting[:obfuscate_inventory_hostnames]
|
|
180
|
-
|
|
181
|
-
return foreman_hostname_from_setting
|
|
182
|
-
end
|
|
183
|
-
# Otherwise fall through to bash_hostname below
|
|
184
|
-
# NOTE: Containerized foremanctl setups must configure Setting[:foreman_url]
|
|
185
|
-
# as bash hostname may not be available or meaningful in containers
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
# Fallback to bash hostname (with obfuscation if enabled)
|
|
189
|
-
if Setting[:obfuscate_inventory_hostnames]
|
|
158
|
+
foreman_hostname = ForemanRhCloud.foreman_host&.name
|
|
159
|
+
if bash_hostname == foreman_hostname
|
|
160
|
+
fqdn(ForemanRhCloud.foreman_host)
|
|
161
|
+
elsif Setting[:obfuscate_inventory_hostnames]
|
|
190
162
|
obfuscate_fqdn(bash_hostname)
|
|
191
163
|
else
|
|
192
164
|
bash_hostname
|
|
@@ -194,8 +166,6 @@ module ForemanInventoryUpload
|
|
|
194
166
|
end
|
|
195
167
|
|
|
196
168
|
def bios_uuid(host)
|
|
197
|
-
return nil if host.nil?
|
|
198
|
-
|
|
199
169
|
value = fact_value(host, 'dmi::system::uuid') || ''
|
|
200
170
|
uuid_value(value)
|
|
201
171
|
end
|
|
@@ -230,7 +230,7 @@ module ForemanInventoryUpload
|
|
|
230
230
|
@stream.simple_field('system_purpose_sla', host.subscription_facet.service_level)
|
|
231
231
|
@stream.simple_field('distribution_version', fact_value(host, 'distribution::version'))
|
|
232
232
|
@stream.simple_field('satellite_instance_id', Foreman.try(:instance_id))
|
|
233
|
-
@stream.simple_field('is_simple_content_access',
|
|
233
|
+
@stream.simple_field('is_simple_content_access', true)
|
|
234
234
|
@stream.simple_field('is_hostname_obfuscated', !!obfuscate_hostname?(host))
|
|
235
235
|
@stream.simple_field('organization_id', host.organization_id, :last)
|
|
236
236
|
end
|
|
@@ -96,14 +96,7 @@ module ForemanInventoryUpload
|
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
def self.inventory_self_url
|
|
99
|
-
|
|
100
|
-
hostname = host ? host.fqdn : ForemanRhCloud.foreman_host_name
|
|
101
|
-
if hostname.nil?
|
|
102
|
-
Rails.logger.warn("Cannot determine Foreman hostname for inventory sync. " \
|
|
103
|
-
"Please configure Setting[:foreman_url]. " \
|
|
104
|
-
"Containerized setups must explicitly set this.")
|
|
105
|
-
end
|
|
106
|
-
inventory_base_url + "?hostname_or_id=#{hostname}"
|
|
99
|
+
inventory_base_url + "?hostname_or_id=#{ForemanRhCloud.foreman_host.fqdn}"
|
|
107
100
|
end
|
|
108
101
|
|
|
109
102
|
def self.host_by_id_url(host_uuid)
|
|
@@ -40,7 +40,6 @@ module ForemanRhCloud
|
|
|
40
40
|
::Host::Managed.include RhCloudHost
|
|
41
41
|
|
|
42
42
|
::Katello::Api::Rhsm::CandlepinDynflowProxyController.include InsightsCloud::PackageProfileUploadExtensions
|
|
43
|
-
::Katello::Api::Rhsm::CandlepinProxiesController.include InsightsCloud::CandlepinProxiesExtensions
|
|
44
43
|
::Katello::RegistrationManager.singleton_class.prepend ::ForemanRhCloud::RegistrationManagerExtensions
|
|
45
44
|
end
|
|
46
45
|
end
|
data/lib/foreman_rh_cloud.rb
CHANGED
|
@@ -84,50 +84,23 @@ module ForemanRhCloud
|
|
|
84
84
|
|
|
85
85
|
# For testing purposes we can override the default hostname with an environment variable SATELLITE_RH_CLOUD_FOREMAN_HOST
|
|
86
86
|
def self.foreman_host
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
# Try fullname first
|
|
93
|
-
host = ::Host.unscoped.friendly.where(name: fullname).first
|
|
94
|
-
|
|
95
|
-
# If not found, try shortname
|
|
96
|
-
if host.nil?
|
|
87
|
+
@foreman_host ||= begin
|
|
88
|
+
fullname = foreman_host_name
|
|
89
|
+
::Host.unscoped.friendly.find(fullname)
|
|
90
|
+
rescue ActiveRecord::RecordNotFound
|
|
91
|
+
# fullname didn't work. Let's try shortname
|
|
97
92
|
shortname = /(?<shortname>[^\.]*)\.?.*/.match(fullname)[:shortname]
|
|
98
|
-
|
|
93
|
+
::Host.unscoped.friendly.find(shortname)
|
|
99
94
|
end
|
|
100
|
-
|
|
101
|
-
@foreman_host = host
|
|
102
95
|
end
|
|
103
96
|
|
|
104
97
|
def self.foreman_host_name
|
|
105
|
-
ENV['SATELLITE_RH_CLOUD_FOREMAN_HOST'] || marked_foreman_host&.name ||
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def self.foreman_url_hostname
|
|
109
|
-
return nil unless Setting[:foreman_url]
|
|
110
|
-
|
|
111
|
-
begin
|
|
112
|
-
# Ensure setting is a string to avoid TypeError from URI.parse
|
|
113
|
-
url = Setting[:foreman_url].to_s
|
|
114
|
-
URI.parse(url).host
|
|
115
|
-
rescue URI::InvalidURIError, ArgumentError, TypeError => e
|
|
116
|
-
Rails.logger.warn("Invalid foreman_url setting: #{e.message}")
|
|
117
|
-
nil
|
|
118
|
-
end
|
|
98
|
+
ENV['SATELLITE_RH_CLOUD_FOREMAN_HOST'] || marked_foreman_host&.name || ::SmartProxy.default_capsule.name
|
|
119
99
|
end
|
|
120
100
|
|
|
121
101
|
def self.marked_foreman_host
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return nil unless defined?(HostFacets::InfrastructureFacet)
|
|
125
|
-
|
|
126
|
-
facet = HostFacets::InfrastructureFacet.find_by(foreman_instance: true)
|
|
127
|
-
facet&.host
|
|
128
|
-
rescue ActiveRecord::StatementInvalid => e
|
|
129
|
-
# Table might not exist yet during migrations
|
|
130
|
-
Rails.logger.debug("Could not query marked foreman host: #{e.message}")
|
|
102
|
+
::Host.unscoped.search_for('infrastructure_facet.foreman = true').first
|
|
103
|
+
rescue ScopedSearch::QueryNotSupported
|
|
131
104
|
nil
|
|
132
105
|
end
|
|
133
106
|
|
|
@@ -13,16 +13,7 @@ module InsightsCloud
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def add_satellite_notifications
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# Skip if no Foreman host record exists
|
|
19
|
-
unless host
|
|
20
|
-
logger.debug("Skipping Insights notifications: no Foreman host record found")
|
|
21
|
-
blueprint&.notifications&.destroy_all
|
|
22
|
-
return
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
hits_count = InsightsHit.where(host_id: host.id).count
|
|
16
|
+
hits_count = InsightsHit.where(host_id: foreman_host.id).count
|
|
26
17
|
|
|
27
18
|
# Remove stale notifications
|
|
28
19
|
blueprint.notifications.destroy_all
|
|
@@ -6,8 +6,6 @@ module InsightsCloud
|
|
|
6
6
|
class VmaasReposcanSync < ::Actions::EntryAction
|
|
7
7
|
include ::ForemanRhCloud::CertAuth
|
|
8
8
|
|
|
9
|
-
HTTP_TOO_MANY_REQUESTS = 429
|
|
10
|
-
|
|
11
9
|
# Subscribe to Katello repository sync hook action, if available
|
|
12
10
|
def self.subscribe
|
|
13
11
|
'Actions::Katello::Repository::SyncHook'.constantize
|
|
@@ -51,9 +49,15 @@ module InsightsCloud
|
|
|
51
49
|
|
|
52
50
|
response
|
|
53
51
|
rescue RestClient::ExceptionWithResponse => e
|
|
54
|
-
|
|
52
|
+
message = "VMaaS reposcan sync failed: #{e.response&.code} - #{e.response&.body}"
|
|
53
|
+
logger.error(message)
|
|
54
|
+
output[:message] = message
|
|
55
|
+
raise
|
|
55
56
|
rescue StandardError => e
|
|
56
|
-
|
|
57
|
+
message = "Error triggering VMaaS reposcan sync: #{e.message}, response: #{e.respond_to?(:response) ? e.response : nil}"
|
|
58
|
+
logger.error(message)
|
|
59
|
+
output[:message] = message
|
|
60
|
+
raise
|
|
57
61
|
end
|
|
58
62
|
|
|
59
63
|
def rescue_strategy_for_self
|
|
@@ -66,25 +70,6 @@ module InsightsCloud
|
|
|
66
70
|
|
|
67
71
|
private
|
|
68
72
|
|
|
69
|
-
def handle_rest_client_error(exception)
|
|
70
|
-
if exception.response&.code == HTTP_TOO_MANY_REQUESTS
|
|
71
|
-
message = "VMaaS reposcan sync skipped: another sync already in progress (#{HTTP_TOO_MANY_REQUESTS})"
|
|
72
|
-
logger.warn(message)
|
|
73
|
-
else
|
|
74
|
-
message = "VMaaS reposcan sync failed: #{exception.response&.code} - #{exception.response&.body}"
|
|
75
|
-
logger.error(message)
|
|
76
|
-
end
|
|
77
|
-
output[:message] = message
|
|
78
|
-
# Do NOT raise - let rescue_strategy_for_self Skip handle this
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def handle_standard_error(exception)
|
|
82
|
-
message = "Error triggering VMaaS reposcan sync: #{exception.message}"
|
|
83
|
-
logger.error(message)
|
|
84
|
-
output[:message] = message
|
|
85
|
-
# Do NOT raise - let rescue_strategy_for_self Skip handle this
|
|
86
|
-
end
|
|
87
|
-
|
|
88
73
|
def logger
|
|
89
74
|
action_logger
|
|
90
75
|
end
|
|
@@ -15,26 +15,16 @@ module InventorySync
|
|
|
15
15
|
|
|
16
16
|
def setup_statuses
|
|
17
17
|
@subscribed_hosts_ids = Set.new(affected_host_ids)
|
|
18
|
-
@omitted_ids = Set.new(user_omitted_host_ids)
|
|
19
|
-
|
|
20
|
-
# Remove user-omitted hosts from subscribed set. In normal operation, affected_host_ids
|
|
21
|
-
# already excludes user-omitted hosts via for_slice, but this handles edge cases like
|
|
22
|
-
# a host transitioning from uploaded to user-omitted between syncs.
|
|
23
|
-
@subscribed_hosts_ids.subtract(@omitted_ids)
|
|
24
18
|
|
|
25
19
|
InventorySync::InventoryStatus.transaction do
|
|
26
20
|
InventorySync::InventoryStatus.where(host_id: @subscribed_hosts_ids).delete_all
|
|
27
|
-
InventorySync::InventoryStatus.where(host_id: @omitted_ids).delete_all
|
|
28
21
|
yield
|
|
29
|
-
add_missing_hosts_statuses(@subscribed_hosts_ids)
|
|
30
|
-
add_user_omitted_host_statuses(@omitted_ids)
|
|
22
|
+
add_missing_hosts_statuses(@subscribed_hosts_ids)
|
|
31
23
|
host_statuses[:disconnect] += @subscribed_hosts_ids.size
|
|
32
|
-
host_statuses[:user_omitted] += @omitted_ids.size
|
|
33
24
|
end
|
|
34
25
|
|
|
35
|
-
logger.debug("Synced hosts
|
|
36
|
-
logger.debug("Disconnected hosts
|
|
37
|
-
logger.debug("User-omitted hosts count: #{host_statuses[:user_omitted]}")
|
|
26
|
+
logger.debug("Synced hosts amount: #{host_statuses[:sync]}")
|
|
27
|
+
logger.debug("Disconnected hosts amount: #{host_statuses[:disconnect]}")
|
|
38
28
|
output[:host_statuses] = host_statuses
|
|
39
29
|
end
|
|
40
30
|
|
|
@@ -54,7 +44,6 @@ module InventorySync
|
|
|
54
44
|
private
|
|
55
45
|
|
|
56
46
|
def update_hosts_status(status_hashes)
|
|
57
|
-
# create Inventory statuses
|
|
58
47
|
InventorySync::InventoryStatus.create(status_hashes)
|
|
59
48
|
updated_ids = status_hashes.map { |hash| hash[:host_id] }
|
|
60
49
|
@subscribed_hosts_ids.subtract(updated_ids)
|
|
@@ -72,23 +61,10 @@ module InventorySync
|
|
|
72
61
|
)
|
|
73
62
|
end
|
|
74
63
|
|
|
75
|
-
def add_user_omitted_host_statuses(host_ids)
|
|
76
|
-
InventorySync::InventoryStatus.create(
|
|
77
|
-
host_ids.map do |host_id|
|
|
78
|
-
{
|
|
79
|
-
host_id: host_id,
|
|
80
|
-
status: InventorySync::InventoryStatus::USER_OMITTED,
|
|
81
|
-
reported_at: DateTime.current,
|
|
82
|
-
}
|
|
83
|
-
end
|
|
84
|
-
)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
64
|
def host_statuses
|
|
88
65
|
@host_statuses ||= {
|
|
89
66
|
sync: 0,
|
|
90
67
|
disconnect: 0,
|
|
91
|
-
user_omitted: 0,
|
|
92
68
|
}
|
|
93
69
|
end
|
|
94
70
|
|
|
@@ -97,18 +73,6 @@ module InventorySync
|
|
|
97
73
|
Host.unscoped.where(organization: organizations)
|
|
98
74
|
).pluck(:id)
|
|
99
75
|
end
|
|
100
|
-
|
|
101
|
-
def user_omitted_host_ids
|
|
102
|
-
param_name = InsightsCloud.enable_client_param_inventory
|
|
103
|
-
|
|
104
|
-
# Use search_for to respect parameter inheritance (global, org, hostgroup, host)
|
|
105
|
-
# This matches the same logic used by for_slice, ensuring consistency
|
|
106
|
-
Host.unscoped
|
|
107
|
-
.where(organization: organizations)
|
|
108
|
-
.joins(:subscription_facet)
|
|
109
|
-
.search_for("params.#{param_name} = f")
|
|
110
|
-
.pluck(:id)
|
|
111
|
-
end
|
|
112
76
|
end
|
|
113
77
|
end
|
|
114
78
|
end
|
|
@@ -4,14 +4,7 @@ module InventorySync
|
|
|
4
4
|
set_callback :step, :around, :create_facets
|
|
5
5
|
|
|
6
6
|
def plan
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if host.nil?
|
|
10
|
-
logger.warn("Skipping self-host inventory sync: no Foreman host record found.")
|
|
11
|
-
return
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
super(host.organization)
|
|
7
|
+
super(ForemanRhCloud.foreman_host.organization)
|
|
15
8
|
end
|
|
16
9
|
|
|
17
10
|
def create_facets
|
|
@@ -29,10 +22,7 @@ module InventorySync
|
|
|
29
22
|
private
|
|
30
23
|
|
|
31
24
|
def add_missing_insights_facet(uuids_hash)
|
|
32
|
-
|
|
33
|
-
return unless host # Guard against nil
|
|
34
|
-
|
|
35
|
-
facet = InsightsFacet.find_or_create_by(host_id: host.id) do |facet|
|
|
25
|
+
facet = InsightsFacet.find_or_create_by(host_id: ForemanRhCloud.foreman_host.id) do |facet|
|
|
36
26
|
facet.uuid = uuids_hash.values.first
|
|
37
27
|
end
|
|
38
28
|
|
|
Binary file
|