Sha256: 11e52bfc66d2dbc53e1044d4372f07df43dd530845832d973608fa12e562607d

Contents?: true

Size: 800 Bytes

Versions: 189

Compression:

Stored size: 800 Bytes

Contents

module Actions
  module Helpers
    module Notifications
      def self.included(base)
        base.execution_plan_hooks.use :send_notification, :on => [:stopped]
      end

      def send_notification(plan)
        if plan_failed?(plan)
          failure_notification(plan)
        else
          success_notification(plan)
        end
      end

      def success_notification(plan)
      end

      def failure_notification(plan)
      end

      def plan_failed?(plan)
        [:error, :warning, :cancelled].include?(plan.result)
      end

      def subject_organization
        @organization ||= ::Organization.find(input[:organization][:id])
      end

      def get_foreman_task(plan)
        ::ForemanTasks::Task::DynflowTask.where(:external_id => plan.id).first
      end
    end
  end
end

Version data entries

189 entries across 189 versions & 1 rubygems

Version Path
katello-4.3.1 app/lib/actions/helpers/notifications.rb
katello-4.4.0 app/lib/actions/helpers/notifications.rb
katello-4.4.0.rc2 app/lib/actions/helpers/notifications.rb
katello-4.4.0.rc1 app/lib/actions/helpers/notifications.rb
katello-4.2.2 app/lib/actions/helpers/notifications.rb
katello-4.3.0 app/lib/actions/helpers/notifications.rb
katello-4.3.0.rc4 app/lib/actions/helpers/notifications.rb
katello-4.3.0.rc3 app/lib/actions/helpers/notifications.rb
katello-4.3.0.rc2.1 app/lib/actions/helpers/notifications.rb
katello-4.3.0.rc2 app/lib/actions/helpers/notifications.rb
katello-4.3.0.rc1 app/lib/actions/helpers/notifications.rb
katello-4.2.1 app/lib/actions/helpers/notifications.rb
katello-4.2.0.1 app/lib/actions/helpers/notifications.rb
katello-4.1.4 app/lib/actions/helpers/notifications.rb
katello-4.0.3 app/lib/actions/helpers/notifications.rb
katello-4.2.0.1.rc3 app/lib/actions/helpers/notifications.rb
katello-3.18.5 app/lib/actions/helpers/notifications.rb
katello-4.2.0.1.rc2 app/lib/actions/helpers/notifications.rb
katello-4.2.0.rc2 app/lib/actions/helpers/notifications.rb
katello-4.1.3 app/lib/actions/helpers/notifications.rb