|
|
@@ -167,14 +167,25 @@ func (s *composeService) ensureProjectVolumes(ctx context.Context, project *type
|
|
|
if !filepath.IsAbs(p) {
|
|
|
return fmt.Errorf("file share path is not absolute: %s", p)
|
|
|
}
|
|
|
- if _, err := os.Stat(p); errors.Is(err, fs.ErrNotExist) {
|
|
|
+ if fi, err := os.Stat(p); errors.Is(err, fs.ErrNotExist) {
|
|
|
+ // actual directory will be implicitly created when the
|
|
|
+ // file share is initialized if it doesn't exist, so
|
|
|
+ // need to filter out any that should not be auto-created
|
|
|
if vol.Bind != nil && !vol.Bind.CreateHostPath {
|
|
|
- return fmt.Errorf("service %s: host path %q does not exist and `create_host_path` is false", svcName, vol.Source)
|
|
|
- }
|
|
|
- if err := os.MkdirAll(p, 0o755); err != nil {
|
|
|
- return fmt.Errorf("creating host path: %w", err)
|
|
|
+ logrus.Debugf("Skipping creating file share for %q: does not exist and `create_host_path` is false", p)
|
|
|
+ continue
|
|
|
}
|
|
|
+ } else if err != nil {
|
|
|
+ // if we can't read the path, we won't be able ot make
|
|
|
+ // a file share for it
|
|
|
+ logrus.Debugf("Skipping creating file share for %q: %v", p, err)
|
|
|
+ continue
|
|
|
+ } else if !fi.IsDir() {
|
|
|
+ // ignore files & special types (e.g. Unix sockets)
|
|
|
+ logrus.Debugf("Skipping creating file share for %q: not a directory", p)
|
|
|
+ continue
|
|
|
}
|
|
|
+
|
|
|
paths = append(paths, p)
|
|
|
}
|
|
|
}
|
|
|
@@ -185,14 +196,14 @@ func (s *composeService) ensureProjectVolumes(ctx context.Context, project *type
|
|
|
|
|
|
fileShareManager := desktop.NewFileShareManager(s.desktopCli, project.Name, paths)
|
|
|
if err := fileShareManager.EnsureExists(ctx); err != nil {
|
|
|
- return fmt.Errorf("initializing: %w", err)
|
|
|
+ return fmt.Errorf("initializing file shares: %w", err)
|
|
|
}
|
|
|
}
|
|
|
return nil
|
|
|
}()
|
|
|
|
|
|
if err != nil {
|
|
|
- progress.ContextWriter(ctx).TailMsgf("Failed to prepare Synchronized File Shares: %v", err)
|
|
|
+ progress.ContextWriter(ctx).TailMsgf("Failed to prepare Synchronized file shares: %v", err)
|
|
|
}
|
|
|
return nil
|
|
|
}
|