2024-01-30 09:58:56 +01:00
|
|
|
package dns
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2024-10-24 10:53:46 +02:00
|
|
|
type ShutdownState struct {
|
|
|
|
Guid string
|
|
|
|
}
|
2024-01-30 09:58:56 +01:00
|
|
|
|
2024-10-24 10:53:46 +02:00
|
|
|
func (s *ShutdownState) Name() string {
|
|
|
|
return "dns_state"
|
|
|
|
}
|
2024-01-30 09:58:56 +01:00
|
|
|
|
2024-10-24 10:53:46 +02:00
|
|
|
func (s *ShutdownState) Cleanup() error {
|
|
|
|
manager, err := newHostManagerWithGuid(s.Guid)
|
2024-01-30 09:58:56 +01:00
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("create host manager: %w", err)
|
|
|
|
}
|
|
|
|
|
2024-10-24 10:53:46 +02:00
|
|
|
if err := manager.restoreUncleanShutdownDNS(); err != nil {
|
|
|
|
return fmt.Errorf("restore unclean shutdown dns: %w", err)
|
2024-01-30 09:58:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|