From 2f88521d41d4288cdf767ba996c4f7365a5be21a Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 8 Mar 2011 21:43:36 +0100 Subject: [PATCH 01/74] ads --- asd | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 asd diff --git a/asd b/asd new file mode 100644 index 00000000..e69de29b From adbf670309fae0b4e9513d846689fac4f541fbe9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 14 Mar 2011 18:25:57 +0100 Subject: [PATCH 02/74] +mercurial Signed-off-by: Nico Schottelius --- REAL_README | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/REAL_README b/REAL_README index 0938289f..88d5de13 100644 --- a/REAL_README +++ b/REAL_README @@ -165,7 +165,8 @@ Yes, I'm actually eating my own dogfood and currently managing * [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication) * [ircd-hybrid](http://www.ircd-hybrid.org/) (chat) * [stunnel](http://stunnel.mirt.net/) (SSL tunnel) + * [mercurial-server](http://www.lshift.net/mercurial-server.html) -with cdist on a total of **3** production servers of the +with cdist on a total of **4** production servers of the [Systems Group](http://www.systems.ethz.ch) at the [ETH Zurich](http://www.ethz.ch). From 27286c787dc468451ebaeb84ca6e20134462c574 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 14 Mar 2011 23:12:14 +0100 Subject: [PATCH 03/74] document files/ directories (in object and type) Signed-off-by: Nico Schottelius --- doc/man/cdist-type.text | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/man/cdist-type.text b/doc/man/cdist-type.text index 7c8b49f3..f8811a16 100644 --- a/doc/man/cdist-type.text +++ b/doc/man/cdist-type.text @@ -179,6 +179,14 @@ level tools like ruby installed. If a type requires specific tools to be present on the target, there must be another type that provides this tool and the first type should create an object of the specific type. +If your type wants to save temporay data, that may be used by other types +later on (for instance __file), you can save them in the subdirectory +"files" below $__object (but you must create it yourself). cdist will not touch +this directory. + +If your type contains static files, it's also recommened to place them in +a folder named "files" within the type (again, because cdist guarantees to +never ever touch this folder). HOW TO INCLUDE A TYPE INTO UPSTREAM CDIST ----------------------------------------- From 710ce98386848ecc1ce6a8c5f1fa426a22881ffa Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 14 Mar 2011 23:23:32 +0100 Subject: [PATCH 04/74] [DOC] __package_pacman gained manpage Signed-off-by: Nico Schottelius --- conf/type/__package_pacman/man.text | 53 +++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 conf/type/__package_pacman/man.text diff --git a/conf/type/__package_pacman/man.text b/conf/type/__package_pacman/man.text new file mode 100644 index 00000000..35a7e44c --- /dev/null +++ b/conf/type/__package_pacman/man.text @@ -0,0 +1,53 @@ +cdist-type__package_pacman(7) +============================= +Nico Schottelius + + +NAME +---- +cdist-type__package_pacman - Manage packages with pacman + + +DESCRIPTION +----------- +Pacman is usually used on the Archlinux distribution to manage +packages. + + +REQUIRED PARAMETERS +------------------- +state:: + Either "installed" or "deinstalled". + + +OPTIONAL PARAMETERS +------------------- +name:: + If supplied, use the name and not the object id as the package name. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Ensure zsh in installed +__package_pacman zsh --state installed + +# If you don't want to follow pythonX packages, but always use python +__package_pacman python --state installed --name python2 + +# Remove obsolete package +__package_pacman puppet --state deinstalled +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- cdist-type__package(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 49d3548f46581535de7adc7d8444fb930f9105fc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 14 Mar 2011 23:41:36 +0100 Subject: [PATCH 05/74] support debian/ubuntu in __motd Signed-off-by: Nico Schottelius --- conf/type/__motd/manifest | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/conf/type/__motd/manifest b/conf/type/__motd/manifest index 594977b9..a6e963f1 100755 --- a/conf/type/__motd/manifest +++ b/conf/type/__motd/manifest @@ -19,8 +19,6 @@ # # -destination=/etc/motd - # Select motd source if [ -f "$__object/parameter/source" ]; then source="$(cat "$__object/parameter/source")" @@ -28,4 +26,16 @@ else source="$__type/files/motd" fi +os=$(cat $__global/explorer/os) + + +case "$os" in + debian|ubuntu) + destination=/etc/motd.tail + ;; + *) + destination=/etc/motd + ;; +esac + __file "$destination" --source "$source" --type file From 1187a8594afb17205209376032dd62ca66e8c2fa Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 14 Mar 2011 23:41:46 +0100 Subject: [PATCH 06/74] more stuff for upcoming 1.0.4 Signed-off-by: Nico Schottelius --- conf/manifest/init | 1 + doc/changelog | 1 + 2 files changed, 2 insertions(+) diff --git a/conf/manifest/init b/conf/manifest/init index 0a1dca50..aa1a51da 100755 --- a/conf/manifest/init +++ b/conf/manifest/init @@ -14,6 +14,7 @@ case "$__target_host" in localhost) # Usual example __file test --type symlink --source /etc/cdist-configured --destination /tmp/cdist-testfile + __motd ;; # diff --git a/doc/changelog b/doc/changelog index c939b547..dc332cf2 100644 --- a/doc/changelog +++ b/doc/changelog @@ -2,6 +2,7 @@ * New type __motd * New type __addifnosuchline * Document type __issue + * Document type __package_pacman 1.0.3: 2011-03-11 * Update regexp used for sane characters From 8ff02673f0deca02e003c2a66bab0b3f524192ae Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 14 Mar 2011 23:43:00 +0100 Subject: [PATCH 07/74] remove __motd from localhost (not good as an example for testers) Signed-off-by: Nico Schottelius --- conf/manifest/init | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/manifest/init b/conf/manifest/init index aa1a51da..0a1dca50 100755 --- a/conf/manifest/init +++ b/conf/manifest/init @@ -14,7 +14,6 @@ case "$__target_host" in localhost) # Usual example __file test --type symlink --source /etc/cdist-configured --destination /tmp/cdist-testfile - __motd ;; # From 5821ceebbc3d7afeeaf3db7c34d4a0a8f9327636 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 00:00:25 +0100 Subject: [PATCH 08/74] add support for --owner and --group in __file Signed-off-by: Nico Schottelius --- conf/type/__file/gencode | 13 +++++++++++-- conf/type/__file/parameter/optional | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/conf/type/__file/gencode b/conf/type/__file/gencode index 5f386349..4921815c 100755 --- a/conf/type/__file/gencode +++ b/conf/type/__file/gencode @@ -109,6 +109,15 @@ esac # Mode settings if [ -f "$__object/parameter/mode" ]; then - mode="$(cat "$__object/parameters/mode")" - echo chmod \"$mode\" \"$destination\" + echo chmod \"$(cat "$__object/parameters/mode")\" \"$destination\" +fi + +# Group +if [ -f "$__object/parameter/group" ]; then + echo chgrp \"$(cat "$__object/parameters/group")\" \"$destination\" +fi + +# Owner +if [ -f "$__object/parameter/owner" ]; then + echo chown \"$(cat "$__object/parameters/owner")\" \"$destination\" fi diff --git a/conf/type/__file/parameter/optional b/conf/type/__file/parameter/optional index de17ffff..0c30f4be 100644 --- a/conf/type/__file/parameter/optional +++ b/conf/type/__file/parameter/optional @@ -1,3 +1,5 @@ +group mode +owner source destination From 2d4cbdddab02c94023fd54bdc0504cbd5f286cac Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 00:05:38 +0100 Subject: [PATCH 09/74] document new features Signed-off-by: Nico Schottelius --- conf/type/__file/man.text | 11 +++++++++++ doc/changelog | 1 + 2 files changed, 12 insertions(+) diff --git a/conf/type/__file/man.text b/conf/type/__file/man.text index 04e0ffc3..e1c13db8 100644 --- a/conf/type/__file/man.text +++ b/conf/type/__file/man.text @@ -25,9 +25,15 @@ destination:: If supplied, use this as the destination on the target. Otherwise the object_id is used. +group:: + Group to chgrp to. + mode:: Unix permissions, suitable for chmod. +owner:: + User to chown to. + source:: If supplied, copy this file from the host running cdist to the target. If not supplied, an empty file or directory will be created. @@ -45,6 +51,11 @@ __file cdist-marker --type file --destination /etc/cdist-configured # Use __file from another type __file /etc/issue --source "$__type/files/archlinux" --type file + +# Supply some more settings +__file /etc/shadow --source "$__type/files/shadow" --type file \ + --owner root --group shadow --mode 0640 + -------------------------------------------------------------------------------- diff --git a/doc/changelog b/doc/changelog index dc332cf2..e712c15f 100644 --- a/doc/changelog +++ b/doc/changelog @@ -3,6 +3,7 @@ * New type __addifnosuchline * Document type __issue * Document type __package_pacman + * New parameter for __file: --owner and --group 1.0.3: 2011-03-11 * Update regexp used for sane characters From fe2d4877ced09d6f8999ccd95b052d233d05e8a4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 00:06:50 +0100 Subject: [PATCH 10/74] -plural (old stuff) Signed-off-by: Nico Schottelius --- conf/type/__file/gencode | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/type/__file/gencode b/conf/type/__file/gencode index 4921815c..531cc203 100755 --- a/conf/type/__file/gencode +++ b/conf/type/__file/gencode @@ -109,15 +109,15 @@ esac # Mode settings if [ -f "$__object/parameter/mode" ]; then - echo chmod \"$(cat "$__object/parameters/mode")\" \"$destination\" + echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\" fi # Group if [ -f "$__object/parameter/group" ]; then - echo chgrp \"$(cat "$__object/parameters/group")\" \"$destination\" + echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\" fi # Owner if [ -f "$__object/parameter/owner" ]; then - echo chown \"$(cat "$__object/parameters/owner")\" \"$destination\" + echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\" fi From aa4a23e7dd1ddffe6ef6e92dc3a0095720a663ca Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 00:18:31 +0100 Subject: [PATCH 11/74] doc: -\n Signed-off-by: Nico Schottelius --- conf/type/__file/man.text | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/type/__file/man.text b/conf/type/__file/man.text index e1c13db8..c60ada44 100644 --- a/conf/type/__file/man.text +++ b/conf/type/__file/man.text @@ -55,7 +55,6 @@ __file /etc/issue --source "$__type/files/archlinux" --type file # Supply some more settings __file /etc/shadow --source "$__type/files/shadow" --type file \ --owner root --group shadow --mode 0640 - -------------------------------------------------------------------------------- From 0aad5724612db50f04d5e8f223d0149f955171a4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 13:01:03 +0100 Subject: [PATCH 12/74] define dependency handling Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-03-15 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 doc/dev/logs/2011-03-15 diff --git a/doc/dev/logs/2011-03-15 b/doc/dev/logs/2011-03-15 new file mode 100644 index 00000000..66de8aed --- /dev/null +++ b/doc/dev/logs/2011-03-15 @@ -0,0 +1,27 @@ +Steven, Nico + +How to handle dependencies: + +1) Add --require parameter for all types + - Special handling in cdist-type-emulator + + Everything on one line + +2) Add __require type + + No change in core + - Type influences core + - Additional line + - Core needs to know about requirements + +3) cdist-require as a seperate executable + + No change in cdist-type-emulator + - new behaviour + - first time cdist-xxx dependency in types + +4) require="" environment variable for cdist-type-emulator + + on one line / same context + + special handling is ok for special case + + doesn't touch parameters (i.e. type still has full control) + +-------------------------------------------------------------------------------- + +Result: Use version 4. From dfdd7644b2515dff05b0f22981bb121f8699ffda Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 16:29:11 +0100 Subject: [PATCH 13/74] make footer aequivalent to header Signed-off-by: Nico Schottelius --- bin/cdist-deploy-to | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index 35c058d9..7f66888f 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -67,4 +67,4 @@ cdist-dir push "$__cdist_target_host" "$__cdist_out_object_dir" \ # And finally - execute the code cdist-code-run-all "$__cdist_target_host" -echo "Configuration successfully finished for $__cdist_target_host" +echo "cdist $__cdist_version: success on $__cdist_target_host" From 77381b9981fe3b9730e834522f0ae6fe0339cc26 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 16:35:04 +0100 Subject: [PATCH 14/74] cleanup manpages for __issue and __motd Signed-off-by: Nico Schottelius --- conf/type/__issue/man.text | 2 +- conf/type/__motd/man.text | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/type/__issue/man.text b/conf/type/__issue/man.text index 57ece530..18d88947 100644 --- a/conf/type/__issue/man.text +++ b/conf/type/__issue/man.text @@ -1,5 +1,5 @@ cdist-type__issue(7) -=================== +==================== Nico Schottelius diff --git a/conf/type/__motd/man.text b/conf/type/__motd/man.text index 1fca60d3..a4ca80b5 100644 --- a/conf/type/__motd/man.text +++ b/conf/type/__motd/man.text @@ -33,7 +33,7 @@ EXAMPLES __motd # Supply source file from a different type -__file --source "$__type/files/my-motd" +__motd --source "$__type/files/my-motd" -------------------------------------------------------------------------------- From 63452e0feefa68954d81c53a0a7a646c0777756c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 16:37:34 +0100 Subject: [PATCH 15/74] document __package_apt Signed-off-by: Nico Schottelius --- conf/type/__package_apt/man.text | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 conf/type/__package_apt/man.text diff --git a/conf/type/__package_apt/man.text b/conf/type/__package_apt/man.text new file mode 100644 index 00000000..0780124d --- /dev/null +++ b/conf/type/__package_apt/man.text @@ -0,0 +1,53 @@ +cdist-type__package_apt(7) +========================== +Nico Schottelius + + +NAME +---- +cdist-type__package_apt - Manage packages with apt-get + + +DESCRIPTION +----------- +apt-get is usually used on Debian and variants (like Ubuntu) to +manage packages. + + +REQUIRED PARAMETERS +------------------- +state:: + Either "installed" or "deinstalled". + + +OPTIONAL PARAMETERS +------------------- +name:: + If supplied, use the name and not the object id as the package name. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Ensure zsh in installed +__package_apt zsh --state installed + +# In case you only want *a* webserver, but don't care which one +__package_apt webserver --state installed --name nginx + +# Remove obsolete package +__package_apt puppet --state deinstalled +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- cdist-type__package(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 05742ae432f2b98c74e5f7c4fc9809f322433784 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 16:38:25 +0100 Subject: [PATCH 16/74] +changelog Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index e712c15f..50fb9de1 100644 --- a/doc/changelog +++ b/doc/changelog @@ -3,6 +3,7 @@ * New type __addifnosuchline * Document type __issue * Document type __package_pacman + * Document type __package_apt * New parameter for __file: --owner and --group 1.0.3: 2011-03-11 From 8d8491232c4e2a90861c023161b10a6dabc4283b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 16:41:04 +0100 Subject: [PATCH 17/74] add template for type __directory Signed-off-by: Nico Schottelius --- conf/type/__directory/explorer/exists | 34 ++++++++++++ conf/type/__directory/gencode | 63 ++++++++++++++++++++++ conf/type/__directory/man.text | 69 ++++++++++++++++++++++++ conf/type/__directory/parameter/optional | 5 ++ conf/type/__directory/parameter/required | 1 + 5 files changed, 172 insertions(+) create mode 100755 conf/type/__directory/explorer/exists create mode 100755 conf/type/__directory/gencode create mode 100644 conf/type/__directory/man.text create mode 100644 conf/type/__directory/parameter/optional create mode 100644 conf/type/__directory/parameter/required diff --git a/conf/type/__directory/explorer/exists b/conf/type/__directory/explorer/exists new file mode 100755 index 00000000..b0be82fc --- /dev/null +++ b/conf/type/__directory/explorer/exists @@ -0,0 +1,34 @@ +#!/bin/sh +# +# 2011 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 . +# +# +# Check whether file exists or not +# + +if [ -f "$__object/parameter/destination" ]; then + destination="$(cat "$__object/parameter/destination")" +else + destination="/$__object_id" +fi + +if [ -e "$destination" ]; then + echo yes +else + echo no +fi diff --git a/conf/type/__directory/gencode b/conf/type/__directory/gencode new file mode 100755 index 00000000..08429b14 --- /dev/null +++ b/conf/type/__directory/gencode @@ -0,0 +1,63 @@ +#!/bin/sh +# +# 2011 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 . +# +# +# Handle directories +# + +# If destination was specified, do not use the id +if [ -f "$__object/parameter/destination" ]; then + destination="$(cat "$__object/parameter/destination")" +else + # If no destination has been supplied, the id is the destination + # Prepend /, which got lost in the object id (and relative paths + # don't make sense) + destination="/$__object_id" +fi + +# Ensure we have an absolute path +if ! $(echo "$destination" | grep -q ^/); then + echo "Error: Destination ($destination) of $__object_id is not absolute." >&2 + exit 1 +fi + +if [ -f "$__object/parameter/source" ]; then + echo "Source not supported for directory currently - FIXME" >&2 + exit 1 +else + if [ no = "$(cat "$__object/explorer/exists")" ]; then + echo mkdir \"$destination\" + fi +fi + + +# Mode settings +if [ -f "$__object/parameter/mode" ]; then + echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\" +fi + +# Group +if [ -f "$__object/parameter/group" ]; then + echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\" +fi + +# Owner +if [ -f "$__object/parameter/owner" ]; then + echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\" +fi diff --git a/conf/type/__directory/man.text b/conf/type/__directory/man.text new file mode 100644 index 00000000..c60ada44 --- /dev/null +++ b/conf/type/__directory/man.text @@ -0,0 +1,69 @@ +cdist-type__file(7) +=================== +Nico Schottelius + + +NAME +---- +cdist-type__file - Create files + + +DESCRIPTION +----------- +This cdist type allows you to create files on the target. + + +REQUIRED PARAMETERS +------------------- +type:: + Specifies the type of file to be created. Either "directory" or "file" + + +OPTIONAL PARAMETERS +------------------- +destination:: + If supplied, use this as the destination on the target. Otherwise the + object_id is used. + +group:: + Group to chgrp to. + +mode:: + Unix permissions, suitable for chmod. + +owner:: + User to chown to. + +source:: + If supplied, copy this file from the host running cdist to the target. + If not supplied, an empty file or directory will be created. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Create /etc/cdist-configured as an empty file +__file /etc/cdist-configured --type file + +# Same but with a different object id +__file cdist-marker --type file --destination /etc/cdist-configured + +# Use __file from another type +__file /etc/issue --source "$__type/files/archlinux" --type file + +# Supply some more settings +__file /etc/shadow --source "$__type/files/shadow" --type file \ + --owner root --group shadow --mode 0640 +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(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). diff --git a/conf/type/__directory/parameter/optional b/conf/type/__directory/parameter/optional new file mode 100644 index 00000000..0c30f4be --- /dev/null +++ b/conf/type/__directory/parameter/optional @@ -0,0 +1,5 @@ +group +mode +owner +source +destination diff --git a/conf/type/__directory/parameter/required b/conf/type/__directory/parameter/required new file mode 100644 index 00000000..aa80e646 --- /dev/null +++ b/conf/type/__directory/parameter/required @@ -0,0 +1 @@ +type From 4f8932c1427b3491f05dd289fd08e448d67e3bac Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 15 Mar 2011 19:07:58 +0100 Subject: [PATCH 18/74] Documented parameters for __addifnosuchline --- .../to_check/cdist-type-addifnosuchline.text | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/man/to_check/cdist-type-addifnosuchline.text b/doc/man/to_check/cdist-type-addifnosuchline.text index 09618dc3..12690000 100644 --- a/doc/man/to_check/cdist-type-addifnosuchline.text +++ b/doc/man/to_check/cdist-type-addifnosuchline.text @@ -19,6 +19,31 @@ cdist-type-addifnosuchline can be used to check a file for existence of a specific line and adding that if not found +REQUIRED PARAMETERS +------------------- +line:: + Specifies the content which shall be added if not existing. + + +OPTIONAL PARAMETERS +------------------- +file:: + If supplied, use this as the destination file. Otherwise the + object_id is used. + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Creates or appends the line specifiend in "foo" to the file "bar" + +__addifnosuchline foo --file bar --line foo + +# Adds the line "foo2" to the file "bar" +__addifnosuchline foo --file bar --line foo2 + +-------------------------------------------------------------------------------- + SEE ALSO -------- cdist(7) From 7c4cff6286ffa121df9bb8d6624c289df03c94a0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 19:56:49 +0100 Subject: [PATCH 19/74] + type proposal Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-03-15.file_directory_link | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 doc/dev/logs/2011-03-15.file_directory_link diff --git a/doc/dev/logs/2011-03-15.file_directory_link b/doc/dev/logs/2011-03-15.file_directory_link new file mode 100644 index 00000000..ba4607ca --- /dev/null +++ b/doc/dev/logs/2011-03-15.file_directory_link @@ -0,0 +1,7 @@ +Proposal for new types, which replace __file: + +__directory /etc [--mode --owner --group --parents [yes|no] ] + +__link /destination --source abc --type [symbolic|hard] + +__file /etc/passwd [--source] --mode --owner --group From f306004c9ca018abad6e1e1207ace40f01035127 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 15 Mar 2011 20:16:56 +0100 Subject: [PATCH 20/74] Moved manpages for addifnosuchline --- asd | 0 doc/man/{to_check => }/cdist-type-addifnosuchline.text | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 asd rename doc/man/{to_check => }/cdist-type-addifnosuchline.text (100%) diff --git a/asd b/asd deleted file mode 100644 index e69de29b..00000000 diff --git a/doc/man/to_check/cdist-type-addifnosuchline.text b/doc/man/cdist-type-addifnosuchline.text similarity index 100% rename from doc/man/to_check/cdist-type-addifnosuchline.text rename to doc/man/cdist-type-addifnosuchline.text From 3d24edae511bb57002b62e2e5a4c0a8d8a223a87 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 20:37:23 +0100 Subject: [PATCH 21/74] + template for __link Signed-off-by: Nico Schottelius --- conf/type/__link/gencode | 43 ++++++++++++++++++++++ conf/type/__link/man.text | 57 +++++++++++++++++++++++++++++ conf/type/__link/parameter/optional | 5 +++ conf/type/__link/parameter/required | 1 + 4 files changed, 106 insertions(+) create mode 100755 conf/type/__link/gencode create mode 100644 conf/type/__link/man.text create mode 100644 conf/type/__link/parameter/optional create mode 100644 conf/type/__link/parameter/required diff --git a/conf/type/__link/gencode b/conf/type/__link/gencode new file mode 100755 index 00000000..4a97ac34 --- /dev/null +++ b/conf/type/__link/gencode @@ -0,0 +1,43 @@ +#!/bin/sh +# +# 2011 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 . +# +# +# __file is a very basic type and should be able to be used as an +# example for typewrites later +# + +destination="/$__object_id" + +type="$(cat "$__object/parameter/type")" +source="$(cat "$__object/parameter/source")" + +case "$type" in + symbolic) + lnopt="-s" + ;; + hard) + lnopt="" + ;; + *) + echo "Unknown type: $type" >&2 + exit 1 + ;; +esac + +echo ln ${lnopts} -f \"$source\" \"$destination\" diff --git a/conf/type/__link/man.text b/conf/type/__link/man.text new file mode 100644 index 00000000..5022697a --- /dev/null +++ b/conf/type/__link/man.text @@ -0,0 +1,57 @@ +cdist-type__link(7) +=================== +Nico Schottelius + + +NAME +---- +cdist-type__link - Create links + + +DESCRIPTION +----------- +This cdist type allows you to hard and symoblic links. The given +object id is the destination for the link. + + +REQUIRED PARAMETERS +------------------- +source:: + Specifies the link source. + +source:: + Specifies the link type: Either hard or symoblic. + + +OPTIONAL PARAMETERS +------------------- +None. + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Create /etc/cdist-configured as an empty file +__file /etc/cdist-configured --type file + +# Same but with a different object id +__file cdist-marker --type file --destination /etc/cdist-configured + +# Use __file from another type +__file /etc/issue --source "$__type/files/archlinux" --type file + +# Supply some more settings +__file /etc/shadow --source "$__type/files/shadow" --type file \ + --owner root --group shadow --mode 0640 +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(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). diff --git a/conf/type/__link/parameter/optional b/conf/type/__link/parameter/optional new file mode 100644 index 00000000..0c30f4be --- /dev/null +++ b/conf/type/__link/parameter/optional @@ -0,0 +1,5 @@ +group +mode +owner +source +destination diff --git a/conf/type/__link/parameter/required b/conf/type/__link/parameter/required new file mode 100644 index 00000000..aa80e646 --- /dev/null +++ b/conf/type/__link/parameter/required @@ -0,0 +1 @@ +type From b8c68fcb9eacd5652047f7fdd763e835f65b5951 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 20:37:51 +0100 Subject: [PATCH 22/74] remove explorer for __directory Signed-off-by: Nico Schottelius --- conf/type/__directory/gencode | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/conf/type/__directory/gencode b/conf/type/__directory/gencode index 08429b14..99a89bd1 100755 --- a/conf/type/__directory/gencode +++ b/conf/type/__directory/gencode @@ -37,13 +37,8 @@ if ! $(echo "$destination" | grep -q ^/); then exit 1 fi -if [ -f "$__object/parameter/source" ]; then - echo "Source not supported for directory currently - FIXME" >&2 - exit 1 -else - if [ no = "$(cat "$__object/explorer/exists")" ]; then - echo mkdir \"$destination\" - fi +if [ no = "$(cat "$__object/explorer/exists")" ]; then + echo mkdir \"$destination\" fi From 2072fc196f3ed01b045e3836f6afb33f27fdf335 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 15 Mar 2011 20:46:15 +0100 Subject: [PATCH 23/74] Examples changed --- doc/man/cdist-type-addifnosuchline.text | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/man/cdist-type-addifnosuchline.text b/doc/man/cdist-type-addifnosuchline.text index 12690000..2222283a 100644 --- a/doc/man/cdist-type-addifnosuchline.text +++ b/doc/man/cdist-type-addifnosuchline.text @@ -15,14 +15,14 @@ cdist-type-addifnosuchline Add if no such line DESCRIPTION ----------- -cdist-type-addifnosuchline can be used to check a file for existence of a +cdist-type-addifnosuchline can be used to check a file for existence of a specific line and adding that if not found REQUIRED PARAMETERS ------------------- line:: - Specifies the content which shall be added if not existing. + Specifies the content which shall be added if not existing. OPTIONAL PARAMETERS @@ -35,12 +35,12 @@ EXAMPLES -------- -------------------------------------------------------------------------------- -# Creates or appends the line specifiend in "foo" to the file "bar" +# Creates or appends the line specifiend in "include_www" to the file "lighttpd.conf" -__addifnosuchline foo --file bar --line foo +__addifnosuchline www --file lighttpd.conf --line include_www -# Adds the line "foo2" to the file "bar" -__addifnosuchline foo --file bar --line foo2 +# Adds the line "include_git" to the file "bar" +__addifnosuchline git_web --file lighttpd.conf --line include_git -------------------------------------------------------------------------------- From 4c59a0fde14312ad06734ca0ec60ef822b5892a6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 20:51:09 +0100 Subject: [PATCH 24/74] cleanup __link Signed-off-by: Nico Schottelius --- conf/type/__link/man.text | 20 +++++++++----------- conf/type/__link/parameter/optional | 5 ----- conf/type/__link/parameter/required | 1 + 3 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 conf/type/__link/parameter/optional diff --git a/conf/type/__link/man.text b/conf/type/__link/man.text index 5022697a..db124cb9 100644 --- a/conf/type/__link/man.text +++ b/conf/type/__link/man.text @@ -19,7 +19,7 @@ REQUIRED PARAMETERS source:: Specifies the link source. -source:: +type:: Specifies the link type: Either hard or symoblic. @@ -31,18 +31,16 @@ EXAMPLES -------- -------------------------------------------------------------------------------- -# Create /etc/cdist-configured as an empty file -__file /etc/cdist-configured --type file +# Create hard link of /etc/shadow +__file /root/shadow --source /etc/shadow --type hard -# Same but with a different object id -__file cdist-marker --type file --destination /etc/cdist-configured +# Relative symbolic link +__file /etc/apache2/sites-enabled/www.test.ch \ + --source ../sites-available/www.test.ch \ + --type symbolic -# Use __file from another type -__file /etc/issue --source "$__type/files/archlinux" --type file - -# Supply some more settings -__file /etc/shadow --source "$__type/files/shadow" --type file \ - --owner root --group shadow --mode 0640 +# Relative absolute link +__file /opt/plone --source /home/services/plone --type symbolic -------------------------------------------------------------------------------- diff --git a/conf/type/__link/parameter/optional b/conf/type/__link/parameter/optional deleted file mode 100644 index 0c30f4be..00000000 --- a/conf/type/__link/parameter/optional +++ /dev/null @@ -1,5 +0,0 @@ -group -mode -owner -source -destination diff --git a/conf/type/__link/parameter/required b/conf/type/__link/parameter/required index aa80e646..f7facfb8 100644 --- a/conf/type/__link/parameter/required +++ b/conf/type/__link/parameter/required @@ -1 +1,2 @@ +source type From c010c9b2886c1786b13c2bfadeea71a61bf1e1bd Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 15 Mar 2011 21:02:47 +0100 Subject: [PATCH 25/74] moved manpages --- .../type/__addifnosuchline/man.text | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/man/cdist-type-addifnosuchline.text => conf/type/__addifnosuchline/man.text (100%) diff --git a/doc/man/cdist-type-addifnosuchline.text b/conf/type/__addifnosuchline/man.text similarity index 100% rename from doc/man/cdist-type-addifnosuchline.text rename to conf/type/__addifnosuchline/man.text From 86d98ddec4aefe663c9f5bda4fc5e38819864cd6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 21:06:18 +0100 Subject: [PATCH 26/74] begin cleanup doc for __directory Signed-off-by: Nico Schottelius --- conf/type/__directory/gencode | 31 +++++++++++++++---------------- conf/type/__directory/man.text | 20 +++++++------------- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/conf/type/__directory/gencode b/conf/type/__directory/gencode index 99a89bd1..6d226aae 100755 --- a/conf/type/__directory/gencode +++ b/conf/type/__directory/gencode @@ -20,28 +20,27 @@ # # Handle directories # +# +# __directory /etc [--mode --owner --group --parents [yes|no] ] +# -# If destination was specified, do not use the id -if [ -f "$__object/parameter/destination" ]; then - destination="$(cat "$__object/parameter/destination")" -else - # If no destination has been supplied, the id is the destination - # Prepend /, which got lost in the object id (and relative paths - # don't make sense) - destination="/$__object_id" -fi - -# Ensure we have an absolute path -if ! $(echo "$destination" | grep -q ^/); then - echo "Error: Destination ($destination) of $__object_id is not absolute." >&2 - exit 1 +destination="/$__object_id" + +# Include parent directories? +if [ -f "$__object/parameter/parents" ]; then + parents="$(cat "$__object/parameter/parents")" + if [ yes = "$parents" ]; then + mkdiropt="-p" + else + mkdiropt="" + fi fi +# Only create if not already existent if [ no = "$(cat "$__object/explorer/exists")" ]; then - echo mkdir \"$destination\" + echo mkdir $mkdiropt \"$destination\" fi - # Mode settings if [ -f "$__object/parameter/mode" ]; then echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\" diff --git a/conf/type/__directory/man.text b/conf/type/__directory/man.text index c60ada44..a619666d 100644 --- a/conf/type/__directory/man.text +++ b/conf/type/__directory/man.text @@ -1,30 +1,25 @@ -cdist-type__file(7) -=================== +cdist-type__directory(7) +======================== Nico Schottelius NAME ---- -cdist-type__file - Create files +cdist-type__directory - Create a directory DESCRIPTION ----------- -This cdist type allows you to create files on the target. +This cdist type allows you to create directories on the target. REQUIRED PARAMETERS ------------------- -type:: - Specifies the type of file to be created. Either "directory" or "file" +None. OPTIONAL PARAMETERS ------------------- -destination:: - If supplied, use this as the destination on the target. Otherwise the - object_id is used. - group:: Group to chgrp to. @@ -34,9 +29,8 @@ mode:: owner:: User to chown to. -source:: - If supplied, copy this file from the host running cdist to the target. - If not supplied, an empty file or directory will be created. +parents:: + Whether to create parents as well (mkdir -p behaviour) EXAMPLES From 1202131195f4aa4474da941b220a554fd4836a0f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 21:11:59 +0100 Subject: [PATCH 27/74] update __directory parameters Signed-off-by: Nico Schottelius --- conf/type/__directory/parameter/optional | 3 +-- conf/type/__directory/parameter/required | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 conf/type/__directory/parameter/required diff --git a/conf/type/__directory/parameter/optional b/conf/type/__directory/parameter/optional index 0c30f4be..752c3989 100644 --- a/conf/type/__directory/parameter/optional +++ b/conf/type/__directory/parameter/optional @@ -1,5 +1,4 @@ group mode owner -source -destination +parents diff --git a/conf/type/__directory/parameter/required b/conf/type/__directory/parameter/required deleted file mode 100644 index aa80e646..00000000 --- a/conf/type/__directory/parameter/required +++ /dev/null @@ -1 +0,0 @@ -type From 1619964cbbdc61e0bb88c0478a37d26113b52e77 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 21:13:01 +0100 Subject: [PATCH 28/74] __file does not require --type anymore Signed-off-by: Nico Schottelius --- conf/type/__file/man.text | 3 +-- conf/type/__file/parameter/required | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 conf/type/__file/parameter/required diff --git a/conf/type/__file/man.text b/conf/type/__file/man.text index c60ada44..22b367cb 100644 --- a/conf/type/__file/man.text +++ b/conf/type/__file/man.text @@ -15,8 +15,7 @@ This cdist type allows you to create files on the target. REQUIRED PARAMETERS ------------------- -type:: - Specifies the type of file to be created. Either "directory" or "file" +None. OPTIONAL PARAMETERS diff --git a/conf/type/__file/parameter/required b/conf/type/__file/parameter/required deleted file mode 100644 index aa80e646..00000000 --- a/conf/type/__file/parameter/required +++ /dev/null @@ -1 +0,0 @@ -type From e06e8026dd81218ff6a36bc5f9c28ec86be2921e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 21:18:15 +0100 Subject: [PATCH 29/74] begin to cleanup __file Signed-off-by: Nico Schottelius --- conf/type/__file/gencode | 96 ++++++--------------- doc/dev/logs/2011-03-15.file_directory_link | 4 +- 2 files changed, 27 insertions(+), 73 deletions(-) diff --git a/conf/type/__file/gencode b/conf/type/__file/gencode index 531cc203..bf30bb2c 100755 --- a/conf/type/__file/gencode +++ b/conf/type/__file/gencode @@ -18,27 +18,13 @@ # along with cdist. If not, see . # # -# __file is a very basic type and should be able to be used as an -# example for typewrites later +# __file is a very basic type, which will probably be reused quite often # -# If destination was specified, do not use the id -if [ -f "$__object/parameter/destination" ]; then - destination="$(cat "$__object/parameter/destination")" -else - # If no destination has been supplied, the id is the destination - # Prepend /, which got lost in the object id (and relative paths - # don't make sense) - destination="/$__object_id" -fi - -# Ensure we have an absolute path -if ! $(echo "$destination" | grep -q ^/); then - echo "Error: Destination ($destination) of $__object_id is not absolute." >&2 - exit 1 -fi +destination="/$__object_id" # Use correct md5sum binary - MacOSx is different here +# FIXME: broken: we don't know the host os! case "$os" in macosx) md5sum="md5" @@ -49,63 +35,31 @@ case "$os" in ;; esac -type="$(cat "$__object/parameter/type")" +if [ -f "$__object/parameter/source" ]; then + source="$(cat "$__object/parameter/source")" -case "$type" in - directory) - if [ -f "$__object/parameter/source" ]; then - echo "Source not supported for directory currently - FIXME" >&2 - exit 1 - else - if [ no = "$(cat "$__object/explorer/exists")" ]; then - echo mkdir \"$destination\" - fi + if [ -f "$source" ]; then + local_md5sum="$($md5sum < "$source")" + remote_md5sum="$(cat "$__object/explorer/md5sum")" + + # FIXME: Is md5sum the right approach? + if [ "$local_md5sum" != "$remote_md5sum" ]; then + # FIXME: This is ugly and hardcoded, replace after 1.0! + # Probably a better aproach is to have the user configured + # ~/.ssh/config to contain the right username + # Probably describe it in cdist-quickstart... + scp "$source" "root@${__target_host}:${destination}" fi - ;; - - file) - if [ -f "$__object/parameter/source" ]; then - source="$(cat "$__object/parameter/source")" - - if [ -f "$source" ]; then - local_md5sum="$($md5sum < "$source")" - remote_md5sum="$(cat "$__object/explorer/md5sum")" - - # FIXME: Is md5sum the right approach? - if [ "$local_md5sum" != "$remote_md5sum" ]; then - # FIXME: This is ugly and hardcoded, replace after 1.0! - # Probably a better aproach is to have the user configured - # ~/.ssh/config to contain the right username - # Probably describe it in cdist-quickstart... - scp "$source" "root@${__target_host}:${destination}" - fi - else - echo "Source \"$source\" does not exist." >&2 - exit 1 - fi - else - if [ no = "$(cat "$__object/explorer/exists")" ]; then - echo touch \"$destination\" - fi - fi - ;; - - symlink) - if [ ! -f "$__object/parameter/source" ]; then - echo "Source required for symlink" >&2 - exit 1 - fi - source="$(cat "$__object/parameter/source")" - - # FIXME: handle directories or document & ignore? - echo ln -sf \"$source\" \"$destination\" - ;; - - *) - echo "Unsupported type: \"$type\"" >&2 + else + echo "Source \"$source\" does not exist." >&2 exit 1 - ;; -esac + fi +else + if [ no = "$(cat "$__object/explorer/exists")" ]; then + echo touch \"$destination\" + fi +fi + # Mode settings if [ -f "$__object/parameter/mode" ]; then diff --git a/doc/dev/logs/2011-03-15.file_directory_link b/doc/dev/logs/2011-03-15.file_directory_link index ba4607ca..8a975750 100644 --- a/doc/dev/logs/2011-03-15.file_directory_link +++ b/doc/dev/logs/2011-03-15.file_directory_link @@ -1,7 +1,7 @@ Proposal for new types, which replace __file: -__directory /etc [--mode --owner --group --parents [yes|no] ] +x __directory /etc [--mode --owner --group --parents [yes|no] ] -__link /destination --source abc --type [symbolic|hard] +x __link /destination --source abc --type [symbolic|hard] __file /etc/passwd [--source] --mode --owner --group From 2ed638a0a2bafc52f2421f808ee61be567c53aa1 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 15 Mar 2011 21:18:18 +0100 Subject: [PATCH 30/74] Minor doc fixes --- conf/type/__addifnosuchline/man.text | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/conf/type/__addifnosuchline/man.text b/conf/type/__addifnosuchline/man.text index 2222283a..3d332cd0 100644 --- a/conf/type/__addifnosuchline/man.text +++ b/conf/type/__addifnosuchline/man.text @@ -1,21 +1,21 @@ -cdist-type-addifnosuchline(1) +cdist-type__addifnosuchline(1) ====================== Daniel Roth NAME ---- -cdist-type-addifnosuchline +cdist-type__addifnosuchline - Add if no such line SYNOPSIS -------- -cdist-type-addifnosuchline Add if no such line +cdist-type__addifnosuchline - Add if no such line DESCRIPTION ----------- -cdist-type-addifnosuchline can be used to check a file for existence of a +cdist-type__addifnosuchline - can be used to check a file for existence of a specific line and adding that if not found @@ -36,17 +36,16 @@ EXAMPLES -------------------------------------------------------------------------------- # Creates or appends the line specifiend in "include_www" to the file "lighttpd.conf" - __addifnosuchline www --file lighttpd.conf --line include_www -# Adds the line "include_git" to the file "bar" -__addifnosuchline git_web --file lighttpd.conf --line include_git +# Adds the line "include_git" to the file "lighttpd.conf" +__addifnosuchline lighttpd.conf --line include_git -------------------------------------------------------------------------------- SEE ALSO -------- -cdist(7) +- cdist-type(7) COPYING From 4a44b3bdf5cb708135123fb87a6af29305336c9c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 21:19:49 +0100 Subject: [PATCH 31/74] __file: -destination Signed-off-by: Nico Schottelius --- conf/type/__file/parameter/optional | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/type/__file/parameter/optional b/conf/type/__file/parameter/optional index 0c30f4be..06120518 100644 --- a/conf/type/__file/parameter/optional +++ b/conf/type/__file/parameter/optional @@ -2,4 +2,3 @@ group mode owner source -destination From 6f7312e877bd166992f41b9f75f603fe128b8526 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 21:25:09 +0100 Subject: [PATCH 32/74] some cleanups in cdist-type__addifnosuchline(7) Signed-off-by: Nico Schottelius --- conf/type/__addifnosuchline/man.text | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/conf/type/__addifnosuchline/man.text b/conf/type/__addifnosuchline/man.text index 3d332cd0..722a3080 100644 --- a/conf/type/__addifnosuchline/man.text +++ b/conf/type/__addifnosuchline/man.text @@ -1,22 +1,17 @@ -cdist-type__addifnosuchline(1) -====================== +cdist-type__addifnosuchline(7) +============================== Daniel Roth NAME ---- -cdist-type__addifnosuchline - Add if no such line - - -SYNOPSIS --------- -cdist-type__addifnosuchline - Add if no such line +cdist-type__addifnosuchline - Add a line (if not existing already) DESCRIPTION ----------- -cdist-type__addifnosuchline - can be used to check a file for existence of a -specific line and adding that if not found +This type can be used to check a file for existence of a +specific line and adding it, if it was not found. REQUIRED PARAMETERS @@ -28,21 +23,22 @@ line:: OPTIONAL PARAMETERS ------------------- file:: - If supplied, use this as the destination file. Otherwise the - object_id is used. + If supplied, use this as the destination file. + Otherwise the object_id is used. + EXAMPLES -------- -------------------------------------------------------------------------------- # Creates or appends the line specifiend in "include_www" to the file "lighttpd.conf" -__addifnosuchline www --file lighttpd.conf --line include_www +__addifnosuchline www --file /etc/lighttpd.conf --line include_www # Adds the line "include_git" to the file "lighttpd.conf" -__addifnosuchline lighttpd.conf --line include_git - +__addifnosuchline /etc/lighttpd.conf --line include_git -------------------------------------------------------------------------------- + SEE ALSO -------- - cdist-type(7) From b19a29be6e9928da729a3f9748906c777c033954 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 21:30:02 +0100 Subject: [PATCH 33/74] make cdist-env usable standalone (i.e. without cdist-config) Signed-off-by: Nico Schottelius --- bin/cdist-env | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/cdist-env b/bin/cdist-env index e95e078b..a7610aac 100755 --- a/bin/cdist-env +++ b/bin/cdist-env @@ -18,14 +18,14 @@ # along with cdist. If not, see . # # -# Setup environment for use with cdist +# Setup environment for use with cdist - must be standalone! # -. cdist-config -[ $# -eq 0 ] || __cdist_usage "no arguments" - -# Allow access to unset variables like PATH and MANPATH -set +u +__cdist_pwd="$(pwd -P)" +__cdist_mydir="${0%/*}"; +__cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)" +__cdist_myname=${0##*/}; +__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" echo export PATH=$__cdist_abs_mydir:$PATH From 8fa48be2aeeeb15708ea7cc627b55be9841cebf9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 21:31:11 +0100 Subject: [PATCH 34/74] change footer (looks better) Signed-off-by: Nico Schottelius --- bin/cdist-deploy-to | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index 7f66888f..d006dd2d 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -67,4 +67,4 @@ cdist-dir push "$__cdist_target_host" "$__cdist_out_object_dir" \ # And finally - execute the code cdist-code-run-all "$__cdist_target_host" -echo "cdist $__cdist_version: success on $__cdist_target_host" +echo "cdist $__cdist_version: Successfully finished run on $__cdist_target_host" From e69db644b468deaae62dabe3490779dd251f2a4e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Mar 2011 21:38:09 +0100 Subject: [PATCH 35/74] prepare version 1.0.4 Signed-off-by: Nico Schottelius --- bin/cdist-config | 2 +- doc/changelog | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cdist-config b/bin/cdist-config index 0d0fd152..61b7117f 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -19,7 +19,7 @@ # # -__cdist_version="1.0.3" +__cdist_version="1.0.4" # Fail if something bogus is going on set -u diff --git a/doc/changelog b/doc/changelog index 50fb9de1..c869c146 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,4 +1,4 @@ -1.0.4: +1.0.4: 2011-03-15 * New type __motd * New type __addifnosuchline * Document type __issue From f69802b3d89fbcd144377356f0ec4881570a0a75 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 08:25:36 +0100 Subject: [PATCH 36/74] s/md5sum/cksum/g Signed-off-by: Nico Schottelius --- conf/type/__file/explorer/{md5sum => cksum} | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) rename conf/type/__file/explorer/{md5sum => cksum} (82%) diff --git a/conf/type/__file/explorer/md5sum b/conf/type/__file/explorer/cksum similarity index 82% rename from conf/type/__file/explorer/md5sum rename to conf/type/__file/explorer/cksum index 4ac0e1b9..6bcf9cd0 100755 --- a/conf/type/__file/explorer/md5sum +++ b/conf/type/__file/explorer/cksum @@ -27,22 +27,9 @@ else destination="/$__object_id" fi -os="$(cat $__global/explorer/os)" - -case "$os" in - macosx) - md5sum="md5" - ;; - - *) - md5sum="md5sum" - ;; -esac - -# No output if file does not exist - does definitely not match the md5sum :-) if [ -e "$destination" ]; then if [ -f "$destination" ]; then - $md5sum < "$destination" + cksum < "$destination" else echo "NO REGULAR FILE" fi From 501fcf36d191ea5dcf47249950e1daf2def24539 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 08:30:02 +0100 Subject: [PATCH 37/74] remove old --destination parameter from __file explorers Signed-off-by: Nico Schottelius --- conf/type/__file/explorer/cksum | 6 +----- conf/type/__file/explorer/exists | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/conf/type/__file/explorer/cksum b/conf/type/__file/explorer/cksum index 6bcf9cd0..dcad99ba 100755 --- a/conf/type/__file/explorer/cksum +++ b/conf/type/__file/explorer/cksum @@ -21,11 +21,7 @@ # Retrieve the md5sum of a file to be created, if it is already existing. # -if [ -f "$__object/parameter/destination" ]; then - destination="$(cat "$__object/parameter/destination")" -else - destination="/$__object_id" -fi +destination="/$__object_id" if [ -e "$destination" ]; then if [ -f "$destination" ]; then diff --git a/conf/type/__file/explorer/exists b/conf/type/__file/explorer/exists index b0be82fc..f8b85671 100755 --- a/conf/type/__file/explorer/exists +++ b/conf/type/__file/explorer/exists @@ -21,11 +21,7 @@ # Check whether file exists or not # -if [ -f "$__object/parameter/destination" ]; then - destination="$(cat "$__object/parameter/destination")" -else - destination="/$__object_id" -fi +destination="/$__object_id" if [ -e "$destination" ]; then echo yes From bf60df1a9baed8a5b6665262a8a4f9a2db0160de Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 08:31:30 +0100 Subject: [PATCH 38/74] cleanup in __file manifest Signed-off-by: Nico Schottelius --- conf/type/__file/gencode | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/conf/type/__file/gencode b/conf/type/__file/gencode index bf30bb2c..ef8c5501 100755 --- a/conf/type/__file/gencode +++ b/conf/type/__file/gencode @@ -23,28 +23,15 @@ destination="/$__object_id" -# Use correct md5sum binary - MacOSx is different here -# FIXME: broken: we don't know the host os! -case "$os" in - macosx) - md5sum="md5" - ;; - - *) - md5sum="md5sum" - ;; -esac - if [ -f "$__object/parameter/source" ]; then source="$(cat "$__object/parameter/source")" if [ -f "$source" ]; then - local_md5sum="$($md5sum < "$source")" - remote_md5sum="$(cat "$__object/explorer/md5sum")" + local_cksum="$(cksum < "$source")" + remote_cksum="$(cat "$__object/explorer/cksum")" - # FIXME: Is md5sum the right approach? - if [ "$local_md5sum" != "$remote_md5sum" ]; then - # FIXME: This is ugly and hardcoded, replace after 1.0! + if [ "$local_cksum" != "$remote_cksum" ]; then + # FIXME: The username is ugly and hardcoded, replace after 1.0! # Probably a better aproach is to have the user configured # ~/.ssh/config to contain the right username # Probably describe it in cdist-quickstart... From e7f64758ce18050def03d9423e1495ba4a2e0361 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 08:39:51 +0100 Subject: [PATCH 39/74] update conf/manifest/init example Signed-off-by: Nico Schottelius --- conf/manifest/init | 7 ++++--- doc/dev/logs/2011-03-15.file_directory_link | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/conf/manifest/init b/conf/manifest/init index 0a1dca50..0241423b 100755 --- a/conf/manifest/init +++ b/conf/manifest/init @@ -7,13 +7,14 @@ # Every machine becomes a marker, so sysadmins know that automatic # configurations are happening -__file /etc/cdist-configured --type file +__file /etc/cdist-configured case "$__target_host" in # Everybody has this localhost) - # Usual example - __file test --type symlink --source /etc/cdist-configured --destination /tmp/cdist-testfile + __link /tmp/cdist-testfile --source /etc/cdist-configured --type symbolic + __directory /tmp/cdist-test-dir --mode 4777 + __file /tmp/cdist-test-file --mode 0750 --owner nobody --group root ;; # diff --git a/doc/dev/logs/2011-03-15.file_directory_link b/doc/dev/logs/2011-03-15.file_directory_link index 8a975750..9044bc33 100644 --- a/doc/dev/logs/2011-03-15.file_directory_link +++ b/doc/dev/logs/2011-03-15.file_directory_link @@ -4,4 +4,4 @@ x __directory /etc [--mode --owner --group --parents [yes|no] ] x __link /destination --source abc --type [symbolic|hard] -__file /etc/passwd [--source] --mode --owner --group +x __file /etc/passwd [--source] --mode --owner --group From 2b2545ed8cf20824364eaf85df0afa1ced868182 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 08:40:36 +0100 Subject: [PATCH 40/74] add changes for 1.1 release Signed-off-by: Nico Schottelius --- doc/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/changelog b/doc/changelog index c869c146..d83d3d44 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,3 +1,6 @@ +1.1: + * Replace type __file with __file, __directory, __link + 1.0.4: 2011-03-15 * New type __motd * New type __addifnosuchline From d2c4ffb5f00ea30382c92e1d1b2432d0d19a6729 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 08:45:01 +0100 Subject: [PATCH 41/74] cleanup manpages for new types Signed-off-by: Nico Schottelius --- conf/type/__directory/man.text | 15 ++++----------- conf/type/__file/man.text | 13 +++---------- conf/type/__link/man.text | 9 +++++---- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/conf/type/__directory/man.text b/conf/type/__directory/man.text index a619666d..f7272df9 100644 --- a/conf/type/__directory/man.text +++ b/conf/type/__directory/man.text @@ -37,18 +37,11 @@ EXAMPLES -------- -------------------------------------------------------------------------------- -# Create /etc/cdist-configured as an empty file -__file /etc/cdist-configured --type file +# A silly example +__directory /tmp/foobar -# Same but with a different object id -__file cdist-marker --type file --destination /etc/cdist-configured - -# Use __file from another type -__file /etc/issue --source "$__type/files/archlinux" --type file - -# Supply some more settings -__file /etc/shadow --source "$__type/files/shadow" --type file \ - --owner root --group shadow --mode 0640 +# Ensure /etc exists correctly +__file /etc --owner root --group root --mode 0755 -------------------------------------------------------------------------------- diff --git a/conf/type/__file/man.text b/conf/type/__file/man.text index 22b367cb..67ab53d1 100644 --- a/conf/type/__file/man.text +++ b/conf/type/__file/man.text @@ -20,10 +20,6 @@ None. OPTIONAL PARAMETERS ------------------- -destination:: - If supplied, use this as the destination on the target. Otherwise the - object_id is used. - group:: Group to chgrp to. @@ -43,16 +39,13 @@ EXAMPLES -------------------------------------------------------------------------------- # Create /etc/cdist-configured as an empty file -__file /etc/cdist-configured --type file - -# Same but with a different object id -__file cdist-marker --type file --destination /etc/cdist-configured +__file /etc/cdist-configured # Use __file from another type -__file /etc/issue --source "$__type/files/archlinux" --type file +__file /etc/issue --source "$__type/files/archlinux" # Supply some more settings -__file /etc/shadow --source "$__type/files/shadow" --type file \ +__file /etc/shadow --source "$__type/files/shadow" \ --owner root --group shadow --mode 0640 -------------------------------------------------------------------------------- diff --git a/conf/type/__link/man.text b/conf/type/__link/man.text index db124cb9..fb914298 100644 --- a/conf/type/__link/man.text +++ b/conf/type/__link/man.text @@ -27,20 +27,21 @@ OPTIONAL PARAMETERS ------------------- None. + EXAMPLES -------- -------------------------------------------------------------------------------- # Create hard link of /etc/shadow -__file /root/shadow --source /etc/shadow --type hard +__link /root/shadow --source /etc/shadow --type hard # Relative symbolic link -__file /etc/apache2/sites-enabled/www.test.ch \ +__link /etc/apache2/sites-enabled/www.test.ch \ --source ../sites-available/www.test.ch \ --type symbolic -# Relative absolute link -__file /opt/plone --source /home/services/plone --type symbolic +# Absolute symbolic link +__link /opt/plone --source /home/services/plone --type symbolic -------------------------------------------------------------------------------- From 693e1be85e8ece59c14d9017d606a0b29acd7f0a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 08:54:35 +0100 Subject: [PATCH 42/74] add initial manpage for cdist-env Signed-off-by: Nico Schottelius --- doc/man/cdist-env.text | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 doc/man/cdist-env.text diff --git a/doc/man/cdist-env.text b/doc/man/cdist-env.text new file mode 100644 index 00000000..4c2d73bc --- /dev/null +++ b/doc/man/cdist-env.text @@ -0,0 +1,32 @@ +cdist-env(1) +============ +Nico Schottelius + + +NAME +---- +cdist-env - Setup environment for using cdist + + +SYNOPSIS +-------- +cdist-env + + +DESCRIPTION +----------- +cdist-env outputs two strings suitable for usage in your current shell, +so you can use cdist from the checkout. You can evaluate those strings +and make directory usage of them. + + + +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 01ffe2f3ad855e58340e63a068fd97ca17ab1f0e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 09:00:22 +0100 Subject: [PATCH 43/74] cdist-env: add support for tcsh Signed-off-by: Nico Schottelius --- bin/cdist-env | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/cdist-env b/bin/cdist-env index a7610aac..2256965b 100755 --- a/bin/cdist-env +++ b/bin/cdist-env @@ -27,7 +27,17 @@ __cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)" __cdist_myname=${0##*/}; __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" -echo export PATH=$__cdist_abs_mydir:$PATH +shell_binary=${SHELL##*/} +NEWPATH="$__cdist_abs_mydir:$PATH" cd "$__cdist_abs_mydir/../doc/man" -echo export MANPATH=$(pwd -P):$MANPATH +NEWMANPATH="$(pwd -P):$MANPATH" + +# Match csh, tcsh to handle differently +if $(echo $shell_binary | grep -q 'csh$'); then + echo setenv PATH $NEWPATH + echo setenv MANPATH $NEWMANPATH +else + echo export PATH=$NEWPATH + echo export MANPATH=$NEWMANPATH +fi From 1cbdcc1f53c7648f7626d4e1131157330f7f042f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 09:15:22 +0100 Subject: [PATCH 44/74] + semicolon for csh Signed-off-by: Nico Schottelius --- bin/cdist-env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist-env b/bin/cdist-env index 2256965b..3b8e1645 100755 --- a/bin/cdist-env +++ b/bin/cdist-env @@ -35,7 +35,7 @@ NEWMANPATH="$(pwd -P):$MANPATH" # Match csh, tcsh to handle differently if $(echo $shell_binary | grep -q 'csh$'); then - echo setenv PATH $NEWPATH + echo setenv PATH $NEWPATH \; echo setenv MANPATH $NEWMANPATH else echo export PATH=$NEWPATH From 0d07b2056fc4b0b5034a145aaa3dabb6b00b0c7d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 09:38:59 +0100 Subject: [PATCH 45/74] describe how to use cdist-env in every shell Signed-off-by: Nico Schottelius --- doc/man/cdist-env.text | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/man/cdist-env.text b/doc/man/cdist-env.text index 4c2d73bc..fca115fb 100644 --- a/doc/man/cdist-env.text +++ b/doc/man/cdist-env.text @@ -16,9 +16,23 @@ cdist-env DESCRIPTION ----------- cdist-env outputs two strings suitable for usage in your current shell, -so you can use cdist from the checkout. You can evaluate those strings -and make directory usage of them. +so you can use cdist from the checkout. cdist-env essentially helps you +to easily setup PATH and MANPATH. +If you've multiple checkouts of cdist and run cdist-env from the various +checkouts, a new run will prepend the last directory, thus ensures you +can run it multiple times and does what one expects. + +EXAMPLES +-------- +For use in bourne shell variants (like dash, bash, ksh) as well as +in csh variants (csh, tcsh): + +-------------------------------------------------------------------------------- +eval `~/cdist/bin/cdist-env` +-------------------------------------------------------------------------------- + +Replace ~/cdist with the checkout directory of cdist. SEE ALSO From a5aec139277fc49112d30228c6a30d2ed2416e2d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 09:40:48 +0100 Subject: [PATCH 46/74] add cdist-env for MANSRC Signed-off-by: Nico Schottelius --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index a6d78aeb..5b6b6e94 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ MANGENERATED=$(MANDIR)/cdist-reference.text MANSRC=$(MANDIR)/cdist.text \ $(MANDIR)/cdist-bin-transfer.text \ + $(MANDIR)/cdist-env.text \ $(MANDIR)/cdist-deploy-to.text \ $(MANDIR)/cdist-explorer.text \ $(MANDIR)/cdist-manifest.text \ From d084cf1422752db88bcc2f4e4a807335148fb0cb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 09:45:22 +0100 Subject: [PATCH 47/74] less todo, updates for changelog Signed-off-by: Nico Schottelius --- doc/changelog | 3 ++- doc/dev/todo/niconext | 3 +++ doc/dev/todo/post-1.0 | 22 +--------------------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/doc/changelog b/doc/changelog index d83d3d44..696bae25 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,9 +1,10 @@ 1.1: * Replace type __file with __file, __directory, __link + * Document cdist-env 1.0.4: 2011-03-15 * New type __motd - * New type __addifnosuchline + * New type __addifnosuchline (Daniel Roth) * Document type __issue * Document type __package_pacman * Document type __package_apt diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index e69de29b..a1916dcd 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -0,0 +1,3 @@ +DOC: + - cdist-dir + - cdist-config diff --git a/doc/dev/todo/post-1.0 b/doc/dev/todo/post-1.0 index 49c6f8b0..0d32dd98 100644 --- a/doc/dev/todo/post-1.0 +++ b/doc/dev/todo/post-1.0 @@ -9,22 +9,9 @@ Types to be written/extended: - __service - __user - __file_edit - - delete_line_from_file + - __deleteline - regexp replace (can probably cover all?) - - __file: - - template == [shell script] stdout - cron - - __file: think about splitting - __file - source - mode - owner - __directory - parents - mode - owner - __link - type symbolic | hard - __issue: add --source @@ -41,16 +28,9 @@ Documentation: + cdist + cdist-deploy-to + cdist-manifest - - cdist-type [IMPORTANT] - - only do necessary work [TYPE IMPLEMENTATION HINTS] - - install packages only if not existent - - copy file only if different - - DOC document that $type/manifest is executed for every object/instance - ensure every file in bin/ has a correspondent manpage - cdist-code-run-all - - cdist-config - cdist-deploy-to - - cdist-dir - cdist-explorer-run-init - cdist-manifest-run - cdist-manifest-run-all From 6a29a7c1d8de4ef969e6b17a48a26a6fb3229f8c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 09:46:14 +0100 Subject: [PATCH 48/74] REAL_README -> README Signed-off-by: Nico Schottelius --- README | 173 +++++++++++++++++++++++++++++++++++++++++++++++++++- REAL_README | 172 --------------------------------------------------- 2 files changed, 172 insertions(+), 173 deletions(-) mode change 120000 => 100644 README delete mode 100644 REAL_README diff --git a/README b/README deleted file mode 120000 index ace36209..00000000 --- a/README +++ /dev/null @@ -1 +0,0 @@ -REAL_README \ No newline at end of file diff --git a/README b/README new file mode 100644 index 00000000..88d5de13 --- /dev/null +++ b/README @@ -0,0 +1,172 @@ +[[!meta title="cdist - configuration management"]] + + + .. . .x+=:. s + dF @88> z` ^% :8 + '88bu. %8P . origin/ + + # Stay on version 1.0 + git checkout -b 1.0 origin/1.0 + +### Update + +To upgrade cdist in the current branch use + + git pull + + # Also update the manpages + make man + export MANPATH=$MANPATH:$(pwd -P)/doc/man + + +The version branches are designed to change if there are incompatibilities. +Or the other way round: As long as you stay on 1.0 and do git pull, nothing +should break. + +## Support + +### IRC + +You can join the development ***IRC channel*** +[#cLinux on irc.freenode.org](irc://irc.freenode.org/#cLinux). + +### Mailing list + +Bug reports, questions, patches, etc. should be send to the +[cdist mailing list](http://l.schottelius.org/mailman/listinfo/cdist). + +## Used by + +If you're using cdist, feel free to send a report to the mailing list. +Interesting information are for instance + + * Which services do you manage? + * How many machines do you manage? + * What are the pros/cons you see in cdist? + * General comments/critics + +### Nico Schottelius, Systems Group ETH Zurich + +Yes, I'm actually eating my own dogfood and currently managing + + * [plone](http://plone.org/) (cms) + * [moinmoin](http://moinmo.in/) (wiki) + * [apache](http://httpd.apache.org/) (webserver) + * [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication) + * [ircd-hybrid](http://www.ircd-hybrid.org/) (chat) + * [stunnel](http://stunnel.mirt.net/) (SSL tunnel) + * [mercurial-server](http://www.lshift.net/mercurial-server.html) + +with cdist on a total of **4** production servers of the +[Systems Group](http://www.systems.ethz.ch) at the +[ETH Zurich](http://www.ethz.ch). diff --git a/REAL_README b/REAL_README deleted file mode 100644 index 88d5de13..00000000 --- a/REAL_README +++ /dev/null @@ -1,172 +0,0 @@ -[[!meta title="cdist - configuration management"]] - - - .. . .x+=:. s - dF @88> z` ^% :8 - '88bu. %8P . origin/ - - # Stay on version 1.0 - git checkout -b 1.0 origin/1.0 - -### Update - -To upgrade cdist in the current branch use - - git pull - - # Also update the manpages - make man - export MANPATH=$MANPATH:$(pwd -P)/doc/man - - -The version branches are designed to change if there are incompatibilities. -Or the other way round: As long as you stay on 1.0 and do git pull, nothing -should break. - -## Support - -### IRC - -You can join the development ***IRC channel*** -[#cLinux on irc.freenode.org](irc://irc.freenode.org/#cLinux). - -### Mailing list - -Bug reports, questions, patches, etc. should be send to the -[cdist mailing list](http://l.schottelius.org/mailman/listinfo/cdist). - -## Used by - -If you're using cdist, feel free to send a report to the mailing list. -Interesting information are for instance - - * Which services do you manage? - * How many machines do you manage? - * What are the pros/cons you see in cdist? - * General comments/critics - -### Nico Schottelius, Systems Group ETH Zurich - -Yes, I'm actually eating my own dogfood and currently managing - - * [plone](http://plone.org/) (cms) - * [moinmoin](http://moinmo.in/) (wiki) - * [apache](http://httpd.apache.org/) (webserver) - * [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication) - * [ircd-hybrid](http://www.ircd-hybrid.org/) (chat) - * [stunnel](http://stunnel.mirt.net/) (SSL tunnel) - * [mercurial-server](http://www.lshift.net/mercurial-server.html) - -with cdist on a total of **4** production servers of the -[Systems Group](http://www.systems.ethz.ch) at the -[ETH Zurich](http://www.ethz.ch). From b6f231063eb1254b04ae3fda23e83f3c1adac0ec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 09:48:59 +0100 Subject: [PATCH 49/74] 0600 is enough for cdist-config (according to posix) Signed-off-by: Nico Schottelius --- bin/cdist-config | 0 doc/man/{to_check => }/cdist-config.text | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 bin/cdist-config rename doc/man/{to_check => }/cdist-config.text (100%) diff --git a/bin/cdist-config b/bin/cdist-config old mode 100755 new mode 100644 diff --git a/doc/man/to_check/cdist-config.text b/doc/man/cdist-config.text similarity index 100% rename from doc/man/to_check/cdist-config.text rename to doc/man/cdist-config.text From a8ae699c8f095a70872d877419c63881e2d61547 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:02:46 +0100 Subject: [PATCH 50/74] [DOC] cleanup cdist-config Signed-off-by: Nico Schottelius --- Makefile | 4 ++-- doc/changelog | 1 + doc/man/cdist-config.text | 16 ++++++---------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 5b6b6e94..b780a983 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,6 @@ WEBPAGE=software/cdist.mdwn MANDIR=doc/man # Unchecked MANSRC=$(MANDIR)/cdist-config-layout.text \ - $(MANDIR)/cdist-config.text \ $(MANDIR)/cdist-quickstart.text \ $(MANDIR)/cdist-stages.text \ $(MANDIR)/cdist-terms.text \ @@ -21,6 +20,7 @@ MANGENERATED=$(MANDIR)/cdist-reference.text MANSRC=$(MANDIR)/cdist.text \ $(MANDIR)/cdist-bin-transfer.text \ + $(MANDIR)/cdist-config.text \ $(MANDIR)/cdist-env.text \ $(MANDIR)/cdist-deploy-to.text \ $(MANDIR)/cdist-explorer.text \ @@ -40,7 +40,7 @@ all: @echo '' @echo 'Here are the possible targets:' @echo '' - @echo ' man: Build manpages' + @echo ' man: Build manpages (requires Asciidoc (a2x binary))' @echo ' clean: Remove build stuff' @echo '' @echo '' diff --git a/doc/changelog b/doc/changelog index 696bae25..a9738e06 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,6 +1,7 @@ 1.1: * Replace type __file with __file, __directory, __link * Document cdist-env + * Document cdist-config 1.0.4: 2011-03-15 * New type __motd diff --git a/doc/man/cdist-config.text b/doc/man/cdist-config.text index 969be9cc..9d147988 100644 --- a/doc/man/cdist-config.text +++ b/doc/man/cdist-config.text @@ -10,18 +10,14 @@ cdist-config - Read basic cdist configuration DESCRIPTION ----------- -Cdist-config is sourced by all helper programs and provides -hints on where to find the library. Cdist-config needs to be -in the path. - -AUTHOR ------- -Nico Schottelius +Cdist-config is sourced by cdist programs and provides hints on where to find +types, manifests, etc. Generally speaking, it's just usable from within the +core and is only of interest for cdist-developers. -RESOURCES ---------- -Main web site: http://www.nico.schottelius.org/cdist/[] +SEE ALSO +-------- +cdist(7) COPYING From 3cf23460721f2f611f9055790184001bff636871 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:07:30 +0100 Subject: [PATCH 51/74] [DOC] add manpage for cdist-dir Signed-off-by: Nico Schottelius --- Makefile | 1 + doc/man/cdist-dir.text | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 doc/man/cdist-dir.text diff --git a/Makefile b/Makefile index b780a983..3bb33226 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ MANGENERATED=$(MANDIR)/cdist-reference.text MANSRC=$(MANDIR)/cdist.text \ $(MANDIR)/cdist-bin-transfer.text \ $(MANDIR)/cdist-config.text \ + $(MANDIR)/cdist-dir.text \ $(MANDIR)/cdist-env.text \ $(MANDIR)/cdist-deploy-to.text \ $(MANDIR)/cdist-explorer.text \ diff --git a/doc/man/cdist-dir.text b/doc/man/cdist-dir.text new file mode 100644 index 00000000..0f4a2e68 --- /dev/null +++ b/doc/man/cdist-dir.text @@ -0,0 +1,36 @@ +cdist-dir(1) +============ +Nico Schottelius + + +NAME +---- +cdist-dir - Poor man's directory synchronisation + + +SYNOPSIS +-------- +cdist-dir TARGET_HOST SRC_DIR DST_DIR + + +DESCRIPTION +----------- +cdist-dir either pushes a local directory to the target host +or pulls a remote directory from a target host to the local host. + +In the push case SRC_DIR is local, in the pull case remote. +In the push case DST_DIR is remote, in the pull case local. + +cdist-dir does not cleanup DST_DIR and thus it may contain old +stuff if used multiple times. + + +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 24eb626ca85e940c07936070a1ef7b098d080ae9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:11:00 +0100 Subject: [PATCH 52/74] clearify dumb behaviour of cdist-dir Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 4 +--- doc/man/cdist-dir.text | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index a1916dcd..7ce8da49 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,3 +1 @@ -DOC: - - cdist-dir - - cdist-config +Release 1.1.0 diff --git a/doc/man/cdist-dir.text b/doc/man/cdist-dir.text index 0f4a2e68..223bc779 100644 --- a/doc/man/cdist-dir.text +++ b/doc/man/cdist-dir.text @@ -24,6 +24,8 @@ In the push case DST_DIR is remote, in the pull case local. cdist-dir does not cleanup DST_DIR and thus it may contain old stuff if used multiple times. +cdist-dir does not rely on rsync or other high level tools, because +it cannot expect its existence on the local or target host. SEE ALSO -------- From 2389dde9f565988550c89228ee626ecf8889f6ef Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:18:03 +0100 Subject: [PATCH 53/74] [DOC] add manpage for cdist-quickstart Signed-off-by: Nico Schottelius --- Makefile | 3 +- doc/changelog | 2 + doc/dev/todo/post-1.0 | 1 - doc/man/cdist-quickstart.text | 51 ++++++++++++++++++++++++++ doc/man/to_check/cdist-quickstart.text | 42 --------------------- 5 files changed, 54 insertions(+), 45 deletions(-) create mode 100644 doc/man/cdist-quickstart.text delete mode 100644 doc/man/to_check/cdist-quickstart.text diff --git a/Makefile b/Makefile index 3bb33226..660abb09 100644 --- a/Makefile +++ b/Makefile @@ -11,9 +11,7 @@ WEBPAGE=software/cdist.mdwn MANDIR=doc/man # Unchecked MANSRC=$(MANDIR)/cdist-config-layout.text \ - $(MANDIR)/cdist-quickstart.text \ $(MANDIR)/cdist-stages.text \ - $(MANDIR)/cdist-terms.text \ # Clean documentation MANGENERATED=$(MANDIR)/cdist-reference.text @@ -26,6 +24,7 @@ MANSRC=$(MANDIR)/cdist.text \ $(MANDIR)/cdist-deploy-to.text \ $(MANDIR)/cdist-explorer.text \ $(MANDIR)/cdist-manifest.text \ + $(MANDIR)/cdist-quickstart.text \ $(MANDIR)/cdist-stages.text \ $(MANDIR)/cdist-type.text \ $(MANDIR)/cdist-type-template.text \ diff --git a/doc/changelog b/doc/changelog index a9738e06..1558d59f 100644 --- a/doc/changelog +++ b/doc/changelog @@ -2,6 +2,8 @@ * Replace type __file with __file, __directory, __link * Document cdist-env * Document cdist-config + * Document cdist-dir + * Document cdist-quickstart 1.0.4: 2011-03-15 * New type __motd diff --git a/doc/dev/todo/post-1.0 b/doc/dev/todo/post-1.0 index 0d32dd98..d351a0f7 100644 --- a/doc/dev/todo/post-1.0 +++ b/doc/dev/todo/post-1.0 @@ -38,7 +38,6 @@ Documentation: - cdist-object-codegen - cdist-object-codegen-all - cdist-object-explorer-all - - cdist-quickstart - cdist-remote-code-run-all - cdist-remote-explorer-run - cdist-run-remote diff --git a/doc/man/cdist-quickstart.text b/doc/man/cdist-quickstart.text new file mode 100644 index 00000000..ddcbbccc --- /dev/null +++ b/doc/man/cdist-quickstart.text @@ -0,0 +1,51 @@ +cdist-quickstart(1) +=================== +Nico Schottelius + +NAME +---- +cdist-quickstart - Make use of cinit in 5 minutes + + +SYNOPSIS +-------- +cdist-quickstart + + +DESCRIPTION +----------- +cdist-quickstart is an interactive guide to cdist. It should be one +of the first tools you use when you begin with cdist. + + +EXAMPLES +-------- + +To use cdist-quickstart, add the bin directory to your PATH, +execute cdist-quickstart and enjoy cdist: + + +-------------------------------------------------------------------------------- +# Bourne shell example +export PATH=$(pwd -P)/bin:$PATH + +# Alternatively, usable for csh and bsh, set's up PATH and MANPATH +eval `./bin/cdist-env` + +# Let's go! +cdist-quickstart +-------------------------------------------------------------------------------- + + + +SEE ALSO +-------- +- cdist(7) +- cdist-env(1) + + +COPYING +------- +Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). +## How to use cdist? diff --git a/doc/man/to_check/cdist-quickstart.text b/doc/man/to_check/cdist-quickstart.text deleted file mode 100644 index 570aa310..00000000 --- a/doc/man/to_check/cdist-quickstart.text +++ /dev/null @@ -1,42 +0,0 @@ -cdist-quickstart(1) -=================== -Nico Schottelius - -NAME ----- -cdist-quickstart - Make use of cinit in 5 minutes - - -DESCRIPTION ------------ -This document helps you to take the first steps with cdist. -We'll begin to configure the host "localhost" to have two files -in place, /etc/DO-NOT-CHANGE and /root/CDIST-ENABLED-HOST, which -both are used to warn other sysadmins that this system is managed -by configuration management and manual changes may get overwritten. - -Begin to execute cdist-quickstart, it will show you the steps it -takes and explains what it does: - -% cdist-quickstart - -mkdir -p /etc/cdist/manifests - -# Create - -Cdist uses -kgives you an impression of - 0. Create a host specification (/etc/cdist/hosts/**hostname**) - 0. Add functionalilty to add - 0. Run ***cdist-apply*** - -SEE ALSO --------- -cdist-config-layout(7) - - -COPYING -------- -Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). -## How to use cdist? From e7eecb06d9d926218de1a246124405cf775d6551 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:19:38 +0100 Subject: [PATCH 54/74] cdist-config needs to be executable, otherwise which does not find it Signed-off-by: Nico Schottelius --- bin/cdist-config | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/cdist-config diff --git a/bin/cdist-config b/bin/cdist-config old mode 100644 new mode 100755 From f82527283ec00de18cf4d79cee10c329d4e2a925 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:20:38 +0100 Subject: [PATCH 55/74] remove obsolete documentation Signed-off-by: Nico Schottelius --- doc/man/to_check/cdist-terms.text | 26 ----------------------- doc/man/to_check/cdist-type-manifest.text | 24 --------------------- 2 files changed, 50 deletions(-) delete mode 100644 doc/man/to_check/cdist-terms.text delete mode 100644 doc/man/to_check/cdist-type-manifest.text diff --git a/doc/man/to_check/cdist-terms.text b/doc/man/to_check/cdist-terms.text deleted file mode 100644 index 530c4762..00000000 --- a/doc/man/to_check/cdist-terms.text +++ /dev/null @@ -1,26 +0,0 @@ -cdist-terms(7) -============== -Nico Schottelius - - -NAME ----- -cdist-terms - Describe terms used in cdist - - -DESCRIPTION ------------ -provider: Provides functionality. -object: Instance with provider unique id of a provider. -manifest: Define which objects to create [on hosts] -server: The machine that configures all targets. -target: Host that should be configured. - -SEE ALSO --------- - - -COPYING -------- -Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/to_check/cdist-type-manifest.text b/doc/man/to_check/cdist-type-manifest.text deleted file mode 100644 index 7573df6b..00000000 --- a/doc/man/to_check/cdist-type-manifest.text +++ /dev/null @@ -1,24 +0,0 @@ -cdist-type-manifest(7) -====================== -Nico Schottelius - - -NAME ----- -cdist-type-manifest - Manifest of a type - - -DESCRIPTION ------------ -CWD = object directory -ARGV = target host, basedir -ENV = - -SEE ALSO --------- - - -COPYING -------- -Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). From 953837c7335e311e7b78d5082bcf40b1a6f7013c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:21:10 +0100 Subject: [PATCH 56/74] cleanup makefile Signed-off-by: Nico Schottelius --- Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 660abb09..11b9c59a 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,8 @@ A2X=a2x -f manpage --no-xmllint WEBDIR=$$HOME/niconetz WEBPAGE=software/cdist.mdwn +# Documentation MANDIR=doc/man -# Unchecked -MANSRC=$(MANDIR)/cdist-config-layout.text \ - $(MANDIR)/cdist-stages.text \ - -# Clean documentation MANGENERATED=$(MANDIR)/cdist-reference.text MANSRC=$(MANDIR)/cdist.text \ From 44c8adccbe1e2cb8d529e3d7749f4a2e82dcd4c8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:25:53 +0100 Subject: [PATCH 57/74] cdist-env: document ./ as default Signed-off-by: Nico Schottelius --- doc/man/cdist-env.text | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/man/cdist-env.text b/doc/man/cdist-env.text index fca115fb..8d10aa85 100644 --- a/doc/man/cdist-env.text +++ b/doc/man/cdist-env.text @@ -29,10 +29,10 @@ For use in bourne shell variants (like dash, bash, ksh) as well as in csh variants (csh, tcsh): -------------------------------------------------------------------------------- -eval `~/cdist/bin/cdist-env` +eval `./bin/cdist-env` -------------------------------------------------------------------------------- -Replace ~/cdist with the checkout directory of cdist. +Replace "./" with the checkout directory of cdist. SEE ALSO From aee6953ecd5049b2a337bb03e5ed0e41794fb21a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:28:00 +0100 Subject: [PATCH 58/74] [BUGFIX] __link: remove trailing 's' in variable name Signed-off-by: Nico Schottelius --- conf/type/__link/gencode | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__link/gencode b/conf/type/__link/gencode index 4a97ac34..2e13755c 100755 --- a/conf/type/__link/gencode +++ b/conf/type/__link/gencode @@ -40,4 +40,4 @@ case "$type" in ;; esac -echo ln ${lnopts} -f \"$source\" \"$destination\" +echo ln ${lnopt} -f \"$source\" \"$destination\" From 84b15fac454f5bd9c999aacd154b403fd5808424 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:31:22 +0100 Subject: [PATCH 59/74] todo post 1.1 Signed-off-by: Nico Schottelius --- doc/dev/todo/{post-1.0-cache => cache} | 0 doc/dev/todo/{post-1.0 => post-1.1} | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) rename doc/dev/todo/{post-1.0-cache => cache} (100%) rename doc/dev/todo/{post-1.0 => post-1.1} (97%) diff --git a/doc/dev/todo/post-1.0-cache b/doc/dev/todo/cache similarity index 100% rename from doc/dev/todo/post-1.0-cache rename to doc/dev/todo/cache diff --git a/doc/dev/todo/post-1.0 b/doc/dev/todo/post-1.1 similarity index 97% rename from doc/dev/todo/post-1.0 rename to doc/dev/todo/post-1.1 index d351a0f7..2efa1ab7 100644 --- a/doc/dev/todo/post-1.0 +++ b/doc/dev/todo/post-1.1 @@ -1,3 +1,6 @@ +Core: + - write test case: test.sh + Dependencies: - Add meta parameters like --requires --excludes --depends? - Build dependency tree @@ -30,7 +33,6 @@ Documentation: + cdist-manifest - ensure every file in bin/ has a correspondent manpage - cdist-code-run-all - - cdist-deploy-to - cdist-explorer-run-init - cdist-manifest-run - cdist-manifest-run-all From 4fdef270bac4368839dc92d32d87f9b2a6713361 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:44:43 +0100 Subject: [PATCH 60/74] describe how to upgrade to 1.1 Signed-off-by: Nico Schottelius --- README | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/README b/README index 88d5de13..9c645e97 100644 --- a/README +++ b/README @@ -40,7 +40,6 @@ it ticks differently: ### Architecture * Push mode (server pushes configuration) - * Pull mode planned (client triggers configuration) * User defines configuration in shell scripts (called ***manifests***) * Generates internal configuration (cconfig style) * Uses ***types*** to generate code be executed on the target @@ -58,15 +57,10 @@ but is not. Or: The reason why I began to write cdist. * Meaningful error messages * No surprise factor * Consistency in behaviour, naming and documentation - * Easy integration nacked installations + * Easy integration into bare metal installations * Simple and well-known DSL: posix shell - * It is very easy to - * extend cdist - * debug cdist-core and cdist-types - * Focus on reuse of existing functionality - * ssh - * sh - * find, rm, ... + * It must be very easy to extend and debug cdist + * Focus on reuse of existing functionality (like sh, ssh, find, rm, ...) ## Requirements @@ -104,21 +98,22 @@ how to use cdist. ### Available versions -There are at least two branches available: +There are at least the following branches available: * master: the development branch - * 1.0: stable branch of version 1.0 + * 1.0: First official release + * 1.1: Current stable (includes __file type change) -Other branches may be available as well for features or bugfixes, but they +Other branches may be available for features or bugfixes, but they may vanish at any point. To select a specific branch use # Generic code git checkout -b origin/ - # Stay on version 1.0 - git checkout -b 1.0 origin/1.0 + # Stay on version 1.1 + git checkout -b 1.1 origin/1.1 -### Update +## Update To upgrade cdist in the current branch use @@ -128,10 +123,20 @@ To upgrade cdist in the current branch use make man export MANPATH=$MANPATH:$(pwd -P)/doc/man +If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break. +The master branch on the other hand is the development branch and may not be +working, break your setup or eat the tree in your garden. + +### Upgrading from 1.0 to 1.1 + +In 1.1 the type **__file** was split into **__directory**, **__file** and +**__link**. The parameter **--type** was removed from **__file**. Thus you +need to replace **__file** calls in your manifests: + + * Remove --type from all __file calls + * If type was symlink, use __link and --type symbolic + * If type was directory, use __directory -The version branches are designed to change if there are incompatibilities. -Or the other way round: As long as you stay on 1.0 and do git pull, nothing -should break. ## Support From 5e58bfbd28ce0e587f5f4694a588409c0c22377a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:45:13 +0100 Subject: [PATCH 61/74] fix web target Signed-off-by: Nico Schottelius --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 11b9c59a..093859a5 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,7 @@ test: .rsync nicosc@ru3.inf.ethz.ch:cdist web: - cp REAL_README $(WEBDIR)/$(WEBPAGE) + cp README $(WEBDIR)/$(WEBPAGE) cd $(WEBDIR) && git commit -m "cdist update" $(WEBPAGE) cd $(WEBDIR) && make pub From 18d0f85fbf4bfb71322d808d34a04d2e9f6a175d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:48:43 +0100 Subject: [PATCH 62/74] fight against markdown with \ Signed-off-by: Nico Schottelius --- README | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README b/README index 9c645e97..552aecf1 100644 --- a/README +++ b/README @@ -102,7 +102,7 @@ There are at least the following branches available: * master: the development branch * 1.0: First official release - * 1.1: Current stable (includes __file type change) + * 1.1: Current stable (includes \_\_file type change) Other branches may be available for features or bugfixes, but they may vanish at any point. To select a specific branch use @@ -129,13 +129,13 @@ working, break your setup or eat the tree in your garden. ### Upgrading from 1.0 to 1.1 -In 1.1 the type **__file** was split into **__directory**, **__file** and -**__link**. The parameter **--type** was removed from **__file**. Thus you -need to replace **__file** calls in your manifests: +In 1.1 the type **\_\_file** was split into **\_\_directory**, **\_\_file** and +**\_\_link**. The parameter **--type** was removed from **\_\_file**. Thus you +need to replace **\_\_file** calls in your manifests: - * Remove --type from all __file calls - * If type was symlink, use __link and --type symbolic - * If type was directory, use __directory + * Remove --type from all \_\_file calls + * If type was symlink, use \_\_link and --type symbolic + * If type was directory, use \_\_directory ## Support From 2e97515f0b63ec8f6b4369a0bd883d0bbdf0fbb7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:52:36 +0100 Subject: [PATCH 63/74] cleanup README, more stuff done by cdist Signed-off-by: Nico Schottelius --- README | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README b/README index 552aecf1..a897cb55 100644 --- a/README +++ b/README @@ -48,19 +48,22 @@ it ticks differently: ### Features Stuff that should probably be included in every configuration management, -but is not. Or: The reason why I began to write cdist. +but is not. Or: Why I began to write cdist: * Speed * Elegant code * Clean design * Good documentation (man pages) * Meaningful error messages - * No surprise factor + * The no surprise factor * Consistency in behaviour, naming and documentation * 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 + ## Requirements @@ -171,7 +174,9 @@ Yes, I'm actually eating my own dogfood and currently managing * [ircd-hybrid](http://www.ircd-hybrid.org/) (chat) * [stunnel](http://stunnel.mirt.net/) (SSL tunnel) * [mercurial-server](http://www.lshift.net/mercurial-server.html) + * [xfce](http://www.xfce.org/) + * [slim](http://slim.berlios.de/) -with cdist on a total of **4** production servers of the +with cdist on a total of **5** production machines of the [Systems Group](http://www.systems.ethz.ch) at the [ETH Zurich](http://www.ethz.ch). From 37255960d61afa60f7bd7392ce4116ebb271d95f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 10:57:16 +0100 Subject: [PATCH 64/74] +urls Signed-off-by: Nico Schottelius --- README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index a897cb55..1c0d4111 100644 --- a/README +++ b/README @@ -173,9 +173,9 @@ Yes, I'm actually eating my own dogfood and currently managing * [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication) * [ircd-hybrid](http://www.ircd-hybrid.org/) (chat) * [stunnel](http://stunnel.mirt.net/) (SSL tunnel) - * [mercurial-server](http://www.lshift.net/mercurial-server.html) - * [xfce](http://www.xfce.org/) - * [slim](http://slim.berlios.de/) + * [mercurial-server](http://www.lshift.net/mercurial-server.html) (version control) + * [xfce](http://www.xfce.org/) (lightweight desktop environment) + * [slim](http://slim.berlios.de/) (graphical login manager for X11) with cdist on a total of **5** production machines of the [Systems Group](http://www.systems.ethz.ch) at the From 0f3297bfa21c2bfb484570ef47d16e5c278ef369 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 11:08:12 +0100 Subject: [PATCH 65/74] list know working operating systems Signed-off-by: Nico Schottelius --- README | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README b/README index 1c0d4111..c4a580a4 100644 --- a/README +++ b/README @@ -64,6 +64,16 @@ but is not. Or: Why I began to write cdist: * Easy upgrade: ***There is no need to update cdist on target hosts!*** * cdist only needs to be update on the master server +### OS support + +cdist was tested or is know to run on at least + + * [Archlinux](http://www.archlinux.org/) + * [Debian](http://www.debian.org/) + * [Gentoo](http://www.gentoo.org/) + * [Mac OS X](http://www.apple.com/macosx/) + * [Ubuntu](http://www.ubuntu.com/) + ## Requirements From c733c9f9a4835acc9b7e181855b29ce51c6a118d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 11:10:37 +0100 Subject: [PATCH 66/74] Change to 1.1.0 Signed-off-by: Nico Schottelius --- bin/cdist-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist-config b/bin/cdist-config index 61b7117f..3e418c77 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -19,7 +19,7 @@ # # -__cdist_version="1.0.4" +__cdist_version="1.1.0" # Fail if something bogus is going on set -u From b11941bdaf56a3c1c1ddd46e673bd76a31fef064 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 11:12:08 +0100 Subject: [PATCH 67/74] update changelog Signed-off-by: Nico Schottelius --- doc/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index 1558d59f..52a872d1 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,4 +1,4 @@ -1.1: +1.1.0: 2011-03-16 * Replace type __file with __file, __directory, __link * Document cdist-env * Document cdist-config From f94b39c22bd7262bcd9c3fcc1511c780e4168b01 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 11:16:45 +0100 Subject: [PATCH 68/74] fix __file usage in __issue and add redhat support Signed-off-by: Nico Schottelius --- conf/type/__issue/files/redhat | 3 +++ conf/type/__issue/manifest | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 conf/type/__issue/files/redhat diff --git a/conf/type/__issue/files/redhat b/conf/type/__issue/files/redhat new file mode 100644 index 00000000..d93372b0 --- /dev/null +++ b/conf/type/__issue/files/redhat @@ -0,0 +1,3 @@ +Red Hat Enterprise Linux Server (cdist-automated) +Kernel \r on an \m + diff --git a/conf/type/__issue/manifest b/conf/type/__issue/manifest index aa6f7629..1fab9a07 100755 --- a/conf/type/__issue/manifest +++ b/conf/type/__issue/manifest @@ -23,12 +23,12 @@ destination=/etc/issue source="$(cat "out/explorer/os")" case "$os" in - archlinux) - source="$__type/files/archlinux" + archlinux|redhat) + source="$__type/files/$os" ;; *) source="$__type/files/default" ;; esac -__file "$destination" --source "$source" --type file +__file "$destination" --source "$source" From 1bc37f5ba2f00c6440fd539d03ca16afb50d67c3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 11:20:07 +0100 Subject: [PATCH 69/74] setup mode 0644 for motd Signed-off-by: Nico Schottelius --- conf/type/__motd/manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__motd/manifest b/conf/type/__motd/manifest index a6e963f1..4716f530 100755 --- a/conf/type/__motd/manifest +++ b/conf/type/__motd/manifest @@ -38,4 +38,4 @@ case "$os" in ;; esac -__file "$destination" --source "$source" --type file +__file "$destination" --source "$source" --mode 0644 From e0520edb10695c7aace70ab28f385022ae603cfd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 11:20:18 +0100 Subject: [PATCH 70/74] document redhat support Signed-off-by: Nico Schottelius --- README | 1 + conf/manifest/init | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/README b/README index c4a580a4..c1df4618 100644 --- a/README +++ b/README @@ -72,6 +72,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/) + * [Redhat](http://www.redhat.com/) * [Ubuntu](http://www.ubuntu.com/) diff --git a/conf/manifest/init b/conf/manifest/init index 0241423b..85a9a359 100755 --- a/conf/manifest/init +++ b/conf/manifest/init @@ -37,11 +37,17 @@ case "$__target_host" in # Same stuff for gentoo __package tree --state installed ;; + cdist-debian) __package_apt atop --state installed __package apache2 --state deinstalled ;; + cdist-redhat) + __issue + __motd + ;; + # Real machines may be used with their hostname or fqdn, # depending on how you call cdist-deploy-to # machine) From b8a0fce4fa63a37c8cd0c39ec0f1bb21c06acb2c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 11:33:01 +0100 Subject: [PATCH 71/74] remove grep -q, not supported on solaris, from cdist-env Signed-off-by: Nico Schottelius --- bin/cdist-env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist-env b/bin/cdist-env index 3b8e1645..3a477e85 100755 --- a/bin/cdist-env +++ b/bin/cdist-env @@ -34,7 +34,7 @@ cd "$__cdist_abs_mydir/../doc/man" NEWMANPATH="$(pwd -P):$MANPATH" # Match csh, tcsh to handle differently -if $(echo $shell_binary | grep -q 'csh$'); then +if [ "$(echo $shell_binary | grep 'csh$')" ]; then echo setenv PATH $NEWPATH \; echo setenv MANPATH $NEWMANPATH else From 44a41b3893119222271958ce7124e677cfaabe99 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 11:36:45 +0100 Subject: [PATCH 72/74] take care of solaris in next version Signed-off-by: Nico Schottelius --- doc/dev/todo/post-1.1 | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/post-1.1 b/doc/dev/todo/post-1.1 index 2efa1ab7..8556f253 100644 --- a/doc/dev/todo/post-1.1 +++ b/doc/dev/todo/post-1.1 @@ -1,5 +1,6 @@ Core: - write test case: test.sh + - probably remove grep -q (solaris does not have it) Dependencies: - Add meta parameters like --requires --excludes --depends? From 39739835fa7ce194a07a70286e723dcb1109a3b9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 11:38:05 +0100 Subject: [PATCH 73/74] add git mirrors Signed-off-by: Nico Schottelius --- Makefile | 1 + README | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 093859a5..3842e47f 100644 --- a/Makefile +++ b/Makefile @@ -92,3 +92,4 @@ web: pub: git push --mirror + git push --mirror github diff --git a/README b/README index c1df4618..c43e0653 100644 --- a/README +++ b/README @@ -127,6 +127,11 @@ may vanish at any point. To select a specific branch use # Stay on version 1.1 git checkout -b 1.1 origin/1.1 +### Mirrors + + * git://github.com/telmich/cdist.git (Nicos Schottelius' backup) + * git://git.sans.ethz.ch/cdist (Steven Armstrongs main repo) + ## Update To upgrade cdist in the current branch use From 057ee7911e17c161de05dc4c9421ecc920127858 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Mar 2011 11:55:17 +0100 Subject: [PATCH 74/74] update mirror description Signed-off-by: Nico Schottelius --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index c43e0653..dbf3d89a 100644 --- a/README +++ b/README @@ -129,8 +129,8 @@ may vanish at any point. To select a specific branch use ### Mirrors - * git://github.com/telmich/cdist.git (Nicos Schottelius' backup) - * git://git.sans.ethz.ch/cdist (Steven Armstrongs main repo) + * git://github.com/telmich/cdist.git ([github](https://github.com/telmich/cdist)) + * git://git.sans.ethz.ch/cdist ([sans](http://git.sans.ethz.ch/?p=cdist;a=summary)) ## Update