Merge "fix(mariadb): handle IndexError"
This commit is contained in:
commit
9e48974fcf
@ -487,10 +487,15 @@ def get_grastate_val(key):
|
|||||||
key -- the key to extract the value of
|
key -- the key to extract the value of
|
||||||
"""
|
"""
|
||||||
logger.debug("Reading grastate.dat key={0}".format(key))
|
logger.debug("Reading grastate.dat key={0}".format(key))
|
||||||
with open("/var/lib/mysql/grastate.dat", "r") as myfile:
|
try:
|
||||||
grastate_raw = [s.strip() for s in myfile.readlines()]
|
with open("/var/lib/mysql/grastate.dat", "r") as myfile:
|
||||||
return [i for i in grastate_raw
|
grastate_raw = [s.strip() for s in myfile.readlines()]
|
||||||
if i.startswith("{0}:".format(key))][0].split(':')[1].strip()
|
return [i for i in grastate_raw
|
||||||
|
if i.startswith("{0}:".format(key))][0].split(':')[1].strip()
|
||||||
|
except IndexError:
|
||||||
|
logger.warn("IndexError: Unable to find %s with ':' in grastate.dat",
|
||||||
|
key)
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
def set_grastate_val(key, value):
|
def set_grastate_val(key, value):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user