1

Im a newbie in ruby, question is how to do ruby_block in chef that checks until a file is created.?

I started my code with my other ruby block,like..

ruby_block "block_until_not_operational" do
  block do
    10.times do
      if IO.popen("netstat -lnt").entries.select { |entry|
          entry.split[3] =~ /:#{node[:jboss][:default_port]}$/
        }.size == 0
        break
      end
      Chef::Log.debug("service[jenkins] still listening (port #{node[:jboss][:default_port]})")
      sleep 1
    end
  end
  action :nothing
end
4

1 に答える 1