Discussion:
[rancid] clogin and CSS bug and fix?
Max Allan
2009-07-23 10:35:00 UTC
Permalink
Hello,

I've just started using rancid (2.3.2) and I think I've found a minor clogin bug and fixed it.

I've got some CSSs that don't require enable, you log straight in to enable mode.

When the login tries to exit I get an error :
can't read "do_saveconfig": no such variable
while executing
"if {$do_saveconfig} {
catch {send "y\r"}
} else {
catch {send "n\r"}
}"
Daniel Medina
2009-07-23 14:09:59 UTC
Permalink
Post by Max Allan
I've just started using rancid (2.3.2) and I think I've found a minor clogin bug and fixed it.
I've got some CSSs that don't require enable, you log straight in to enable mode.
[...]
Any opinions?
Have you looked at setting autoenable / noenable in cloginrc?

Try "add autoenable * 1" to tell clogin that you're getting in already enabled.
--
Daniel Medina
Max Allan
2009-07-23 15:19:52 UTC
Permalink
Post by Daniel Medina
Try "add autoenable * 1" to tell clogin that you're getting in already enabled.
All the CSSs already have autoenable set. Which is why they're bypassing do_enable in clogin.
do_enable seems to set the scope of do_saveconfig to be global through all procs, so if they didn't autoenable, it would all work fine.

I do get the relevant config back from them even though clogin is giving a return code of 1 and dumping error text.

e.g.
max $ clogin -c "sh run" css1> css1.conf
can't read "do_saveconfig": no such variable
while executing
"if {$do_saveconfig} {
catch {send "y\r"}
} else {
catch {send "n\r"}
}"
invoked from within
"expect -nobrace -re {^[^
*]*css1([^#>\r\n]+)?[#>](\([^)\r\n]+\))?} {
# the Cisco CE and Jnx ERX
# return to non-enabled mode
..."
invoked from within
"expect {
-re "^\[^\n\r *]*$reprompt" {
# the Cisco CE and Jnx ERX
# return to non-enabled mode
# on exit in enabled mode.
..."
(procedure "run_commands" line 81)
invoked from within
"run_commands $prompt $command"
("foreach" body line 149)
invoked from within
"foreach router [lrange $argv $i end] {
set router [string tolower $router]
# attempt at platform switching.
set platform ""
send_user ..."
(file "/export/home/max/rancid/bin/clogin" line 727)

max $ echo $?
1

Thanks,
Max
_________________________________________________________________
With Windows Live, you can organise, edit, and share your photos.
http://clk.atdmt.com/UKM/go/134665338/direct/01/
john heasley
2009-07-23 15:50:50 UTC
Permalink
Post by Max Allan
Hello,
I've just started using rancid (2.3.2) and I think I've found a minor clogin bug and fixed it.
I've got some CSSs that don't require enable, you log straight in to enable mode.
can't read "do_saveconfig": no such variable
while executing
"if {$do_saveconfig} {
ftp://ftp.shrubbery.net/pub/rancid/rancid-2.3.2.p1
Post by Max Allan
catch {send "y\r"}
} else {
catch {send "n\r"}
}"
Loading...