Merge pull request #2463 from crosbymichael/temp-clean
Don't prevent boot on temp cleanup
This commit is contained in:
commit
ed697290da
@ -116,8 +116,12 @@ func App() *cli.App {
|
|||||||
return errors.Wrap(err, "creating temp mount location")
|
return errors.Wrap(err, "creating temp mount location")
|
||||||
}
|
}
|
||||||
// unmount all temp mounts on boot for the server
|
// unmount all temp mounts on boot for the server
|
||||||
if err := mount.CleanupTempMounts(0); err != nil {
|
warnings, err := mount.CleanupTempMounts(0)
|
||||||
return errors.Wrap(err, "unmounting temp mounts")
|
if err != nil {
|
||||||
|
log.G(ctx).WithError(err).Error("unmounting temp mounts")
|
||||||
|
}
|
||||||
|
for _, w := range warnings {
|
||||||
|
log.G(ctx).WithError(w).Warn("cleanup temp mount")
|
||||||
}
|
}
|
||||||
address := config.GRPC.Address
|
address := config.GRPC.Address
|
||||||
if address == "" {
|
if address == "" {
|
||||||
|
@ -39,10 +39,10 @@ func SetTempMountLocation(root string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CleanupTempMounts all temp mounts and remove the directories
|
// CleanupTempMounts all temp mounts and remove the directories
|
||||||
func CleanupTempMounts(flags int) error {
|
func CleanupTempMounts(flags int) (warnings []error, err error) {
|
||||||
mounts, err := Self()
|
mounts, err := Self()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
var toUnmount []string
|
var toUnmount []string
|
||||||
for _, m := range mounts {
|
for _, m := range mounts {
|
||||||
@ -53,11 +53,12 @@ func CleanupTempMounts(flags int) error {
|
|||||||
sort.Sort(sort.Reverse(sort.StringSlice(toUnmount)))
|
sort.Sort(sort.Reverse(sort.StringSlice(toUnmount)))
|
||||||
for _, path := range toUnmount {
|
for _, path := range toUnmount {
|
||||||
if err := UnmountAll(path, flags); err != nil {
|
if err := UnmountAll(path, flags); err != nil {
|
||||||
return err
|
warnings = append(warnings, err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
if err := os.Remove(path); err != nil {
|
if err := os.Remove(path); err != nil {
|
||||||
return err
|
warnings = append(warnings, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return warnings, nil
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,6 @@ func SetTempMountLocation(root string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CleanupTempMounts all temp mounts and remove the directories
|
// CleanupTempMounts all temp mounts and remove the directories
|
||||||
func CleanupTempMounts(flags int) error {
|
func CleanupTempMounts(flags int) ([]error, error) {
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user