[rancid] clogin adding 'exit' command?

heasley heas at shrubbery.net
Thu May 3 16:38:26 UTC 2018


Thu, May 03, 2018 at 05:05:27PM +0100, Howard Jones:
> I'm updating an old F5 loadbalancer script to work with BIG-IP 13.1 -
> it seems that since the last time I needed to use it, F5 have changed
> to starting users in tmsh instead of bash, so the command list needed
> to be tweaked. That's all fine but...

if you run rancid 3.6 (or better 3.7) there are two device types for f5;
f5 and bigip (for >=11.0).

> What I end up with is the following clogin command-line:
> 
> clogin -t 90 -c "modify cli preference pager disabled
> display-threshold 0;show /sys version;show /sys hardware;show /sys
> license;show /net route static;list all-properties recursive" lb01
> 
> which does everything I need, but then sits at the final prompt
> repeatedly type 'exit':
> 
>     rancidconfbackup@(lb01)(cfg-sync In Sync)(Active)(/Common)(tmos)#exit
>     Use "quit" to end the current session
>     rancidconfbackup@(lb01)(cfg-sync In Sync)(Active)(/Common)(tmos)# exit
>     Use "quit" to end the current session
> 
> Where is this 'exit' coming from? Can it be altered?
> 
> If I add 'quit' to the end of my command list, then instead it
> complains EOF received and none of the commands are matched:
> 
>     rancidconfbackup@(lb01)(cfg-sync In Sync)(Active)(/Common)(tmos)# quit
>     Connection to lb01 closed.
> 
>     Error: EOF received
> 
> Do I need to dig into the expect code to deal with this?

the expect it using exit to logout.  Does this work

Index: bin/clogin.in
===================================================================
--- bin/clogin.in	(revision 3786)
+++ bin/clogin.in	(working copy)
@@ -440,6 +440,11 @@
 						  send -h "exit\r"
 						  exp_continue;
 						}
+	-re "^\[^\n\r *]*Use .quit. to end"	{
+						  # the F5 >=11 uses quit
+						  send -h "quit\r"
+						  exp_continue;
+						}
 	"The system has unsaved changes"	{ # Force10 SFTOS
 						  if {$do_saveconfig} {
 						    catch {send "y\r"}

> Thanks for any pointers (or to a modern f5rancid)...
> 
> Howie
> 
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss



More information about the Rancid-discuss mailing list