File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
lib/charms/data_platform_libs/v0 Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ def restart(self, event) -> None:
285
285
286
286
# Increment this PATCH version before using `charmcraft publish-lib` or reset
287
287
# to 0 if you are raising the major API version
288
- LIBPATCH = 16
288
+ LIBPATCH = 17
289
289
290
290
PYDEPS = ["pydantic>=1.10,<2" , "poetry-core" ]
291
291
@@ -907,6 +907,17 @@ def _on_upgrade_charm(self, event: UpgradeCharmEvent) -> None:
907
907
logger .error (e )
908
908
self .set_unit_failed ()
909
909
return
910
+ top_unit_id = self .upgrade_stack [- 1 ]
911
+ top_unit = self .charm .model .get_unit (f"{ self .charm .app .name } /{ top_unit_id } " )
912
+ if (
913
+ top_unit == self .charm .unit
914
+ and self .peer_relation .data [self .charm .unit ].get ("state" ) == "recovery"
915
+ ):
916
+ # While in a rollback and the Juju leader unit is the top unit in the upgrade stack, emit the event
917
+ # for this unit to start the rollback.
918
+ self .peer_relation .data [self .charm .unit ].update ({"state" : "ready" })
919
+ self .on_upgrade_changed (event )
920
+ return
910
921
self .charm .unit .status = WaitingStatus ("other units upgrading first..." )
911
922
self .peer_relation .data [self .charm .unit ].update ({"state" : "ready" })
912
923
You can’t perform that action at this time.
0 commit comments