summaryrefslogtreecommitdiff
path: root/chef/lib/chef/knife/cookbook_upload.rb
diff options
context:
space:
mode:
authorMatthew Kent <mkent@magoazul.com>2012-01-08 19:29:10 -0800
committerBryan McLellan <btm@opscode.com>2012-04-03 11:31:22 -0700
commit1c468f0a50f8a0393103ea16449ace4af994e982 (patch)
treead270e70d66d7348c39575f9c784ebe25e5b4f75 /chef/lib/chef/knife/cookbook_upload.rb
parent578c94713cf5e30f40949f1021619e6c02515f3b (diff)
downloadchef-1c468f0a50f8a0393103ea16449ace4af994e982.tar.gz
CHEF-2801: Exit immediately if we have nothing to do, especially before
loading content from the server.
Diffstat (limited to 'chef/lib/chef/knife/cookbook_upload.rb')
-rw-r--r--chef/lib/chef/knife/cookbook_upload.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/chef/lib/chef/knife/cookbook_upload.rb b/chef/lib/chef/knife/cookbook_upload.rb
index 6745eb47ee..577d298a98 100644
--- a/chef/lib/chef/knife/cookbook_upload.rb
+++ b/chef/lib/chef/knife/cookbook_upload.rb
@@ -68,6 +68,15 @@ class Chef
:description => "Also upload cookbook dependencies"
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]
assert_environment_valid!
@@ -93,11 +102,6 @@ class Chef
end
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
justify_width = @name_args.map {|name| name.size }.max.to_i + 2
@name_args.each do |cookbook_name|
begin