From 2fe647a1f718979da09b8cde00f9e4c4a1ccca9f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Nov 2012 15:17:46 +0100 Subject: [PATCH 01/14] Revert "implement before/after to declare dependencies and deprecate require" Comment from asteven: Some problems showed up while updating the docs and tests. You should revert the merge for now. This reverts commit 84770b9ef2afbfa1232845ce6538b56df99cee3a. --- cdist/core/cdist_object.py | 2 -- cdist/emulator.py | 25 ++++--------------------- cdist/resolver.py | 17 +++-------------- cdist/test/object/__init__.py | 1 - 4 files changed, 7 insertions(+), 38 deletions(-) diff --git a/cdist/core/cdist_object.py b/cdist/core/cdist_object.py index 7e587bf3..90a21e59 100644 --- a/cdist/core/cdist_object.py +++ b/cdist/core/cdist_object.py @@ -186,8 +186,6 @@ class CdistObject(object): return os.path.join(self.path, "explorer") requirements = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'require')) - before = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'before')) - after = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'after')) autorequire = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'autorequire')) parameters = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.parameter_path)) explorers = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.explorer_path)) diff --git a/cdist/emulator.py b/cdist/emulator.py index bd3661d3..a9c760cb 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -23,7 +23,6 @@ import argparse import logging import os -import warnings import sys import cdist @@ -93,12 +92,8 @@ class Emulator(object): def commandline(self): """Parse command line""" - self.meta_parameters = dict.fromkeys(('after', 'before')) - meta_parser = argparse.ArgumentParser(add_help=False) - for meta_parameter in self.meta_parameters.keys(): - meta_parser.add_argument('--%s' % meta_parameter, action='append', required=False) - parser = argparse.ArgumentParser(add_help=False, parents=[meta_parser], argument_default=argparse.SUPPRESS) + parser = argparse.ArgumentParser(add_help=False, argument_default=argparse.SUPPRESS) for parameter in self.cdist_type.required_parameters: argument = "--" + parameter @@ -124,11 +119,6 @@ class Emulator(object): self.args = parser.parse_args(self.argv[1:]) self.log.debug('Args: %s' % self.args) - # Handle meta parameters - for meta_parameter in self.meta_parameters.keys(): - if meta_parameter in self.args: - self.meta_parameters[meta_parameter] = getattr(self.args, meta_parameter) - delattr(self.args, meta_parameter) def setup_object(self): # Setup object_id - FIXME: unset / do not setup anymore! @@ -185,18 +175,10 @@ class Emulator(object): def record_requirements(self): """record requirements""" - for key in ('before', 'after'): - if key in self.meta_parameters and self.meta_parameters[key]: - for value in self.meta_parameters[key]: - self.log.debug("Recording requirement: %s %s %s", self.cdist_object.name, key, value) - dependency_list = getattr(self.cdist_object, key) - # append to the object.after or object.before lists - dependency_list.append(value) if "require" in self.env: - warnings.warn("The 'require' envrionment variable is deprecated. Use the --before and --after meta parameters to define dependencies.", category=PendingDeprecationWarning, stacklevel=2) - requirements = self.env['require'] + self.log.debug("reqs = " + requirements) for requirement in requirements.split(" "): # Ignore empty fields - probably the only field anyway if len(requirement) == 0: continue @@ -205,10 +187,11 @@ class Emulator(object): cdist_object = self.cdist_object.object_from_name(requirement) self.log.debug("Recording requirement: " + requirement) + # Save the sanitised version, not the user supplied one # (__file//bar => __file/bar) # This ensures pattern matching is done against sanitised list - self.cdist_object.after.append(cdist_object.name) + self.cdist_object.requirements.append(cdist_object.name) def record_auto_requirements(self): """An object shall automatically depend on all objects that it defined in it's type manifest. diff --git a/cdist/resolver.py b/cdist/resolver.py index d181d066..7e3a1a68 100644 --- a/cdist/resolver.py +++ b/cdist/resolver.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# 2011-2012 Steven Armstrong (steven-cdist at armstrong.cc) +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -109,21 +109,10 @@ class DependencyResolver(object): raise RequirementNotFoundError(pattern) def _preprocess_requirements(self): - """Find all before, after and autorequire dependencies and merge them - to be just requirements for further processing. + """Find all autorequire dependencies and merge them to be just requirements + for further processing. """ for cdist_object in self.objects.values(): - if cdist_object.after: - cdist_object.requirements.extend(cdist_object.after) - # As we changed the object on disc, we have to ensure it is not - # preprocessed again if someone would call us multiple times. - cdist_object.after = [] - if cdist_object.before: - for other_object in self.find_requirements_by_name(cdist_object.before): - other_object.requirements.append(cdist_object.name) - # As we changed the object on disc, we have to ensure it is not - # preprocessed again if someone would call us multiple times. - cdist_object.before = [] if cdist_object.autorequire: # The objects (children) that this cdist_object (parent) defined # in it's type manifest shall inherit all explicit requirements diff --git a/cdist/test/object/__init__.py b/cdist/test/object/__init__.py index 7bdc037e..3a91f709 100644 --- a/cdist/test/object/__init__.py +++ b/cdist/test/object/__init__.py @@ -87,7 +87,6 @@ class ObjectTestCase(test.CdistTestCase): self.cdist_object.code_local = '' self.cdist_object.code_remote = '' self.cdist_object.state = '' - self.cdist_object.requirements = [] def test_name(self): self.assertEqual(self.cdist_object.name, '__third/moon') From 785c9ad4aae5df68a5a074c37a0584f8e0346f12 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Nov 2012 15:20:22 +0100 Subject: [PATCH 02/14] no after/before for now (--changes) Signed-off-by: Nico Schottelius --- docs/changelog | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 943d83e4..798a5b00 100644 --- a/docs/changelog +++ b/docs/changelog @@ -10,7 +10,6 @@ next: * New Type: __user_groups (Steven Armstrong) * Type __user: Remove --groups support (now provided by __user_groups) * Type __apt_ppa: Bugfix: Installeded ppa detection (Steven Armstrong) - * Core: Support for --after and --before parameters 2.1.0pre8: 2012-11-15 * Type cleanup: __apt_ppa, __apt_ppa_update_index, __file, From 3dfad32d4c35b62f60612889e515300479e599ed Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Nov 2012 17:24:01 +0100 Subject: [PATCH 03/14] add new type: __localch_kvm_vm Signed-off-by: Nico Schottelius --- cdist/conf/type/__localch_kvm_vm/README | 10 +++ cdist/conf/type/__localch_kvm_vm/manifest | 72 +++++++++++++++++++ .../type/__localch_kvm_vm/parameter/optional | 4 ++ .../type/__localch_kvm_vm/parameter/required | 2 + 4 files changed, 88 insertions(+) create mode 100644 cdist/conf/type/__localch_kvm_vm/README create mode 100644 cdist/conf/type/__localch_kvm_vm/manifest create mode 100644 cdist/conf/type/__localch_kvm_vm/parameter/optional create mode 100644 cdist/conf/type/__localch_kvm_vm/parameter/required diff --git a/cdist/conf/type/__localch_kvm_vm/README b/cdist/conf/type/__localch_kvm_vm/README new file mode 100644 index 00000000..9752aad2 --- /dev/null +++ b/cdist/conf/type/__localch_kvm_vm/README @@ -0,0 +1,10 @@ +To be executed on the Xen Host. +Using "xe" tool from Citrix Xen. + +Todo: + + - Setup DNS -> bind + - via puppet + - move away from puppet to cdist (intrusive) + - Boot VM + - Kickstart diff --git a/cdist/conf/type/__localch_kvm_vm/manifest b/cdist/conf/type/__localch_kvm_vm/manifest new file mode 100644 index 00000000..3e5df044 --- /dev/null +++ b/cdist/conf/type/__localch_kvm_vm/manifest @@ -0,0 +1,72 @@ +################################################################################ +# Default VM parameters +# +cores=4 +memory=$((8*1024*1024*1024)) +system_disk_size=$((50*1024*1024*1024)) + +[ -f "$__object/parameter/memory" ] && memory="$(cat "$__object/parameter/memory")" +[ -f "$__object/parameter/cores" ] && cores="$(cat "$__object/parameter/cores")" +[ -f "$__object/parameter/system-disk-size" ] && system_disk_size="$(cat "$__object/parameter/system-disk-size")" + +# Convert memory to MiB (kvm/qemu requirement) +memory_mebibytes=$(($memory/(1024*1024))) + +################################################################################ +# Required VM parameters +# +nic_pz="$(cat "$__object/parameter/nic-pz")" +nic_fz="$(cat "$__object/parameter/nic-fz")" +vm=$__object_id + +basedir=/opt/local.ch/sys/kvm/vm/$vm +system_disk=$basedir/system-disk +start_on_boot=$basedir/start-on-boot +vnc_socket=unix:$basedir/vnc +pidfile=$basedir/pid +monitor=$basedir/monitor + +mkdir -p "$__object/files" +start_file_source=$__object/files/start +start_file_destination=$basedir/start + +#Base VM directory +__directory $basedir --parents yes \ + --owner root --group root + +cat << eof > "$start_file_source" +#!/bin/sh +# Generated shell script - do not modify +# + +/usr/libexec/qemu-kvm \\ + -name $vm \\ + -enable-kvm \\ + -m $memory_mebibytes \\ + -drive file=${system_disk},if=virtio \\ + -vnc $vnc_socket \\ + -cpu host \\ + -boot order=nc \\ + -pidfile "$pidfile" \\ + -monitor "unix:$monitor,server,nowait" \\ + -net nic,macaddr=$nic_pz,model=virtio,vlan=200 \\ + -net tap,script=/opt/local.ch/sys/kvm/bin/ifup-pz,downscript=/opt/local.ch/sys/kvm/bin/ifdown,vlan=200 \\ + -net nic,macaddr=$nic_fz,model=virtio,vlan=300 \\ + -net tap,script=/opt/local.ch/sys/kvm/bin/ifup-fz,downscript=/opt/local.ch/sys/kvm/bin/ifdown,vlan=300 \\ + -smp $cores +eof + +require="__directory/$basedir" __file $start_file_destination \ + --source $start_file_source --mode 0755 --owner root --group root + +require="__directory/$basedir" __qemu_img "$system_disk" \ + --size "$system_disk_size" + +# Normally, create a flag to start a VM on boot (if not +# explicitly told we should not) +if [ ! -f "$__object/parameter/do-not-start-on-boot" ]; then + require="__directory/$basedir" __file "$start_on_boot" \ + --mode 0600 --owner root --group root +else + __file "$start_on_boot" --state absent +fi diff --git a/cdist/conf/type/__localch_kvm_vm/parameter/optional b/cdist/conf/type/__localch_kvm_vm/parameter/optional new file mode 100644 index 00000000..1b05d9fb --- /dev/null +++ b/cdist/conf/type/__localch_kvm_vm/parameter/optional @@ -0,0 +1,4 @@ +cores +memory +system-disk-size +do-not-start-on-boot diff --git a/cdist/conf/type/__localch_kvm_vm/parameter/required b/cdist/conf/type/__localch_kvm_vm/parameter/required new file mode 100644 index 00000000..01161205 --- /dev/null +++ b/cdist/conf/type/__localch_kvm_vm/parameter/required @@ -0,0 +1,2 @@ +nic-pz +nic-fz From a6452cfabd1215decdfaa8dbe4e254fb272f189f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Nov 2012 17:24:38 +0100 Subject: [PATCH 04/14] rename type to reflect new environment Signed-off-by: Nico Schottelius --- cdist/conf/type/{__localch_kvm_vm => __nico_kvm_vm}/README | 0 cdist/conf/type/{__localch_kvm_vm => __nico_kvm_vm}/manifest | 0 .../type/{__localch_kvm_vm => __nico_kvm_vm}/parameter/optional | 0 .../type/{__localch_kvm_vm => __nico_kvm_vm}/parameter/required | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename cdist/conf/type/{__localch_kvm_vm => __nico_kvm_vm}/README (100%) rename cdist/conf/type/{__localch_kvm_vm => __nico_kvm_vm}/manifest (100%) rename cdist/conf/type/{__localch_kvm_vm => __nico_kvm_vm}/parameter/optional (100%) rename cdist/conf/type/{__localch_kvm_vm => __nico_kvm_vm}/parameter/required (100%) diff --git a/cdist/conf/type/__localch_kvm_vm/README b/cdist/conf/type/__nico_kvm_vm/README similarity index 100% rename from cdist/conf/type/__localch_kvm_vm/README rename to cdist/conf/type/__nico_kvm_vm/README diff --git a/cdist/conf/type/__localch_kvm_vm/manifest b/cdist/conf/type/__nico_kvm_vm/manifest similarity index 100% rename from cdist/conf/type/__localch_kvm_vm/manifest rename to cdist/conf/type/__nico_kvm_vm/manifest diff --git a/cdist/conf/type/__localch_kvm_vm/parameter/optional b/cdist/conf/type/__nico_kvm_vm/parameter/optional similarity index 100% rename from cdist/conf/type/__localch_kvm_vm/parameter/optional rename to cdist/conf/type/__nico_kvm_vm/parameter/optional diff --git a/cdist/conf/type/__localch_kvm_vm/parameter/required b/cdist/conf/type/__nico_kvm_vm/parameter/required similarity index 100% rename from cdist/conf/type/__localch_kvm_vm/parameter/required rename to cdist/conf/type/__nico_kvm_vm/parameter/required From 8408f433e997ed7eccbafd5fe847da8bce2704b6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Nov 2012 17:27:35 +0100 Subject: [PATCH 05/14] remove type from here - goes into cdist-nico repo Signed-off-by: Nico Schottelius --- cdist/conf/type/__nico_kvm_vm/README | 10 --- cdist/conf/type/__nico_kvm_vm/manifest | 72 ------------------- .../type/__nico_kvm_vm/parameter/optional | 4 -- .../type/__nico_kvm_vm/parameter/required | 2 - 4 files changed, 88 deletions(-) delete mode 100644 cdist/conf/type/__nico_kvm_vm/README delete mode 100644 cdist/conf/type/__nico_kvm_vm/manifest delete mode 100644 cdist/conf/type/__nico_kvm_vm/parameter/optional delete mode 100644 cdist/conf/type/__nico_kvm_vm/parameter/required diff --git a/cdist/conf/type/__nico_kvm_vm/README b/cdist/conf/type/__nico_kvm_vm/README deleted file mode 100644 index 9752aad2..00000000 --- a/cdist/conf/type/__nico_kvm_vm/README +++ /dev/null @@ -1,10 +0,0 @@ -To be executed on the Xen Host. -Using "xe" tool from Citrix Xen. - -Todo: - - - Setup DNS -> bind - - via puppet - - move away from puppet to cdist (intrusive) - - Boot VM - - Kickstart diff --git a/cdist/conf/type/__nico_kvm_vm/manifest b/cdist/conf/type/__nico_kvm_vm/manifest deleted file mode 100644 index 3e5df044..00000000 --- a/cdist/conf/type/__nico_kvm_vm/manifest +++ /dev/null @@ -1,72 +0,0 @@ -################################################################################ -# Default VM parameters -# -cores=4 -memory=$((8*1024*1024*1024)) -system_disk_size=$((50*1024*1024*1024)) - -[ -f "$__object/parameter/memory" ] && memory="$(cat "$__object/parameter/memory")" -[ -f "$__object/parameter/cores" ] && cores="$(cat "$__object/parameter/cores")" -[ -f "$__object/parameter/system-disk-size" ] && system_disk_size="$(cat "$__object/parameter/system-disk-size")" - -# Convert memory to MiB (kvm/qemu requirement) -memory_mebibytes=$(($memory/(1024*1024))) - -################################################################################ -# Required VM parameters -# -nic_pz="$(cat "$__object/parameter/nic-pz")" -nic_fz="$(cat "$__object/parameter/nic-fz")" -vm=$__object_id - -basedir=/opt/local.ch/sys/kvm/vm/$vm -system_disk=$basedir/system-disk -start_on_boot=$basedir/start-on-boot -vnc_socket=unix:$basedir/vnc -pidfile=$basedir/pid -monitor=$basedir/monitor - -mkdir -p "$__object/files" -start_file_source=$__object/files/start -start_file_destination=$basedir/start - -#Base VM directory -__directory $basedir --parents yes \ - --owner root --group root - -cat << eof > "$start_file_source" -#!/bin/sh -# Generated shell script - do not modify -# - -/usr/libexec/qemu-kvm \\ - -name $vm \\ - -enable-kvm \\ - -m $memory_mebibytes \\ - -drive file=${system_disk},if=virtio \\ - -vnc $vnc_socket \\ - -cpu host \\ - -boot order=nc \\ - -pidfile "$pidfile" \\ - -monitor "unix:$monitor,server,nowait" \\ - -net nic,macaddr=$nic_pz,model=virtio,vlan=200 \\ - -net tap,script=/opt/local.ch/sys/kvm/bin/ifup-pz,downscript=/opt/local.ch/sys/kvm/bin/ifdown,vlan=200 \\ - -net nic,macaddr=$nic_fz,model=virtio,vlan=300 \\ - -net tap,script=/opt/local.ch/sys/kvm/bin/ifup-fz,downscript=/opt/local.ch/sys/kvm/bin/ifdown,vlan=300 \\ - -smp $cores -eof - -require="__directory/$basedir" __file $start_file_destination \ - --source $start_file_source --mode 0755 --owner root --group root - -require="__directory/$basedir" __qemu_img "$system_disk" \ - --size "$system_disk_size" - -# Normally, create a flag to start a VM on boot (if not -# explicitly told we should not) -if [ ! -f "$__object/parameter/do-not-start-on-boot" ]; then - require="__directory/$basedir" __file "$start_on_boot" \ - --mode 0600 --owner root --group root -else - __file "$start_on_boot" --state absent -fi diff --git a/cdist/conf/type/__nico_kvm_vm/parameter/optional b/cdist/conf/type/__nico_kvm_vm/parameter/optional deleted file mode 100644 index 1b05d9fb..00000000 --- a/cdist/conf/type/__nico_kvm_vm/parameter/optional +++ /dev/null @@ -1,4 +0,0 @@ -cores -memory -system-disk-size -do-not-start-on-boot diff --git a/cdist/conf/type/__nico_kvm_vm/parameter/required b/cdist/conf/type/__nico_kvm_vm/parameter/required deleted file mode 100644 index 01161205..00000000 --- a/cdist/conf/type/__nico_kvm_vm/parameter/required +++ /dev/null @@ -1,2 +0,0 @@ -nic-pz -nic-fz From b996dcbae187ed5ab635d884bff80553e588a88b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Nov 2012 17:42:39 +0100 Subject: [PATCH 06/14] bugfix __qemu_img Signed-off-by: Nico Schottelius --- cdist/conf/type/__qemu_img/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__qemu_img/gencode-remote b/cdist/conf/type/__qemu_img/gencode-remote index e5ff1b4f..2a76cf8f 100644 --- a/cdist/conf/type/__qemu_img/gencode-remote +++ b/cdist/conf/type/__qemu_img/gencode-remote @@ -3,7 +3,7 @@ # not existing and state != absent # state="present" -[ -f "$__object/parameter/state" ] state="$(cat "$__object/parameter/state")" +[ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")" [ "$state" = "absent" ] && exit 0 exists="$(cat "$__object/explorer/exists")" From 661e33ac4b20cab30cb1d18075ed335f42b28042 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 20 Nov 2012 18:09:57 +0100 Subject: [PATCH 07/14] document on how to speed up shell execution Signed-off-by: Nico Schottelius --- docs/man/man7/cdist-best-practice.text | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/man/man7/cdist-best-practice.text b/docs/man/man7/cdist-best-practice.text index a8851f7f..818c423a 100644 --- a/docs/man/man7/cdist-best-practice.text +++ b/docs/man/man7/cdist-best-practice.text @@ -30,6 +30,15 @@ Host * ControlPersist 10 -------------------------------------------------------------------------------- +SPEEDING UP SHELL EXECUTION +---------------------------- +On the source host, ensure that /bin/sh is *not* bash: bash is quite slow for +script execution. Instead, you could use dash after installing it: + +-------------------------------------------------------------------------------- +ln -sf /bin/dash /bin/sh +-------------------------------------------------------------------------------- + MULTI MASTER OR ENVIRONMENT SETUPS ---------------------------------- From 8bf196fdc0b62ce807ac5b526455dd64aaf6975b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 20 Nov 2012 22:41:38 +0100 Subject: [PATCH 08/14] add helpful log message when resolving dependencies Signed-off-by: Nico Schottelius --- cdist/resolver.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cdist/resolver.py b/cdist/resolver.py index 7e3a1a68..c1b2c292 100644 --- a/cdist/resolver.py +++ b/cdist/resolver.py @@ -77,6 +77,7 @@ class DependencyResolver(object): lists of all dependencies including the key object itself. """ if self._dependencies is None: + log.info("Resolving dependencies...") self._dependencies = d = {} self._preprocess_requirements() for name,cdist_object in self.objects.items(): From a1ed12b382a9efb872c28cf372746b14ae1011d5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 21 Nov 2012 09:21:13 +0100 Subject: [PATCH 09/14] roadmap proposal Signed-off-by: Nico Schottelius --- docs/dev/logs/2012-11-21.roadmap-proposal | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 docs/dev/logs/2012-11-21.roadmap-proposal diff --git a/docs/dev/logs/2012-11-21.roadmap-proposal b/docs/dev/logs/2012-11-21.roadmap-proposal new file mode 100644 index 00000000..cd60ffe6 --- /dev/null +++ b/docs/dev/logs/2012-11-21.roadmap-proposal @@ -0,0 +1,6 @@ +Target version proposed date features +2.1. 2012-12-01 initial support for before/after requirements +2.2. 2013-03-01 initial notifications support, + replace require="" with before/after +2.3. 2013-06-01 installation support: pre-os and install types +2.4. 2013-09-01 performance speedup via parallelisation From 9e9271fd4f91d859145280c732d3f5dde8fc67cc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 21 Nov 2012 09:44:38 +0100 Subject: [PATCH 10/14] why should I use cdist? Signed-off-by: Nico Schottelius --- docs/web/cdist.mdwn | 1 + docs/web/cdist/why.mdwn | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 docs/web/cdist/why.mdwn diff --git a/docs/web/cdist.mdwn b/docs/web/cdist.mdwn index ee24e910..74457fc8 100644 --- a/docs/web/cdist.mdwn +++ b/docs/web/cdist.mdwn @@ -11,6 +11,7 @@ cdist is an alternative to other configuration management systems like [cfengine](http://www.cfengine.org/) and [puppet](http://www.puppetlabs.com/). + * [[Why should I use cdist?|why]] * [[Documentation|documentation]] * [[Supported Operating Systems|os]] * [[Installation|install]] diff --git a/docs/web/cdist/why.mdwn b/docs/web/cdist/why.mdwn new file mode 100644 index 00000000..883d6338 --- /dev/null +++ b/docs/web/cdist/why.mdwn @@ -0,0 +1,37 @@ +[[!meta title="Why should I use cdist?"]] + +There are several motivations to use cdist, these +are probably the most popular ones. + +## Known language + +Cdist is being configured in +[shell script](https://en.wikipedia.org/wiki/Shell_script). +Shell script is used by UNIX system engineers for decades. +So when cdist is introduced, your staff does not need to learn a new +[DSL](https://en.wikipedia.org/wiki/Domain-specific_language) +or programming language. + +## Powerful language + +Not only is shell scripting widely known by system engineers, +but it is also a very powerful language. Here are some features +which make daily work easy: + + * Configuration can react dynamicly on explored values + * High level string manipulation (using sed, awk, grep) + * Conditional support (**if, case**) + * Loop support (**for, while**) + * Support for dependencies between cdist types + +## More than shell scripting + +If you compare regular shell scripting with cdist, there is one major +difference: When using cdist types, +the results are +[idempotent](https://en.wikipedia.org/wiki/Idempotence). +In practise, that means it does not matter in which order you +call cdist types, the result is always the same. + + +[[!tag cdist unix]] From 2b32e1e9f434744eaed836298ebd3b4b2463373b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 21 Nov 2012 11:26:52 +0100 Subject: [PATCH 11/14] more reasons to use cdist Signed-off-by: Nico Schottelius --- docs/web/cdist/why.mdwn | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/web/cdist/why.mdwn b/docs/web/cdist/why.mdwn index 883d6338..6aa3516f 100644 --- a/docs/web/cdist/why.mdwn +++ b/docs/web/cdist/why.mdwn @@ -1,5 +1,7 @@ [[!meta title="Why should I use cdist?"]] +[[!toc]] + There are several motivations to use cdist, these are probably the most popular ones. @@ -30,8 +32,40 @@ If you compare regular shell scripting with cdist, there is one major difference: When using cdist types, the results are [idempotent](https://en.wikipedia.org/wiki/Idempotence). -In practise, that means it does not matter in which order you +In practise that means it does not matter in which order you call cdist types, the result is always the same. +## Zero dependency configuration management + +Cdist requires very litte on a target system. Even better, +in almost all cases all dependencies are usually fulfilled. +Cdist does not require an agent or a high level programming +languages on the target host: it will run on any host that +has an **ssh server running** and a posix compatible shell +(**/bin/sh**). + +## Push based distribution + +Cdist uses the push based model for configuration. In this +scenario, one (or more) computers connect the target hosts +and apply the configuration. That way the source host has +very little requirements: Cdist can even run on a sysadmin +notebook that is loosely connected to the network and has +limited amount of resources. + +Furthermore, from a security point of view, only one machine +needs access to the target hosts. No target hosts will ever +need to connect back to the source host, which contains the +full configuration. + +## Highly scalable + +If at some point you manage more hosts than can be handled from +a single source host, you can simply add more resources: Either +add more cores to one host or add hosts. +Cdist will utilise the given resources in parallel. + +## Integration into inventory management + [[!tag cdist unix]] From 4d63694e20b3d564d148e272b0afb0c6c8002649 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 21 Nov 2012 11:34:32 +0100 Subject: [PATCH 12/14] introduce new web-doc target to publish only the web documentation Signed-off-by: Nico Schottelius --- build | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build b/build index fb01c565..6fe8960f 100755 --- a/build +++ b/build @@ -331,14 +331,17 @@ eof done ;; - web) - set -e + web-doc) rsync -av "${basedir}/docs/web/" "${WEBTOPDIR}" cd "${WEBDIR}" && git add "${WEBBASE}" cd "${WEBDIR}" && git commit -m "cdist update" "${WEBBASE}" "${WEBPAGE}" cd "${WEBDIR}" && make pub + ;; + web) + set -e + $0 web-doc # Fix ikiwiki, which does not like symlinks for pseudo security ssh tee.schottelius.org \ "cd /home/services/www/nico/www.nico.schottelius.org/www/software/cdist/man && From 9c99346ddf77935a81d80d24472ffa232b506847 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 21 Nov 2012 16:09:00 +0100 Subject: [PATCH 13/14] remove emtpy heading Signed-off-by: Nico Schottelius --- docs/web/cdist/why.mdwn | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/web/cdist/why.mdwn b/docs/web/cdist/why.mdwn index 6aa3516f..0fcdf5c5 100644 --- a/docs/web/cdist/why.mdwn +++ b/docs/web/cdist/why.mdwn @@ -65,7 +65,4 @@ a single source host, you can simply add more resources: Either add more cores to one host or add hosts. Cdist will utilise the given resources in parallel. -## Integration into inventory management - - [[!tag cdist unix]] From 0c15d0ff024db2cfa8f29a8fcec39c5bd8b1e5b3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 21 Nov 2012 22:52:14 +0100 Subject: [PATCH 14/14] ++ideas Signed-off-by: Nico Schottelius --- docs/dev/logs/2012-11-21.idea-shell-testing | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/dev/logs/2012-11-21.idea-shell-testing diff --git a/docs/dev/logs/2012-11-21.idea-shell-testing b/docs/dev/logs/2012-11-21.idea-shell-testing new file mode 100644 index 00000000..2a657053 --- /dev/null +++ b/docs/dev/logs/2012-11-21.idea-shell-testing @@ -0,0 +1,3 @@ +Use roundup for testing included types? + + http://bmizerany.github.com/roundup/