[rancid] filtering of show license
heasley
heas at shrubbery.net
Thu Jul 14 09:46:47 UTC 2016
Tue, Jul 12, 2016 at 09:42:40AM +0200, Václav Ovsík:
> On Mon, Jul 11, 2016 at 04:01:56PM +0200, Václav Ovsík wrote:
> > > Hi,
> > > with Rancid 3.4.1 a new information is digged from IOS using
> > > show license
> > > but it contains relative (changing) time :-/ e.g.:
> > >
> > > Index 3 Feature: securityk9
> > > Period left: 5 days 7 hours
> > > Period Used: 7 weeks 5 days
> > >
> > > have anybody already solved this? (change to end-of-license time or so)
> >
> > for this time I added only removing:
> >
> > @@ -587,6 +587,7 @@
> > return(0) if (/% license not supported on this device/i);# show lic on old box
> > return(1) if (/Line has invalid autocommand /);
> > return(1) if (/(invalid (input|command) detected|type help or )/i);
> > + s/^(\s*Period (?:left|used)):(?:\s*\d+\s*(?:weeks|days|hours))+/$1: <removed>/i;
> >
> > ProcessHistory("COMMENTS","keysort","LICENSE","! $_");
> > }
>
> singular too :-/
>
> --- ios.pm.orig 2016-05-18 08:09:10.000000000 +0200
> +++ ios.pm 2016-07-12 09:35:02.552000000 +0200
> @@ -587,6 +587,7 @@
> return(0) if (/% license not supported on this device/i);# show lic on old box
> return(1) if (/Line has invalid autocommand /);
> return(1) if (/(invalid (input|command) detected|type help or )/i);
> + s/^(\s*Period (?:left|used)):(?:\s*\d+\s*(?:weeks?|days?|hours?))+/$1: <removed>/i;
>
> ProcessHistory("COMMENTS","keysort","LICENSE","! $_");
> }
Does this also solve the problem for you:
Index: lib/ios.pm.in
===================================================================
--- lib/ios.pm.in (revision 3291)
+++ lib/ios.pm.in (revision 3300)
@@ -458,6 +458,7 @@
while (<$INPUT>) {
tr/\015//d;
goto OUT if (/^$prompt/); # should not occur
+ s/\s*$//; # trim trailing WS
# the pager can not be disabled per-session on the PIX
if (/^(<-+ More -+>)/) {
my($len) = length($1);
@@ -540,9 +541,16 @@
next if (/^\s+\^$/);
return(0) if (/% no licensable udi in the system/i); # show udi on old box
return(0) if (/% license not supported on this device/i);# show lic on old box
+ return(0) if (/% incomplete command/i); # show lic on old XE box
return(1) if (/Line has invalid autocommand /);
return(1) if (/(invalid (input|command) detected|type help or )/i);
+ next if (/period used:/i);
+ if (/(^\s*period left:\s*)\d+/i) {
+ ProcessHistory("COMMENTS","keysort","LICENSE","! $1<limited>\n");
+ next;
+ }
+
ProcessHistory("COMMENTS","keysort","LICENSE","! $_");
}
ProcessHistory("COMMENTS","keysort","LICENSE","!\n");
More information about the Rancid-discuss
mailing list