Skip to content

Commit

Permalink
ROU in-place updates must temporarily re-enable ROU repos
Browse files Browse the repository at this point in the history
Summary: ROU in-place updates must temporarily re-enable ROU repos if they're disabled.

Differential Revision: D68870488

fbshipit-source-id: a9ee1fe94a311b4519331f7f85997eec80083fa6
  • Loading branch information
epilatow authored and facebook-github-bot committed Feb 5, 2025
1 parent 19fb13c commit 59d96b3
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion cookbooks/fb_system_upgrade/resources/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@
action :run do
log = node['fb_system_upgrade']['log']

# We don't want this cookbook to take a dependency on fb_dnf_settings,
# so check if it's loaded in the run.
fb_dnf_settings = FB.const_defined?(:DnfSettings)

ruby_block 'optionally enable rou repos' do
# Restore ROU repos before the upgrade and swap resources below.
block do
if fb_dnf_settings && node['fb_dnf_settings']['disable_default_rou_repos']
FB::DnfSettings.update_dnf_conf(node, false)
end
end
end

to_upgrade = []
node['fb_system_upgrade']['early_upgrade_packages'].each do |p|
if node.rpm_version(p)
Expand All @@ -37,7 +50,7 @@

to_remove = node['fb_system_upgrade']['early_remove_packages']
unless to_remove.empty?
Chef::Log.info("fb_system_upgrade: early remove for #{to_upgrade}")
Chef::Log.info("fb_system_upgrade: early remove for #{to_remove}")
package to_remove do
action :remove
end
Expand All @@ -58,6 +71,10 @@
cmd,
:timeout => node['fb_system_upgrade']['timeout'],
).run_command
if fb_dnf_settings && node['fb_dnf_settings']['disable_default_rou_repos']
# Disable ROU repos before reporting success / failure.
FB::DnfSettings.update_dnf_conf(node)
end
if s.exitstatus.zero?
if node['fb_system_upgrade']['success_callback_method']
Chef::Log.info('fb_system_upgrade: Running success callback')
Expand Down

0 comments on commit 59d96b3

Please sign in to comment.