diff --git a/bin/netdisco-sshcollector b/bin/netdisco-sshcollector index a9de0fe3..82176dc8 100755 --- a/bin/netdisco-sshcollector +++ b/bin/netdisco-sshcollector @@ -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); diff --git a/lib/App/Netdisco/SSHCollector/Platform/ACE.pm b/lib/App/Netdisco/SSHCollector/Platform/ACE.pm index d33bffe4..e905e479 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/ACE.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/ACE.pm @@ -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); diff --git a/lib/App/Netdisco/SSHCollector/Platform/ASA.pm b/lib/App/Netdisco/SSHCollector/Platform/ASA.pm index e785994e..5d637e4d 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/ASA.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/ASA.pm @@ -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); diff --git a/lib/App/Netdisco/SSHCollector/Platform/CPVSX.pm b/lib/App/Netdisco/SSHCollector/Platform/CPVSX.pm index c2edd764..6ad33539 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/CPVSX.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/CPVSX.pm @@ -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); diff --git a/lib/App/Netdisco/SSHCollector/Platform/FreeBSD.pm b/lib/App/Netdisco/SSHCollector/Platform/FreeBSD.pm index fd3345a4..5df096f6 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/FreeBSD.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/FreeBSD.pm @@ -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); diff --git a/lib/App/Netdisco/SSHCollector/Platform/GAIAEmbedded.pm b/lib/App/Netdisco/SSHCollector/Platform/GAIAEmbedded.pm index 56dbeedd..9df5522f 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/GAIAEmbedded.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/GAIAEmbedded.pm @@ -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); diff --git a/lib/App/Netdisco/SSHCollector/Platform/Linux.pm b/lib/App/Netdisco/SSHCollector/Platform/Linux.pm index 549ec5b4..b8afafc2 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/Linux.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/Linux.pm @@ -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); diff --git a/lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm b/lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm index faeb6197..fba0b77e 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm @@ -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?$/;