From d082815c811ba53cb096198d1199f5c35e11f269 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Sun, 19 Feb 2012 14:09:36 -0500 Subject: [PATCH] Created explorers, man page, jailbase placeholder. Began initial development of gencode-remote. --- conf/type/__jail/explorer/present | 27 +++++++++++++++ conf/type/__jail/explorer/status | 28 +++++++++++++++ conf/type/__jail/files/jailbase | 1 + conf/type/__jail/gencode-remote | 44 +++++++++++++++++++++++ conf/type/__jail/man.text | 54 +++++++++++++++++++++++++++++ conf/type/__jail/manifest | 31 +++++++++++++++++ conf/type/__jail/parameter/optional | 1 + conf/type/__jail/parameter/required | 1 + 8 files changed, 187 insertions(+) create mode 100755 conf/type/__jail/explorer/present create mode 100755 conf/type/__jail/explorer/status create mode 100644 conf/type/__jail/files/jailbase mode change 100644 => 100755 conf/type/__jail/gencode-remote create mode 100755 conf/type/__jail/manifest diff --git a/conf/type/__jail/explorer/present b/conf/type/__jail/explorer/present new file mode 100755 index 00000000..c559cf65 --- /dev/null +++ b/conf/type/__jail/explorer/present @@ -0,0 +1,27 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# 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 . +# +# +# See if the requested jail exists +# + +name=$__object_id + +[ -d "/usr/jail/$name" ] && echo "EXISTS" + diff --git a/conf/type/__jail/explorer/status b/conf/type/__jail/explorer/status new file mode 100755 index 00000000..19b57672 --- /dev/null +++ b/conf/type/__jail/explorer/status @@ -0,0 +1,28 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# 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 . +# +# +# See if the requested jail is started +# + +name=$__object_id + +jls_output=$(jls | grep "[ ]\/usr\/jail\/$name\$") +[ -n "$jls_output" ] && echo "STARTED" + diff --git a/conf/type/__jail/files/jailbase b/conf/type/__jail/files/jailbase new file mode 100644 index 00000000..defb739a --- /dev/null +++ b/conf/type/__jail/files/jailbase @@ -0,0 +1 @@ +Create a tarball jailbase.tgz in this directory containing the base filesystem for a jail. diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote old mode 100644 new mode 100755 index e69de29b..264ce111 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -0,0 +1,44 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# 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 . +# +# +# The __jail type creates, configures, and deletes FreeBSD jails for use as +# virtual machines. +# + +jaildir="/usr/jail" +present="$(cat "$__object/explorer/present")" +status="$(cat "$__object/explorer/status")" +state="$(cat "$__object/parameter/state")" +name="$__object_id" + +if [ -f "$__object/parameter/started" ]; then + started="$(cat "$__object/parameter/started")" +fi + +# + +if [ "$present" = "EXISTS" ]; then +# blah +fi + +if [ "$status" = "STARTED" ]; then +# blah +fi + diff --git a/conf/type/__jail/man.text b/conf/type/__jail/man.text index e69de29b..b2e49468 100644 --- a/conf/type/__jail/man.text +++ b/conf/type/__jail/man.text @@ -0,0 +1,54 @@ +cdist-type__jail(7) +========================== +Jake Guffey + + +NAME +---- +cdist-type__jail - Manage FreeBSD jails + + +DESCRIPTION +----------- +This type is used on FreeBSD to manage jails. + + +REQUIRED PARAMETERS +------------------- +state:: + Either "present" or "absent." + + +OPTIONAL PARAMETERS +------------------- +started:: + Either "true" or "false." + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Create a jail called www +__jail www --state present + +# Remove the jail called www +__jail www --state absent + +# Ensure that the jail called www is started +__jail www --state present --started true + +# Use the name variable explicitly +__jail thisjail --state present --name www +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2012 Jake Guffey. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__jail/manifest b/conf/type/__jail/manifest new file mode 100755 index 00000000..81fcd65b --- /dev/null +++ b/conf/type/__jail/manifest @@ -0,0 +1,31 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# 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 . +# +# +# The __jail type creates, configures, and deletes FreeBSD jails for use as +# virtual machines. +# + +#FIXME: /usr/jail should never be hardcoded in this type +#FIXME: jailbase.tgz should not be hardcoded in this file + +jailbase="/usr/jail/jailbase.tgz" + +__rsyncer "$jailbase" --source "$__object/files/jailbase.tgz" + diff --git a/conf/type/__jail/parameter/optional b/conf/type/__jail/parameter/optional index e69de29b..c06c82c7 100644 --- a/conf/type/__jail/parameter/optional +++ b/conf/type/__jail/parameter/optional @@ -0,0 +1 @@ +started diff --git a/conf/type/__jail/parameter/required b/conf/type/__jail/parameter/required index e69de29b..ff72b5c7 100644 --- a/conf/type/__jail/parameter/required +++ b/conf/type/__jail/parameter/required @@ -0,0 +1 @@ +state