Class: InsightsCloud::Async::InsightsScheduledSync

Inherits:
Actions::EntryAction
  • Object
show all
Includes:
Actions::RecurringAction, ForemanInventoryUpload::Async::DelayedStart
Defined in:
lib/insights_cloud/async/insights_scheduled_sync.rb

Constant Summary

Constants included from ForemanInventoryUpload::Async::DelayedStart

ForemanInventoryUpload::Async::DelayedStart::START_WINDOW

Instance Method Summary collapse

Methods included from ForemanInventoryUpload::Async::DelayedStart

#after_delay, #humanized_name

Instance Method Details

#loggerObject



37
38
39
# File 'lib/insights_cloud/async/insights_scheduled_sync.rb', line 37

def logger
  action_logger
end

#planObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/insights_cloud/async/insights_scheduled_sync.rb', line 7

def plan
  unless Setting[:allow_auto_insights_sync]
    logger.debug(
      'The scheduled process is disabled due to the "allow_auto_insights_sync"
      setting being set to false.'
    )
    return
  end

  if ForemanRhCloud.with_iop_smart_proxy?
    plan_self
  else
    after_delay do
      plan_full_sync # so that 'run' runs
    end
  end
end

#plan_full_syncObject



29
30
31
# File 'lib/insights_cloud/async/insights_scheduled_sync.rb', line 29

def plan_full_sync
  plan_action(InsightsFullSync, Organization.unscoped.all)
end

#rescue_strategy_for_selfObject



33
34
35
# File 'lib/insights_cloud/async/insights_scheduled_sync.rb', line 33

def rescue_strategy_for_self
  Dynflow::Action::Rescue::Fail
end

#runObject



25
26
27
# File 'lib/insights_cloud/async/insights_scheduled_sync.rb', line 25

def run
  output[:status] = _('The scheduled process is disabled because this Foreman is configured with a local IoP Smart Proxy.') if ForemanRhCloud.with_iop_smart_proxy?
end