This file is indexed.

/usr/lib/obs/server/plugins/notify_rabbitmq.pm is in obs-server 2.7.1-10.

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
#
# Copyright (c) 2010 Anas Nashif, Intel Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (see the file COPYING); if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
################################################################
#
# Module to talk to RabbitMQ
#

package notify_rabbitmq;

use Net::AMQP::RabbitMQ;
use BSConfig;
use JSON::XS;
#use Data::UUID;

use strict;

sub new {
  my $self = {};
  bless $self, shift;
  return $self;
}

# compat...
my $defaultconfig = {
  'server' => "192.168.50.99",
  'user' => "mailer",
  'password' => "mailerpwd",
  'vhost' => "mailer_vhost",
};

sub notify() {
  my ($self, $type, $paramRef ) = @_;

  my $prefix = $BSConfig::notification_namespace || "OBS";
  $type ||= "UNKNOWN";
  $type =  "${prefix}_$type";

  #my $uu = Data::UUID->new;
  $paramRef ||= {};
  $paramRef->{'eventtype'} = $type;
  my $mq = Net::AMQP::RabbitMQ->new();
  my %rabbitparam = %{$BSConfig::rabbitmqconfig || $BSConfig::rabbitmqconfig || $defaultconfig};
  my $rabbitserver = delete $rabbitparam{'server'};
  $mq->connect($rabbitserver, \%rabbitparam);
  $mq->channel_open(1);
  #$mq->queue_declare(1, "mailer_queue");
  $mq->queue_bind(1, "mailer_queue", "mailer_exchange", "mailer");
  $mq->publish(1, "mailer", encode_json($paramRef), { exchange => 'mailer_exchange' });
  $mq->disconnect();
}

1;