diff options
author | John Keiser <jkeiser@opscode.com> | 2013-06-03 13:35:46 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-06-07 13:12:36 -0700 |
commit | e8595bdec6aa35820c17669c8dbcb5265303ef1f (patch) | |
tree | b4aa51f1adcda3434d54266f430f714e4736fe2a /lib/chef | |
parent | 67c09f4458388a080e52e81152afbc44e9811d87 (diff) | |
download | chef-e8595bdec6aa35820c17669c8dbcb5265303ef1f.tar.gz |
Add knife upload --freeze for cookbooks
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/chef_fs/file_system/cookbooks_dir.rb | 9 | ||||
-rw-r--r-- | lib/chef/knife/upload.rb | 8 |
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/chef/chef_fs/file_system/cookbooks_dir.rb b/lib/chef/chef_fs/file_system/cookbooks_dir.rb index 934e82883d..f54584bcab 100644 --- a/lib/chef/chef_fs/file_system/cookbooks_dir.rb +++ b/lib/chef/chef_fs/file_system/cookbooks_dir.rb @@ -95,8 +95,11 @@ class Chef proxy_loader = Chef::Cookbook::CookbookVersionLoader.new(proxy_cookbook_path, other.parent.chefignore) proxy_loader.load_cookbooks + cookbook_to_upload = proxy_loader.cookbook_version + cookbook_to_upload.freeze_version if options[:freeze] + # Instantiate a new uploader based on the proxy loader - uploader = Chef::CookbookUploader.new(proxy_loader.cookbook_version, proxy_cookbook_path, :force => options[:force], :rest => rest) + uploader = Chef::CookbookUploader.new(cookbook_to_upload, proxy_cookbook_path, :force => options[:force], :rest => rest) with_actual_cookbooks_dir(temp_cookbooks_path) do upload_cookbook!(uploader) @@ -105,7 +108,9 @@ class Chef end def upload_unversioned_cookbook(other, options) - uploader = Chef::CookbookUploader.new(other.chef_object, other.parent.file_path, :force => options[:force], :rest => rest) + cookbook_to_upload = other.chef_object + cookbook_to_upload.freeze_version if options[:freeze] + uploader = Chef::CookbookUploader.new(cookbook_to_upload, other.parent.file_path, :force => options[:force], :rest => rest) with_actual_cookbooks_dir(other.parent.file_path) do upload_cookbook!(uploader) diff --git a/lib/chef/knife/upload.rb b/lib/chef/knife/upload.rb index d2e5708aa8..f72b6ea616 100644 --- a/lib/chef/knife/upload.rb +++ b/lib/chef/knife/upload.rb @@ -25,7 +25,13 @@ class Chef :long => '--[no-]force', :boolean => true, :default => false, - :description => "Force upload of files even if they match (quicker and harmless, but doesn't print out what it changed)" + :description => "Force upload of files even if they match (quicker for many files). Will overwrite frozen cookbooks." + + option :freeze, + :long => '--[no-]freeze', + :boolean => true, + :default => false, + :description => "Freeze cookbooks that get uploaded." option :dry_run, :long => '--dry-run', |