Split action into kubectl
This commit is contained in:
@@ -1,37 +0,0 @@
|
|||||||
package osupgrade
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"os/exec"
|
|
||||||
)
|
|
||||||
|
|
||||||
type NextBootConfig struct {
|
|
||||||
Key string
|
|
||||||
Value string
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetNextBootEnv(ctx context.Context, cfg NextBootConfig) error {
|
|
||||||
if cfg.Key == "" {
|
|
||||||
return fmt.Errorf("boot env key is empty")
|
|
||||||
}
|
|
||||||
if cfg.Value == "" {
|
|
||||||
return fmt.Errorf("boot env value is empty")
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd := exec.CommandContext(
|
|
||||||
ctx,
|
|
||||||
"/proc/self/exe",
|
|
||||||
"internal",
|
|
||||||
"fw-setenv",
|
|
||||||
"--key", cfg.Key,
|
|
||||||
"--value", cfg.Value,
|
|
||||||
)
|
|
||||||
|
|
||||||
out, err := cmd.CombinedOutput()
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("invoke internal fw-setenv: %w: %s", err, string(out))
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user