Sha256: cb3898ea75e2fc9d155446fef5b8d18fb03e42a722bcb1ec463fe35d9aaf5f00

Contents?: true

Size: 835 Bytes

Versions: 158

Compression:

Stored size: 835 Bytes

Contents

module Actions
  module Middleware

    class BindJobInvocation < ::Dynflow::Middleware

      def delay(*args)
        schedule_options, job_invocation = args
        if !job_invocation.task_id.nil? && job_invocation.task_id != task.id
          job_invocation = job_invocation.deep_clone!
          args = [schedule_options, job_invocation]
        end
        pass(*args).tap { bind(job_invocation) }
      end

      def plan(*args)
        job_invocation = args.first
        pass(*args).tap { bind(job_invocation) }
      end

      private

      def task
        @task ||= ForemanTasks::Task::DynflowTask.where(:external_id => action.execution_plan_id).first!
      end

      def bind(job_invocation)
        job_invocation.update_attribute :task_id, task.id if job_invocation.task_id != task.id
      end

    end

  end
end

Version data entries

158 entries across 158 versions & 1 rubygems

Version Path
foreman_remote_execution-14.1.2 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-14.1.1 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-14.1.0 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-14.0.2 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-14.0.1 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-13.2.6 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-14.0.0 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-13.2.5 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-13.2.4 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-13.2.3 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-13.2.2 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-12.0.7 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-13.2.1 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-13.2.0 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-10.1.3 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-13.0.0 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-12.0.5 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-12.0.4 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-12.0.1 app/lib/actions/middleware/bind_job_invocation.rb
foreman_remote_execution-12.0.2 app/lib/actions/middleware/bind_job_invocation.rb