summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorf9n <f9n@protonmail.com>2019-01-18 14:27:32 +0300
committerf9n <f9n@protonmail.com>2019-01-18 14:38:16 +0300
commitfa1c9b5fbedda8cbadc006af49af99b2727f94ad (patch)
tree72e3cbc12a41df5bd4853908bfeb2bf29629f5ff
parent2f7ad6baf98f1999faa49f5218552911105e0380 (diff)
downloadchef-fa1c9b5fbedda8cbadc006af49af99b2727f94ad.tar.gz
Remove unnessary code blocks in the knife cookbook upload command
Signed-off-by: Fatih Sarhan <f9n@protonmail.com>
-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