diff options
author | Thom May <thom@may.lt> | 2018-03-05 12:11:18 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-05 12:11:18 +0000 |
commit | 95df1180804e11dd2d9d579bcb5b692d29f05314 (patch) | |
tree | 7fb48651cf576ea1b83248c83a3fdc9931d53ded | |
parent | 2c1fc982bfee738ad7b14c0c1292510eb23ad496 (diff) | |
parent | ff5d9860081ad7cf3a2ec8343590f6207faff903 (diff) | |
download | chef-95df1180804e11dd2d9d579bcb5b692d29f05314.tar.gz |
Merge pull request #6936 from chef/site_failure_deprecated_chef_13
[knife] Don't crash when a deprecated cookbook has no replacement (#6853)
-rw-r--r-- | lib/chef/knife/cookbook_site_download.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/chef/knife/cookbook_site_download.rb b/lib/chef/knife/cookbook_site_download.rb index 43677cfa78..07e0037bd6 100644 --- a/lib/chef/knife/cookbook_site_download.rb +++ b/lib/chef/knife/cookbook_site_download.rb @@ -47,7 +47,12 @@ class Chef def run if current_cookbook_deprecated? message = "DEPRECATION: This cookbook has been deprecated. " - message << "It has been replaced by #{replacement_cookbook}." + replacement = replacement_cookbook + if !replacement.to_s.strip.empty? + message << "It has been replaced by #{replacement}." + else + message << "No replacement has been defined." + end ui.warn message unless config[:force] @@ -105,7 +110,7 @@ class Chef end def replacement_cookbook - File.basename(current_cookbook_data["replacement"]) + File.basename(current_cookbook_data["replacement"] || "") end def specific_cookbook_version_url |