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

(maint) Do not raise NoMethodError on normal env info writing #1148

Merged

Conversation

justinstoller
Copy link
Member

Previously when calling write_environment_info we would call
Module#repo to collect the sha, if it existed. However, only git backed
modules have this method defined. So the write_environment_info method
would cause an exception which it caught and ignored when inspecting any
non-git-backed modules.

This moves to use the Module#properties method which is well defined for
every type of module and has an :actual key which matches the value
that the write_environment_info used to gather. We do not collect
:actual key values for any module besides those of type :git to
match the behavior preivously.

This also adds a test for the failure case of the write_environment_info
method that was previously untested. I have a feeling that this is no
longer needed now that we do not call Module#repo indiscriminantly,
however it is included to err on the safe side.

Please add all notable changes to the "Unreleased" section of the CHANGELOG in the format:

- Summary of changes. [Issue or PR #](link to issue or PR)

@mwaggett
Copy link
Contributor

This looks good to me, other than my one comment.

Previously when calling write_environment_info we would call
Module#repo to collect the sha, if it existed. However, only git backed
modules have this method defined. So the write_environment_info method
would cause an exception which it caught and ignored when inspecting any
non-git-backed modules.

This moves to use the Module#properties method which is well defined for
every type of module and has an `:actual` key which matches the value
that the write_environment_info used to gather. We do not collect
`:actual` key values for any module besides those of type `:git` to
match the behavior preivously.

This also adds a test for the failure case of the write_environment_info
method that was previously untested. I have a feeling that this is no
longer needed now that we do not call Module#repo indiscriminantly,
however it is included to err on the safe side.
@justinstoller justinstoller force-pushed the maint-no-raise-env-info-writing branch from 36e8fc7 to 065b475 Compare April 23, 2021 20:55
@mwaggett mwaggett merged commit c4bc775 into puppetlabs:main Apr 23, 2021
@justinstoller justinstoller deleted the maint-no-raise-env-info-writing branch April 27, 2021 21:57
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.

3 participants