From ac36b5e18db16595c22cb43dfe673de77f2adb98 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 18 Jan 2012 13:31:22 +0100 Subject: [PATCH 01/26] template for new type that starts stuff on boot Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/explorer/cksum | 34 ++++++++++ conf/type/__start_on_boot/explorer/exists | 30 +++++++++ conf/type/__start_on_boot/gencode-local | 43 ++++++++++++ conf/type/__start_on_boot/gencode-remote | 66 +++++++++++++++++++ conf/type/__start_on_boot/man.text | 69 ++++++++++++++++++++ conf/type/__start_on_boot/manifest | 24 +++++++ conf/type/__start_on_boot/parameter/optional | 5 ++ 7 files changed, 271 insertions(+) create mode 100755 conf/type/__start_on_boot/explorer/cksum create mode 100755 conf/type/__start_on_boot/explorer/exists create mode 100755 conf/type/__start_on_boot/gencode-local create mode 100755 conf/type/__start_on_boot/gencode-remote create mode 100644 conf/type/__start_on_boot/man.text create mode 100755 conf/type/__start_on_boot/manifest create mode 100644 conf/type/__start_on_boot/parameter/optional diff --git a/conf/type/__start_on_boot/explorer/cksum b/conf/type/__start_on_boot/explorer/cksum new file mode 100755 index 00000000..dcad99ba --- /dev/null +++ b/conf/type/__start_on_boot/explorer/cksum @@ -0,0 +1,34 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Retrieve the md5sum of a file to be created, if it is already existing. +# + +destination="/$__object_id" + +if [ -e "$destination" ]; then + if [ -f "$destination" ]; then + cksum < "$destination" + else + echo "NO REGULAR FILE" + fi +else + echo "NO FILE FOUND, NO CHECKSUM CALCULATED." +fi diff --git a/conf/type/__start_on_boot/explorer/exists b/conf/type/__start_on_boot/explorer/exists new file mode 100755 index 00000000..f8b85671 --- /dev/null +++ b/conf/type/__start_on_boot/explorer/exists @@ -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 . +# +# +# Check whether file exists or not +# + +destination="/$__object_id" + +if [ -e "$destination" ]; then + echo yes +else + echo no +fi diff --git a/conf/type/__start_on_boot/gencode-local b/conf/type/__start_on_boot/gencode-local new file mode 100755 index 00000000..d9839a19 --- /dev/null +++ b/conf/type/__start_on_boot/gencode-local @@ -0,0 +1,43 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# __file is a very basic type, which will probably be reused quite often +# + +destination="/$__object_id" +state_should="$(cat "$__object/parameter/state")" + +if [ "$state_should" = "present" ]; then + if [ -f "$__object/parameter/source" ]; then + source="$(cat "$__object/parameter/source")" + + if [ -f "$source" ]; then + local_cksum="$(cksum < "$source")" + remote_cksum="$(cat "$__object/explorer/cksum")" + + if [ "$local_cksum" != "$remote_cksum" ]; then + echo "$__remote_copy" "$source" "${__target_host}:${destination}" + fi + else + echo "Source \"$source\" does not exist." >&2 + exit 1 + fi + fi +fi diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote new file mode 100755 index 00000000..9e700934 --- /dev/null +++ b/conf/type/__start_on_boot/gencode-remote @@ -0,0 +1,66 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# __file is a very basic type, which will probably be reused quite often +# + +destination="/$__object_id" +state_should="$(cat "$__object/parameter/state")" +exists="$(cat "$__object/explorer/exists")" + +case "$state_should" in + present) + # No source? Create empty file + if [ ! -f "$__object/parameter/source" ]; then + if [ "$exists" = "no" ]; then + echo touch \"$destination\" + fi + fi + + # Mode settings + if [ -f "$__object/parameter/mode" ]; then + echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\" + fi + + # Group + if [ -f "$__object/parameter/group" ]; then + echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\" + fi + + # Owner + if [ -f "$__object/parameter/owner" ]; then + echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\" + fi + ;; + + absent) + + if [ "$exists" = "yes" ]; then + echo rm -f \"$destination\" + fi + + ;; + + *) + echo "Unknown state: $state_should" >&2 + exit 1 + ;; + +esac diff --git a/conf/type/__start_on_boot/man.text b/conf/type/__start_on_boot/man.text new file mode 100644 index 00000000..5e91599f --- /dev/null +++ b/conf/type/__start_on_boot/man.text @@ -0,0 +1,69 @@ +cdist-type__file(7) +=================== +Nico Schottelius + + +NAME +---- +cdist-type__file - Manage files + + +DESCRIPTION +----------- +This cdist type allows you to create files, remove files and set file +attributes on the target. + + +REQUIRED PARAMETERS +------------------- +None. + +OPTIONAL PARAMETERS +------------------- +state:: + 'present' or 'absent', defaults to 'present' + +group:: + Group to chgrp to. + +mode:: + Unix permissions, suitable for chmod. + +owner:: + User to chown to. + +source:: + If supplied, copy this file from the host running cdist to the target. + If not supplied, an empty file or directory will be created. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Create /etc/cdist-configured as an empty file +__file /etc/cdist-configured +# The same thing +__file /etc/cdist-configured --state present +# Delete existing file +__file /etc/cdist-configured --state absent + +# Use __file from another type +__file /etc/issue --source "$__type/files/archlinux" --state present + +# Supply some more settings +__file /etc/shadow --source "$__type/files/shadow" \ + --owner root --group shadow --mode 0640 \ + --state present +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2011-2012 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/__start_on_boot/manifest b/conf/type/__start_on_boot/manifest new file mode 100755 index 00000000..6b5e1ca7 --- /dev/null +++ b/conf/type/__start_on_boot/manifest @@ -0,0 +1,24 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 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 . +# + +# set default: present, if not setup +statefile="$__object/parameter/state" +[ -f "$statefile" ] || echo present > "$statefile" diff --git a/conf/type/__start_on_boot/parameter/optional b/conf/type/__start_on_boot/parameter/optional new file mode 100644 index 00000000..c696d592 --- /dev/null +++ b/conf/type/__start_on_boot/parameter/optional @@ -0,0 +1,5 @@ +state +group +mode +owner +source From c567ade17a2072d502613a059e99ce7e812faf6e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 18 Jan 2012 14:42:36 +0100 Subject: [PATCH 02/26] add manpage for __start_on_boot Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/man.text | 43 +++++++++--------------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/conf/type/__start_on_boot/man.text b/conf/type/__start_on_boot/man.text index 5e91599f..e9691401 100644 --- a/conf/type/__start_on_boot/man.text +++ b/conf/type/__start_on_boot/man.text @@ -1,17 +1,17 @@ -cdist-type__file(7) -=================== +cdist-type__start_on_boot(7) +============================ Nico Schottelius NAME ---- -cdist-type__file - Manage files +cdist-type__start_on_boot - Manage stuff to be started at boot DESCRIPTION ----------- -This cdist type allows you to create files, remove files and set file -attributes on the target. +This cdist type allows you to enable or disable stuff to be started +at boot of your operating system. REQUIRED PARAMETERS @@ -23,38 +23,19 @@ OPTIONAL PARAMETERS state:: 'present' or 'absent', defaults to 'present' -group:: - Group to chgrp to. - -mode:: - Unix permissions, suitable for chmod. - -owner:: - User to chown to. - -source:: - If supplied, copy this file from the host running cdist to the target. - If not supplied, an empty file or directory will be created. - EXAMPLES -------- -------------------------------------------------------------------------------- -# Create /etc/cdist-configured as an empty file -__file /etc/cdist-configured -# The same thing -__file /etc/cdist-configured --state present -# Delete existing file -__file /etc/cdist-configured --state absent +# Ensure snmpd is started at boot +__start_on_boot snmpd -# Use __file from another type -__file /etc/issue --source "$__type/files/archlinux" --state present +# Same, but more explicit +__start_on_boot snmpd --state present -# Supply some more settings -__file /etc/shadow --source "$__type/files/shadow" \ - --owner root --group shadow --mode 0640 \ - --state present +# Ensure legacy configuration management will not be started +__start_on_boot puppet --state absent -------------------------------------------------------------------------------- @@ -65,5 +46,5 @@ SEE ALSO COPYING ------- -Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is +Copyright \(C) 2012 Nico Schottelius. Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3). From aea107079899f2c76ca0f0aa7a9a62f278f4a9e7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 18 Jan 2012 14:50:50 +0100 Subject: [PATCH 03/26] add global explorer runlevel Signed-off-by: Nico Schottelius --- conf/explorer/runlevel | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 conf/explorer/runlevel diff --git a/conf/explorer/runlevel b/conf/explorer/runlevel new file mode 100755 index 00000000..7cdd81ef --- /dev/null +++ b/conf/explorer/runlevel @@ -0,0 +1,26 @@ +#!/bin/sh +# +# 2012 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 . +# +# + +set +e +executable=$(which runlevel 2>/dev/null) +if [ -x "$executable" ]; then + "$executable" | awk '{ print $2 }' +fi From 14127446191d92ed343145a50dc04c9e66507c20 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 18 Jan 2012 15:52:19 +0100 Subject: [PATCH 04/26] begin state explorer Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/explorer/exists | 30 ---------------- .../__start_on_boot/explorer/{cksum => state} | 34 ++++++++++++------- 2 files changed, 22 insertions(+), 42 deletions(-) delete mode 100755 conf/type/__start_on_boot/explorer/exists rename conf/type/__start_on_boot/explorer/{cksum => state} (59%) diff --git a/conf/type/__start_on_boot/explorer/exists b/conf/type/__start_on_boot/explorer/exists deleted file mode 100755 index f8b85671..00000000 --- a/conf/type/__start_on_boot/explorer/exists +++ /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 . -# -# -# Check whether file exists or not -# - -destination="/$__object_id" - -if [ -e "$destination" ]; then - echo yes -else - echo no -fi diff --git a/conf/type/__start_on_boot/explorer/cksum b/conf/type/__start_on_boot/explorer/state similarity index 59% rename from conf/type/__start_on_boot/explorer/cksum rename to conf/type/__start_on_boot/explorer/state index dcad99ba..c68ec2ba 100755 --- a/conf/type/__start_on_boot/explorer/cksum +++ b/conf/type/__start_on_boot/explorer/state @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -18,17 +18,27 @@ # along with cdist. If not, see . # # -# Retrieve the md5sum of a file to be created, if it is already existing. +# Check whether the given name will be started on boot or not # -destination="/$__object_id" +os=$(cat "$__global/explorer/os") + +case "$os" in + debian|ubuntu) + echo update-rc.d \"$name\" defaults + ;; + + gentoo) + echo rc-update add \"$name\" default + ;; + + centos|fedora|owl|redhat) + echo chkconfig \"$name\" on + ;; + + *) + echo "Unsupported os: $os" >&2 + exit 1 + ;; +esac -if [ -e "$destination" ]; then - if [ -f "$destination" ]; then - cksum < "$destination" - else - echo "NO REGULAR FILE" - fi -else - echo "NO FILE FOUND, NO CHECKSUM CALCULATED." -fi From 6b6ae1bde225765051f7be1972c2fd463f789b48 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 18 Jan 2012 15:52:47 +0100 Subject: [PATCH 05/26] document more exported environment variables Signed-off-by: Nico Schottelius --- doc/man/cdist-reference.text.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 6b4e786f..ffc40ee3 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -167,7 +167,7 @@ ENVIRONMENT VARIABLES --------------------- __explorer:: Directory that contains all global explorers. - Available for: explorer + Available for: explorer, type explorer __manifest:: Directory that contains the initial manifest. Available for: initial manifest @@ -188,7 +188,7 @@ __object_name:: Available for: type manifest, type explorer, type gencode __target_host:: The host we are deploying to. - Available for: initial manifest, type manifest, type gencode + Available for: explorer, initial manifest, type explorer, type manifest, type gencode __type:: Path to the current type. Available for: type manifest, type gencode From 42e3c18d02823a47423ac194ef884a57fd741aa2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 18 Jan 2012 15:54:32 +0100 Subject: [PATCH 06/26] +update of __start_on_boot Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/explorer/state | 2 +- conf/type/__start_on_boot/gencode-remote | 71 ++++++++++++------------ conf/type/__start_on_boot/man.text | 3 + 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/conf/type/__start_on_boot/explorer/state b/conf/type/__start_on_boot/explorer/state index c68ec2ba..136c1e05 100755 --- a/conf/type/__start_on_boot/explorer/state +++ b/conf/type/__start_on_boot/explorer/state @@ -21,7 +21,7 @@ # Check whether the given name will be started on boot or not # -os=$(cat "$__global/explorer/os") +os=$("$__explorer/os") case "$os" in debian|ubuntu) diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index 9e700934..5133810d 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -18,49 +18,48 @@ # along with cdist. If not, see . # # -# __file is a very basic type, which will probably be reused quite often -# -destination="/$__object_id" -state_should="$(cat "$__object/parameter/state")" -exists="$(cat "$__object/explorer/exists")" +if [ -f "$__object/parameter/state" ]; then + state_should="$(cat "$__object/parameter/state")" +else + state_should="present" +fi + +os=$(cat "$__global/explorer/os") +name="$__object_id" + +# Support runlevels later +#runlevel=$(cat $__global/explorer/runlevel) case "$state_should" in - present) - # No source? Create empty file - if [ ! -f "$__object/parameter/source" ]; then - if [ "$exists" = "no" ]; then - echo touch \"$destination\" - fi - fi + present) + case "$os" in + debian|ubuntu) + echo update-rc.d \"$name\" defaults + ;; - # Mode settings - if [ -f "$__object/parameter/mode" ]; then - echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\" - fi + gentoo) + echo rc-update add \"$name\" default + ;; - # Group - if [ -f "$__object/parameter/group" ]; then - echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\" - fi + centos|fedora|owl|redhat) + echo echo chkconfig \"$name\" on + ;; - # Owner - if [ -f "$__object/parameter/owner" ]; then - echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\" - fi - ;; + *) + echo "Unsupported os: $os" >&2 + exit 1 + ;; + esac + ;; - absent) + absent) - if [ "$exists" = "yes" ]; then - echo rm -f \"$destination\" - fi + ;; - ;; - - *) - echo "Unknown state: $state_should" >&2 - exit 1 - ;; + *) + echo "Unknown state: $state_should" >&2 + exit 1 + ;; esac diff --git a/conf/type/__start_on_boot/man.text b/conf/type/__start_on_boot/man.text index e9691401..eb9dbe7f 100644 --- a/conf/type/__start_on_boot/man.text +++ b/conf/type/__start_on_boot/man.text @@ -23,6 +23,9 @@ OPTIONAL PARAMETERS state:: 'present' or 'absent', defaults to 'present' +runlevel:: + Specify runlevel(s) to affect. Defaults to default or current runlevel. + EXAMPLES -------- From 1e9940ae53b3b517b4e90896ee8fac2a722e3162 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 18 Jan 2012 15:54:50 +0100 Subject: [PATCH 07/26] ++fixme of logging Signed-off-by: Nico Schottelius --- lib/cdist/core/explorer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index 01c4c81d..19833d92 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -73,6 +73,7 @@ class Explorer(object): '__target_host': self.target_host, '__explorer': self.remote.global_explorer_path, } + # FIXME: remove soon with new logging infrastructure if self.log.getEffectiveLevel() == logging.DEBUG: self.env.update({'__debug': "yes" }) self._type_explorers_transferred = [] From 5a383fcbad5c99e0c16dd365c0b94ca85cf9585f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 18 Jan 2012 15:54:58 +0100 Subject: [PATCH 08/26] ++todo for nico Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 3 --- doc/dev/todo/niconext | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 875d2970..56bb8284 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -37,6 +37,3 @@ TYPES ------ - __user add option to include --create-home -- __init_script? - to enable/disable startup of init stuff - http://linuxhelp.blogspot.com/2006/04/enabling-and-disabling-services-during_01.html diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index ad859266..4543b32a 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,4 +1,9 @@ +- __init_script? + to enable/disable startup of init stuff + http://linuxhelp.blogspot.com/2006/04/enabling-and-disabling-services-during_01.html + - update/create docs + - document __remote_copy and __remote_exec - cdist-cache:: How to get use information about the hosts we have been working on [advanced] - cdist-scaling-tuning:: @@ -12,4 +17,3 @@ - exec flag is not true for manifest anymore - SSH HINTS - ssh agent - From 0ccf000713dc196686a80256fd543a15b499ce56 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 18 Jan 2012 15:55:06 +0100 Subject: [PATCH 09/26] more stuff for 2.0.6 Signed-off-by: Nico Schottelius --- doc/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/changelog b/doc/changelog index 062db392..5867d54d 100644 --- a/doc/changelog +++ b/doc/changelog @@ -7,6 +7,8 @@ * New Type: __rvm_gem (Evax Software) * New Type: __rvm_gemset (Evax Software) * New Type: __rvm_ruby (Evax Software) + * New Explorer: runlevel + * Documentation: Update of reference (environment variables) 2.0.5: 2012-01-18 * Bugfix __key_value: Use correct delimiters From fe0fae69023eca7561c6c01831b97f6e50a8e2c4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 18 Jan 2012 16:07:33 +0100 Subject: [PATCH 10/26] update explorer and gencode and parameter Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/explorer/state | 5 ++- conf/type/__start_on_boot/gencode-local | 43 -------------------- conf/type/__start_on_boot/gencode-remote | 25 +++++++++++- conf/type/__start_on_boot/man.text | 1 + conf/type/__start_on_boot/parameter/optional | 4 -- 5 files changed, 29 insertions(+), 49 deletions(-) delete mode 100755 conf/type/__start_on_boot/gencode-local diff --git a/conf/type/__start_on_boot/explorer/state b/conf/type/__start_on_boot/explorer/state index 136c1e05..8db4b9d2 100755 --- a/conf/type/__start_on_boot/explorer/state +++ b/conf/type/__start_on_boot/explorer/state @@ -22,6 +22,7 @@ # os=$("$__explorer/os") +runlevel=$("$__explorer/runlevel") case "$os" in debian|ubuntu) @@ -33,7 +34,8 @@ case "$os" in ;; centos|fedora|owl|redhat) - echo chkconfig \"$name\" on + state=$(chkconfig --level "$runlevel" \"$name\" || echo absent) + [ "$state" ] || state="present" ;; *) @@ -42,3 +44,4 @@ case "$os" in ;; esac +echo $state diff --git a/conf/type/__start_on_boot/gencode-local b/conf/type/__start_on_boot/gencode-local deleted file mode 100755 index d9839a19..00000000 --- a/conf/type/__start_on_boot/gencode-local +++ /dev/null @@ -1,43 +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 . -# -# -# __file is a very basic type, which will probably be reused quite often -# - -destination="/$__object_id" -state_should="$(cat "$__object/parameter/state")" - -if [ "$state_should" = "present" ]; then - if [ -f "$__object/parameter/source" ]; then - source="$(cat "$__object/parameter/source")" - - if [ -f "$source" ]; then - local_cksum="$(cksum < "$source")" - remote_cksum="$(cat "$__object/explorer/cksum")" - - if [ "$local_cksum" != "$remote_cksum" ]; then - echo "$__remote_copy" "$source" "${__target_host}:${destination}" - fi - else - echo "Source \"$source\" does not exist." >&2 - exit 1 - fi - fi -fi diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index 5133810d..aa854658 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -25,6 +25,11 @@ else state_should="present" fi +state_is=$(cat "$__object/explorer/state") + +# Nothing todo, go away +[ "$state_should" = "$state_is" ] && exit 0 + os=$(cat "$__global/explorer/os") name="$__object_id" @@ -43,7 +48,7 @@ case "$state_should" in ;; centos|fedora|owl|redhat) - echo echo chkconfig \"$name\" on + echo chkconfig \"$name\" on ;; *) @@ -54,7 +59,25 @@ case "$state_should" in ;; absent) + case "$os" in + debian|ubuntu) + echo update-rc.d -f \"$name\" remove + ;; + gentoo) + echo rc-update del \"$name\" + ;; + + centos|fedora|owl|redhat) + echo chkconfig \"$name\" off + ;; + + *) + echo "Unsupported os: $os" >&2 + exit 1 + ;; + esac + ;; diff --git a/conf/type/__start_on_boot/man.text b/conf/type/__start_on_boot/man.text index eb9dbe7f..5614f16b 100644 --- a/conf/type/__start_on_boot/man.text +++ b/conf/type/__start_on_boot/man.text @@ -25,6 +25,7 @@ state:: runlevel:: Specify runlevel(s) to affect. Defaults to default or current runlevel. + NOT YET SUPPORTED, ALWAYS USING CURRENT RUNLEVEL. EXAMPLES diff --git a/conf/type/__start_on_boot/parameter/optional b/conf/type/__start_on_boot/parameter/optional index c696d592..ff72b5c7 100644 --- a/conf/type/__start_on_boot/parameter/optional +++ b/conf/type/__start_on_boot/parameter/optional @@ -1,5 +1 @@ state -group -mode -owner -source From 559670ab4f333b44831c29e18b70ab442275b8d9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 18 Jan 2012 16:15:53 +0100 Subject: [PATCH 11/26] add debian / ubuntu support for checking state Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/explorer/state | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/conf/type/__start_on_boot/explorer/state b/conf/type/__start_on_boot/explorer/state index 8db4b9d2..2778e784 100755 --- a/conf/type/__start_on_boot/explorer/state +++ b/conf/type/__start_on_boot/explorer/state @@ -21,12 +21,19 @@ # Check whether the given name will be started on boot or not # +set -x +exec >&2 + os=$("$__explorer/os") runlevel=$("$__explorer/runlevel") +name="$__object_id" + +# default +state="present" case "$os" in debian|ubuntu) - echo update-rc.d \"$name\" defaults + [ -f "/etc/rc$runlevel.d/S"??"$name" ] || state="absent" ;; gentoo) @@ -45,3 +52,4 @@ case "$os" in esac echo $state +exit 1 From aa870e012441a0a570aae87c35d45a11552609fb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 18 Jan 2012 16:37:09 +0100 Subject: [PATCH 12/26] remove debug, remove gentoo support until tested Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/explorer/state | 8 -------- conf/type/__start_on_boot/gencode-remote | 15 ++++++++------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/conf/type/__start_on_boot/explorer/state b/conf/type/__start_on_boot/explorer/state index 2778e784..9d63b84e 100755 --- a/conf/type/__start_on_boot/explorer/state +++ b/conf/type/__start_on_boot/explorer/state @@ -21,9 +21,6 @@ # Check whether the given name will be started on boot or not # -set -x -exec >&2 - os=$("$__explorer/os") runlevel=$("$__explorer/runlevel") name="$__object_id" @@ -36,10 +33,6 @@ case "$os" in [ -f "/etc/rc$runlevel.d/S"??"$name" ] || state="absent" ;; - gentoo) - echo rc-update add \"$name\" default - ;; - centos|fedora|owl|redhat) state=$(chkconfig --level "$runlevel" \"$name\" || echo absent) [ "$state" ] || state="present" @@ -52,4 +45,3 @@ case "$os" in esac echo $state -exit 1 diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index aa854658..ee2bdeb6 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -43,9 +43,10 @@ case "$state_should" in echo update-rc.d \"$name\" defaults ;; - gentoo) - echo rc-update add \"$name\" default - ;; +# Disabled until the explorer is checked +# gentoo) +# echo rc-update add \"$name\" default +# ;; centos|fedora|owl|redhat) echo chkconfig \"$name\" on @@ -64,9 +65,10 @@ case "$state_should" in echo update-rc.d -f \"$name\" remove ;; - gentoo) - echo rc-update del \"$name\" - ;; +# Disabled until the explorer is checked +# gentoo) +# echo rc-update del \"$name\" +# ;; centos|fedora|owl|redhat) echo chkconfig \"$name\" off @@ -80,7 +82,6 @@ case "$state_should" in ;; - *) echo "Unknown state: $state_should" >&2 exit 1 From a112b4f123d591096bede64ba96545e911204edd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 19 Jan 2012 09:12:54 +0100 Subject: [PATCH 13/26] documet debian/ubuntu problem Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/gencode-remote | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index ee2bdeb6..5e9c6343 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -40,6 +40,9 @@ case "$state_should" in present) case "$os" in debian|ubuntu) + # This does not work as expected: + # insserv: warning: current start runlevel(s) (3 4 5) of script `postfix' overwrites defaults (2 3 4 5). + #echo update-rc.d \"$name\" defaults echo update-rc.d \"$name\" defaults ;; From aae67652e9cdb79c019c7c405e2a97e0d8c32f90 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 20 Jan 2012 12:57:40 +0100 Subject: [PATCH 14/26] explore state of init script on archlinux Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/explorer/state | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/conf/type/__start_on_boot/explorer/state b/conf/type/__start_on_boot/explorer/state index 9d63b84e..1de1fe57 100755 --- a/conf/type/__start_on_boot/explorer/state +++ b/conf/type/__start_on_boot/explorer/state @@ -29,6 +29,23 @@ name="$__object_id" state="present" case "$os" in + archlinux) + # convert bash array to shell + daemons=$(grep ^DAEMONS /etc/rc.conf | sed -e 's/^.*=(//' -e 's/)$//') + + # absent, as long as not found + state="absent" + + # iterate, last one wins. + for daemon in $daemons; do + if [ "$daemon" = "$name" -o "$daemon" = "@${name}" ]; then + state="present" + elif [ "$daemon" = "!${name}" ]; then + state="absent" + fi + done + ;; + debian|ubuntu) [ -f "/etc/rc$runlevel.d/S"??"$name" ] || state="absent" ;; From bd32bd0953d3075b21586df15abee23f22eb99c7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 20 Jan 2012 12:58:50 +0100 Subject: [PATCH 15/26] setup state in os specific sections to get better overview Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/explorer/state | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/type/__start_on_boot/explorer/state b/conf/type/__start_on_boot/explorer/state index 1de1fe57..ff092a65 100755 --- a/conf/type/__start_on_boot/explorer/state +++ b/conf/type/__start_on_boot/explorer/state @@ -25,8 +25,6 @@ os=$("$__explorer/os") runlevel=$("$__explorer/runlevel") name="$__object_id" -# default -state="present" case "$os" in archlinux) @@ -44,21 +42,23 @@ case "$os" in state="absent" fi done - ;; + ;; debian|ubuntu) + state="present" [ -f "/etc/rc$runlevel.d/S"??"$name" ] || state="absent" - ;; + ;; centos|fedora|owl|redhat) + state="present" state=$(chkconfig --level "$runlevel" \"$name\" || echo absent) [ "$state" ] || state="present" - ;; + ;; *) echo "Unsupported os: $os" >&2 exit 1 - ;; + ;; esac echo $state From 4ea85fb40224da50eeb945fa0d1a366e846a0196 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 20 Jan 2012 13:12:14 +0100 Subject: [PATCH 16/26] ++todo (absent/present) 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 948aa1a5..abcd5097 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -36,3 +36,5 @@ TYPES ------ - __user add option to include --create-home +- ensure that all types, which support --state support + present and absent (consistent look and feel) From 6d5c69d5c423b2dcb049b11618b4f15216213161 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 20 Jan 2012 14:16:49 +0100 Subject: [PATCH 17/26] remove runlevel parameter for now - seems to be too complex/unecessary for the moment Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/man.text | 4 ---- 1 file changed, 4 deletions(-) diff --git a/conf/type/__start_on_boot/man.text b/conf/type/__start_on_boot/man.text index 5614f16b..e9691401 100644 --- a/conf/type/__start_on_boot/man.text +++ b/conf/type/__start_on_boot/man.text @@ -23,10 +23,6 @@ OPTIONAL PARAMETERS state:: 'present' or 'absent', defaults to 'present' -runlevel:: - Specify runlevel(s) to affect. Defaults to default or current runlevel. - NOT YET SUPPORTED, ALWAYS USING CURRENT RUNLEVEL. - EXAMPLES -------- From a357d7d794990d3123a36c6690ccf5ac8ed979fb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 20 Jan 2012 14:57:25 +0100 Subject: [PATCH 18/26] support adding start on boot on archlinux (no removal so far) Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/gencode-remote | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index 5e9c6343..c13013ad 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -33,12 +33,12 @@ state_is=$(cat "$__object/explorer/state") os=$(cat "$__global/explorer/os") name="$__object_id" -# Support runlevels later -#runlevel=$(cat $__global/explorer/runlevel) - case "$state_should" in present) case "$os" in + archlinux) + echo sed -i /etc/rc.conf \"s/^\\(DAEMONS=.*\\))/\\1 foo)/\" + ;; debian|ubuntu) # This does not work as expected: # insserv: warning: current start runlevel(s) (3 4 5) of script `postfix' overwrites defaults (2 3 4 5). From 6d14e32911c78130860718515115fe8a1ec248b1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 20 Jan 2012 15:34:18 +0100 Subject: [PATCH 19/26] support removal and correct adding daemons on archlinux Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/gencode-remote | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index c13013ad..61a6b465 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -37,7 +37,7 @@ case "$state_should" in present) case "$os" in archlinux) - echo sed -i /etc/rc.conf \"s/^\\(DAEMONS=.*\\))/\\1 foo)/\" + echo sed -i /etc/rc.conf \"s/^\\(DAEMONS=.*\\))/\\1 $name)/\" ;; debian|ubuntu) # This does not work as expected: @@ -64,6 +64,9 @@ case "$state_should" in absent) case "$os" in + archlinux) + echo sed -i /etc/rc.conf -e \"s/ $name / /g\" -e \"s/($name/(/\" -e \"s/ $name)/)/\" + ;; debian|ubuntu) echo update-rc.d -f \"$name\" remove ;; From 1b263b57cfde719eb8a8134555317201d1e8e0aa Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 20 Jan 2012 16:30:44 +0100 Subject: [PATCH 20/26] prefer ' over " Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index 61a6b465..09c4912d 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -37,7 +37,7 @@ case "$state_should" in present) case "$os" in archlinux) - echo sed -i /etc/rc.conf \"s/^\\(DAEMONS=.*\\))/\\1 $name)/\" + echo sed -i /etc/rc.conf \'s/^\\(DAEMONS=.*\\))/\\1 $name)/\' ;; debian|ubuntu) # This does not work as expected: From 2b0c2737151b52d38aa449b9cefc42fa19957cbb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 14 Feb 2012 18:04:00 +0100 Subject: [PATCH 21/26] state_should is being populated in manifest, if not given Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/gencode-remote | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index 09c4912d..6618b9b0 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -19,12 +19,7 @@ # # -if [ -f "$__object/parameter/state" ]; then - state_should="$(cat "$__object/parameter/state")" -else - state_should="present" -fi - +state_should="$(cat "$__object/parameter/state")" state_is=$(cat "$__object/explorer/state") # Nothing todo, go away From 2f16b08bb0247e7ba5454f43b2dea6bf33691636 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 14 Feb 2012 20:31:02 +0100 Subject: [PATCH 22/26] also copy over the .css for manpages Signed-off-by: Nico Schottelius --- build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build b/build index b994ce00..2d98e862 100755 --- a/build +++ b/build @@ -113,8 +113,8 @@ case "$1" in # cp ${SPEECHESDIR}/*.pdf ${WEBDIR}/${WEBBASE}/speeches # git describe > ${WEBDIR}/${WEBBASE}/man/VERSION - cp ${MAN1DSTDIR}/*.html ${WEBMAN}/man1 - cp ${MAN7DSTDIR}/*.html ${WEBMAN}/man7 + cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${WEBMAN}/man1 + cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${WEBMAN}/man7 cd ${WEBDIR} && git add ${WEBBASE} cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} From 5d47eb849f5f8f78a8a63932316e14da894323f9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 14 Feb 2012 20:31:16 +0100 Subject: [PATCH 23/26] some stuff to be fixed Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/gencode-remote | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index 6618b9b0..3db7293f 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -35,13 +35,13 @@ case "$state_should" in echo sed -i /etc/rc.conf \'s/^\\(DAEMONS=.*\\))/\\1 $name)/\' ;; debian|ubuntu) - # This does not work as expected: + # FIXME: This does not work as expected: # insserv: warning: current start runlevel(s) (3 4 5) of script `postfix' overwrites defaults (2 3 4 5). #echo update-rc.d \"$name\" defaults echo update-rc.d \"$name\" defaults ;; -# Disabled until the explorer is checked +# FIXME: Disabled until the explorer is checked # gentoo) # echo rc-update add \"$name\" default # ;; @@ -60,13 +60,14 @@ case "$state_should" in absent) case "$os" in archlinux) - echo sed -i /etc/rc.conf -e \"s/ $name / /g\" -e \"s/($name/(/\" -e \"s/ $name)/)/\" + # Replace a) at the beginning b) in the middle c) end d) only + echo "sed -i /etc/rc.conf -e 's/^\(DAEMONS=(\)$name /\1/' -e 's/^\(DAEMONS=(.* \)$name \(.*\)/\1\2/' -e 's/^\(DAEMONS=(.*\) $name)/\1)/' -e 's/^\(DAEMONS=(\)$name)/\1)/'" ;; debian|ubuntu) echo update-rc.d -f \"$name\" remove ;; -# Disabled until the explorer is checked +# FIXME: Disabled until the explorer is checked # gentoo) # echo rc-update del \"$name\" # ;; From d427af2ee33875f271c413ecde5421640448ae72 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 15 Feb 2012 08:50:03 +0100 Subject: [PATCH 24/26] add hint on incomplete type Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/man.text | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conf/type/__start_on_boot/man.text b/conf/type/__start_on_boot/man.text index e9691401..0e75c9ab 100644 --- a/conf/type/__start_on_boot/man.text +++ b/conf/type/__start_on_boot/man.text @@ -13,6 +13,9 @@ DESCRIPTION This cdist type allows you to enable or disable stuff to be started at boot of your operating system. +Warning: This type has not been tested intensively and is not fully +supported (i.e. gentoo and *bsd are not implemented). + REQUIRED PARAMETERS ------------------- From 824ec459ea3ce1dbc2c2751071a42eb235eae66e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 15 Feb 2012 08:50:26 +0100 Subject: [PATCH 25/26] cleanups in gencode Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/gencode-remote | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index 3db7293f..f1788d4b 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -32,13 +32,10 @@ case "$state_should" in present) case "$os" in archlinux) - echo sed -i /etc/rc.conf \'s/^\\(DAEMONS=.*\\))/\\1 $name)/\' + echo "sed -i /etc/rc.conf \'s/^\\(DAEMONS=.*\\))/\\1 $name)/\'" ;; debian|ubuntu) - # FIXME: This does not work as expected: - # insserv: warning: current start runlevel(s) (3 4 5) of script `postfix' overwrites defaults (2 3 4 5). - #echo update-rc.d \"$name\" defaults - echo update-rc.d \"$name\" defaults + echo "update-rc.d \"$name\" defaults >/dev/null" ;; # FIXME: Disabled until the explorer is checked @@ -61,7 +58,7 @@ case "$state_should" in case "$os" in archlinux) # Replace a) at the beginning b) in the middle c) end d) only - echo "sed -i /etc/rc.conf -e 's/^\(DAEMONS=(\)$name /\1/' -e 's/^\(DAEMONS=(.* \)$name \(.*\)/\1\2/' -e 's/^\(DAEMONS=(.*\) $name)/\1)/' -e 's/^\(DAEMONS=(\)$name)/\1)/'" + echo "sed -i /etc/rc.conf -e 's/^\\(DAEMONS=(\\)$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) $name)/\\1)/' -e 's/^\\(DAEMONS=(\\)$name)/\\1)/'" ;; debian|ubuntu) echo update-rc.d -f \"$name\" remove From be670597253d1e713ba79416b2392f51108e4ae7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 15 Feb 2012 09:27:11 +0100 Subject: [PATCH 26/26] print name, not object (user does not need to see python way of things) Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 0979182a..6d6050e8 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -125,7 +125,7 @@ class Emulator(object): if self.cdist_object.exists: if self.cdist_object.parameters != self.parameters: raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s" - % (self.cdist_object, " ".join(self.cdist_object.source), self.cdist_object.parameters, self.object_source, self.parameters) + % (self.cdist_object.name, " ".join(self.cdist_object.source), self.cdist_object.parameters, self.object_source, self.parameters) ) else: self.cdist_object.create()