Class: InsightsCloud::Async::CloudConnectorAnnounceTask

Inherits:
Actions::EntryAction
  • Object
show all
Defined in:
lib/insights_cloud/async/cloud_connector_announce_task.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.connector_feature_idObject



8
9
10
# File 'lib/insights_cloud/async/cloud_connector_announce_task.rb', line 8

def self.connector_feature_id
  @connector_feature_id ||= RemoteExecutionFeature.feature!(ForemanRhCloud::CloudConnector::CLOUD_CONNECTOR_FEATURE).id
end

.subscribeObject



4
5
6
# File 'lib/insights_cloud/async/cloud_connector_announce_task.rb', line 4

def self.subscribe
  Actions::RemoteExecution::RunHostsJob
end

Instance Method Details

#connector_feature_idObject



35
36
37
# File 'lib/insights_cloud/async/cloud_connector_announce_task.rb', line 35

def connector_feature_id
  self.class.connector_feature_id
end

#connector_playbook_job?(job_invocation) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/insights_cloud/async/cloud_connector_announce_task.rb', line 31

def connector_playbook_job?(job_invocation)
  job_invocation&.remote_execution_feature_id == connector_feature_id
end

#finalizeObject



18
19
20
21
22
23
24
25
# File 'lib/insights_cloud/async/cloud_connector_announce_task.rb', line 18

def finalize
  Organization.unscoped.each do |org|
    presence = ForemanRhCloud::CloudPresence.new(org, logger)
    presence.announce_to_sources
  rescue StandardError => ex
    logger.warn(ex)
  end
end

#loggerObject



39
40
41
# File 'lib/insights_cloud/async/cloud_connector_announce_task.rb', line 39

def logger
  action_logger
end

#plan(job_invocation) ⇒ Object



12
13
14
15
16
# File 'lib/insights_cloud/async/cloud_connector_announce_task.rb', line 12

def plan(job_invocation)
  return unless connector_playbook_job?(job_invocation)

  plan_self
end

#rescue_strategy_for_selfObject



27
28
29
# File 'lib/insights_cloud/async/cloud_connector_announce_task.rb', line 27

def rescue_strategy_for_self
  Dynflow::Action::Rescue::Skip
end