Project

General

Profile

Revision 9fb80abe

Added by Ondřej Pražák over 7 years ago

making promoting decisions more robust

View differences:

app/lib/actions/foreman_pipeline/job/run_job_manually.rb
4 4
      class RunJobManually < Actions::EntryAction
5 5

  
6 6
        def plan(job)
7
          if job.is_valid? && job.target_cv_version_avail? && !job.version_already_promoted?
7
          if job.is_valid? && job.target_cv_version_avail? && job.not_yet_promoted?
8 8
            plan_action(DeployNewHost, job)
9 9
            plan_self(:info => "Manually triggered job started.", :name => job.name)
10 10
          else
11
            plan_self(:info => "Manually triggered job execution skipped, check job configuration.", :name => job.name)
11
            plan_self(:info => "Manually triggered job execution skipped, check job configuration.", :name => job.name, :fail => true)
12 12
          end
13 13
        end
14 14

  
15 15
        def run
16 16
          output = input
17
          fail input[:info] if input[:fail]
18
        end
19

  
20
        def rescue_strategy_for_self
21
          Dynflow::Action::Rescue::Skip
17 22
        end
18 23

  
19 24
        def humanized_name

Also available in: Unified diff