Commit aa827953 authored by Mohamed Khalil Labidi's avatar Mohamed Khalil Labidi
Browse files

Fix TargetType and removeClouds

parent afef04cb
...@@ -471,6 +471,7 @@ public class PAGateway { ...@@ -471,6 +471,7 @@ public class PAGateway {
* @param preempt If true undeploy node source immediately without waiting for nodes to be freed * @param preempt If true undeploy node source immediately without waiting for nodes to be freed
*/ */
public void removeClouds(List<String> cloudIDs, Boolean preempt) { public void removeClouds(List<String> cloudIDs, Boolean preempt) {
EntityManagerHelper.begin();
cloudIDs.forEach(cloudID -> { cloudIDs.forEach(cloudID -> {
PACloud cloud = EntityManagerHelper.find(PACloud.class, cloudID); PACloud cloud = EntityManagerHelper.find(PACloud.class, cloudID);
for (Map.Entry<String, String> entry : cloud.getDeployedRegions().entrySet()) { for (Map.Entry<String, String> entry : cloud.getDeployedRegions().entrySet()) {
...@@ -480,7 +481,9 @@ public class PAGateway { ...@@ -480,7 +481,9 @@ public class PAGateway {
LOGGER.error(e.getStackTrace()); LOGGER.error(e.getStackTrace());
} }
} }
EntityManagerHelper.remove(cloud);
}); });
EntityManagerHelper.commit();
} }
/** /**
......
...@@ -25,6 +25,15 @@ public class EmsDeploymentRequest implements Serializable { ...@@ -25,6 +25,15 @@ public class EmsDeploymentRequest implements Serializable {
String adapterVal; String adapterVal;
public static TargetType fromValue(String text) {
for (TargetType b : TargetType.values()) {
if (String.valueOf(b.adapterVal).equals(text.toUpperCase(Locale.ROOT))) {
return b;
}
}
return null;
}
} }
public enum TargetProvider { public enum TargetProvider {
...@@ -115,7 +124,7 @@ public class EmsDeploymentRequest implements Serializable { ...@@ -115,7 +124,7 @@ public class EmsDeploymentRequest implements Serializable {
this.baguetteIp = baguetteIp; this.baguetteIp = baguetteIp;
this.baguette_port = baguette_port; this.baguette_port = baguette_port;
this.targetOs = targetOs; this.targetOs = targetOs;
this.targetType = TargetType.valueOf(targetType); this.targetType = TargetType.fromValue(targetType);
this.targetName = targetName; this.targetName = targetName;
this.targetProvider = targetProvider; this.targetProvider = targetProvider;
this.location = location; this.location = location;
......
Supports Markdown
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