[rancid] Fixed Ciena-ws Rancid 3.6.2

heasley heas at shrubbery.net
Fri Jul 21 14:22:16 UTC 2017


Wed, Jul 19, 2017 at 03:43:07PM -0500, Chris Wopat:
> 
> > These changes do not seem right to me.  i understand that its working for
> > you, but i'm not sure that it will be reliable.
> > 
> > Also, of the 4 raw command output examples that i have, all of them have
> > the prompt ">", not "#".  Can you tell me why it is different?  keep in
> > mind that I havent much experience with these and we no longer have them.
> > 
> > If someone could extend remote access to me, I can feel more comfortable
> > accepting these changes.  anyone?
> 
> The prompt varies depending on userlevel. If you're the superuser 
> account, it's #. If you're a read only or perhaps generally lesser user, 
> it's >.
> 
> My user is defined as:
> 
> 	user create user MYUSERNAME access-level limited
> 
> I just tested this patch WITHOUT the prompt changes for my user, which 
> is a read only user, and it seemed to work!
> 
> It sounds like the best case would be to adjust regexp to match # or >.

great; thanks for testing that.  Just addressing that one point, the patch
is:

Index: lib/wavesvros.pm.in
===================================================================
--- lib/wavesvros.pm.in	(revision 3719)
+++ lib/wavesvros.pm.in	(working copy)
@@ -62,10 +62,10 @@
 	    $clean_run = 0;
 	    last;
 	}
-	while (/>\s*($cmds_regexp)\s*$/) {
+	while (/[>#]\s*($cmds_regexp)\s*$/) {
 	    $cmd = $1;
 	    if (!defined($prompt)) {
-		$prompt = ($_ =~ /^([^>]+>)/)[0];
+		$prompt = ($_ =~ /^([^>#]+[>#])/)[0];
 		$prompt =~ s/([][}{)(\\])/\\$1/g;
 		# prompt changes when config is unsaved - "foo*> "
 		$prompt =~ s/\*/\\\*/;
@@ -90,7 +90,7 @@
 		last TOP;
 	    }
 	}
-	if (/>\s*exit/) {
+	if (/[>#]\s*exit/) {
 	    $clean_run=1;
 	    last;
 	}
@@ -103,7 +103,7 @@
     print STDERR "    In ShowChassisClocks: $_" if ($debug);
 
     # include the command
-    s/^[a-z]+@//; s/^([^ ]+)\*>/$1>/;
+    s/^[a-z]+@//; s/^([^ ]+)\*([>#])/$1$2/;
     ProcessHistory("","","","! $_");
     while (<$INPUT>) {
 	tr/\015//d;
@@ -131,7 +131,7 @@
     print STDERR "    In ShowVersion: $_" if ($debug);
 
     # include the command
-    s/^[a-z]+@//; s/^([^ ]+)\*>/$1>/;
+    s/^[a-z]+@//; s/^([^ ]+)\*([>#])/$1$2/;
     ProcessHistory("","","","! $_");
     # skip software state info
     while (<$INPUT>) {
@@ -160,7 +160,7 @@
     print STDERR "    In ShowConfiguration: $_" if ($debug);
 
     # include the command
-    s/^[a-z]+@//; s/^([^ ]+)\*>/$1>/;
+    s/^[a-z]+@//; s/^([^ ]+)\*([>#])/$1$2/;
     ProcessHistory("","","","! $_");
     while (<$INPUT>) {
 	tr/\015//d;



More information about the Rancid-discuss mailing list