Fence installation transaction durability (T-613)
This commit is contained in:
@@ -89,6 +89,14 @@ func inspectManagedDirectory(path string) (bool, error) {
|
||||
}
|
||||
|
||||
func removeManagedDirectory(layout appLayout, target string) error {
|
||||
return removeManagedDirectoryWithFence(layout, target, defaultDurability())
|
||||
}
|
||||
|
||||
func removeManagedDirectoryWithFence(
|
||||
layout appLayout,
|
||||
target string,
|
||||
fence durabilityFence,
|
||||
) error {
|
||||
if filepath.Dir(target) != layout.root {
|
||||
return fmt.Errorf("%w: refuse removal outside app root", ErrUnsafeInstallLayout)
|
||||
}
|
||||
@@ -106,5 +114,5 @@ func removeManagedDirectory(layout appLayout, target string) error {
|
||||
if err := os.RemoveAll(target); err != nil {
|
||||
return fmt.Errorf("remove managed directory %s: %w", base, err)
|
||||
}
|
||||
return nil
|
||||
return syncDirectoryWithFence(fence, layout.root, "app root after directory removal")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user