Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from __future__ import absolute_import
from __future__ import unicode_literals
from collections import OrderedDict
from flask_wtf import FlaskForm
from wtforms import (BooleanField, RadioField, TextAreaField, validators)
from puppetboard.core import get_app
app = get_app()
QUERY_ENDPOINTS = OrderedDict([
# PuppetDB API endpoint, Form name
('nodes', 'Nodes'),
('resources', 'Resources'),
('facts', 'Facts'),
('factsets', 'Fact Sets'),
('fact-paths', 'Fact Paths'),
('fact-contents', 'Fact Contents'),
('reports', 'Reports'),
('events', 'Events'),
('catalogs', 'Catalogs'),
('edges', 'Edges'),
('environments', 'Environments'),
('pql', 'PQL'),
])
ENABLED_QUERY_ENDPOINTS = app.config.get(
from __future__ import absolute_import
from __future__ import unicode_literals
from flask import render_template
from werkzeug.exceptions import InternalServerError
from puppetboard.core import environments, get_app
app = get_app()
@app.errorhandler(400)
def bad_request(e):
envs = environments()
return render_template('400.html', envs=envs), 400
@app.errorhandler(403)
def forbidden(e):
envs = environments()
return render_template('403.html', envs=envs), 403
@app.errorhandler(404)
def not_found(e):
{'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):
app.update_template_context(context)