Browse Source

cluster: add Machine.ReadLines() shortcut

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/38/head
Alejandro Mery 8 months ago
parent
commit
1580c09746
  1. 8
      pkg/cluster/machine_file.go

8
pkg/cluster/machine_file.go

@ -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...)

Loading…
Cancel
Save