[rancid] parameterizing diff lines of context?

Lee ler762 at gmail.com
Wed Sep 22 16:35:45 UTC 2010


The local security policy is that user switch ports get turned off
when they're no longer being used.  Which means we'll be seeing lots
of "-  shutdown" and "+  shutdown" as the only difference in the
configs.  With the default 4 lines of context, rancid isn't showing
which interface changed.

Is this an issue with anyone else (meaning it would be worthwhile to
make it parameterized) or is this a non-issue for most people?


"control_rancid" line 447
# This has been different for different machines...
# Diff the directory and then checkin.
trap 'rm -fr $TMP $TMP.diff $DIR/routers.single;' 1 2 15
cd $DIR
if [ $RCSSYS = "cvs" ] ; then
    # --LR-- cvs -f diff -U 4 -ko | sed -e '/^RCS file: /d' -e '/^--- /d' \
    # --LR-- 4 is not enough, 8 seems a bit much so try 6
    cvs -f diff -U 6 -ko | sed -e '/^RCS file: /d' -e '/^--- /d' \
        -e '/^+++ /d' -e 's/^\([-+ ]\)/\1 /' >$TMP.diff
else
    svn diff | sed -e '/^+++ /d' -e 's/^\([-+ ]\)/\1 /' >$TMP.diff
fi

which results in:

@@ -1392,13 +1392,12 @@
   description xxx
   switchport
   switchport access vlan 177
   switchport mode access
   switchport voice vlan 877
   no logging event link-status
-  shutdown
   no snmp trap link-status
   mls qos vlan-based
   mls qos trust cos
   spanning-tree portfast
  !
  interface GigabitEthernet4/8


Regards,
Lee


More information about the Rancid-discuss mailing list