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 <guillaume.boutry@canonical.com>
This commit is contained in:
parent
66d0fd5c2e
commit
a8e0fa902f
@ -24,8 +24,6 @@ This charm provide Glance services as part of an OpenStack deployment
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import signal
|
|
||||||
import typing
|
|
||||||
from typing import (
|
from typing import (
|
||||||
Callable,
|
Callable,
|
||||||
List,
|
List,
|
||||||
@ -122,16 +120,6 @@ class GlanceAPIPebbleHandler(sunbeam_chandlers.ServicePebbleHandler):
|
|||||||
self.execute(["a2enmod", "proxy_http"], exception_on_error=True)
|
self.execute(["a2enmod", "proxy_http"], exception_on_error=True)
|
||||||
return super().init_service(context)
|
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
|
@sunbeam_tracing.trace_type
|
||||||
class GlanceStorageRelationHandler(sunbeam_rhandlers.CephClientHandler):
|
class GlanceStorageRelationHandler(sunbeam_rhandlers.CephClientHandler):
|
||||||
|
@ -22,8 +22,6 @@ This charm deploys the openstack images sync service on Kubernetes.
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import signal
|
|
||||||
import typing
|
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
)
|
)
|
||||||
@ -165,16 +163,6 @@ class OpenstackImagesSyncPebbleHandler(sunbeam_chandlers.ServicePebbleHandler):
|
|||||||
self.execute(["a2dissite", "000-default"], exception_on_error=True)
|
self.execute(["a2dissite", "000-default"], exception_on_error=True)
|
||||||
return super().init_service(context)
|
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
|
@sunbeam_tracing.trace_sunbeam_charm
|
||||||
class OpenstackImagesSyncK8SCharm(sunbeam_charm.OSBaseOperatorAPICharm):
|
class OpenstackImagesSyncK8SCharm(sunbeam_charm.OSBaseOperatorAPICharm):
|
||||||
|
@ -21,7 +21,6 @@ in the container.
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
import logging
|
import logging
|
||||||
import signal
|
|
||||||
import typing
|
import typing
|
||||||
from collections.abc import (
|
from collections.abc import (
|
||||||
Callable,
|
Callable,
|
||||||
@ -450,27 +449,6 @@ class WSGIPebbleHandler(PebbleHandler):
|
|||||||
)
|
)
|
||||||
self.wsgi_service_name = wsgi_service_name
|
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:
|
def start_wsgi(self, restart: bool = True) -> None:
|
||||||
"""Check and start services in container.
|
"""Check and start services in container.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user