From f77f551846ca2dc19d6dcda528603c5befb89385 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 8 Mar 2011 19:37:42 +0100 Subject: [PATCH 01/22] todos /dani updated --- doc/dev/todo/daninext | 2 ++ doc/dev/todo/post-1.0 | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 doc/dev/todo/daninext diff --git a/doc/dev/todo/daninext b/doc/dev/todo/daninext new file mode 100644 index 00000000..19ebc573 --- /dev/null +++ b/doc/dev/todo/daninext @@ -0,0 +1,2 @@ +file-edit + - add_line_to_file_if_not_existing diff --git a/doc/dev/todo/post-1.0 b/doc/dev/todo/post-1.0 index e469214e..d3fdd2c9 100644 --- a/doc/dev/todo/post-1.0 +++ b/doc/dev/todo/post-1.0 @@ -23,7 +23,6 @@ Types to be written/extended: - __service - __user - __file_edit - - add_line_to_file_if_not_existing - delete_line_from_file - regexp replace (can probably cover all?) - __file: From ac815524f405d4df7509f6766d53df453a149080 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 8 Mar 2011 19:34:51 +0100 Subject: [PATCH 02/22] Implementation of addifnosuchline type --- conf/type/__addifnosuchline/explorer/findline | 41 +++++++++++++++++++ conf/type/__addifnosuchline/gencode | 33 +++++++++++++++ .../type/__addifnosuchline/parameter/optional | 1 + .../type/__addifnosuchline/parameter/required | 1 + .../to_check/cdist-type-addifnosuchline.text | 30 ++++++++++++++ 5 files changed, 106 insertions(+) create mode 100755 conf/type/__addifnosuchline/explorer/findline create mode 100755 conf/type/__addifnosuchline/gencode create mode 100644 conf/type/__addifnosuchline/parameter/optional create mode 100644 conf/type/__addifnosuchline/parameter/required create mode 100644 doc/man/to_check/cdist-type-addifnosuchline.text diff --git a/conf/type/__addifnosuchline/explorer/findline b/conf/type/__addifnosuchline/explorer/findline new file mode 100755 index 00000000..9367be42 --- /dev/null +++ b/conf/type/__addifnosuchline/explorer/findline @@ -0,0 +1,41 @@ +#!/bin/sh +# +# 2010-2011 Daniel Roth (dani-cdist@d-roth.li) +# +# 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 . +# +# + +if [ -f "$__object/parameter/file" ]; then + file=$(cat "$__object/parameter/file") +else + file="/$__object_id" +fi + +regex=$(cat "$__object/parameter/line") +if [ -f "$file" ]; then + grep -q "^$regex\$" "$file" + if [ $? -eq 1 ]; then + # regex pattern not found --> success + echo "SUCCESS" + else + # regex pattern found --> failure + echo "FAILURE" + fi +else + # file does not exist --> line not in file + echo "SUCCESS" +fi diff --git a/conf/type/__addifnosuchline/gencode b/conf/type/__addifnosuchline/gencode new file mode 100755 index 00000000..898d93f9 --- /dev/null +++ b/conf/type/__addifnosuchline/gencode @@ -0,0 +1,33 @@ +#!/bin/sh +# +# 2010-2011 Daniel Roth (dani-cdist@d-roth.li) +# +# 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 . +# +# + +if [ -f "$__object/parameter/file" ]; then + file=$(cat "$__object/parameter/file") +else + file="/$__object_id" +fi + +result=$(cat "$__object/explorer/findline") + +if [ $result = "SUCCESS" ]; then + line=$(cat "$__object/parameter/line") + echo "echo $line >> $file" +fi diff --git a/conf/type/__addifnosuchline/parameter/optional b/conf/type/__addifnosuchline/parameter/optional new file mode 100644 index 00000000..f73f3093 --- /dev/null +++ b/conf/type/__addifnosuchline/parameter/optional @@ -0,0 +1 @@ +file diff --git a/conf/type/__addifnosuchline/parameter/required b/conf/type/__addifnosuchline/parameter/required new file mode 100644 index 00000000..a999a0c2 --- /dev/null +++ b/conf/type/__addifnosuchline/parameter/required @@ -0,0 +1 @@ +line diff --git a/doc/man/to_check/cdist-type-addifnosuchline.text b/doc/man/to_check/cdist-type-addifnosuchline.text new file mode 100644 index 00000000..09618dc3 --- /dev/null +++ b/doc/man/to_check/cdist-type-addifnosuchline.text @@ -0,0 +1,30 @@ +cdist-type-addifnosuchline(1) +====================== +Daniel Roth + + +NAME +---- +cdist-type-addifnosuchline + + +SYNOPSIS +-------- +cdist-type-addifnosuchline Add if no such line + + +DESCRIPTION +----------- +cdist-type-addifnosuchline can be used to check a file for existence of a +specific line and adding that if not found + + +SEE ALSO +-------- +cdist(7) + + +COPYING +------- +Copyright \(C) 2011 Daniel Roth. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). From 5333b98299d59d2b1e2c543cc3309baa7335bd60 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 7 Mar 2011 20:08:41 +0100 Subject: [PATCH 03/22] Testing/Demonstration of type addifnosuchline --- conf/manifest/init | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conf/manifest/init b/conf/manifest/init index e6cf47d5..bca93d06 100755 --- a/conf/manifest/init +++ b/conf/manifest/init @@ -10,7 +10,11 @@ __file /etc/cdist-configured --type file case "$__target_host" in # Everybody has this localhost) - __file test --type file --destination /tmp/cdist-testfile +# __file test --type file --destination /tmp/cdist-testfile + __addifnosuchline testfile_foo --file /tmp/myTestFile --line "foo" + __addifnosuchline testfile2_foo --file /tmp/myTestFile2 --line "foo" + __addifnosuchline testfile_bar --file /tmp/myTestFile --line "bar" + __addifnosuchline /tmp/myTestFile3 --line "bar" ;; # Alias in /etc/hosts for localhost From 35df79534210b4bb68bd6043a74eecd34c26f758 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 8 Mar 2011 20:21:10 +0100 Subject: [PATCH 04/22] Return values replaced --- conf/type/__addifnosuchline/explorer/findline | 9 +++------ conf/type/__addifnosuchline/gencode | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/conf/type/__addifnosuchline/explorer/findline b/conf/type/__addifnosuchline/explorer/findline index 9367be42..c1633626 100755 --- a/conf/type/__addifnosuchline/explorer/findline +++ b/conf/type/__addifnosuchline/explorer/findline @@ -29,13 +29,10 @@ regex=$(cat "$__object/parameter/line") if [ -f "$file" ]; then grep -q "^$regex\$" "$file" if [ $? -eq 1 ]; then - # regex pattern not found --> success - echo "SUCCESS" + echo "NOTFOUND" else - # regex pattern found --> failure - echo "FAILURE" + echo "FOUND" fi else - # file does not exist --> line not in file - echo "SUCCESS" + echo "NOTFOUND" fi diff --git a/conf/type/__addifnosuchline/gencode b/conf/type/__addifnosuchline/gencode index 898d93f9..f97789ae 100755 --- a/conf/type/__addifnosuchline/gencode +++ b/conf/type/__addifnosuchline/gencode @@ -27,7 +27,7 @@ fi result=$(cat "$__object/explorer/findline") -if [ $result = "SUCCESS" ]; then +if [ "$result" = "NOTFOUND" ]; then line=$(cat "$__object/parameter/line") echo "echo $line >> $file" fi From d4fac0951866e9ecf09571fcae1276521b14b85b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 10 Mar 2011 19:16:21 +0100 Subject: [PATCH 05/22] fail, if source is not existing Signed-off-by: Nico Schottelius --- conf/type/__file/gencode | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conf/type/__file/gencode b/conf/type/__file/gencode index 1fb20bf9..5f386349 100755 --- a/conf/type/__file/gencode +++ b/conf/type/__file/gencode @@ -79,6 +79,9 @@ case "$type" in # 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 From b8772f073db0ea49a8737bd41c31d9dfff8f4f30 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 10 Mar 2011 19:41:18 +0100 Subject: [PATCH 06/22] +thoughts Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 87b61b47..f10db701 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,3 +1,7 @@ - Support singletons (see types/issue for a good reason) - add documentation! +- think about splitting __file: + __file --source + __directory --recursive yes|no --source + __link --type symbolic|hard From e5d2874c245f6af09dafa62f3038c98b85076090 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 10 Mar 2011 21:49:49 +0100 Subject: [PATCH 07/22] +asciidoc hint Signed-off-by: Nico Schottelius --- REAL_README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/REAL_README b/REAL_README index ab070b38..474dde56 100644 --- a/REAL_README +++ b/REAL_README @@ -79,7 +79,7 @@ To install cdist, execute the following commands: cd cdist export PATH=$PATH:$(pwd -P)/bin - # If you want the manpages + # If you want the manpages (requires asciidoc to be installed) make man export MANPATH=$MANPATH:$(pwd -P)/doc/man From 53e3e718642d85add77dc44ddf5a36d34a65737f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 10 Mar 2011 23:14:57 +0100 Subject: [PATCH 08/22] + used_by Signed-off-by: Nico Schottelius --- REAL_README | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/REAL_README b/REAL_README index 474dde56..5c66f96b 100644 --- a/REAL_README +++ b/REAL_README @@ -129,3 +129,24 @@ You can join the development ***IRC channel*** 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) + +with cdist on a total of **2** production servers. From 65f09477d0a4592502eae72dd3e6181db719fdf0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 10 Mar 2011 23:15:49 +0100 Subject: [PATCH 09/22] +urls Signed-off-by: Nico Schottelius --- REAL_README | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/REAL_README b/REAL_README index 5c66f96b..46e0c3ee 100644 --- a/REAL_README +++ b/REAL_README @@ -149,4 +149,6 @@ Yes, I'm actually eating my own dogfood and currently managing * [apache](http://httpd.apache.org/) (webserver) * [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication) -with cdist on a total of **2** production servers. +with cdist on a total of **2** production servers of the +[Systems Group](http://www.systems.ethz.ch) at the +[ETH Zurich](http://www.ethz.ch). From a145ca32f4d466f17a885da7ae1bd615f1a7ae29 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 11 Mar 2011 16:20:29 +0100 Subject: [PATCH 10/22] update used_by section Signed-off-by: Nico Schottelius --- REAL_README | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/REAL_README b/REAL_README index 46e0c3ee..e69c36ba 100644 --- a/REAL_README +++ b/REAL_README @@ -148,7 +148,9 @@ Yes, I'm actually eating my own dogfood and currently managing * [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) -with cdist on a total of **2** production servers of the +with cdist on a total of **3** production servers of the [Systems Group](http://www.systems.ethz.ch) at the [ETH Zurich](http://www.ethz.ch). From 783c4b12ca9fb3107dc745c71f6628e6db05c86c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 11 Mar 2011 19:08:52 +0100 Subject: [PATCH 11/22] [__issue] remove unneeded parameters Signed-off-by: Nico Schottelius --- conf/type/__issue/parameter/optional | 0 conf/type/__issue/parameter/required | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 conf/type/__issue/parameter/optional delete mode 100644 conf/type/__issue/parameter/required diff --git a/conf/type/__issue/parameter/optional b/conf/type/__issue/parameter/optional deleted file mode 100644 index e69de29b..00000000 diff --git a/conf/type/__issue/parameter/required b/conf/type/__issue/parameter/required deleted file mode 100644 index e69de29b..00000000 From 19c7317cbbd38c4f9731186a29508dd34a4e2dc4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 11 Mar 2011 19:09:36 +0100 Subject: [PATCH 12/22] [DOC] document singleton behaviour in type manpage Signed-off-by: Nico Schottelius --- bin/cdist-config | 2 +- doc/dev/todo/niconext | 16 ++++++++++------ doc/man/cdist-type.text | 37 +++++++++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/bin/cdist-config b/bin/cdist-config index 54984eaf..ce07fde8 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -19,7 +19,7 @@ # # -# Fail if something bogus is going on and export all variables +# Fail if something bogus is going on set -u ################################################################################ diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index f10db701..239a1f83 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,7 +1,11 @@ -- Support singletons (see types/issue for a good reason) - - add documentation! - - think about splitting __file: - __file --source - __directory --recursive yes|no --source - __link --type symbolic|hard + __file + source + mode + owner + __directory + parents + mode + owner + __link + type symbolic | hard diff --git a/doc/man/cdist-type.text b/doc/man/cdist-type.text index 2835815e..7c8b49f3 100644 --- a/doc/man/cdist-type.text +++ b/doc/man/cdist-type.text @@ -10,7 +10,9 @@ cdist-type - Functionality bundled SYNOPSIS -------- -Other languages name this module or class +__TYPE ID --parameter value [--parameter value ...] + +__TYPE --parameter value [--parameter value ...] (for singletons) DESCRIPTION @@ -37,7 +39,23 @@ Internally cdist-type-emulator(1) will be called from cdist-manifest-run(1) to save the given parameters into a cconfig database, so they can be accessed by the manifest and gencode scripts of the type (see below). -A list of supported types can be found in the cdist-type-listing(7) manpage. +A list of supported types can be found in the cdist-reference(7) manpage. + +SINGLETON TYPES +--------------- +If a type is flagged as a singleton, it may me used only once. This +is useful for types which can be used only once on a system. If a type +can only be used once, it does not take an + +Example: +-------------------------------------------------------------------------------- +# __issue type manages /etc/issue +__issue + +# Probably your own type - singletons may use parameters +__myfancysingleton --colour green +-------------------------------------------------------------------------------- + HOW TO WRITE A NEW TYPE @@ -46,6 +64,7 @@ A type consists of - parameter (optional) - manifest (optional) +- singleton (optional) - explorer (optional) - gencode (optional) @@ -98,6 +117,20 @@ Always ensure the manifest is executable, otherwise cdist will not be able to execute it. +SINGLETON - ONLY INSTANCE ONLY +------------------------------ +If you want to ensure that a type can only be used once per target, you can +mark it as a singleton: Just create the (empty) file "singleton" in your type +directory. This will also change the way your type must be called: + +-------------------------------------------------------------------------------- +__YOURTYPE --parameter value +-------------------------------------------------------------------------------- + +As you can see, the ID is omitted, because it does not make any sense, if your +type can be used only once. + + THE TYPE EXPLORERS ------------------ If a type needs to explore specific details, it can provide type specific From 0dc9c7f8ff148eb81ae92c2ad33b41639ae66ce4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 11 Mar 2011 19:15:28 +0100 Subject: [PATCH 13/22] [TODO] update lists Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 11 ----------- doc/dev/todo/post-1.0 | 33 +++++++++++++++++---------------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 239a1f83..e69de29b 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,11 +0,0 @@ -- think about splitting __file: - __file - source - mode - owner - __directory - parents - mode - owner - __link - type symbolic | hard diff --git a/doc/dev/todo/post-1.0 b/doc/dev/todo/post-1.0 index 8ea11dd4..6d248db5 100644 --- a/doc/dev/todo/post-1.0 +++ b/doc/dev/todo/post-1.0 @@ -1,13 +1,8 @@ -Type handler: - - add dependency parameters to core available for every type - --requires - --excludes? - -Stage 5 (code execution): - - check return codes - - abort on first error? - - dependencies - +Dependencies: + - Add meta parameters like --requires --excludes --depends? + - Build dependency tree + - Exit on any error + - Check return codes Types to be written/extended: - __ssh-keys (host/user) @@ -20,6 +15,18 @@ Types to be written/extended: - __file: - template == [shell script] stdout - cron + - __file: think about splitting + __file + source + mode + owner + __directory + parents + mode + owner + __link + type symbolic | hard + Documentation: - Describe Multi master setups @@ -58,9 +65,3 @@ Documentation: - cdist-type-build-emulation - cdist-type-emulator - Ensure html output of manpages are published on the web --------------------------------------------------------------------------------- -Fix: -Running initial manifest for sgv-wiki-01 ... -/tmp/cdist.VfhjaH8LP3GE/out/type_bin/__ethz_systems_wiki: Zeile 87: /home/users/nico/privat/firmen/ethz/vcs/cdist/conf/type/__ethz_systems_wiki/parameter/required: Datei oder Verzeichnis nicht gefunden -/tmp/cdist.VfhjaH8LP3GE/out/type_bin/__ethz_systems_wiki: Zeile 94: /home/users/nico/privat/firmen/ethz/vcs/cdist/conf/type/__ethz_systems_wiki/parameter/optional: Datei oder Verzeichnis nicht gefunden - From 6a591d3e06a424c20fa5975fe0b4e98bdd61e597 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 11 Mar 2011 19:17:31 +0100 Subject: [PATCH 14/22] update version to be indpendent of git tree Otherwise versions will include changes by users, which will not be helpful for development. Signed-off-by: Nico Schottelius --- bin/cdist-config | 2 +- doc/changelog | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/cdist-config b/bin/cdist-config index ce07fde8..c1498f58 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -31,7 +31,7 @@ __cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)" __cdist_myname=${0##*/}; __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" -: ${__cdist_version:="$(cd "$__cdist_abs_mydir/.." && git describe)"} +__cdist_version="1.0.3" ################################################################################ # Names / Constants diff --git a/doc/changelog b/doc/changelog index 4bca6d9c..d5c5f882 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,7 +1,7 @@ -1.0.3: upcoming +1.0.3: 2011-03-11 * Update regexp used for sane characters * Allow types without parameters - * Allow type to be singleton (DOCUMENTATION MISSING) + * Allow type to be singleton * Type __file learned --type symlink 1.0.2: 2011-03-09 From 068a7d272b38851504ec64bd5328947c3fc91c51 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 11 Mar 2011 19:25:55 +0100 Subject: [PATCH 15/22] place version on top Signed-off-by: Nico Schottelius --- bin/cdist-config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cdist-config b/bin/cdist-config index c1498f58..0d0fd152 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -19,6 +19,8 @@ # # +__cdist_version="1.0.3" + # Fail if something bogus is going on set -u @@ -31,8 +33,6 @@ __cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)" __cdist_myname=${0##*/}; __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" -__cdist_version="1.0.3" - ################################################################################ # Names / Constants # From f8b8ba32facae6740688fb509ae3f8e36c9f4c7b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 11 Mar 2011 23:42:44 +0100 Subject: [PATCH 16/22] add new cdist-env Signed-off-by: Nico Schottelius --- bin/cdist-env | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 bin/cdist-env diff --git a/bin/cdist-env b/bin/cdist-env new file mode 100755 index 00000000..e95e078b --- /dev/null +++ b/bin/cdist-env @@ -0,0 +1,33 @@ +#!/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 . +# +# +# Setup environment for use with cdist +# + +. cdist-config +[ $# -eq 0 ] || __cdist_usage "no arguments" + +# Allow access to unset variables like PATH and MANPATH +set +u + +echo export PATH=$__cdist_abs_mydir:$PATH + +cd "$__cdist_abs_mydir/../doc/man" +echo export MANPATH=$(pwd -P):$MANPATH From ff1eb0895b6277c50b4a0d366647ae0aa9ec9c82 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 12 Mar 2011 18:47:34 +0100 Subject: [PATCH 17/22] add new type: __motd Signed-off-by: Nico Schottelius --- conf/type/__motd/README | 1 + conf/type/__motd/files/motd | 17 +++++++++++++ conf/type/__motd/man.text | 48 +++++++++++++++++++++++++++++++++++++ conf/type/__motd/manifest | 31 ++++++++++++++++++++++++ conf/type/__motd/singleton | 0 5 files changed, 97 insertions(+) create mode 100644 conf/type/__motd/README create mode 100644 conf/type/__motd/files/motd create mode 100644 conf/type/__motd/man.text create mode 100755 conf/type/__motd/manifest create mode 100644 conf/type/__motd/singleton diff --git a/conf/type/__motd/README b/conf/type/__motd/README new file mode 100644 index 00000000..f7bbde5c --- /dev/null +++ b/conf/type/__motd/README @@ -0,0 +1 @@ +Manage /etc/issue diff --git a/conf/type/__motd/files/motd b/conf/type/__motd/files/motd new file mode 100644 index 00000000..b5f5bfdf --- /dev/null +++ b/conf/type/__motd/files/motd @@ -0,0 +1,17 @@ + +Welcome to a cdist automated systems! + + .. . .x+=:. s + dF @88> z` ^% :8 + '88bu. %8P . + + +NAME +---- +cdist-type__motd - Manage message of the day + + +DESCRIPTION +----------- +This cdist type allows you to easily setup /etc/motd. + + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +source:: + If supplied, copy this file from the host running cdist to the target. + If not supplied, a default message will be placed onto the target. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Use cdist defaults +__motd + +# Supply source file from a different type +__file --source "$__type/files/my-motd" +-------------------------------------------------------------------------------- + + +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/__motd/manifest b/conf/type/__motd/manifest new file mode 100755 index 00000000..594977b9 --- /dev/null +++ b/conf/type/__motd/manifest @@ -0,0 +1,31 @@ +#!/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 . +# +# + +destination=/etc/motd + +# Select motd source +if [ -f "$__object/parameter/source" ]; then + source="$(cat "$__object/parameter/source")" +else + source="$__type/files/motd" +fi + +__file "$destination" --source "$source" --type file diff --git a/conf/type/__motd/singleton b/conf/type/__motd/singleton new file mode 100644 index 00000000..e69de29b From 5bd26959e683cc82841d7b95f306deedb68f0559 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 12 Mar 2011 18:48:02 +0100 Subject: [PATCH 18/22] update changelog Signed-off-by: Nico Schottelius --- doc/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/changelog b/doc/changelog index d5c5f882..aa466277 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,3 +1,6 @@ +1.0.4: + * New type: __motd + 1.0.3: 2011-03-11 * Update regexp used for sane characters * Allow types without parameters From 32042aba8fb8b05fbe9ca6b9c1b9b20ab06608fa Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 12 Mar 2011 18:58:22 +0100 Subject: [PATCH 19/22] cleanup motd Signed-off-by: Nico Schottelius --- conf/type/__motd/files/motd | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/conf/type/__motd/files/motd b/conf/type/__motd/files/motd index b5f5bfdf..fcba183d 100644 --- a/conf/type/__motd/files/motd +++ b/conf/type/__motd/files/motd @@ -1,17 +1,16 @@ -Welcome to a cdist automated systems! - - .. . .x+=:. s - dF @88> z` ^% :8 - '88bu. %8P . z` ^% :8 + '88bu. %8P . Date: Sat, 12 Mar 2011 19:07:19 +0100 Subject: [PATCH 20/22] +banner in readme Signed-off-by: Nico Schottelius --- REAL_README | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/REAL_README b/REAL_README index e69c36ba..0938289f 100644 --- a/REAL_README +++ b/REAL_README @@ -1,5 +1,20 @@ [[!meta title="cdist - configuration management"]] + + .. . .x+=:. s + dF @88> z` ^% :8 + '88bu. %8P . Date: Sat, 12 Mar 2011 19:48:37 +0100 Subject: [PATCH 21/22] [DOC] type __issue Signed-off-by: Nico Schottelius --- conf/type/__issue/README | 1 - conf/type/__issue/man.text | 41 ++++++++++++++++++++++++++++++++++++++ conf/type/__motd/README | 1 - doc/changelog | 4 +++- 4 files changed, 44 insertions(+), 3 deletions(-) delete mode 100644 conf/type/__issue/README create mode 100644 conf/type/__issue/man.text delete mode 100644 conf/type/__motd/README diff --git a/conf/type/__issue/README b/conf/type/__issue/README deleted file mode 100644 index f7bbde5c..00000000 --- a/conf/type/__issue/README +++ /dev/null @@ -1 +0,0 @@ -Manage /etc/issue diff --git a/conf/type/__issue/man.text b/conf/type/__issue/man.text new file mode 100644 index 00000000..57ece530 --- /dev/null +++ b/conf/type/__issue/man.text @@ -0,0 +1,41 @@ +cdist-type__issue(7) +=================== +Nico Schottelius + + +NAME +---- +cdist-type__issue - Manage issue + + +DESCRIPTION +----------- +This cdist type allows you to easily setup /etc/issue. + + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +None + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +__issue +-------------------------------------------------------------------------------- + + +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/__motd/README b/conf/type/__motd/README deleted file mode 100644 index f7bbde5c..00000000 --- a/conf/type/__motd/README +++ /dev/null @@ -1 +0,0 @@ -Manage /etc/issue diff --git a/doc/changelog b/doc/changelog index aa466277..c939b547 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,5 +1,7 @@ 1.0.4: - * New type: __motd + * New type __motd + * New type __addifnosuchline + * Document type __issue 1.0.3: 2011-03-11 * Update regexp used for sane characters From 6ab7df596e3fe860f555675a8ce20a57e1a5429c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 12 Mar 2011 19:48:51 +0100 Subject: [PATCH 22/22] +cleanup Signed-off-by: Nico Schottelius --- .gitignore | 4 ++++ doc/dev/todo/post-1.0 | 1 + 2 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index ba65e3f8..d7c6f7c2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ +# -vim .*.swp + +# Ignore generated manpages doc/man/*.[1-9] doc/man/.marker doc/man/man*/ +conf/type/*/*.7 diff --git a/doc/dev/todo/post-1.0 b/doc/dev/todo/post-1.0 index 63872eb2..49c6f8b0 100644 --- a/doc/dev/todo/post-1.0 +++ b/doc/dev/todo/post-1.0 @@ -25,6 +25,7 @@ Types to be written/extended: owner __link type symbolic | hard + - __issue: add --source Documentation: