From bb514a221e068b46b6ecf8cd30eb1d0a04c64182 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 27 Sep 2012 16:28:29 +0200
Subject: [PATCH] daemon-util: Use function to determine if confd is enabled
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

… instead of comparing with two different values in two placse.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 daemons/daemon-util.in | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/daemons/daemon-util.in b/daemons/daemon-util.in
index 9a0b5bc2c..dd5eae104 100644
--- a/daemons/daemon-util.in
+++ b/daemons/daemon-util.in
@@ -32,7 +32,11 @@ DAEMONS=(
   ganeti-rapi
   )
 
-if [[ "@CUSTOM_ENABLE_CONFD@" == True ]]; then
+_confd_enabled() {
+  [[ "@CUSTOM_ENABLE_CONFD@" == True ]]
+}
+
+if _confd_enabled; then
   DAEMONS+=( ganeti-confd )
 fi
 
@@ -211,8 +215,7 @@ start() {
   local usergroup=$(_daemon_usergroup $plain_name)
   local daemonexec=$(_daemon_executable $name)
 
-  if [[ "$name" == ganeti-confd &&
-        "@CUSTOM_ENABLE_CONFD@" == False ]]; then
+  if [[ "$name" == ganeti-confd ]] && ! _confd_enabled; then
     echo 'ganeti-confd disabled at build time' >&2
     return 1
   fi
-- 
GitLab