diff --git a/testsuite/features/step_definitions/salt_steps.rb b/testsuite/features/step_definitions/salt_steps.rb index 0354530347e..394e95fa466 100644 --- a/testsuite/features/step_definitions/salt_steps.rb +++ b/testsuite/features/step_definitions/salt_steps.rb @@ -559,41 +559,26 @@ When(/^I perform a full salt minion cleanup on "([^"]*)"$/) do |host| node = get_target(host) - if use_salt_bundle - if transactional_system?(host) - node.run('transactional-update --continue -n pkg rm venv-salt-minion', check_errors: false) - # Transactional systems could have also installed salt-minion via sumaform - _result, code = node.run('rpm -q salt-minion', check_errors: false) - node.run('transactional-update --continue -n pkg rm salt-minion', check_errors: false) if code.zero? - # Reboot needed here after package removal but before file removal - step %(I reboot the "#{host}" host through SSH, waiting until it comes back) - node.run('rm -Rf /var/cache/salt/minion /var/run/salt /run/salt /var/log/salt /etc/salt', check_errors: false) if code.zero? - elsif rh_host?(host) - node.run('yum -y remove --setopt=clean_requirements_on_remove=1 venv-salt-minion', check_errors: false) - elsif deb_host?(host) - node.run('apt-get --assume-yes remove venv-salt-minion && apt-get --assume-yes purge venv-salt-minion && apt-get --assume-yes autoremove', check_errors: false) - else - node.run('zypper --non-interactive remove --clean-deps -y venv-salt-minion', check_errors: false) - end - node.run('rm -Rf /root/salt /var/cache/venv-salt-minion /run/venv-salt-minion /var/venv-salt-minion.log /etc/venv-salt-minion /var/tmp/.root*', check_errors: false) + cleanup_paths = use_salt_bundle ? "/var/cache/venv-salt-minion /run/venv-salt-minion /var/venv-salt-minion.log /etc/venv-salt-minion /var/tmp/.root*" : + "/var/cache/salt/minion /var/run/salt /run/salt /var/log/salt /etc/salt /var/tmp/.root*" + + # File/folder cleanup needs to happen before package removal otherwise the transaction is in an inconsistent state + node.run("rm -Rf /root/salt #{cleanup_paths}", check_errors: false) + + # Package removal using the existing step + package_list = use_salt_bundle ? 'venv-salt-minion' : 'salt salt-minion' + + if transactional_system?(host) && use_salt_bundle + # Remove venv-salt-minion and conditionally remove salt-minion if present from sumaform + step %(I remove package "#{package_list}" from this "#{host}" without error control) + _result, code = node.run('rpm -q salt-minion', check_errors: false) + step %(I remove package "salt-minion" from this "#{host}" without error control) if code.zero? else - if transactional_system?(host) - node.run('transactional-update --continue -n pkg rm salt salt-minion', check_errors: false) - # Reboot needed here after package removal but before file removal - step %(I reboot the "#{host}" host through SSH, waiting until it comes back) - elsif rh_host?(host) - node.run('yum -y remove --setopt=clean_requirements_on_remove=1 salt salt-minion', check_errors: false) - elsif deb_host?(host) - node.run('apt-get --assume-yes remove salt-common salt-minion && apt-get --assume-yes purge salt-common salt-minion && apt-get --assume-yes autoremove', check_errors: false) - else - node.run('zypper --non-interactive remove --clean-deps -y salt salt-minion', check_errors: false) - end - node.run('rm -Rf /root/salt /var/cache/salt/minion /var/run/salt /run/salt /var/log/salt /etc/salt /var/tmp/.root*', check_errors: false) - end - if transactional_system?(host) - # Reboot needed after file removal as well - step %(I reboot the "#{host}" host through SSH, waiting until it comes back) + # Standard removal of bundled or non-bundled package list + step %(I remove package "#{package_list}" from this "#{host}" without error control) end + + # Disable repositories step %(I disable the repositories "tools_update_repo tools_pool_repo" on this "#{host}" without error control) end