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

(PUP-11754) Empty metadata files should be treated as though they don't exist #9012

Merged

Conversation

AriaXLi
Copy link
Contributor

@AriaXLi AriaXLi commented Feb 7, 2023

This commit has Puppet::Util::Json.load check if an empty string is passed in and returns nil if an empty string is passed in. More work may be necessary to ensure Puppet::Util::Json.load behaves as expected.

@AriaXLi AriaXLi requested a review from a team as a code owner February 7, 2023 20:20
@AriaXLi AriaXLi force-pushed the PUP-11754/Json.load_handles_empty_string branch 2 times, most recently from 4961dfa to 05ac75d Compare February 7, 2023 20:23
@AriaXLi AriaXLi marked this pull request as draft February 7, 2023 20:37
@AriaXLi
Copy link
Contributor Author

AriaXLi commented Feb 7, 2023

More work is definitely needed for this, I just wanted to lay down some groundwork for whoever picks this up

@joshcooper
Copy link
Contributor

Upstream issue filed in intridea/multi_json#206

@AriaXLi AriaXLi force-pushed the PUP-11754/Json.load_handles_empty_string branch 3 times, most recently from 3fb53ea to 3c472fa Compare March 8, 2023 23:15
@AriaXLi AriaXLi marked this pull request as ready for review March 8, 2023 23:53
@AriaXLi AriaXLi force-pushed the PUP-11754/Json.load_handles_empty_string branch 2 times, most recently from f0e7761 to af4b326 Compare March 9, 2023 22:09
@AriaXLi AriaXLi changed the title (PUP-11754) Puppet::Util::Json.load can handle empty string (PUP-11754) Empty metadata files should be treated as though they don't exist Mar 9, 2023
@AriaXLi AriaXLi force-pushed the PUP-11754/Json.load_handles_empty_string branch from b2a126f to d93b639 Compare March 9, 2023 22:14
…'t exist

This commit treats empty metadata files as though they don't exist. This is
acheived by returning an empty hash '{}' when attempting to read an empty
metadata file which prevents Puppet::Util::Json.load() to be used on the empty
metadata files.
@AriaXLi AriaXLi force-pushed the PUP-11754/Json.load_handles_empty_string branch from a450838 to f2d0b4d Compare March 9, 2023 22:16
@joshcooper joshcooper merged commit f4781e3 into puppetlabs:main Mar 10, 2023
@AriaXLi AriaXLi deleted the PUP-11754/Json.load_handles_empty_string branch March 10, 2023 16:22
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