From 7f2e1d46bcbc5f10d85c07571292783ff0378ac5 Mon Sep 17 00:00:00 2001 From: chris meyers Date: Thu, 19 Mar 2020 08:59:15 -0400 Subject: [PATCH] replace janky unique channel name w/ uuid * postgres notify/listen channel names have size limitations as well as character limitations. Respect those limitations while at the same time generate a unique channel name. --- awx/main/dispatch/control.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/awx/main/dispatch/control.py b/awx/main/dispatch/control.py index a7c8ce78de..ea3cd75ee6 100644 --- a/awx/main/dispatch/control.py +++ b/awx/main/dispatch/control.py @@ -1,5 +1,5 @@ import logging -import string +import uuid import random import json @@ -29,8 +29,7 @@ class Control(object): @classmethod def generate_reply_queue_name(cls): - letters = string.ascii_lowercase - return 'reply_to_{}'.format(''.join(random.choice(letters) for i in range(8))) + return f"reply_to_{str(uuid.uuid4()).replace('-','_')}" def control_with_reply(self, command, timeout=5): logger.warn('checking {} {} for {}'.format(self.service, command, self.queuename))