/// <summary> /// Checks the server has been restarted after any patches that require a restart were applied and returns a list of reboot warnings /// </summary> /// <param name="host"></param> /// <returns></returns> private List<KeyValuePair<String, String>> CheckServerUpdates(Host host) { List<Pool_patch> patches = host.AppliedPatches(); List<KeyValuePair<String, String>> warnings = new List<KeyValuePair<String, String>>(); double bootTime = host.BootTime; double agentStart = host.AgentStartTime; if (bootTime == 0.0 || agentStart == 0.0) return warnings; foreach (Pool_patch patch in patches) { double applyTime = Util.ToUnixTime(patch.AppliedOn(host)); if (patch.after_apply_guidance.Contains(after_apply_guidance.restartHost) && applyTime > bootTime) { //TODO: Could we come up with a better key string than foopatch on blahhost? Also needs i18 warnings.Add(new KeyValuePair<String, String>( String.Format("{0} on {1}", patch.Name, host.Name), String.Format(Messages.GENERAL_PANEL_UPDATE_WARNING, host.Name, patch.Name))); } else if (patch.after_apply_guidance.Contains(after_apply_guidance.restartXAPI) && applyTime > agentStart) { // Actually, it only needs xapi restart, but we have no UI to do that. warnings.Add(new KeyValuePair<String, String>( String.Format("{0} on {1}", patch.Name, host.Name), String.Format(Messages.GENERAL_PANEL_UPDATE_WARNING, host.Name, patch.Name))); } } return warnings; }
private bool isPatchApplied(string uuid, Host host) { if (Helpers.ElyOrGreater(host)) { return host.AppliedUpdates().Any(u => u != null && string.Equals(u.uuid, uuid, StringComparison.InvariantCultureIgnoreCase)); } else { List<Pool_patch> hostPatches = host.AppliedPatches(); foreach (Pool_patch patch in hostPatches) { if (string.Equals(patch.uuid, uuid, StringComparison.OrdinalIgnoreCase)) { return true; } } } return false; }
private string hostAppliedPatches(Host host) { List<string> result = new List<string>(); foreach (Pool_patch patch in host.AppliedPatches()) result.Add(patch.Name); result.Sort(StringUtility.NaturalCompare); return string.Join("\n", result.ToArray()); }
private bool isPatchApplied(string uuid, Host host) { List<Pool_patch> hostPatches = host.AppliedPatches(); foreach (Pool_patch patch in hostPatches) { if (patch.uuid.Equals(uuid)) { return true; } } return false; }
/// <summary> /// Checks the server has been restarted after any patches that require a restart were applied and returns a list of reboot warnings /// </summary> /// <param name="host"></param> /// <returns></returns> private List<KeyValuePair<String, String>> CheckServerUpdates(Host host) { List<Pool_patch> patches = host.AppliedPatches(); List<KeyValuePair<String, String>> warnings = new List<KeyValuePair<String, String>>(); double bootTime = host.BootTime; double agentStart = host.AgentStartTime; if (bootTime == 0.0 || agentStart == 0.0) return warnings; foreach (Pool_patch patch in patches) { double applyTime = Util.ToUnixTime(patch.AppliedOn(host)); if (patch.after_apply_guidance.Contains(after_apply_guidance.restartHost) && applyTime > bootTime || patch.after_apply_guidance.Contains(after_apply_guidance.restartXAPI) && applyTime > agentStart) { warnings.Add(CreateWarningRow(host, patch)); } } return warnings; }
/// <summary> /// Creates a list of warnings for updates that require the host to be rebooted /// </summary> /// <param name="host"></param> /// <returns></returns> private List<KeyValuePair<String, String>> CheckHostUpdatesRequiringReboot(Host host) { var warnings = new List<KeyValuePair<String, String>>(); // Updates that require host restart var updateRefs = host.updates_requiring_reboot; foreach (var updateRef in updateRefs) { var update = host.Connection.Resolve(updateRef); warnings.Add(CreateWarningRow(host, update)); } // For Toolstack restart, legacy code has to be used to determine this - pool_patches are still populated for backward compatibility List<Pool_patch> patches = host.AppliedPatches(); double bootTime = host.BootTime; double agentStart = host.AgentStartTime; if (bootTime == 0.0 || agentStart == 0.0) return warnings; foreach (Pool_patch patch in patches) { double applyTime = Util.ToUnixTime(patch.AppliedOn(host)); if (patch.after_apply_guidance.Contains(after_apply_guidance.restartXAPI) && applyTime > agentStart) { warnings.Add(CreateWarningRow(host, patch)); } } return warnings; }
private string hostAppliedPatches(Host host) { List<string> result = new List<string>(); if (Helpers.ElyOrGreater(host)) { foreach (var update in host.AppliedUpdates()) result.Add(update.Name); } else { foreach (Pool_patch patch in host.AppliedPatches()) result.Add(patch.Name); } result.Sort(StringUtility.NaturalCompare); return string.Join("\n", result.ToArray()); }
private bool isPatchApplied(string uuid, Host host) { List<Pool_patch> hostPatches = host.AppliedPatches(); foreach (Pool_patch patch in hostPatches) { if (string.Equals(patch.uuid, uuid, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; }