Class: InsightsCloud::Async::InsightsFullSync
Instance Method Summary
collapse
#attempts_before_next_interval, #done!, #done?, #invoke_external_task, #poll_external_task, #poll_intervals
#cert_auth_available?, #execute_cloud_request, #foreman_certificate
#candlepin_id_cert, #cp_owner_id, #upstream_owner
#execute_cloud_request
Instance Method Details
#logger ⇒ Object
58
59
60
|
# File 'lib/insights_cloud/async/insights_full_sync.rb', line 58
def logger
action_logger
end
|
49
50
51
52
53
54
55
56
|
# File 'lib/insights_cloud/async/insights_full_sync.rb', line 49
def perform_hits_sync(organization)
hits = query_insights_hits(organization)
uuids = hits.map { |hit| hit['uuid'] }
setup_host_ids(uuids, organization)
replace_hits_data(hits, organization)
end
|
#plan(organizations) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/insights_cloud/async/insights_full_sync.rb', line 10
def plan(organizations)
organizations = organizations.select do |organization|
checker = ::Katello::UpstreamConnectionChecker.new(organization)
if cert_auth_available?(organization) && !organization.manifest_expired? && checker.can_connect?
true
else
logger.info("A manifest is not available for org: #{organization.name}, or it has expired, or been deleted. skipping insights sync")
false
end
end
sequence do
valid_organizations = organizations.reject(&:manifest_expired?)
if valid_organizations.any?
plan_hosts_sync(organizations)
plan_self(organization_ids: organizations.map(&:id))
concurrence do
plan_rules_sync(organizations)
plan_notifications
end
end
end
end
|
#try_execute ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/insights_cloud/async/insights_full_sync.rb', line 36
def try_execute
organizations.each do |organization|
checker = ::Katello::UpstreamConnectionChecker.new(organization)
if !cert_auth_available?(organization) && organization.manifest_expired && !checker.can_connect?
logger.info("A manifest is not available for org: #{organization.name}, or it has expired, or been deleted. skipping insights sync")
next
end
perform_hits_sync(organization)
end
done!
end
|