github/octocatalog-diff

Difference where there should be none.

BarnumD opened this issue · 7 comments

I've seen some other issues about octocatalog-diff reporting 'no differences' when there is supposed to be some, but I have the opposite problem. I've just started using OC-D and I have my from_env set to the branch where I've freshly configured OC-D. Now i've created a git branch based on that one and I'm running the binary given a specific node. Since I've made no modifications to the new branch, nothing should have changed.

However, I'm getting results that several items have changed - except that the results confusingly prove that nothing changed. Here's an example of a local_internal_options.conf file. If you compare the plusses and minuses everything is exactly the same. So I don't understand why this is showing as a change.

  File[/var/ossec/etc/local_internal_options.conf] =>
   parameters =>
     content =>
      @@ -1,3 +1,3 @@
      -# local_internal_options.conf: Managed by puppet.
      -# Logcollector - If it should accept remote commands from the manager
      -logcollector.remote_commands=1
      +# local_internal_options.conf: Managed by puppet.
      +# Logcollector - If it should accept remote commands from the manager
      +logcollector.remote_commands=1

Here's a second example. Again, both sections are identical. Except this one has a fi at the end - which I assume is just context.

  Exec[wazuh_agent_install] =>
   parameters =>
     command =>
      @@ -1,7 +1,7 @@
      -curl -o /tmp/wazuh_agent.deb https://packages.wazuh.com/3.x/apt/pool/main/w/wazuh-agent/wazuh-agent_3.3.1-1_amd64.deb;
      -          dpkg -i /tmp/wazuh_agent.deb;
      -          rm -f /tmp/wazuh_agent.deb;
      -          #The agent can't register when there's a blank client.keys.
      -          if [ -f /var/ossec/etc/client.keys ] && [ $(stat --printf='%s' /var/ossec/etc/client.keys) == 0 ]; then
      -            rm -f /var/ossec/etc/client.keys;
      +curl -o /tmp/wazuh_agent.deb https://packages.wazuh.com/3.x/apt/pool/main/w/wazuh-agent/wazuh-agent_3.3.1-1_amd64.deb;
      +          dpkg -i /tmp/wazuh_agent.deb;
      +          rm -f /tmp/wazuh_agent.deb;
      +          #The agent can't register when there's a blank client.keys.
      +          if [ -f /var/ossec/etc/client.keys ] && [ $(stat --printf='%s' /var/ossec/etc/client.keys) == 0 ]; then
      +            rm -f /var/ossec/etc/client.keys;
                 fi

Any ideas why this is happening?

maybe some whitespace at the line end?

try to use the json output or pipe the ocd output to cat -A

Here is some of the debug output if it helps:

, [2018-07-11T19:28:03.127490 #6757] DEBUG -- : ["Exit status: 0"]
D, [2018-07-11T19:28:03.127537 #6757] DEBUG -- : (to) Catalog succeeded on try 1 in 6.6188699 seconds
D, [2018-07-11T19:28:03.137488 #6757] DEBUG -- : Catalog for . successfully built with OctocatalogDiff::Catalog::Computed in 240.793115 seconds
D, [2018-07-11T19:28:03.137642 #6757] DEBUG -- : Success build_catalog for .
D, [2018-07-11T19:28:03.167207 #6751] DEBUG -- : PID=6757 completed in 240.8228396 seconds, 321679 bytes
D, [2018-07-11T19:28:03.168133 #6751] DEBUG -- : All child processes completed with no exceptions raised
I, [2018-07-11T19:28:03.168490 #6751]  INFO -- : Catalogs compiled for myserver.domain.org
D, [2018-07-11T19:28:03.168656 #6751] DEBUG -- : Begin compute diffs between catalogs
D, [2018-07-11T19:28:03.169135 #6751] DEBUG -- : Entering catdiff; catalog sizes: 197, 197
D, [2018-07-11T19:28:03.169279 #6751] DEBUG -- : Entering preprocess_diff; catalog sizes: 197, 197
D, [2018-07-11T19:28:03.180148 #6751] DEBUG -- : Exiting preprocess_diff; added 0, removed 0
D, [2018-07-11T19:28:03.180530 #6751] DEBUG -- : Entering hashdiff_initial; catalog sizes: 197, 197
D, [2018-07-11T19:28:03.291053 #6751] DEBUG -- : Exiting hashdiff_initial; changes: 6, nested changes: 0
D, [2018-07-11T19:28:03.292834 #6751] DEBUG -- : Exiting catdiff; change count: 6
D, [2018-07-11T19:28:03.292973 #6751] DEBUG -- : Success compute diffs between catalogs
I, [2018-07-11T19:28:03.293364 #6751]  INFO -- : Diffs computed for myserver.domain.org
D, [2018-07-11T19:28:03.294129 #6751] DEBUG -- : Generating colored text output
D, [2018-07-11T19:28:03.294522 #6751] DEBUG -- : Added resources: 0
D, [2018-07-11T19:28:03.294594 #6751] DEBUG -- : Removed resources: 0
D, [2018-07-11T19:28:03.294788 #6751] DEBUG -- : Changed resources: 6

Thanks for your input @vinzent. For the local_internal_options.conf file, here's the output of cat -A. I'm not sure what the difference is between the 31m and the 32m.

  File[/var/ossec/etc/local_internal_options.conf] =>$
   parameters =>$
     content =>$
      ^[[36m@@ -1,3 +1,3 @@^[[0m$
      ^[[31m-# local_internal_options.conf: Managed by puppet.^[[0m$
      ^[[31m-# Logcollector - If it should accept remote commands from the manager^[[0m$
      ^[[31m-logcollector.remote_commands=1^[[0m$
      ^[[32m+# local_internal_options.conf: Managed by puppet.^[[0m$
      ^[[32m+# Logcollector - If it should accept remote commands from the manager^[[0m$
      ^[[32m+logcollector.remote_commands=1^[[0m$

From the JSON output, I can see there are several \r's

"old_value": "# local_internal_options.conf: Managed by puppet.\n# Logcollector - If it should accept remote commands from the manager\nlogcollector.remote_commands=1\n",
"new_value": "# local_internal_options.conf: Managed by puppet.\r\n# Logcollector - If it should accept remote commands from the manager\r\nlogcollector.remote_commands=1\r\n",

Perhaps it's an artifact from the fact that I'm in a ubuntu based docker container on windows with the puppet code repository bind mounted?

I think I confirmed this by cloning the repo inside the container without using a bind-mounted folder. It shows no differences. I'll close this ticket assuming that it's just a difference between windows and linux filesystems.
Thanks for your help @vinzent

Yes that also helps. Thanks.