Commit d17647f0 authored by Spiros Koulouzis's avatar Spiros Koulouzis

Fix ansible bugs: set correct name for deployer and fix deployer ansible logging

parent a55f54c7
......@@ -135,23 +135,24 @@ public class ConfigurationService {
Matcher match = p.matcher(ymlStr);
while (match.find()) {
String line = match.group();
if (!line.contains("\"")) {
if (!line.contains("\"") || line.contains("'")) {
String cpusNum = line.split(":")[1];
cpusNum = cpusNum.replaceAll(",", "").trim();
ymlStr = ymlStr.replaceAll(cpusNum, "\"" + cpusNum + "\"");
ymlStr = ymlStr.replaceAll(cpusNum, '\'' + cpusNum + '\'');
}
}
p = Pattern.compile("memory:.*");
match = p.matcher(ymlStr);
while (match.find()) {
String line = match.group();
if (!line.contains("\"")) {
if (!line.contains("\"") || line.contains("'")) {
String memory = line.split(":")[1];
memory = memory.replaceAll("}", "").trim();
ymlStr = ymlStr.replaceAll(memory, "\"" + memory + "\"");
ymlStr = ymlStr.replaceAll(memory, '\'' + memory + '\'');
}
}
return ymlStr;
return ymlStr.replaceAll("'''", "'");
}
}
......@@ -145,10 +145,7 @@ public class DeployService {
null).get(0);
;
deployerInvokationMessage.setOwner(((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getUsername());
// Message response = MessageGenerator.generate ArtificialMessage(System.getProperty("user.home")
// + File.separator + "workspace" + File.separator + "DRIP"
// + File.separator + "docs" + File.separator + "json_samples"
// + File.separator + "deployer_ansible_response_benchmark.json");
logger.info("Calling deployer");
Message response = (deployer.call(deployerInvokationMessage));
logger.info("Got response from deployer");
......@@ -292,7 +289,12 @@ public class DeployService {
private MessageParameter createConfigurationParameter(String configurationID, String confType) throws JSONException {
String configuration = configurationService.get(configurationID, "yml");
MessageParameter configurationParameter = new MessageParameter();
if (confType.equals("ansible")) {
configurationParameter.setName("playbook");
} else {
configurationParameter.setName(confType);
}
configurationParameter.setEncoding("UTF-8");
configurationParameter.setValue(configuration);
return configurationParameter;
......
......@@ -15,6 +15,7 @@
*/
package nl.uva.sne.drip.api.v1.rest;
import nl.uva.sne.drip.drip.commons.data.v1.external.GrafanaMonitorringMessage;
import com.webcohesion.enunciate.metadata.rs.ResponseCode;
import com.webcohesion.enunciate.metadata.rs.StatusCodes;
import java.util.ArrayList;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment