Re: Re: problems using Net::SSH::Perl in a while loop




"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.


.



Relevant Pages

  • Re: Re: problems using Net::SSH::Perl in a while loop
    ... > The question is what does the module do, if there is no die() call. ... > list of error messages. ... I don't think that's what Mark ... function sometimes dies, killing the whole script. ...
    (comp.lang.perl.modules)
  • Re: 1945 Merc FSB?
    ... The problem lies between the 2nd and 3rd bundle stick from the left. ... some additional die burn by the designers initials. ... Looks like there's a contact mark across the center band which hides ...
    (rec.collecting.coins)
  • Re: pipe benders for aluminum
    ... mark wrote: ... distortion in the bend area, measuring the bend is a pain, and the ... Would annealing the steel pipe make any ... The pipe should fit fairly snug in the die, if there is too much wiggle room side to side it will kink. ...
    (rec.crafts.metalworking)
  • Re: 1945 Merc FSB?
    ... The obverse has a very non ... the die which so happens to be the bands on the torch and from die abrasion. ... super fine detailed design element--it just ain't happening. ... The contact mark looks like one of those that'll drive you crazy--it's ...
    (rec.collecting.coins)
  • Re: Battlestar Galactica returs for 3rd season
    ... Didn't her character have just six ... > prophecy says she's supposed to die. ... He could easily be way off the mark. ...
    (rec.arts.tv)