|
|
|
@ -40,6 +40,21 @@ func (m *Cluster) openWriter(name string, flags int, args ...any) (io.WriteClose
|
|
|
|
|
panic("unreachable") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// RemoveFile deletes a file from the cluster's config directory
|
|
|
|
|
func (m *Cluster) RemoveFile(name string, args ...any) error { |
|
|
|
|
if len(args) > 0 { |
|
|
|
|
name = fmt.Sprintf(name, args...) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
err := fs.Remove(m.dir, name) |
|
|
|
|
switch { |
|
|
|
|
case os.IsNotExist(err): |
|
|
|
|
return nil |
|
|
|
|
default: |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ReadFile reads a file from the cluster's config directory
|
|
|
|
|
func (m *Cluster) ReadFile(name string, args ...any) ([]byte, error) { |
|
|
|
|
if len(args) > 0 { |
|
|
|
|