Source:
public HostUpgradeManagerResult checkForUpdates(VDS host) { AuditLogableBase auditLog = Injector.injectMembers(new AuditLogableBase()); auditLog.setVds(host); if (!vdsDynamicDao.get(host.getId()).getStatus().isEligibleForOnDemandCheckUpdates()) { log.warn("Check for available updates is skipped for host '{}' due to unsupported host status '{}' ", host.getName(), host.getStatus()); auditLog.addCustomValue("VdsStatus", host.getStatus().toString()); auditLogDirector.log(auditLog, AuditLogType.HOST_AVAILABLE_UPDATES_SKIPPED_UNSUPPORTED_STATUS); return null; } HostUpgradeManagerResult updatesResult = null; try { updatesResult = availableUpdatesFinder.checkForUpdates(host); if (updatesResult.isUpdatesAvailable()) { String message = updatesResult.getAvailablePackages() == null ? "found updates." : String.format("found updates for packages %s", StringUtils.join(updatesResult.getAvailablePackages(), ", ")); auditLog.addCustomValue("Message", message); } else { auditLog.addCustomValue("Message", "no updates found."); } auditLogDirector.log(auditLog, AuditLogType.HOST_AVAILABLE_UPDATES_FINISHED); } catch (IllegalStateException e) { log.warn(e.getMessage()); auditLogDirector.log(auditLog, AuditLogType.HOST_AVAILABLE_UPDATES_PROCESS_IS_ALREADY_RUNNING); } catch (Exception e) { log.error("Failed to check if updates are available for host '{}' with error message '{}'", host.getName(), e.getMessage()); log.debug("Exception", e); auditLog.addCustomValue("Message", StringUtils.defaultString(e.getMessage(), e.getCause() == null ? null : e.getCause().toString())); auditLogDirector.log(auditLog, AuditLogType.HOST_AVAILABLE_UPDATES_FAILED); } if (updatesResult != null && updatesResult.isUpdatesAvailable() != host.isUpdateAvailable()) { VdsManager hostManager = resourceManager.getVdsManager(host.getId()); synchronized (hostManager) { hostManager.updateUpdateAvailable(updatesResult.isUpdatesAvailable()); } } return updatesResult; }

Target:
public HostUpgradeManagerResult checkForUpdates(VDS host) { AuditLogableBase auditLog = Injector.injectMembers(new AuditLogableBase()); auditLog.setVds(host); if (!vdsDynamicDao.get(host.getId()).getStatus().isEligibleForOnDemandCheckUpdates()) { log.warn("Check for available updates is skipped for host '{}' due to unsupported host status '{}' ", host.getName(), host.getStatus()); auditLogDirector.log(auditLog, AuditLogType.HOST_AVAILABLE_UPDATES_SKIPPED_UNSUPPORTED_STATUS); return null; } HostUpgradeManagerResult updatesResult = null; try { updatesResult = availableUpdatesFinder.checkForUpdates(host); if (updatesResult.isUpdatesAvailable()) { String message = updatesResult.getAvailablePackages() == null ? "found updates." : String.format("found updates for packages %s", StringUtils.join(updatesResult.getAvailablePackages(), ", ")); auditLog.addCustomValue("Message", message); } else { auditLog.addCustomValue("Message", "no updates found."); } auditLogDirector.log(auditLog, AuditLogType.HOST_AVAILABLE_UPDATES_FINISHED); } catch (IllegalStateException e) { log.warn(e.getMessage()); auditLogDirector.log(auditLog, AuditLogType.HOST_AVAILABLE_UPDATES_PROCESS_IS_ALREADY_RUNNING); } catch (Exception e) { log.error("Failed to check if updates are available for host '{}' with error message '{}'", host.getName(), e.getMessage()); log.debug("Exception", e); auditLog.addCustomValue("Message", StringUtils.defaultString(e.getMessage(), e.getCause() == null ? null : e.getCause().toString())); auditLogDirector.log(auditLog, AuditLogType.HOST_AVAILABLE_UPDATES_FAILED); } if (updatesResult != null && updatesResult.isUpdatesAvailable() != host.isUpdateAvailable()) { VdsManager hostManager = resourceManager.getVdsManager(host.getId()); synchronized (hostManager) { hostManager.updateUpdateAvailable(updatesResult.isUpdatesAvailable()); } } return updatesResult; }