class PackageVersionChecker {

    public CheckResult checkInstancesHaveMultiplePackageVersions(Set<InstanceMetaData> instanceMetaDataSet) {
        List<String> packagesWithMultipleVersions = instanceMetadataUpdater.collectPackagesWithMultipleVersions(instanceMetaDataSet);
        if (!packagesWithMultipleVersions.isEmpty()) {
            String message = messagesService.getMessage(CLUSTER_PACKAGES_ON_INSTANCES_ARE_DIFFERENT.getMessage(),
                    Collections.singletonList(String.join(",", packagesWithMultipleVersions)));
            return CheckResult.failed(message);
        }
        return CheckResult.ok();
    }

}