xenadmin/XenModel/Actions/ZipStatusReportAction.cs

242 lines
9.8 KiB
C#
Raw Normal View History

/* Copyright (c) Cloud Software Group, Inc.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
using System;
using System.IO;
using XenCenterLib.Archive;
namespace XenAdmin.Actions
{
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
public class ZipStatusReportAction : StatusReportAction
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// The folder containing the raw files as downloaded from the server
/// </summary>
private readonly string _inputTempFolder;
/// <summary>
/// Temporary folder in which we assemble the log files from the server
/// before repackaging them in a single zip file.
/// </summary>
private string _extractTempDir;
/// <summary>
/// The destination zip file for the repackaged server log files
/// </summary>
private readonly string _destFile;
/// <summary>
/// Creates a new instance of the action for zipping downloaded server log files
/// </summary>
/// <param name="tempFolder">Temporary folder to store the downloaded logs</param>
/// <param name="destFile">The target file to store the compressed result</param>
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
/// <param name="timeString">Time string used when running action as <see cref="StatusReportAction"/>. Can be omitted otherwise.</param>
/// <param name="suppressHistory">Whether to suppress history in the Events TabPage</param>
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
public ZipStatusReportAction(string tempFolder, string destFile, string timeString = null, bool suppressHistory = true)
: base(null, Messages.BUGTOOL_SAVING, destFile, timeString, suppressHistory)
{
_inputTempFolder = tempFolder;
_destFile = destFile;
}
protected override void Run()
{
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
Status = ReportStatus.inProgress;
do
{
_extractTempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
} while (Directory.Exists(_extractTempDir));
Directory.CreateDirectory(_extractTempDir);
try
{
// Calculate total bytes to save
long bytesToCompress = 0, bytesToExtract = 0, bytesExtracted = 0;
var files = Directory.GetFiles(_inputTempFolder);
foreach (string inputFile in files)
bytesToExtract += new FileInfo(inputFile).Length;
foreach (string inputFile in files)
{
if (inputFile.ToLowerInvariant().EndsWith(".tar"))
{
// Sanitize and un-tar each of the raw server tars to the temp extraction directory
string outFilename = inputFile.Substring(0, inputFile.Length - 4);
if (outFilename.Length == 0)
outFilename = Path.GetRandomFileName();
string outputDir = Path.Combine(_extractTempDir, Path.GetFileName(outFilename));
string sanitizedTar = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
TarSanitization.SanitizeTarForWindows(inputFile, sanitizedTar, CheckCancellation);
using (FileStream fs = File.OpenRead(sanitizedTar))
using (ArchiveIterator tarIterator = ArchiveFactory.Reader(ArchiveFactory.Type.Tar, fs))
{
Directory.CreateDirectory(outputDir);
tarIterator.ExtractAllContents(outputDir);
bytesToCompress += Core.Helpers.GetDirSize(new DirectoryInfo(outputDir));
}
try
{
File.Delete(sanitizedTar);
}
catch
{
// ignored
}
}
else
{
// Just copy vanilla input files unmodified to the temp directory
string outputFile = Path.Combine(_extractTempDir, Path.GetFileName(inputFile));
File.Copy(inputFile, outputFile);
bytesToCompress += new FileInfo(outputFile).Length;
}
bytesExtracted += new FileInfo(inputFile).Length;
File.Delete(inputFile);
PercentComplete = (int)(50.0 * bytesExtracted / bytesToExtract);
CheckCancellation();
}
// Now zip up all the temporarily extracted files into a single zip file for the user
log.DebugFormat("Packing {0} of bug report files into zip file {1}",
Util.DiskSizeString(bytesToCompress), _destFile);
ZipToOutputFile(_extractTempDir, CheckCancellation, p => PercentComplete = 50 + p / 2);
CleanupFiles();
PercentComplete = 100;
}
catch (CancelledException)
{
CleanupFiles(true);
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
log.Info("Packaging system status cancelled");
Tick(100, Messages.ACTION_SAVE_STATUS_REPORT_CANCELLED);
Status = ReportStatus.cancelled;
throw;
}
catch (Exception exn)
{
try
{
log.Error("Failed to package sanitized server status report: ", exn);
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
log.Info("Attempting to package raw downloaded server files.");
ZipToOutputFile(_inputTempFolder, CheckCancellation);
}
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
catch (CancelledException)
{
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
log.Info("Packaging raw downloaded server cancelled");
Tick(100, Messages.ACTION_SAVE_STATUS_REPORT_CANCELLED);
Status = ReportStatus.cancelled;
CleanupFiles(true);
throw;
}
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
catch (Exception exception)
{
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
log.Error("Failed to package raw downloaded server files.", exception);
}
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
Tick(100, Messages.ACTION_SAVE_STATUS_REPORT_FAILED);
Status = ReportStatus.failed;
throw new Exception(Messages.ACTION_SAVE_STATUS_REPORT_FAILED_PARTIAL);
}
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
Tick(100, Messages.COMPLETED);
Status = ReportStatus.succeeded;
}
private void CheckCancellation()
{
if (Cancelling)
throw new CancelledException();
}
private void ZipToOutputFile(string folderToZip, Action cancellingDelegate = null, Action<int> progressDelegate = null)
{
using (ArchiveWriter zip = ArchiveFactory.Writer(ArchiveFactory.Type.Zip, File.OpenWrite(_destFile)))
zip.CreateArchive(folderToZip, cancellingDelegate, progressDelegate);
}
private void CleanupFiles(bool deleteDestFile = false)
{
try
{
log.Debug("Deleting temporary directory with raw downloaded server files");
Directory.Delete(_inputTempFolder, true);
}
catch (Exception exn)
{
log.Warn("Could not delete temporary directory with raw downloaded server files", exn);
}
try
{
log.Debug("Deleting directory with temporarily extracted files");
Directory.Delete(_extractTempDir, true);
}
catch (Exception exn)
{
log.Warn("Could not delete directory with temporarily extracted files", exn);
}
try
{
if (deleteDestFile)
{
log.Debug("Deleting destination zip file");
File.Delete(_destFile);
}
}
catch (Exception ex)
{
log.Warn("Could not delete destination zip file", ex);
}
}
public override void RecomputeCanCancel()
{
CanCancel = !Cancelling && !IsCompleted;
}
protected override void CancelRelatedTask()
{
}
CP-40842: Remove CIS upload from Server Status Report wizard (#3087) * Remove credentials controls from `BugToolPageDestination` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Explicitly call dispose in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Tidy up code in `BugToolPageDestination.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `StatusReportRow` to its own file Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Move `ClientSideDataRow` and `HostStatusRow` to own files Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update order of pages in `BugToolWizard` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update action and create row for packaging status report in BugTool wizard Instead of creating a new action, this males ZipStatusReportAction inherit StatusReportAction Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Allow for pending `StatusReportAction` to be cancelled This avoids the need for a running action to update the status. i.e. an action that has been registered but hasn't started running can be cancelled, too. Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Update content of `ACTION_SYSTEM_STATUS_SUCCESSFUL` message Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add link to `labelBlurb` in `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Add report packaging logic to `BugToolPageRetrieveData.cs` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Open CIS URL when clicking on `linkLabelBlurb` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * CP-40842: Report packaged data amount in `ZipStatusReportAction` Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Remove unused `using`s Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> * Minor layout tweaks. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed folder and namespace to match the ones for the other wizards. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed wizard's private fields. Some code efficiency corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Keep the row classes as private within the BugToolPageRetrieveData class. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Removed leftover unused action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Tidy up status report messages. Use more relevant icon. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Made blurb localisable. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed private fields. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplified the stages of the compilation of the status report. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Renamed row classes again to match the action names. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Simplify reporting the progress of the zipping action. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> * Recursive call is not necessary. Tweaked message. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Sort strings Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> * Update copyright notices Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> --------- Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
2023-02-13 14:47:21 +01:00
}
}