Description
Description of problem
When using parameters values that are strings containing multiple references to the compilation dir (ie using $::settings::codedir
for instance), the CompilationDir
filter is unable to detect that the parameters are strictly equivalent.
For instance the following resource:
exec { 'sign cert':
command => "openssl x509 -req -in ${user}.csr -CA ${settings::localcacert} -CAkey ${settings::cakey} -CAcreateserial -out ${user}.pem -days ${days}",
...
}
will produce the following diff:
Exec[sign cert] =>
parameters =>
command =>
- openssl x509 -req -in user.csr -CA /tmp/ocd-ipc-20180605-856-t3sswg/ocd-builddir-20180605-858-e8z4wo/var/ssl/certs/ca.pem -CAkey /tmp/ocd-ipc-20180605-856-t3sswg/ocd-builddir-20180605-858-e8z4wo/var/ssl/ca/ca_key.pem -CAcreateserial -out user.pem -days 365
+ openssl x509 -req -in user.csr -CA /tmp/ocd-ipc-20180605-856-t3sswg/ocd-builddir-20180605-861-awzqbm/var/ssl/certs/ca.pem -CAkey /tmp/ocd-ipc-20180605-856-t3sswg/ocd-builddir-20180605-861-awzqbm/var/ssl/ca/ca_key.pem -CAcreateserial -out user.pem -days 365
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
The problem comes from the fact that the CompilationDir
only checks for the presence of one compilation dir path in the parameter value.
I think this would be more effective to replace all from and to compilation dir in the string by a placeholder and then just do string equality comparison instead of trying to split the string around the presence of the compilation dir prefix as it is now.