Skip to content
Snippets Groups Projects
Commit cc4fb7b4 authored by erbel's avatar erbel
Browse files

Add deployment check when deprovisioning monitoring instruments

parent 7ef4b39f
No related branches found
No related tags found
No related merge requests found
Pipeline #119636 passed
......@@ -5,6 +5,7 @@ import java.util.List;
import org.eclipse.cmf.occi.core.Link;
import org.eclipse.cmf.occi.core.MixinBase;
import org.eclipse.cmf.occi.infrastructure.Compute;
import org.modmacao.cm.ConfigurationManagementTool;
import org.modmacao.cm.ansible.AnsibleCMTool;
import org.modmacao.occi.platform.Component;
......@@ -233,4 +234,14 @@ public class ComponentManager {
return true;
}
public static boolean isConnectedToCompute(Component comp) {
for (Link link : comp.getLinks()) {
if (link.getTarget() != null) {
if (link.getTarget() instanceof Compute) {
return true;
}
}
}
return false;
}
}
\ No newline at end of file
......@@ -84,8 +84,10 @@ public class DatagathererConnector extends monitoring.impl.DatagathererImpl {
@Override
public void occiDelete() {
LOGGER.debug("occiDelete() called on " + this);
this.stop();
this.undeploy();
if (ComponentManager.isConnectedToCompute(this)) {
this.stop();
this.undeploy();
}
}
// End of user code
......
......@@ -84,8 +84,10 @@ public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl {
@Override
public void occiDelete() {
LOGGER.debug("occiDelete() called on " + this);
this.stop();
this.undeploy();
if (ComponentManager.isConnectedToCompute(this)) {
this.stop();
this.undeploy();
}
}
// End of user code
......
......@@ -103,9 +103,10 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl
@Override
public void occiDelete() {
LOGGER.debug("occiDelete() called on " + this);
// TODO: Implement this callback or remove this method.
this.stop();
this.undeploy();
if (ComponentManager.isConnectedToCompute(this)) {
this.stop();
this.undeploy();
}
}
// End of user code
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment