From ada1eaefcc43c00f2b52e9481a29c7e7563f5e4e Mon Sep 17 00:00:00 2001 From: Sonu Saha Date: Thu, 21 Apr 2022 21:17:27 +0530 Subject: [PATCH] CFINSPEC-96: Handle corner case and add comments Signed-off-by: Sonu Saha --- lib/inspec/resources/zfs.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/inspec/resources/zfs.rb b/lib/inspec/resources/zfs.rb index b78d0a9b7..4b5d1d79d 100644 --- a/lib/inspec/resources/zfs.rb +++ b/lib/inspec/resources/zfs.rb @@ -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