Ejemplo n.º 1
0
def reports_node(node):
    """Fetches all reports for a node and processes them eventually rendering
    a table displaying those reports."""
    reports = ten_reports(
        yield_or_stop(puppetdb.reports(
            '["=", "certname", "{0}"]'.format(node))))
    return render_template('reports_node.html', reports=reports, nodename=node)
Ejemplo n.º 2
0
def reports_node(node):
    """Fetches all reports for a node and processes them eventually rendering
    a table displaying those reports."""
    reports = ten_reports(yield_or_stop(
        puppetdb.reports('["=", "certname", "{0}"]'.format(node))))
    return render_template(
        'reports_node.html',
        reports=reports,
        nodename=node)
Ejemplo n.º 3
0
def node(node_name):
    """Display a dashboard for a node showing as much data as we have on that
    node. This includes facts and reports but not Resources as that is too
    heavy to do within a single request.
    """
    node = get_or_abort(puppetdb.node, node_name)
    facts = node.facts()
    reports = ten_reports(node.reports())
    return render_template("node.html", node=node, facts=yield_or_stop(facts), reports=yield_or_stop(reports))
Ejemplo n.º 4
0
def reports_node(node):
    """Fetches all reports for a node and processes them eventually rendering
    a table displaying those reports."""
    if app.config["PUPPETDB_API"] > 2:
        reports = ten_reports(yield_or_stop(puppetdb.reports('["=", "certname", "{0}"]'.format(node))))
    else:
        log.warn("PuppetDB API prior to v3 cannot access reports.")
        abort(412)
    return render_template("reports_node.html", reports=reports, nodename=node)
Ejemplo n.º 5
0
def reports_node(node):
    """Fetches all reports for a node and processes them eventually rendering
    a table displaying those reports."""
    if app.config["PUPPETDB_EXPERIMENTAL"]:
        reports = ten_reports(yield_or_stop(puppetdb.reports('["=", "certname", "{0}"]'.format(node))))
    else:
        log.warn("Access to experimental endpoint not allowed.")
        abort(412)
    return render_template("reports_node.html", reports=reports, nodename=node)
Ejemplo n.º 6
0
def report_latest(node_name):
    """Redirect to the latest report of a given node. This is a workaround
    as long as PuppetDB can't filter reports for latest-report? field. This
    feature has been requested: http://projects.puppetlabs.com/issues/21554
    """
    # TODO: use limit parameter in _query to get just one report
    node = get_or_abort(puppetdb.node, node_name)
    reports = ten_reports(node.reports())
    report = list(yield_or_stop(reports))[0]
    return redirect(url_for('report', node=node_name, report_id=report))
Ejemplo n.º 7
0
def report_latest(node_name):
    """Redirect to the latest report of a given node. This is a workaround
    as long as PuppetDB can't filter reports for latest-report? field. This
    feature has been requested: http://projects.puppetlabs.com/issues/21554
    """
    # TODO: use limit parameter in _query to get just one report
    node = get_or_abort(puppetdb.node, node_name)
    reports = ten_reports(node.reports())
    report = list(yield_or_stop(reports))[0]
    return redirect(url_for('report', node=node_name, report_id=report))
Ejemplo n.º 8
0
def reports_node(node):
    """Fetches all reports for a node and processes them eventually rendering
    a table displaying those reports."""
    if app.config['PUPPETDB_EXPERIMENTAL']:
        reports = ten_reports(yield_or_stop(
            puppetdb.reports('["=", "certname", "{0}"]'.format(node))))
    else:
        log.warn('Access to experimental endpoint not allowed.')
        abort(412)
    return render_template('reports_node.html', reports=reports,
            nodename=node)
Ejemplo n.º 9
0
def node(node_name):
    """Display a dashboard for a node showing as much data as we have on that
    node. This includes facts and reports but not Resources as that is too
    heavy to do within a single request.
    """
    node = get_or_abort(puppetdb.node, node_name)
    facts = node.facts()
    reports = ten_reports(node.reports())
    return render_template('node.html',
                           node=node,
                           facts=yield_or_stop(facts),
                           reports=yield_or_stop(reports))
Ejemplo n.º 10
0
def node(node_name):
    """Display a dashboard for a node showing as much data as we have on that
    node. This includes facts and reports but not Resources as that is too
    heavy to do within a single request.
    """
    node = get_or_abort(puppetdb.node, node_name)
    facts =  node.facts()
    if app.config['PUPPETDB_EXPERIMENTAL']:
        reports = ten_reports(node.reports())
    else:
        reports = iter([])
    return render_template('node.html', node=node, facts=yield_or_stop(facts),
            reports=yield_or_stop(reports))