Tuesday, February 9, 2016

Chef: Retry (or sleep) some resource, in case the it's waiting for other resource to be up.

Use Case: need to validate tomcat healthcheck.

execute "validate_docker" do
  command "docker ps"
  action :run
  retries 6
  retry_delay 10
  notifies :run, 'execute[start_ecs]', :immediately
end

retries: The number of times to catch exceptions and retry the resource. Default value: 0.
retry_delay: The retry delay (in seconds). Default value: 2.

1 comment: