[rancid] rancid 2.3.6: clogin with multiple devices fails... ($autologin not defined)

P C pc50000 at gmail.com
Tue Sep 6 23:16:02 UTC 2011


Has any determined the best solution for this?  I just upgraded from
version 2.3.1_3 to 2.3.6 and now I'm having this problem too.

I used to do clogin -c "show inventory" `cat all_routers.txt` and it
would return said command for the routers listed in all_routers.txt,
with one router entry per line.

Now, the first routers runs fine, but each subsequent one gives this:

can't read "autoenable": no such variable
    while executing
"if { $enable && $do_enapasswd && $autoenable == 0 && [llength $pswd] < 2 } {
        send_user -- "\nError: no enable password for $router in
$password_file...."
    ("foreach" body line 28)
    invoked from within
"foreach router [lrange $argv $i end] {
    set router [string tolower $router]
    # attempt at platform switching.
    set platform ""
    send_user ..."
    (file "/usr/local/rancid/bin/clogin" line 743)


On Wed, Jul 13, 2011 at 6:57 PM, Jon Peatfield
<J.S.Peatfield at damtp.cam.ac.uk> wrote:
> On Wed, 13 Jul 2011, Lee wrote:
>
>>> I can see a number of possible fixes to the current clogin code but would
>>> prefer an expert to take a look at it...
>>
>>  ... crickets ...
>>
>> OK, how 'bout a proposed fix?  Starting at my line 756 in clogin it's:
>> set enable 0
>> foreach router [lrange $argv $i end] {
>>   set router [string tolower $router]
>>   # attempt at platform switching.
>>
>> Fix is to move the "set enable 0" line after the "foreach router [..."
>> line.
>
> Which does seem to fix it, or at least hide the underlying problems...
>
> My worry is that the code is testing $enable in the loop before it can be
> set other than to 0, so either the testing of $enable code is wrong, or it
> really is intended to be the value of $enable from the *previous* time round
> the loop, in which case the fix may break something subtle...
>
> Then there is the use of $autoenable itself, which I assume was left when
> the variable was renamed, but it isn't obvious (to me) if that should be
> $avautoenable or $ae since I don't understand what the test is meant to be
> doing...
>
> So we have (in the unfixed 2.3.6):
>
> ...
> set enable 0
> foreach router [lrange $argv $i end] {
> ...
>    # look for noenable option in .cloginrc
>    if { [find noenable $router] == "1" } {
>        set enable 0
>    }
> ...
>      if { $enable && $do_enapasswd && $autoenable == 0 && [llength $pswd] <
> 2 } {
>        send_user -- "\nError: no enable password for $router in
> $password_file.\n"
>        continue
>      }
> ...
> <things which set enable and tests of it>
> ...
> }
>
> so maybe that test of $enable just needs to be moved after the places where
> enable is set...
>
> I clearly don't understand the code.
>
>  -- Jon
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
>


More information about the Rancid-discuss mailing list