A few bugfixes for letsencrypt worker

This commit is contained in:
Kyle Drake 2016-06-19 02:00:14 +00:00
parent 96642dc27a
commit 2598474596

View file

@ -30,7 +30,7 @@ class LetsEncryptWorker
domains = [site.domain, "www.#{site.domain}"] domains = [site.domain, "www.#{site.domain}"]
domains.each_with_index do |domain, index| domains.each_with_index do |domain, index|
auth = letsencrypt.authorize domain: site.domain auth = letsencrypt.authorize domain: domain
challenge = auth.http01 challenge = auth.http01
FileUtils.mkdir_p File.join(site.base_files_path, File.dirname(challenge.filename)) if index == 0 FileUtils.mkdir_p File.join(site.base_files_path, File.dirname(challenge.filename)) if index == 0
@ -42,13 +42,16 @@ class LetsEncryptWorker
attempts = 0 attempts = 0
begin begin
puts "WAITING FOR #{domain} VALIDATION"
raise VerificationTimeoutError if attempts == 30 raise VerificationTimeoutError if attempts == 30
raise NotAuthorizedYetError if challenge.verify_status != 'valid' raise NotAuthorizedYetError if challenge.verify_status != 'valid'
rescue NotAuthorizedYet rescue NotAuthorizedYetError
sleep 5 sleep 5
attempts += 1 attempts += 1
retry retry
end end
puts "DONE!"
end end
csr = Acme::Client::CertificateRequest.new names: domains csr = Acme::Client::CertificateRequest.new names: domains