嗨,我正在研究下面的代码片段。我尝试了各种组合,但无法从RemoteFile]中调用manage_auth或authorized_users_ldap
我能够从ruby_block“ manage_operator”通知manage_auth
或authorized_users_ldap,但不能从RemoteFile通知<>]如果manage_operator_flag等于1,则我想触发两个(manage_auth或authorized_users_ldap
)中的一个。因此,我尝试在remote_file上放置一个通知,但未触发。请让我知道我做错了ruby_block "manage_auth" do block do Chef::Log.info("MANAGE AUTH") end action :nothing end ruby_block "manage_operator" do block do manage_operator_flag = (cfg.fetch("manage.operators", 0) == 1) if (manage_operator_flag) then f = Chef::Resource::File::RemoteFile.new("#{node['ucms']['dir']}/bin/ucms_authorized_users_ldap.json", run_context) f.source "https://ca.#{c}.#{p}.axiadids.net:4443/ucms_authorized_users_ldap.json" f.retries 3 f.retry_delay 10 f.ignore_failure true # f.run_action :create f.action :create # f.notifies :run, "execute[authorized_users_ldap]" # f.notifies(:run, Chef::Resource::Execute.new("authorized_users_ldap", run_context)) f.notifies :run, "ruby_block[manage_auth]" end end end execute "authorized_users_ldap" do command "touch /tmp/test" action :nothing end
嗨,我正在研究下面的代码片段。我尝试了各种组合,但我无法从RemoteFile调用manage_auth或authorized_users_ldap。我能够通知manage_auth或...
查看manage_operator
ruby块,您应该删除then
关键字,因为在ruby中没有这样的关键字。
更改: