Skip to content

Instantly share code, notes, and snippets.

@murphy-slaw
Created June 4, 2013 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save murphy-slaw/5708456 to your computer and use it in GitHub Desktop.
Save murphy-slaw/5708456 to your computer and use it in GitHub Desktop.
action :create do
Chef::Log.info "Creating #{@new_resource.name}"
unless file_current?(@new_resource)
tmp = Tempfile.new(::File.basename(new_resource.name),::File.dirname(new_resource.name))
tmp.close
ruby_block "move #{tmp.path}" do
FileUtils.mv(tmp.path, new_resource.name)
action :nothing
end
remote_file tmp.path do
source new_resource.source
action :create
notifies :run, "ruby_block['move #{tmp.path}']", :immediately
end
@new_resource.updated_by_last_action(true)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment