Fix get_machines_for_applications for subordinates

In the case where we have a subordinate charm, libjuju juju status
on the unit returns an empty dictionary, therefore the existing None
check would fail and the subordinate status would never get set.
The result being subordinates not included in the returned Iterator.
This commit is contained in:
Corey Bryant
2020-05-28 10:32:07 +00:00
parent 0546e01b62
commit 24306b8880
+1 -1
View File
@@ -96,7 +96,7 @@ def get_machines_for_application(application, model_name=None):
# libjuju juju status no longer has units for subordinate charms
# Use the application it is subordinate-to to find machines
if status.get("units") is None and status.get("subordinate-to"):
if not status.get("units") and status.get("subordinate-to"):
status = get_application_status(status.get("subordinate-to")[0],
model_name=model_name)