Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This made me wonder about
common_facts
and sadly we'll also need to deal with that. The rabbit hole is always deeper than you'd like :(There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I would like to takle that in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah wait, that already fixes
common_facts
as well?self.common_facts
always returns symbols but afterwards we callfacts = stringify_keys(facts) if RSpec.configuration.facterdb_string_keys
so that's fine?We could call
stringify_keys
directly inself.common_facts
but I think that justs adds one useless iteration on the hash that we can avoid?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's about performance overhead IMHO. It may not matter that much, but we know rspec-puppet-facts has proven slow at times. If you make
common_facts
return correct values you can then implement it here as:Then longer term we can also push the changes into
facterdb
itself. There we do this:https://github.com/voxpupuli/facterdb/blob/9c33730c537b2891aa1db7e26bd0faf3895e8b1a/lib/facterdb.rb#L146
If we drop the
to_sym
there we can dropstringify_keys
here. voxpupuli/facterdb#362 introduces asymbolize_keys
parameter.Does that clarify the long term path I see for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we should wait with this until we've a new facterdb version that only returns strings by default. Let's see if we can get voxpupuli/facterdb#364 merged.