From 8400f4cb7d977896531ae277fdcf3398dc2d4c6c Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Wed, 26 Sep 2018 22:22:29 -0700 Subject: replace some instances of to_hash with to_h to_hash on a lot of these objects should go away, but even eliminating all our calls to to_hash on these objects internally is difficult. (e.g. converting the knife ui code to call #to_h means we wind up calling nil#to_h which "helpfully" becomes '{}' which is hilarious and i don't know why someone thought that was a good idea). Signed-off-by: Lamont Granquist --- lib/chef/run_status.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/chef/run_status.rb') diff --git a/lib/chef/run_status.rb b/lib/chef/run_status.rb index 9a52f846c7..37b10fb9be 100644 --- a/lib/chef/run_status.rb +++ b/lib/chef/run_status.rb @@ -1,6 +1,6 @@ # # Author:: Daniel DeLeo () -# Copyright:: Copyright 2010-2016, Chef Software Inc. +# Copyright:: Copyright 2010-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -102,7 +102,7 @@ class Chef::RunStatus # * :updated_resources # * :exception # * :backtrace - def to_hash + def to_h # use a flat hash here so we can't errors from intermediate values being nil { node: node, success: success?, @@ -116,6 +116,8 @@ class Chef::RunStatus run_id: run_id } end + alias_method :to_hash, :to_h + # Returns a string of the format "ExceptionClass: message" or +nil+ if no # +exception+ is set. def formatted_exception -- cgit v1.2.1