mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CP-15790: Prepare XenCenter for unit testing of Automatic Updates
Added support for defining custom update.xml location in Registry. This can be either a local file or an URL. This will be beneficial when testing XenCenter. Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
parent
bd69aab6d2
commit
9ec512921b
@ -379,6 +379,11 @@ namespace XenAdmin.Core
|
||||
get { return ReadInstalledKey(ADDITIONAL_FEATURES); }
|
||||
}
|
||||
|
||||
public static string CustomUpdatesXmlLocation
|
||||
{
|
||||
get { return ReadKey(CUSTOM_UPDATES_XML_LOCATION); }
|
||||
}
|
||||
|
||||
private const string SSL_CERTIFICATES_CHANGED_ONLY = "CHANGED";
|
||||
private const string SSL_CERTIFICATES_ALL = "ALL";
|
||||
private const string SSL_CERTIFICATES_KEY = "ForceSSLCertificates";
|
||||
@ -402,6 +407,7 @@ namespace XenAdmin.Core
|
||||
private const string HEALTH_CHECK_PRODUCT_KEY = "HealthCheckProductKey";
|
||||
private const string HIDDEN_FEATURES = "HiddenFeatures";
|
||||
private const string ADDITIONAL_FEATURES = "AdditionalFeatures";
|
||||
private const string CUSTOM_UPDATES_XML_LOCATION = "CheckForUpdatesXmlLocationOverride";
|
||||
}
|
||||
|
||||
public enum SSLCertificateTypes { None, Changed, All }
|
||||
|
@ -197,7 +197,7 @@ namespace XenAdmin.Core
|
||||
Properties.Settings.Default.AllowXenCenterUpdates || force,
|
||||
Properties.Settings.Default.AllowXenServerUpdates || force,
|
||||
Properties.Settings.Default.AllowPatchesUpdates || force,
|
||||
Branding.CheckForUpdatesUrl);
|
||||
Updates.CheckForUpdatesUrl);
|
||||
{
|
||||
action.Completed += actionCompleted;
|
||||
}
|
||||
@ -208,7 +208,15 @@ namespace XenAdmin.Core
|
||||
action.RunAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static string CheckForUpdatesUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
return Registry.CustomUpdatesXmlLocation ?? Branding.CheckForUpdatesUrl;
|
||||
}
|
||||
}
|
||||
|
||||
private static void actionCompleted(ActionBase sender)
|
||||
{
|
||||
Program.AssertOffEventThread();
|
||||
|
@ -184,7 +184,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
}
|
||||
else //In Automatic Mode
|
||||
{
|
||||
var downloadUpdatesAction = new DownloadUpdatesXmlAction(false, true, true);
|
||||
var downloadUpdatesAction = new DownloadUpdatesXmlAction(false, true, true, Updates.CheckForUpdatesUrl);
|
||||
var dialog = new ActionProgressDialog(downloadUpdatesAction, ProgressBarStyle.Marquee);
|
||||
|
||||
dialog.ShowDialog(this.Parent); //Will block until dialog closes, action completed
|
||||
|
@ -83,10 +83,10 @@ namespace XenAdmin.Actions
|
||||
_checkForXenCenter = checkForXenCenter;
|
||||
_checkForServerVersion = checkForServerVersion;
|
||||
_checkForPatches = checkForPatches;
|
||||
_checkForUpdatesUrl = string.IsNullOrEmpty(checkForUpdatesUrl) ? InvisibleMessages.XENSERVER_UPDATE_URL : checkForUpdatesUrl;
|
||||
_checkForUpdatesUrl = checkForUpdatesUrl;
|
||||
}
|
||||
|
||||
public DownloadUpdatesXmlAction(bool checkForXenCenter, bool checkForServerVersion, bool checkForPatches)
|
||||
protected DownloadUpdatesXmlAction(bool checkForXenCenter, bool checkForServerVersion, bool checkForPatches)
|
||||
: this(checkForXenCenter, checkForServerVersion, checkForPatches, null)
|
||||
{ }
|
||||
|
||||
@ -288,10 +288,19 @@ namespace XenAdmin.Actions
|
||||
|
||||
protected virtual XmlDocument FetchCheckForUpdatesXml(string location)
|
||||
{
|
||||
XmlDocument xdoc;
|
||||
using (Stream xmlstream = HTTPHelper.GET(new Uri(location), Connection, false, true))
|
||||
var xdoc = new XmlDocument();
|
||||
var uri = new Uri(location);
|
||||
|
||||
if (uri.IsFile)
|
||||
{
|
||||
xdoc = Helpers.LoadXmlDocument(xmlstream);
|
||||
xdoc.Load(location);
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Stream xmlstream = HTTPHelper.GET(new Uri(location), Connection, false, true))
|
||||
{
|
||||
xdoc = Helpers.LoadXmlDocument(xmlstream);
|
||||
}
|
||||
}
|
||||
return xdoc;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user