foreman_maintain 1.0.18 → 1.1.1
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/features/candlepin_database.rb +10 -1
 - data/definitions/features/capsule.rb +1 -1
 - data/definitions/features/installer.rb +8 -4
 - data/definitions/features/katello.rb +1 -1
 - data/definitions/features/nftables.rb +3 -5
 - data/definitions/features/puppet_server.rb +2 -0
 - data/definitions/features/satellite.rb +1 -1
 - data/definitions/procedures/content/prepare.rb +0 -1
 - data/definitions/procedures/content/switchover.rb +0 -1
 - data/definitions/procedures/foreman/apipie_cache.rb +1 -1
 - data/definitions/procedures/packages/update.rb +1 -3
 - data/definitions/scenarios/puppet.rb +0 -3
 - data/definitions/scenarios/self_upgrade.rb +64 -16
 - data/definitions/scenarios/upgrade_to_capsule_6_11.rb +0 -1
 - data/definitions/scenarios/upgrade_to_capsule_6_11_z.rb +0 -1
 - data/definitions/scenarios/upgrade_to_satellite_6_11.rb +1 -2
 - data/definitions/scenarios/upgrade_to_satellite_6_11_z.rb +0 -1
 - data/lib/foreman_maintain/cli/self_upgrade_command.rb +7 -1
 - data/lib/foreman_maintain/concerns/downstream.rb +3 -2
 - data/lib/foreman_maintain/concerns/firewall/nftables_maintenance_mode.rb +3 -3
 - data/lib/foreman_maintain/concerns/metadata.rb +0 -4
 - data/lib/foreman_maintain/concerns/system_helpers.rb +4 -11
 - data/lib/foreman_maintain/package_manager/yum.rb +15 -15
 - data/lib/foreman_maintain/reporter/cli_reporter.rb +6 -24
 - data/lib/foreman_maintain/utils/service/systemd.rb +8 -13
 - data/lib/foreman_maintain/version.rb +1 -1
 - metadata +6 -21
 - data/definitions/procedures/installer/run_for_6_11.rb +0 -52
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 38a7ae9f24c88731e052acb62c13b25d29074a07ad852daa258bed6322c1d22d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e0420aa7dc1935c61ef479aed3a43069281797ca41f131048902c727676c6634
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e0b38e2d2819e152a508874b060b22f161aa4b56523d9b6869b714f9186920fa7d61fd10b09840158c94e4b55a7c18a718307e9a02f4320426f54baa9bdfdd9f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d53fb1934cdc2cbbc2cad92e43a4132ff0f8ea8eec1435bd930be575d3e2284a48278809b7576bdf24b8d7df36ac39fe2dcb223813dc9f8c3b57632e08e030e5
         
     | 
| 
         @@ -75,7 +75,7 @@ class Features::CandlepinDatabase < ForemanMaintain::Feature 
     | 
|
| 
       75 
75 
     | 
    
         
             
              # rubocop:enable Metrics/MethodLength
         
     | 
| 
       76 
76 
     | 
    
         | 
| 
       77 
77 
     | 
    
         
             
              def extend_with_db_options
         
     | 
| 
       78 
     | 
    
         
            -
                db_options = { '-d' =>  
     | 
| 
      
 78 
     | 
    
         
            +
                db_options = { '-d' => construct_database_string }
         
     | 
| 
       79 
79 
     | 
    
         
             
                if check_option_using_cpdb_help('dbhost')
         
     | 
| 
       80 
80 
     | 
    
         
             
                  db_options['--dbhost'] = configuration['host']
         
     | 
| 
       81 
81 
     | 
    
         
             
                  db_options['--dbport'] = configuration['port']
         
     | 
| 
         @@ -83,6 +83,15 @@ class Features::CandlepinDatabase < ForemanMaintain::Feature 
     | 
|
| 
       83 
83 
     | 
    
         
             
                db_options
         
     | 
| 
       84 
84 
     | 
    
         
             
              end
         
     | 
| 
       85 
85 
     | 
    
         | 
| 
      
 86 
     | 
    
         
            +
              def construct_database_string
         
     | 
| 
      
 87 
     | 
    
         
            +
                db_str = configuration['database']
         
     | 
| 
      
 88 
     | 
    
         
            +
                extra_opts = []
         
     | 
| 
      
 89 
     | 
    
         
            +
                extra_opts << "ssl=#{configuration['ssl']}" if configuration['ssl']
         
     | 
| 
      
 90 
     | 
    
         
            +
                extra_opts << "sslfactory=#{configuration['sslfactory']}" if configuration['sslfactory']
         
     | 
| 
      
 91 
     | 
    
         
            +
                db_str += "?#{extra_opts.join('&')}" unless extra_opts.empty?
         
     | 
| 
      
 92 
     | 
    
         
            +
                db_str
         
     | 
| 
      
 93 
     | 
    
         
            +
              end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
       86 
95 
     | 
    
         
             
              def fetch_extra_param(url, key_name)
         
     | 
| 
       87 
96 
     | 
    
         
             
                query_string = url.split('?')[1]
         
     | 
| 
       88 
97 
     | 
    
         
             
                return nil unless query_string
         
     | 
| 
         @@ -64,9 +64,7 @@ class Features::Installer < ForemanMaintain::Feature 
     | 
|
| 
       64 
64 
     | 
    
         
             
              def config_files
         
     | 
| 
       65 
65 
     | 
    
         
             
                Dir.glob(File.join(config_directory, '**/*')) +
         
     | 
| 
       66 
66 
     | 
    
         
             
                  [
         
     | 
| 
       67 
     | 
    
         
            -
                    '/usr/local/bin/validate_postgresql_connection.sh' 
     | 
| 
       68 
     | 
    
         
            -
                    '/opt/puppetlabs/puppet/cache/foreman_cache_data',
         
     | 
| 
       69 
     | 
    
         
            -
                    '/opt/puppetlabs/puppet/cache/pulpcore_cache_data'
         
     | 
| 
      
 67 
     | 
    
         
            +
                    '/usr/local/bin/validate_postgresql_connection.sh'
         
     | 
| 
       70 
68 
     | 
    
         
             
                  ]
         
     | 
| 
       71 
69 
     | 
    
         
             
              end
         
     | 
| 
       72 
70 
     | 
    
         | 
| 
         @@ -102,7 +100,13 @@ class Features::Installer < ForemanMaintain::Feature 
     | 
|
| 
       102 
100 
     | 
    
         
             
              end
         
     | 
| 
       103 
101 
     | 
    
         | 
| 
       104 
102 
     | 
    
         
             
              def installer_arguments
         
     | 
| 
       105 
     | 
    
         
            -
                installer_args = ' 
     | 
| 
      
 103 
     | 
    
         
            +
                installer_args = ''
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                if feature(:foreman_proxy) &&
         
     | 
| 
      
 106 
     | 
    
         
            +
                   feature(:foreman_proxy).with_content?
         
     | 
| 
      
 107 
     | 
    
         
            +
                  installer_args += ' --disable-system-checks'
         
     | 
| 
      
 108 
     | 
    
         
            +
                end
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
       106 
110 
     | 
    
         
             
                unless check_min_version('foreman', '2.1') || check_min_version('foreman-proxy', '2.1')
         
     | 
| 
       107 
111 
     | 
    
         
             
                  installer_args += ' --upgrade' if can_upgrade?
         
     | 
| 
       108 
112 
     | 
    
         
             
                end
         
     | 
| 
         @@ -25,14 +25,12 @@ class Features::Nftables < ForemanMaintain::Feature 
     | 
|
| 
       25 
25 
     | 
    
         
             
                execute!("nft add chain #{family} #{table} #{chain} #{chain_options}")
         
     | 
| 
       26 
26 
     | 
    
         
             
              end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
              def  
     | 
| 
      
 28 
     | 
    
         
            +
              def add_rule(options = {})
         
     | 
| 
       29 
29 
     | 
    
         
             
                family = options.fetch(:family, ip_family)
         
     | 
| 
       30 
30 
     | 
    
         
             
                table = options.fetch(:table, table_name)
         
     | 
| 
       31 
31 
     | 
    
         
             
                chain = options.fetch(:chain, chain_name)
         
     | 
| 
       32 
     | 
    
         
            -
                 
     | 
| 
       33 
     | 
    
         
            -
                 
     | 
| 
       34 
     | 
    
         
            -
                  execute!("nft add rule #{family} #{table} #{chain} #{rule}")
         
     | 
| 
       35 
     | 
    
         
            -
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
                rule = options.fetch(:rule) # needs validation
         
     | 
| 
      
 33 
     | 
    
         
            +
                execute!("nft add rule #{family} #{table} #{chain} #{rule}")
         
     | 
| 
       36 
34 
     | 
    
         
             
              end
         
     | 
| 
       37 
35 
     | 
    
         | 
| 
       38 
36 
     | 
    
         
             
              def table_exist?(name = table_name)
         
     | 
| 
         @@ -11,6 +11,8 @@ class Features::PuppetServer < ForemanMaintain::Feature 
     | 
|
| 
       11 
11 
     | 
    
         
             
                [
         
     | 
| 
       12 
12 
     | 
    
         
             
                  '/etc/puppet',
         
     | 
| 
       13 
13 
     | 
    
         
             
                  '/etc/puppetlabs',
         
     | 
| 
      
 14 
     | 
    
         
            +
                  '/opt/puppetlabs/puppet/cache/foreman_cache_data',
         
     | 
| 
      
 15 
     | 
    
         
            +
                  '/var/lib/puppet/foreman_cache_data',
         
     | 
| 
       14 
16 
     | 
    
         
             
                  '/opt/puppetlabs/puppet/ssl/',
         
     | 
| 
       15 
17 
     | 
    
         
             
                  '/var/lib/puppet/ssl',
         
     | 
| 
       16 
18 
     | 
    
         
             
                  '/var/lib/puppet',
         
     | 
| 
         @@ -10,7 +10,7 @@ class Features::Satellite < ForemanMaintain::Feature 
     | 
|
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
              def current_version
         
     | 
| 
       13 
     | 
    
         
            -
                @current_version ||=  
     | 
| 
      
 13 
     | 
    
         
            +
                @current_version ||= package_version(package_name) || version_from_source
         
     | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              def package_name
         
     | 
| 
         @@ -6,14 +6,12 @@ module Procedures::Packages 
     | 
|
| 
       6 
6 
     | 
    
         
             
                  param :force, 'Do not skip if package is installed', :flag => true, :default => false
         
     | 
| 
       7 
7 
     | 
    
         
             
                  param :warn_on_errors, 'Do not interrupt scenario on failure',
         
     | 
| 
       8 
8 
     | 
    
         
             
                        :flag => true, :default => false
         
     | 
| 
       9 
     | 
    
         
            -
                  param :yum_options, 'Extra yum options if any', :array => true, :default => []
         
     | 
| 
       10 
9 
     | 
    
         
             
                end
         
     | 
| 
       11 
10 
     | 
    
         | 
| 
       12 
11 
     | 
    
         
             
                def run
         
     | 
| 
       13 
12 
     | 
    
         
             
                  assumeyes_val = @assumeyes.nil? ? assumeyes? : @assumeyes
         
     | 
| 
       14 
13 
     | 
    
         
             
                  package_manager.clean_cache(:assumeyes => assumeyes_val)
         
     | 
| 
       15 
     | 
    
         
            -
                   
     | 
| 
       16 
     | 
    
         
            -
                  packages_action(:update, @packages, opts)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  packages_action(:update, @packages, :assumeyes => assumeyes_val)
         
     | 
| 
       17 
15 
     | 
    
         
             
                rescue ForemanMaintain::Error::ExecutionError => e
         
     | 
| 
       18 
16 
     | 
    
         
             
                  if @warn_on_errors
         
     | 
| 
       19 
17 
     | 
    
         
             
                    set_status(:warning, e.message)
         
     | 
| 
         @@ -15,9 +15,6 @@ module ForemanMaintain::Scenarios 
     | 
|
| 
       15 
15 
     | 
    
         
             
                      add_step(Procedures::Puppet::RemovePuppet)
         
     | 
| 
       16 
16 
     | 
    
         
             
                      add_step(Procedures::Puppet::RemovePuppetData) if context.get(:remove_data)
         
     | 
| 
       17 
17 
     | 
    
         
             
                      add_step(Procedures::Service::Restart)
         
     | 
| 
       18 
     | 
    
         
            -
                      if server?
         
     | 
| 
       19 
     | 
    
         
            -
                        add_step(Procedures::Foreman::ApipieCache)
         
     | 
| 
       20 
     | 
    
         
            -
                      end
         
     | 
| 
       21 
18 
     | 
    
         
             
                    end
         
     | 
| 
       22 
19 
     | 
    
         
             
                  end
         
     | 
| 
       23 
20 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,12 +1,24 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module ForemanMaintain::Scenarios
         
     | 
| 
       2 
2 
     | 
    
         
             
              class SelfUpgradeBase < ForemanMaintain::Scenario
         
     | 
| 
       3 
     | 
    
         
            -
                 
     | 
| 
      
 3 
     | 
    
         
            +
                def enabled_system_repos_id
         
     | 
| 
      
 4 
     | 
    
         
            +
                  repository_manager.enabled_repos.keys
         
     | 
| 
      
 5 
     | 
    
         
            +
                end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def enable_repos(repo_ids = stored_enabled_repos_ids)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  add_step(Procedures::Repositories::Enable.new(repos: repo_ids))
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                def disable_repos(repo_ids = stored_enabled_repos_ids)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  add_step(Procedures::Repositories::Disable.new(repos: repo_ids))
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       4 
15 
     | 
    
         
             
                def target_version
         
     | 
| 
       5 
     | 
    
         
            -
                   
     | 
| 
      
 16 
     | 
    
         
            +
                  current_full_version = feature(:instance).downstream.current_version
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @target_version ||= current_full_version.bump
         
     | 
| 
       6 
18 
     | 
    
         
             
                end
         
     | 
| 
       7 
19 
     | 
    
         | 
| 
       8 
20 
     | 
    
         
             
                def current_version
         
     | 
| 
       9 
     | 
    
         
            -
                  feature(:instance).downstream. 
     | 
| 
      
 21 
     | 
    
         
            +
                  feature(:instance).downstream.current_minor_version
         
     | 
| 
       10 
22 
     | 
    
         
             
                end
         
     | 
| 
       11 
23 
     | 
    
         | 
| 
       12 
24 
     | 
    
         
             
                def maintenance_repo_label
         
     | 
| 
         @@ -31,6 +43,33 @@ module ForemanMaintain::Scenarios 
     | 
|
| 
       31 
43 
     | 
    
         
             
                  end
         
     | 
| 
       32 
44 
     | 
    
         
             
                end
         
     | 
| 
       33 
45 
     | 
    
         | 
| 
      
 46 
     | 
    
         
            +
                def maintenance_repo_version
         
     | 
| 
      
 47 
     | 
    
         
            +
                  return '6' if current_version == '6.10'
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  current_version
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                def stored_enabled_repos_ids
         
     | 
| 
      
 53 
     | 
    
         
            +
                  @stored_enabled_repos_ids ||= begin
         
     | 
| 
      
 54 
     | 
    
         
            +
                    path = File.expand_path('enabled_repos.yml', ForemanMaintain.config.backup_dir)
         
     | 
| 
      
 55 
     | 
    
         
            +
                    @stored_enabled_repos_ids = File.file?(path) ? YAML.load(File.read(path)) : []
         
     | 
| 
      
 56 
     | 
    
         
            +
                  end
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                def all_maintenance_repos
         
     | 
| 
      
 60 
     | 
    
         
            +
                  repo_regex = if el7?
         
     | 
| 
      
 61 
     | 
    
         
            +
                                 /rhel-\d-server-satellite-maintenance-\d.\d-rpms/
         
     | 
| 
      
 62 
     | 
    
         
            +
                               else
         
     | 
| 
      
 63 
     | 
    
         
            +
                                 /satellite-maintenance-\d.\d-for-rhel-\d-x86_64-rpms/
         
     | 
| 
      
 64 
     | 
    
         
            +
                               end
         
     | 
| 
      
 65 
     | 
    
         
            +
                  stored_enabled_repos_ids.select { |id| !id.match(repo_regex).nil? }
         
     | 
| 
      
 66 
     | 
    
         
            +
                end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                def repos_ids_to_reenable
         
     | 
| 
      
 69 
     | 
    
         
            +
                  repos_ids_to_reenable = stored_enabled_repos_ids - all_maintenance_repos
         
     | 
| 
      
 70 
     | 
    
         
            +
                  repos_ids_to_reenable << maintenance_repo(maintenance_repo_version)
         
     | 
| 
      
 71 
     | 
    
         
            +
                end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
       34 
73 
     | 
    
         
             
                def use_rhsm?
         
     | 
| 
       35 
74 
     | 
    
         
             
                  return false if maintenance_repo_label
         
     | 
| 
       36 
75 
     | 
    
         | 
| 
         @@ -40,14 +79,6 @@ module ForemanMaintain::Scenarios 
     | 
|
| 
       40 
79 
     | 
    
         | 
| 
       41 
80 
     | 
    
         
             
                  true
         
     | 
| 
       42 
81 
     | 
    
         
             
                end
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                def req_repos_to_update_pkgs
         
     | 
| 
       45 
     | 
    
         
            -
                  if use_rhsm?
         
     | 
| 
       46 
     | 
    
         
            -
                    main_rh_repos + [maintenance_repo_id(target_version)]
         
     | 
| 
       47 
     | 
    
         
            -
                  else
         
     | 
| 
       48 
     | 
    
         
            -
                    [maintenance_repo_id(target_version)]
         
     | 
| 
       49 
     | 
    
         
            -
                  end
         
     | 
| 
       50 
     | 
    
         
            -
                end
         
     | 
| 
       51 
82 
     | 
    
         
             
              end
         
     | 
| 
       52 
83 
     | 
    
         | 
| 
       53 
84 
     | 
    
         
             
              class SelfUpgrade < SelfUpgradeBase
         
     | 
| 
         @@ -61,11 +92,28 @@ module ForemanMaintain::Scenarios 
     | 
|
| 
       61 
92 
     | 
    
         
             
                def compose
         
     | 
| 
       62 
93 
     | 
    
         
             
                  if check_min_version('foreman', '2.5') || check_min_version('foreman-proxy', '2.5')
         
     | 
| 
       63 
94 
     | 
    
         
             
                    pkgs_to_update = %w[satellite-maintain rubygem-foreman_maintain]
         
     | 
| 
       64 
     | 
    
         
            -
                     
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                     
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
      
 95 
     | 
    
         
            +
                    add_step(Procedures::Repositories::BackupEnabledRepos.new)
         
     | 
| 
      
 96 
     | 
    
         
            +
                    disable_repos
         
     | 
| 
      
 97 
     | 
    
         
            +
                    add_step(Procedures::Repositories::Enable.new(repos: [maintenance_repo_id(target_version)],
         
     | 
| 
      
 98 
     | 
    
         
            +
                                                                  use_rhsm: use_rhsm?))
         
     | 
| 
      
 99 
     | 
    
         
            +
                    add_step(Procedures::Packages::Update.new(packages: pkgs_to_update, assumeyes: true))
         
     | 
| 
      
 100 
     | 
    
         
            +
                    enable_repos(repos_ids_to_reenable)
         
     | 
| 
      
 101 
     | 
    
         
            +
                  end
         
     | 
| 
      
 102 
     | 
    
         
            +
                end
         
     | 
| 
      
 103 
     | 
    
         
            +
              end
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
              class SelfUpgradeRescue < SelfUpgradeBase
         
     | 
| 
      
 106 
     | 
    
         
            +
                metadata do
         
     | 
| 
      
 107 
     | 
    
         
            +
                  label :rescue_self_upgrade
         
     | 
| 
      
 108 
     | 
    
         
            +
                  description 'Disables all version specific maintenance repositories and,'\
         
     | 
| 
      
 109 
     | 
    
         
            +
              		 "\nenables the repositories which were configured prior to self upgrade"
         
     | 
| 
      
 110 
     | 
    
         
            +
                  manual_detection
         
     | 
| 
      
 111 
     | 
    
         
            +
                  run_strategy :fail_slow
         
     | 
| 
      
 112 
     | 
    
         
            +
                end
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
                def compose
         
     | 
| 
      
 115 
     | 
    
         
            +
                  if check_min_version('foreman', '2.5') || check_min_version('foreman-proxy', '2.5')
         
     | 
| 
      
 116 
     | 
    
         
            +
                    enable_repos(repos_ids_to_reenable)
         
     | 
| 
       69 
117 
     | 
    
         
             
                  end
         
     | 
| 
       70 
118 
     | 
    
         
             
                end
         
     | 
| 
       71 
119 
     | 
    
         
             
              end
         
     | 
| 
         @@ -40,7 +40,6 @@ module Scenarios::Capsule_6_11 
     | 
|
| 
       40 
40 
     | 
    
         
             
                def compose
         
     | 
| 
       41 
41 
     | 
    
         
             
                  add_steps(find_procedures(:pre_migrations))
         
     | 
| 
       42 
42 
     | 
    
         
             
                  add_step(Procedures::Pulp::Remove.new(:assumeyes => true))
         
     | 
| 
       43 
     | 
    
         
            -
                  add_step(Procedures::Content::FixPulpcoreArtifactOwnership.new(:assumeyes => true))
         
     | 
| 
       44 
43 
     | 
    
         
             
                  add_step(Procedures::Service::Stop.new)
         
     | 
| 
       45 
44 
     | 
    
         
             
                end
         
     | 
| 
       46 
45 
     | 
    
         
             
              end
         
     | 
| 
         @@ -42,7 +42,6 @@ module Scenarios::Satellite_6_11 
     | 
|
| 
       42 
42 
     | 
    
         
             
                def compose
         
     | 
| 
       43 
43 
     | 
    
         
             
                  add_steps(find_procedures(:pre_migrations))
         
     | 
| 
       44 
44 
     | 
    
         
             
                  add_step(Procedures::Pulp::Remove.new(:assumeyes => true))
         
     | 
| 
       45 
     | 
    
         
            -
                  add_step(Procedures::Content::FixPulpcoreArtifactOwnership.new(:assumeyes => true))
         
     | 
| 
       46 
45 
     | 
    
         
             
                  add_step(Procedures::Service::Stop.new)
         
     | 
| 
       47 
46 
     | 
    
         
             
                end
         
     | 
| 
       48 
47 
     | 
    
         
             
              end
         
     | 
| 
         @@ -62,7 +61,7 @@ module Scenarios::Satellite_6_11 
     | 
|
| 
       62 
61 
     | 
    
         
             
                  add_step(Procedures::Repositories::Setup.new(:version => '6.11'))
         
     | 
| 
       63 
62 
     | 
    
         
             
                  add_step(Procedures::Packages::UnlockVersions.new)
         
     | 
| 
       64 
63 
     | 
    
         
             
                  add_step(Procedures::Packages::Update.new(:assumeyes => true))
         
     | 
| 
       65 
     | 
    
         
            -
                  add_step_with_context(Procedures::Installer:: 
     | 
| 
      
 64 
     | 
    
         
            +
                  add_step_with_context(Procedures::Installer::Upgrade)
         
     | 
| 
       66 
65 
     | 
    
         
             
                  add_step(Procedures::Installer::UpgradeRakeTask)
         
     | 
| 
       67 
66 
     | 
    
         
             
                end
         
     | 
| 
       68 
67 
     | 
    
         
             
              end
         
     | 
| 
         @@ -5,7 +5,7 @@ module ForemanMaintain 
     | 
|
| 
       5 
5 
     | 
    
         
             
                         'Repository label from which packages should be updated.'\
         
     | 
| 
       6 
6 
     | 
    
         
             
                         'This can be used when standard CDN repositories are unavailable.'
         
     | 
| 
       7 
7 
     | 
    
         
             
                  def execute
         
     | 
| 
       8 
     | 
    
         
            -
                    run_scenario(upgrade_scenario)
         
     | 
| 
      
 8 
     | 
    
         
            +
                    run_scenario(upgrade_scenario, upgrade_rescue_scenario)
         
     | 
| 
       9 
9 
     | 
    
         
             
                  end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                  def upgrade_scenario
         
     | 
| 
         @@ -13,6 +13,12 @@ module ForemanMaintain 
     | 
|
| 
       13 
13 
     | 
    
         
             
                      maintenance_repo_label: maintenance_repo_label
         
     | 
| 
       14 
14 
     | 
    
         
             
                    )
         
     | 
| 
       15 
15 
     | 
    
         
             
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  def upgrade_rescue_scenario
         
     | 
| 
      
 18 
     | 
    
         
            +
                    Scenarios::SelfUpgradeRescue.new(
         
     | 
| 
      
 19 
     | 
    
         
            +
                      maintenance_repo_label: maintenance_repo_label
         
     | 
| 
      
 20 
     | 
    
         
            +
                    )
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
       16 
22 
     | 
    
         
             
                end
         
     | 
| 
       17 
23 
     | 
    
         
             
              end
         
     | 
| 
       18 
24 
     | 
    
         
             
            end
         
     | 
| 
         @@ -66,8 +66,7 @@ module ForemanMaintain 
     | 
|
| 
       66 
66 
     | 
    
         
             
                    server_version_full = "#{server_version.major}.#{server_version.minor}"
         
     | 
| 
       67 
67 
     | 
    
         
             
                    rh_repos.concat(product_specific_repos(server_version_full))
         
     | 
| 
       68 
68 
     | 
    
         
             
                    if server_version > version('6.3')
         
     | 
| 
       69 
     | 
    
         
            -
                       
     | 
| 
       70 
     | 
    
         
            -
                      rh_repos << ansible_repo if ansible_repo
         
     | 
| 
      
 69 
     | 
    
         
            +
                      rh_repos << ansible_repo(server_version)
         
     | 
| 
       71 
70 
     | 
    
         
             
                    end
         
     | 
| 
       72 
71 
     | 
    
         | 
| 
       73 
72 
     | 
    
         
             
                    rh_repos
         
     | 
| 
         @@ -84,6 +83,8 @@ module ForemanMaintain 
     | 
|
| 
       84 
83 
     | 
    
         | 
| 
       85 
84 
     | 
    
         
             
                    if el7?
         
     | 
| 
       86 
85 
     | 
    
         
             
                      "rhel-#{el_major_version}-server-ansible-#{ansible_version}-rpms"
         
     | 
| 
      
 86 
     | 
    
         
            +
                    else
         
     | 
| 
      
 87 
     | 
    
         
            +
                      "ansible-#{ansible_version}-for-rhel-#{el_major_version}-x86_64-rpms"
         
     | 
| 
       87 
88 
     | 
    
         
             
                    end
         
     | 
| 
       88 
89 
     | 
    
         
             
                  end
         
     | 
| 
       89 
90 
     | 
    
         | 
| 
         @@ -10,7 +10,7 @@ module ForemanMaintain 
     | 
|
| 
       10 
10 
     | 
    
         
             
                      unless table_exist?
         
     | 
| 
       11 
11 
     | 
    
         
             
                        add_table
         
     | 
| 
       12 
12 
     | 
    
         
             
                        add_chain(:chain_options => nftables_chain_options)
         
     | 
| 
       13 
     | 
    
         
            -
                         
     | 
| 
      
 13 
     | 
    
         
            +
                        add_rule(rule: nftables_rule)
         
     | 
| 
       14 
14 
     | 
    
         
             
                      end
         
     | 
| 
       15 
15 
     | 
    
         
             
                    end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
         @@ -22,8 +22,8 @@ module ForemanMaintain 
     | 
|
| 
       22 
22 
     | 
    
         
             
                      '{type filter hook input priority 0\\;}'
         
     | 
| 
       23 
23 
     | 
    
         
             
                    end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                    def  
     | 
| 
       26 
     | 
    
         
            -
                       
     | 
| 
      
 25 
     | 
    
         
            +
                    def nftables_rule
         
     | 
| 
      
 26 
     | 
    
         
            +
                      'tcp dport https reject'
         
     | 
| 
       27 
27 
     | 
    
         
             
                    end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
                    def status_for_maintenance_mode
         
     | 
| 
         @@ -100,10 +100,6 @@ module ForemanMaintain 
     | 
|
| 
       100 
100 
     | 
    
         
             
                      @data[:advanced_run] = advanced_run
         
     | 
| 
       101 
101 
     | 
    
         
             
                    end
         
     | 
| 
       102 
102 
     | 
    
         | 
| 
       103 
     | 
    
         
            -
                    def do_not_whitelist
         
     | 
| 
       104 
     | 
    
         
            -
                      @data[:do_not_whitelist] = true
         
     | 
| 
       105 
     | 
    
         
            -
                    end
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
103 
     | 
    
         
             
                    def self.eval_dsl(metadata, &block)
         
     | 
| 
       108 
104 
     | 
    
         
             
                      new(metadata).tap do |dsl|
         
     | 
| 
       109 
105 
     | 
    
         
             
                        dsl.instance_eval(&block)
         
     | 
| 
         @@ -100,13 +100,12 @@ module ForemanMaintain 
     | 
|
| 
       100 
100 
     | 
    
         
             
                  end
         
     | 
| 
       101 
101 
     | 
    
         | 
| 
       102 
102 
     | 
    
         
             
                  def packages_action(action, packages, options = {})
         
     | 
| 
       103 
     | 
    
         
            -
                    options.validate_options!(:assumeyes 
     | 
| 
      
 103 
     | 
    
         
            +
                    options.validate_options!(:assumeyes)
         
     | 
| 
       104 
104 
     | 
    
         
             
                    case action
         
     | 
| 
       105 
105 
     | 
    
         
             
                    when :install
         
     | 
| 
       106 
106 
     | 
    
         
             
                      package_manager.install(packages, :assumeyes => options[:assumeyes])
         
     | 
| 
       107 
107 
     | 
    
         
             
                    when :update
         
     | 
| 
       108 
     | 
    
         
            -
                      package_manager.update(packages, :assumeyes => options[:assumeyes] 
     | 
| 
       109 
     | 
    
         
            -
                                                       :yum_options => options[:yum_options])
         
     | 
| 
      
 108 
     | 
    
         
            +
                      package_manager.update(packages, :assumeyes => options[:assumeyes])
         
     | 
| 
       110 
109 
     | 
    
         
             
                    when :remove
         
     | 
| 
       111 
110 
     | 
    
         
             
                      package_manager.remove(packages, :assumeyes => options[:assumeyes])
         
     | 
| 
       112 
111 
     | 
    
         
             
                    else
         
     | 
| 
         @@ -116,7 +115,8 @@ module ForemanMaintain 
     | 
|
| 
       116 
115 
     | 
    
         | 
| 
       117 
116 
     | 
    
         
             
                  def package_version(name)
         
     | 
| 
       118 
117 
     | 
    
         
             
                    # space for extension to support non-rpm distributions
         
     | 
| 
       119 
     | 
    
         
            -
                     
     | 
| 
      
 118 
     | 
    
         
            +
                    pkg = package_manager.find_installed_package(name, '%{VERSION}')
         
     | 
| 
      
 119 
     | 
    
         
            +
                    version(pkg) unless pkg.nil?
         
     | 
| 
       120 
120 
     | 
    
         
             
                  end
         
     | 
| 
       121 
121 
     | 
    
         | 
| 
       122 
122 
     | 
    
         
             
                  def parse_csv(data)
         
     | 
| 
         @@ -133,13 +133,6 @@ module ForemanMaintain 
     | 
|
| 
       133 
133 
     | 
    
         
             
                    nil
         
     | 
| 
       134 
134 
     | 
    
         
             
                  end
         
     | 
| 
       135 
135 
     | 
    
         | 
| 
       136 
     | 
    
         
            -
                  def rpm_version(name)
         
     | 
| 
       137 
     | 
    
         
            -
                    rpm_version = execute(%(rpm -q '#{name}' --queryformat="%{VERSION}"))
         
     | 
| 
       138 
     | 
    
         
            -
                    if $CHILD_STATUS.success?
         
     | 
| 
       139 
     | 
    
         
            -
                      version(rpm_version)
         
     | 
| 
       140 
     | 
    
         
            -
                    end
         
     | 
| 
       141 
     | 
    
         
            -
                  end
         
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
       143 
136 
     | 
    
         
             
                  def shellescape(string)
         
     | 
| 
       144 
137 
     | 
    
         
             
                    Shellwords.escape(string)
         
     | 
| 
       145 
138 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -36,8 +36,12 @@ module ForemanMaintain::PackageManager 
     | 
|
| 
       36 
36 
     | 
    
         
             
                  sys.execute?(%(rpm -q #{packages_list}))
         
     | 
| 
       37 
37 
     | 
    
         
             
                end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                def find_installed_package(name)
         
     | 
| 
       40 
     | 
    
         
            -
                   
     | 
| 
      
 39 
     | 
    
         
            +
                def find_installed_package(name, queryformat = '')
         
     | 
| 
      
 40 
     | 
    
         
            +
                  rpm_cmd = "rpm -q '#{name}'"
         
     | 
| 
      
 41 
     | 
    
         
            +
                  unless queryformat.empty?
         
     | 
| 
      
 42 
     | 
    
         
            +
                    rpm_cmd += " --qf '#{queryformat}'"
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
                  status, result = sys.execute_with_status(rpm_cmd)
         
     | 
| 
       41 
45 
     | 
    
         
             
                  if status == 0
         
     | 
| 
       42 
46 
     | 
    
         
             
                    result
         
     | 
| 
       43 
47 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -55,8 +59,8 @@ module ForemanMaintain::PackageManager 
     | 
|
| 
       55 
59 
     | 
    
         
             
                  yum_action('remove', packages, :assumeyes => assumeyes)
         
     | 
| 
       56 
60 
     | 
    
         
             
                end
         
     | 
| 
       57 
61 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
                def update(packages = [], assumeyes: false 
     | 
| 
       59 
     | 
    
         
            -
                  yum_action('update', packages, :assumeyes => assumeyes 
     | 
| 
      
 62 
     | 
    
         
            +
                def update(packages = [], assumeyes: false)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  yum_action('update', packages, :assumeyes => assumeyes)
         
     | 
| 
       60 
64 
     | 
    
         
             
                end
         
     | 
| 
       61 
65 
     | 
    
         | 
| 
       62 
66 
     | 
    
         
             
                def clean_cache(assumeyes: false)
         
     | 
| 
         @@ -78,12 +82,12 @@ module ForemanMaintain::PackageManager 
     | 
|
| 
       78 
82 
     | 
    
         
             
                  sys.execute(find_cmd).split("\n")
         
     | 
| 
       79 
83 
     | 
    
         
             
                end
         
     | 
| 
       80 
84 
     | 
    
         | 
| 
       81 
     | 
    
         
            -
                def list_installed_packages( 
     | 
| 
       82 
     | 
    
         
            -
                  # The  
     | 
| 
      
 85 
     | 
    
         
            +
                def list_installed_packages(queryformat = '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n')
         
     | 
| 
      
 86 
     | 
    
         
            +
                  # The queryformat should only include valid tag(s) as per `rpm --querytags` list.
         
     | 
| 
       83 
87 
     | 
    
         
             
                  # If any special formatting is required with querytag then it should be provided with tag i.e,
         
     | 
| 
       84 
     | 
    
         
            -
                  #  
     | 
| 
       85 
     | 
    
         
            -
                  # The  
     | 
| 
       86 
     | 
    
         
            -
                  sys.execute!("rpm -qa --qf '#{ 
     | 
| 
      
 88 
     | 
    
         
            +
                  # "--%{VENDOR}"
         
     | 
| 
      
 89 
     | 
    
         
            +
                  # The queryformat string must end with '\n'
         
     | 
| 
      
 90 
     | 
    
         
            +
                  sys.execute!("rpm -qa --qf '#{queryformat}'").split("\n")
         
     | 
| 
       87 
91 
     | 
    
         
             
                end
         
     | 
| 
       88 
92 
     | 
    
         | 
| 
       89 
93 
     | 
    
         
             
                private
         
     | 
| 
         @@ -116,12 +120,8 @@ module ForemanMaintain::PackageManager 
     | 
|
| 
       116 
120 
     | 
    
         
             
                  File.open(protector_config_file, 'w') { |file| file.puts config }
         
     | 
| 
       117 
121 
     | 
    
         
             
                end
         
     | 
| 
       118 
122 
     | 
    
         | 
| 
       119 
     | 
    
         
            -
                 
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
     | 
    
         
            -
                  with_status = options.fetch(:with_status, false)
         
     | 
| 
       122 
     | 
    
         
            -
                  assumeyes = options.fetch(:assumeyes, false)
         
     | 
| 
       123 
     | 
    
         
            -
                  valid_exit_statuses = options.fetch(:valid_exit_statuses, [0])
         
     | 
| 
       124 
     | 
    
         
            -
                  yum_options = options.fetch(:yum_options, [])
         
     | 
| 
      
 123 
     | 
    
         
            +
                def yum_action(action, packages, with_status: false, assumeyes: false, valid_exit_statuses: [0])
         
     | 
| 
      
 124 
     | 
    
         
            +
                  yum_options = []
         
     | 
| 
       125 
125 
     | 
    
         
             
                  packages = [packages].flatten(1)
         
     | 
| 
       126 
126 
     | 
    
         
             
                  yum_options << '-y' if assumeyes
         
     | 
| 
       127 
127 
     | 
    
         
             
                  yum_options << '--disableplugin=foreman-protector'
         
     | 
| 
         @@ -317,11 +317,7 @@ module ForemanMaintain 
     | 
|
| 
       317 
317 
     | 
    
         | 
| 
       318 
318 
     | 
    
         
             
                    steps_with_error = scenario.steps_with_error(:whitelisted => false)
         
     | 
| 
       319 
319 
     | 
    
         
             
                    steps_with_skipped = scenario.steps_with_skipped(:whitelisted => true)
         
     | 
| 
       320 
     | 
    
         
            -
                     
     | 
| 
       321 
     | 
    
         
            -
                      step.metadata[:do_not_whitelist] == true
         
     | 
| 
       322 
     | 
    
         
            -
                    end
         
     | 
| 
       323 
     | 
    
         
            -
             
     | 
| 
       324 
     | 
    
         
            -
                    steps_to_whitelist = steps_with_error + steps_with_skipped - not_skippable_steps
         
     | 
| 
      
 320 
     | 
    
         
            +
                    steps_to_whitelist = steps_with_error + steps_with_skipped
         
     | 
| 
       325 
321 
     | 
    
         
             
                    unless steps_with_error.empty?
         
     | 
| 
       326 
322 
     | 
    
         
             
                      message << format(<<-MESSAGE.strip_heredoc, format_steps(steps_with_error, "\n", 2))
         
     | 
| 
       327 
323 
     | 
    
         
             
                      The following steps ended up in failing state:
         
     | 
| 
         @@ -329,25 +325,11 @@ module ForemanMaintain 
     | 
|
| 
       329 
325 
     | 
    
         
             
                      %s
         
     | 
| 
       330 
326 
     | 
    
         
             
                      MESSAGE
         
     | 
| 
       331 
327 
     | 
    
         
             
                      whitelist_labels = steps_to_whitelist.map(&:label_dashed).join(',')
         
     | 
| 
       332 
     | 
    
         
            -
                       
     | 
| 
       333 
     | 
    
         
            -
             
     | 
| 
       334 
     | 
    
         
            -
             
     | 
| 
       335 
     | 
    
         
            -
             
     | 
| 
       336 
     | 
    
         
            -
             
     | 
| 
       337 
     | 
    
         
            -
                          If the situation persists and, you are unclear what to do next,
         
     | 
| 
       338 
     | 
    
         
            -
                          contact Red Hat Technical Support.
         
     | 
| 
       339 
     | 
    
         
            -
             
     | 
| 
       340 
     | 
    
         
            -
                          In case the failures are false positives, use
         
     | 
| 
       341 
     | 
    
         
            -
                          --whitelist="%s"
         
     | 
| 
       342 
     | 
    
         
            -
                          MESSAGE
         
     | 
| 
       343 
     | 
    
         
            -
                                     else
         
     | 
| 
       344 
     | 
    
         
            -
                                       format(<<-MESSAGE.strip_heredoc, whitelist_labels)
         
     | 
| 
       345 
     | 
    
         
            -
                          Resolve the failed steps and rerun the command.
         
     | 
| 
       346 
     | 
    
         
            -
                          In case the failures are false positives, use
         
     | 
| 
       347 
     | 
    
         
            -
                          --whitelist="%s"
         
     | 
| 
       348 
     | 
    
         
            -
                          MESSAGE
         
     | 
| 
       349 
     | 
    
         
            -
                                     end
         
     | 
| 
       350 
     | 
    
         
            -
                      end
         
     | 
| 
      
 328 
     | 
    
         
            +
                      recommend << format(<<-MESSAGE.strip_heredoc, whitelist_labels)
         
     | 
| 
      
 329 
     | 
    
         
            +
                      Resolve the failed steps and rerun
         
     | 
| 
      
 330 
     | 
    
         
            +
                      the command. In case the failures are false positives,
         
     | 
| 
      
 331 
     | 
    
         
            +
                      use --whitelist="%s"
         
     | 
| 
      
 332 
     | 
    
         
            +
                      MESSAGE
         
     | 
| 
       351 
333 
     | 
    
         
             
                    end
         
     | 
| 
       352 
334 
     | 
    
         | 
| 
       353 
335 
     | 
    
         
             
                    steps_with_warning = scenario.steps_with_warning(:whitelisted => false)
         
     | 
| 
         @@ -8,21 +8,16 @@ module ForemanMaintain::Utils 
     | 
|
| 
       8 
8 
     | 
    
         
             
                    @instance_parent_unit = options.fetch(:instance_parent_unit, nil)
         
     | 
| 
       9 
9 
     | 
    
         
             
                  end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                  def command(action 
     | 
| 
       12 
     | 
    
         
            -
                    do_wait = options.fetch(:wait, true) # wait for service to start
         
     | 
| 
      
 11 
     | 
    
         
            +
                  def command(action)
         
     | 
| 
       13 
12 
     | 
    
         
             
                    all = @options.fetch(:all, false)
         
     | 
| 
       14 
13 
     | 
    
         
             
                    skip_enablement = @options.fetch(:skip_enablement, false)
         
     | 
| 
       15 
14 
     | 
    
         
             
                    if skip_enablement && %w[enable disable].include?(action)
         
     | 
| 
       16 
15 
     | 
    
         
             
                      return skip_enablement_message(action, @name)
         
     | 
| 
       17 
16 
     | 
    
         
             
                    end
         
     | 
| 
       18 
17 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                     
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                     
     | 
| 
       22 
     | 
    
         
            -
                      cmd = "systemctl #{action} #{@name}"
         
     | 
| 
       23 
     | 
    
         
            -
                      cmd += ' --all' if all
         
     | 
| 
       24 
     | 
    
         
            -
                      cmd
         
     | 
| 
       25 
     | 
    
         
            -
                    end
         
     | 
| 
      
 18 
     | 
    
         
            +
                    cmd = "systemctl #{action} #{@name}"
         
     | 
| 
      
 19 
     | 
    
         
            +
                    cmd += ' --all' if all
         
     | 
| 
      
 20 
     | 
    
         
            +
                    cmd
         
     | 
| 
       26 
21 
     | 
    
         
             
                  end
         
     | 
| 
       27 
22 
     | 
    
         | 
| 
       28 
23 
     | 
    
         
             
                  def status
         
     | 
| 
         @@ -38,11 +33,11 @@ module ForemanMaintain::Utils 
     | 
|
| 
       38 
33 
     | 
    
         
             
                  end
         
     | 
| 
       39 
34 
     | 
    
         | 
| 
       40 
35 
     | 
    
         
             
                  def enable
         
     | 
| 
       41 
     | 
    
         
            -
                    execute('enable' 
     | 
| 
      
 36 
     | 
    
         
            +
                    execute('enable')
         
     | 
| 
       42 
37 
     | 
    
         
             
                  end
         
     | 
| 
       43 
38 
     | 
    
         | 
| 
       44 
39 
     | 
    
         
             
                  def disable
         
     | 
| 
       45 
     | 
    
         
            -
                    execute('disable' 
     | 
| 
      
 40 
     | 
    
         
            +
                    execute('disable')
         
     | 
| 
       46 
41 
     | 
    
         
             
                  end
         
     | 
| 
       47 
42 
     | 
    
         | 
| 
       48 
43 
     | 
    
         
             
                  def running?
         
     | 
| 
         @@ -66,8 +61,8 @@ module ForemanMaintain::Utils 
     | 
|
| 
       66 
61 
     | 
    
         | 
| 
       67 
62 
     | 
    
         
             
                  private
         
     | 
| 
       68 
63 
     | 
    
         | 
| 
       69 
     | 
    
         
            -
                  def execute(action 
     | 
| 
       70 
     | 
    
         
            -
                    @sys.execute_with_status(command(action 
     | 
| 
      
 64 
     | 
    
         
            +
                  def execute(action)
         
     | 
| 
      
 65 
     | 
    
         
            +
                    @sys.execute_with_status(command(action))
         
     | 
| 
       71 
66 
     | 
    
         
             
                  end
         
     | 
| 
       72 
67 
     | 
    
         | 
| 
       73 
68 
     | 
    
         
             
                  def service_enabled_status
         
     | 
    
        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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ivan Nečas
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire:
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-04-26 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: clamp
         
     | 
| 
         @@ -108,20 +108,6 @@ dependencies: 
     | 
|
| 
       108 
108 
     | 
    
         
             
                - - '='
         
     | 
| 
       109 
109 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       110 
110 
     | 
    
         
             
                    version: 0.50.0
         
     | 
| 
       111 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       112 
     | 
    
         
            -
              name: minitest-stub-const
         
     | 
| 
       113 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       114 
     | 
    
         
            -
                requirements:
         
     | 
| 
       115 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       116 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       117 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       118 
     | 
    
         
            -
              type: :development
         
     | 
| 
       119 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       120 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       121 
     | 
    
         
            -
                requirements:
         
     | 
| 
       122 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       123 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       124 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
       125 
111 
     | 
    
         
             
            description: Provides various features that helps keeping the Foreman/Satellite up
         
     | 
| 
       126 
112 
     | 
    
         
             
              and running.
         
     | 
| 
       127 
113 
     | 
    
         
             
            email: inecas@redhat.com
         
     | 
| 
         @@ -280,7 +266,6 @@ files: 
     | 
|
| 
       280 
266 
     | 
    
         
             
            - definitions/procedures/foreman_tasks/ui_investigate.rb
         
     | 
| 
       281 
267 
     | 
    
         
             
            - definitions/procedures/hammer_setup.rb
         
     | 
| 
       282 
268 
     | 
    
         
             
            - definitions/procedures/installer/run.rb
         
     | 
| 
       283 
     | 
    
         
            -
            - definitions/procedures/installer/run_for_6_11.rb
         
     | 
| 
       284 
269 
     | 
    
         
             
            - definitions/procedures/installer/upgrade.rb
         
     | 
| 
       285 
270 
     | 
    
         
             
            - definitions/procedures/installer/upgrade_rake_task.rb
         
     | 
| 
       286 
271 
     | 
    
         
             
            - definitions/procedures/knowledge_base_article.rb
         
     | 
| 
         @@ -467,7 +452,7 @@ homepage: https://github.com/theforeman/foreman_maintain 
     | 
|
| 
       467 
452 
     | 
    
         
             
            licenses:
         
     | 
| 
       468 
453 
     | 
    
         
             
            - GPL-3.0
         
     | 
| 
       469 
454 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       470 
     | 
    
         
            -
            post_install_message:
         
     | 
| 
      
 455 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
       471 
456 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       472 
457 
     | 
    
         
             
            require_paths:
         
     | 
| 
       473 
458 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -482,8 +467,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       482 
467 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       483 
468 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       484 
469 
     | 
    
         
             
            requirements: []
         
     | 
| 
       485 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
       486 
     | 
    
         
            -
            signing_key:
         
     | 
| 
      
 470 
     | 
    
         
            +
            rubygems_version: 3.0.9
         
     | 
| 
      
 471 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
       487 
472 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       488 
473 
     | 
    
         
             
            summary: Foreman maintenance tool belt
         
     | 
| 
       489 
474 
     | 
    
         
             
            test_files: []
         
     | 
| 
         @@ -1,52 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module Procedures::Installer
         
     | 
| 
       2 
     | 
    
         
            -
              class RunFor6_11 < ForemanMaintain::Procedure
         
     | 
| 
       3 
     | 
    
         
            -
                metadata do
         
     | 
| 
       4 
     | 
    
         
            -
                  description 'Run installer with Candlepin SSL CA'\
         
     | 
| 
       5 
     | 
    
         
            -
                              ' when using external database with SSL'
         
     | 
| 
       6 
     | 
    
         
            -
                  param :assumeyes, 'Do not ask for confirmation'
         
     | 
| 
       7 
     | 
    
         
            -
                  manual_detection
         
     | 
| 
       8 
     | 
    
         
            -
                end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                def run
         
     | 
| 
       11 
     | 
    
         
            -
                  if extdb_and_ssl?
         
     | 
| 
       12 
     | 
    
         
            -
                    run_installer_with_extra_option
         
     | 
| 
       13 
     | 
    
         
            -
                  else
         
     | 
| 
       14 
     | 
    
         
            -
                    run_installer
         
     | 
| 
       15 
     | 
    
         
            -
                  end
         
     | 
| 
       16 
     | 
    
         
            -
                end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                def ext_db?
         
     | 
| 
       19 
     | 
    
         
            -
                  !feature(:foreman_database).local?
         
     | 
| 
       20 
     | 
    
         
            -
                end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                def installer_answers
         
     | 
| 
       23 
     | 
    
         
            -
                  @installer_answers ||= feature(:installer).answers
         
     | 
| 
       24 
     | 
    
         
            -
                end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                def server_db_with_ssl?
         
     | 
| 
       27 
     | 
    
         
            -
                  installer_answers.fetch('katello')['candlepin_db_ssl']
         
     | 
| 
       28 
     | 
    
         
            -
                end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                def extdb_and_ssl?
         
     | 
| 
       31 
     | 
    
         
            -
                  ext_db? && server_db_with_ssl?
         
     | 
| 
       32 
     | 
    
         
            -
                end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                def run_installer_with_extra_option
         
     | 
| 
       35 
     | 
    
         
            -
                  ssl_ca_path = installer_answers.fetch('foreman')['db_root_cert']
         
     | 
| 
       36 
     | 
    
         
            -
                  spinner_msg = "Running installer with --katello-candlepin-db-ssl-ca #{ssl_ca_path} argument!"
         
     | 
| 
       37 
     | 
    
         
            -
                  with_spinner(spinner_msg) do
         
     | 
| 
       38 
     | 
    
         
            -
                    installer_args = feature(:installer).installer_arguments
         
     | 
| 
       39 
     | 
    
         
            -
                    new_ssl_arg = " --katello-candlepin-db-ssl-ca #{ssl_ca_path}"
         
     | 
| 
       40 
     | 
    
         
            -
                    installer_args << new_ssl_arg
         
     | 
| 
       41 
     | 
    
         
            -
                    feature(:installer).run(installer_args)
         
     | 
| 
       42 
     | 
    
         
            -
                  end
         
     | 
| 
       43 
     | 
    
         
            -
                end
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                def run_installer
         
     | 
| 
       46 
     | 
    
         
            -
                  with_spinner('Executing installer') do
         
     | 
| 
       47 
     | 
    
         
            -
                    assumeyes_val = @assumeyes.nil? ? assumeyes? : @assumeyes
         
     | 
| 
       48 
     | 
    
         
            -
                    feature(:installer).upgrade(:interactive => !assumeyes_val)
         
     | 
| 
       49 
     | 
    
         
            -
                  end
         
     | 
| 
       50 
     | 
    
         
            -
                end
         
     | 
| 
       51 
     | 
    
         
            -
              end
         
     | 
| 
       52 
     | 
    
         
            -
            end
         
     |