Do not barf stack trace if stats DB is missing
This can happen if devstack fails to run, but we still run the post tasks. Also could happen if some sort of hybrid job configuration does not run all of devstack but we still end up running post jobs. Just warn to stderr and assume no DB info. Change-Id: I211a331ab668dbb0ad7882908cca4363f865d924
This commit is contained in:
parent
50e3c06ec2
commit
1cdf413ac6
@ -86,9 +86,17 @@ def get_processes_stats(matches):
|
||||
|
||||
def get_db_stats(host, user, passwd):
|
||||
dbs = []
|
||||
try:
|
||||
db = pymysql.connect(host=host, user=user, password=passwd,
|
||||
database='stats',
|
||||
cursorclass=pymysql.cursors.DictCursor)
|
||||
except pymysql.err.OperationalError as e:
|
||||
if 'Unknown database' in str(e):
|
||||
print('No stats database; assuming devstack failed',
|
||||
file=sys.stderr)
|
||||
return []
|
||||
raise
|
||||
|
||||
with db:
|
||||
with db.cursor() as cur:
|
||||
cur.execute('SELECT db,op,count FROM queries')
|
||||
|
Loading…
Reference in New Issue
Block a user