mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 06:16:37 +01:00
CA-225731: XenCenter: Find the ISO update in the zip file defined in CFU
Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
parent
9398837c38
commit
8ac6774e80
@ -341,7 +341,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
|
||||
private string UpdateExtension
|
||||
{
|
||||
get { return "." + Branding.Update; }
|
||||
get { return SelectedUpdateType != UpdateType.ISO ? "." + Branding.Update : ".iso"; }
|
||||
}
|
||||
|
||||
private bool isValidFile(string fileName)
|
||||
|
@ -105,7 +105,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
Uri address = new Uri(patchUri);
|
||||
string tempFile = Path.GetTempFileName();
|
||||
|
||||
bool isIso = patchUri.ToLowerInvariant().EndsWith("iso");
|
||||
bool isIso = SelectedUpdateType == UpdateType.ISO;
|
||||
|
||||
downloadAction = new DownloadAndUnzipXenServerPatchAction(SelectedUpdateAlert.Name, address, tempFile, isIso ? "iso" : Branding.Update);
|
||||
|
||||
|
@ -91,7 +91,7 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
|
||||
|
||||
bool isIso = patchUri.ToLowerInvariant().EndsWith("iso");
|
||||
|
||||
var downloadAction = new DownloadAndUnzipXenServerPatchAction(patch.Name, address, tempFileName, isIso ? "iso" : Branding.Update);
|
||||
var downloadAction = new DownloadAndUnzipXenServerPatchAction(patch.Name, address, tempFileName);
|
||||
|
||||
if (downloadAction != null)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ namespace XenAdmin.Actions
|
||||
}
|
||||
|
||||
public DownloadAndUnzipXenServerPatchAction(string patchName, Uri uri, string outputFileName)
|
||||
: this(patchName, uri, outputFileName, InvisibleMessages.XEN_UPDATE)
|
||||
: this(patchName, uri, outputFileName, null)
|
||||
{ }
|
||||
|
||||
public DownloadAndUnzipXenServerPatchAction(string patchName, Uri uri, string outputFileName, string updateFileExtension)
|
||||
@ -123,14 +123,22 @@ namespace XenAdmin.Actions
|
||||
|
||||
while (iterator.HasNext())
|
||||
{
|
||||
if (Path.GetExtension(iterator.CurrentFileName()) == "." + updateFileExtension)
|
||||
string currentExtension = Path.GetExtension(iterator.CurrentFileName());
|
||||
|
||||
if (!string.IsNullOrEmpty(updateFileExtension) && currentExtension == "." + updateFileExtension
|
||||
|| currentExtension == ".iso" || currentExtension == ".xsupdate")
|
||||
{
|
||||
string path = Path.Combine(Path.GetDirectoryName(outFileName), iterator.CurrentFileName());
|
||||
|
||||
log.DebugFormat("Found '{0}' in the downloaded archive when looking for a '{1}' file. Extracting...", iterator.CurrentFileName(), currentExtension);
|
||||
|
||||
using (Stream outputStream = new FileStream(path, FileMode.Create))
|
||||
{
|
||||
iterator.ExtractCurrentFile(outputStream);
|
||||
PatchPath = path;
|
||||
|
||||
log.DebugFormat("Update file extracted to '{0}'", path);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -177,18 +185,10 @@ namespace XenAdmin.Actions
|
||||
if (Cancelling)
|
||||
throw new CancelledException();
|
||||
|
||||
if (updateFileExtension.ToLowerInvariant() != "iso")
|
||||
{
|
||||
log.DebugFormat("Extracting XenServer patch '{0}'", updateName);
|
||||
Description = string.Format(Messages.DOWNLOAD_AND_EXTRACT_ACTION_EXTRACTING_DESC, updateName);
|
||||
ExtractFile();
|
||||
log.DebugFormat("Extracting XenServer patch '{0}' completed", updateName);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.DebugFormat("ISO file downloaded ('{0}'), skipping unzip. Setting PatchPath to '{1}'", updateName, outFileName);
|
||||
PatchPath = outFileName;
|
||||
}
|
||||
log.DebugFormat("Extracting XenServer patch '{0}'", updateName);
|
||||
Description = string.Format(Messages.DOWNLOAD_AND_EXTRACT_ACTION_EXTRACTING_DESC, updateName);
|
||||
ExtractFile();
|
||||
log.DebugFormat("Extracting XenServer patch '{0}' completed", updateName);
|
||||
|
||||
Description = Messages.COMPLETED;
|
||||
MarkCompleted();
|
||||
|
Loading…
Reference in New Issue
Block a user