foreman_maintain 1.7.4 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/foreman_maintain/update_runner.rb +22 -3
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: cd1a7ccb0a384dfbcbde42660854837199df64a4bcf465a3ea92fb77809eff3a
         | 
| 4 | 
            +
              data.tar.gz: 54f3cbec98e27261489708521a4cb43a41411cb0c40699a5a04c09c6ec66edb3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a60449b267d0b2e5cf90358b87f0ebebf3987b782fae40fcedcc88472790e4ecca1c2a4d4bf3d92497fb328e56fa792b3b8e8fa5ac05c50866f3f3662b4f31c0
         | 
| 7 | 
            +
              data.tar.gz: 3fb5c40f6edac2b69cb455af6c90c9c43a4ec91a0d2e8dca590edf2339931c08c58f239565a601280f9b81a4d5ab4c742ad91740bd96e0a26bab633aaa04cc16
         | 
| @@ -36,7 +36,11 @@ module ForemanMaintain | |
| 36 36 | 
             
                  PHASES.each do |phase|
         | 
| 37 37 | 
             
                    return run_rollback if quit?
         | 
| 38 38 |  | 
| 39 | 
            -
                     | 
| 39 | 
            +
                    if skip?(phase)
         | 
| 40 | 
            +
                      skip_phase(phase)
         | 
| 41 | 
            +
                    else
         | 
| 42 | 
            +
                      run_phase(phase)
         | 
| 43 | 
            +
                    end
         | 
| 40 44 | 
             
                  end
         | 
| 41 45 |  | 
| 42 46 | 
             
                  finish_update unless quit?
         | 
| @@ -90,12 +94,22 @@ module ForemanMaintain | |
| 90 94 | 
             
                  @ask_to_confirm_update = phase == :pre_update_checks
         | 
| 91 95 | 
             
                end
         | 
| 92 96 |  | 
| 97 | 
            +
                def skip_phase(skipped_phase)
         | 
| 98 | 
            +
                  with_non_empty_scenario(skipped_phase) do |scenario|
         | 
| 99 | 
            +
                    @reporter.before_scenario_starts(scenario)
         | 
| 100 | 
            +
                    @reporter.puts <<~MESSAGE
         | 
| 101 | 
            +
                      Skipping #{skipped_phase} phase as it was already run before.
         | 
| 102 | 
            +
                    MESSAGE
         | 
| 103 | 
            +
                    @reporter.after_scenario_finishes(scenario)
         | 
| 104 | 
            +
                  end
         | 
| 105 | 
            +
                end
         | 
| 106 | 
            +
             | 
| 93 107 | 
             
                private
         | 
| 94 108 |  | 
| 95 109 | 
             
                def rollback_pre_migrations
         | 
| 96 110 | 
             
                  raise "Unexpected phase #{phase}, expecting pre_migrations" unless phase == :pre_migrations
         | 
| 97 111 |  | 
| 98 | 
            -
                  rollback_needed =  | 
| 112 | 
            +
                  rollback_needed = find_scenario(:pre_migrations).steps.any? { |s| s.executed? && s.success? }
         | 
| 99 113 | 
             
                  if rollback_needed
         | 
| 100 114 | 
             
                    @quit = false
         | 
| 101 115 | 
             
                    # prevent the unnecessary confirmation questions
         | 
| @@ -110,7 +124,7 @@ module ForemanMaintain | |
| 110 124 | 
             
                end
         | 
| 111 125 |  | 
| 112 126 | 
             
                def with_non_empty_scenario(phase)
         | 
| 113 | 
            -
                  next_scenario =  | 
| 127 | 
            +
                  next_scenario = find_scenario(phase)
         | 
| 114 128 | 
             
                  unless next_scenario.nil? || next_scenario.steps.empty?
         | 
| 115 129 | 
             
                    yield next_scenario
         | 
| 116 130 | 
             
                  end
         | 
| @@ -153,6 +167,11 @@ module ForemanMaintain | |
| 153 167 | 
             
                  @ask_to_confirm_update = false
         | 
| 154 168 | 
             
                end
         | 
| 155 169 |  | 
| 170 | 
            +
                def skip?(next_phase)
         | 
| 171 | 
            +
                  # the next_phase was run before the current phase
         | 
| 172 | 
            +
                  PHASES.index(next_phase) < PHASES.index(phase)
         | 
| 173 | 
            +
                end
         | 
| 174 | 
            +
             | 
| 156 175 | 
             
                def phase=(phase)
         | 
| 157 176 | 
             
                  raise "Unknown phase #{phase}" unless PHASES.include?(phase)
         | 
| 158 177 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: foreman_maintain
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.7. | 
| 4 | 
            +
              version: 1.7.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ivan Nečas
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024-09- | 
| 11 | 
            +
            date: 2024-09-26 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: clamp
         |