From d12daf10c4dd943bb007402914957ab8f47dcac3 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Fri, 4 Apr 2014 14:00:51 -0400 Subject: [PATCH 1/2] Added messaging support for __jail type prints start/stop/create/delete/onboot to $__messages_out --- cdist/conf/type/__jail/explorer/status | 2 +- cdist/conf/type/__jail/gencode-remote | 7 ++++++- cdist/conf/type/__jail/manifest | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cdist/conf/type/__jail/explorer/status b/cdist/conf/type/__jail/explorer/status index 06f7d063..1ceba212 100755 --- a/cdist/conf/type/__jail/explorer/status +++ b/cdist/conf/type/__jail/explorer/status @@ -39,7 +39,7 @@ fi # backslash-escaped $jaildir sjaildir="$(echo ${jaildir} | sed 's#/#\\/#g')" -jls_output="$(jls | grep "[ ^I]${sjaildir}\/${name}\$")" || true +jls_output="$(jls | grep "[ ]${sjaildir}\/${name}\$")" || true if [ -n "${jls_output}" ]; then echo "STARTED" diff --git a/cdist/conf/type/__jail/gencode-remote b/cdist/conf/type/__jail/gencode-remote index 141c8150..c88f3361 100755 --- a/cdist/conf/type/__jail/gencode-remote +++ b/cdist/conf/type/__jail/gencode-remote @@ -1,6 +1,6 @@ #!/bin/sh # -# 2012 Jake Guffey (jake.guffey at eprotex.com) +# 2012,2014 Jake Guffey (jake.guffey at eprotex.com) # # This file is part of cdist. # @@ -104,6 +104,7 @@ stopJail() { # Check $status before issuing command if [ "$status" = "STARTED" ]; then echo "/etc/rc.d/jail stop ${name}" + echo "stop" >> "$__messages_out" fi } @@ -111,6 +112,7 @@ startJail() { # Check $status before issuing command if [ "$status" = "NOTSTART" ]; then echo "/etc/rc.d/jail start ${name}" + echo "start" >> "$__messages_out" fi } @@ -162,6 +164,7 @@ EOF rm -f /etc/rc.conf.bak fi EOF + echo "delete" >> "$__messages_out" } createJail() { @@ -215,6 +218,7 @@ cat <> "$__messages_out" # Create the ro+rw mountpoint entries in fstab cat <> "$__messages_out" fi # Add the normal entries into the jail's rc.conf diff --git a/cdist/conf/type/__jail/manifest b/cdist/conf/type/__jail/manifest index 6a953241..2d29e263 100755 --- a/cdist/conf/type/__jail/manifest +++ b/cdist/conf/type/__jail/manifest @@ -29,8 +29,8 @@ # Can only be used on FreeBSD os="$(cat "$__global/explorer/os")" if [ ! "$os" = "freebsd" ]; then - echo "__jail can only be used on FreeBSD targets!" >&2 - exit 1 + echo "__jail can only be used on FreeBSD targets!" >&2 + exit 1 fi jaildir="$(cat "$__object/parameter/jaildir")" From f7a6377b74f7b1809a096a9a7cb9b9daf96b1d90 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Mon, 7 Apr 2014 09:44:28 -0400 Subject: [PATCH 2/2] Updated man page Included MESSAGES section --- cdist/conf/type/__jail/man.text | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cdist/conf/type/__jail/man.text b/cdist/conf/type/__jail/man.text index 9c968d84..be27e909 100644 --- a/cdist/conf/type/__jail/man.text +++ b/cdist/conf/type/__jail/man.text @@ -67,6 +67,19 @@ be removed then re-added with the correct IP address/netmask or the appropriate line (jail__ip="...") modified within rc.conf through some alternate means. +MESSAGES +-------- +start:: + The jail was started +stop:: + The jail was stopped +create: + The jail was created +delete:: + The jail was deleted +onboot:: + The jail was configured to start on boot + EXAMPLES --------