Remove version check bin type. Update all tools.

This commit is contained in:
Daniel Nichter
2014-02-19 19:00:02 -08:00
parent 01918ec71e
commit 94c806a33f
20 changed files with 4545 additions and 4897 deletions

View File

@@ -1913,7 +1913,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -2096,25 +2095,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -27,7 +27,7 @@ BEGIN {
TableNibbler
Daemon
MasterSlave
HTTPMicro
HTTP::Micro
VersionCheck
));
}
@@ -4199,25 +4199,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -4288,7 +4286,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -4353,14 +4351,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -4403,7 +4405,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -4667,6 +4669,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -4687,6 +4690,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -4842,9 +4846,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -4878,7 +4881,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -5109,7 +5112,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -5223,7 +5226,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -5406,25 +5408,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -27,7 +27,7 @@ BEGIN {
MySQLConfig
MySQLConfigComparer
ReportFormatter
HTTPMicro
HTTP::Micro
VersionCheck
));
}
@@ -3928,25 +3928,23 @@ no Lmo;
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -4017,7 +4015,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -4082,14 +4080,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -4132,7 +4134,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -4396,6 +4398,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -4416,6 +4419,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -4571,9 +4575,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -4607,7 +4610,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -4838,7 +4841,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -4952,7 +4955,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -5135,25 +5137,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -25,7 +25,7 @@ BEGIN {
DSNParser
Cxn
Daemon
HTTPMicro
HTTP::Micro
VersionCheck
Runtime
));
@@ -2993,25 +2993,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -3082,7 +3080,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -3147,14 +3145,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -3197,7 +3199,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -3461,6 +3463,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -3481,6 +3484,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -3636,9 +3640,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -3672,7 +3675,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -3903,7 +3906,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -4017,7 +4020,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -4200,25 +4202,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -22,7 +22,7 @@ BEGIN {
DiskstatsGroupByDisk
DiskstatsGroupBySample
DiskstatsMenu
HTTPMicro
HTTP::Micro
VersionCheck
));
}
@@ -3606,25 +3606,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -3695,7 +3693,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -3760,14 +3758,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -3810,7 +3812,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -4074,6 +4076,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -4094,6 +4097,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -4249,9 +4253,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -4285,7 +4288,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -4516,7 +4519,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -4630,7 +4633,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -4813,25 +4815,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -4651,7 +4651,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -4834,25 +4833,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -19,7 +19,7 @@ BEGIN {
Quoter
TableParser
Daemon
HTTPMicro
HTTP::Micro
VersionCheck
));
}
@@ -2350,25 +2350,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -2439,7 +2437,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -2504,14 +2502,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -2554,7 +2556,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -2818,6 +2820,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -2838,6 +2841,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -2993,9 +2997,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -3029,7 +3032,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -3260,7 +3263,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -3374,7 +3377,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -3557,25 +3559,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -20,7 +20,7 @@ BEGIN {
Cxn
Daemon
Transformers
HTTPMicro
HTTP::Micro
VersionCheck
Runtime
));
@@ -2498,25 +2498,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -2587,7 +2585,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -2652,14 +2650,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -2702,7 +2704,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -2966,6 +2968,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -2986,6 +2989,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -3141,9 +3145,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -3177,7 +3180,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -3408,7 +3411,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -3522,7 +3525,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -3705,25 +3707,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -22,7 +22,7 @@ BEGIN {
TableParser
Retry
Transformers
HTTPMicro
HTTP::Micro
VersionCheck
));
}
@@ -3522,25 +3522,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -3611,7 +3609,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -3676,14 +3674,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -3726,7 +3728,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -3990,6 +3992,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -4010,6 +4013,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -4165,9 +4169,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -4201,7 +4204,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -4432,7 +4435,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -4546,7 +4549,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -4729,25 +4731,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -29,7 +29,7 @@ BEGIN {
ExplainAnalyzer
IndexUsage
Progress
HTTPMicro
HTTP::Micro
VersionCheck
));
}
@@ -4998,25 +4998,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -5087,7 +5085,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -5152,14 +5150,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -5202,7 +5204,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -5466,6 +5468,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -5486,6 +5489,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -5641,9 +5645,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -5677,7 +5680,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -5908,7 +5911,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -6022,7 +6025,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -6205,25 +6207,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -31,7 +31,7 @@ BEGIN {
QueryRewriter
Retry
Cxn
HTTPMicro
HTTP::Micro
VersionCheck
));
}
@@ -5296,25 +5296,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -5385,7 +5383,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -5450,14 +5448,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -5500,7 +5502,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -5764,6 +5766,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -5784,6 +5787,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -5939,9 +5943,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -5975,7 +5978,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -6206,7 +6209,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -6320,7 +6323,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -6503,25 +6505,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -37,7 +37,7 @@ BEGIN {
Transformers
CleanupTask
IndexLength
HTTPMicro
HTTP::Micro
VersionCheck
Percona::XtraDB::Cluster
));
@@ -6310,25 +6310,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -6399,7 +6397,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -6464,14 +6462,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -6514,7 +6516,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -6778,6 +6780,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -6798,6 +6801,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -6953,9 +6957,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -6989,7 +6992,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -7220,7 +7223,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -7334,7 +7337,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -7517,25 +7519,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -12628,7 +12628,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -12811,25 +12810,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -24,7 +24,7 @@ BEGIN {
Daemon
Transformers
Retry
HTTPMicro
HTTP::Micro
VersionCheck
));
}
@@ -2875,25 +2875,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -2964,7 +2962,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -3029,14 +3027,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -3079,7 +3081,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -3343,6 +3345,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -3363,6 +3366,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -3518,9 +3522,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -3554,7 +3557,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -3785,7 +3788,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -3899,7 +3902,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -4082,25 +4084,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -25,7 +25,7 @@ BEGIN {
DSNParser
MasterSlave
Daemon
HTTPMicro
HTTP::Micro
VersionCheck
));
}
@@ -3524,25 +3524,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -3613,7 +3611,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -3678,14 +3676,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -3728,7 +3730,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -3992,6 +3994,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -4012,6 +4015,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -4167,9 +4171,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -4203,7 +4206,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -4434,7 +4437,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -4548,7 +4551,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -4731,25 +4733,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -14,7 +14,7 @@ use warnings FATAL => 'all';
BEGIN {
$INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw(
Percona::Toolkit
HTTPMicro
HTTP::Micro
VersionCheck
DSNParser
OptionParser
@@ -110,25 +110,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -199,7 +197,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -264,14 +262,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -314,7 +316,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -578,6 +580,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -598,6 +601,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -753,9 +757,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -789,7 +792,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -1020,7 +1023,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -1134,7 +1137,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -1317,25 +1319,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -39,7 +39,7 @@ BEGIN {
SchemaIterator
Transformers
Retry
HTTPMicro
HTTP::Micro
VersionCheck
));
}
@@ -8384,25 +8384,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -8473,7 +8471,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -8538,14 +8536,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -8588,7 +8590,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -8852,6 +8854,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -8872,6 +8875,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -9027,9 +9031,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -9063,7 +9066,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -9294,7 +9297,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -9408,7 +9411,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -9591,25 +9593,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -27,7 +27,7 @@ BEGIN {
Daemon
Outfile
Retry
HTTPMicro
HTTP::Micro
VersionCheck
QueryRewriter
VersionParser
@@ -3304,25 +3304,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -3393,7 +3391,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -3458,14 +3456,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -3508,7 +3510,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -3772,6 +3774,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -3792,6 +3795,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -3947,9 +3951,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -3983,7 +3986,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -4214,7 +4217,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -4328,7 +4331,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -4511,25 +4513,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -28,7 +28,7 @@ BEGIN {
Advisor
AdvisorRules
VariableAdvisorRules
HTTPMicro
HTTP::Micro
VersionCheck
));
}
@@ -3782,25 +3782,23 @@ sub _d {
# ###########################################################################
# ###########################################################################
# HTTPMicro package
# HTTP::Micro package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the Bazaar repository at,
# lib/HTTPMicro.pm
# t/lib/HTTPMicro.t
# lib/HTTP/Micro.pm
# t/lib/HTTP/Micro.t
# See https://launchpad.net/percona-toolkit for more information.
# ###########################################################################
{
package HTTP::Micro;
our $VERSION = '0.01';
package HTTPMicro;
BEGIN {
$HTTPMicro::VERSION = '0.001';
}
use strict;
use warnings;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp ();
my @attributes;
BEGIN {
@attributes = qw(agent timeout);
@@ -3871,7 +3869,7 @@ sub _request {
headers => {},
};
my $handle = HTTPMicro::Handle->new(timeout => $self->{timeout});
my $handle = HTTP::Micro::Handle->new(timeout => $self->{timeout});
$handle->connect($scheme, $host, $port);
@@ -3936,14 +3934,18 @@ sub _split_url {
return ($scheme, $host, $port, $path_query);
}
package
HTTPMicro::Handle; # hide from PAUSE/indexers
use strict;
use warnings;
} # HTTP::Micro
use Carp qw[croak];
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
{
package HTTP::Micro::Handle;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Carp qw(croak);
use Errno qw(EINTR EPIPE);
use IO::Socket qw(SOCK_STREAM);
sub BUFSIZE () { 32768 }
@@ -3986,7 +3988,7 @@ sub connect {
croak(qq/Unsupported URL scheme '$scheme'\n/);
}
$self->{fh} = 'IO::Socket::INET'->new(
$self->{fh} = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
Proto => 'tcp',
@@ -4250,6 +4252,7 @@ sub can_write {
my $self = shift;
return $self->_do_timeout('write', @_)
}
} # HTTP::Micro::Handle
my $prog = <<'EOP';
BEGIN {
@@ -4270,6 +4273,7 @@ BEGIN {
}
}
{
use Carp qw(croak);
my %dispatcher = (
issuer => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_issuer_name( shift )) },
subject => sub { Net::SSLeay::X509_NAME_oneline( Net::SSLeay::X509_get_subject_name( shift )) },
@@ -4425,9 +4429,8 @@ if ( $INC{"IO/Socket/SSL.pm"} ) {
}
1;
}
# ###########################################################################
# End HTTPMicro package
# End HTTP::Micro package
# ###########################################################################
# ###########################################################################
@@ -4461,7 +4464,7 @@ use FindBin qw();
eval {
require Percona::Toolkit;
require HTTPMicro;
require HTTP::Micro;
};
{
@@ -4692,7 +4695,7 @@ sub pingback {
my $url = $args{url};
my $instances = $args{instances};
my $ua = $args{ua} || HTTPMicro->new( timeout => 3 );
my $ua = $args{ua} || HTTP::Micro->new( timeout => 3 );
my $response = $ua->request('GET', $url);
PTDEBUG && _d('Server response:', Dumper($response));
@@ -4806,7 +4809,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -4989,25 +4991,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

View File

@@ -1,4 +1,4 @@
# This program is copyright 2012-2013 Percona Ireland Ltd.
# This program is copyright 2012-2014 Percona Ireland Ltd.
# Feedback and improvements are welcome.
#
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
@@ -479,7 +479,6 @@ my %sub_for_type = (
perl_version => \&get_perl_version,
perl_module_version => \&get_perl_module_version,
mysql_variable => \&get_mysql_variable,
bin_version => \&get_bin_version,
);
sub valid_item {
@@ -669,25 +668,6 @@ sub get_from_mysql {
return \%version_for;
}
sub get_bin_version {
my (%args) = @_;
my $item = $args{item};
my $cmd = $item->{item};
return unless $cmd;
my $sanitized_command = File::Basename::basename($cmd);
PTDEBUG && _d('cmd:', $cmd, 'sanitized:', $sanitized_command);
return if $sanitized_command !~ /\A[a-zA-Z0-9_-]+\z/;
my $output = `$sanitized_command --version 2>&1`;
PTDEBUG && _d('output:', $output);
my ($version) = $output =~ /v?([0-9]+\.[0-9]+(?:\.[\w-]+)?)/;
PTDEBUG && _d('Version for', $sanitized_command, '=', $version);
return $version;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }