import json import re from itertools import tee import commonmark from flask import (request, render_template, abort) from pypuppetdb.QueryBuilder import (AndOperator, EqualsOperator, OrOperator, LessEqualOperator, RegexOperator, GreaterEqualOperator) from puppetboard.core import get_app, get_puppetdb, environments, REPORTS_COLUMNS, to_html, \ get_raw_error, get_friendly_error from puppetboard.utils import (check_env, get_or_abort) app = get_app() puppetdb = get_puppetdb() @app.route('/reports/json', defaults={ 'env': app.config['DEFAULT_ENVIRONMENT'], 'node_name': None }) @app.route('/<env>/reports/json', defaults={'node_name': None}) @app.route('/reports/<node_name>/json', defaults={'env': app.config['DEFAULT_ENVIRONMENT']}) @app.route('/<env>/reports/<node_name>/json') def reports_ajax(env, node_name): """Query and Return JSON data to reports Jquery datatable :param env: Search for all reports in this environment
'name': 'End time', 'type': 'datetime'}, {'attr': 'status', 'name': 'Status', 'type': 'status'}, {'attr': 'certname', 'name': 'Certname', 'type': 'node'}, {'attr': 'version', 'filter': 'configuration_version', 'name': 'Configuration version'}, {'attr': 'agent_version', 'filter': 'puppet_version', 'name': 'Agent version'}, ] CATALOGS_COLUMNS = [ {'attr': 'certname', 'name': 'Certname', 'type': 'node'}, {'attr': 'catalog_timestamp', 'name': 'Compile Time'}, {'attr': 'form', 'name': 'Compare'}, ] app = get_app() graph_facts = app.config['GRAPH_FACTS'] numeric_level = getattr(logging, app.config['LOGLEVEL'].upper(), None) logging.basicConfig(level=numeric_level) log = logging.getLogger(__name__) puppetdb = get_puppetdb() @app.template_global() def version(): return __version__ def stream_template(template_name, **context):