@@ -714,12 +714,12 @@ def _on_webhook_mutator_pebble_ready(self, event) -> None:
714
714
generate_mutating_webhook (
715
715
client , self .unit , self .model .name , cert , self .mutator_service_name
716
716
)
717
- client .close ()
718
717
719
718
# We must ensure that juju does not overwrite our termination period, so we should update
720
719
# it as needed. However, updating the termination period can result in an onslaught of
721
- # events, including the upgrade event. To prevent this from messing with upgrades do not
722
- # update the termination period when an upgrade is occurring.
720
+ # events, including the upgrade event.
721
+ # To prevent this from messing with upgrades do not update the termination period when an
722
+ # upgrade is occurring.
723
723
if self .get_current_termination_period () != ONE_YEAR and not self .upgrade_in_progress :
724
724
self .update_termination_grace_period_to_one_year ()
725
725
@@ -989,7 +989,6 @@ def get_current_termination_period(self) -> int:
989
989
"""Returns the current termination period for the stateful set of this juju application."""
990
990
client = Client ()
991
991
statefulset = client .get (StatefulSet , name = self .app .name , namespace = self .model .name )
992
- client .close ()
993
992
return statefulset .spec .template .spec .terminationGracePeriodSeconds
994
993
995
994
def get_termination_period_for_pod (self ) -> int :
@@ -998,7 +997,6 @@ def get_termination_period_for_pod(self) -> int:
998
997
client = Client ()
999
998
pod = client .get (Pod , name = pod_name , namespace = self .model .name )
1000
999
termination_grace_period = pod .spec .terminationGracePeriodSeconds
1001
- client .close ()
1002
1000
return termination_grace_period
1003
1001
1004
1002
def update_termination_grace_period_to_one_year (self ) -> None :
@@ -1021,7 +1019,6 @@ def update_termination_grace_period_to_one_year(self) -> None:
1021
1019
)
1022
1020
# Works because we're leader.
1023
1021
self .needs_new_termination_period = False
1024
- client .close ()
1025
1022
1026
1023
def __handle_partition_on_stop (self ) -> None :
1027
1024
"""Raise partition to prevent other units from restarting if an upgrade is in progress.
0 commit comments