Discussion:
[rancid] modifying diff conditions
Wayne Eisenberg
2013-11-03 20:29:47 UTC
Permalink
Hi,

I am trying to modify the diff process, but without much success. I am retrieving configs from a Palo Alto devices without problems. However there are some fields which change very frequently and although I do want a record of the values, I don't want a new version in cvs or an email generated if that is the only change.

The section of the config that updates all the time is this:

#app-version: 402-2007
#app-release-date: 2013/10/29 15:46:46
#av-version: 1138-1588
#av-release-date: 2013/11/01 04:00:02
#threat-version: 402-2007
#threat-release-date: 2013/10/29 15:46:46
#wildfire-version: 21772-27787
#wildfire-release-date: 2013/11/03 10:23:01
#url-filtering-version: 2013.10.31.000

Therefore, I modified bin/control_rancid from:

if [ $RCSSYS = "cvs" ] ; then
cvs -f diff -U 4 -ko | sed -e '/^RCS file: /d' -e '/^--- /d' \
-e '/^+++ /d' -e 's/^\([-+ ]\)/\1 /' >$TMP.diff

to:

if [ $RCSSYS = "cvs" ] ; then
cvs -f diff -U 4 --ignore-matching-lines='(.*av-.*|.*wildfire-.*|.*threat-.*|.*url-filtering-.*|.*app-.*|.*call-forwarding.*)' -ko | sed -e '/^RCS file: /d' -e '/^--- /d' \ -e '/^+++ /d' -e 's/^\([-+ ]\)/\1 /' >$TMP.diff

I thought this would be the appropriate change (adding the '--ignore-matching-lines' parameter), but it doesn't seem to change a thing. Is there a syntax error I'm missing? Did I change the right command? Is there a way to debug/troubleshoot this to find out where I'm missing it?

Thanks,
Wayne



________________________________
The information in this Internet e-mail (and any attachments) is confidential, may be legally privileged and is intended solely for the Addressee(s) named above. If you are not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, then any dissemination or copying of this e-mail (and any attachments) is prohibited and may be unlawful. If you received this e-mail in error, please immediately notify us by e-mail or telephone, then delete the message. Thank you.
Wayne Eisenberg
2013-11-08 17:08:37 UTC
Permalink
Well, I've done some experimenting and I think I've seen that the regex expression doesn't always work. I found that
--ignore-matching-lines='av\|wildfire\|threat'
*can* work, but if I don't include all of the things to ignore, it won't ignore any of them. For example, with the text below,
'av\|wildfire\|url-filtering\|app\|threat' will successfully ignore all of those lines. But if I omit one of the elements (say 'threat'), it won't ignore any of the lines even though I would expect it to only return the 'threat' lines as different. Does anyone have any ideas or explanation of this behavior?

Thanks,
Wayne



From: rancid-discuss-***@shrubbery.net [mailto:rancid-discuss-***@shrubbery.net] On Behalf Of Wayne Eisenberg
Sent: Sunday, November 03, 2013 3:30 PM
To: 'rancid-***@shrubbery.net'
Subject: [rancid] modifying diff conditions

Hi,

I am trying to modify the diff process, but without much success. I am retrieving configs from a Palo Alto devices without problems. However there are some fields which change very frequently and although I do want a record of the values, I don't want a new version in cvs or an email generated if that is the only change.

The section of the config that updates all the time is this:

#app-version: 402-2007
#app-release-date: 2013/10/29 15:46:46
#av-version: 1138-1588
#av-release-date: 2013/11/01 04:00:02
#threat-version: 402-2007
#threat-release-date: 2013/10/29 15:46:46
#wildfire-version: 21772-27787
#wildfire-release-date: 2013/11/03 10:23:01
#url-filtering-version: 2013.10.31.000

Therefore, I modified bin/control_rancid from:

if [ $RCSSYS = "cvs" ] ; then
cvs -f diff -U 4 -ko | sed -e '/^RCS file: /d' -e '/^--- /d' \
-e '/^+++ /d' -e 's/^\([-+ ]\)/\1 /' >$TMP.diff

to:

if [ $RCSSYS = "cvs" ] ; then
cvs -f diff -U 4 --ignore-matching-lines='(.*av-.*|.*wildfire-.*|.*threat-.*|.*url-filtering-.*|.*app-.*|.*call-forwarding.*)' -ko | sed -e '/^RCS file: /d' -e '/^--- /d' \ -e '/^+++ /d' -e 's/^\([-+ ]\)/\1 /' >$TMP.diff

I thought this would be the appropriate change (adding the '--ignore-matching-lines' parameter), but it doesn't seem to change a thing. Is there a syntax error I'm missing? Did I change the right command? Is there a way to debug/troubleshoot this to find out where I'm missing it?

Thanks,
Wayne



________________________________
The information in this Internet e-mail (and any attachments) is confidential, may be legally privileged and is intended solely for the Addressee(s) named above. If you are not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, then any dissemination or copying of this e-mail (and any attachments) is prohibited and may be unlawful. If you received this e-mail in error, please immediately notify us by e-mail or telephone, then delete the message. Thank you.
heasley
2013-11-08 17:20:52 UTC
Permalink
Post by Wayne Eisenberg
Well, I've done some experimenting and I think I've seen that the regex expression doesn't always work. I found that
--ignore-matching-lines='av\|wildfire\|threat'
*can* work, but if I don't include all of the things to ignore, it won't ignore any of them. For example, with the text below,
'av\|wildfire\|url-filtering\|app\|threat' will successfully ignore all of those lines. But if I omit one of the elements (say 'threat'), it won't ignore any of the lines even though I would expect it to only return the 'threat' lines as different. Does anyone have any ideas or explanation of this behavior?
bad RE format, i suspect. '(term1|term2|term3)'

i do not know if any of those chars needs to be escaped, since its in single
quotes. but, depends on how cvs execs diff.

Loading...