24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/puppet/type/file/data_sync.rb', line 24
def checksum_insync?(param, is, has_contents, &block)
resource = param.resource
if resource.should_be_file?
return false if is == :absent
else
if resource[:ensure] == :present && has_contents && (s = resource.stat)
resource.warning _("Ensure set to :present but file type is %{file_type} so no content will be synced") % { file_type: s.ftype}
end
return true
end
return true if ! resource.replace?
is_insync = yield(is)
if show_diff?(!is_insync)
if param.sensitive
send resource[:loglevel], "[diff redacted]"
else
write_temporarily(param) do |path|
diff_output = diff(resource[:path], path)
if diff_output.encoding == Encoding::BINARY || !diff_output.valid_encoding?
diff_output = "Binary files #{resource[:path]} and #{path} differ"
end
send resource[:loglevel], "\n" + diff_output
end
end
end
is_insync
end
|