diff options
-rw-r--r-- | lib/chef/provider.rb | 4 | ||||
-rw-r--r-- | spec/integration/recipes/resource_converge_if_changed_spec.rb | 48 |
2 files changed, 50 insertions, 2 deletions
diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb index 1e8146428e..d9d6b49894 100644 --- a/lib/chef/provider.rb +++ b/lib/chef/provider.rb @@ -205,7 +205,7 @@ class Chef modified = specified_properties.select { |p| new_resource.send(p) != current_resource.send(p) } if modified.empty? properties_str = if sensitive - '(suppressed sensitive properties)' + specified_properties.join(", ") else specified_properties.map { |p| "#{p}=#{new_resource.send(p).inspect}" }.join(", ") end @@ -236,7 +236,7 @@ class Chef else new_resource.send(property).inspect end - " set #{property.to_s.ljust(property_size)} to #{properties_str}" + default ||= '' + " set #{property.to_s.ljust(property_size)} to #{properties_str}#{default}" end converge_by([ "create #{new_resource.identity}" ] + created, &converge_block) diff --git a/spec/integration/recipes/resource_converge_if_changed_spec.rb b/spec/integration/recipes/resource_converge_if_changed_spec.rb index 82d38a8faf..fb01da5137 100644 --- a/spec/integration/recipes/resource_converge_if_changed_spec.rb +++ b/spec/integration/recipes/resource_converge_if_changed_spec.rb @@ -110,6 +110,29 @@ EOM end end + context "and state1 and state2 are set to new sensitive values" do + let(:converge_recipe) { + <<-EOM + #{resource_name} 'blah' do + sensitive true + state1 'new_state1' + state2 'new_state2' + end + EOM + } + + it "the resource updates state1 and state2" do + expect(resource.converged).to eq 1 + expect(resource.updated?).to be_truthy + expect(converged_recipe.stdout).to eq <<-EOM +* #{resource_name}[blah] action create + - update default_identity1 + - set state1 to (suppressed sensitive properties) + - set state2 to (suppressed sensitive properties) +EOM + end + end + context "and state1 is set to its current value but state2 is set to a new value" do let(:converge_recipe) { <<-EOM @@ -416,6 +439,31 @@ EOM EOM end end + + context "and state1 and state2 are set to new sensitive values" do + let(:converge_recipe) { + <<-EOM + #{resource_name} 'blah' do + sensitive true + state1 'new_state1' + state2 'new_state2' + end + EOM + } + + it "the resource is created" do + expect(resource.converged).to eq 2 + expect(resource.updated?).to be_truthy + expect(converged_recipe.stdout).to eq <<-EOM +* #{resource_name}[blah] action create + - create default_identity1 + - set state1 to (suppressed sensitive properties) + - create default_identity1 + - set state2 to (suppressed sensitive properties) +EOM + end + end + end end |