-
Notifications
You must be signed in to change notification settings - Fork 90
Description
Description of problem
- What did you do?
Diffing two catalogs withOctocatalogDiff::API::V1.catalog_diffand ignoring the following change:
File[/etc/snmp/snmpd.conf] =>
parameters =>
source =>
- puppet:///modules/hardwarenode_base/snmpd.conf
+ puppet:///modules/hp_utilities/snmpd.conf
I've used the following ignore rule:
catalog_diff_result = OctocatalogDiff::API::V1.catalog_diff(
{
:logger => logger,
:to_catalog => catalog_new.path,
:from_catalog => catalog_old.path,
:ignore => [
{
type: 'File',
title: '/etc/snmp/snmpd.conf',
attr: "parameters\fsource=&>.*(hp_utilities|hardwarenode_base).*"
},
]
}
)
-
What happened?
It didn't ignore the change -
What did you expect to happen?
That it would ignore the change -
How can someone reproduce the problem?
Try to ignore a parameter besidecontentwith an regex as described in https://github.com/github/octocatalog-diff/blob/master/doc/advanced-ignores.md#ignoring-attributes-whose-changes-are-encompassed-by-a-regular-expression
Command used and debugging output
Platform and version information
- Your OS: Ubuntu 14.04.5
- Your Ruby version: 2.4.0
- Your version of Puppet: 5.3.4
- Your version of octocatalog-diff: 1.5.2
Do the tests pass from a clean checkout?
Using the gem, so hopefully ;)
Anything else to add that you think will be helpful?
I think the problem is what's in the diff. If you add @logger.info line before https://github.com/github/octocatalog-diff/blob/master/lib/octocatalog-diff/catalog-diff/differ.rb#L298 the output is the following:
...
I, [2018-03-06T14:20:10.508543 #10136] INFO -- : Catalogs compiled for
I, [2018-03-06T14:20:11.542122 #10136] INFO -- : -puppet:///modules/hardwarenode_base/snmpd.conf
I, [2018-03-06T14:20:11.542181 #10136] INFO -- : \ No newline at end of file
I, [2018-03-06T14:20:11.542208 #10136] INFO -- : +puppet:///modules/hp_utilities/snmpd.conf
I, [2018-03-06T14:20:11.542238 #10136] INFO -- : \ No newline at end of file
I, [2018-03-06T14:20:11.545826 #10136] INFO -- : Diffs computed for
...
The problem seems to be the line \ No newline at end of file. If i change my OctocatalogDiff::API::V1.catalog_diff object to the following, the ignore works.
catalog_diff_result = OctocatalogDiff::API::V1.catalog_diff(
{
:logger => logger,
:to_catalog => catalog_new.path,
:from_catalog => catalog_old.path,
:ignore => [
{
type: 'File',
title: '/etc/snmp/snmpd.conf',
attr: "parameters\fsource=&>.*(hp_utilities|hardwarenode_base|No newline at end of file).*"
},
]
}
)
But this seems kind of non-intuitive, might be a good idea to automatically ignore those lines. On the other hand, in other scenarios there could be only this one line which someone wants to catch.
What do you think?