Search in sources :

Example 6 with PackageVersionResponse

use of com.sequenceiq.cloudbreak.orchestrator.salt.domain.PackageVersionResponse in project cloudbreak by hortonworks.

the class PgkVersionSaltResponse method run.

@Override
public Object run(String mockUuid, Map<String, List<String>> params) throws Exception {
    List<Map<String, String>> result = new ArrayList<>();
    PackageVersionResponse response = new PackageVersionResponse();
    ClouderaManagerDto cmDto = clouderaManagerStoreService.read(mockUuid);
    List<ApiClusterTemplateHostInfo> hosts = cmDto.getClusterTemplate().getInstantiator().getHosts();
    Map<String, String> pkgVersion = new HashMap<>();
    for (ApiClusterTemplateHostInfo host : hosts) {
        String hostName = host.getHostName();
        pkgVersion.put(hostName, cmDto.getClusterTemplate().getCmVersion());
    }
    result.add(pkgVersion);
    response.setResult(result);
    return response;
}
Also used : PackageVersionResponse(com.sequenceiq.cloudbreak.orchestrator.salt.domain.PackageVersionResponse) ClouderaManagerDto(com.sequenceiq.mock.clouderamanager.ClouderaManagerDto) HashMap(java.util.HashMap) ApiClusterTemplateHostInfo(com.sequenceiq.mock.swagger.model.ApiClusterTemplateHostInfo) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

PackageVersionResponse (com.sequenceiq.cloudbreak.orchestrator.salt.domain.PackageVersionResponse)6 HashMap (java.util.HashMap)6 ArrayList (java.util.ArrayList)5 HostList (com.sequenceiq.cloudbreak.orchestrator.salt.client.target.HostList)4 List (java.util.List)4 Optional (java.util.Optional)4 Test (org.junit.Test)4 PackageInfo (com.sequenceiq.cloudbreak.common.model.PackageInfo)3 Map (java.util.Map)3 ClouderaManagerDto (com.sequenceiq.mock.clouderamanager.ClouderaManagerDto)1 ApiClusterTemplateHostInfo (com.sequenceiq.mock.swagger.model.ApiClusterTemplateHostInfo)1