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:
Gabor Apati-Nagy 2016-10-19 11:29:57 +01:00
parent 9398837c38
commit 8ac6774e80
4 changed files with 17 additions and 17 deletions

View File

@ -341,7 +341,7 @@ namespace XenAdmin.Wizards.PatchingWizard
private string UpdateExtension private string UpdateExtension
{ {
get { return "." + Branding.Update; } get { return SelectedUpdateType != UpdateType.ISO ? "." + Branding.Update : ".iso"; }
} }
private bool isValidFile(string fileName) private bool isValidFile(string fileName)

View File

@ -105,7 +105,7 @@ namespace XenAdmin.Wizards.PatchingWizard
Uri address = new Uri(patchUri); Uri address = new Uri(patchUri);
string tempFile = Path.GetTempFileName(); 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); downloadAction = new DownloadAndUnzipXenServerPatchAction(SelectedUpdateAlert.Name, address, tempFile, isIso ? "iso" : Branding.Update);

View File

@ -91,7 +91,7 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
bool isIso = patchUri.ToLowerInvariant().EndsWith("iso"); 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) if (downloadAction != null)
{ {

View File

@ -59,7 +59,7 @@ namespace XenAdmin.Actions
} }
public DownloadAndUnzipXenServerPatchAction(string patchName, Uri uri, string outputFileName) 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) public DownloadAndUnzipXenServerPatchAction(string patchName, Uri uri, string outputFileName, string updateFileExtension)
@ -123,14 +123,22 @@ namespace XenAdmin.Actions
while (iterator.HasNext()) 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()); 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)) using (Stream outputStream = new FileStream(path, FileMode.Create))
{ {
iterator.ExtractCurrentFile(outputStream); iterator.ExtractCurrentFile(outputStream);
PatchPath = path; PatchPath = path;
log.DebugFormat("Update file extracted to '{0}'", path);
break; break;
} }
} }
@ -177,18 +185,10 @@ namespace XenAdmin.Actions
if (Cancelling) if (Cancelling)
throw new CancelledException(); 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);
log.DebugFormat("Extracting XenServer patch '{0}'", updateName); ExtractFile();
Description = string.Format(Messages.DOWNLOAD_AND_EXTRACT_ACTION_EXTRACTING_DESC, updateName); log.DebugFormat("Extracting XenServer patch '{0}' completed", 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;
}
Description = Messages.COMPLETED; Description = Messages.COMPLETED;
MarkCompleted(); MarkCompleted();