Remove EntityType from juju watcher and workaround juju bug for retrieving the status
- The juju watcher was doing an unnecessary translation with the entity types. The entity already provides an attribute .entity_type
- Juju has a bug in version 2.8.2 that returns a wrong status. Therefore, charms were getting stuck in waiting for ever.
Change-Id: I44709190acc41601e8a67f4c52074fda00c3d495
Signed-off-by: David Garcia <david.garcia@canonical.com>
diff --git a/n2vc/utils.py b/n2vc/utils.py
index 62892eb..e8cf64d 100644
--- a/n2vc/utils.py
+++ b/n2vc/utils.py
@@ -67,36 +67,24 @@
return cls.get_entity(v)
-FinalStatus = Dict(
- {
- EntityType.MACHINE: Dict({"field": "agent_status", "status": ["started"]}),
- EntityType.APPLICATION: Dict(
- {"field": "status", "status": ["active", "blocked"]}
- ),
- EntityType.ACTION: Dict(
- {"field": "status", "status": ["completed", "failed", "cancelled"]}
- ),
- }
-)
-
JujuStatusToOSM = {
- EntityType.MACHINE: {
+ "machine": {
"pending": N2VCDeploymentStatus.PENDING,
"started": N2VCDeploymentStatus.COMPLETED,
},
- EntityType.APPLICATION: {
+ "application": {
"waiting": N2VCDeploymentStatus.RUNNING,
"maintenance": N2VCDeploymentStatus.RUNNING,
"blocked": N2VCDeploymentStatus.RUNNING,
"error": N2VCDeploymentStatus.FAILED,
"active": N2VCDeploymentStatus.COMPLETED,
},
- EntityType.ACTION: {
+ "action": {
"pending": N2VCDeploymentStatus.PENDING,
"running": N2VCDeploymentStatus.RUNNING,
"completed": N2VCDeploymentStatus.COMPLETED,
},
- EntityType.UNIT: {
+ "unit": {
"waiting": N2VCDeploymentStatus.RUNNING,
"maintenance": N2VCDeploymentStatus.RUNNING,
"blocked": N2VCDeploymentStatus.RUNNING,