Change-Id: Ic6834b6fa36d03c6c4633ae4093d26f74af8559a
This commit is contained in:
Mikhail S Medvedev 2015-11-13 14:23:57 -06:00
parent fb75343650
commit 32315f3e13
7 changed files with 26 additions and 13 deletions

View File

@ -13,14 +13,17 @@
# under the License. # under the License.
from collections import OrderedDict from collections import OrderedDict
from datetime import datetime, timedelta from datetime import datetime
from datetime import timedelta
from flask import request from flask import request
from sqlalchemy import and_ from sqlalchemy import and_
from sqlalchemy import desc from sqlalchemy import desc
from ciwatch import db from ciwatch import db
from ciwatch.models import CiServer, Project, PatchSet from ciwatch.models import CiServer
from ciwatch.models import PatchSet
from ciwatch.models import Project
TIME_OPTIONS = OrderedDict([ # Map time options to hours TIME_OPTIONS = OrderedDict([ # Map time options to hours

View File

@ -15,8 +15,9 @@
from sqlalchemy import create_engine from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import sessionmaker
from ciwatch.config import cfg
from ciwatch.config import get_projects
from ciwatch import models from ciwatch import models
from ciwatch.config import cfg, get_projects
engine = create_engine(cfg.database.connection) engine = create_engine(cfg.database.connection)

View File

@ -12,15 +12,20 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from datetime import datetime
import json import json
import paramiko import paramiko
import time
from datetime import datetime
import re import re
import time
from ciwatch import db, models from ciwatch import db
from ciwatch.log import logger, DATA_DIR from ciwatch import models
from ciwatch.config import cfg, get_projects
from ciwatch.log import DATA_DIR
from ciwatch.log import logger
from ciwatch.config import cfg
from ciwatch.config import get_projects
def _process_project_name(project_name): def _process_project_name(project_name):
@ -54,7 +59,8 @@ def _is_ci_user(name):
def _is_valid(event): def _is_valid(event):
if (event.get('type', 'nill') == 'comment-added' and if (event.get('type', 'nill') == 'comment-added' and
_is_ci_user(event['author'].get('name', '')) and _is_ci_user(event['author'].get('name', '')) and
_process_project_name(event['change']['project']) in get_projects() and _process_project_name(
event['change']['project']) in get_projects() and
event['change']['branch'] == 'master'): event['change']['branch'] == 'master'):
return True return True
return False return False

View File

@ -14,7 +14,9 @@
import re import re
from jinja2 import evalcontextfilter, Markup, escape from jinja2 import escape
from jinja2 import evalcontextfilter
from jinja2 import Markup
from ciwatch.server import app from ciwatch.server import app

View File

@ -15,7 +15,8 @@
import os import os
from ciwatch import db from ciwatch import db
from ciwatch.events import parse_json_event, add_event_to_db from ciwatch.events import add_event_to_db
from ciwatch.events import parse_json_event
from ciwatch.log import DATA_DIR from ciwatch.log import DATA_DIR

View File

@ -16,8 +16,8 @@ from flask import Flask
app = Flask(__name__) app = Flask(__name__)
from ciwatch import views # noqa
from ciwatch import filters # noqa from ciwatch import filters # noqa
from ciwatch import views # noqa
__version__ = "0.0.1" __version__ = "0.0.1"

View File

@ -16,10 +16,10 @@ from flask import render_template
from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.orm.exc import NoResultFound
from werkzeug.exceptions import abort from werkzeug.exceptions import abort
from ciwatch.server import app
from ciwatch.api import get_context from ciwatch.api import get_context
from ciwatch.api import get_projects from ciwatch.api import get_projects
from ciwatch.cache import cached from ciwatch.cache import cached
from ciwatch.server import app
@app.route("/") @app.route("/")