Skip to content

Commit ee2fb22

Browse files
jaymzhmeta-codesync[bot]
authored andcommitted
fb_apt: ensure keys are properly maintained (#340)
Summary: The recent rewrite to handle updated key formats has a slight corner-case problem. If the destination of the key gets deleted for any reason, Chef won't notice until the source is updated. This fixes that - idempotently, of course. Signed-off-by: Phil Dibowitz <[email protected]> Pull Request resolved: #340 Differential Revision: D83875538 fbshipit-source-id: 69b7db2a8cfb166751f8aa9041d046b98b10335f
1 parent 4fdd133 commit ee2fb22

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cookbooks/fb_apt/resources/keys.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@
8181
notifies :run, "execute[generate #{name} keyring]", :immediately
8282
end
8383

84+
# If the dest file gets deleted but we don't need to update the
85+
# src file, we'll never notice and never create the dest, so here's
86+
# a special trigger just for that situation
87+
ruby_block "force generation of #{dst}" do
88+
# not_if, since it runs at run-time, will only trigger this
89+
# if the above resource's 'immediate' notifies did not create it
90+
not_if { ::File.exist?(dst) }
91+
block { true }
92+
notifies :run, "execute[generate #{name} keyring]", :immediately
93+
end
94+
8495
file dst do
8596
action :nothing
8697
end

0 commit comments

Comments
 (0)