summaryrefslogtreecommitdiff
path: root/lib/chef/knife/cookbook_site_share.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/knife/cookbook_site_share.rb')
-rw-r--r--lib/chef/knife/cookbook_site_share.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/chef/knife/cookbook_site_share.rb b/lib/chef/knife/cookbook_site_share.rb
index b360cad728..71bbb00abc 100644
--- a/lib/chef/knife/cookbook_site_share.rb
+++ b/lib/chef/knife/cookbook_site_share.rb
@@ -40,6 +40,12 @@ class Chef
:description => "A colon-separated path to look for cookbooks in",
:proc => lambda { |o| Chef::Config.cookbook_path = o.split(":") }
+ option :upload,
+ :long => "--[no-]upload",
+ :description => "Upload cookbook to SuperMacket, defaults is true. If given --no-upload, only show list of archived files",
+ :boolean => true,
+ :default => true
+
def run
if @name_args.length < 2
show_usage
@@ -66,6 +72,14 @@ class Chef
exit(1)
end
+ unless config[:upload]
+ ui.info("Not uploading #{cookbook_name}.tgz due to --no-upload flag.")
+ result = shell_out!("tar -tzf #{cookbook_name}.tgz", :cwd => tmp_cookbook_dir)
+ ui.info(result.stdout)
+ FileUtils.rm_rf tmp_cookbook_dir
+ return
+ end
+
begin
do_upload("#{tmp_cookbook_dir}/#{cookbook_name}.tgz", category, Chef::Config[:node_name], Chef::Config[:client_key])
ui.info("Upload complete!")