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

Add merge facts option to add_custom_fact #160

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

jordanbreen28
Copy link
Contributor

@jordanbreen28 jordanbreen28 commented Jan 29, 2024

This PR implements a new merge_facts option, which can be used with the add_custom_fact method in your configurations.
It allows users to determine whether they want to completely overwrite a fact already present in the facts hash, or simply merge values into the existing fact to expand/overwrite certain values whilst the entirety of the fact.

sample usage:
add_custom_fact :identity, { 'user' => "test_user" }, merge_facts: true
will update the value of user in the identity fact to "test_user", whilst keeping the rest of the identity fact values the same.

Failing tests rely on the merge of #157

Copy link

codecov bot commented Feb 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ec05ede) 95.23% compared to head (d0c9451) 95.34%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #160      +/-   ##
==========================================
+ Coverage   95.23%   95.34%   +0.11%     
==========================================
  Files           2        2              
  Lines         168      172       +4     
==========================================
+ Hits          160      164       +4     
  Misses          8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jordanbreen28 jordanbreen28 force-pushed the feat-add_merge_facts branch 3 times, most recently from 6a9fdf3 to b8517d3 Compare February 2, 2024 09:36
@jordanbreen28 jordanbreen28 marked this pull request as ready for review February 2, 2024 09:36
@jordanbreen28 jordanbreen28 force-pushed the feat-add_merge_facts branch 2 times, most recently from b3be6bc to 49673bf Compare February 2, 2024 15:25
This commit adds an option to the add_custom_fact method, which allows
the user to specify whether they wish to deep_merge facts.

This allows the user to determine whether they wish to completely
overwrite a fact, or simply merge values into the existing fact in a
given fact hash.
@jordanbreen28
Copy link
Contributor Author

@ekohl @bastelfreak 👋 sorry for the ping.. Does this need anything/any comments? Thanks

Copy link
Member

@bastelfreak bastelfreak left a comment

Choose a reason for hiding this comment

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

looks good to me, but I would like to have a review from @ekohl as well.

@bastelfreak bastelfreak merged commit 69f6331 into voxpupuli:master Feb 21, 2024
8 checks passed
@bastelfreak bastelfreak changed the title (feat) - Add merge facts option to add_custom_fact Add merge facts option to add_custom_fact Feb 21, 2024
@jordanbreen28 jordanbreen28 deleted the feat-add_merge_facts branch February 22, 2024 10:08
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