From 7a56c5466e9ddf53e53c831e00af361f8f3844f3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 22:28:34 +0100 Subject: [PATCH 01/11] use build.sh in documentation Signed-off-by: Nico Schottelius --- README | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README b/README index 389470a0..48b934f1 100644 --- a/README +++ b/README @@ -77,6 +77,7 @@ cdist was tested or is know to run on at least * [Debian](http://www.debian.org/) * [Gentoo](http://www.gentoo.org/) * [Mac OS X](http://www.apple.com/macosx/) + * [OpenBSD](http://www.openbsd.org) * [Redhat](http://www.redhat.com/) * [Ubuntu](http://www.ubuntu.com/) @@ -108,7 +109,7 @@ To install cdist, execute the following commands: export PATH=$PATH:$(pwd -P)/bin # If you want the manpages (requires gmake and asciidoc to be installed) - make man + ./build.sh man export MANPATH=$MANPATH:$(pwd -P)/doc/man @@ -150,7 +151,7 @@ To upgrade cdist in the current branch use git pull # Also update the manpages - make man + ./build.sh man export MANPATH=$MANPATH:$(pwd -P)/doc/man If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break. From 7f2ca78b8238e037cab7fddf829cebb6172196f4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 22:34:11 +0100 Subject: [PATCH 02/11] spell correction Signed-off-by: Nico Schottelius --- .../{cdist-best-practise.text => cdist-best-practice.text} | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) rename doc/man/{cdist-best-practise.text => cdist-best-practice.text} (96%) diff --git a/doc/man/cdist-best-practise.text b/doc/man/cdist-best-practice.text similarity index 96% rename from doc/man/cdist-best-practise.text rename to doc/man/cdist-best-practice.text index af06084e..febe8f36 100644 --- a/doc/man/cdist-best-practise.text +++ b/doc/man/cdist-best-practice.text @@ -1,10 +1,10 @@ -cdist-best-practise(7) +cdist-best-practice(7) ====================== Nico Schottelius NAME ---- -cdist-best-practise - Practises used in real environments +cdist-best-practice - Practices used in real environments PASSWORDLESS CONNECTIONS @@ -61,7 +61,6 @@ machine-b % git clone git://your-git-server/cdist -------------------------------------------------------------------------------- - SEE ALSO -------- - cdist(7) From a55eb6ebc97713a4b9f9f4aab45cf761f119ad14 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 22:54:17 +0100 Subject: [PATCH 03/11] correct mantype linking and finish spell check Signed-off-by: Nico Schottelius --- build.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 2c1570f5..4fc65b0d 100755 --- a/build.sh +++ b/build.sh @@ -41,6 +41,7 @@ case "$1" in man) set -e "$0" mandirs + "$0" mangen "$0" mantype "$0" man1 "$0" man7 @@ -61,7 +62,7 @@ case "$1" in ;; mantype) - for mansrc in ${MAN7TYPESRC}; do + for mansrc in conf/type/*/man.text; do dst="$(echo $mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')" ln -sf "../../../$mansrc" "$dst" done @@ -83,7 +84,7 @@ case "$1" in ;; man7) - for man in cdist.text cdist-best-practise.text cdist-hacker.text \ + for man in cdist.text cdist-best-practice.text cdist-hacker.text \ cdist-quickstart.text cdist-reference.text cdist-stages.text \ cdist-type.text do From 5ec1a6cc2d9f43b7b2cb7a65608a1d11ee7e08fb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 23:06:30 +0100 Subject: [PATCH 04/11] rephrase cdist and add prominent example section Signed-off-by: Nico Schottelius --- doc/man/cdist.text | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/man/cdist.text b/doc/man/cdist.text index 44be52b1..a4c88c1d 100644 --- a/doc/man/cdist.text +++ b/doc/man/cdist.text @@ -10,8 +10,13 @@ cdist - Configuration management system DESCRIPTION ----------- -Cdist is a very simple, elegant, cleanly designed configuration management -system. The easiest way to get started with cdist is to run cdist-quickstart. +Cdist is a usable configuration management system. +The easiest way to get started with cdist is to initialise +the environment and run cdist-quickstart: + +-------------------------------------------------------------------------------- +eval `./bin/cdist-env` && cdist-quickstart +-------------------------------------------------------------------------------- Cdist configurations are written in the shell scripting language. The mapping of configurations to hosts is defined in so called manifests, From 8f88ed269198b83b101993355e9bd31d294e749c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 23:17:35 +0100 Subject: [PATCH 05/11] template for cdist-cache Signed-off-by: Nico Schottelius --- bin/cdist-cache | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 bin/cdist-cache diff --git a/bin/cdist-cache b/bin/cdist-cache new file mode 100755 index 00000000..d4ea18bb --- /dev/null +++ b/bin/cdist-cache @@ -0,0 +1,56 @@ +#!/bin/sh +# +# 2010 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Let's build a cconfig tree from a configuration +# And save it into the cache tree +# + +. cdist-config +[ $# -eq 2 ] || __cdist_usage " " +set -u + +__cdist_target_host="$1"; shift +__cdist_manifest="$1"; shift + +################################################################################ +# Export information for cdist-type-emulator or manifest +# + +# Config dir should not get reset - FIXME: why did I do this? +export __cdist_conf_dir + +# Used to record the source in the object +export __cdist_manifest + +# Export information for manifests - __cdist_out_dir comes from cdist-config +export __global="$__cdist_out_dir" + +################################################################################ +# The actual run +# + +# Ensure binaries exist and are up-to-date +cdist-type-build-emulation "${__cdist_out_type_bin_dir}" \ + || __cdist_exit_err "Failed to build type emulation binaries" + +# prepend our path, so all cdist tools come before other tools +export PATH="${__cdist_out_type_bin_dir}:$PATH" + +__cdist_exec_fail_on_error "${__cdist_manifest}" From a9ce26f96858ec15fa88d3b26401bf1adc8ab10f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 23:35:11 +0100 Subject: [PATCH 06/11] integrate cdist-cache Signed-off-by: Nico Schottelius --- .gitignore | 9 ++------- bin/cdist-cache | 33 +++++++-------------------------- bin/cdist-config | 2 ++ bin/cdist-deploy-to | 1 + 4 files changed, 12 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index fdf9184f..68f829dc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,13 +2,8 @@ .*.swp # Ignore generated manpages -doc/man/*.[1-9] doc/man/.marker doc/man/man*/ -doc/html - -conf/type/*/*.7 -conf/type/*/man.html - - +# Ignore cache for version control +cache/ diff --git a/bin/cdist-cache b/bin/cdist-cache index d4ea18bb..120b0df2 100755 --- a/bin/cdist-cache +++ b/bin/cdist-cache @@ -23,34 +23,15 @@ # . cdist-config -[ $# -eq 2 ] || __cdist_usage " " +[ $# -eq 1 ] || __cdist_usage "" set -u __cdist_target_host="$1"; shift -__cdist_manifest="$1"; shift -################################################################################ -# Export information for cdist-type-emulator or manifest -# +mkdir -p "${__cdist_local_base_cache_dir}" +__cdist_abs_cache_dir="$(cd "$__cdist_local_base_cache_dir" && pwd -P)" +__cdist_abs_ddir="$__cdist_abs_cache_dir/$__cdist_target_host" -# Config dir should not get reset - FIXME: why did I do this? -export __cdist_conf_dir - -# Used to record the source in the object -export __cdist_manifest - -# Export information for manifests - __cdist_out_dir comes from cdist-config -export __global="$__cdist_out_dir" - -################################################################################ -# The actual run -# - -# Ensure binaries exist and are up-to-date -cdist-type-build-emulation "${__cdist_out_type_bin_dir}" \ - || __cdist_exit_err "Failed to build type emulation binaries" - -# prepend our path, so all cdist tools come before other tools -export PATH="${__cdist_out_type_bin_dir}:$PATH" - -__cdist_exec_fail_on_error "${__cdist_manifest}" +echo "Saving cache to $__cdist_abs_ddir ..." +rm -rf "$__cdist_abs_ddir" +mv "$__cdist_local_base_dir" "$__cdist_abs_ddir" diff --git a/bin/cdist-config b/bin/cdist-config index 86039f00..ccab81cc 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -41,6 +41,7 @@ __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" # : ${__cdist_name_bin:=bin} +: ${__cdist_name_cache:=cache} : ${__cdist_name_code:=code} : ${__cdist_name_code_finished:=codedone} : ${__cdist_name_conf_dir:=conf} @@ -100,6 +101,7 @@ __cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX") # Local Base # : ${__cdist_local_base_dir:=$__cdist_tmp_dir} +: ${__cdist_local_base_cache_dir:=$__cdist_abs_mydir/../$__cdist_name_cache} : ${__cdist_conf_dir:="$(cd "$__cdist_abs_mydir/../conf" && pwd -P)"} diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index 9a2fd303..3a2c37c9 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -58,5 +58,6 @@ cdist-dir push "$__cdist_target_host" "$__cdist_out_object_dir" \ "${__cdist_remote_out_object_base_dir}" cdist-code-run-all "$__cdist_target_host" +cdist-cache "$__cdist_target_host" echo "cdist $__cdist_version: Successfully finished run on $__cdist_target_host" From a11e9791650be176d0c270edf7d8dca9b58319d4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 23:36:42 +0100 Subject: [PATCH 07/11] update todos Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 3556f371..ada791ca 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,8 +1,12 @@ Core: - support $__self = relative_type/object_id - - cache Cache: + - add manpage + - add example how to use + - export variable $__cache + -> to all hosts or this host? + Assume you want to configure stuff one host ("monitor node"), depending on the configuration of other hosts ("cluster nodes"). From 76725c1b0db5923069fdc5734c37551a2efa68a6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 23:43:23 +0100 Subject: [PATCH 08/11] begin to document cache Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 25 ++------------------- doc/man/cdist-cache.text | 47 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 23 deletions(-) create mode 100644 doc/man/cdist-cache.text diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index ada791ca..6b0891a2 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,27 +1,6 @@ -Core: - - support $__self = relative_type/object_id - Cache: - - add manpage - add example how to use - export variable $__cache -> to all hosts or this host? - - Assume you want to configure stuff one host ("monitor node"), - depending on the configuration of other hosts ("cluster nodes"). - - For instance, the monitor host would like to know, - which hosts are configured with the provider - "apache" and option --start true. - - This requires the monitor node to be able to - query all other configured nodes. It can't - ask for all hosts, because cdist does not - know which hosts are configured or may exist. - - Example implementation - - If cdist keeps ("caches") the configuration of every - node it configures, each new node can query the - cache for existing nodes that acquired the given - configuration. +Core: + - support $__self = relative_type/object_id diff --git a/doc/man/cdist-cache.text b/doc/man/cdist-cache.text new file mode 100644 index 00000000..cbf4c9d7 --- /dev/null +++ b/doc/man/cdist-cache.text @@ -0,0 +1,47 @@ +cdist-cache(1) +============== +Nico Schottelius + + +NAME +---- +cdist-cache - Cache output of last run + + +SYNOPSIS +-------- +cdist-cache TARGET_HOST + + +DESCRIPTION +----------- + + Assume you want to configure stuff one host ("monitor node"), + depending on the configuration of other hosts ("cluster nodes"). + + For instance, the monitor host would like to know, + which hosts are configured with the provider + "apache" and option --start true. + + This requires the monitor node to be able to + query all other configured nodes. It can't + ask for all hosts, because cdist does not + know which hosts are configured or may exist. + + Example implementation + + If cdist keeps ("caches") the configuration of every + node it configures, each new node can query the + cache for existing nodes that acquired the given + configuration. + + +SEE ALSO +-------- +cdist(7) + + +COPYING +------- +Copyright \(C) 2011 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). From 652c0c1615d9b73eee55cdeb2445be1a179db871 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 23:52:13 +0100 Subject: [PATCH 09/11] document stuff for next release Signed-off-by: Nico Schottelius --- build.sh | 2 +- doc/changelog | 4 +++- doc/man/cdist-cache.text | 22 +++------------------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/build.sh b/build.sh index 4fc65b0d..b91db496 100755 --- a/build.sh +++ b/build.sh @@ -86,7 +86,7 @@ case "$1" in man7) for man in cdist.text cdist-best-practice.text cdist-hacker.text \ cdist-quickstart.text cdist-reference.text cdist-stages.text \ - cdist-type.text + cdist-type.text cdist-cache.text do ln -sf ../$man ${MAN7DSTDIR} done diff --git a/doc/changelog b/doc/changelog index 5cfae26f..93d0f7e4 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,3 +1,6 @@ +1.5.0: + * Add cache functionality + 1.4.1: 2011-03-25 * New type __key_value (Steven Armstrong) * New type __apt_ppa (Steven Armstrong) @@ -41,7 +44,6 @@ * Document cdist-object-gencode-all * Document cdist-manifest-run - 1.1.0: 2011-03-16 * Replace type __file with __file, __directory, __link * Document cdist-env diff --git a/doc/man/cdist-cache.text b/doc/man/cdist-cache.text index cbf4c9d7..54619199 100644 --- a/doc/man/cdist-cache.text +++ b/doc/man/cdist-cache.text @@ -15,25 +15,9 @@ cdist-cache TARGET_HOST DESCRIPTION ----------- - - Assume you want to configure stuff one host ("monitor node"), - depending on the configuration of other hosts ("cluster nodes"). - - For instance, the monitor host would like to know, - which hosts are configured with the provider - "apache" and option --start true. - - This requires the monitor node to be able to - query all other configured nodes. It can't - ask for all hosts, because cdist does not - know which hosts are configured or may exist. - - Example implementation - - If cdist keeps ("caches") the configuration of every - node it configures, each new node can query the - cache for existing nodes that acquired the given - configuration. +cdist-cache moves away the objects created during last run so the +next run can use the previous information and compare them with +the current status. SEE ALSO From 38a9c5d60fb492945aeb6b2ddf7f8466d991f40f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 25 Mar 2011 23:53:38 +0100 Subject: [PATCH 10/11] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 6b0891a2..05a44503 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,6 +1,9 @@ Cache: - add example how to use - export variable $__cache - -> to all hosts or this host? + -> for current host + -> add function to cdist-config, import from cdist-cache + + Core: - support $__self = relative_type/object_id From 2a0cba4e4b37ed115accd5ce24cefc9a24cc9f7d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 26 Mar 2011 00:07:23 +0100 Subject: [PATCH 11/11] rephrase features Signed-off-by: Nico Schottelius --- README | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/README b/README index 48b934f1..c498e3b8 100644 --- a/README +++ b/README @@ -52,22 +52,28 @@ You can [browse the documentation for the latest version online](man) as well. ### Features -Stuff that should probably be included in every configuration management, -but is not. Or: Why I began to write cdist: - - * Speed - * Elegant code - * Clean design + * Elegant code and clean design + * Type and core cleanly seperated + * Small codebase in core * Good documentation (man pages) - * Meaningful error messages - * The no surprise factor * Consistency in behaviour, naming and documentation + * Meaningful error messages + * Either standard error messages from tools or added description for clearification + * The no surprise factor + * No magic guessing of what the user wants + * Simple and well-known DSL + * Posix shell * Easy integration into bare metal installations - * Simple and well-known DSL: posix shell - * It must be very easy to extend and debug cdist - * Focus on reuse of existing functionality (like sh, ssh, find, rm, ...) - * Easy upgrade: ***There is no need to update cdist on target hosts!*** - * cdist only needs to be update on the master server + * requires only ssh + sh + * Easy upgrade + * ***There is no need to update cdist on target hosts!*** + * cdist only needs to be updated on the master server(s) + * Very easy to extend + * Can be done via types, which can be stacked on top of others + * Reuse of existing functionality + * sh, ssh, find, rm, mv, ... + * Very easy to debug + * Just add set -x in the scripts ### OS support