From f0992b8d0d0d40ad805db48d5bf827a66382f8f5 Mon Sep 17 00:00:00 2001 From: Andrew Bonney Date: Thu, 29 Aug 2024 09:01:54 +0100 Subject: [PATCH] mcapi_proxy: ensure proxy service restarts when venv changes Previously the service would only restart if the systemd unit was modified. If the venv was changed in-place, this would not trigger a restart. Change-Id: I685bedef4d84bf718aaa9064a20d3c1b71daf5bf --- mcapi_vexxhost/roles/proxy/handlers/main.yml | 24 ++++++++++++++++++++ mcapi_vexxhost/roles/proxy/tasks/main.yml | 1 - 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 mcapi_vexxhost/roles/proxy/handlers/main.yml diff --git a/mcapi_vexxhost/roles/proxy/handlers/main.yml b/mcapi_vexxhost/roles/proxy/handlers/main.yml new file mode 100644 index 00000000..0a253d79 --- /dev/null +++ b/mcapi_vexxhost/roles/proxy/handlers/main.yml @@ -0,0 +1,24 @@ +--- +# Copyright 2024, BBC R&D +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Restart magnum_cluster_api_proxy service + systemd: + name: "magnum-cluster-api-proxy" + enabled: yes + state: "restarted" + daemon_reload: yes + listen: + - "venv changed" + - "systemd service changed" diff --git a/mcapi_vexxhost/roles/proxy/tasks/main.yml b/mcapi_vexxhost/roles/proxy/tasks/main.yml index 6d06af5a..ba390bbf 100644 --- a/mcapi_vexxhost/roles/proxy/tasks/main.yml +++ b/mcapi_vexxhost/roles/proxy/tasks/main.yml @@ -86,7 +86,6 @@ vars: systemd_user_name: "{{ magnum_cluster_api_proxy_system_user_name }}" systemd_group_name: "{{ magnum_cluster_api_proxy_system_group_name }}" - systemd_service_restart_changed: true systemd_tempd_prefix: openstack systemd_slice_name: magnum-cluster-api-proxy systemd_lock_path: /var/lock/magnum-cluster-api-proxy