Commit 514855b8 authored by kaiyou's avatar kaiyou
Browse files

Add a jinja notifier to generate webpages

parent bc655a9b
Pipeline #149 passed with stage
in 59 seconds
def dashboard(name, state):
import celery
import jinja2
from amonit import util
def jinja(context, template, destination, load_conf=False, load_checks=False):
""" Generate a report using the jinja template engine
data = context.copy()
scheduler = celery.current_app.scheduler
if load_conf:
data["conf"] = scheduler.config.copy()
if load_checks:
data["checks"] = scheduler.state.asdict()
with open(template) as handle:
code =
with open(destination, "w") as handle:
handle.write(util.render(code, data))
import importlib
import jinja2
import sys
def resolve(function, cache={}):
......@@ -14,7 +15,10 @@ def resolve(function, cache={}):
def render(template, data):
""" Quickly render a jinja template with provided data dict
return jinja2.Template(template).render(**data)
return jinja2.Template(template).render(
def filter_match(candidate, filters):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment