Line | |
---|
1 | #!/usr/bin/env perl
|
---|
2 |
|
---|
3 | use warnings;
|
---|
4 | use strict;
|
---|
5 |
|
---|
6 | use lib "/usr/lib/obs/server";
|
---|
7 | #use BSConfiguration;
|
---|
8 | #use BSRPC;
|
---|
9 | use BSNotify;
|
---|
10 | use Data::Dumper;
|
---|
11 |
|
---|
12 | sub notify {
|
---|
13 | my ($type, $p) = @_;
|
---|
14 | # strip
|
---|
15 | $p = { map {$_ => $p->{$_}} grep {defined($p->{$_}) && !ref($p->{$_})} sort keys %{$p || {}} };
|
---|
16 | if (1) {
|
---|
17 | BSNotify::notify_plugins($type, $p);
|
---|
18 | } else {
|
---|
19 | # always route over to the src server
|
---|
20 | print "srcserver: ", $BSConfig::srcserver, "\n";
|
---|
21 | my $param = {
|
---|
22 | 'uri' => "$BSConfig::srcserver/notify/$type",
|
---|
23 | 'request' => 'POST',
|
---|
24 | 'headers' => [ 'Content-Type: application/x-www-form-urlencoded' ],
|
---|
25 | 'timeout' => 60,
|
---|
26 | };
|
---|
27 | my @args = map {"$_=$p->{$_}"} sort keys %$p;
|
---|
28 | print Dumper( @args );
|
---|
29 | eval {
|
---|
30 | BSRPC::rpc($param, undef, @args);
|
---|
31 | };
|
---|
32 | warn($@) if $@;
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | #notify( 'MY_TYPE', { project => 'myprj' , 'repo' => 'myrepo' } );
|
---|
37 | #notify( 'REPO_PUBLISHED', { 'project' => 'internal:master' , 'repository' => 'win_cross' } );
|
---|
38 | #notify( 'BUILD_SUCCESS', { 'project' => 'bareos:master', 'package' => 'bareos-docs', 'repository' => 'Debian_8.0', 'arch' => 'x86_64' } );
|
---|
39 | notify( 'BUILD_SUCCESS', { 'project' => 'internal:master', 'package' => 'winbareos-opsi', 'repository' => 'win_cross', 'arch' => 'x86_64' } );
|
---|
Note:
See
TracBrowser
for help on using the repository browser.