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/tests/unit/test_utils.py b/n2vc/tests/unit/test_utils.py
index 3bab705..c5ab84f 100644
--- a/n2vc/tests/unit/test_utils.py
+++ b/n2vc/tests/unit/test_utils.py
@@ -40,14 +40,14 @@
def test_juju_status_to_osm(self):
tests = [
{
- "entity_type": EntityType.MACHINE,
+ "entity_type": "machine",
"status": [
{"juju": "pending", "osm": N2VCDeploymentStatus.PENDING},
{"juju": "started", "osm": N2VCDeploymentStatus.COMPLETED},
],
},
{
- "entity_type": EntityType.APPLICATION,
+ "entity_type": "application",
"status": [
{"juju": "waiting", "osm": N2VCDeploymentStatus.RUNNING},
{"juju": "maintenance", "osm": N2VCDeploymentStatus.RUNNING},
@@ -57,7 +57,7 @@
],
},
{
- "entity_type": EntityType.UNIT,
+ "entity_type": "unit",
"status": [
{"juju": "waiting", "osm": N2VCDeploymentStatus.RUNNING},
{"juju": "maintenance", "osm": N2VCDeploymentStatus.RUNNING},
@@ -67,7 +67,7 @@
],
},
{
- "entity_type": EntityType.ACTION,
+ "entity_type": "action",
"status": [
{"juju": "running", "osm": N2VCDeploymentStatus.RUNNING},
{"juju": "completed", "osm": N2VCDeploymentStatus.COMPLETED},