From cd8b0072ef1958ba75f801bd56480e4a7bc8e5f7 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 17 Nov 2011 11:49:56 +0100
Subject: [PATCH] Add toggle for enabling/disabling confd

Doesn't do anything yet.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 Makefile.am      |  2 ++
 configure.ac     | 21 +++++++++++++++++++++
 lib/constants.py |  1 +
 3 files changed, 24 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 735896454..171e9dd12 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1003,6 +1003,7 @@ lib/_autoconf.py: Makefile | lib/.dir
 	  else \
 	    echo "HTOOLS = False"; \
 	  fi; \
+	  echo "ENABLE_CONFD = $(ENABLE_CONFD)"; \
 	} > $@
 
 lib/_vcsversion.py: Makefile vcs-version | lib/.dir
@@ -1054,6 +1055,7 @@ $(REPLACE_VARS_SED): Makefile
 	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
 	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
 	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
+	  echo 's#@CUSTOM_ENABLE_CONFD@#$(ENABLE_CONFD)#g'; \
 	} > $@
 
 # Using deferred evaluation
diff --git a/configure.ac b/configure.ac
index ad0094000..06ed0e418 100644
--- a/configure.ac
+++ b/configure.ac
@@ -261,6 +261,27 @@ AC_ARG_ENABLE([htools-rapi],
         [],
         [enable_htools_rapi=no])
 
+# --enable-htools
+ENABLE_CONFD=
+AC_ARG_ENABLE([confd],
+  [AS_HELP_STRING([--enable-confd],
+  [enable the ganeti-confd daemon (default: yes)])],
+  [[case "$enableval" in
+      no)
+        enable_confd=False
+        ;;
+      yes)
+        enable_confd=True
+        ;;
+      *)
+        echo "Invalid value for enable-confd '$enableval'"
+        exit 1
+        ;;
+    esac
+  ]],
+  [enable_confd=True])
+AC_SUBST(ENABLE_CONFD, $enable_confd)
+
 # --with-disk-separator=...
 AC_ARG_WITH([disk-separator],
   [AS_HELP_STRING([--with-disk-separator=STRING],
diff --git a/lib/constants.py b/lib/constants.py
index 1da713dfa..48ac0b51c 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -181,6 +181,7 @@ SYSCONFDIR = _autoconf.SYSCONFDIR
 TOOLSDIR = _autoconf.TOOLSDIR
 CONF_DIR = SYSCONFDIR + "/ganeti"
 USER_SCRIPTS_DIR = CONF_DIR + "/scripts"
+ENABLE_CONFD = _autoconf.ENABLE_CONFD
 
 #: Lock file for watcher, locked in shared mode by watcher; lock in exclusive
 # mode to block watcher (see L{cli._RunWhileClusterStoppedHelper.Call}
-- 
GitLab