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

(CAT-1608) - PDK update #2501

Merged
merged 1 commit into from
Dec 5, 2023
Merged

(CAT-1608) - PDK update #2501

merged 1 commit into from
Dec 5, 2023

Conversation

Ramesh7
Copy link
Contributor

@Ramesh7 Ramesh7 commented Nov 28, 2023

Summary

PDK update.

Checklist

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified. (For example puppet apply)

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))
Copy link
Collaborator

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:

voxpupuli/voxpupuli-test@87d851c

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Copy link
Collaborator

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:

voxpupuli/voxpupuli-test@87d851c#diff-69103b11f5a59727fe6d9de29156f298586f2a3ab7ff8758b356f691549cb07bR3-R8

Copy link
Contributor Author

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.

Copy link
Collaborator

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!

@Ramesh7 Ramesh7 force-pushed the CAT-1608-pdk-update branch 2 times, most recently from 50439a4 to 5da0d4e Compare November 30, 2023 05:58
@Ramesh7 Ramesh7 force-pushed the CAT-1608-pdk-update branch from 5da0d4e to 791b599 Compare November 30, 2023 09:05
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))
Copy link
Collaborator

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!

@Ramesh7 Ramesh7 merged commit b6cb8e9 into main Dec 5, 2023
39 checks passed
@Ramesh7 Ramesh7 deleted the CAT-1608-pdk-update branch December 5, 2023 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants