summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-01-28 12:25:08 -0800
committerGitHub <noreply@github.com>2019-01-28 12:25:08 -0800
commit2aa38b678cad9c36a7d6839b791a22136624907d (patch)
tree060aaa12d8c68080b4f04019c4c90eb0632e0a6c
parent6917f86c4cc5931c2c02d7b4e2053716dea734e3 (diff)
parentfa1c9b5fbedda8cbadc006af49af99b2727f94ad (diff)
downloadchef-2aa38b678cad9c36a7d6839b791a22136624907d.tar.gz
Merge pull request #8135 from f9n/clean_up_the_knife_cookbook_upload_command
[knife] Remove duplicate code blocks in the knife cookbook upload command
-rw-r--r--lib/chef/knife/cookbook_upload.rb20
1 files changed, 3 insertions, 17 deletions
diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb
index 57a63c7b47..d2a140540e 100644
--- a/lib/chef/knife/cookbook_upload.rb
+++ b/lib/chef/knife/cookbook_upload.rb
@@ -76,22 +76,14 @@ class Chef
def run
# Sanity check before we load anything from the server
- unless config[:all]
- if @name_args.empty?
- show_usage
- ui.fatal("You must specify the --all flag or at least one cookbook name")
- exit 1
- end
- end
-
- config[:cookbook_path] ||= Chef::Config[:cookbook_path]
-
- if @name_args.empty? && ! config[:all]
+ if ! config[:all] && @name_args.empty?
show_usage
ui.fatal("You must specify the --all flag or at least one cookbook name")
exit 1
end
+ config[:cookbook_path] ||= Chef::Config[:cookbook_path]
+
assert_environment_valid!
version_constraints_to_update = {}
upload_failures = 0
@@ -121,12 +113,6 @@ class Chef
ui.warn("Could not find any cookbooks in your cookbook path: #{cookbook_path}. Use --cookbook-path to specify the desired path.")
end
else
- if @name_args.empty?
- show_usage
- ui.error("You must specify the --all flag or at least one cookbook name")
- exit 1
- end
-
cookbooks_to_upload.each do |cookbook_name, cookbook|
cookbook.freeze_version if config[:freeze]
begin