mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 15:29:26 +01:00
CA-352455: Parse the task result as xml document instead of using a regex.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
96956dbc81
commit
47d9146ce3
@ -34,6 +34,7 @@ using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Network;
|
||||
using XenAPI;
|
||||
@ -366,9 +367,15 @@ namespace XenAdmin.Actions
|
||||
log.InfoFormat("Task {0} finished successfully", RelatedTask.opaque_ref);
|
||||
if (task.result != "") // Work around CA-6597
|
||||
{
|
||||
Match m = Regex.Match(task.result, "<value>(.*)</value>");
|
||||
if (m.Success)
|
||||
Result = m.Groups[1].Value;
|
||||
var doc = new XmlDocument();
|
||||
doc.LoadXml(task.result);
|
||||
var nodes = doc.GetElementsByTagName("value");
|
||||
|
||||
foreach (XmlNode node in nodes)
|
||||
{
|
||||
Result = node.InnerText;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
|
@ -538,16 +538,6 @@ namespace XenAPI
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(xml);
|
||||
|
||||
// If we've got this from an async task result, then it will be wrapped
|
||||
// in a <value> element. Parse the contents instead.
|
||||
foreach (XmlNode node in doc.GetElementsByTagName("value"))
|
||||
{
|
||||
xml = node.InnerText;
|
||||
doc = new XmlDocument();
|
||||
doc.LoadXml(xml);
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (XmlNode node in doc.GetElementsByTagName("SR"))
|
||||
{
|
||||
string uuid = "";
|
||||
|
Loading…
Reference in New Issue
Block a user