cluster: add Machine.ReadLines() shortcut

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-10-29 23:45:19 +00:00
parent 6a6cdfcfe8
commit 5d95b4509b
+8
View File
@@ -53,6 +53,14 @@ func (m *Machine) ReadFile(name string, args ...any) ([]byte, error) {
return m.zone.zones.ReadFile(fullName)
}
// ReadLines reads a file from the machine's config directory,
// split by lines, trimmed, and accepting `#` to comment lines out.
func (m *Machine) ReadLines(name string, args ...any) ([]string, error) {
fullName := m.getFilename(name, args...)
return m.zone.zones.ReadLines(fullName)
}
// 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 {
fullName := m.getFilename(name, args...)