From patchwork Wed Mar 30 09:56:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 5418 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4KT2063VSDz3wfF for ; Wed, 30 Mar 2022 09:56:54 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4KT2001Sh8znF; Wed, 30 Mar 2022 09:56:48 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4KT1zz3rnxz2yxm; Wed, 30 Mar 2022 09:56:47 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4KT1zx2F4bz2ySg for ; Wed, 30 Mar 2022 09:56:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4KT1zx1MkYz4YQ; Wed, 30 Mar 2022 09:56:45 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1648634205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w+sER8ZrGVEQ031e8rfKj0ZS8vk5rFXTU/xgfQ3zT/Y=; b=fKzYjNoOX2Xh/Q2yHQjhlQxmwBAxLxrUGqFFszdUgcoh39OtfR3OTL+TUjrWpbPDvp6+ms VQsx9GRmJZRlTcCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1648634205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w+sER8ZrGVEQ031e8rfKj0ZS8vk5rFXTU/xgfQ3zT/Y=; b=pEARISwAlEty23ImBrOu+W816tWDOOvNHXDfwYoiRDYzGbVxeDwTCLwVEJCl3Y/rtK3og2 81tK9Wa40w3THgdFMLyKTnwrq2qRwHOwOqEFZE7JQhcNuUFpcK/sE8XE78/H0VBFoyt3XC U48I8fzafvc+T+tLn9RMXhaptgt2F773ECofNrilHgdgMoag4CVzjmNfkbFGUX5tVZ4sDk yMBi1KE82nVODaHmkVtkPGKahINqsyPfPnnmpAGD9nujEjmvf91AusKRLVRFkIVsPnbiUe asGNL4b442GFZpzC63AIO/CYe1GPIDwE3aOmoDSpEnx/dyawfqyzLC8uogQPXg== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH v2 5/5] unbound-dhcp-leases-bridge: Don't open stderr on daemonization Date: Wed, 30 Mar 2022 09:56:35 +0000 Message-Id: <20220330095635.621181-5-michael.tremer@ipfire.org> In-Reply-To: <20220330095635.621181-1-michael.tremer@ipfire.org> References: <20220330095635.621181-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Michael Tremer --- config/unbound/unbound-dhcp-leases-bridge | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index 50a0e516a..1446c88df 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -618,13 +618,14 @@ if __name__ == "__main__": bridge = UnboundDHCPLeasesBridge(args.dhcp_leases, args.fix_leases, args.unbound_leases, args.hosts) - ctx = daemon.DaemonContext(detach_process=args.daemon, stderr=sys.stderr) - ctx.signal_map = { - signal.SIGHUP : bridge.update_dhcp_leases, - signal.SIGTERM : bridge.terminate, - } - - with ctx: + with daemon.DaemonContext( + detach_process=args.daemon, + stderr=None if args.daemon else sys.stderr, + signal_map = { + signal.SIGHUP : bridge.update_dhcp_leases, + signal.SIGTERM : bridge.terminate, + }, + ) as daemon: setup_logging(daemon=args.daemon, loglevel=loglevel) bridge.run()