- From: Bryan McLellan <
>
- To:
- Cc:
- Subject: [chef] Re: [chef-dev] how to doing polling in a recipe
- Date: Mon, 15 Oct 2012 17:09:10 -0400
On Mon, Oct 15, 2012 at 2:17 PM,
<
>
wrote:
>
Basically the network configuration is not ready when the recipe got
>
triggered.
>
I would hope there is a resource I can use to wait and poll the status.
>
>
Is there a way to fix this?
Put this in a cookbook and put it at the top of your run list or base role.
ruby_block "check_internet" do
block do
require 'socket'
test_host = "www.google.com"
test_port = "www"
retries = 0
begin
s = TCPSocket.new(test_host, test_port)
s.close
rescue Errno::ETIMEDOUT
if retries < 3
retries += 1
Chef::Log.logger.send("warn", "Unable to connect to
#{test_host}:#{test_port}, retry ##{retries}")
retry
end
end
end
end
- [chef] Re: [chef-dev] how to doing polling in a recipe, Bryan McLellan, 10/15/2012
Archive powered by MHonArc 2.6.16.