diff options
Diffstat (limited to 'extensions/TryAutoLand/bin')
3 files changed, 190 insertions, 0 deletions
diff --git a/extensions/TryAutoLand/bin/TryAutoLand.getBugs.pl b/extensions/TryAutoLand/bin/TryAutoLand.getBugs.pl new file mode 100644 index 000000000..5d05831a8 --- /dev/null +++ b/extensions/TryAutoLand/bin/TryAutoLand.getBugs.pl @@ -0,0 +1,60 @@ +#!/usr/bin/perl -w +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +use XMLRPC::Lite; +use Data::Dumper; +use HTTP::Cookies; + +################################### +# Need to login first # +################################### + +my $username = shift; +my $password = shift; + +my $cookie_jar = new HTTP::Cookies( file => "/tmp/lwp_cookies.dat" ); + +my $rpc = new XMLRPC::Lite; + +$rpc->proxy('http://fedora/726193/xmlrpc.cgi'); + +$rpc->encoding('UTF-8'); + +$rpc->transport->cookie_jar($cookie_jar); + +my $call = $rpc->call( 'User.login', + { login => $username, password => $password } ); + +if ( $call->faultstring ) { + print $call->faultstring . "\n"; + exit; +} + +# Save the cookies in the cookie file +$rpc->transport->cookie_jar->extract_cookies( + $rpc->transport->http_response ); +$rpc->transport->cookie_jar->save; + +print "Successfully logged in.\n"; + +################################### +# Main call here # +################################### + +$call = $rpc->call('TryAutoLand.getBugs', { status => [] }); + +my $result = ""; +if ( $call->faultstring ) { + print $call->faultstring . "\n"; + exit; +} +else { + $result = $call->result; +} + +print Dumper($result); diff --git a/extensions/TryAutoLand/bin/TryAutoLand.updateStatus.pl b/extensions/TryAutoLand/bin/TryAutoLand.updateStatus.pl new file mode 100644 index 000000000..4a8f92089 --- /dev/null +++ b/extensions/TryAutoLand/bin/TryAutoLand.updateStatus.pl @@ -0,0 +1,65 @@ +#!/usr/bin/perl -w +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +use XMLRPC::Lite; +use Data::Dumper; +use HTTP::Cookies; + +################################### +# Need to login first # +################################### + +my $username = shift; +my $password = shift; + +my $cookie_jar = new HTTP::Cookies( file => "/tmp/lwp_cookies.dat" ); + +my $rpc = new XMLRPC::Lite; + +$rpc->proxy('http://fedora/726193/xmlrpc.cgi'); + +$rpc->encoding('UTF-8'); + +$rpc->transport->cookie_jar($cookie_jar); + +my $call = $rpc->call( 'User.login', + { login => $username, password => $password } ); + +if ( $call->faultstring ) { + print $call->faultstring . "\n"; + exit; +} + +# Save the cookies in the cookie file +$rpc->transport->cookie_jar->extract_cookies( + $rpc->transport->http_response ); +$rpc->transport->cookie_jar->save; + +print "Successfully logged in.\n"; + +################################### +# Main call here # +################################### + +my $attach_id = shift; +my $action = shift; +my $status = shift; + +$call = $rpc->call('TryAutoLand.update', + { attach_id => $attach_id, action => $action, status => $status }); + +my $result = ""; +if ( $call->faultstring ) { + print $call->faultstring . "\n"; + exit; +} +else { + $result = $call->result; +} + +print Dumper($result); diff --git a/extensions/TryAutoLand/bin/TryAutoLand.updateStatus_json.pl b/extensions/TryAutoLand/bin/TryAutoLand.updateStatus_json.pl new file mode 100644 index 000000000..f39b55229 --- /dev/null +++ b/extensions/TryAutoLand/bin/TryAutoLand.updateStatus_json.pl @@ -0,0 +1,65 @@ +#!/usr/bin/perl -w + +use JSON::RPC::Client; +use Data::Dumper; +use HTTP::Cookies; + +################################### +# Need to login first # +################################### + +my $username = shift; +my $password = shift; + +my $cookie_jar = HTTP::Cookies->new( file => "/tmp/lwp_cookies.dat" ); + +my $rpc = new JSON::RPC::Client; + +$rpc->ua->ssl_opts(verify_hostname => 0); + +my $uri = "http://fedora/726193/jsonrpc.cgi"; + +#$rpc->ua->cookie_jar($cookie_jar); + +#my $result = $rpc->call($uri, { method => 'User.login', params => +# { login => $username, password => $password } }); + +#if ($result) { +# if ($result->is_error) { +# print "Error : ", $result->error_message; +# exit; +# } +# else { +# print "Successfully logged in.\n"; +# } +#} +#else { +# print $rpc->status_line; +#} + +################################### +# Main call here # +################################### + +my $attach_id = shift; +my $action = shift; +my $status = shift; + +$result = $rpc->call($uri, { method => 'TryAutoLand.update', + params => { attach_id => $attach_id, + action => $action, + status => $status, + Bugzilla_login => $username, + Bugzilla_password => $password } }); + +if ($result) { + if ($result->is_error) { + print "Error : ", $result->error_message; + exit; + } +} +else { + print $rpc->status_line; +} + +print Dumper($result->result); |