Commit 13ffcc8f authored by Spiros Koulouzis's avatar Spiros Koulouzis

We still get org.ho.yaml.exception.YamlException: Error near line 9: End of document expected.

parent 518314e4
...@@ -88,11 +88,22 @@ public class Consumer extends DefaultConsumer { ...@@ -88,11 +88,22 @@ public class Consumer extends DefaultConsumer {
if (name.equals("topology")) { if (name.equals("topology")) {
JSONObject attributes = param.getJSONObject("attributes"); JSONObject attributes = param.getJSONObject("attributes");
int fileLevel = Integer.valueOf((String) attributes.get("level")); int fileLevel = Integer.valueOf((String) attributes.get("level"));
String fileName = (String) attributes.get("filename"); String[] parts = ((String) attributes.get("filename")).split("_");
String fileName = "";
String prefix = "";
//Clear date part form file name
for (int j = 1; j < parts.length; j++) {
fileName += prefix + parts[j];
prefix = "_";
}
if (fileLevel == level) { if (fileLevel == level) {
File topologyFile = new File(tempInputDirPath + File.separator + fileName); File topologyFile = new File(tempInputDirPath + File.separator + fileName);
if (topologyFile.createNewFile()) { if (topologyFile.createNewFile()) {
writeValueToFile((String) param.get(Parameter.VALUE), topologyFile); String val = (String) param.get(Parameter.VALUE);
//Replace '{' with indentation otherwise we get 'End of document execption'
val = val.replaceAll("- \\{", " - ").replaceAll(", ", "\n ").replaceAll("}", "");
writeValueToFile(val, topologyFile);
return topologyFile; return topologyFile;
} else { } else {
return null; return null;
...@@ -283,23 +294,19 @@ public class Consumer extends DefaultConsumer { ...@@ -283,23 +294,19 @@ public class Consumer extends DefaultConsumer {
scriptPath = scriptFile.getAbsolutePath(); scriptPath = scriptFile.getAbsolutePath();
File curDir = new File(tempInputDirPath); File curDir = new File(tempInputDirPath);
String[] ls = curDir.list(); for (File f : curDir.listFiles()) {
for (int i = 0; i < ls.length; i++) { String fileType = FilenameUtils.getExtension(f.getName());
if (ls[i].contains(".")) {
String fileType = FilenameUtils.getExtension(ls[i]);
if (fileType != null) { if (fileType != null) {
if (fileType.equals("yml")) { if (fileType.equals("yml")) {
String toscaFile = curDir + ls[i]; String toscaFile = f.getAbsolutePath();
if (sshKeyFilePath != null) { if (sshKeyFilePath != null) {
changeKeyFilePath(toscaFile, sshKeyFilePath); changeKeyFilePath(toscaFile, sshKeyFilePath);
} }
if (scriptPath != null) { if (scriptPath != null) {
changeGUIScriptFilePath(toscaFile, scriptPath); changeGUIScriptFilePath(toscaFile, scriptPath);
} }
}
} }
} }
} }
......
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