8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/chef/file_content_management/deploy/target_io.rb', line 8
def deploy(src, dst)
Chef::Log.trace("Reading modes from remote file #{dst}")
stat = ::TargetIO::File.stat(dst)
mode = stat.mode & 07777
uid = stat.uid
gid = stat.gid
Chef::Log.trace("Uploading local temporary file #{src} as remote file #{dst}")
connection = Chef.run_context&.transport_connection
connection.upload(src, dst)
Chef::Log.trace("Applying mode = #{mode.to_s(8)}, uid = #{uid}, gid = #{gid} to #{dst}")
::TargetIO::File.chown(uid, nil, dst)
::TargetIO::File.chown(nil, gid, dst)
::TargetIO::File.chmod(mode, dst)
File.delete(src)
end
|