Alon Bar-Lev has uploaded a new change for review. Change subject: bootstrap: allow distinguish error from non error messages ......................................................................
bootstrap: allow distinguish error from non error messages The old bootstrap xml like protocol will remain for a while until the note upgrade script rewritten. Till then we need to know if there was an error message to fail the command without relaying on constants within messages as VdsInstaller had done so far. Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=875528 Change-Id: I62de9fab0ae3c10d245ed6c2580bf8fcc09057d6 Signed-off-by: Alon Bar-Lev <alo...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java 1 file changed, 13 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/61/9161/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java index ed27468..388588a 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java @@ -17,22 +17,23 @@ _vdsId = vdsId; } - public void AddMessage(String message) { + public boolean AddMessage(String message) { + boolean error = false; if (StringUtils.isEmpty(message)) { - return; + return error; } String[] msgs = message.split("[\\n]", -1); if (msgs.length > 1) { for (String msg : msgs) { - AddMessage(msg); + error = AddMessage(msg) || error; } - return; + return error; } if (StringUtils.isNotEmpty(message)) { if (message.charAt(0) == '<') { try { - parseMessage(message); + error = parseMessage(message); } catch (RuntimeException e) { log.errorFormat( "Installation of Host. Received illegal XML from Host. Message: {1}, Exception: {2}", @@ -42,9 +43,11 @@ log.info("VDS message: " + message); } } + return error; } - private void parseMessage(String message) { + private boolean parseMessage(String message) { + boolean error = false; XmlDocument doc = new XmlDocument(); doc.LoadXml(message); XmlNode node = doc.ChildNodes[0]; @@ -59,6 +62,7 @@ } else if (node.Attributes.get("status").getValue().equals("WARN")) { logType = AuditLogType.VDS_INSTALL_IN_PROGRESS_WARNING; } else { + error = true; logType = AuditLogType.VDS_INSTALL_IN_PROGRESS_ERROR; } @@ -81,7 +85,10 @@ AuditLogableBase logable = new AuditLogableBase(_vdsId); logable.AddCustomValue("Message", StringUtils.stripEnd(sb.toString(), " ")); AuditLogDirector.log(logable, logType); + return error; } + + return error; } private static Log log = LogFactory.getLog(InstallerMessages.class); -- To view, visit http://gerrit.ovirt.org/9161 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I62de9fab0ae3c10d245ed6c2580bf8fcc09057d6 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches