Actions
Architecture #16603
closedClarify code of rollback events parsing
Status:
Released
Priority:
N/A
Assignee:
Category:
Architecture - Code maintenance
Target version:
Fix check:
Checked
Regression:
Description
Something is fishy in parsing of rollback events
def getRollbackDetails(xml:NodeSeq) : Box[RollbackInfo] = {
def getEvents(xml:NodeSeq)= {
for{
event <- xml
eventlogs <- event.child
entry <- eventlogs \ "rollbackedEvent"
id <- (entry \ "id").headOption.map(_.text.toInt) ?~! ("Entry type is not a 'rollback': %s".format(entry))
evtType <-(entry \ "type").headOption.map(_.text) ?~! ("Entry type is not a 'rollback': %s".format(entry))
author <-(entry \ "author").headOption.map(_.text) ?~! ("Entry type is not a 'rollback': %s".format(entry))
date <-(entry \ "date").headOption.map(_.text) ?~! ("Entry type is not a 'rollback': %s".format(entry))
} yield {
RollbackedEvent(id,date,evtType,author)
}
}
val rollbackInfo = for{
event <- xml
eventlogs <- event.child
entry <- (eventlogs \ "main").headOption
id <- (entry \ "id").headOption.map(_.text.toInt) ?~! ("Entry type is not a 'rollback': %s".format(entry))
evtType <- (entry \ "type").headOption.map(_.text) ?~! ("Entry type is not a 'rollback': %s".format(entry))
author <- (entry \ "author").headOption.map(_.text) ?~! ("Entry type is not a 'rollback': %s".format(entry))
date <- (entry \ "date").headOption.map(_.text) ?~! ("Entry type is not a 'rollback': %s".format(entry))
rollbackType <- (entry \ "rollbackType").headOption.map(_.text) ?~! ("Entry type is not a 'rollback': %s".format(entry))
} yield {
val target = RollbackedEvent(id,date,evtType,author)
RollbackInfo(target,rollbackType,getEvents(xml))
}
rollbackInfo.headOption
}
rollbackinfo is a Seq, that we take head, andwe implictly convert to box, it should directlybe a box
getEvents should be a Box[Seq[RollbackedEvents]]
moreover, identation is broken, and error message useless
Updated by Vincent MEMBRÉ almost 5 years ago
- Status changed from New to In progress
- Assignee set to Vincent MEMBRÉ
Updated by Vincent MEMBRÉ almost 5 years ago
- Status changed from In progress to Pending technical review
- Assignee changed from Vincent MEMBRÉ to François ARMAND
- Pull Request set to https://github.com/Normation/rudder/pull/2734
Updated by Vincent MEMBRÉ almost 5 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset rudder|35015785ca4b262bcd7cf42870439247b0c6f18d.
Updated by Vincent MEMBRÉ over 4 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 6.1.0~beta1 which was released today.
Updated by François ARMAND over 4 years ago
- Fix check changed from To do to Checked
Actions