Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning up unused code paths #804

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion definitions/checks/disk/available_space_candlepin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class AvailableSpaceCandlepin < ForemanMaintain::Check
description 'Check to make sure /var/lib/candlepin has enough space'
tags :pre_upgrade
confine do
feature(:candlepin) && check_min_version('candlepin', '3.1')
feature(:candlepin)
end
end

Expand Down
3 changes: 0 additions & 3 deletions definitions/checks/foreman/check_corrupted_roles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ class CheckCorruptedRoles < ForemanMaintain::Check
for_feature :foreman_database
description 'Check for roles that have filters with multiple resources attached'
tags :pre_upgrade
confine do
check_min_version('foreman', '1.15')
end
end

def run
Expand Down
3 changes: 1 addition & 2 deletions definitions/checks/foreman/validate_external_db_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ class ValidateExternalDbVersion < ForemanMaintain::Check
tags :pre_upgrade
label :validate_external_db_version
confine do
feature(:foreman_database) && !feature(:foreman_database).local? &&
!check_min_version('foreman', '2.0')
feature(:foreman_database) && !feature(:foreman_database).local?
end
end

Expand Down
6 changes: 1 addition & 5 deletions definitions/features/foreman_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ def dhcpd_conf_exist?
end

def services
services = [system_service('foreman-proxy', 40)]
if check_max_version('foreman-proxy', '2.4')
services << system_service('smart_proxy_dynflow_core', 20)
end
services
[system_service('foreman-proxy', 40)]
end

def features
Expand Down
8 changes: 2 additions & 6 deletions definitions/features/foreman_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,9 @@ def delete(state)
DELETE FROM foreman_tasks_tasks WHERE #{tasks_condition};
-- Delete locks and links which may now be orphaned
DELETE FROM foreman_tasks_locks as ftl where ftl.task_id NOT IN (SELECT id FROM foreman_tasks_tasks);
DELETE FROM foreman_tasks_links as ftl where ftl.task_id NOT IN (SELECT id FROM foreman_tasks_tasks);
SQL

if check_min_version(foreman_plugin_name('foreman-tasks'), '4.0.0')
sql += 'DELETE FROM foreman_tasks_links as ftl ' \
'where ftl.task_id NOT IN (SELECT id FROM foreman_tasks_tasks);'
end

feature(:foreman_database).psql("BEGIN; #{sql}; COMMIT;")

count(state)
Expand Down Expand Up @@ -134,7 +130,7 @@ def services
end

def service_name
check_min_version('foreman', '1.17') ? 'dynflowd' : 'foreman-tasks'
'dynflowd'
end

private
Expand Down
2 changes: 1 addition & 1 deletion definitions/features/pulpcore_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Features::PulpcoreDatabase < ForemanMaintain::Feature
label :pulpcore_database

confine do
file_nonzero?(PULPCORE_DB_CONFIG) && check_min_version('katello-common', '3.18')
file_nonzero?(PULPCORE_DB_CONFIG)
end
end

Expand Down
3 changes: 0 additions & 3 deletions definitions/procedures/foreman/fix_corrupted_roles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ class FixCorruptedRoles < ForemanMaintain::Procedure
for_feature :foreman_database
desc = 'Create additional filters so that each filter has only permissions of one resource'
description desc
confine do
check_min_version('foreman', '1.15')
end
end

def run
Expand Down
64 changes: 0 additions & 64 deletions definitions/procedures/foreman/remove_duplicate_obsolete_roles.rb

This file was deleted.

3 changes: 1 addition & 2 deletions definitions/procedures/puppet/remove_puppet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ class RemovePuppet < ForemanMaintain::Procedure
metadata do
description 'Remove Puppet feature'
confine do
feature(:puppet_server) &&
(check_min_version('foreman', '3.6') || check_min_version('foreman-proxy', '3.6'))
feature(:puppet_server)
end
advanced_run false
end
Expand Down
18 changes: 1 addition & 17 deletions definitions/procedures/restore/installer_reset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,12 @@ def run

def installer_cmd
installer = "yes | #{feature(:installer).installer_command} "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

someone needs to remind me, why this yes | is required, but out of scope for this PR probably.

installer << reset_option
installer << '-v --reset-data '
if feature(:instance).foreman_proxy_with_content?
installer << '--foreman-proxy-register-in-foreman false '
end

# We always disable system checks to avoid unnecessary errors. The installer should have
# already ran since this is to be run on an existing system, which means installer checks
# has already been skipped
if feature(:foreman_proxy)&.with_content? &&
check_max_version('foreman-installer', '3.4')
installer << '--disable-system-checks '
end
installer
end

def reset_option
if check_min_version('foreman', '2.2') || \
check_min_version('foreman-proxy', '2.2')
return '-v --reset-data '
end

'-v --reset '
end
end
end
10 changes: 4 additions & 6 deletions definitions/scenarios/puppet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ class RemovePuppet < ForemanMaintain::Scenario
end

def compose
if check_min_version('foreman', '3.0') || check_min_version('foreman-proxy', '3.0')
add_step(Checks::CheckPuppetCapsules) if server?
add_step(Procedures::Puppet::RemovePuppet)
add_step(Procedures::Puppet::RemovePuppetData) if context.get(:remove_data)
add_step(Procedures::Service::Restart)
end
add_step(Checks::CheckPuppetCapsules) if server?
add_step(Procedures::Puppet::RemovePuppet)
add_step(Procedures::Puppet::RemovePuppetData) if context.get(:remove_data)
add_step(Procedures::Service::Restart)
end
end
end
Expand Down
Loading