Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Commit

Permalink
Fix session
Browse files Browse the repository at this point in the history
  • Loading branch information
grewn0uille committed Mar 7, 2018
1 parent 33faf04 commit bbb474d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sherlog/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from itertools import groupby

import pygal
from flask import g

from sherlog.log_parser import get_config, get_session
from sherlog.model import Log


Expand All @@ -30,26 +30,25 @@ def build_list_service(data):


def get_data(server_name, ping_service, start):
dbsession = get_session(get_config())
if 'ping6' in ping_service:
data = (
dbsession.query(Log)
g.session.query(Log)
.filter(Log.server_name == server_name)
.filter(Log.command.contains('ping6'))
.filter(Log.start > start)
.all()
)
elif 'ping' in ping_service:
data = (
dbsession.query(Log)
g.session.query(Log)
.filter(Log.server_name == server_name)
.filter(Log.command.contains('ping '))
.filter(Log.start > start)
.all()
)
else:
data = (
dbsession.query(Log)
g.session.query(Log)
.filter(Log.host == ping_service)
.filter(Log.command == None) # noqa
.filter(Log.start > start)
Expand Down

0 comments on commit bbb474d

Please sign in to comment.