Skip to content

Instantly share code, notes, and snippets.

@charlesjohnson
Created December 4, 2014 19:53
Show Gist options
  • Save charlesjohnson/d8577f5ab5c7f7d4bd3a to your computer and use it in GitHub Desktop.
Save charlesjohnson/d8577f5ab5c7f7d4bd3a to your computer and use it in GitHub Desktop.
File copy in Chef
ruby_block "Copy Chef config file if running in a Vagrant guest" do
block do
::FileUtils.cp "/tmp/vagrant-chef-1/client.rb", "#{node['chef-client']['conf_dir']}/client.rb"
end
if ::File.exist?("#{node['chef-client']['conf_dir']}/client.rb")
not_if { ::FileUtils.compare_file("/tmp/vagrant-chef-1/client.rb", "#{node['chef-client']['conf_dir']}/client.rb") }
end
only_if ::File.exist?("/tmp/vagrant-chef-1/client.rb")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment