diff --git a/definitions/features/installer.rb b/definitions/features/installer.rb index 73cafdfde..7b341beec 100644 --- a/definitions/features/installer.rb +++ b/definitions/features/installer.rb @@ -3,22 +3,10 @@ class Features::Installer < ForemanMaintain::Feature label :installer confine do - find_package('foreman-installer') || - find_package('katello-installer') || - find_package('capsule-installer') + find_package('foreman-installer') end end - def initialize - @installer_type = if find_package('foreman-installer') - :scenarios - elsif find_package('katello-installer') - :legacy_katello - elsif find_package('capsule-installer') - :legacy_capsule - end - end - def answers load_answers(configuration) end @@ -28,39 +16,17 @@ def configuration end def config_file - case @installer_type - when :scenarios - last_scenario_config - when :legacy_katello - File.join(config_directory, 'katello-installer.yaml') - when :legacy_capsule - File.join(config_directory, 'capsule-installer.yaml') - end - end - - def with_scenarios? - @installer_type == :scenarios + last_scenario_config end def config_directory - case @installer_type - when :scenarios - '/etc/foreman-installer' - when :legacy_katello - '/etc/katello-installer' - when :legacy_capsule - '/etc/capsule-installer' - end + '/etc/foreman-installer' end def custom_hiera_file @custom_hiera_file ||= File.join(config_directory, 'custom-hiera.yaml') end - def can_upgrade? - @installer_type == :scenarios || @installer_type == :legacy_katello - end - def config_files Dir.glob(File.join(config_directory, '**/*')) + [ @@ -71,23 +37,14 @@ def config_files end def last_scenario - return nil unless with_scenarios? - File.basename(last_scenario_config).split('.')[0] end def installer_command - case @installer_type - when :scenarios - if feature(:satellite) - 'satellite-installer' - else - 'foreman-installer' - end - when :legacy_katello - 'katello-installer' - when :legacy_capsule - 'capsule-installer' + if feature(:satellite) + 'satellite-installer' + else + 'foreman-installer' end end @@ -105,22 +62,7 @@ def run_with_status(arguments = '', exec_options = {}) end def upgrade(exec_options = {}) - run(installer_arguments, exec_options) - end - - def installer_arguments - installer_args = '' - - if feature(:foreman_proxy)&.with_content? && - check_max_version('foreman-installer', '3.4') - installer_args += ' --disable-system-checks' - end - - if !check_min_version('foreman-installer', '2.1') && can_upgrade? - installer_args += ' --upgrade' - end - - installer_args + run('', exec_options) end def initial_admin_username diff --git a/test/definitions/features/installer_test.rb b/test/definitions/features/installer_test.rb index 63eb2fe89..7926b2f55 100644 --- a/test/definitions/features/installer_test.rb +++ b/test/definitions/features/installer_test.rb @@ -11,8 +11,6 @@ before do installer_config_dir(["#{data_dir}/installer/simple_config"]) mock_installer_package('foreman-installer') - Features::Installer.any_instance. - stubs(:installer_arguments).returns('--disable-system-checks --upgrade') end it 'loads list of configs on the start' do @@ -28,10 +26,6 @@ _(subject.config_files.sort).must_equal(expected_config_files) end - it 'can tell if we use scenarios or not' do - _(subject.with_scenarios?).must_equal true - end - it 'can tell last used scenario from the link' do _(subject.last_scenario).must_equal('foreman') end @@ -40,30 +34,6 @@ _(subject.answers['foreman']['admin_password']).must_equal('inspasswd') end - it 'has --upgrade' do - _(subject.can_upgrade?).must_equal true - end - - context '#upgrade' do - it '#upgrade runs the installer with correct params' do - assume_feature_absent(:satellite) - installer_inst.expects(:'execute!'). - with('foreman-installer --disable-system-checks --upgrade', - { :interactive => true }). - returns(true) - subject.upgrade(:interactive => true) - end - - it '#upgrade runs the installer with correct params in satellite' do - assume_feature_present(:satellite) - installer_inst.expects(:'execute!'). - with('satellite-installer --disable-system-checks --upgrade', - { :interactive => true }). - returns(true) - subject.upgrade(:interactive => true) - end - end - context '#run' do it 'runs the installer with correct params' do assume_feature_absent(:satellite)