mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
[feat] Also run query against mysql to ensure queries can complete
This commit is contained in:
@@ -24,12 +24,14 @@ def mysql_conn(retry):
|
|||||||
for i in range(0, retry):
|
for i in range(0, retry):
|
||||||
log.debug(f'Connection attempt {i+1}')
|
log.debug(f'Connection attempt {i+1}')
|
||||||
try:
|
try:
|
||||||
_mysql.connect(
|
db = _mysql.connect(
|
||||||
host=mainip,
|
host=mainip,
|
||||||
user='root',
|
user='root',
|
||||||
passwd=__salt__['pillar.get']('secrets:mysql')
|
passwd=__salt__['pillar.get']('secrets:mysql')
|
||||||
)
|
)
|
||||||
log.debug(f'Connected to MySQL server on {mainip} after {retry} attempts.')
|
log.debug(f'Connected to MySQL server on {mainip} after {i} attempts.')
|
||||||
|
db.query("""SELECT 1;""")
|
||||||
|
log.debug(f'Successfully completed query against MySQL server on {mainip}')
|
||||||
mysql_up = True
|
mysql_up = True
|
||||||
break
|
break
|
||||||
except _mysql.OperationalError as e:
|
except _mysql.OperationalError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user