MCPcopy Create free account
hub / github.com/DBCDK/morph / GetBootID

Method GetBootID

ssh/ssh.go:282–300  ·  view source on GitHub ↗
(host Host)

Source from the content-addressed store, hash-verified

280}
281
282func (sshCtx *SSHContext) GetBootID(host Host) (string, error) {
283 ctx, cancel := context.WithTimeout(context.TODO(), 5*time.Second)
284 defer cancel()
285 cmd, err := sshCtx.CmdContext(ctx, host, "cat", "/proc/sys/kernel/random/boot_id")
286 if err != nil {
287 return "", err
288 }
289
290 var stdout bytes.Buffer
291 cmd.Stdout = &stdout
292 cmd.Stderr = os.Stderr
293
294 err = cmd.Run()
295 if err != nil {
296 return "", err
297 }
298
299 return strings.TrimSpace(stdout.String()), nil
300}
301
302func (ctx *SSHContext) MakeTempFile(host Host) (path string, err error) {
303 cmd, _ := ctx.Cmd(host, "mktemp")

Callers 1

RebootMethod · 0.80

Calls 3

CmdContextMethod · 0.95
StringMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected