This file is indexed.

/usr/lib/python2.7/dist-packages/oops_amqp/trace.py is in python-oops-amqp 0.0.7-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright (c) 2012, Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, version 3 only.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# GNU Lesser General Public License version 3 (see the file LICENSE).

"""Trace OOPS reports coming from an AMQP queue."""

from functools import partial
import sys
import optparse
from textwrap import dedent

import amqplib.client_0_8 as amqp
import oops
import oops_amqp

import anybson as bson


def main(argv=None):
    if argv is None:
        argv=sys.argv
    usage = dedent("""\
        %prog [options]

        The following options must be supplied:
         --host

        e.g.
        oops-amqp-trace --host "localhost:3472"

        If you do not have a persistent queue, you should run this script
        before generating oopses, as AMQP will discard messages with no
        consumers.
        """)
    description = "Trace OOPS reports coming from an AMQP queue."
    parser = optparse.OptionParser(
        description=description, usage=usage)
    parser.add_option('--host', help="AQMP host / host:port.")
    parser.add_option('--username', help="AQMP username.", default="guest")
    parser.add_option('--password', help="AQMP password.", default="guest")
    parser.add_option('--vhost', help="AMQP vhost.", default="/")
    parser.add_option('--exchange', help="AMQP exchange name.", default="oopses")
    options, args = parser.parse_args(argv[1:])
    def needed(optname):
        if getattr(options, optname, None) is None:
            raise ValueError('option "%s" must be supplied' % optname)
    needed('host')
    factory = partial(
        amqp.Connection, host=options.host, userid=options.username,
        password=options.password, virtual_host=options.vhost)
    connection = factory()
    channel = connection.channel()
    channel.exchange_declare(options.exchange, type="fanout", durable=False,
        auto_delete=True)
    queue = channel.queue_declare(durable=False, auto_delete=True)[0]
    channel.queue_bind(queue, options.exchange)
    config = oops.Config()
    config.publisher = oops.pprint_to_stream(sys.stdout)
    receiver = oops_amqp.Receiver(config, factory, queue)
    try:
        receiver.run_forever()
    except KeyboardInterrupt:
        pass