xenadmin/XenAdmin/Diagnostics/Hotfixing/MultipleHotfix.cs
Mihaela Stoica 7a46698141 CP-16068: Pick up new RPU hotfixes
- XenCenter build system picks up the RPU hotfixes from Artifactory
- RPU001 and RPU002 replace XS62E006 and XS65ESP1006
- Removed hotfixes from the solution, moved  XS60E001 to Branding folder
- also cleaned up code in the HotfixFactory class, removing MNR and Cowley hotfixes (not supported anymore)

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
2016-02-11 22:18:06 +00:00

86 lines
3.2 KiB
C#

/* Copyright (c) Citrix Systems Inc.
* All rights reserved.
*
* 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.Collections.Generic;
using System.Linq;
using XenAPI;
namespace XenAdmin.Diagnostics.Hotfixing
{
internal class MultipleHotfix : Hotfix
{
public List<Hotfix> ComponentHotfixes { get; set; }
/// <summary>
/// Concatenated string of sorted UUIDs separated with a ";"
/// Use String.Contains() to look up if the individual UUID is present
/// </summary>
public override string UUID
{
get
{
List<string> uuids = ComponentHotfixes.Select(hotfix => hotfix.UUID).ToList();
return String.Join(";", uuids.ToArray());
}
set { throw new NotImplementedException("Multiple hotfix string does not implement a setter"); }
}
/// <summary>
/// Concatenated string of sorted file names separated with a ";"
/// Use String.Contains() to look up if the individual file name is present
/// </summary>
public override string Filename
{
get
{
List<string> filenames = ComponentHotfixes.Select(h => h.Filename).ToList();
return String.Join(";", filenames.ToArray());
}
set { throw new NotImplementedException("Multiple hotfix string does not implement a setter"); }
}
public sealed override void Apply(Host host, Session session)
{
foreach (Hotfix hotfix in ComponentHotfixes)
{
if(hotfix.ShouldBeAppliedTo(host))
hotfix.Apply(host, session);
}
}
public override bool ShouldBeAppliedTo(Host host)
{
return ComponentHotfixes.Any(hf => hf.ShouldBeAppliedTo(host));
}
}
}