diff options
author | Jos Backus <jos@catnook.com> | 2015-12-15 14:49:46 -0800 |
---|---|---|
committer | Jos Backus <jos@catnook.com> | 2016-02-17 11:03:20 -0800 |
commit | 7dde5d9e6fc1b25f43198b9b3beb08b2684af0cb (patch) | |
tree | 538438d930cba31afde4954d28281402bda98443 | |
parent | e48aee5eae2191cf5755697d3f4407827945b0e9 (diff) | |
download | chef-7dde5d9e6fc1b25f43198b9b3beb08b2684af0cb.tar.gz |
chef-client: add --[no]skip-cookbook-sync option
Use with caution. Useful for patching a set of cookbooks on a machine
when iterating during development.
-rw-r--r-- | distro/common/markdown/man8/chef-client.mkd | 2 | ||||
-rw-r--r-- | lib/chef/application/client.rb | 5 | ||||
-rw-r--r-- | lib/chef/cookbook/synchronizer.rb | 1 | ||||
-rw-r--r-- | lib/chef/shell.rb | 5 |
4 files changed, 13 insertions, 0 deletions
diff --git a/distro/common/markdown/man8/chef-client.mkd b/distro/common/markdown/man8/chef-client.mkd index ffe444ecf2..7506e3b925 100644 --- a/distro/common/markdown/man8/chef-client.mkd +++ b/distro/common/markdown/man8/chef-client.mkd @@ -40,6 +40,8 @@ __chef-client__ _(options)_ Set the PID file location, defaults to /tmp/chef-client.pid * `--once`: Cancel any interval or splay options, run chef once and exit + * `--skip-cookbook-sync`: + Skip cookbook synchronization * `-v`, `--version`: Show chef version * `-h`, `--help`: diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb index 1a7d8d046d..badd7af9cf 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 => "Whether to skip cookbook synchronization", + :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..21ad373625 100644 --- a/lib/chef/cookbook/synchronizer.rb +++ b/lib/chef/cookbook/synchronizer.rb @@ -263,6 +263,7 @@ class Chef end def cached_copy_up_to_date?(local_path, expected_checksum) + return true if Chef::Config[:skip_cookbook_sync] 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..545b544011 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 => "Whether to skip cookbook synchronization", + :boolean => false + def self.print_help instance = new instance.parse_options([]) |