[rancid] adding a "new" type for axos
heasley
heas at shrubbery.net
Mon Dec 11 14:50:03 UTC 2023
Sun, Dec 10, 2023 at 11:18:53PM -0500, Jon Lewis:
> On Sat, 9 Dec 2023, Jon Lewis wrote:
>
> > --- ios.pm.orig 2020-10-15 11:26:17.000000000 -0400
> > +++ ios.pm 2023-12-09 22:21:50.408683973 -0500
> > @@ -2787,7 +2794,7 @@
> > # The ContentEngine lacks a definitive "end of config" marker. If we
> > # know that it is a CE, SAN, or NXOS and we have seen at least 5 lines
> > # of write term output, we can be reasonably sure that we have the
> > # config.
> > - if (($type eq "CE" || $type eq "SAN" || $type eq "NXOS") && $linecnt > 5) {
> > + if (($type eq "CE" || $type eq "SAN" || $type eq "NXOS" || $devtype eq "axos") && $linecnt > 5) {
> > $found_end = 1;
> > return(0);
> > }
>
> I did some more debugging tonight, and see the problem now. I'm kind of
> curious out the CE/SAN/NXOS types get around this...but the problem is, with
> no clear end of config marker to the show running-config, the WriteTerm
> function doesn't stop processing input until it's read all of it. In
> WriteTerm, when
>
> last if (/^$prompt/);
>
> matches, the line matched has the exit command on it. So when processing is
> handed back to inloop, there's nothing left for it to process other than the
> "Shared connection to ... closed." message from ssh.
right, so when it returns, the 'exit' line should be re-evaluated in the
top loop and clean_run will be set. There is some nuance, but all the
other filter functions operate in the same manner.
94 TOP: while(<$INPUT>) {
...
102 while (/[>#]\s*($cmds_regexp)\s*$/) {
121 $rval = &{$commands{$cmd}}($INPUT, $OUTPUT, $cmd);
122 delete($commands{$cmd});
...
127 }
128 if (/[>#]\s?exit$/) { <<<<<<<<<<<<<<<<
129 $clean_run = 1;
130 last;
131 }
132 }
133 }
Are you certain that the exit prompt is exactly:
some-device#exit
there are no spaces or other garbage on the line?
> Would it be an appropriate workaround for this to also set $clean_run = 1 in
> the above if statement at the end of WriteTerm...or make a new if statment
> just for $devtype axos that sets both $found_end and $clean_run?
it should not be necessary.
More information about the Rancid-discuss
mailing list