@app.route('/report/<node_name>/<report_id>', defaults={'env': app.config['DEFAULT_ENVIRONMENT']})
@app.route('/<env>/report/<node_name>/<report_id>')
def report(env, node_name, report_id):
    """Displays a single report including all the events associated with that
    report and their status.

    The report_id may be the puppetdb's report hash or the
    configuration_version. This allows for better integration
    into puppet-hipchat.

    :param env: Search for reports in this environment
    :type env: :obj:`string`
    :param node_name: Find the reports whose certname match this value
    :type node_name: :obj:`string`
    :param report_id: The hash or the configuration_version of the desired
        report
    :type report_id: :obj:`string`
    """
    envs = environments()
    check_env(env, envs)

    if env == '*':
        query = '["and", ["=", "certname", "{0}"],' \
            '["or", ["=", "hash", "{1}"], ["=", "configuration_version", "{1}"]]]'.format(
                node_name, report_id)
    else:
        query = '["and", ["=", "environment", "{0}"], ["=", "certname", "{1}"],' \
            '["or", ["=", "hash", "{2}"], ["=", "configuration_version", "{2}"]]]'.format(
                env, node_name, report_id)
    reports = puppetdb.reports(query=query)

    try:
        report = next(reports)
    except __HOLE__:
        abort(404)

    return render_template(
        'report.html',
        report=report,
        events=yield_or_stop(report.events()),
        logs=report.logs,
        metrics=report.metrics,
        envs=envs,
        current_env=env)
dataset/ETHPy150Open voxpupuli/puppetboard/puppetboard/app.py/report