From 1acca459efc261dd4288c16a621cfc9d3b6316f6 Mon Sep 17 00:00:00 2001 From: chris meyers Date: Wed, 15 Apr 2020 13:28:13 -0400 Subject: [PATCH] nice error message when redis is down * awx_manage run_wsbroadcast --status nice error message if someone failed to start awx services (i.e. redis) --- awx/main/management/commands/run_wsbroadcast.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/awx/main/management/commands/run_wsbroadcast.py b/awx/main/management/commands/run_wsbroadcast.py index 62f571921d..31bfac87c0 100644 --- a/awx/main/management/commands/run_wsbroadcast.py +++ b/awx/main/management/commands/run_wsbroadcast.py @@ -4,6 +4,7 @@ import logging import asyncio import datetime import re +import redis from datetime import datetime as dt from django.core.management.base import BaseCommand @@ -91,7 +92,12 @@ class Command(BaseCommand): def handle(self, *arg, **options): if options.get('status'): - stats_all = BroadcastWebsocketStatsManager.get_stats_sync() + try: + stats_all = BroadcastWebsocketStatsManager.get_stats_sync() + except redis.exceptions.ConnectionError as e: + print(f"Unable to get Broadcast Websocket Status. Failed to connect to redis {e}") + return + data = {} for family in stats_all: if family.type == 'gauge' and len(family.samples) > 1: