mirror of
https://github.com/inspec/inspec
synced 2024-11-22 20:53:11 +00:00
CFINSPEC-96: Handle corner case and add comments
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
parent
038d284f32
commit
ada1eaefcc
1 changed files with 5 additions and 3 deletions
|
@ -13,7 +13,7 @@ module Inspec::Resources
|
|||
example <<~EXAMPLE
|
||||
describe zfs("new-pool") do
|
||||
it { should exist }
|
||||
it { should have_property({"failmode" => "wait", "capacity"=>"0"}) }
|
||||
it { should have_property({"failmode" => "wait", "capacity" => "0"}) }
|
||||
end
|
||||
EXAMPLE
|
||||
|
||||
|
@ -34,10 +34,12 @@ module Inspec::Resources
|
|||
def has_property?(properties_hash)
|
||||
raise Inspec::Exceptions::ResourceSkipped, "Provide a valid key-value pair of the zfs properties." if properties_hash.empty?
|
||||
|
||||
# Transform all the keys to string, since hash keys provided by user can be symbols or strings.
|
||||
# Transform all the key & values provided by user to string,
|
||||
# since hash keys can be symbols or strings & values can be integers or strings.
|
||||
# @params is a hash populated in the parent class with the properties(key-value) of the current zfs pool.
|
||||
# The keys in the @params are of string type.
|
||||
# and the key-value in @params are of string type.
|
||||
properties_hash.transform_keys(&:to_s)
|
||||
properties_hash.transform_values(&:to_s)
|
||||
|
||||
# check if the given properties is a subset of @params
|
||||
properties_hash <= @params
|
||||
|
|
Loading…
Reference in a new issue