MCPcopy
hub / github.com/purpleidea/mgmt / FileWrite

Function FileWrite

engine/resources/resources_test.go:224–233  ·  view source on GitHub ↗

FileWrite takes a path and a string to write to that file, and builds a Step that does that to them.

(p, s string)

Source from the content-addressed store, hash-verified

222// FileWrite takes a path and a string to write to that file, and builds a Step
223// that does that to them.
224func FileWrite(p, s string) Step { // path & string
225 return &manualStep{
226 action: func() error {
227 // TODO: apparently using 0666 is equivalent to respecting the current umask
228 const umask = 0666
229 return os.WriteFile(p, []byte(s), umask)
230 },
231 expect: func() error { return nil },
232 }
233}
234
235// ErrIsNotExistOK returns nil if we get an IsNotExist true result on the error.
236func ErrIsNotExistOK(e error) error {

Callers 1

TestResources1Function · 0.85

Calls 1

WriteFileMethod · 0.65

Tested by

no test coverage detected