From 1ed4380bfc79dd7eb7a22c9c714ce93b2f898024 Mon Sep 17 00:00:00 2001 From: Gianluca Zuccarelli Date: Wed, 30 Apr 2025 10:46:02 +0000 Subject: [PATCH] cloudConfig: restart worker on submit Restart osbuild-composer and the worker after updating the config, this is a necessary step for osbuild-composer to register the changes. --- src/store/cockpit/cockpitApi.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/store/cockpit/cockpitApi.ts b/src/store/cockpit/cockpitApi.ts index e51d22fd..52afd13b 100644 --- a/src/store/cockpit/cockpitApi.ts +++ b/src/store/cockpit/cockpitApi.ts @@ -652,6 +652,39 @@ export const cockpitApi = contentSourcesApi.injectEndpoints({ }); }); + const systemServices = [ + 'osbuild-composer.socket', + 'osbuild-worker@*.service', + 'osbuild-composer.service', + ]; + + await cockpit.spawn( + [ + 'systemctl', + 'stop', + // we need to be explicit here and stop all the services first, + // otherwise this step is a little bit flaky + ...systemServices, + ], + { + superuser: 'require', + } + ); + + await cockpit.spawn( + [ + 'systemctl', + 'restart', + // we need to restart all the services explicitly too + // since the config doesn't always get reloaded if we + // only reload the worker service + ...systemServices, + ], + { + superuser: 'require', + } + ); + return { data: TOML.parse(contents) }; } catch (error) { return { error };