[rancid] [PATCH 2/2] Multiple fixes/improvements for Extreme XOS

john heasley heas at shrubbery.net
Wed Nov 30 21:51:10 UTC 2011


Wed, Nov 30, 2011 at 08:12:43PM +0200, Zenon Mousmoulas:
> On Tue, 29 Nov 2011 22:51:46 +0000, john heasley <heas at shrubbery.net>
> wrote:
> > Mon, Nov 28, 2011 at 03:36:45PM +0200, Zenon Mousmoulas:
> >> Improve support for Extreme Networks devices running XOS:
> >> - The pager can be disabled per session since XOS 12.3, try to do that
> >>   in order to avoid struggling with pager prompts and ANSI sequences
> >>   altogether (clogin).
> > 
> >> +++ rancid-2.3.6-grnet/bin/clogin.in	2011-11-26 00:15:17.000000000
> +0200
> >> @@ -610,11 +610,9 @@
> >>      global do_saveconfig in_proc platform
> >>      set in_proc 1
> >>  
> >> -    # If the prompt is (enable), then we are on a switch and the
> >> -    # command is "set length 0"; otherwise its "terminal length 0".
> >> -    # skip if its an extreme (since the pager can not be disabled on a
> >> -    # per-vty basis).
> >>      if { [ string compare "extreme" "$platform" ] } {
> >> +        # If the prompt is (enable), then we are on a switch and the
> >> +        # command is "set length 0"; otherwise its "terminal length
> 0".
> >>  	if [ regexp -- ".*> .*enable" "$prompt" ] {
> >>  	    send "set length 0\r"
> >>  	    # This is ugly, but reduces code duplication, allowing the
> >> @@ -631,7 +629,12 @@
> >>  	    -re "\[\n\r]+"	{ exp_continue }
> >>  	}
> >>      } else {
> >> +	send "disable clipaging\r"
> >>  	set reprompt $prompt
> >> +	expect {
> >> +	    -re $reprompt	{}
> >> +	    -re "\[\n\r]+"	{ exp_continue }
> >> +	}
> >>      }
> >>  
> >>      # this is the only way i see to get rid of more prompts in
> >>      o/p..grrrrr
> >> @@ -640,11 +643,14 @@
> >>      set commands [split $command \;]
> >>      set num_commands [llength $commands]
> >>      # the pager can not be turned off on the PIX, so we have to look
> >> -    # for the "More" prompt.  the extreme is equally obnoxious, with a
> >> -    # global switch in the config.
> >> +    # for the "More" prompt.
> > 
> > i think this what you really want:
> 
> The following diff seems to be against some version of clogin (other
> than 2.3.6) I don't have access to (is there a public source code repo
> for rancid, btw?) so I can not apply/try it and therefore I'm not sure
> if it is what I really want.

attached

> > Index: bin/clogin.in
> > ===================================================================
> > --- bin/clogin.in	(revision 2340)
> > +++ bin/clogin.in	(working copy)
> > @@ -633,8 +633,8 @@
> >      set commands [split $command \;]
> >      set num_commands [llength $commands]
> >      # the pager can not be turned off on the PIX, so we have to look
> > -    # for the "More" prompt.  the extreme is equally obnoxious, with a
> > -    # global switch in the config.
> > +    # for the "More" prompt.  the extreme is equally obnoxious in
> > pre-12.3 XOS,
> > +    # with a global switch in the config.
> 
> Actually I am not sure this last statement is true: we had not found
> such a "global switch" in pre-12.3 XOS, as far as we can remember.

What came before XOS?  has it always been called XOS?  the old extreme boxes
had a global knob, IIRC.

> >      for {set i 0} {$i < $num_commands} { incr i} {
> >  	send -- "[subst -nocommands [lindex $commands $i]]\r"
> >  	expect {
> > @@ -897,20 +897,25 @@
> >  				}
> >      }
> >      if { $do_command || $do_script } {
> > -	# If the prompt is (enable), then we are on a switch and the
> > -	# command is "set length 0"; otherwise its "terminal length 0".
> > -	if [regexp -- ".*> .*enable" "$prompt"] {
> > -	    send "set length 0\r"
> > -	    expect -re $prompt  {}
> > -	    send "set width 132\r"
> > -	    expect -re $prompt	{}
> > -	    send "set logging session disable\r"
> > +	if { [ string compare "extreme" "$platform" ] } {
> > +	    # If the prompt is (enable), then we are on a switch and the
> > +	    # command is "set length 0"; otherwise its "terminal length 0".
> > +	    if [regexp -- ".*> .*enable" "$prompt"] {
> > +		send "set length 0\r"
> > +		expect -re $prompt  	{}
> > +		send "set width 132\r"
> > +		expect -re $prompt	{}
> > +		send "set logging session disable\r"
> > +	    } else {
> > +		send "terminal length 0\r"
> > +		expect -re $prompt  	{}
> > +		send "terminal width 132\r"
> > +	    }
> > +	    expect -re $prompt		{}
> >  	} else {
> > -	    send "terminal length 0\r"
> > -	    expect -re $prompt  {}
> > -	    send "terminal width 132\r"
> > +	    send "disable clipaging\r"
> > +	    expect -re $prompt		{}
> >  	}
> > -	expect -re $prompt	{}
> >      }
> >      if { $do_command } {
> >  	if {[run_commands $prompt $command]} {
> > 
> > 
> >> -	set u_prompt "(Username|Login|login|user name|User):"
> >> +	set u_prompt "(Username|Login|login|user name|User): *"
> > 
> > why is this necessary?  if there happen to be spaces after the prompt,
> it
> > should be possible to ignore them, send the input and allow the next
> expect
> > to eat the spaces, if they exist.
> 
> This was part of the changes we ported from 2.3.2a8 to 2.3.6 and it
> was used (still used today actually) in production at GRNET since
> 2009, so it was definitely necessary at some point; unfortunately neither
> Faidon nor I can no longer remember a specific case where this would
> be necessary. Your explanation is reasonable. I suppose we can drop this.
> 
> > 
> >>      } else {
> >>  	set u_prompt [join [lindex $u_prompt 0] ""]
> >>      }
> >>      set p_prompt [find passprompt $router]
> >>      if { "$p_prompt" == "" } {
> >> -	set p_prompt "(\[Pp]assword|passwd|Enter password for \[^ :]+):"
> >> +	set p_prompt "(\[Pp]assword|passwd|Enter password for \[^ :]+): *"
> >>      } else {
> >>  	set p_prompt [join [lindex $p_prompt 0] ""]
> >>      }
> >>      set e_prompt [find enableprompt $router]
> >>      if { "$e_prompt" == "" } {
> >> -	set e_prompt "\[Pp]assword:"
> >> +	set e_prompt "\[Pp]assword: *"
> >>      } else {
> >>  	set e_prompt [join [lindex $e_prompt 0] ""]
> >>      }


More information about the Rancid-discuss mailing list