Search in sources :

Example 1 with ApiClusterTemplateHostInfo

use of com.sequenceiq.mock.swagger.model.ApiClusterTemplateHostInfo 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)

Example 2 with ApiClusterTemplateHostInfo

use of com.sequenceiq.mock.swagger.model.ApiClusterTemplateHostInfo in project cloudbreak by hortonworks.

the class CmdRunSaltResponse method addDataToAllHost.

private void addDataToAllHost(ClouderaManagerDto cmDto, Map<String, JsonNode> result, String data) {
    List<ApiClusterTemplateHostInfo> hosts = cmDto.getClusterTemplate().getInstantiator().getHosts();
    for (ApiClusterTemplateHostInfo host : hosts) {
        String hostName = host.getHostName();
        result.put(hostName, new TextNode(data));
    }
}
Also used : ApiClusterTemplateHostInfo(com.sequenceiq.mock.swagger.model.ApiClusterTemplateHostInfo) TextNode(com.fasterxml.jackson.databind.node.TextNode)

Aggregations

ApiClusterTemplateHostInfo (com.sequenceiq.mock.swagger.model.ApiClusterTemplateHostInfo)2 TextNode (com.fasterxml.jackson.databind.node.TextNode)1 PackageVersionResponse (com.sequenceiq.cloudbreak.orchestrator.salt.domain.PackageVersionResponse)1 ClouderaManagerDto (com.sequenceiq.mock.clouderamanager.ClouderaManagerDto)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1