diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-08-28 10:18:23 -0700 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2014-09-03 13:57:39 -0400 |
commit | cc589ce0bf208503894cc4a6f495eec25b847ea9 (patch) | |
tree | 281cb24c27f8c83d7aaf15dd349e9e529af1be2c | |
parent | 0d88ddf2e978aa4e2c33443dd87c55371d6f2d5a (diff) | |
download | chef-cc589ce0bf208503894cc4a6f495eec25b847ea9.tar.gz |
Better logging for dsc scripts with multiple resources
-rw-r--r-- | lib/chef/provider/dsc_script.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/chef/provider/dsc_script.rb b/lib/chef/provider/dsc_script.rb index 4e488557e6..d296e09c23 100644 --- a/lib/chef/provider/dsc_script.rb +++ b/lib/chef/provider/dsc_script.rb @@ -133,9 +133,14 @@ class Chef def generate_description ["converge DSC configuration '#{configuration_friendly_name}'"] + @dsc_resources_info.map do |resource| - # We ignore the last log message because it only contains the time it took, which looks weird - cleaned_messages = resource.change_log[0..-2].map { |c| c.sub(/^#{Regexp.escape(resource.name)}/, '').strip } - "converge DSC resource #{resource.name} by #{cleaned_messages.find_all{ |c| c != ''}.join("\n")}" + if resource.changes_state? + # We ignore the last log message because it only contains the time it took, which looks weird + cleaned_messages = resource.change_log[0..-2].map { |c| c.sub(/^#{Regexp.escape(resource.name)}/, '').strip } + "converge DSC resource #{resource.name} by #{cleaned_messages.find_all{ |c| c != ''}.join("\n")}" + else + # This is needed because a dsc script can have resouces that are both converged and not + "converge DSC resource #{resource.name} by doing nothing because it is already converged" + end end end end |