Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JUJU-1682] Utilities for subordinate units #879

Merged
merged 4 commits into from
Jun 9, 2023

Conversation

cderici
Copy link
Contributor

@cderici cderici commented Jun 8, 2023

Description

This is in response to an LP bug, which is about getting the subordinate units using libjuju. The way that zaza was doing it is incorrect, in that it uses the Charm field in the subordinate units to get the charm_url. This is an internal field and shouldn't be used externally. Furthermore the naming of this field is somewhat misleading, as it's really the upgrading-from field that's being set only during an upgrade -to indicate the previous charm url prior to the upgrade- and it is to be deleted/unset right after the upgrade is done. This is why getting the charm-url from this field is not correct.

This change adds some useful utilities (some fields and some methods) to interact with the subordinate units, in particular, we're adding:

  • ModelState.subordinate_units and model.subordinate_units
  • Application.subordinate_units
  • Unit.is_subordinate, Unit.principal_unit and Unit.get_subordinates()

QA Steps

This also adds the test tests/integration/test_unit.py::test_subordinate_units, so the following should be working:

tox -e integration -- tests/integration/test_unit.py::test_subordinate_units

Notes & Discussion

Marked to be forward-ported into the main branch.

@cderici cderici added hint/2.9 going on 2.9 branch area/forward-port to be forward ported - remove label after port labels Jun 8, 2023
@cderici
Copy link
Contributor Author

cderici commented Jun 9, 2023

/merge

@jujubot jujubot merged commit 7a70f97 into juju:2.9 Jun 9, 2023
@cderici cderici removed the area/forward-port to be forward ported - remove label after port label Jun 26, 2023
jujubot added a commit that referenced this pull request Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hint/2.9 going on 2.9 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants