From 135f2b710c2471612e5e3555f0730298f5d54718 Mon Sep 17 00:00:00 2001 From: Curtis Castrapel Date: Wed, 13 Jun 2018 15:14:48 -0700 Subject: [PATCH] Limit dns queries to 10 attempts --- lemur/plugins/lemur_acme/dyn.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lemur/plugins/lemur_acme/dyn.py b/lemur/plugins/lemur_acme/dyn.py index 763436a1..6ce117bf 100644 --- a/lemur/plugins/lemur_acme/dyn.py +++ b/lemur/plugins/lemur_acme/dyn.py @@ -41,12 +41,15 @@ def _has_dns_propagated(name, token): def wait_for_dns_change(change_id, account_number=None): fqdn, token = change_id - while True: + number_of_attempts = 10 + for attempts in range(0, number_of_attempts): status = _has_dns_propagated(fqdn, token) current_app.logger.debug("Record status for fqdn: {}: {}".format(fqdn, status)) if status: break time.sleep(20) + if not status: + raise Exception("Unable to query DNS token for fqdn {}.".format(fqdn)) return