Discussion:
[rancid] Different outputs with fnrancid and rancid-run
Devon True
2010-06-15 15:24:19 UTC
Permalink
All:

I have modified the fnrancid script to omit some data the new Fortigate
software gives during the "get system status". When I manually run
fnrancid, the output is how I expect. However, if I run rancid-run, the
data that should be removed is not.

fnrancid:

sub GetSystem {
print STDERR " In GetSystem: $_" if ($debug);
while (<INPUT>) {
tr/\015//d;
next if /^\s*$/;
last if(/$prompt/);
if (/(^\s*System time:)(.*)/ && $filter_pwds >= 1) {
ProcessHistory("ENC","","","$1=<removed>\n");
next;
}
if (/(^\s*FortiClient application signature package:)(.*)/ &&
$filter_pwds >= 1) {
ProcessHistory("ENC","","","$1=<removed>\n");
next;
}
ProcessHistory("","","","$_");
}
#print STDOUT "Vendor: $vendor";
ProcessHistory("SYSTEM","","","\n");
return(0);
}

Manual run of fnrancid creates a .new file with the output I would expect:

!RANCID-CONTENT-TYPE: fortigate
[snip]
Branch point: 272
Release Version Information: MR2
System time:=<removed>

#config-version=FG200A-4.00-FW-build272-100331:opmode=0:vdom=0
#conf_file_ver=<removed>

However, if I run "rancid-run" and modify control.rancid to not delete
the temp files created, I see the information that should have been removed:

retrieving revision 1.33
diff -U 4 -r1.33 <device>
@@ -18,12 +18,12 @@
Current HA mode: a-p, master
Distribution: International
Branch point: 272
Release Version Information: MR2
- - System time: Tue Jun 15 10:15:38 2010
+ System time: Tue Jun 15 11:04:55 2010

#config-version=FG200A-4.00-FW-build272-100331:opmode=0:vdom=0
- - #conf_file_ver=7431428455965478911
+ #conf_file_ver=17778636958364288780


I tried searching through rancid-run, control-rancid, rancid-fe, and
par. I can also run "par -q -n 2 -c 'rancid-fe {}' $DIR/routers.single"
manually and get the output I expect.

Any suggestions or hints about where to look?

- --
Devon
Devon True
2010-06-16 16:09:07 UTC
Permalink
On 6/15/2010 11:24 AM, Devon True wrote:
[snip message]
Post by Devon True
Any suggestions or hints about where to look?
Responding to myself for posterity. The issue was previous incarnations
of the fnrancid script stored locally forced the $filter_pwds parameter
to "1". When I applied the same logic to my new copy of fnrancid, the
issue was resolved.

- --
Devon
john heasley
2010-06-16 16:59:57 UTC
Permalink
Post by Devon True
I have modified the fnrancid script to omit some data the new Fortigate
software gives during the "get system status". When I manually run
fnrancid, the output is how I expect. However, if I run rancid-run, the
data that should be removed is not.
retrieving revision 1.33
diff -U 4 -r1.33 <device>
@@ -18,12 +18,12 @@
Current HA mode: a-p, master
Distribution: International
Branch point: 272
Release Version Information: MR2
- System time: Tue Jun 15 10:15:38 2010
+ System time: Tue Jun 15 11:04:55 2010
#config-version=FG200A-4.00-FW-build272-100331:opmode=0:vdom=0
- #conf_file_ver=7431428455965478911
+ #conf_file_ver=17778636958364288780
This is probably the right patch:

Index: bin/fnrancid.in
===================================================================
--- bin/fnrancid.in (revision 2199)
+++ bin/fnrancid.in (working copy)
@@ -173,10 +173,13 @@
while (<INPUT>) {
tr/\015//d;
next if /^\s*$/;
- last if(/$prompt/);
+ last if (/$prompt/);
+
+ next if (/^System Time:/);
+ next if (/^conf_file_ver=:/);
+
ProcessHistory("","","","$_");
}
- print STDOUT "Vendor: $vendor";
ProcessHistory("SYSTEM","","","\n");
return(0);
}

Loading...