Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompilationDir filter doesn't support arrays or hashes #187

Closed
masterzen opened this issue Jun 5, 2018 · 0 comments
Closed

CompilationDir filter doesn't support arrays or hashes #187

masterzen opened this issue Jun 5, 2018 · 0 comments

Comments

@masterzen
Copy link
Contributor

Description of problem

When using parameters values that are arrays containing references to the compilation dir (ie using $::settings::codedir for instance, the CompilationDir filter is unable to detect that some of the array or hash members are equivalent.

For instance the following resource:

service { 'puppetserver':
  ...
  subscribe => [File["${::settings::codedir}/hiera.yaml"], Package['hiera-eyaml']]
}

will produce the following diff:

  Service[puppetserver] =>
   parameters =>
     subscribe =>
      - ["File[/tmp/ocd-ipc-20180605-856-t3sswg/ocd-builddir-20180605-858-e8z4wo/hiera.yaml]", "Package[hiera-eyaml]"]
      + ["File[/tmp/ocd-ipc-20180605-856-t3sswg/ocd-builddir-20180605-861-awzqbm/hiera.yaml]", "Package[hiera-eyaml]"]

Command used and debugging output

octocatalog-diff  --fact-file /repo/ci/facts/ubuntu.yaml --from-fact-override "role=tower" --to-fact-override "role=tower" --bootstrap-environment "V=0,SSH_AUTH_SOCK=/ssh-agent/ssh-agent.sock" --compare-file-text --filters CompilationDir --display-detail-add --debug

Platform and version information

  • Your OS: ubuntu 16.04
  • Your Ruby version: 2.3.1
  • Your version of Puppet: 5.5.0
  • Your version of octocatalog-diff: 1.5.3

It would be great for the CompilationDir filter to traverse arrays or hashes and apply recursively itself before taking any decision.

masterzen pushed a commit to masterzen/octocatalog-diff that referenced this issue Jun 6, 2018
…ltiple values

There were two cases where CompilationDir wasn't filtering out changes:
* if the parameter value is an arbitrary data structure (ie hash, array
or mix of both)
* if the parameter value is a string containing more than one occurence
of the compilation dir

It turns out that both can be fixed by just replacing the compilation
dirs in both the new and old values with empty strings and comparing
what's left.

It's probably much slower than the original string-only implementation
but covers much more cases as demonstrated by github#187 and github#188.
masterzen pushed a commit to masterzen/octocatalog-diff that referenced this issue Jun 6, 2018
…ltiple values

There were two cases where CompilationDir wasn't filtering out changes:
* if the parameter value is an arbitrary data structure (ie hash, array
or mix of both)
* if the parameter value is a string containing more than one occurence
of the compilation dir

It turns out that both can be fixed by just replacing the compilation
dirs in both the new and old values with empty strings and comparing
what's left.

It's probably much slower than the original string-only implementation
but covers much more cases as demonstrated by github#187 and github#188.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant