foreman_maintain 0.7.1 → 0.7.2
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/definitions/checks/disk/available_space_candlepin.rb +27 -0
 - data/definitions/features/candlepin.rb +4 -0
 - data/definitions/features/foreman_tasks.rb +5 -1
 - data/lib/foreman_maintain.rb +2 -0
 - data/lib/foreman_maintain/cli/upgrade_command.rb +2 -0
 - data/lib/foreman_maintain/concerns/primary_checks.rb +23 -0
 - data/lib/foreman_maintain/utils/disk/io_device.rb +4 -0
 - data/lib/foreman_maintain/version.rb +1 -1
 - metadata +4 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ede9ac694f3aa2331891b0a5a8d6e2d16881baa2705cedda1d6665e2f525617c
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ee459a09c76aeac0d0e62a337e30830b7f93f70a6a48111e81d7af1eed2f6aa0
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e41953a3ec03c60f1a2ee2ab573db15a5fdbfddebf438abbf7a93be1b9512401a430ca13c3f870d010275f3b78d01decc404a00f92cd6087e20fcb8fd057cca4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 25745f4026a790b816ce52dd378a1747cea9d9598b3167320cb6d4cc3fb531998589371c8512146c7b35b33aa6b3b632aa9af50b005834c416cda0d2c6b47523
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Checks
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Disk
         
     | 
| 
      
 3 
     | 
    
         
            +
                class AvailableSpaceCandlepin < ForemanMaintain::Check
         
     | 
| 
      
 4 
     | 
    
         
            +
                  metadata do
         
     | 
| 
      
 5 
     | 
    
         
            +
                    label :available_space_cp
         
     | 
| 
      
 6 
     | 
    
         
            +
                    description 'Check to make sure /var/lib/candlepin has enough space'
         
     | 
| 
      
 7 
     | 
    
         
            +
                    tags :pre_upgrade
         
     | 
| 
      
 8 
     | 
    
         
            +
                    confine do
         
     | 
| 
      
 9 
     | 
    
         
            +
                      feature(:candlepin) && check_min_version('candlepin', '3.1')
         
     | 
| 
      
 10 
     | 
    
         
            +
                    end
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  MAX_USAGE_IN_PERCENT = 90
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  def run
         
     | 
| 
      
 16 
     | 
    
         
            +
                    assert(enough_space?, "System has more than #{MAX_USAGE_IN_PERCENT}% space used"\
         
     | 
| 
      
 17 
     | 
    
         
            +
                           " on #{feature(:candlepin).work_dir}.\n"\
         
     | 
| 
      
 18 
     | 
    
         
            +
                           'See https://bugzilla.redhat.com/show_bug.cgi?id=1898605')
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  def enough_space?
         
     | 
| 
      
 22 
     | 
    
         
            +
                    io_obj = ForemanMaintain::Utils::Disk::IODevice.new(feature(:candlepin).work_dir)
         
     | 
| 
      
 23 
     | 
    
         
            +
                    io_obj.space_used_in_percent < MAX_USAGE_IN_PERCENT
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -95,7 +95,11 @@ class Features::ForemanTasks < ForemanMaintain::Feature 
     | 
|
| 
       95 
95 
     | 
    
         
             
              end
         
     | 
| 
       96 
96 
     | 
    
         | 
| 
       97 
97 
     | 
    
         
             
              def resume_task_using_hammer
         
     | 
| 
       98 
     | 
    
         
            -
                 
     | 
| 
      
 98 
     | 
    
         
            +
                if check_min_version('satellite', '6.8')
         
     | 
| 
      
 99 
     | 
    
         
            +
                  feature(:hammer).run('task resume --search ""')
         
     | 
| 
      
 100 
     | 
    
         
            +
                else
         
     | 
| 
      
 101 
     | 
    
         
            +
                  feature(:hammer).run('task resume')
         
     | 
| 
      
 102 
     | 
    
         
            +
                end
         
     | 
| 
       99 
103 
     | 
    
         
             
              end
         
     | 
| 
       100 
104 
     | 
    
         | 
| 
       101 
105 
     | 
    
         
             
              def fetch_tasks_status(state, spinner)
         
     | 
    
        data/lib/foreman_maintain.rb
    CHANGED
    
    | 
         @@ -21,6 +21,7 @@ module ForemanMaintain 
     | 
|
| 
       21 
21 
     | 
    
         
             
              require 'foreman_maintain/concerns/base_database'
         
     | 
| 
       22 
22 
     | 
    
         
             
              require 'foreman_maintain/concerns/directory_marker'
         
     | 
| 
       23 
23 
     | 
    
         
             
              require 'foreman_maintain/concerns/downstream'
         
     | 
| 
      
 24 
     | 
    
         
            +
              require 'foreman_maintain/concerns/primary_checks'
         
     | 
| 
       24 
25 
     | 
    
         
             
              require 'foreman_maintain/top_level_modules'
         
     | 
| 
       25 
26 
     | 
    
         
             
              require 'foreman_maintain/yaml_storage'
         
     | 
| 
       26 
27 
     | 
    
         
             
              require 'foreman_maintain/config'
         
     | 
| 
         @@ -41,6 +42,7 @@ module ForemanMaintain 
     | 
|
| 
       41 
42 
     | 
    
         
             
              require 'foreman_maintain/error'
         
     | 
| 
       42 
43 
     | 
    
         | 
| 
       43 
44 
     | 
    
         
             
              class << self
         
     | 
| 
      
 45 
     | 
    
         
            +
                include ForemanMaintain::Concerns::PrimaryChecks
         
     | 
| 
       44 
46 
     | 
    
         
             
                attr_accessor :config, :logger
         
     | 
| 
       45 
47 
     | 
    
         | 
| 
       46 
48 
     | 
    
         
             
                LOGGER_LEVEL_MAPPING = {
         
     | 
| 
         @@ -67,6 +67,7 @@ module ForemanMaintain 
     | 
|
| 
       67 
67 
     | 
    
         
             
                    disable_self_upgrade_option
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
       69 
69 
     | 
    
         
             
                    def execute
         
     | 
| 
      
 70 
     | 
    
         
            +
                      ForemanMaintain.validate_downstream_packages
         
     | 
| 
       70 
71 
     | 
    
         
             
                      ForemanMaintain.perform_self_upgrade unless disable_self_upgrade?
         
     | 
| 
       71 
72 
     | 
    
         
             
                      upgrade_runner.run_phase(:pre_upgrade_checks)
         
     | 
| 
       72 
73 
     | 
    
         
             
                      exit upgrade_runner.exit_code
         
     | 
| 
         @@ -86,6 +87,7 @@ module ForemanMaintain 
     | 
|
| 
       86 
87 
     | 
    
         
             
                    end
         
     | 
| 
       87 
88 
     | 
    
         | 
| 
       88 
89 
     | 
    
         
             
                    def execute
         
     | 
| 
      
 90 
     | 
    
         
            +
                      ForemanMaintain.validate_downstream_packages
         
     | 
| 
       89 
91 
     | 
    
         
             
                      ForemanMaintain.perform_self_upgrade unless disable_self_upgrade?
         
     | 
| 
       90 
92 
     | 
    
         
             
                      if phase
         
     | 
| 
       91 
93 
     | 
    
         
             
                        upgrade_runner.run_phase(phase.to_sym)
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module ForemanMaintain
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Concerns
         
     | 
| 
      
 3 
     | 
    
         
            +
                module PrimaryChecks
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def validate_downstream_packages
         
     | 
| 
      
 5 
     | 
    
         
            +
                    return unless detector.feature(:installer) && detector.feature(:installer).with_scenarios?
         
     | 
| 
      
 6 
     | 
    
         
            +
                    if (package = package_name) && !package_manager.installed?(package)
         
     | 
| 
      
 7 
     | 
    
         
            +
                      raise ForemanMaintain::Error::Fail,
         
     | 
| 
      
 8 
     | 
    
         
            +
                            "Error: Important rpm package #{package} is not installed!"\
         
     | 
| 
      
 9 
     | 
    
         
            +
                            "\nInstall #{package} rpm to ensure system consistency."
         
     | 
| 
      
 10 
     | 
    
         
            +
                    end
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  def package_name
         
     | 
| 
      
 14 
     | 
    
         
            +
                    installed_scenario = detector.feature(:installer).last_scenario
         
     | 
| 
      
 15 
     | 
    
         
            +
                    if installed_scenario == 'satellite'
         
     | 
| 
      
 16 
     | 
    
         
            +
                      'satellite'
         
     | 
| 
      
 17 
     | 
    
         
            +
                    elsif installed_scenario == 'capsule'
         
     | 
| 
      
 18 
     | 
    
         
            +
                      'satellite-capsule'
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -22,6 +22,10 @@ module ForemanMaintain 
     | 
|
| 
       22 
22 
     | 
    
         
             
                      convert_kb_to_mb(execute!("df #{dir}|awk {'print $4'}|tail -1").to_i)
         
     | 
| 
       23 
23 
     | 
    
         
             
                    end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
      
 25 
     | 
    
         
            +
                    def space_used_in_percent
         
     | 
| 
      
 26 
     | 
    
         
            +
                      execute!("df #{dir}|awk {'print $5'}|tail -1").to_i
         
     | 
| 
      
 27 
     | 
    
         
            +
                    end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
       25 
29 
     | 
    
         
             
                    private
         
     | 
| 
       26 
30 
     | 
    
         | 
| 
       27 
31 
     | 
    
         
             
                    # In fio command, --direct option bypass the cache page
         
     | 
    
        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: 0.7. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.7.2
         
     | 
| 
       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: 2020-12- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-12-23 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: clamp
         
     | 
| 
         @@ -125,6 +125,7 @@ files: 
     | 
|
| 
       125 
125 
     | 
    
         
             
            - definitions/checks/check_hotfix_installed.rb
         
     | 
| 
       126 
126 
     | 
    
         
             
            - definitions/checks/check_tmout.rb
         
     | 
| 
       127 
127 
     | 
    
         
             
            - definitions/checks/disk/available_space.rb
         
     | 
| 
      
 128 
     | 
    
         
            +
            - definitions/checks/disk/available_space_candlepin.rb
         
     | 
| 
       128 
129 
     | 
    
         
             
            - definitions/checks/disk/performance.rb
         
     | 
| 
       129 
130 
     | 
    
         
             
            - definitions/checks/env_proxy.rb
         
     | 
| 
       130 
131 
     | 
    
         
             
            - definitions/checks/foreman/check_checkpoint_segments.rb
         
     | 
| 
         @@ -347,6 +348,7 @@ files: 
     | 
|
| 
       347 
348 
     | 
    
         
             
            - lib/foreman_maintain/concerns/hammer.rb
         
     | 
| 
       348 
349 
     | 
    
         
             
            - lib/foreman_maintain/concerns/logger.rb
         
     | 
| 
       349 
350 
     | 
    
         
             
            - lib/foreman_maintain/concerns/metadata.rb
         
     | 
| 
      
 351 
     | 
    
         
            +
            - lib/foreman_maintain/concerns/primary_checks.rb
         
     | 
| 
       350 
352 
     | 
    
         
             
            - lib/foreman_maintain/concerns/reporter.rb
         
     | 
| 
       351 
353 
     | 
    
         
             
            - lib/foreman_maintain/concerns/scenario_metadata.rb
         
     | 
| 
       352 
354 
     | 
    
         
             
            - lib/foreman_maintain/concerns/system_helpers.rb
         
     |