From 1bae5968ade8a945873c63c5e5f7bbe92564fcf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=B6hlmann?= Date: Sun, 7 Oct 2018 01:39:02 +0300 Subject: [PATCH] Import tenacy and fix syntax errors --- core/dovecot/start.py | 3 ++- core/postfix/start.py | 3 ++- services/rspamd/start.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/dovecot/start.py b/core/dovecot/start.py index bab5f1ee..40e1edf0 100755 --- a/core/dovecot/start.py +++ b/core/dovecot/start.py @@ -4,11 +4,12 @@ import jinja2 import os import socket import glob +import tenacity from tenacity import retry convert = lambda src, dst: open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ)) -@retry(stop=stop_after_attempt(10), wait=wait_random(min=2, max=5)) +@retry(stop=tenacity.stop_after_attempt(10), wait=tenacity.wait_random(min=2, max=5)) def resolve(): os.environ["FRONT_ADDRESS"] = socket.gethostbyname(os.environ.get("FRONT_ADDRESS", "front")) os.environ["REDIS_ADDRESS"] = socket.gethostbyname(os.environ.get("REDIS_ADDRESS", "redis")) diff --git a/core/postfix/start.py b/core/postfix/start.py index 30167da5..bfa13da2 100755 --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -5,11 +5,12 @@ import os import socket import glob import shutil +import tenacity from tenacity import retry convert = lambda src, dst: open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ)) -@retry(stop=stop_after_attempt(10), wait=wait_random(min=2, max=5)) +@retry(stop=tenacity.stop_after_attempt(10), wait=tenacity.wait_random(min=2, max=5)) def resolve(): os.environ["FRONT_ADDRESS"] = socket.gethostbyname(os.environ.get("FRONT_ADDRESS", "front")) diff --git a/services/rspamd/start.py b/services/rspamd/start.py index cb9a1788..3ef309b2 100755 --- a/services/rspamd/start.py +++ b/services/rspamd/start.py @@ -4,11 +4,12 @@ import jinja2 import os import socket import glob +import tenacity from tenacity import retry convert = lambda src, dst: open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ)) -@retry(stop=stop_after_attempt(10), wait=wait_random(min=2, max=5)) +@retry(stop=tenacity.stop_after_attempt(10), wait=tenacity.wait_random(min=2, max=5)) def resolve(): os.environ["FRONT_ADDRESS"] = socket.gethostbyname(os.environ.get("FRONT_ADDRESS", "front"))