diff options
author | Tor Magnus Rakvåg <tor.magnus@outlook.com> | 2018-12-06 14:22:04 +0100 |
---|---|---|
committer | Tor Magnus Rakvåg <tor.magnus@outlook.com> | 2018-12-06 15:37:47 +0100 |
commit | 74914371863579eac61ccb4cfb628d7e502ab668 (patch) | |
tree | cdbf70ce1a80b4837e8a55c922186a31712dec6a | |
parent | e02e7df9934b04e4382a7277e59111ab9b0f6f7d (diff) | |
download | chef-74914371863579eac61ccb4cfb628d7e502ab668.tar.gz |
use built in method of handling nil status
Signed-off-by: Tor Magnus Rakvåg <tm@intility.no>
-rw-r--r-- | lib/chef/resource/powershell_package_source.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/resource/powershell_package_source.rb b/lib/chef/resource/powershell_package_source.rb index 321a788822..b1979448fa 100644 --- a/lib/chef/resource/powershell_package_source.rb +++ b/lib/chef/resource/powershell_package_source.rb @@ -56,8 +56,12 @@ class Chef load_current_value do cmd = load_resource_state_script(name) repo = powershell_out!(cmd) - status = Chef::JSONCompat.from_json(repo.stdout) - url status["url"].nil? ? "not_set" : status["url"] + if repo.stdout.empty? + current_value_does_not_exist! + else + status = Chef::JSONCompat.from_json(repo.stdout) + end + url status["url"] trusted status["trusted"] provider_name status["provider_name"] publish_location status["publish_location"] |