mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-26 05:58:16 +00:00
Begin to fill in pt-agent. Use new, experimental Percona::Toolkit. Remove Versions resource; add as optional attrib to Agent resource.
This commit is contained in:
@@ -19,7 +19,45 @@
|
||||
# ###########################################################################
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
our $VERSION = '2.1.7';
|
||||
our $VERSION = '3.0.0';
|
||||
|
||||
use Carp qw(carp cluck);
|
||||
use Data::Dumper qw();
|
||||
$Data::Dumper::Indent = 1;
|
||||
$Data::Dumper::Sortkeys = 1;
|
||||
$Data::Dumper::Quotekeys = 0;
|
||||
|
||||
use Exporter 'import';
|
||||
our @EXPORT = qw(
|
||||
have_required_args
|
||||
Dumper
|
||||
_d
|
||||
);
|
||||
|
||||
sub have_required_args {
|
||||
my ($args, @required_args) = @_;
|
||||
my $have_required_args = 1;
|
||||
foreach my $arg ( @required_args ) {
|
||||
if ( !defined $args->{$arg} ) {
|
||||
$have_required_args = 0;
|
||||
carp "Argument $arg is not defined";
|
||||
}
|
||||
}
|
||||
cluck unless $have_required_args; # print backtrace
|
||||
return $have_required_args;
|
||||
}
|
||||
|
||||
sub Dumper {
|
||||
Data::Dumper::Dumper(@_);
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
map { defined $_ ? $_ : 'undef' }
|
||||
@_;
|
||||
print STDERR "# $package:$line $PID ", join(' ', @_), "\n";
|
||||
}
|
||||
|
||||
1;
|
||||
}
|
||||
|
@@ -15,12 +15,11 @@ has 'hostname' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
required => 1,
|
||||
default => sub { return `hostname 2>/dev/null` },
|
||||
);
|
||||
|
||||
has 'versions' => (
|
||||
is => 'ro',
|
||||
isa => 'Maybe[Percona::WebAPI::Resource::Versions]',
|
||||
isa => 'Maybe[HashRef]',
|
||||
required => 0,
|
||||
default => undef,
|
||||
);
|
||||
|
@@ -1,14 +0,0 @@
|
||||
package Percona::WebAPI::Resource::Versions;
|
||||
|
||||
use Mo;
|
||||
|
||||
with 'Percona::WebAPI::Representation::JSON';
|
||||
with 'Percona::WebAPI::Representation::HashRef';
|
||||
|
||||
has 'versions' => (
|
||||
is => 'ro',
|
||||
isa => 'HashRef',
|
||||
required => 1,
|
||||
);
|
||||
|
||||
1;
|
Reference in New Issue
Block a user