Exemplo n.º 1
0
def api_summary(content_type='json'):
    """
    Get health summary for all Resources within this instance.
    """

    health_summary = views.get_health_summary()

    # Convert Runs to dict-like structure
    for run in ['first_run', 'last_run']:
        run_obj = health_summary.get(run, None)
        if run_obj:
            health_summary[run] = run_obj.for_json()

    # Convert Resources failing to dict-like structure
    failed_resources = []
    for resource in health_summary['failed_resources']:
        failed_resources.append(resource.for_json())
    health_summary['failed_resources'] = failed_resources

    if content_type == 'json':
        result = jsonify(health_summary)
    else:
        result = '<pre>\n%s\n</pre>' % \
                 render_template('status_report_email.txt',
                                 lang=g.current_lang, summary=health_summary)
    return result
Exemplo n.º 2
0
def home():
    """homepage"""

    response = views.get_health_summary()
    return render_template('home.html', response=response)
Exemplo n.º 3
0
def home():
    """homepage"""

    response = views.get_health_summary()
    return render_template('home.html', response=response)