From adbf670309fae0b4e9513d846689fac4f541fbe9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 14 Mar 2011 18:25:57 +0100 Subject: [PATCH 01/14] +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 02/14] 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 03/14] [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 04/14] 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 05/14] 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 06/14] 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 07/14] 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 08/14] 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 09/14] -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 10/14] 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 11/14] 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 12/14] 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 13/14] 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 14/14] 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).