Skip to content
Snippets Groups Projects
Commit b4b305b1 authored by Tim Steiner's avatar Tim Steiner
Browse files

In update-tg-config, use a predictable name for each haproxy server.

parent 846907f0
Branches
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment