cluster: add Machine.ReadLines() shortcut
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -53,6 +53,14 @@ func (m *Machine) ReadFile(name string, args ...any) ([]byte, error) {
|
|||||||
return m.zone.zones.ReadFile(fullName)
|
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
|
// 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 {
|
func (m *Machine) WriteStringFile(value string, name string, args ...any) error {
|
||||||
fullName := m.getFilename(name, args...)
|
fullName := m.getFilename(name, args...)
|
||||||
|
|||||||
Reference in New Issue
Block a user