From a28ac9bedca9581b1c28d8af44f66bf8280094a8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 4 Apr 2011 12:15:13 +0200 Subject: [PATCH 01/21] ++todo 1.6 Signed-off-by: Nico Schottelius --- doc/dev/todo/1.6 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/dev/todo/1.6 b/doc/dev/todo/1.6 index 1be7274f..12a83e93 100644 --- a/doc/dev/todo/1.6 +++ b/doc/dev/todo/1.6 @@ -1 +1,3 @@ -- adjust documentation / stages +Documentation: + - update stages + - go through all manpages and ensure __ and co are correct From 09bf63ffca43d10320f20fd41dfb0943275ccf9f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 4 Apr 2011 12:19:02 +0200 Subject: [PATCH 02/21] [DOC] remove some formatting issues in cdist-reference Signed-off-by: Nico Schottelius --- doc/man/cdist-reference.text.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 8fb24362..a5d1698a 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -45,9 +45,11 @@ cdist-reference - Variable, path and type reference for cdist DESCRIPTION ----------- -Various scripts which are not in the core need information on how -to find information. This manpage summarises the available environment -variables, types and paths and clearifies with part may access which variables. +This reference summarises + +- environment variables +- paths +- types PATHS @@ -62,7 +64,6 @@ conf/manifest/init:: It is an executable (+x bit set) shell script that can use values from the explorers to decide which configuration to create for the specified target host. - It should be primary used to define mapping from configurations to hosts. conf/manifest/*:: @@ -103,15 +104,12 @@ conf/type//parameters/optional:: conf/type//explorer:: Location of the type specific explorers. - This directory is referenced by the variable __type_explorer (see below). - See cdist-explorer(7). out/:: This directory contains output of cdist and is usually located in a temporary directory and thus will be removed after the run. - This directory is referenced by the variable __global (see below). out/explorer:: @@ -122,7 +120,6 @@ out/object:: out/object/:: Contains all object specific information. - This directory is referenced by the variable __object (see below). out/object//explorers:: @@ -138,8 +135,8 @@ TYPES The available types are listed in the SEE ALSO section and are referenced as cdist-type__TYPENAME. -VARIABLES ---------- +ENVIRONMENT VARIABLES +--------------------- __explorer:: Directory that contains all explorers. Available for: explorer From 785ec3f36ff7315012cf0ac037a5e01d8a2210cd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 4 Apr 2011 13:20:22 +0200 Subject: [PATCH 03/21] sort fields by alphabet Signed-off-by: Nico Schottelius --- conf/type/__user/gencode-remote | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/conf/type/__user/gencode-remote b/conf/type/__user/gencode-remote index 8f4222c3..7670b943 100755 --- a/conf/type/__user/gencode-remote +++ b/conf/type/__user/gencode-remote @@ -32,10 +32,6 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then file="$__object/explorer/passwd" case "$property" in - password) - field=3 - file="$__object/explorer/shadow" - ;; gid) if $(echo "$new_value" | grep -q '^[0-9][0-9]*$'); then field=4 @@ -45,10 +41,14 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then field=1 fi ;; - uid) field=3 ;; + password) + field=3 + file="$__object/explorer/shadow" + ;; comment) field=5 ;; home) field=6 ;; shell) field=7 ;; + uid) field=3 ;; esac export field From 654512c2096cedff06aa696e407f995034572397 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 4 Apr 2011 23:50:48 +0200 Subject: [PATCH 04/21] add template for __package_openbsd_pkg Signed-off-by: Nico Schottelius --- .../explorer/pkg_version | 30 +++++++++++ .../type/__package_openbsd_pkg/gencode-remote | 52 ++++++++++++++++++ conf/type/__package_openbsd_pkg/man.text | 53 +++++++++++++++++++ .../__package_openbsd_pkg/parameter/optional | 1 + .../__package_openbsd_pkg/parameter/required | 1 + 5 files changed, 137 insertions(+) create mode 100755 conf/type/__package_openbsd_pkg/explorer/pkg_version create mode 100755 conf/type/__package_openbsd_pkg/gencode-remote create mode 100644 conf/type/__package_openbsd_pkg/man.text create mode 100644 conf/type/__package_openbsd_pkg/parameter/optional create mode 100644 conf/type/__package_openbsd_pkg/parameter/required diff --git a/conf/type/__package_openbsd_pkg/explorer/pkg_version b/conf/type/__package_openbsd_pkg/explorer/pkg_version new file mode 100755 index 00000000..4f612423 --- /dev/null +++ b/conf/type/__package_openbsd_pkg/explorer/pkg_version @@ -0,0 +1,30 @@ +#!/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 . +# +# +# Retrieve the status of a package - parsed dpkg output +# + +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name="$__object_id" +fi + +pacman -Q "$name" 2>/dev/null | awk '{ print $2 }' diff --git a/conf/type/__package_openbsd_pkg/gencode-remote b/conf/type/__package_openbsd_pkg/gencode-remote new file mode 100755 index 00000000..536b7708 --- /dev/null +++ b/conf/type/__package_openbsd_pkg/gencode-remote @@ -0,0 +1,52 @@ +#!/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 . +# +# +# Manage packages with Pacman (mostly archlinux) +# + +# Debug +# exec >&2 +# set -x + +pacopts="--noconfirm --noprogressbar" + +if [ -f "$__object/parameter/name" ]; then + name="$__object/parameter/name" +else + name="$__object_id" +fi + +state="$(cat "$__object/parameter/state")" +pkg_version="$(cat "$__object/explorer/pkg_version")" + +case "$state" in + installed) + + # Empty? Not installed. + if [ -z "$pkg_version" ]; then + echo pacman "$pacopts" -S \"$name\" + fi + ;; + uninstalled) + if [ "$pkg_version" ]; then + echo pacman "$pacopts" -R \"$name\" + fi + ;; +esac diff --git a/conf/type/__package_openbsd_pkg/man.text b/conf/type/__package_openbsd_pkg/man.text new file mode 100644 index 00000000..35a7e44c --- /dev/null +++ b/conf/type/__package_openbsd_pkg/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). diff --git a/conf/type/__package_openbsd_pkg/parameter/optional b/conf/type/__package_openbsd_pkg/parameter/optional new file mode 100644 index 00000000..f121bdbf --- /dev/null +++ b/conf/type/__package_openbsd_pkg/parameter/optional @@ -0,0 +1 @@ +name diff --git a/conf/type/__package_openbsd_pkg/parameter/required b/conf/type/__package_openbsd_pkg/parameter/required new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/conf/type/__package_openbsd_pkg/parameter/required @@ -0,0 +1 @@ +state From 02da74e4374732ba4e8060ed446e5960ac70d811 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 4 Apr 2011 23:57:36 +0200 Subject: [PATCH 05/21] add explorer os_version supporting openbsd Signed-off-by: Nico Schottelius --- conf/explorer/os_version | 97 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100755 conf/explorer/os_version diff --git a/conf/explorer/os_version b/conf/explorer/os_version new file mode 100755 index 00000000..d4dd2bc9 --- /dev/null +++ b/conf/explorer/os_version @@ -0,0 +1,97 @@ +#!/bin/sh +# +# 2010-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 . +# +# +# All os variables are lower case +# +# + +case "$($__explorer/os)" in + openbsd) + uname -r + ;; +esac + +exit 0 + +# Ubuntu is also Debian, thus return if Ubuntu was found +if grep -q ^DISTRIB_ID=Ubuntu /etc/lsb-release 2>/dev/null; then + echo ubuntu + exit 0 +fi + +if [ -f /etc/arch-release ]; then + echo archlinux + exit 0 +fi + +if [ -f /etc/debian_version ]; then + echo debian + exit 0 +fi + +if [ -f /etc/gentoo-release ]; then + echo gentoo + exit 0 +fi + +# Fedora is also Redhat, thus return before redhat! +if grep -q ^Fedora /etc/redhat-release 2>/dev/null; then + echo fedora + exit 0 +fi + +if [ -f /etc/redhat-release ]; then + echo redhat + exit 0 +fi + +if [ -f /etc/SuSE-release ]; then + echo suse + exit 0 +fi + +uname_s="$(uname -s)" + +# Assume there is no tr on the client -> do lower case ourselves +case "$uname_s" in + Darwin) + echo macosx + exit 0 + ;; + NetBSD) + echo netbsd + exit 0 + ;; + FreeBSD) + echo freebsd + exit 0 + ;; + OpenBSD) + echo openbsd + exit 0 + ;; + SunOS) + echo solaris + exit 0 + ;; +esac + +echo "Unknown OS" >&2 +exit 1 From b474960774607c03e96b967374478a1bb8c79e6e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 00:03:23 +0200 Subject: [PATCH 06/21] explorer os_version supports macosx Signed-off-by: Nico Schottelius --- conf/explorer/os_version | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/conf/explorer/os_version b/conf/explorer/os_version index d4dd2bc9..02e2e2cd 100755 --- a/conf/explorer/os_version +++ b/conf/explorer/os_version @@ -23,7 +23,11 @@ # case "$($__explorer/os)" in - openbsd) + archlinux) + # empty, but well... + cat /etc/arch-release + ;; + macosx|openbsd) uname -r ;; esac @@ -36,11 +40,6 @@ if grep -q ^DISTRIB_ID=Ubuntu /etc/lsb-release 2>/dev/null; then exit 0 fi -if [ -f /etc/arch-release ]; then - echo archlinux - exit 0 -fi - if [ -f /etc/debian_version ]; then echo debian exit 0 @@ -71,10 +70,6 @@ uname_s="$(uname -s)" # Assume there is no tr on the client -> do lower case ourselves case "$uname_s" in - Darwin) - echo macosx - exit 0 - ;; NetBSD) echo netbsd exit 0 From edfedc5c064d38157f2abe5306297866e7e74b91 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 00:10:26 +0200 Subject: [PATCH 07/21] in theory finish os_version Signed-off-by: Nico Schottelius --- conf/explorer/os_version | 73 +++++++++------------------------------- 1 file changed, 16 insertions(+), 57 deletions(-) diff --git a/conf/explorer/os_version b/conf/explorer/os_version index 02e2e2cd..5f7120c0 100755 --- a/conf/explorer/os_version +++ b/conf/explorer/os_version @@ -27,66 +27,25 @@ case "$($__explorer/os)" in # empty, but well... cat /etc/arch-release ;; - macosx|openbsd) + debian) + cat /etc/debian_version + ;; + fedora) + cat /etc/fedora-release + ;; + gentoo) + cat /etc/gentoo-release + ;; + macosx|*bsd|solaris) uname -r ;; -esac - -exit 0 - -# Ubuntu is also Debian, thus return if Ubuntu was found -if grep -q ^DISTRIB_ID=Ubuntu /etc/lsb-release 2>/dev/null; then - echo ubuntu - exit 0 -fi - -if [ -f /etc/debian_version ]; then - echo debian - exit 0 -fi - -if [ -f /etc/gentoo-release ]; then - echo gentoo - exit 0 -fi - -# Fedora is also Redhat, thus return before redhat! -if grep -q ^Fedora /etc/redhat-release 2>/dev/null; then - echo fedora - exit 0 -fi - -if [ -f /etc/redhat-release ]; then - echo redhat - exit 0 -fi - -if [ -f /etc/SuSE-release ]; then - echo suse - exit 0 -fi - -uname_s="$(uname -s)" - -# Assume there is no tr on the client -> do lower case ourselves -case "$uname_s" in - NetBSD) - echo netbsd - exit 0 + redhat) + cat /etc/redhat-release ;; - FreeBSD) - echo freebsd - exit 0 + suse) + cat /etc/SuSE-release ;; - OpenBSD) - echo openbsd - exit 0 - ;; - SunOS) - echo solaris - exit 0 + ubuntu) + lsb_release -sr ;; esac - -echo "Unknown OS" >&2 -exit 1 From 1a9901989133203d9552b027d66383660efb8148 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 00:11:19 +0200 Subject: [PATCH 08/21] more stuff todo Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index ad6561a6..3adf4561 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -24,6 +24,7 @@ CORE - probably remove or improve cdist-type-template + TYPES ------ - __ssh-keys (host/user) @@ -40,6 +41,7 @@ DOCUMENTATION - asciidoc interprets __, which we use for variables names -> seek through docs and replace with \_\_! - check all all internal variables are prefixed with __cdist +- reference explorers in cdist-reference! Cache: - add example how to use From 5710d9a60690656e5d820ef24acce7f104c842a1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 14:57:22 +0200 Subject: [PATCH 09/21] delay __package_openbsd_pkg / wait for input of justastudent Signed-off-by: Nico Schottelius --- .../explorer/pkg_version | 30 ----------- .../type/__package_openbsd_pkg/gencode-remote | 52 ------------------ conf/type/__package_openbsd_pkg/man.text | 53 ------------------- .../__package_openbsd_pkg/parameter/optional | 1 - .../__package_openbsd_pkg/parameter/required | 1 - 5 files changed, 137 deletions(-) delete mode 100755 conf/type/__package_openbsd_pkg/explorer/pkg_version delete mode 100755 conf/type/__package_openbsd_pkg/gencode-remote delete mode 100644 conf/type/__package_openbsd_pkg/man.text delete mode 100644 conf/type/__package_openbsd_pkg/parameter/optional delete mode 100644 conf/type/__package_openbsd_pkg/parameter/required diff --git a/conf/type/__package_openbsd_pkg/explorer/pkg_version b/conf/type/__package_openbsd_pkg/explorer/pkg_version deleted file mode 100755 index 4f612423..00000000 --- a/conf/type/__package_openbsd_pkg/explorer/pkg_version +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 . -# -# -# Retrieve the status of a package - parsed dpkg output -# - -if [ -f "$__object/parameter/name" ]; then - name="$(cat "$__object/parameter/name")" -else - name="$__object_id" -fi - -pacman -Q "$name" 2>/dev/null | awk '{ print $2 }' diff --git a/conf/type/__package_openbsd_pkg/gencode-remote b/conf/type/__package_openbsd_pkg/gencode-remote deleted file mode 100755 index 536b7708..00000000 --- a/conf/type/__package_openbsd_pkg/gencode-remote +++ /dev/null @@ -1,52 +0,0 @@ -#!/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 . -# -# -# Manage packages with Pacman (mostly archlinux) -# - -# Debug -# exec >&2 -# set -x - -pacopts="--noconfirm --noprogressbar" - -if [ -f "$__object/parameter/name" ]; then - name="$__object/parameter/name" -else - name="$__object_id" -fi - -state="$(cat "$__object/parameter/state")" -pkg_version="$(cat "$__object/explorer/pkg_version")" - -case "$state" in - installed) - - # Empty? Not installed. - if [ -z "$pkg_version" ]; then - echo pacman "$pacopts" -S \"$name\" - fi - ;; - uninstalled) - if [ "$pkg_version" ]; then - echo pacman "$pacopts" -R \"$name\" - fi - ;; -esac diff --git a/conf/type/__package_openbsd_pkg/man.text b/conf/type/__package_openbsd_pkg/man.text deleted file mode 100644 index 35a7e44c..00000000 --- a/conf/type/__package_openbsd_pkg/man.text +++ /dev/null @@ -1,53 +0,0 @@ -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). diff --git a/conf/type/__package_openbsd_pkg/parameter/optional b/conf/type/__package_openbsd_pkg/parameter/optional deleted file mode 100644 index f121bdbf..00000000 --- a/conf/type/__package_openbsd_pkg/parameter/optional +++ /dev/null @@ -1 +0,0 @@ -name diff --git a/conf/type/__package_openbsd_pkg/parameter/required b/conf/type/__package_openbsd_pkg/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/conf/type/__package_openbsd_pkg/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state From 33e792540e38168b6f730ead3840809406a3a5bc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 14:57:50 +0200 Subject: [PATCH 10/21] more stuff for 1.6.0 Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index f0641509..cec4a11a 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,6 +1,7 @@ 1.6.0: * New Type __package_yum * New type __debconf_set_selections + * New explorer os_version * Fix Type __group in case of __group NAME syntax * Type __package gained Fedora support * Removed --preseed support from __package_apt From 1fc90b2d8c5d5f09f14a951d0c21ad3adfcc4cfe Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 14:58:40 +0200 Subject: [PATCH 11/21] +obsd pkg tests Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-04-04.openbsd | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 doc/dev/logs/2011-04-04.openbsd diff --git a/doc/dev/logs/2011-04-04.openbsd b/doc/dev/logs/2011-04-04.openbsd new file mode 100644 index 00000000..df1732c2 --- /dev/null +++ b/doc/dev/logs/2011-04-04.openbsd @@ -0,0 +1,24 @@ + +Some openbsd experiements: + +# pkg_add foo +Can't find foo +# echo $? +0 +# +# pkg_info foo +# echo $? +0 + +# pkg_add -s vim +Ambiguous: vim could be vim-7.2.444-gtk2 vim-7.2.444-no_x11 +# pkg_add -s vim--no_x11 +# echo $? +0 +# pkg_add -s vimfooooooooo +Can't find vimfooooooooo +# pkg_add -s vim--foooooooo +Can't find vim--foooooooo +# echo $? +0 + From 231d6a49868f7d7d63a1c6959b52a6e7980ed3a8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 15:19:33 +0200 Subject: [PATCH 12/21] more ideas for stuff todo Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 3adf4561..ebf506d4 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -23,6 +23,9 @@ CORE [20:22] kr:bin% - probably remove or improve cdist-type-template +- add $__tmp? + - for use in manifest, code, etc.? + - for creating temporary files, etc. TYPES From 4ebcdc3ef1d1126ab7f7b0d1d64f9ce45b297b2f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 16:25:13 +0200 Subject: [PATCH 13/21] find __package* -type f -exec sed -i 's/deinstalled/removed/g' {} \; Signed-off-by: Nico Schottelius --- conf/type/__package_apt/man.text | 4 ++-- conf/type/__package_pacman/man.text | 4 ++-- conf/type/__package_yum/man.text | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/type/__package_apt/man.text b/conf/type/__package_apt/man.text index 0780124d..905bfb5f 100644 --- a/conf/type/__package_apt/man.text +++ b/conf/type/__package_apt/man.text @@ -17,7 +17,7 @@ manage packages. REQUIRED PARAMETERS ------------------- state:: - Either "installed" or "deinstalled". + Either "installed" or "removed". OPTIONAL PARAMETERS @@ -37,7 +37,7 @@ __package_apt zsh --state installed __package_apt webserver --state installed --name nginx # Remove obsolete package -__package_apt puppet --state deinstalled +__package_apt puppet --state removed -------------------------------------------------------------------------------- diff --git a/conf/type/__package_pacman/man.text b/conf/type/__package_pacman/man.text index 35a7e44c..28766581 100644 --- a/conf/type/__package_pacman/man.text +++ b/conf/type/__package_pacman/man.text @@ -17,7 +17,7 @@ packages. REQUIRED PARAMETERS ------------------- state:: - Either "installed" or "deinstalled". + Either "installed" or "removed". OPTIONAL PARAMETERS @@ -37,7 +37,7 @@ __package_pacman zsh --state installed __package_pacman python --state installed --name python2 # Remove obsolete package -__package_pacman puppet --state deinstalled +__package_pacman puppet --state removed -------------------------------------------------------------------------------- diff --git a/conf/type/__package_yum/man.text b/conf/type/__package_yum/man.text index b2f57606..c9cad340 100644 --- a/conf/type/__package_yum/man.text +++ b/conf/type/__package_yum/man.text @@ -18,7 +18,7 @@ slightly confusing error message "Error: Nothing to do". REQUIRED PARAMETERS ------------------- state:: - Either "installed" or "deinstalled". + Either "installed" or "removed". OPTIONAL PARAMETERS @@ -38,7 +38,7 @@ __package_yum zsh --state installed __package_yum python --state installed --name python2 # Remove obsolete package -__package_yum puppet --state deinstalled +__package_yum puppet --state removed -------------------------------------------------------------------------------- From ac976c9f703ad319ff246ae0e2778a3f668ed2db Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 16:25:27 +0200 Subject: [PATCH 14/21] find __package* -type f -exec sed -i 's/uninstalled/removed/g' {} \; Signed-off-by: Nico Schottelius --- conf/type/__package/man.text | 2 +- conf/type/__package_apt/gencode-remote | 2 +- conf/type/__package_pacman/gencode-remote | 2 +- conf/type/__package_yum/gencode-remote | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/type/__package/man.text b/conf/type/__package/man.text index eeeceba0..46af7b3d 100644 --- a/conf/type/__package/man.text +++ b/conf/type/__package/man.text @@ -17,7 +17,7 @@ It dispatches the actual work to the package system dependant types. REQUIRED PARAMETERS ------------------- state:: - The state the package should be in, either "installed" or "uninstalled" + The state the package should be in, either "installed" or "removed" OPTIONAL PARAMETERS diff --git a/conf/type/__package_apt/gencode-remote b/conf/type/__package_apt/gencode-remote index e38653e9..aac9beb1 100755 --- a/conf/type/__package_apt/gencode-remote +++ b/conf/type/__package_apt/gencode-remote @@ -46,7 +46,7 @@ case "$state" in echo $aptget install \"$name\" fi ;; - uninstalled) + removed) # Remove only if existent if [ -n "$is_installed" ]; then echo $aptget remove \"$name\" diff --git a/conf/type/__package_pacman/gencode-remote b/conf/type/__package_pacman/gencode-remote index 536b7708..b31d097a 100755 --- a/conf/type/__package_pacman/gencode-remote +++ b/conf/type/__package_pacman/gencode-remote @@ -44,7 +44,7 @@ case "$state" in echo pacman "$pacopts" -S \"$name\" fi ;; - uninstalled) + removed) if [ "$pkg_version" ]; then echo pacman "$pacopts" -R \"$name\" fi diff --git a/conf/type/__package_yum/gencode-remote b/conf/type/__package_yum/gencode-remote index 033298b1..215a1ae5 100755 --- a/conf/type/__package_yum/gencode-remote +++ b/conf/type/__package_yum/gencode-remote @@ -39,7 +39,7 @@ case "$state" in echo yum $opts install \"$name\" fi ;; - uninstalled) + removed) if ! grep -q "$not_installed" "$__object/explorer/pkg_version"; then echo yum $opts remove \"$name\" fi From 1687d82c9d88874bda757da031ce32b5379e1a31 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 16:26:56 +0200 Subject: [PATCH 15/21] ++changes in 1.6.0 Signed-off-by: Nico Schottelius --- doc/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/changelog b/doc/changelog index cec4a11a..9672814f 100644 --- a/doc/changelog +++ b/doc/changelog @@ -3,6 +3,8 @@ * New type __debconf_set_selections * New explorer os_version * Fix Type __group in case of __group NAME syntax + * Fix __package* types: consistently name --state removed instead of + uninstalled or deinstalled * Type __package gained Fedora support * Removed --preseed support from __package_apt * explorer/os: gained Fedora support From 249977cca66bcff51778cf336ff377c076074016 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 16:49:09 +0200 Subject: [PATCH 16/21] document upcoming changes for 1.6 Signed-off-by: Nico Schottelius --- README | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README b/README index aba67707..52471068 100644 --- a/README +++ b/README @@ -106,14 +106,15 @@ how to use cdist. There are at least the following branches available: * master: the development branch - * 1.5: Focus on object orientation instead of global stage orientation + * 1.6: New types, cleaned up \_\_package* types, internal cleanup Old versions: + * 1.5: Focus on object orientation instead of global stage orientation * 1.4: Support for redefiniton of objects (if equal) * 1.3: Support for local and remote code execution (current stable) * 1.2: Dependencies supported - * 1.1: __file to __file, __directory, __link migration + * 1.1: \_\_file to \_\_file, \_\_directory, \_\_link migration * 1.0: First official release Other branches may be available for features or bugfixes, but they @@ -123,7 +124,7 @@ may vanish at any point. To select a specific branch use git checkout -b origin/ # Stay on a specific version - version=1.5 + version=1.6 git checkout -b $version origin/$version ### Mirrors @@ -145,6 +146,14 @@ 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.5 to 1.6 + +* If you used **\_\_package_apt --preseed**, you need to use the new + type **\_\_debconf_set_selections** instead. +* The **\_\_package** types accepted either --state deinstalled or + --state uninstaaled. Starting with 1.6, it was made consistently + to --state removed. + ### Upgrading from 1.3 to 1.5 No incompatiblities. From 519212e39684bc3d18e8ba6446496584365d02ca Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 16:53:56 +0200 Subject: [PATCH 17/21] error out if state given is unknown Signed-off-by: Nico Schottelius --- conf/type/__package_apt/gencode-remote | 4 ++++ conf/type/__package_pacman/gencode-remote | 4 ++++ conf/type/__package_yum/gencode-remote | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/conf/type/__package_apt/gencode-remote b/conf/type/__package_apt/gencode-remote index aac9beb1..df8fd823 100755 --- a/conf/type/__package_apt/gencode-remote +++ b/conf/type/__package_apt/gencode-remote @@ -52,4 +52,8 @@ case "$state" in echo $aptget remove \"$name\" fi ;; + *) + echo "Unknown state: $state" >&2 + exit 1 + ;; esac diff --git a/conf/type/__package_pacman/gencode-remote b/conf/type/__package_pacman/gencode-remote index b31d097a..347b037d 100755 --- a/conf/type/__package_pacman/gencode-remote +++ b/conf/type/__package_pacman/gencode-remote @@ -49,4 +49,8 @@ case "$state" in echo pacman "$pacopts" -R \"$name\" fi ;; + *) + echo "Unknown state: $state" >&2 + exit 1 + ;; esac diff --git a/conf/type/__package_yum/gencode-remote b/conf/type/__package_yum/gencode-remote index 215a1ae5..8bd81ca0 100755 --- a/conf/type/__package_yum/gencode-remote +++ b/conf/type/__package_yum/gencode-remote @@ -44,4 +44,8 @@ case "$state" in echo yum $opts remove \"$name\" fi ;; + *) + echo "Unknown state: $state" >&2 + exit 1 + ;; esac From c5925ff33153803ec50d718decf1dd4d6fced462 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 17:43:10 +0200 Subject: [PATCH 18/21] prepare version change 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 026d8419..2e5c63b1 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -19,7 +19,7 @@ # # -__cdist_version="1.5.0" +__cdist_version="1.6.0pre" # Fail if something bogus is going on set -u From 4fc181273a0d56faaeef18fb762cdbd08cb061c1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 17:58:09 +0200 Subject: [PATCH 19/21] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index ebf506d4..abae0dcb 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -27,6 +27,7 @@ CORE - for use in manifest, code, etc.? - for creating temporary files, etc. +- How to cleanly implement "restart service if config file changed" TYPES ------ From 864d25bd8cb2488be8f6e7964bfe9d7077bdb98e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 20:26:00 +0200 Subject: [PATCH 20/21] reorder todos Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index abae0dcb..7e9d2d5d 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -29,6 +29,14 @@ CORE - How to cleanly implement "restart service if config file changed" +- Cache + - add example how to use + - export variable $__cache + -> for current host + -> add function to cdist-config, import from cdist-cache + +- check all all internal variables are prefixed with __cdist + TYPES ------ - __ssh-keys (host/user) @@ -36,19 +44,12 @@ TYPES - regexp replace (can probably cover all?) -> aka sed. - __cron -- __user: +- __user add option to include --create-home - fix __user NAME case (same issue as __group) DOCUMENTATION -------------- - asciidoc interprets __, which we use for variables names -> seek through docs and replace with \_\_! -- check all all internal variables are prefixed with __cdist - reference explorers in cdist-reference! -Cache: - - add example how to use - - export variable $__cache - -> for current host - -> add function to cdist-config, import from cdist-cache From c5675bc35240ba2711bc9e2cc00851ecdc068c90 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Apr 2011 20:38:22 +0200 Subject: [PATCH 21/21] add hint on asciidoc errors and how to fix Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-hacker.text | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/man/man7/cdist-hacker.text b/doc/man/man7/cdist-hacker.text index d55f1c2f..03a348ed 100644 --- a/doc/man/man7/cdist-hacker.text +++ b/doc/man/man7/cdist-hacker.text @@ -59,7 +59,8 @@ HOW TO SUBMIT A NEW TYPE Submitting a type works as described above, with the additional requirement that a corresponding manpage named man.text in asciidoc format with the manpage-name "cdist-type__NAME" is included in the type directory -AND asciidoc is able to compile it. +AND asciidoc is able to compile it (i.e. do NOT have to many "=" in the second +line). SEE ALSO