diff options
author | Thom May <thom@may.lt> | 2016-02-18 09:07:37 +0000 |
---|---|---|
committer | Thom May <thom@may.lt> | 2016-02-18 09:07:37 +0000 |
commit | 320389bf316d461ffc874ec4041999bffbac590a (patch) | |
tree | 60f35b64c110f125a3d9bc6fd65eb594b35749e4 /lib | |
parent | a07b8022e790c025265f8859b5e04ac5116e7683 (diff) | |
parent | d038cf5a74267e02136d38407bbaa188754e5830 (diff) | |
download | chef-320389bf316d461ffc874ec4041999bffbac590a.tar.gz |
Merge pull request #4316 from josb/master
chef-client: add --[no]skip-cookbook-sync option
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/application/client.rb | 5 | ||||
-rw-r--r-- | lib/chef/cookbook/synchronizer.rb | 4 | ||||
-rw-r--r-- | lib/chef/shell.rb | 5 |
3 files changed, 14 insertions, 0 deletions
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb index 1a7d8d046d..9ec553fb8a 100644 --- a/lib/chef/application/client.rb +++ b/lib/chef/application/client.rb @@ -285,6 +285,11 @@ class Chef::Application::Client < Chef::Application :description => "DANGEROUS: does what it says, only useful with --recipe-url", :boolean => true + option :skip_cookbook_sync, + :long => "--[no-]skip-cookbook-sync", + :description => "Use cached cookbooks without overwriting local differences from the server", + :boolean => false + IMMEDIATE_RUN_SIGNAL = "1".freeze attr_reader :chef_client_json diff --git a/lib/chef/cookbook/synchronizer.rb b/lib/chef/cookbook/synchronizer.rb index e8b90a45c3..ec388746e9 100644 --- a/lib/chef/cookbook/synchronizer.rb +++ b/lib/chef/cookbook/synchronizer.rb @@ -263,6 +263,10 @@ class Chef end def cached_copy_up_to_date?(local_path, expected_checksum) + if Chef::Config[:skip_cookbook_sync] + Chef::Log.warn "skipping cookbook synchronization! DO NOT LEAVE THIS ENABLED IN PRODUCTION!!!" + return true + end if cache.has_key?(local_path) current_checksum = CookbookVersion.checksum_cookbook_file(cache.load(local_path, false)) expected_checksum == current_checksum diff --git a/lib/chef/shell.rb b/lib/chef/shell.rb index 72081b18df..aad5c49d00 100644 --- a/lib/chef/shell.rb +++ b/lib/chef/shell.rb @@ -265,6 +265,11 @@ FOOTER :description => "Replace current run list with specified items", :proc => lambda { |items| items.split(",").map { |item| Chef::RunList::RunListItem.new(item) } } + option :skip_cookbook_sync, + :long => "--[no-]skip-cookbook-sync", + :description => "Use cached cookbooks without overwriting local differences from the server", + :boolean => false + def self.print_help instance = new instance.parse_options([]) |