diff --git a/src/store/cockpit/cockpitApi.ts b/src/store/cockpit/cockpitApi.ts index 2220cd59..0fc9f02b 100644 --- a/src/store/cockpit/cockpitApi.ts +++ b/src/store/cockpit/cockpitApi.ts @@ -588,17 +588,22 @@ export const cockpitApi = contentSourcesApi.injectEndpoints({ getWorkerConfig: builder.query({ queryFn: async () => { try { + // we need to ensure that the file is created + await cockpit.spawn(['mkdir', '-p', '/etc/osbuild-worker'], { + superuser: 'require', + }); + + await cockpit.spawn( + ['touch', '/etc/osbuild-worker/osbuild-worker.toml'], + { superuser: 'require' } + ); + const config = await cockpit .file('/etc/osbuild-worker/osbuild-worker.toml') .read(); return { data: TOML.parse(config) }; } catch (error) { - // no worker file error message - if (error.message === 'input is null') { - return { data: {} }; - } - return { error }; } },