Skip to content

Commit

Permalink
Check if applications are active/idle before upgrading.
Browse files Browse the repository at this point in the history
- Without status check if the unit is on maintenance it will
  proceed to upgrade

Closes: canonical#199
  • Loading branch information
gabrielcocenza committed Dec 13, 2023
1 parent 2154966 commit 0a2f680
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions cou/utils/juju_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ async def _wait_for_idle() -> None:
timeout=timeout,
idle_period=idle_period,
raise_on_blocked=raise_on_blocked,
status="active",
)
except (asyncio.exceptions.TimeoutError, JujuAppError, JujuUnitError) as error:
# NOTE(rgildein): Catching TimeoutError raised as exception when wait_for_idle
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/utils/test_juju_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ async def test_coumodel_wait_for_idle(mock_get_supported_apps, mocked_model):
timeout=timeout,
idle_period=juju_utils.DEFAULT_MODEL_IDLE_PERIOD,
raise_on_blocked=False,
status="active",
)
mock_get_supported_apps.assert_awaited_once_with()

Expand All @@ -504,6 +505,7 @@ async def test_coumodel_wait_for_idle_apps(mock_get_supported_apps, mocked_model
timeout=timeout,
idle_period=juju_utils.DEFAULT_MODEL_IDLE_PERIOD,
raise_on_blocked=False,
status="active",
)
mock_get_supported_apps.assert_not_awaited()

Expand All @@ -525,5 +527,6 @@ async def test_coumodel_wait_for_idle_timeout(mock_get_supported_apps, mocked_mo
timeout=timeout,
idle_period=juju_utils.DEFAULT_MODEL_IDLE_PERIOD,
raise_on_blocked=False,
status="active",
)
mock_get_supported_apps.assert_not_awaited()

0 comments on commit 0a2f680

Please sign in to comment.