Hi,
How can I monitor both $ZOMBIE and $SERVICE in the same pre-condition?
$ZOMBIE only works when the entire service is being deleted. But if I have a component in the nano-service that is being deleted, I would have to use $PLAN (or $SERVICE) in the delete pre-conditions. But that wont work when I'm deleting the entire service.
Simple example:
ncs:plan-outline deployment-plan {
ncs:component-type "ncs:self" {
ncs:state "ncs:init" {
ncs:create {
ncs:nano-callback;
}
}
ncs:state "ncs:ready" {
ncs:create {
ncs:pre-condition {
ncs:monitor "$PLAN" {
ncs:trigger-expr
"not(component/state[name != 'ncs:ready'][status != 'reached'])";
}
}
}
}
}
ncs:component-type "abc:extra" {
ncs:state "ncs:init" {
ncs:create {
ncs:nano-callback;
}
ncs:delete {
ncs:pre-condition {
ncs:monitor "$SERVICE/plan/component[name='extra'][type='abc:extra']/state[name='ncs:ready']" { // HERE IS THE PROBLEM
ncs:trigger-expr "post-action-status = 'delete-reached'";
}
}
}
}
ncs:state "ncs:ready" {
ncs:delete {
ncs:post-action-node "$ZOMBIE" {
ncs:action-name "re-deploy";
}
}
}
}
}
ncs:service-behavior-tree abc-servicepoint {
description
"Informative description";
ncs:plan-outline-ref deployment-plan;
ncs:selector {
ncs:variable "ABC_NAME" {
ncs:value-expr "name";
}
ncs:create-component "'self'" {
ncs:component-type-ref "ncs:self";
}
ncs:create-component "'extra'" {
ncs:component-type-ref "abc:extra";
ncs:pre-condition {
ncs:monitor "$SERVICE/extra" {
}
}
}
}
}
Sorry to say that this is an known issue that needs to be resolved in a future release.
There is an undocumented feature in the behavior-tree to use a plan-location i.e another path for the plan, which then will need to be created and maintained. This works well for service lists that sits on the top or under non-presence containers. So that the path is static. The nano service manager will handle the creation and removal of the plan and the $PLAN variable will be usable both for the service and the zombie.