@@ -22,16 +22,16 @@ func Unmount(env *models.Env) error {
22
22
defer display .StopTask ()
23
23
24
24
// unmount the engine if it's a local directory
25
- if config .EngineDir () != "" {
26
- src := config .EngineDir ()
27
- dst := filepath .Join (provider .HostShareDir (), env .ID , "engine" )
25
+ engineDir , _ := config .EngineDir ()
26
+ if engineDir != "" {
27
+ src := engineDir // local directory
28
+ dst := filepath .Join (provider .HostShareDir (), env .ID , "engine" ) // b2d "global zone"
28
29
29
30
// unmount the env on the provider
30
31
if err := provider .RemoveMount (src , dst ); err != nil {
31
32
display .ErrorTask ()
32
33
return util .ErrorAppend (err , "failed to remove engine mount" )
33
34
}
34
-
35
35
}
36
36
37
37
// unmount the app src
@@ -47,6 +47,21 @@ func Unmount(env *models.Env) error {
47
47
return nil
48
48
}
49
49
50
+ func UnmountEngine (env * models.Env , engineDir string ) error {
51
+ // unmount the engine if it's a local directory
52
+ if engineDir != "" {
53
+ src := engineDir // local directory
54
+ dst := filepath .Join (provider .HostShareDir (), env .ID , "engine" ) // b2d "global zone"
55
+
56
+ // unmount the env on the provider
57
+ if err := provider .RemoveMount (src , dst ); err != nil {
58
+ display .ErrorTask ()
59
+ return util .ErrorAppend (err , "failed to cleanup old engine mount" )
60
+ }
61
+ }
62
+ return nil
63
+ }
64
+
50
65
// mountsInUse returns true if any of the env's apps are running
51
66
func mountsInUse (env * models.Env ) bool {
52
67
devApp , _ := models .FindAppBySlug (env .ID , "dev" )
@@ -58,7 +73,8 @@ func mountsInUse(env *models.Env) bool {
58
73
func mounted (env * models.Env ) bool {
59
74
60
75
// if the engine is mounted, check that
61
- if config .EngineDir () != "" {
76
+ engineDir , _ := config .EngineDir ()
77
+ if engineDir != "" {
62
78
dst := filepath .Join (provider .HostShareDir (), env .ID , "engine" )
63
79
64
80
if provider .HasMount (dst ) {
0 commit comments