Apply the cached config without safe-apply and keep reverted generations in memory
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user