From 4c6f115a434eaf9e33ec1b305179b306f53d0edd Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Sat, 26 Mar 2011 01:48:19 +0100 Subject: [PATCH] extract code to execute gencode-generated scripts into its own executable Signed-off-by: Steven Armstrong --- bin/cdist-object-code-run | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 bin/cdist-object-code-run diff --git a/bin/cdist-object-code-run b/bin/cdist-object-code-run new file mode 100755 index 00000000..b75f6f46 --- /dev/null +++ b/bin/cdist-object-code-run @@ -0,0 +1,42 @@ +#!/bin/sh +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Exec the code for the given object locally and remote +# + +. cdist-config +[ $# -eq 2 ] || __cdist_usage " " +set -e + +__cdist_target_host="$1"; shift +__cdist_object="$1"; shift + +# Code local +export __cdist_out_object_dir="$__cdist_out_object_dir" +cdist-code-run "$__cdist_object" "${__cdist_name_gencode_local}" \ + || __cdist_exit_err "Local code failed for $__cdist_object" + +# Code remote +cdist-run-remote "$__cdist_target_host" \ + "export __cdist_out_object_dir=\"$__cdist_remote_out_object_dir\";" \ + "cdist-code-run" "$__cdist_object" "${__cdist_name_gencode_remote}" \ + || __cdist_exit_err "Remote code failed for $__cdist_object" +