Skip to content

Commit

Permalink
move the logic which versions are supported into the downstream concern
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Oct 10, 2024
1 parent 0a34801 commit 3f780e1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion definitions/features/satellite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Features::Satellite < ForemanMaintain::Feature
end

def target_version
'6.16'
satellite_maintain_target_version
end

def current_version
Expand Down
5 changes: 2 additions & 3 deletions definitions/scenarios/satellite_upgrade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ def self.upgrade_metadata(&block)
metadata do
tags :upgrade_scenario
confine do
(feature(:instance).downstream&.current_minor_version == '6.15' || \
ForemanMaintain.upgrade_in_progress == '6.16')
feature(:instance).downstream&.satellite_upgrade_allowed?
end
instance_eval(&block)
end
end

def target_version
'6.16'
feature(:instance).downstream&.satellite_maintain_target_version
end
end

Expand Down
16 changes: 16 additions & 0 deletions lib/foreman_maintain/concerns/downstream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,24 @@ def fm_pkg_and_cmd_name
%w[satellite-maintain satellite-maintain]
end

def satellite_maintain_target_version
satellite_maintain_config[:current_sat_version]
end

def satellite_upgrade_allowed?
current_minor_version == satellite_maintain_config[:previous_sat_version] || \
ForemanMaintain.upgrade_in_progress == satellite_maintain_config[:current_sat_version]
end

private

def satellite_maintain_config
{
'current_sat_version': '6.16',
'previous_sat_version': '6.15',
}
end

def rh_repos(server_version)
server_version = version(server_version)
rh_repos = main_rh_repos
Expand Down

0 comments on commit 3f780e1

Please sign in to comment.