Using clogin to push multi-line banner motd's?

john heasley heas at shrubbery.net
Tue Feb 26 22:32:26 UTC 2002


Tue, Feb 26, 2002 at 12:24:33AM -0500, Adam Rothschild:
> Hi,
> 
> Forgive me for asking something whacky, bordering on outright stupid,
> but this seems like the appropriate forum.
> 
> I've been using rancid's clogin as a mechanism for pushing out config
> policy changes to IOS-speaking devices automagically, and I have a
> feeling others are doing the same.
> 
> One small stumbling block I've come across is, I'd like to be able to
> push out multi-line banner motd's, eg:
> 
>   crisco1.lab(config)#banner motd ^
>   Enter TEXT message.  End with the character '^'.
>   line 1 blah blah
>   line 2 blah blah
>   line 2 blah blah
>   [...]
>   ^
>   crisco1.lab(config)#
> 
> So, I run 'clogin -x [command sequence] [device]'...
> 
>   spawn telnet crisco1.lab 
>   [...]
> 
>   User Access Verification
> 
>   Username: rancid
>   Password: 
> 
>   crisco1.lab>enable
>   Password: 
>   crisco1.lab#term length 
>   crisco1.lab#conf t
>   Enter configuration commands, one per line.  End with CNTL/Z.
>   crisco1.lab(config)#no banner motd
>   crisco1.lab(config)#banner motd ^ 
>   Enter TEXT message.  End with the character '^'.
>  
>   [hangs]
> 
> Don't get me wrong, I realize this is the correct behavior, as
> clogin's not seeing the prompt it's expecting.  Question is, what
> work-arounds for this particular issue are there, short of sticking
> with one-line banner motd's, or pushing out the config snippets by
> some other means?

you could use -s and rancid-*/util/*.exp as a template.  you could
also try embedding \n's in the input.  i presume expect's send() will
recursively evaluate it's argument and expand the \n, but do not know
for sure.

> For bonus points, has anyone written a patch to get clogin to behave
> as I want it to, by any chance?  :-)
> 
> Thanks in advance,
> -adam



More information about the Rancid-discuss mailing list