forked from ungleich-public/cdist
		
	Merge pull request #325 from jdguffey/__jail_messaging
Added messaging support for __jail type
This commit is contained in:
		
				commit
				
					
						47ba46400c
					
				
			
		
					 4 changed files with 22 additions and 4 deletions
				
			
		| 
						 | 
					@ -39,7 +39,7 @@ fi
 | 
				
			||||||
# backslash-escaped $jaildir
 | 
					# backslash-escaped $jaildir
 | 
				
			||||||
sjaildir="$(echo ${jaildir} | sed 's#/#\\/#g')"
 | 
					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
 | 
					if [ -n "${jls_output}" ]; then
 | 
				
			||||||
   echo "STARTED"
 | 
					   echo "STARTED"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
#!/bin/sh
 | 
					#!/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.
 | 
					# This file is part of cdist.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
| 
						 | 
					@ -104,6 +104,7 @@ stopJail() {
 | 
				
			||||||
# Check $status before issuing command
 | 
					# Check $status before issuing command
 | 
				
			||||||
   if [ "$status" = "STARTED" ]; then
 | 
					   if [ "$status" = "STARTED" ]; then
 | 
				
			||||||
      echo "/etc/rc.d/jail stop ${name}"
 | 
					      echo "/etc/rc.d/jail stop ${name}"
 | 
				
			||||||
 | 
					      echo "stop" >> "$__messages_out"
 | 
				
			||||||
   fi
 | 
					   fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -111,6 +112,7 @@ startJail() {
 | 
				
			||||||
# Check $status before issuing command
 | 
					# Check $status before issuing command
 | 
				
			||||||
   if [ "$status" = "NOTSTART" ]; then
 | 
					   if [ "$status" = "NOTSTART" ]; then
 | 
				
			||||||
      echo "/etc/rc.d/jail start ${name}"
 | 
					      echo "/etc/rc.d/jail start ${name}"
 | 
				
			||||||
 | 
					      echo "start" >> "$__messages_out"
 | 
				
			||||||
   fi
 | 
					   fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -162,6 +164,7 @@ EOF
 | 
				
			||||||
         rm -f /etc/rc.conf.bak
 | 
					         rm -f /etc/rc.conf.bak
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					   echo "delete" >> "$__messages_out"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
createJail() {
 | 
					createJail() {
 | 
				
			||||||
| 
						 | 
					@ -215,6 +218,7 @@ cat <<EOF
 | 
				
			||||||
   fi
 | 
					   fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					   echo "create" >> "$__messages_out"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create the ro+rw mountpoint entries in fstab
 | 
					# Create the ro+rw mountpoint entries in fstab
 | 
				
			||||||
cat <<EOF
 | 
					cat <<EOF
 | 
				
			||||||
| 
						 | 
					@ -310,6 +314,7 @@ if [ "$onboot" = "yes" ]; then
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
      unset jail_list
 | 
					      unset jail_list
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					   echo "onboot" >> "$__messages_out"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Add the normal entries into the jail's rc.conf
 | 
					# Add the normal entries into the jail's rc.conf
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,6 +67,19 @@ be removed then re-added with the correct IP address/netmask or the appropriate
 | 
				
			||||||
line (jail_<name>_ip="...") modified within rc.conf through some alternate
 | 
					line (jail_<name>_ip="...") modified within rc.conf through some alternate
 | 
				
			||||||
means.
 | 
					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
 | 
					EXAMPLES
 | 
				
			||||||
--------
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,8 +29,8 @@
 | 
				
			||||||
# Can only be used on FreeBSD
 | 
					# Can only be used on FreeBSD
 | 
				
			||||||
os="$(cat "$__global/explorer/os")"
 | 
					os="$(cat "$__global/explorer/os")"
 | 
				
			||||||
if [ ! "$os" = "freebsd" ]; then
 | 
					if [ ! "$os" = "freebsd" ]; then
 | 
				
			||||||
	echo "__jail can only be used on FreeBSD targets!" >&2
 | 
					   echo "__jail can only be used on FreeBSD targets!" >&2
 | 
				
			||||||
	exit 1
 | 
					   exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
jaildir="$(cat "$__object/parameter/jaildir")"
 | 
					jaildir="$(cat "$__object/parameter/jaildir")"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue