Skip to content

Commit

Permalink
Do not allow escalations to be set for recovery alerts. [HHQ-3188]
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Morgan committed Jun 12, 2009
1 parent c00ce09 commit eca576e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion hqu/hqapi1/app/AlertdefinitionController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ public class AlertdefinitionController extends ApiController {
templs = resource.metrics
}

def isRecovery = false

for (xmlCond in xmlDef['AlertCondition']) {
AlertConditionValue acv = new AlertConditionValue()
def acError
Expand Down Expand Up @@ -610,6 +612,8 @@ public class AlertdefinitionController extends ApiController {
break
}

isRecovery = true

// If a resource alert, look up alert by name
if (resource) {
log.debug("Looking up alerts for resource=" + resource.id)
Expand Down Expand Up @@ -723,7 +727,13 @@ public class AlertdefinitionController extends ApiController {

// Deal with Escalations
if (escalation) {
pojo.setEscalation(user, escalation)
// TODO: Backend should handle escalations on recovery alerts
if (isRecovery) {
log.warn("Skipping escalation for definition '" + pojo.name +
"'. Escalations not allowed for recovery alerts.")
} else {
pojo.setEscalation(user, escalation)
}
} else {
pojo.unsetEscalation(user)
}
Expand Down

0 comments on commit eca576e

Please sign in to comment.