From b3c527e7a91ae2f266001b992d2e9fc257ba64e4 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Tue, 10 Nov 2020 10:05:06 -0500 Subject: [PATCH] [refactor] Code cleanup pt. 2 --- salt/_modules/so.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/salt/_modules/so.py b/salt/_modules/so.py index 9a3706c78..a15e7ee66 100644 --- a/salt/_modules/so.py +++ b/salt/_modules/so.py @@ -25,15 +25,17 @@ def mysql_conn(retry): log.debug(f'Connection attempt {i+1}') try: _mysql.connect( - host=mainip, - user="root", - passwd=__salt__['pillar.get']('secrets:mysql') + host=mainip, + user='root', + passwd=__salt__['pillar.get']('secrets:mysql') ) + log.debug(f'Connected to MySQL server on {mainip} after {retry} attempts.') mysql_up = True break except _mysql.OperationalError as e: log.debug(e) except Exception as e: + log.error('Unexpected error occured.') log.error(e) break sleep(1)