Sha256: 9c7cbe6f19c9666777f1231aa923ac9e69d8804c01f52524821a6642bb66c020
Contents?: true
Size: 1.51 KB
Versions: 49
Compression:
Stored size: 1.51 KB
Contents
module Actions module Middleware class BackendServicesCheck < Dynflow::Middleware def plan(*args) if Setting[:check_services_before_actions] #To prevent the ping from happening multiple times, keep track on the initial entry action #If capsule_id is passed as in args from an action, Katello::Ping checks the pulp server on the capsule parent = source_action parent.input[:services_checked] ||= [] to_check = services - parent.input[:services_checked] if to_check.any? result = User.as_anonymous_admin { ::Katello::Ping.ping(services: to_check, capsule_id: capsule_id(args))[:services] } to_check.each do |service| if result[service][:status] != ::Katello::Ping::OK_RETURN_CODE fail _("There was an issue with the backend service %s: ") % service + result[service][:message] end end parent.input[:services_checked].concat(to_check) end end pass(*args) end protected def capsule_id(args) capsule_hash = args.select { |x| x[:capsule_id] if x.is_a? Hash } capsule_hash[0] ? capsule_hash[0][:capsule_id] : nil end def source_action parent = self.action until parent.triggering_action.nil? parent = parent.triggering_action end parent end def services fail _("No services defined, is this class extended?") end end end end
Version data entries
49 entries across 49 versions & 1 rubygems