From 37d4ecd9073dbc4294b9b30f136cd127bec6d0f8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 23 Jun 2011 13:38:36 +0200 Subject: [PATCH 1/9] init.sample fix Franky Van Liedekerke: > - the example init.sample file mentioned "deinstalled" for package > state, but I believe it should be "removed" Signed-off-by: Nico Schottelius --- conf/manifest/init.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/manifest/init.sample b/conf/manifest/init.sample index b683e02f..fca959e2 100755 --- a/conf/manifest/init.sample +++ b/conf/manifest/init.sample @@ -50,7 +50,7 @@ case "$__target_host" in cdist-debian) __package_apt atop --state installed - __package apache2 --state deinstalled + __package apache2 --state removed ;; cdist-redhat) From 41ee5125962352e439a4d5273e4fe9088e4fd1e7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 25 Jun 2011 23:12:38 +0200 Subject: [PATCH 2/9] update doc of __process: cannot start sshd, shouldn't stop sshd Signed-off-by: Nico Schottelius --- conf/type/__process/man.text | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/type/__process/man.text b/conf/type/__process/man.text index 3f7004c7..fd3bcf49 100644 --- a/conf/type/__process/man.text +++ b/conf/type/__process/man.text @@ -35,16 +35,16 @@ EXAMPLES -------- -------------------------------------------------------------------------------- -# Start /usr/sbin/sshd if not running -__process /usr/sbin/sshd --state running +# Start if not running +__process /usr/sbin/syslog-ng --state running -# Start /usr/sbin/sshd if not running with a different binary -__process /usr/sbin/sshd --state running --start "/etc/rc.d/sshd start" +# Start if not running with a different binary +__process /usr/sbin/nginx --state running --start "/etc/rc.d/nginx start" -# Stop the process using kill (the type default) +# Stop the process using kill (the type default) - DO NOT USE THIS __process /usr/sbin/sshd --state stopped -# Stop the process using /etc/rc.d/sshd stop +# Stop the process using /etc/rc.d/sshd stop - THIS ONE NOT AS WELL __process /usr/sbin/sshd --state stopped --stop "/etc/rc.d/sshd stop" # Ensure cups is running, which runs with -C ...: From dd949d5984aa826d9827d4dde133e33e7a86df64 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 1 Jul 2011 13:14:26 +0200 Subject: [PATCH 3/9] explorers for types with clashing names not pushed to target Thorsten Steenbock reported a bug where types with similar names, e.g __first __first_second would interfere when transfering explorers to the target host. Signed-off-by: Steven Armstrong --- bin/cdist-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist-config b/bin/cdist-config index f7fb5ac0..88e3068f 100644 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -398,7 +398,7 @@ __cdist_type_has_explorer() __cdist_type_explorer_pushed() { [ -f "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" ] \ - && grep -q "$1" "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" + && grep -x -q "$1" "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" } __cdist_type_explorer_pushed_add() From 0736f7dfd3d0c2a1978c87e27d1e69d42e4cedf4 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 1 Jul 2011 14:42:17 +0200 Subject: [PATCH 4/9] ideas for type improvements Signed-off-by: Steven Armstrong --- doc/dev/logs/2011-07-01.type-gencode | 9 ++++++++ doc/dev/logs/2011-07-01.type-global-explorers | 22 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 doc/dev/logs/2011-07-01.type-gencode create mode 100644 doc/dev/logs/2011-07-01.type-global-explorers diff --git a/doc/dev/logs/2011-07-01.type-gencode b/doc/dev/logs/2011-07-01.type-gencode new file mode 100644 index 00000000..cafa8ef2 --- /dev/null +++ b/doc/dev/logs/2011-07-01.type-gencode @@ -0,0 +1,9 @@ +when all objects of a type are applied, then run the types gencode-{local,remote} scripts + +-------------------------------------------------------------------------------- + +__mein_type/ + type/ # executed when all objects of this type have been applied + gencode-local + gencode-remote + diff --git a/doc/dev/logs/2011-07-01.type-global-explorers b/doc/dev/logs/2011-07-01.type-global-explorers new file mode 100644 index 00000000..302c2866 --- /dev/null +++ b/doc/dev/logs/2011-07-01.type-global-explorers @@ -0,0 +1,22 @@ +types can contribute global explorers +-------------------------------------------------------------------------------- + +__mein_type/ + global/ + explorer/ + status-von-foo + anderer + +$out/explorer/ + hostname + os + ... + __mein_type/ + status-von-foo + anderer + + +todos: +- cdist scans types for global/explorer's +- when executing explorers, create the types namespace folder before running type gobal explorers + From aa6b655cd3758bddd6b2b371590738cb445174e7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 1 Jul 2011 16:02:03 +0200 Subject: [PATCH 5/9] new executable that uses its stdin as the initial manifest Signed-off-by: Steven Armstrong --- bin/cdist-deploy-stdin-to | 36 +++++++++++++++++++++++++ doc/man/man1/cdist-deploy-stdin-to.text | 30 +++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100755 bin/cdist-deploy-stdin-to create mode 100644 doc/man/man1/cdist-deploy-stdin-to.text diff --git a/bin/cdist-deploy-stdin-to b/bin/cdist-deploy-stdin-to new file mode 100755 index 00000000..391dd431 --- /dev/null +++ b/bin/cdist-deploy-stdin-to @@ -0,0 +1,36 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# 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 . +# +# +# Use stdin as the manifest to deploy on the given host. +# + +. cdist-config +[ $# -eq 1 ] || __cdist_usage "" +set -eu + +__cdist_target_host="$1" +shift + +cat >> "$__cdist_tmp_file" + +chmod +x "$__cdist_tmp_file" + +export __cdist_manifest_init="$__cdist_tmp_file" +cdist-deploy-to "$__cdist_target_host" diff --git a/doc/man/man1/cdist-deploy-stdin-to.text b/doc/man/man1/cdist-deploy-stdin-to.text new file mode 100644 index 00000000..14f19478 --- /dev/null +++ b/doc/man/man1/cdist-deploy-stdin-to.text @@ -0,0 +1,30 @@ +cdist-deploy-stdin-to(1) +======================== +Steven Armstrong + + +NAME +---- +cdist-deploy-stdin-to - Deploy the configuration given on stdin to host + + +SYNOPSIS +-------- +echo "__file /tmp/whatever" | cdist-deploy-stdin-to HOSTNAME + + +DESCRIPTION +----------- +Use stdin as the manifest for cdist-deploy-to. + + +SEE ALSO +-------- +- cdist(7) +- cdist-deploy-to(1) + + +COPYING +------- +Copyright \(C) 2011 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). From 8dd994d1a65f336ffbe5142a804747e5b4eb8242 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 1 Jul 2011 15:37:09 +0200 Subject: [PATCH 6/9] new type: __apt_update_index Signed-off-by: Steven Armstrong --- conf/type/__apt_update_index/gencode-remote | 26 +++++++++++++ conf/type/__apt_update_index/man.text | 41 +++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100755 conf/type/__apt_update_index/gencode-remote create mode 100644 conf/type/__apt_update_index/man.text diff --git a/conf/type/__apt_update_index/gencode-remote b/conf/type/__apt_update_index/gencode-remote new file mode 100755 index 00000000..e66ff7a3 --- /dev/null +++ b/conf/type/__apt_update_index/gencode-remote @@ -0,0 +1,26 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# 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 . +# + +# run 'apt-get update' if anything in /etc/apt is newer then /var/lib/apt/lists +cat << DONE +if find /etc/apt -cnewer /var/lib/apt/lists | grep . > /dev/null; then + apt-get update || apt-get update +fi +DONE diff --git a/conf/type/__apt_update_index/man.text b/conf/type/__apt_update_index/man.text new file mode 100644 index 00000000..778af508 --- /dev/null +++ b/conf/type/__apt_update_index/man.text @@ -0,0 +1,41 @@ +cdist-type__apt_update_index(7) +=============================== +Steven Armstrong + + +NAME +---- +cdist-type__apt_update_index - update apt's package index + + +DESCRIPTION +----------- +This cdist type runs apt-get update whenever any apt sources have changed. + + +REQUIRED PARAMETERS +------------------- +None. + +OPTIONAL PARAMETERS +------------------- +None. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +__apt_update_index +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2011 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). From 9c887319e64ae6c974049a1498d7c11d4d7813c7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 1 Jul 2011 15:38:06 +0200 Subject: [PATCH 7/9] use new type __apt_update_index Signed-off-by: Steven Armstrong --- conf/type/__apt_ppa/manifest | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/type/__apt_ppa/manifest b/conf/type/__apt_ppa/manifest index d5df9e23..5aa84931 100755 --- a/conf/type/__apt_ppa/manifest +++ b/conf/type/__apt_ppa/manifest @@ -27,3 +27,4 @@ require="__package/python-software-properties" \ --source "$__type/files/remove-apt-repository" \ --mode 0755 +require="$__self" __apt_update_index From ef393a5b8e72380732fc439b6b7539f12dfaeac7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 1 Jul 2011 16:15:08 +0200 Subject: [PATCH 8/9] make __apt_update_index a singleton Signed-off-by: Steven Armstrong --- conf/type/__apt_update_index/singleton | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 conf/type/__apt_update_index/singleton diff --git a/conf/type/__apt_update_index/singleton b/conf/type/__apt_update_index/singleton new file mode 100644 index 00000000..e69de29b From c631a609eddd2e84b7ca7b75480b1e7f26515314 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 1 Jul 2011 16:43:30 +0200 Subject: [PATCH 9/9] +docs Signed-off-by: Steven Armstrong --- conf/type/__package_apt/notes.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 conf/type/__package_apt/notes.txt diff --git a/conf/type/__package_apt/notes.txt b/conf/type/__package_apt/notes.txt new file mode 100644 index 00000000..4b89f9b3 --- /dev/null +++ b/conf/type/__package_apt/notes.txt @@ -0,0 +1,3 @@ +# All you ever wanted to know about apt/apt-get +http://wiki.ubuntuusers.de/apt-get +