|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
package cluster |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"bytes" |
|
|
|
|
"fmt" |
|
|
|
|
"io" |
|
|
|
|
"os" |
|
|
|
@ -58,15 +57,9 @@ func (m *Machine) ReadFile(name string, args ...any) ([]byte, error) {
|
|
|
|
|
|
|
|
|
|
// WriteStringFile writes the given content to a file on the machine's config directory
|
|
|
|
|
func (m *Machine) WriteStringFile(value string, name string, args ...any) error { |
|
|
|
|
f, err := m.CreateTruncFile(name, args...) |
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
defer f.Close() |
|
|
|
|
fullName := m.getFilename(name, args...) |
|
|
|
|
|
|
|
|
|
buf := bytes.NewBufferString(value) |
|
|
|
|
_, err = buf.WriteTo(f) |
|
|
|
|
return err |
|
|
|
|
return m.zone.zones.WriteStringFile(value, fullName) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (m *Machine) getFilename(name string, args ...any) string { |
|
|
|
|