Ensure that files are handled safely

This commit fixes an issue with reading and writing files.
File.open is used which means that a file will remain open
unless explicilty closed or the program exit. This doesn't work
for an NFS mount as the scripts try to "rm -rf" when the file
is still open. This commit fixes that by replacing all .opens
with .reads
This commit is contained in:
mw781 2020-06-17 11:09:09 +01:00
parent 778695b4d9
commit fea0ff3204

View File

@ -97,7 +97,7 @@ def publish_processed_meetings(recording_dir)
metadata_xml_path = "#{published_dir}/#{publish_type}/#{done_base}/metadata.xml"
if File.exists? metadata_xml_path
begin
doc = Hash.from_xml(File.open(metadata_xml_path))
doc = Hash.from_xml(File.read(metadata_xml_path))
playback = doc[:recording][:playback] if !doc[:recording][:playback].nil?
metadata = doc[:recording][:meta] if !doc[:recording][:meta].nil?
download = doc[:recording][:download] if !doc[:recording][:download].nil?