mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 07:30:02 +00:00
Start implementing Perl module dep check on --install.
This commit is contained in:
24
bin/pt-agent
24
bin/pt-agent
@@ -8037,6 +8037,7 @@ sub install {
|
||||
|
||||
my $stepno = 0;
|
||||
my @steps = (
|
||||
"Check Perl module dependencies",
|
||||
"Verify the user is root",
|
||||
"Connect to MySQL",
|
||||
"Verify the API key",
|
||||
@@ -8065,6 +8066,29 @@ sub install {
|
||||
# Pre-install checklist
|
||||
# ########################################################################
|
||||
|
||||
# Check Perl module dependencies
|
||||
$next_step->();
|
||||
my $deps = [
|
||||
[qw(DBD::mysql libdbd-mysql-perl ...)],
|
||||
[qw(JSON libjson-perl ...)],
|
||||
[qw(LWP libwww-perl ...)],
|
||||
[qw(IO::Socket::SSL libio-socket-ssl ...)],
|
||||
];
|
||||
my @missing_deps;
|
||||
foreach my $dep ( @$deps ) {
|
||||
eval "require $dep->[0]";
|
||||
if ( $EVAL_ERROR ) {
|
||||
push @missing_deps, $dep;
|
||||
}
|
||||
}
|
||||
if ( @missing_deps ) {
|
||||
warn "These required Perl modules need to be installed:\n\n";
|
||||
foreach my $dep ( @missing_deps ) {
|
||||
warn "$dep->[0]\n apt-get install $dep->[1]\n yum install $dep->[2]\n\n";
|
||||
}
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# 1. Must be root for --install.
|
||||
$next_step->();
|
||||
if ( $EUID != 0 ) {
|
||||
|
Reference in New Issue
Block a user