diff --git a/XenModel/Actions/Updates/DownloadUnzipUpdateAction.cs b/XenModel/Actions/Updates/DownloadUnzipUpdateAction.cs
index a9842e422..2284f0af0 100644
--- a/XenModel/Actions/Updates/DownloadUnzipUpdateAction.cs
+++ b/XenModel/Actions/Updates/DownloadUnzipUpdateAction.cs
@@ -37,6 +37,7 @@
using System.Net.NetworkInformation;
using XenCenterLib.Archive;
using XenAdmin.Actions.Updates;
+using XenAdmin.Core;
namespace XenAdmin.Actions
{
@@ -214,22 +215,48 @@ protected override void Run()
Description = Messages.COMPLETED;
}
+ private static bool IsFileServiceUri(Uri uri)
+ {
+ var updateUriPrefix = new Uri(InvisibleMessages.UPDATE_URL_PREFIX);
+
+ if (uri.Host == updateUriPrefix.Host)
+ return true;
+
+ var customUpdateUriPrefix = XenAdminConfigManager.Provider.GetCustomFileServicePrefix();
+ if (!string.IsNullOrEmpty(customUpdateUriPrefix))
+ {
+ var customUpdateUri = new Uri(customUpdateUriPrefix);
+
+ if (uri.Host == customUpdateUri.Host)
+ return true;
+ }
+
+ return false;
+ }
+
private void DownloadFile(out string outputFileName)
{
outputFileName = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
- log.InfoFormat("Downloading update '{0}' (from '{1}') to '{2}'", UpdateName, _updateUri, outputFileName);
- Description = string.Format(Messages.DOWNLOAD_AND_EXTRACT_ACTION_DOWNLOADING_DESC, UpdateName);
- LogDescriptionChanges = false;
-
_client = new WebClient();
_client.DownloadProgressChanged += client_DownloadProgressChanged;
_client.DownloadFileCompleted += client_DownloadFileCompleted;
NetworkChange.NetworkAvailabilityChanged += NetworkAvailabilityChanged;
- var credential = TokenManager.GetDownloadCredential(XenAdminConfigManager.Provider);
- _client.Headers.Add("Authorization", $"Basic {credential}");
+ //useful when the updates use test locations
+ if (IsFileServiceUri(_updateUri))
+ {
+ log.InfoFormat("Authenticating account...");
+ Description = string.Format(Messages.DOWNLOAD_AND_EXTRACT_ACTION_AUTHENTICATING_DESC,
+ BrandManager.CompanyNameLegacy);
+ var credential = TokenManager.GetDownloadCredential(XenAdminConfigManager.Provider);
+ _client.Headers.Add("Authorization", $"Basic {credential}");
+ }
+
+ log.InfoFormat("Downloading update '{0}' (from '{1}') to '{2}'", UpdateName, _updateUri, outputFileName);
+ Description = string.Format(Messages.DOWNLOAD_AND_EXTRACT_ACTION_DOWNLOADING_DESC, UpdateName);
+ LogDescriptionChanges = false;
int errorCount = 0;
bool needToRetry = false;
diff --git a/XenModel/InvisibleMessages.Designer.cs b/XenModel/InvisibleMessages.Designer.cs
index aa03e6543..933498708 100644
--- a/XenModel/InvisibleMessages.Designer.cs
+++ b/XenModel/InvisibleMessages.Designer.cs
@@ -204,6 +204,15 @@ public static string TOKEN_API_URL {
}
}
+ ///
+ /// Looks up a localized string similar to https://fileservice.citrix.com/direct/v2/download/.
+ ///
+ public static string UPDATE_URL_PREFIX {
+ get {
+ return ResourceManager.GetString("UPDATE_URL_PREFIX", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to https://www.citrix.com/products/citrix-hypervisor/get-started.html.
///
diff --git a/XenModel/InvisibleMessages.resx b/XenModel/InvisibleMessages.resx
index 66f96cbd0..48a30cb47 100644
--- a/XenModel/InvisibleMessages.resx
+++ b/XenModel/InvisibleMessages.resx
@@ -165,6 +165,9 @@
https://fileservice.citrix.com/api/session/token
+
+ https://fileservice.citrix.com/direct/v2/download/
+
https://www.citrix.com/products/citrix-hypervisor/get-started.html