|No such thing as a small change|
Net::SSH::Perl - stops script execution on authentication failureby GA_L (Initiate)
|on Apr 23, 2010 at 13:02 UTC||Need Help??|
GA_L has asked for the
wisdom of the Perl Monks concerning the following question:
Hi Perl Monk, this is my very first post here, so hi everybody!
I am currently writing a script that is connecting to all our Linux servers and gets information such as Network configuration, OS type, architecture, running services and so on...
We are getting the server IP from a database where ALL our equipment is listed - which includes appliances/switches/router, therefore without the correct credentials. Note that before trying to authenticate against any equipment, I am checking if the remote server has port 22 opened.
The problem I am seeing is that when the code (CF below) is failing to authenticate against an equipment, the scripts exits.
I have surrounded the connection to the server with an "eval" statement which I thought would have prevented the script from exiting and instead, display the error but it is just failing with the following error message:
I have tried and used Error.pm and surrounded the connection statement with a "try/catch/finally" statement but the result was the same ...
Here is the code I am running to connect to the remote SSH server:
Does anyone has any experience with this Perl module (Net::SSH::Perl) and could give me some help with this issue?
Thanks a lot in advance :)