Skip to content

Commit 59d96b3

Browse files
epilatowfacebook-github-bot
authored andcommitted
ROU in-place updates must temporarily re-enable ROU repos
Summary: ROU in-place updates must temporarily re-enable ROU repos if they're disabled. Differential Revision: D68870488 fbshipit-source-id: a9ee1fe94a311b4519331f7f85997eec80083fa6
1 parent 19fb13c commit 59d96b3

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

cookbooks/fb_system_upgrade/resources/default.rb

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121
action :run do
2222
log = node['fb_system_upgrade']['log']
2323

24+
# We don't want this cookbook to take a dependency on fb_dnf_settings,
25+
# so check if it's loaded in the run.
26+
fb_dnf_settings = FB.const_defined?(:DnfSettings)
27+
28+
ruby_block 'optionally enable rou repos' do
29+
# Restore ROU repos before the upgrade and swap resources below.
30+
block do
31+
if fb_dnf_settings && node['fb_dnf_settings']['disable_default_rou_repos']
32+
FB::DnfSettings.update_dnf_conf(node, false)
33+
end
34+
end
35+
end
36+
2437
to_upgrade = []
2538
node['fb_system_upgrade']['early_upgrade_packages'].each do |p|
2639
if node.rpm_version(p)
@@ -37,7 +50,7 @@
3750

3851
to_remove = node['fb_system_upgrade']['early_remove_packages']
3952
unless to_remove.empty?
40-
Chef::Log.info("fb_system_upgrade: early remove for #{to_upgrade}")
53+
Chef::Log.info("fb_system_upgrade: early remove for #{to_remove}")
4154
package to_remove do
4255
action :remove
4356
end
@@ -58,6 +71,10 @@
5871
cmd,
5972
:timeout => node['fb_system_upgrade']['timeout'],
6073
).run_command
74+
if fb_dnf_settings && node['fb_dnf_settings']['disable_default_rou_repos']
75+
# Disable ROU repos before reporting success / failure.
76+
FB::DnfSettings.update_dnf_conf(node)
77+
end
6178
if s.exitstatus.zero?
6279
if node['fb_system_upgrade']['success_callback_method']
6380
Chef::Log.info('fb_system_upgrade: Running success callback')

0 commit comments

Comments
 (0)