From 37baee5b73d568ac9562bba6ebae0472b8146e85 Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Thu, 25 Feb 2016 14:39:23 -0800 Subject: Meant to use the value from the if..then, then put a line above the if. --- lib/chef/provider/package/chocolatey.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/chef/provider/package/chocolatey.rb b/lib/chef/provider/package/chocolatey.rb index 96ec8c0a8c..44fb1de235 100644 --- a/lib/chef/provider/package/chocolatey.rb +++ b/lib/chef/provider/package/chocolatey.rb @@ -147,15 +147,13 @@ EOS # # @return [String] full path of choco.exe def choco_exe - @choco_exe ||= + @choco_exe ||= begin # if this check is in #define_resource_requirements, it won't get # run before choco.exe gets called from #load_current_resource. exe_path = ::File.join(choco_install_path.to_s, "bin", "choco.exe") - if !::File.exist?(exe_path) - raise Chef::Exceptions::MissingLibrary, CHOCO_MISSING_MSG - else - exe_path - end + raise Chef::Exceptions::MissingLibrary, CHOCO_MISSING_MSG unless ::File.exist?(exe_path) + exe_path + end end # lets us mock out an incorrect value for testing. -- cgit v1.2.1