Skip to content

Commit

Permalink
fix: print result's message when status unknown
Browse files Browse the repository at this point in the history
Signed-off-by: zhangyue <huaihuan.zy@alibaba-inc.com>
  • Loading branch information
ZYecho committed Nov 18, 2020
1 parent 8a41d4a commit b51cb32
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/custompluginmonitor/custom_plugin_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,10 @@ func (c *customPluginMonitor) generateStatus(result cpmtypes.Result) *types.Stat
if condition.Status == types.True && status != types.True {
// Scenario 1: Condition status changes from True to False/Unknown
newReason = defaultConditionReason
if newMessage == "" {
if status == types.False {
newMessage = defaultConditionMessage
} else {
// When status unknown, the result's message is important for debug
newMessage = result.Message
}
} else if condition.Status != types.True && status == types.True {
Expand All @@ -200,9 +201,10 @@ func (c *customPluginMonitor) generateStatus(result cpmtypes.Result) *types.Stat
} else if condition.Status != status {
// Scenario 3: Condition status changes from False to Unknown or vice versa
newReason = defaultConditionReason
if newMessage == "" {
if status == types.False {
newMessage = defaultConditionMessage
} else {
// When status unknown, the result's message is important for debug
newMessage = result.Message
}
} else if condition.Status == types.True && status == types.True &&
Expand Down

0 comments on commit b51cb32

Please sign in to comment.