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

Support nil / undef values for resource params #250

Merged
merged 1 commit into from
Apr 9, 2021

Conversation

avbm
Copy link
Contributor

@avbm avbm commented Apr 8, 2021

Overview

This pull request adds support for Nil values for resources in the catalog. Currently if any resource has a parameter explicitly set to undef / nil, octocatalog-diff raises an exception along the lines of:

bundler: failed to load command: octocatalog-diff (/builds/puppet/control-repo/vendor/bundle/bin/octocatalog-diff)
RuntimeError: Bug (please report): Unexpected data structure in hashdiff_result: ["+", "Class\fSomeClass\fparameters\fconfig\fSomeResoruce\fSomekey", nil]
  /builds/puppet/control-repo/vendor/bundle/gems/octocatalog-diff-2.1.0/lib/octocatalog-diff/catalog-diff/differ.rb:569:in `block in hashdiff_initial'

Having certain resource values is supported in puppet and is useful to certain patterns where we set a parameter if certain complex business logic is met otherwise leave as undef so the class/resource can use the default.

Note: I haven't added new tests as the existing ones cover adding the NilClass as a supported value.

Checklist

  • Make sure that all of the tests pass, and fix any that don't. Just run rake in your checkout directory, or review the CI job triggered whenever you push to a pull request.
  • Make sure that there is 100% test coverage by running rake coverage:spec or ignoring untestable sections of code with # :nocov comments. If you need help getting to 100% coverage please ask; however, don't just submit code with no tests.
  • If you have added a new command line option, we would greatly appreciate a corresponding integration test that exercises it from start to finish. This is optional but recommended.
  • If you have added any new gem dependencies, make sure those gems are licensed under the MIT or Apache 2.0 license. We cannot add any dependencies on gems licensed under GPL.
  • If you have added any new gem dependencies, make sure you've checked in a copy of the .gem file into the vendor/cache directory.

/cc [related issues] [teams and individuals, making sure to mention why you're CC-ing them]

@ahayworth ahayworth added this to the 2.2.0 milestone Apr 9, 2021
Copy link
Contributor

@ahayworth ahayworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems pretty good to me - thank you! This'll go out in the next release, which is a little overdue but I'm waiting to see if we get any more action on two other PRs first. 😄

@ahayworth ahayworth merged commit 59a6b57 into github:master Apr 9, 2021
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

Successfully merging this pull request may close these issues.

2 participants