[rancid] Re: Custom devices and ttys

john heasley heas at shrubbery.net
Tue Oct 9 17:40:54 UTC 2007


Tue, Oct 09, 2007 at 02:09:31PM +0100, Mark Loveley:
> Hi
> 
> I'm trying to customize a rancid plugin to work with an Ellacoya e30  
> which has a very cisco like interface.
> clogin works fine from the command line by bails out when run from cron.
> 
>  From cron it asks me to "press any key to continue", when I send a  
> carriage return, or any other key it asks me the same thing again.
> 
> it seems that the e30 behaves differently when there is a tty  
> attached, as when I add -nottycopy after the spawn in the login  
> script I get the same behavior on the cli as when it is run from cron  
> without the ttycopy option.
> ie to get this behavior on the cli I changed
>                  set retval [ catch {spawn telnet $router} reason ]
> to
>                  set retval [ catch {spawn -nottycopy telnet $router}  
> reason ]
> 
> Anyone here got any experience with devices that behave like this?
> Or does anyone know the expect syntax to make rancid behave as if  
> there is a tty?
> 
> I'm reasonably sure it's a tty issue as I have manually set  
> environment variables such as TERM,COLUMNS,LINES etc. A packet trace  
> of the telnet session shows that when launched from cron the width  
> and height is set to zero when it negotiates the window size.
> 
> http://expect.nist.gov/FAQ.html#q26 implies there is a way to do this  
> but helpfully you have to buy their book.
> 
> http://www.issociate.de/board/post/181281/%22expect%22_spawns_telnet_--_screen_height.html seems to solve a very similar  
> issue in a perl script.
> 
> Any ideas?

I think you've identified the problem correctly, the screen height of zero
affecting a broken pager.  Normally rancid sets the TERM to "network" in
rancid.conf, which implies a height of 0.  AND, clogin sends the command
'term length 0' to disable the pager.  Assuming your device does not
recognize the 'term length' command, try setting TERM to something which
normally has a fixed height, such as vt100.

Another possibility is to use hlogin, which has become somewhat the home
of the bastard children, with the addition of a stty command to hard-code
the height to something greater than 0.  Note that hlogin also tries to
disable the pager with HP's 'no page' command.


More information about the Rancid-discuss mailing list