From a8e0fa902f5ed0040cff70c894f082574b8567f6 Mon Sep 17 00:00:00 2001 From: Guillaume Boutry Date: Wed, 12 Mar 2025 18:25:52 +0100 Subject: [PATCH] Always hard restart wsgi Soft restart wsgi introduced new issue when trying to restart and it forked. Change-Id: I1f8717979e990a94c072d6bcc6c65a18c5f2387a Signed-off-by: Guillaume Boutry --- charms/glance-k8s/src/charm.py | 12 ---------- charms/openstack-images-sync-k8s/src/charm.py | 12 ---------- ops-sunbeam/ops_sunbeam/container_handlers.py | 22 ------------------- 3 files changed, 46 deletions(-) diff --git a/charms/glance-k8s/src/charm.py b/charms/glance-k8s/src/charm.py index 2f32df4d..a05f9e83 100755 --- a/charms/glance-k8s/src/charm.py +++ b/charms/glance-k8s/src/charm.py @@ -24,8 +24,6 @@ This charm provide Glance services as part of an OpenStack deployment import json import logging import re -import signal -import typing from typing import ( Callable, List, @@ -122,16 +120,6 @@ class GlanceAPIPebbleHandler(sunbeam_chandlers.ServicePebbleHandler): self.execute(["a2enmod", "proxy_http"], exception_on_error=True) return super().init_service(context) - @property - def _restart_methods( - self, - ) -> typing.Mapping[str, Callable[[ops.Container, str], None]]: - return { - "apache forwarder": lambda container, service_name: container.send_signal( - signal.SIGUSR1, service_name - ) - } - @sunbeam_tracing.trace_type class GlanceStorageRelationHandler(sunbeam_rhandlers.CephClientHandler): diff --git a/charms/openstack-images-sync-k8s/src/charm.py b/charms/openstack-images-sync-k8s/src/charm.py index 80bcf777..999435f9 100755 --- a/charms/openstack-images-sync-k8s/src/charm.py +++ b/charms/openstack-images-sync-k8s/src/charm.py @@ -22,8 +22,6 @@ This charm deploys the openstack images sync service on Kubernetes. import logging import os -import signal -import typing from typing import ( TYPE_CHECKING, ) @@ -165,16 +163,6 @@ class OpenstackImagesSyncPebbleHandler(sunbeam_chandlers.ServicePebbleHandler): self.execute(["a2dissite", "000-default"], exception_on_error=True) return super().init_service(context) - @property - def _restart_methods( - self, - ) -> typing.Mapping[str, typing.Callable[[ops.Container, str], None]]: - return { - "http-mirror": lambda container, service_name: container.send_signal( - signal.SIGUSR1, service_name - ) - } - @sunbeam_tracing.trace_sunbeam_charm class OpenstackImagesSyncK8SCharm(sunbeam_charm.OSBaseOperatorAPICharm): diff --git a/ops-sunbeam/ops_sunbeam/container_handlers.py b/ops-sunbeam/ops_sunbeam/container_handlers.py index 4364fe3c..126428ae 100644 --- a/ops-sunbeam/ops_sunbeam/container_handlers.py +++ b/ops-sunbeam/ops_sunbeam/container_handlers.py @@ -21,7 +21,6 @@ in the container. import collections import logging -import signal import typing from collections.abc import ( Callable, @@ -450,27 +449,6 @@ class WSGIPebbleHandler(PebbleHandler): ) self.wsgi_service_name = wsgi_service_name - @staticmethod - def _restart_wsgi_service( - container: ops.Container, service_name: str - ) -> None: - """Restart WSGI service in container. - - WSGI services can be gracefully restarted by sending SIGUSR1 to the - service. - - :param container: Container to restart service in. - :param service_name: Service to restart. - """ - container.send_signal(signal.SIGUSR1, service_name) - - @property - def _restart_methods( - self, - ) -> typing.Mapping[str, Callable[[ops.Container, str], None]]: - """Mapping of service names to restart methods.""" - return {self.wsgi_service_name: self._restart_wsgi_service} - def start_wsgi(self, restart: bool = True) -> None: """Check and start services in container.