Re: Re: problems using Net::SSH::Perl in a while loop
- From: "Radomir Hejl" <rh662121@xxxxxxxxx>
- Date: Fri, 29 Apr 2005 21:24:05 +0200
"Thonas Siegenthaler" <perl@xxxxxxxx> pí¹e v diskusním pøíspìvku
news:42721058$1_3@xxxxxxxxxxxxxxxxxx
> Hi Mark
>
> thank you for answering. Net::SSH::Perl calls Carp::croak(), which calls
> die().
>
> The question is what does the module do, if there is no die() call.
> I replaced Carp::croak() with a warn-message. The result is a endless
> list of error messages.
>
> Has anyone of you ever had a similar problem? Probably I should contact
> the
> developer of this module. It is not very intelligent to use a die() call
> within a module.
> A good module returns a errorcode and does not cancel the script.
>
> Greetz
> --Thomas
>
> Mark Clements schrieb:
>>Thonas Siegenthaler wrote:
>>> I want to usw Net:SSH::Perl to automatically run some commands on
>>> several
>>> hosts.
>>> All the hostnames are stored in a database.
>>>
>>> I decided to use Net::SSH::Perl because I can configure everything I
>>> need.
>>> The auth is
>>> done by a SSH-Key (RSA). Unfortunately not all of the hosts in the DB
>>> have
>>> the SSH
>>> Key stored in their ~/.ssh/authorized_keys. When I try to connect to one
>>> of
>>> these
>>> hosts using SSH2, my script dies because of a Carp::croak() call in the
>>> Net::SSH::Perl::AuthMgr module (line 142).
>>>
>>> Is there a way to turn off this "die" and just get a error-message
>>> instead?
>>> If a hosts doesn't
>>> have this ssh-key, I don't want to abort my script, I wnat to continue
>>> with
>>> the next hostname
>>> instead.
>>
>>I'm not familiar with this module, but you can normally wrap die calls
>>with eval:
>>
>>eval {
>>print "enter eval\n";
>>die "die here";
>>print "end eval\n";
>>};
>>if($@){
>>print "trapped error - $@";
>># handle error
>>}
>>print "script continues...\n";
>>
>>perldoc -f eval
>>
>>Mark
I use this module and also tried to circumvent dying of script.
I manually implemented all machines with the ssh keys and ping them before
running the relevant part of the script to evade unavailabity of the
machines.
Radek H.
.
- References:
- Re: Re: problems using Net::SSH::Perl in a while loop
- From: Thonas Siegenthaler
- Re: Re: problems using Net::SSH::Perl in a while loop
- Prev by Date: Re: flush writing to multiple children IO::Pipe
- Next by Date: Looking for SNMP-5.1.1/NetSNMP-5.1.1
- Previous by thread: Re: Re: problems using Net::SSH::Perl in a while loop
- Next by thread: MS SQL server and SQL DATETIME manipulation in perl
- Index(es):
Relevant Pages
|
|