source: obs_notify_generic/obs_send_notification.pl@ 1180

Last change on this file since 1180 was 1180, checked in by joergs, on Jun 10, 2015 at 5:45:03 PM

notify send test

  • Property svn:executable set to *
File size: 844 bytes
Line 
1#!/usr/bin/env perl
2
3use warnings;
4use strict;
5
6#use BSConfiguration;
7#use BSRPC;
8use BSNotify;
9use Data::Dumper;
10
11sub 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
35notify( 'MY_TYPE', { project => 'myprj' , 'repo' => 'myrepo' } );
Note: See TracBrowser for help on using the repository browser.