-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
(CAT-1608) - PDK update #2501
(CAT-1608) - PDK update #2501
Conversation
default_facts.deep_merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true)) | ||
default_facts.merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may not be better. There are some pitfalls with (deep)merging listed here:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm the rubocop was complaining, thanks for the heads-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was just going through the existing code deep_merge
and the change merge
, looks like deep_merge
never got succeded as I can see warning in logs, but now introducing to merge
it started failing some of specs with apache
and mysql
modules :
WARNING: Unable to load /home/runner/work/puppetlabs-apache/puppetlabs-apache/spec/default_facts.yml: undefined method `deep_merge!' for {:puppetversion=>"7.27.0", :facterversion=>"4.5.2"}:Hash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe @ekohl can elaborate because he worked on the fix linked above and told me a few times that I should not use merge()
and use the override_facts()
function instead. This part of the patch has some info about the problem deep_merge pose:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyways I think in this spec_helper we are trying to set some default facts which seems to be good, with override_facts make sense in actual spec tests where we already have implemented at multiple places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dang, just saw in the context below that this is not altering the actual facts, but default_facts
which is merged on line 36, so this seems okay.
Anyway, the module seems to not use any of these default facts. I wonder if it makes sense to keep them but I guess they serve as "example" for the PDK?
Anyway, LGTM!
50439a4
to
5da0d4e
Compare
5da0d4e
to
791b599
Compare
default_facts.deep_merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true)) | ||
default_facts.merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dang, just saw in the context below that this is not altering the actual facts, but default_facts
which is merged on line 36, so this seems okay.
Anyway, the module seems to not use any of these default facts. I wonder if it makes sense to keep them but I guess they serve as "example" for the PDK?
Anyway, LGTM!
Summary
PDK update.
Checklist
puppet apply
)