mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-27 02:56:01 +01:00
CA-196315: XS65ESP1018 not showing up in XenCenter Updates (on staging)
Fixed code to treat uuids of patches case-insensitive when consuming, but not changing them (eg. to lowercase) to keep compatibility with older XAPIs. Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
parent
6e66144ad9
commit
b8e447afa3
@ -34,6 +34,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using XenAdmin.Network;
|
||||
using XenAdmin.Core;
|
||||
using System.Linq;
|
||||
|
||||
namespace XenAdmin.Actions
|
||||
{
|
||||
@ -61,7 +62,7 @@ namespace XenAdmin.Actions
|
||||
if (other_config.ContainsKey(IgnorePatchKey))
|
||||
{
|
||||
List<string> current = new List<string>(other_config[IgnorePatchKey].Split(','));
|
||||
if (current.Contains(Patch.Uuid))
|
||||
if (current.Contains(Patch.Uuid, StringComparer.OrdinalIgnoreCase))
|
||||
return;
|
||||
current.Add(Patch.Uuid);
|
||||
other_config[IgnorePatchKey] = string.Join(",", current.ToArray());
|
||||
|
@ -171,7 +171,7 @@ namespace XenAdmin.Alerts
|
||||
if (other_config.ContainsKey(IgnorePatchAction.IgnorePatchKey))
|
||||
{
|
||||
List<string> current = new List<string>(other_config[IgnorePatchAction.IgnorePatchKey].Split(','));
|
||||
if (current.Contains(Patch.Uuid))
|
||||
if (current.Contains(Patch.Uuid, StringComparer.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -181,7 +181,7 @@ namespace XenAdmin.Alerts
|
||||
{
|
||||
if (other is XenServerPatchAlert)
|
||||
{
|
||||
return Patch.Uuid == ((XenServerPatchAlert)other).Patch.Uuid;
|
||||
return string.Equals(Patch.Uuid, ((XenServerPatchAlert)other).Patch.Uuid, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
return base.Equals(other);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ namespace XenAdmin.Core
|
||||
if (other_config.ContainsKey(IgnorePatchAction.IgnorePatchKey))
|
||||
{
|
||||
List<string> current = new List<string>(other_config[IgnorePatchAction.IgnorePatchKey].Split(','));
|
||||
if (current.Contains(((XenServerPatchAlert)alert).Patch.Uuid))
|
||||
if (current.Contains(((XenServerPatchAlert)alert).Patch.Uuid, StringComparer.OrdinalIgnoreCase))
|
||||
continue;
|
||||
current.Add(((XenServerPatchAlert)alert).Patch.Uuid);
|
||||
other_config[IgnorePatchAction.IgnorePatchKey] = string.Join(",", current.ToArray());
|
||||
@ -378,17 +378,17 @@ namespace XenAdmin.Core
|
||||
{
|
||||
var appliedPatches = host.AppliedPatches();
|
||||
// 1. patch is not already installed
|
||||
if (appliedPatches.Any(patch => patch.uuid == serverPatch.Uuid))
|
||||
if (appliedPatches.Any(patch => string.Equals(patch.uuid, serverPatch.Uuid, StringComparison.OrdinalIgnoreCase)))
|
||||
return false;
|
||||
|
||||
// 2. the host has all the required patches installed
|
||||
if (serverPatch.RequiredPatches != null && serverPatch.RequiredPatches.Count > 0 &&
|
||||
!serverPatch.RequiredPatches.All(requiredPatchUuid => appliedPatches.Any(patch => patch.uuid == requiredPatchUuid)))
|
||||
!serverPatch.RequiredPatches.All(requiredPatchUuid => appliedPatches.Any(patch => string.Equals(patch.uuid, requiredPatchUuid, StringComparison.OrdinalIgnoreCase))))
|
||||
return false;
|
||||
|
||||
// 3. the host doesn't have any of the conflicting patches installed
|
||||
if (serverPatch.ConflictingPatches != null && serverPatch.ConflictingPatches.Count > 0 &&
|
||||
serverPatch.ConflictingPatches.Any(conflictingPatchUuid => appliedPatches.Any(patch => patch.uuid == conflictingPatchUuid)))
|
||||
serverPatch.ConflictingPatches.Any(conflictingPatchUuid => appliedPatches.Any(patch => string.Equals(patch.uuid, conflictingPatchUuid, StringComparison.OrdinalIgnoreCase))))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -29,6 +29,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@ -69,7 +70,7 @@ namespace XenAdmin.Diagnostics.Hotfixing
|
||||
{
|
||||
var patches = host.Connection.ResolveAll(host.patches);
|
||||
var poolPatches = patches.Select(hostPatch => hostPatch.Connection.Resolve(hostPatch.pool_patch));
|
||||
return !poolPatches.Any( patch => UUID.Contains(patch.uuid));
|
||||
return !poolPatches.Any( patch => UUID.ToLowerInvariant().Contains(patch.uuid.ToLowerInvariant()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
{
|
||||
List<Pool_patch> patchesToRemove =
|
||||
PatchingWizard_UploadPage.NewUploadedPatches.Keys.ToList().Where(
|
||||
patch => patch.uuid != PatchingWizard_UploadPage.Patch.uuid).ToList();
|
||||
patch => !string.Equals(patch.uuid, PatchingWizard_UploadPage.Patch.uuid, System.StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
|
||||
RemoveUnwantedPatches(patchesToRemove);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
poolPatch = poolPatches.Find(delegate(Pool_patch otherPatch)
|
||||
{
|
||||
if (Patch != null)
|
||||
return otherPatch.uuid == Patch.uuid;
|
||||
return string.Equals(otherPatch.uuid, Patch.uuid, StringComparison.OrdinalIgnoreCase);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
foreach (Host host in SelectedServers)
|
||||
{
|
||||
List<Pool_patch> poolPatches = new List<Pool_patch>(host.Connection.Cache.Pool_patches);
|
||||
Pool_patch poolPatchFromHost = poolPatches.Find(otherPatch => otherPatch.uuid == patch.uuid);
|
||||
Pool_patch poolPatchFromHost = poolPatches.Find(otherPatch => string.Equals(otherPatch.uuid, patch.uuid, StringComparison.OrdinalIgnoreCase));
|
||||
checkGroup.Add(new PatchPrecheckCheck(host, poolPatchFromHost));
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
List<Pool_patch> hostPatches = host.AppliedPatches();
|
||||
foreach (Pool_patch patch in hostPatches)
|
||||
{
|
||||
if (patch.uuid.Equals(uuid))
|
||||
if (string.Equals(patch.uuid, uuid, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
{
|
||||
var poolPatches = new List<Pool_patch>(poolMaster.Connection.Cache.Pool_patches);
|
||||
|
||||
return (poolPatches.Exists(p => p.uuid == patch.uuid));
|
||||
return (poolPatches.Exists(p => string.Equals(p.uuid, patch.uuid, StringComparison.OrdinalIgnoreCase)));
|
||||
}
|
||||
|
||||
private void PrepareUploadActions()
|
||||
|
@ -244,7 +244,7 @@ namespace XenAdmin.Actions
|
||||
{
|
||||
if (childnode.Name != "patch")
|
||||
continue;
|
||||
XenServerPatch patch = XenServerPatches.Find(item => item.Uuid == childnode.Attributes["uuid"].Value);
|
||||
XenServerPatch patch = XenServerPatches.Find(item => string.Equals(item.Uuid, childnode.Attributes["uuid"].Value, StringComparison.OrdinalIgnoreCase));
|
||||
if (patch == null)
|
||||
continue;
|
||||
patches.Add(patch);
|
||||
|
@ -55,7 +55,7 @@ namespace XenAdmin.Core
|
||||
public XenServerPatch(string uuid, string name, string description, string guidance, string version, string url,
|
||||
string patchUrl, string timestamp, string priority, string installationSize)
|
||||
{
|
||||
_uuid = uuid.ToLowerInvariant();
|
||||
_uuid = uuid;
|
||||
Name = name;
|
||||
Description = description;
|
||||
Guidance = guidance;
|
||||
@ -86,7 +86,7 @@ namespace XenAdmin.Core
|
||||
|
||||
public bool Equals(XenServerPatch other)
|
||||
{
|
||||
return Uuid == other.Uuid;
|
||||
return string.Equals(Uuid, other.Uuid, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
@ -419,7 +419,7 @@ namespace XenAdmin.Network
|
||||
{
|
||||
foreach (T m in d.Values)
|
||||
{
|
||||
if (((string)p.GetValue(m, null)) == uuid)
|
||||
if (string.Equals((string)p.GetValue(m, null), uuid, StringComparison.OrdinalIgnoreCase))
|
||||
return m;
|
||||
}
|
||||
}
|
||||
@ -443,7 +443,7 @@ namespace XenAdmin.Network
|
||||
{
|
||||
foreach (KeyValuePair<XenRef<T>, T> kvp in d)
|
||||
{
|
||||
if (((string)p.GetValue(kvp.Value, null)) == uuid)
|
||||
if (string.Equals((string)p.GetValue(kvp.Value, null), uuid, StringComparison.OrdinalIgnoreCase))
|
||||
return kvp.Key;
|
||||
}
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ namespace XenAPI
|
||||
foreach (Pool_patch patch in patches)
|
||||
{
|
||||
Pool_patch patch1 = patch;
|
||||
if (!appliedPatches.Exists(otherPatch => patch1.uuid == otherPatch.uuid))
|
||||
if (!appliedPatches.Exists(otherPatch => string.Equals(patch1.uuid, otherPatch.uuid, StringComparison.OrdinalIgnoreCase)))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ namespace XenAPI
|
||||
{
|
||||
Pool_patch patch = host.Connection.Resolve(hostPatch.pool_patch);
|
||||
|
||||
if (patch != null && patch.uuid == uuid)
|
||||
if (patch != null && string.Equals(patch.uuid, uuid, StringComparison.OrdinalIgnoreCase))
|
||||
return hostPatch.timestamp_applied;
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ namespace XenAPI
|
||||
{
|
||||
foreach (Pool_patch p in patches)
|
||||
{
|
||||
if (p.uuid == patch.uuid)
|
||||
if (string.Equals(p.uuid, patch.uuid, StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ namespace XenAPI
|
||||
{
|
||||
foreach (Pool_patch patch in connection.Cache.Pool_patches)
|
||||
{
|
||||
if (patch.uuid == uuid)
|
||||
if (string.Equals(patch.uuid, uuid, StringComparison.OrdinalIgnoreCase))
|
||||
patches.Add(patch);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user