From 117da5aa8a2bf0a47d7785a6bb5bdb565a74413b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Mon, 16 Nov 2020 12:03:29 +0100 Subject: [PATCH] composer: add sanity checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Running composer without workers or APIs enabled is pretty much a no-op. Let's forbid that. Signed-off-by: Ondřej Budai --- cmd/osbuild-composer/composer.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/osbuild-composer/composer.go b/cmd/osbuild-composer/composer.go index 580f3d926..de10aa5b8 100644 --- a/cmd/osbuild-composer/composer.go +++ b/cmd/osbuild-composer/composer.go @@ -156,6 +156,15 @@ func (c *Composer) InitRemoteWorkers(cert, key string, l net.Listener) error { // // Running without the weldr API is currently not supported. func (c *Composer) Start() error { + // sanity checks + if c.localWorkerListener == nil && c.workerListener == nil { + log.Fatal("neither the local worker socket nor the remote worker socket is enabled, osbuild-composer is useless without workers") + } + + if c.apiListener == nil && c.weldrListener == nil { + log.Fatal("neither the weldr API socket nor the composer API socket is enabled, osbuild-composer is useless without one of these APIs enabled") + } + if c.localWorkerListener != nil { go func() { err := c.workers.Serve(c.localWorkerListener)