cli: Exit with status 0 for --help
[ganeti-local] / Makefile.am
index 701eab3..ee74e2c 100644 (file)
@@ -31,6 +31,7 @@ DOCPP = $(top_srcdir)/autotools/docpp
 REPLACE_VARS_SED = autotools/replace_vars.sed
 CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
 BUILD_RPC = $(top_srcdir)/autotools/build-rpc
+SHELL_ENV_INIT = autotools/shell-env-init
 
 # Note: these are automake-specific variables, and must be named after
 # the directory + 'dir' suffix
@@ -150,8 +151,10 @@ CLEANFILES = \
        $(PYTHON_BOOTSTRAP) \
        epydoc.conf \
        $(REPLACE_VARS_SED) \
+       $(SHELL_ENV_INIT) \
        daemons/daemon-util \
        daemons/ganeti-cleaner \
+       daemons/ganeti-master-cleaner \
        devel/upload \
        $(BUILT_EXAMPLES) \
        doc/examples/bash_completion \
@@ -160,12 +163,13 @@ CLEANFILES = \
        $(man_MANS) \
        $(manhtml) \
        tools/kvm-ifup \
-       tools/vcluster-setup
+       tools/vcluster-setup \
        stamp-directories \
        stamp-srclinks \
        $(nodist_pkgpython_PYTHON) \
        $(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
        $(HS_BUILT_TEST_HELPERS) \
+       htools/ganeti-confd \
        .hpc/*.mix htools/*.tix htest/*.tix \
        doc/hs-lint.html
 
@@ -177,7 +181,7 @@ GENERATED_FILES = \
 HTOOLS_GENERATED_FILES =
 if WANT_HTOOLS
 HTOOLS_GENERATED_FILES += $(HS_PROGS)
-if HS_CONFD
+if ENABLE_CONFD
 HTOOLS_GENERATED_FILES += htools/hconfd
 endif
 endif
@@ -289,9 +293,7 @@ http_PYTHON = \
 
 confd_PYTHON = \
        lib/confd/__init__.py \
-       lib/confd/client.py \
-       lib/confd/querylib.py \
-       lib/confd/server.py
+       lib/confd/client.py
 
 masterd_PYTHON = \
        lib/masterd/__init__.py \
@@ -308,7 +310,6 @@ watcher_PYTHON = \
 
 server_PYTHON = \
        lib/server/__init__.py \
-       lib/server/confd.py \
        lib/server/masterd.py \
        lib/server/noded.py \
        lib/server/rapi.py
@@ -375,6 +376,7 @@ docrst = \
        doc/rapi.rst \
        doc/security.rst \
        doc/upgrade.rst \
+       doc/virtual-cluster.rst \
        doc/walkthrough.rst
 
 HS_PROGS = htools/htools
@@ -563,10 +565,6 @@ PYTHON_BOOTSTRAP_SBIN = \
        daemons/ganeti-rapi \
        $(gnt_scripts)
 
-if PY_CONFD
-PYTHON_BOOTSTRAP_SBIN += daemons/ganeti-confd
-endif
-
 PYTHON_BOOTSTRAP = \
        $(PYTHON_BOOTSTRAP_SBIN) \
        tools/ensure-dirs
@@ -600,9 +598,6 @@ install-exec-hook:
                $(LN_S) -f htools \
                           $(DESTDIR)$(bindir)/$$role ; \
        done
-if HS_CONFD
-       mv $(DESTDIR)$(sbindir)/hconfd $(DESTDIR)$(sbindir)/ganeti-confd
-endif
 endif
 
 $(HS_ALL_PROGS): %: %.hs $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS) Makefile
@@ -650,10 +645,14 @@ dist_sbin_SCRIPTS = \
 
 nodist_sbin_SCRIPTS = \
        $(PYTHON_BOOTSTRAP_SBIN) \
-       daemons/ganeti-cleaner
+       daemons/ganeti-cleaner \
+       daemons/ganeti-master-cleaner
+
+if ENABLE_CONFD
+htools/ganeti-confd: htools/hconfd
+       cp -f $< $@
 
-if HS_CONFD
-nodist_sbin_SCRIPTS += htools/hconfd
+nodist_sbin_SCRIPTS += htools/ganeti-confd
 endif
 
 python_scripts = \
@@ -717,6 +716,7 @@ EXTRA_DIST = \
        $(RUN_IN_TEMPDIR) \
        daemons/daemon-util.in \
        daemons/ganeti-cleaner.in \
+       daemons/ganeti-master-cleaner.in \
        $(pkglib_python_scripts) \
        devel/upload.in \
        tools/kvm-ifup.in \
@@ -752,6 +752,7 @@ EXTRA_DIST = \
 man_MANS = \
        man/ganeti.7 \
        man/ganeti-cleaner.8 \
+       man/ganeti-master-cleaner.8 \
        man/ganeti-confd.8 \
        man/ganeti-listrunner.8 \
        man/ganeti-masterd.8 \
@@ -921,6 +922,7 @@ python_tests = \
        test/ganeti.utils.filelock_unittest.py \
        test/ganeti.utils.hash_unittest.py \
        test/ganeti.utils.io_unittest.py \
+       test/ganeti.utils.io_unittest-runasroot.py \
        test/ganeti.utils.log_unittest.py \
        test/ganeti.utils.mlock_unittest.py \
        test/ganeti.utils.nodesetup_unittest.py \
@@ -937,9 +939,6 @@ python_tests = \
        test/docs_unittest.py \
        test/pycurl_reset_unittest.py \
        test/tempfile_fork_unittest.py
-if HAS_FAKEROOT
-python_tests += test/ganeti.utils.io_unittest-runasroot.py
-endif
 
 haskell_tests = htest/test
 
@@ -1045,7 +1044,8 @@ pep8_python_code = \
 
 test/daemon-util_unittest.bash: daemons/daemon-util
 
-test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
+test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner \
+  daemons/ganeti-master-cleaner
 
 test/bash_completion.bash: doc/examples/bash_completion-debug
 
@@ -1199,6 +1199,8 @@ lib/_autoconf.py: Makefile | stamp-directories
          echo "LOCALSTATEDIR = '$(localstatedir)'"; \
          echo "SYSCONFDIR = '$(sysconfdir)'"; \
          echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
+         echo "SSH_LOGIN_USER = '$(SSH_LOGIN_USER)'"; \
+         echo "SSH_CONSOLE_USER = '$(SSH_CONSOLE_USER)'"; \
          echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
          echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
          echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
@@ -1241,8 +1243,6 @@ lib/_autoconf.py: Makefile | stamp-directories
            echo "HTOOLS = False"; \
          fi; \
          echo "ENABLE_CONFD = $(ENABLE_CONFD)"; \
-         echo "PY_CONFD = $(PY_CONFD)"; \
-         echo "HS_CONFD = $(HS_CONFD)"; \
          echo "XEN_CMD = '$(XEN_CMD)'"; \
          echo "ENABLE_SPLIT_QUERY = $(ENABLE_SPLIT_QUERY)"; \
        } > $@
@@ -1271,7 +1271,20 @@ lib/_vcsversion.py: Makefile vcs-version | stamp-directories
 lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
        PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
 
-$(REPLACE_VARS_SED): Makefile stamp-directories
+$(SHELL_ENV_INIT): Makefile stamp-directories
+       set -e; \
+       { echo '# Allow overriding for tests'; \
+         echo 'readonly LOCALSTATEDIR=$${LOCALSTATEDIR:-$${GANETI_ROOTDIR:-}$(localstatedir)}'; \
+         echo 'readonly SYSCONFDIR=$${SYSCONFDIR:-$${GANETI_ROOTDIR:-}$(sysconfdir)}'; \
+         echo; \
+         echo 'readonly PKGLIBDIR=$(pkglibdir)'; \
+         echo 'readonly LOG_DIR="$$LOCALSTATEDIR/log/ganeti"'; \
+         echo 'readonly RUN_DIR="$$LOCALSTATEDIR/run/ganeti"'; \
+         echo 'readonly DATA_DIR="$$LOCALSTATEDIR/lib/ganeti"'; \
+         echo 'readonly CONF_DIR="$$SYSCONFDIR/ganeti"'; \
+       } > $@
+
+$(REPLACE_VARS_SED): $(SHELL_ENV_INIT) Makefile stamp-directories
        set -e; \
        { echo 's#@PREFIX@#$(prefix)#g'; \
          echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
@@ -1299,6 +1312,11 @@ $(REPLACE_VARS_SED): Makefile stamp-directories
          echo 's#@CUSTOM_ENABLE_CONFD@#$(ENABLE_CONFD)#g'; \
          echo 's#@MODULES@#$(strip $(lint_python_code))#g'; \
          echo 's#@ENABLE_SPLIT_QUERY@#$(ENABLE_SPLIT_QUERY)#g'; \
+         echo; \
+         echo '/^@SHELL_ENV_INIT@$$/ {'; \
+         echo '  r $(SHELL_ENV_INIT)'; \
+         echo '  d'; \
+         echo '}'; \
        } > $@
 
 # Using deferred evaluation
@@ -1401,7 +1419,7 @@ check-local: check-dirs $(GENERATED_FILES)
                echo "Incorrect version in README, expected $$expver"; \
                exit 1; \
        fi; \
-       for file in doc/iallocator.rst doc/hooks.rst; do \
+       for file in doc/iallocator.rst doc/hooks.rst doc/virtual-cluster.rst; do \
                if test "`sed -ne '4 p' $(top_srcdir)/$$file`" != \
                        "Documents Ganeti version $$expver"; then \
                        echo "Incorrect version in $$file, expected $$expver"; \