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