Trying to send msg notification with a loop where the file name changes - need notified resource to get file name? In example below ‘current_deploy_file’ is not always correct (probably updated before ruby_block notify is run?)
current_deploy_file = ""
node[‘vhm_chef_scripts’][‘chef_deploy_files’].each do |deploy_file|
current_deploy_file = deploy_file
cookbook_file “#{chef_scripts_home}/#{deploy_file}” do
source deploy_file
action :create_if_missing
notifies :run, ‘ruby_block[send_update_msg]’, :immediately
end
end
ruby_block “send_update_msg” do
action :nothing
block do
send_kafka_monitor_msg(“Copy Chef deploy support file ‘#{current_deploy_file}’ to #{chef_scripts_home}”)
end
end