From b4b305b1bcfef0d74b1d282d190c99065785621b Mon Sep 17 00:00:00 2001 From: Tim Steiner <tim.steiner@nebraska.edu> Date: Wed, 25 Sep 2019 16:05:04 -0500 Subject: [PATCH] In update-tg-config, use a predictable name for each haproxy server. --- update-tg-config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/update-tg-config.py b/update-tg-config.py index 1eba46f..d2a375c 100755 --- a/update-tg-config.py +++ b/update-tg-config.py @@ -10,6 +10,7 @@ import os import difflib import subprocess import stat +import hashlib def main(): if len(sys.argv) != 4: @@ -191,7 +192,7 @@ def generate_haproxy_config(config, tg_ips): ' #DO NOT EDIT!\n' ) for i, ip in enumerate(tg_ips): - server_list += ' server node%s %s:80\n' % (i, ip) + server_list += ' server %s %s:80\n' % (hashlib.sha256(ip).hexdigest()[:8], ip) server_list += ' #END SERVER LIST\n' pattern = re.compile(r'^\s*#BEGIN SERVER LIST\n #DO NOT EDIT!\n(.*\n)* #END SERVER LIST\n', re.MULTILINE) config = re.sub(pattern, server_list, config) -- GitLab