#431 sshcollector calls die() even if all the work is not done - stromsoe

This commit is contained in:
Oliver Gorwits
2018-10-19 14:59:32 +01:00
parent d4b79f685b
commit 2818591462
8 changed files with 40 additions and 8 deletions

View File

@@ -257,7 +257,11 @@ Depending on the target system, it can be queried using simple methods like
or automated via Expect - this is mostly useful for non-Linux appliances which
don't support command execution via ssh:
my ($pty, $pid) = $ssh->open2pty or die "unable to run remote command";
my ($pty, $pid) = $ssh->open2pty;
unless ($pty) {
debug "unable to run remote command [$hostlabel] " . $ssh->error;
return ();
}
my $expect = Expect->init($pty);
my $prompt = qr/#/;
my ($pos, $error, $match, $before, $after) = $expect->expect(10, -re, $prompt);

View File

@@ -47,7 +47,11 @@ sub arpnip{
debug "$hostlabel $$ arpnip()";
my ($pty, $pid) = $ssh->open2pty or die "unable to run remote command";
my ($pty, $pid) = $ssh->open2pty;
unless ($pty) {
debug "unable to run remote command [$hostlabel] " . $ssh->error;
return ();
}
my $expect = Expect->init($pty);
my ($pos, $error, $match, $before, $after);

View File

@@ -53,7 +53,11 @@ sub arpnip {
debug "$hostlabel $$ arpnip()";
my ($pty, $pid) = $ssh->open2pty or die "unable to run remote command";
my ($pty, $pid) = $ssh->open2pty;
unless ($pty) {
debug "unable to run remote command [$hostlabel] " . $ssh->error;
return ();
}
my $expect = Expect->init($pty);
my ($pos, $error, $match, $before, $after);

View File

@@ -50,7 +50,11 @@ sub arpnip {
debug "$hostlabel $$ arpnip()";
my ($pty, $pid) = $ssh->open2pty or die "unable to run remote command";
my ($pty, $pid) = $ssh->open2pty;
unless ($pty) {
debug "unable to run remote command [$hostlabel] " . $ssh->error;
return ();
}
my $expect = Expect->init($pty);
my ($pos, $error, $match, $before, $after);

View File

@@ -48,7 +48,11 @@ sub arpnip {
debug "$hostlabel $$ arpnip()";
my ($pty, $pid) = $ssh->open2pty or die "unable to run remote command";
my ($pty, $pid) = $ssh->open2pty;
unless ($pty) {
debug "unable to run remote command [$hostlabel] " . $ssh->error;
return ();
}
my $expect = Expect->init($pty);
my ($pos, $error, $match, $before, $after);

View File

@@ -50,7 +50,11 @@ sub arpnip {
debug "$hostlabel $$ arpnip()";
my ($pty, $pid) = $ssh->open2pty or die "unable to run remote command";
my ($pty, $pid) = $ssh->open2pty;
unless ($pty) {
debug "unable to run remote command [$hostlabel] " . $ssh->error;
return ();
}
my $expect = Expect->init($pty);
my ($pos, $error, $match, $before, $after);

View File

@@ -48,7 +48,11 @@ sub arpnip {
debug "$hostlabel $$ arpnip()";
my ($pty, $pid) = $ssh->open2pty or die "unable to run remote command";
my ($pty, $pid) = $ssh->open2pty;
unless ($pty) {
debug "unable to run remote command [$hostlabel] " . $ssh->error;
return ();
}
my $expect = Expect->init($pty);
my ($pos, $error, $match, $before, $after);

View File

@@ -39,7 +39,11 @@ sub arpnip{
debug "$hostlabel $$ arpnip()";
my ($pty, $pid) = $ssh->open2pty or die "unable to run remote command";
my ($pty, $pid) = $ssh->open2pty;
unless ($pty) {
debug "unable to run remote command [$hostlabel] " . $ssh->error;
return ();
}
my $expect = Expect->init($pty);
my ($pos, $error, $match, $before, $after);
my $prompt = qr/> \r?$/;