Hi,
https://docs.chef.io/resource_ruby_block.html
Is it just me or am I correct in assuming that ruby_block does NOT support guard/guard interpreter?
I am trying to execute 2 resources (one a execute resource and another a ruby_block) and i want both these resources to NOT RUN if the PID is already up and running…
execute 'Start Weblogic Node Manager' do
guard_interpreter :bash
user node['weblogic']['user']
group node['weblogic']['group']
cwd node['weblogic']['user_project_bin']
#This PID runs in the foreground by default, so need to use nohup & to run as a background process
command "nohup ./startNodeManager.sh > chef_start_nodemanager.log 2>&1 &"
# grep exits with 1 when no match is found. This resource is executed when not_if returns false i.e exit code is != 0 from bash script
# So, this resource is run if grep doesn't find a match
not_if 'ps -ef | grep weblogic.NodeManager | grep -v grep'
end
#Only run the below block if the SAME guard as above is false.....can that be done??
ruby_block "Wait until Node Manager has started" do
block do
until File.readlines("#{node['weblogic']['domainhome']}/bin/chef_start_nodemanager.log").grep(/Plain socket listener started on port 5556, host localhost/).size > 0
Chef::Log.info('sleeping 3 seconds until grep condition true')
sleep 3
end
end
end
However, looking at the ruby_block documentation, there is no mention of a guard_interpreter/guard, so just checking if its supported.
Cheers