Repository navigation
Bug fix for loading hashmap inputs consistently - #5446
Conversation
…adata file Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
|
Deploy preview for chef-inspec canceled. Built with commit 82e1267 |
c1664e9 to
d0c17b3
Compare
…sh type Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
d0c17b3 to
a55b083
Compare
|
@aaronlippold Does this approach - using HashWithIndifferentAccess - work for your use case? |
| data.inputs.each do |input_name, input_value| | ||
| evt = Inspec::Input::Event.new( | ||
| value: input_value, | ||
| value: input_value.is_a?(Hash) ? Thor::CoreExt::HashWithIndifferentAccess.new(input_value) : input_value, |
There was a problem hiding this comment.
For consistency, I wonder if we should make a similar change in bind_inputs_from_runner_api? Testing that would be difficult, however.
There was a problem hiding this comment.
Yes for consistency that seems right. Let me look into the testing front for this.
There was a problem hiding this comment.
Can we add a method to handle this conversion input_value.is_a?(Hash) ? Thor::CoreExt::HashWithIndifferentAccess.new(input_value) : input_value so that we can just call that method wherever required and code will be maintainable ?
There was a problem hiding this comment.
Yes these checks could be re-used by having just a method :)
There was a problem hiding this comment.
@clintoncwolfe I observed this issue not only additionally happens for runner api input but also for other ways of input. Will try an alternate solution which could work for all the input types, rather than handling it in each method definition for different input types. Hope that would be a better solution.
|
I'm not sure given that there isn't really a description of the change. Can you elaborate on what is being updated and remind me which use case we're talking about :-) |
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
41c696c to
6cc4fc9
Compare
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
6cc4fc9 to
82e1267
Compare
clintoncwolfe
left a comment
There was a problem hiding this comment.
Great testing - very good work!
Signed-off-by: Nikita Mathur nikita.mathur@chef.io
Description
Issues:
symbolkeys and another hash withstringas keysImpact of solution:
This approach will solve reading inputs irrespective of their formats, which enables using hashes inside InSpec controls in any way preferred.
Related Issue
Fixes #4057
Types of changes
Checklist: