Sha256: 5882506d0a01a4bc19794bfb614e3c8b3d212cc25c04411c74ace070a4d69ad6

Contents?: true

Size: 877 Bytes

Versions: 106

Compression:

Stored size: 877 Bytes

Contents

module Actions
  module Middleware
    class RecurringLogic < ::Dynflow::Middleware
      # ::Actions::Middleware::RecurringLogic
      #
      # A middleware designed to make action repeatable.
      # After an action is delayed, it checks whether the delay_options
      # hash contains an id of a recurring logic. If so, it adds the task
      # to the recurring logic's task group, otherwise does nothing.
      def delay(delay_options, *args)
        pass(delay_options, *args).tap do
          if delay_options[:recurring_logic_id]
            task.add_missing_task_groups(recurring_logic(delay_options).task_group)
          end
        end
      end

      private

      def recurring_logic(delay_options)
        ForemanTasks::RecurringLogic.find(delay_options[:recurring_logic_id])
      end

      def task
        @task ||= action.task
      end
    end
  end
end

Version data entries

106 entries across 106 versions & 1 rubygems

Version Path
foreman-tasks-10.0.2 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-10.0.1 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-10.0.0 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-9.2.3 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-9.2.2 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-9.2.1 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-9.2.0 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-9.1.1 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-9.0.4 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-9.1.0 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-9.0.2 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-9.0.1 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-8.3.3 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-9.0.0 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-8.2.1 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-8.1.4 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-8.3.2 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-8.3.1 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-8.1.3 app/lib/actions/middleware/recurring_logic.rb
foreman-tasks-8.3.0 app/lib/actions/middleware/recurring_logic.rb