private void scheduleInstalls(SsmInstallPackagesEvent event, User user) { log.debug("Scheduling package installations."); Date earliest = event.getEarliest(); Set<String> data = event.getPackages(); Long channelId = event.getChannelId(); List<EssentialServerDto> servers = SystemManager.systemsSubscribedToChannelInSet(channelId, user, SetLabels.SYSTEM_LIST); // Convert the package list to domain objects List<PackageListItem> packageListItems = new ArrayList<PackageListItem>(data.size()); for (String key : data) { packageListItems.add(PackageListItem.parse(key)); } // Convert to list of maps List<Map<String, Long>> packageListData = PackageListItem.toKeyMaps(packageListItems); // Create one action for all servers to which the packages are installed List<Long> serverIds = new LinkedList<Long>(); for (EssentialServerDto dto : servers) { serverIds.add(dto.getId()); } log.debug("Scheduling actions."); ActionManager.schedulePackageInstall(user, serverIds, packageListData, earliest); log.debug("Done scheduling package installations."); }
protected List<Long> getAffectedServers(SsmPackageEvent event, User u) { SsmInstallPackagesEvent sipe = (SsmInstallPackagesEvent) event; Long channelId = sipe.getChannelId(); List<EssentialServerDto> servers = SystemManager.systemsSubscribedToChannelInSet(channelId, u, SetLabels.SYSTEM_LIST); // Create one action for all servers to which the packages are installed List<Long> serverIds = new LinkedList<Long>(); for (EssentialServerDto dto : servers) { serverIds.add(dto.getId()); } return serverIds; }