mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
[fix] Put mysql import in try,catch in case it hasn't been installed
This commit is contained in:
@@ -7,10 +7,15 @@ def status():
|
||||
|
||||
|
||||
def mysql_conn(retry):
|
||||
from MySQLdb import _mysql
|
||||
import time
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
from MySQLdb import _mysql
|
||||
except ImportError as e:
|
||||
log.error(e)
|
||||
return False
|
||||
from time import sleep
|
||||
|
||||
mainint = __salt__['pillar.get']('sensor:mainint', __salt__['pillar.get']('manager:mainint'))
|
||||
mainip = __salt__['grains.get']('ip_interfaces').get(mainint)[0]
|
||||
|
||||
@@ -30,7 +35,7 @@ def mysql_conn(retry):
|
||||
except Exception as e:
|
||||
log.error(e)
|
||||
break
|
||||
time.sleep(1)
|
||||
sleep(1)
|
||||
|
||||
if not mysql_up:
|
||||
log.error(f'Could not connect to MySQL server on {mainip} after {retry} attempts.')
|
||||
|
||||
Reference in New Issue
Block a user