From 5a3d483f98cfeb5a5fe48de01d2cb1269e255e21 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Sun, 29 Oct 2023 01:04:24 +0000 Subject: [PATCH] cluster: refactor Machine.ReadFile() and Machine.OpenFile() Signed-off-by: Alejandro Mery --- pkg/cluster/machine_file.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/cluster/machine_file.go b/pkg/cluster/machine_file.go index 0dff58e..bb320df 100644 --- a/pkg/cluster/machine_file.go +++ b/pkg/cluster/machine_file.go @@ -11,10 +11,9 @@ import ( // OpenFile opens a file on the machine's config directory with the specified flags func (m *Machine) OpenFile(name string, flags int, args ...any) (fs.File, error) { - base := m.zone.zones.dir fullName := m.getFilename(name, args...) - return fs.OpenFile(base, fullName, flags, 0644) + return m.zone.zones.OpenFile(fullName, flags) } // CreateTruncFile creates or truncates a file on the machine's config directory @@ -49,10 +48,9 @@ func (m *Machine) RemoveFile(name string, args ...any) error { // ReadFile reads a file from the machine's config directory func (m *Machine) ReadFile(name string, args ...any) ([]byte, error) { - base := m.zone.zones.dir fullName := m.getFilename(name, args...) - return fs.ReadFile(base, fullName) + return m.zone.zones.ReadFile(fullName) } // WriteStringFile writes the given content to a file on the machine's config directory