-
Notifications
You must be signed in to change notification settings - Fork 72
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
Fixes #34854 - disable custom repo if it was not enabled #610
Conversation
Issues: #34854 |
I am trying to understand the logic and seem to need some help.
What I don't understand is the difference in the enabled state after the upgrade is done. Also, the commit message says "… if it was not enabled", but reading the code I'd say it's always disabled now? |
Hello,
In disconnected scenario,
|
Okay, I think I see the logic. How about some tests? --- /dev/null
+++ test/definitions/scenarios/self_upgrade_test.rb
@@ -0,0 +1,38 @@
+require 'test_helper'
+
+module Scenarios
+ describe ForemanMaintain::Scenarios::SelfUpgrade do
+ include DefinitionsTestHelper
+
+ let(:scenario) do
+ ForemanMaintain::Scenarios::SelfUpgrade.new
+ end
+
+ describe 'using CDN' do
+ it 'reenables maintenance repo' do
+ scenario.stubs(:stored_enabled_repos_ids).returns([])
+ scenario.stubs(:current_version).returns('6.10')
+ scenario.stubs(:el_major_version).returns(7)
+ assert_equal ['rhel-7-server-satellite-maintenance-6-rpms'], scenario.repos_ids_to_reenable
+ end
+ end
+
+ describe 'using custom repos' do
+ it 'does not reenable maintenance repo if it was disabled' do
+ scenario.stubs(:stored_enabled_repos_ids).returns([])
+ scenario.stubs(:current_version).returns('6.10')
+ scenario.stubs(:el_major_version).returns(7)
+ scenario.stubs(:maintenance_repo_label).returns('custom-maintenance')
+ assert_equal [], scenario.repos_ids_to_reenable
+ end
+
+ it 'reenables maintenance repo if it was enabled' do
+ scenario.stubs(:stored_enabled_repos_ids).returns(['custom-maintenance'])
+ scenario.stubs(:current_version).returns('6.10')
+ scenario.stubs(:el_major_version).returns(7)
+ scenario.stubs(:maintenance_repo_label).returns('custom-maintenance')
+ assert_equal ['custom-maintenance'], scenario.repos_ids_to_reenable
+ end
+ end
+ end
+end :) |
Thanks for the test, added those |
With this change if custom repositoryl is provided using --maintenance-repo-label
or env variable --MAINTENANCE_REPO_LABEL is exported then
foreman-maintain keeps that custom repo enabled if system had it enabled.
If custom repository was not enabled on system and still provided either via option or
env var then custom repo will be disabled.