From ddbaf6126452de1ab0a76fab7026fadf908022f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tino=20V=C3=A1zquez?= Date: Mon, 6 Mar 2023 11:43:59 +0100 Subject: [PATCH] L #-: Use File.empty? (cherry picked from commit 88fa753e86933428741c29013c74e4391b749969) --- src/vmm_mad/exec/one_vmm_exec.rb | 2 +- src/vmm_mad/remotes/lib/firecracker/microvm.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vmm_mad/exec/one_vmm_exec.rb b/src/vmm_mad/exec/one_vmm_exec.rb index c777c416c2..9ab25310dc 100755 --- a/src/vmm_mad/exec/one_vmm_exec.rb +++ b/src/vmm_mad/exec/one_vmm_exec.rb @@ -400,7 +400,7 @@ class ExecDriver < VirtualMachineDriver # ---------------------------------------------------------------------- local_dfile = action.data[:local_dfile] - if !local_dfile || File.zero?(local_dfile) + if !local_dfile || File.empty?(local_dfile) send_message(ACTION[:deploy], RESULT[:failure], id, "Cannot open deployment file #{local_dfile}") return diff --git a/src/vmm_mad/remotes/lib/firecracker/microvm.rb b/src/vmm_mad/remotes/lib/firecracker/microvm.rb index e3acede0b7..6774292020 100644 --- a/src/vmm_mad/remotes/lib/firecracker/microvm.rb +++ b/src/vmm_mad/remotes/lib/firecracker/microvm.rb @@ -224,9 +224,9 @@ class MicroVM t_start = Time.now timeout = @one.fcrc[:cgroup_delete_timeout] - next while !File.read(path).empty? && (Time.now - t_start < timeout) + next while !File.empty?(path) && (Time.now - t_start < timeout) - File.read(path).empty? + File.empty?(path) rescue Errno::ENOENT end # rubocop:enable Lint/SuppressedException