Apply the cached config without safe-apply and keep reverted generations in memory
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful

This commit is contained in:
2026-10-05 13:56:11 +11:00
parent 9092b463a0
commit c7e02c089a
4 changed files with 117 additions and 27 deletions
+2 -2
View File
@@ -25,14 +25,14 @@ const Unit = "tomswall-try-revert"
var (
// Dir holds the lock and the pending snapshot.
Dir = "/var/lib/tomswall"
// Run executes a systemd command; replaced in tests.
// Run executes a systemd command. Test hook; production code must not reassign.
Run = func(name string, args ...string) error {
if out, err := exec.Command(name, args...).CombinedOutput(); err != nil {
return fmt.Errorf("%s %s: %w: %s", name, strings.Join(args, " "), err, strings.TrimSpace(string(out)))
}
return nil
}
// Restore rolls the live table back to a snapshot; replaced in tests.
// Restore rolls the live table back to a snapshot. Test hook; production code must not reassign.
Restore = func(s *nftables.Snapshot) error {
engine, err := nftables.NewEngine(&config.Config{Settings: config.Settings{TableName: s.Table}})
if err != nil {