From c8fa79d05350732d29ce23fa665d0c121999d7c4 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Thu, 14 Jun 2012 14:33:21 -0400 Subject: [PATCH 1/2] Parameter change Modified jailbase parameter such that it's only required when $state=present --- conf/type/__jail/gencode-local | 22 ++++++++++++++++++---- conf/type/__jail/gencode-remote | 14 +++++++++++++- conf/type/__jail/parameter/optional | 1 + conf/type/__jail/parameter/required | 1 - 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/conf/type/__jail/gencode-local b/conf/type/__jail/gencode-local index 6292d943..075a6ef1 100755 --- a/conf/type/__jail/gencode-local +++ b/conf/type/__jail/gencode-local @@ -28,12 +28,26 @@ else jaildir="/usr/jail" fi -jailbase="$(cat "$__object/parameter/jailbase")" +if [ -f "$__object/parameter/jailbase" ]; then + jailbase="$(cat "$__object/parameter/jailbase")" +else + jailbase="" +fi + +state="$(cat "$__object/parameter/state")" + +if [ "$state" = "present" ] && [ -z "$jailbase" ]; then + exec >&2 + echo "jailbase is a REQUIRED parameter when state=present!" + exit 1 +fi remotebase="${jaildir}/jailbase.tgz" basepresent="$(cat "$__object/explorer/basepresent")" -if [ "$basepresent" = "NONE" ]; then - echo "$__remote_copy" "${jailbase}" "$__target_host:${remotebase}" -fi +if [ "$state" = "present" ]; then + if [ "$basepresent" = "NONE" ]; then + echo "$__remote_copy" "${jailbase}" "$__target_host:${remotebase}" + fi # basepresent=NONE +fi # state=present diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 2db3fac0..d26e02ac 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -177,6 +177,7 @@ cat <