class Chef::Resource::File
Attributes
checksum[W]
final_checksum[RW]
The checksum of the rendered file. This has to be saved on the new_resource for the 'after' state for reporting but we cannot mutate the new_resource.checksum which would change the user intent in the new_resource if the resource is reused.
@return [String] Checksum of the file we actually rendered
Public Instance Methods
special_docker_files?(file)
click to toggle source
# File lib/chef/resource/file.rb, line 101 def special_docker_files?(file) %w{/etc/hosts /etc/hostname /etc/resolv.conf}.include?(Pathname(file.scrub).cleanpath.to_path) end
state_for_resource_reporter()
click to toggle source
Calls superclass method
Chef::Resource#state_for_resource_reporter
# File lib/chef/resource/file.rb, line 92 def state_for_resource_reporter state_attrs = super() # fix up checksum state with final_checksum saved by the provider if checksum.nil? && final_checksum state_attrs[:checksum] = final_checksum end state_attrs end
verify(command = nil, opts = {}, &block)
click to toggle source
# File lib/chef/resource/file.rb, line 80 def verify(command = nil, opts = {}, &block) if ! (command.nil? || [String, Symbol].include?(command.class)) raise ArgumentError, "verify requires either a string, symbol, or a block" end if command || block_given? verifications << Verification.new(self, command, opts, &block) else verifications end end