File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ import (
10
10
11
11
// handleResult is used to Write the latest States to Backend.
12
12
func (p * Plan ) handleResult (change * Change ) error {
13
- if change .ActionName == statemanager .ActionUninstall {
13
+ // uninstall succeeded
14
+ if change .ActionName == statemanager .ActionUninstall && change .Result .Succeeded {
14
15
p .smgr .DeleteState (change .Tool .Name )
15
16
return p .smgr .Write (p .smgr .GetStates ().Format ())
16
17
}
@@ -27,9 +28,15 @@ func (p *Plan) handleResult(change *Change) error {
27
28
},
28
29
)
29
30
30
- if change .Result .Error != nil {
31
+ // uninstall failed
32
+ if change .ActionName == statemanager .ActionUninstall && ! change .Result .Succeeded {
33
+ state .Status = statemanager .StatusInstalled
34
+ log .Printf ("=== plugin %s process failed ===" , change .Tool .Name )
35
+ // install or reinstall failed
36
+ } else if ! change .Result .Succeeded {
31
37
state .Status = statemanager .StatusFailed
32
38
log .Printf ("=== plugin %s process failed ===" , change .Tool .Name )
39
+ // install or reinstall succeeded
33
40
} else {
34
41
log .Printf ("=== plugin %s process done ===" , change .Tool .Name )
35
42
}
Original file line number Diff line number Diff line change @@ -13,9 +13,11 @@ type ComponentAction string
13
13
const (
14
14
// We should delete the state of the "uninstalled" tool at States.
15
15
StatusUninstalled ComponentStatus = "uninstalled"
16
+ // We use StatusInstalled when a plugin is installed but we don't know its status is "running" or "failed".
17
+ // For example: We try to uninstall a plugin but failed for some reason.
16
18
StatusInstalled ComponentStatus = "installed"
17
19
StatusRunning ComponentStatus = "running"
18
- StatusFailed ComponentStatus = "Failed "
20
+ StatusFailed ComponentStatus = "failed "
19
21
)
20
22
21
23
const (
You can’t perform that action at this time.
0 commit comments