From 711fea9e7ed2709b9e9b56a69058cb9a753e4b87 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 19 Feb 2011 02:02:21 +0100 Subject: [PATCH 01/12] [DOC] cleanups Signed-off-by: Nico Schottelius --- Makefile | 1 + doc/man/cdist-stages.text | 43 ++++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 341f2eb5..e56f62c8 100644 --- a/Makefile +++ b/Makefile @@ -36,3 +36,4 @@ pub: man: echo $(MANSRC) a2x -f manpage --no-xmllint doc/man/cdist-stages.text + echo man ./doc/man/cdist-stages.7 diff --git a/doc/man/cdist-stages.text b/doc/man/cdist-stages.text index 98e42ece..960813f6 100644 --- a/doc/man/cdist-stages.text +++ b/doc/man/cdist-stages.text @@ -43,38 +43,39 @@ cdist-config-layout(7). STAGE 3: EXECUTION OF TYPES --------------------------- - Every object is checked whether its type has an init - script (see cdist-types(7)). If the type of the object - has an init script, it is run. This init script may - generate additional objects. +Every object is checked whether its type has an init +script (see cdist-types(7)). If the type of the object +has an init script, it is run. This init script may +generate additional objects. - For instance the object __apache/www.test.ch is of - type __apache, which may contain an init script, which - creates new objects of type __file. +For instance the object __apache/www.test.ch is of +type __apache, which may contain an init script, which +creates new objects of type __file. - The newly created objects are merged back into - the existing tree. No conflicts may occur during - the merge. A conflict would mean that two different - objects try to create the same object, which indicates a - broken configuration. +The newly created objects are merged back into +the existing tree. No conflicts may occur during +the merge. A conflict would mean that two different +objects try to create the same object, which indicates a +broken configuration. STAGE 4: CODE GENERATION ------------------------ - The "gencode" binary of the types for every existing object is - called to generate code that will be executed on the target host. +The "gencode" binary of the types for every existing object is +called to generate code that will be executed on the target host. - This binary should create code to be executed on the target on stdout. +This binary should create code to be executed on the target on stdout. - If the gencode binary fails, it must print diagnostic messages on stderr - and exit non-zero. +If the gencode binary fails, it must print diagnostic messages on stderr +and exit non-zero. - A description of what the generated code may/must/should - do can be found in cdist-types-gencode(7). +A description of what the generated code may/must/should +do can be found in cdist-types-gencode(7). STAGE 5: CODE EXECUTION ----------------------- - The resulting code is transferred to the target host and executed, - the run of cdist-deploy-to(1) ends. + +The resulting code is transferred to the target host and executed, +the run of cdist-deploy-to(1) ends. SEE ALSO From 40e670615c8a4aa6239f3db62de3a5e04dc44b7d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 19 Feb 2011 12:48:26 +0100 Subject: [PATCH 02/12] completly finish cdist-stages Signed-off-by: Nico Schottelius --- doc/man/cdist-stages.text | 87 +++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 41 deletions(-) diff --git a/doc/man/cdist-stages.text b/doc/man/cdist-stages.text index 960813f6..f82f9046 100644 --- a/doc/man/cdist-stages.text +++ b/doc/man/cdist-stages.text @@ -5,77 +5,82 @@ Nico Schottelius NAME ---- -cdist-stages - How the configuration is built +cdist-stages - Stages used during configuration deployment DESCRIPTION ----------- -Starting the execution of deployment with cdist-deploy-to(1), -cdist passes through different stages, each can be triggered -and debugged on its own. Reading the source of the -cdist-deploy-to script shous the binaries being responsible -for each stage. +Starting the execution of deployment with cdist-deploy-to(1), cdist passes +through different stages, each can be triggered and debugged on its own. +Reading the source of the cdist-deploy-to executable shous the scripts +responsible for each stage. + STAGE 1: TARGET INFORMATION RETRIEVAL -------------------------------------- -In this stage information is collected about target using -so called explorers. -Every existing explorer is run on the target and the output -of all explorers are copied back into the local cache. -The results can be used by manifests and types. +In this stage information is collected about target using so called explorers. +Every existing explorer is run on the target and the output of all explorers +are copied back into the local cache. The results can be used by manifests and +types. Related manpages are cdist-explorers(7) and cdist-cache(7). STAGE 2: RUN THE INITIAL MANIFEST --------------------------------- -The initial manifest, which should be used for mappings -of hosts to types, is executed. - -This stage creates objects in a cconfig database that -contains as defined in the manifest for the specific host. - -In this stage, no conflicts may occur, i.e. no object of -the same type with the same id may be created. +The initial manifest, which should be used for mappings of hosts to types, +is executed. This stage creates objects in a cconfig database that contains +the objects as defined in the manifest for the specific host. In this stage, +no conflicts may occur, i.e. no object of the same type with the same id may +be created. Related manpages are cdist-manifest-init(1), cdist-manifests(7) and cdist-config-layout(7). + STAGE 3: EXECUTION OF TYPES --------------------------- -Every object is checked whether its type has an init -script (see cdist-types(7)). If the type of the object -has an init script, it is run. This init script may -generate additional objects. +Every object is checked whether its type has a manifest file. If the type has +a manifest file and it is executable, it will be executed. The manifest script +may generate and change the created objects. In other words, one type can reuse +other types. -For instance the object __apache/www.test.ch is of -type __apache, which may contain an init script, which -creates new objects of type __file. +For instance the object __apache/www.test.ch is of type __apache, which may +contain an manifest script, which creates new objects of type __file. + +The newly created objects are merged back into the existing tree. No conflicts +may occur during the merge. A conflict would mean that two different objects +try to create the same object, which indicates a broken configuration. + +Related manpage are cdist-types(7) and cdist-manifest-run-all(1). -The newly created objects are merged back into -the existing tree. No conflicts may occur during -the merge. A conflict would mean that two different -objects try to create the same object, which indicates a -broken configuration. STAGE 4: CODE GENERATION ------------------------ -The "gencode" binary of the types for every existing object is -called to generate code that will be executed on the target host. +In this stage for every created objects its type is checked whether it has a +gencode script. If the type has a gencode script and it is executable it will +be executed. This executable should create code to be executed on the target +on stdout. If the gencode executable fails, it must print diagnostic messages +on stderr and exit non-zero. -This binary should create code to be executed on the target on stdout. +Related manpages are cdist-types-gencode(7), cdist-gencode(1) and +cdist-gencode-all(1). -If the gencode binary fails, it must print diagnostic messages on stderr -and exit non-zero. - -A description of what the generated code may/must/should -do can be found in cdist-types-gencode(7). STAGE 5: CODE EXECUTION ----------------------- +The resulting code from the previous stage is transferred to the target host +and executed there to apply the configuration changes, -The resulting code is transferred to the target host and executed, -the run of cdist-deploy-to(1) ends. +Related manpages are cdist-exec-transfer(1) and cdist-exec-run(1). + + +SUMMARY +------- +If, and only if, all the stages complete without an errors, the configuration +will be applied to the target. Each stage can also be run individually, though +dependencies for each stage must be fulfilled and thus the stages must be run +in correct order. SEE ALSO From 4dfc7a28cc288cbed04c10637298e2037d13bf6c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 19 Feb 2011 12:50:54 +0100 Subject: [PATCH 03/12] +todo/doc Signed-off-by: Nico Schottelius --- TODO-1.0 | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/TODO-1.0 b/TODO-1.0 index 175d2f28..ad94185b 100644 --- a/TODO-1.0 +++ b/TODO-1.0 @@ -11,7 +11,7 @@ x run initial manifest (stage 2) x Create configuration tree from manifest x write binaries, which create the tree when called from manifest (cdist_tree_wrapper) -- be able to run manifest of types (stage 3) +x be able to run manifest of types (stage 3) x Parse configuration tree/objects recursively x can/may types modify tree? -> yes, of everything a type created itself! @@ -22,13 +22,6 @@ x run initial manifest (stage 2) x rename $__object_dir to $__object_base_dir x use $type/manifest instead of $type/init x find $object_id in recursive runner (before merge) - - DOC document "cd $__object_dir, before running manifest" in doc/man/cdist-types.text - - DOC document that $type/manifest is executed for every object/instance - - DOC: types can always access - __cdist_out_objects, __cdist_out_explorers, - __cdist_out_execs - - --> create cdist-variables document? x generate code to be executed on clients (stage 4) x for one object @@ -41,6 +34,7 @@ x execute code on client (stage 5) - file (with directory) - package - doc cleanup for 1.0: + - ensure every file in bin/ has a correspondent manpage - cdist manpage (main manpage) - cleanup following man + their tree: - cdist-language [CLEANUP AND REMOVE] @@ -72,3 +66,10 @@ x execute code on client (stage 5) - create doc/dev/HACKERS_README - Add install target to Makefile - create cdist-config-init to create basic tree + - DOC document "cd $__object_dir, before running manifest" in doc/man/cdist-types.text + - DOC document that $type/manifest is executed for every object/instance + - DOC: types can always access __cdist_out_objects, __cdist_out_explorers, __cdist_out_execs + --> create cdist-variables document? + + - include generation in makefile + From 15fa6f76e6799ca5c3c94cace5904622319e8ef6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 19 Feb 2011 12:58:32 +0100 Subject: [PATCH 04/12] -debug from cdist-config Signed-off-by: Nico Schottelius --- bin/cdist-config | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/cdist-config b/bin/cdist-config index 49ffd354..3d80262e 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -21,8 +21,6 @@ # Print configuration directories - helper for all other scripts # -echo teeeeeeeeeeeeeeeeeees - # Fail if something bogus is going on set -u From e084272f76226a4495087f362ffd7911187d389a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 19 Feb 2011 13:01:28 +0100 Subject: [PATCH 05/12] ideas for cdist-quickstart Signed-off-by: Nico Schottelius --- doc/man/cdist-quickstart.text | 39 ++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/doc/man/cdist-quickstart.text b/doc/man/cdist-quickstart.text index 0d447a59..7bc79f52 100644 --- a/doc/man/cdist-quickstart.text +++ b/doc/man/cdist-quickstart.text @@ -1,5 +1,42 @@ -## How to use cdist? +cdist-quickstart(7) +=================== +Nico Schottelius +MAKE cdist-quickstart(1) an put into a script! + +NAME +---- +cdist-quickstart - Make use of cinit in 5 minutes + + +DESCRIPTION +----------- +This document helps you to take the first steps with cdist. +We'll begin to configure the host "localhost" to have two files +in place, /etc/DO-NOT-CHANGE and /root/CDIST-ENABLED-HOST, which +both are used to warn other sysadmins that this system is managed +by configuration management and manual changes may get overwritten. + +Firstly, we create the basic directory structure to hold the +configuration for cdist: + +mkdir -p /etc/cdist/manifests + +# Create + +Cdist uses +kgives you an impression of 0. Create a host specification (/etc/cdist/hosts/**hostname**) 0. Add functionalilty to add 0. Run ***cdist-apply*** + +SEE ALSO +-------- +cdist-config-layout(7) + + +COPYING +------- +Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). +## How to use cdist? From ea128862740331589b7ca5d0ae72011d11fbd2b7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 20 Feb 2011 02:05:53 +0100 Subject: [PATCH 06/12] todo change Signed-off-by: Nico Schottelius --- TODO-1.0 | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO-1.0 b/TODO-1.0 index ad94185b..c742e346 100644 --- a/TODO-1.0 +++ b/TODO-1.0 @@ -66,6 +66,7 @@ x execute code on client (stage 5) - create doc/dev/HACKERS_README - Add install target to Makefile - create cdist-config-init to create basic tree + - cdist-type integration! - DOC document "cd $__object_dir, before running manifest" in doc/man/cdist-types.text - DOC document that $type/manifest is executed for every object/instance - DOC: types can always access __cdist_out_objects, __cdist_out_explorers, __cdist_out_execs From 4664643f135949f8f1e00b37e0c562686a8b0e94 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 20 Feb 2011 02:07:56 +0100 Subject: [PATCH 07/12] begin to use cdist-quickstart(1) Signed-off-by: Nico Schottelius --- bin/cdist-quickstart | 40 +++++++++++++++++++++++++++++++++++ doc/man/cdist-quickstart.text | 10 ++++----- 2 files changed, 45 insertions(+), 5 deletions(-) create mode 100755 bin/cdist-quickstart diff --git a/bin/cdist-quickstart b/bin/cdist-quickstart new file mode 100755 index 00000000..08868582 --- /dev/null +++ b/bin/cdist-quickstart @@ -0,0 +1,40 @@ +#!/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 . +# +# +# Give the user an introduction into cdist +# + +. cdist-config +set -eu + +__prompt() +{ + echo "Press enter to continue or ctrl-c to abort" + echo "[Enter]" + read answer +} + +cat << eof + +Welcome to cdist-quickstart, the interactive guide to cdist! + +After you press enter, I'll create the basic directories for you. + +eof diff --git a/doc/man/cdist-quickstart.text b/doc/man/cdist-quickstart.text index 7bc79f52..570aa310 100644 --- a/doc/man/cdist-quickstart.text +++ b/doc/man/cdist-quickstart.text @@ -1,9 +1,7 @@ -cdist-quickstart(7) +cdist-quickstart(1) =================== Nico Schottelius -MAKE cdist-quickstart(1) an put into a script! - NAME ---- cdist-quickstart - Make use of cinit in 5 minutes @@ -17,8 +15,10 @@ in place, /etc/DO-NOT-CHANGE and /root/CDIST-ENABLED-HOST, which both are used to warn other sysadmins that this system is managed by configuration management and manual changes may get overwritten. -Firstly, we create the basic directory structure to hold the -configuration for cdist: +Begin to execute cdist-quickstart, it will show you the steps it +takes and explains what it does: + +% cdist-quickstart mkdir -p /etc/cdist/manifests From ae91df7d0bb89d2b6426bdec2d853e2d38600f32 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 20 Feb 2011 02:10:48 +0100 Subject: [PATCH 08/12] re-integrate log directory Signed-off-by: Nico Schottelius --- doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2010-09-25 | 0 doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2010-11-02.steven | 0 doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2010-11-09 | 0 doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2010-11-21 | 0 doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2010-11-29 | 0 doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2010-12-01 | 0 doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2011-01-17 | 0 .../logs/2011-01-18.type-creation | 0 doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2011-01-24 | 0 doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2011-02-03 | 0 doc/dev/logs/README | 1 + doc/{internal.REMOVE_PRE_1.0 => dev}/logs/stevens_ideas | 0 12 files changed, 1 insertion(+) rename doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2010-09-25 (100%) rename doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2010-11-02.steven (100%) rename doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2010-11-09 (100%) rename doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2010-11-21 (100%) rename doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2010-11-29 (100%) rename doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2010-12-01 (100%) rename doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2011-01-17 (100%) rename doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2011-01-18.type-creation (100%) rename doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2011-01-24 (100%) rename doc/{internal.REMOVE_PRE_1.0 => dev}/logs/2011-02-03 (100%) create mode 100644 doc/dev/logs/README rename doc/{internal.REMOVE_PRE_1.0 => dev}/logs/stevens_ideas (100%) diff --git a/doc/internal.REMOVE_PRE_1.0/logs/2010-09-25 b/doc/dev/logs/2010-09-25 similarity index 100% rename from doc/internal.REMOVE_PRE_1.0/logs/2010-09-25 rename to doc/dev/logs/2010-09-25 diff --git a/doc/internal.REMOVE_PRE_1.0/logs/2010-11-02.steven b/doc/dev/logs/2010-11-02.steven similarity index 100% rename from doc/internal.REMOVE_PRE_1.0/logs/2010-11-02.steven rename to doc/dev/logs/2010-11-02.steven diff --git a/doc/internal.REMOVE_PRE_1.0/logs/2010-11-09 b/doc/dev/logs/2010-11-09 similarity index 100% rename from doc/internal.REMOVE_PRE_1.0/logs/2010-11-09 rename to doc/dev/logs/2010-11-09 diff --git a/doc/internal.REMOVE_PRE_1.0/logs/2010-11-21 b/doc/dev/logs/2010-11-21 similarity index 100% rename from doc/internal.REMOVE_PRE_1.0/logs/2010-11-21 rename to doc/dev/logs/2010-11-21 diff --git a/doc/internal.REMOVE_PRE_1.0/logs/2010-11-29 b/doc/dev/logs/2010-11-29 similarity index 100% rename from doc/internal.REMOVE_PRE_1.0/logs/2010-11-29 rename to doc/dev/logs/2010-11-29 diff --git a/doc/internal.REMOVE_PRE_1.0/logs/2010-12-01 b/doc/dev/logs/2010-12-01 similarity index 100% rename from doc/internal.REMOVE_PRE_1.0/logs/2010-12-01 rename to doc/dev/logs/2010-12-01 diff --git a/doc/internal.REMOVE_PRE_1.0/logs/2011-01-17 b/doc/dev/logs/2011-01-17 similarity index 100% rename from doc/internal.REMOVE_PRE_1.0/logs/2011-01-17 rename to doc/dev/logs/2011-01-17 diff --git a/doc/internal.REMOVE_PRE_1.0/logs/2011-01-18.type-creation b/doc/dev/logs/2011-01-18.type-creation similarity index 100% rename from doc/internal.REMOVE_PRE_1.0/logs/2011-01-18.type-creation rename to doc/dev/logs/2011-01-18.type-creation diff --git a/doc/internal.REMOVE_PRE_1.0/logs/2011-01-24 b/doc/dev/logs/2011-01-24 similarity index 100% rename from doc/internal.REMOVE_PRE_1.0/logs/2011-01-24 rename to doc/dev/logs/2011-01-24 diff --git a/doc/internal.REMOVE_PRE_1.0/logs/2011-02-03 b/doc/dev/logs/2011-02-03 similarity index 100% rename from doc/internal.REMOVE_PRE_1.0/logs/2011-02-03 rename to doc/dev/logs/2011-02-03 diff --git a/doc/dev/logs/README b/doc/dev/logs/README new file mode 100644 index 00000000..15c6bf9f --- /dev/null +++ b/doc/dev/logs/README @@ -0,0 +1 @@ +Logfiles of discussions diff --git a/doc/internal.REMOVE_PRE_1.0/logs/stevens_ideas b/doc/dev/logs/stevens_ideas similarity index 100% rename from doc/internal.REMOVE_PRE_1.0/logs/stevens_ideas rename to doc/dev/logs/stevens_ideas From fab863086b2c89a35917ac624dee0e54d1afe724 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 20 Feb 2011 13:14:45 +0100 Subject: [PATCH 09/12] -* Signed-off-by: Nico Schottelius --- REAL_README | 1 - 1 file changed, 1 deletion(-) diff --git a/REAL_README b/REAL_README index af35e810..15ec6507 100644 --- a/REAL_README +++ b/REAL_README @@ -13,7 +13,6 @@ it ticks differently: * cdist sticks completly to the KISS (keep it simple and stupid) paradigma * cdist's core is very small (currently around 400 lines of code) * There is only one type to extend cdist called ***type***. - * * cdist is UNIX * It reuses existing tools like cat, find, mv, ... * cdist's documentation is bundled as manpages From 35387cbc6112fb5c28742ad75e11ef165396107a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 Feb 2011 11:31:37 +0100 Subject: [PATCH 10/12] add __cdist_exec_fail_on_error Signed-off-by: Nico Schottelius --- bin/cdist-config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/cdist-config b/bin/cdist-config index 3d80262e..e0a40505 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -179,6 +179,12 @@ __cdist_object_source() cat "${object_dir}/$__cdist_name_object_source" } +__cdist_exec_fail_on_error() +{ + sh -e -c "$1" +} + + __cdist_tmp_removal() { rm -rf "${__cdist_tmp_dir}" From da8abcb770bbec48812f6e5173b0796cb58f3f0b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 Feb 2011 11:33:34 +0100 Subject: [PATCH 11/12] -c 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 e0a40505..445c5b32 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -181,7 +181,7 @@ __cdist_object_source() __cdist_exec_fail_on_error() { - sh -e -c "$1" + sh -e "$1" } From 5dcb719844fefbd2881f0482584e51f6720dcdd5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 Feb 2011 11:39:23 +0100 Subject: [PATCH 12/12] introduce and use __cdist_exec_fail_on_error Signed-off-by: Nico Schottelius --- bin/cdist-config | 3 ++- bin/cdist-manifest-run | 15 ++------------- bin/cdist-object-codegen | 16 +--------------- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/bin/cdist-config b/bin/cdist-config index 445c5b32..3a57e56e 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -181,7 +181,8 @@ __cdist_object_source() __cdist_exec_fail_on_error() { - sh -e "$1" + sh -e "$@" + [ "$?" -eq 0 ] || __cdist_exit_err "Error: $1 exited non-zero." } diff --git a/bin/cdist-manifest-run b/bin/cdist-manifest-run index 72f01532..38cf9f1b 100755 --- a/bin/cdist-manifest-run +++ b/bin/cdist-manifest-run @@ -41,17 +41,6 @@ if [ ! -x "${__cdist_manifest}" ]; then __cdist_exit_err "${__cdist_manifest} needs to be executable." fi -mkdir -p "${__cdist_output_dir}" +mkdir -p "${__cdist_output_dir}" || __cdist_exit_err "Cannot create output dir ${__cdist_output_dir}" -# Catch errors ourselves now -set +e - -# Ensure manifest fails if any error exists - FIXME: redundant, cdist-object-codegen -( - set -e - . "${__cdist_manifest}" -); ret=$? - -if [ "$ret" -ne 0 ]; then - __cdist_exit_err "Error: ${__cdist_manifest} exited non-zero." -fi +__cdist_exec_fail_on_error "${__cdist_manifest}" diff --git a/bin/cdist-object-codegen b/bin/cdist-object-codegen index d2bdd550..52006255 100755 --- a/bin/cdist-object-codegen +++ b/bin/cdist-object-codegen @@ -54,19 +54,5 @@ if [ -x "$gencode" ]; then eof - # Catch errors ourself now - set +e - ( - # Ensure manifest fails if something within manifest fails - # And not all manifests need to include set -e themselves - set -e - . "$gencode" - ); ret=$? - -else - ret=0 -fi - -if [ "$ret" -ne 0 ]; then - __cdist_exit_err "Error: $gencode exited non-zero" + __cdist_exec_fail_on_error "$gencode" fi