Skip to content

Commit a301a4a

Browse files
authored
DPE-5209 Fix unit-initialized test may break when run too early (#491)
* skip hook on container not reachable * fix method call
1 parent 858e6a7 commit a301a4a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/upgrade.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from typing_extensions import override
3535

3636
import k8s_helpers
37-
from constants import MYSQLD_SAFE_SERVICE
37+
from constants import CONTAINER_NAME, MYSQLD_SAFE_SERVICE
3838

3939
if TYPE_CHECKING:
4040
from charm import MySQLOperatorCharm
@@ -203,6 +203,8 @@ def _on_upgrade_changed(self, _) -> None:
203203
204204
Run update status for every unit when the upgrade is completed.
205205
"""
206+
if not self.charm.unit.get_container(CONTAINER_NAME).can_connect():
207+
return
206208
if not self.upgrade_stack and self.idle and self.charm.unit_initialized:
207209
self.charm._on_update_status(None)
208210

0 commit comments

Comments
 (0)