Merge branch 'master' into install_integration
This commit is contained in:
commit
52a3db04d0
27 changed files with 74 additions and 64 deletions
|
@ -16,7 +16,8 @@ This cdist type allows manage ubuntu ppa repositories.
|
|||
REQUIRED PARAMETERS
|
||||
-------------------
|
||||
state::
|
||||
The state the ppa should be in, either "present" or "absent".
|
||||
The state the ppa should be in, either 'present' or 'absent'.
|
||||
Defaults to 'present'
|
||||
|
||||
|
||||
OPTIONAL PARAMETERS
|
||||
|
@ -29,6 +30,8 @@ EXAMPLES
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
# Enable a ppa repository
|
||||
__apt_ppa ppa:sans-intern/missing-bits
|
||||
# same as
|
||||
__apt_ppa ppa:sans-intern/missing-bits --state present
|
||||
|
||||
# Disable a ppa repository
|
||||
|
@ -43,5 +46,5 @@ SEE ALSO
|
|||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011 Steven Armstrong. Free use of this software is
|
||||
Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||
# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
|
@ -20,9 +20,10 @@
|
|||
|
||||
name="$__object_id"
|
||||
|
||||
__package python-software-properties --state present
|
||||
__package software-properties-common
|
||||
__package python-software-properties
|
||||
|
||||
require="__package/python-software-properties" \
|
||||
require="__package/software-properties-common __package/python-software-properties" \
|
||||
__file /usr/local/bin/remove-apt-repository \
|
||||
--source "$__type/files/remove-apt-repository" \
|
||||
--mode 0755
|
||||
|
|
1
cdist/conf/type/__apt_ppa/parameter/default/state
Normal file
1
cdist/conf/type/__apt_ppa/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
|||
present
|
|
@ -27,23 +27,11 @@ else
|
|||
shell=""
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/username" ]; then
|
||||
username="$(cat "$__object/parameter/username")"
|
||||
else
|
||||
username="cdist"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/branch" ]; then
|
||||
branch="$(cat "$__object/parameter/branch")"
|
||||
else
|
||||
branch="master"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/source" ]; then
|
||||
source="$(cat "$__object/parameter/source")"
|
||||
else
|
||||
source="git://github.com/telmich/cdist.git"
|
||||
fi
|
||||
|
||||
# Currently hardcoded - if anyone cares, make a parameter
|
||||
# out of it
|
||||
|
|
1
cdist/conf/type/__cdist/parameter/default/branch
Normal file
1
cdist/conf/type/__cdist/parameter/default/branch
Normal file
|
@ -0,0 +1 @@
|
|||
master
|
1
cdist/conf/type/__cdist/parameter/default/source
Normal file
1
cdist/conf/type/__cdist/parameter/default/source
Normal file
|
@ -0,0 +1 @@
|
|||
git://github.com/telmich/cdist.git
|
1
cdist/conf/type/__cdist/parameter/default/username
Normal file
1
cdist/conf/type/__cdist/parameter/default/username
Normal file
|
@ -0,0 +1 @@
|
|||
cdist
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
# 2011-2014 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
|
@ -21,6 +21,12 @@
|
|||
# Setup selections
|
||||
#
|
||||
|
||||
filename"$(cat "$__object/parameter/file")"
|
||||
|
||||
if [ "$filename" = "-" ]; then
|
||||
filename="$__object/stdin"
|
||||
fi
|
||||
|
||||
echo "debconf-set-selections << __file-eof"
|
||||
cat "$(cat "$__object/parameter/file")"
|
||||
cat "$(cat "$filename")"
|
||||
echo "__file-eof"
|
||||
|
|
|
@ -18,6 +18,7 @@ REQUIRED PARAMETERS
|
|||
-------------------
|
||||
file::
|
||||
Use the given filename as input for debconf-set-selections(1)
|
||||
If filename is "-", read from stdin.
|
||||
|
||||
|
||||
EXAMPLES
|
||||
|
@ -29,6 +30,10 @@ __debconf_set_selections nslcd --file /path/to/file
|
|||
|
||||
# Setup configuration for nslcd from another type
|
||||
__debconf_set_selections nslcd --file "$__type/files/preseed/nslcd"
|
||||
|
||||
__debconf_set_selections nslcd --file - << eof
|
||||
gitolite gitolite/gituser string git
|
||||
eof
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
@ -41,5 +46,5 @@ SEE ALSO
|
|||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011-2013 Nico Schottelius. Free use of this software is
|
||||
Copyright \(C) 2011-2014 Nico Schottelius. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#
|
||||
|
||||
if [ -f "$__object/parameter/jaildir" ]; then
|
||||
jaildir="$(cat "$__object/parameter/name")"
|
||||
jaildir="$(cat "$__object/parameter/jaildir")"
|
||||
else
|
||||
jaildir="/usr/jail"
|
||||
fi
|
||||
|
|
|
@ -85,7 +85,7 @@ if [ -f "$__object/parameter/onboot" ]; then
|
|||
fi
|
||||
|
||||
if [ -f "$__object/parameter/jaildir" ]; then
|
||||
jaildir="$(cat "$__object/parameter/name")"
|
||||
jaildir="$(cat "$__object/parameter/jaildir")"
|
||||
else
|
||||
jaildir="/usr/jail"
|
||||
fi
|
||||
|
|
|
@ -34,7 +34,7 @@ if [ ! "$os" = "freebsd" ]; then
|
|||
fi
|
||||
|
||||
if [ -f "$__object/parameter/jaildir" ]; then
|
||||
jaildir="$(cat "$__object/parameter/name")"
|
||||
jaildir="$(cat "$__object/parameter/jaildir")"
|
||||
else
|
||||
jaildir="/usr/jail"
|
||||
fi
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
key="$__object_id"
|
||||
[ -f "$__object/parameter/key" ] && key="$(cat "$__object/parameter/key")"
|
||||
state_should=present
|
||||
[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")"
|
||||
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
|
||||
file="$(cat "$__object/parameter/file")"
|
||||
delimiter="$(cat "$__object/parameter/delimiter")"
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
state_should=present
|
||||
[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")"
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
|
||||
if [ "$state_should" = "present" -a ! -f "$__object/parameter/value" ]; then
|
||||
echo "Missing required parameter 'value'" >&2
|
||||
|
|
1
cdist/conf/type/__key_value/parameter/default/state
Normal file
1
cdist/conf/type/__key_value/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
|||
present
|
|
@ -2,8 +2,7 @@
|
|||
# State: absent is handled by manifest - we need only to do stuff if image is
|
||||
# not existing and state != absent
|
||||
#
|
||||
state="present"
|
||||
[ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
[ "$state" = "absent" ] && exit 0
|
||||
|
||||
exists="$(cat "$__object/explorer/exists")"
|
||||
|
@ -13,8 +12,7 @@ exists="$(cat "$__object/explorer/exists")"
|
|||
# Still there? Create image
|
||||
#
|
||||
|
||||
format=qcow2
|
||||
[ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")"
|
||||
format="$(cat "$__object/parameter/format")"
|
||||
size="$(cat "$__object/parameter/size")"
|
||||
diskimage="/$__object_id"
|
||||
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
# Default settings
|
||||
#
|
||||
|
||||
format=qcow2
|
||||
state=present
|
||||
[ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")"
|
||||
[ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")"
|
||||
format="$(cat "$__object/parameter/format")"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
diskimage="/$__object_id"
|
||||
|
||||
|
|
1
cdist/conf/type/__qemu_img/parameter/default/format
Normal file
1
cdist/conf/type/__qemu_img/parameter/default/format
Normal file
|
@ -0,0 +1 @@
|
|||
qcow2
|
1
cdist/conf/type/__qemu_img/parameter/default/state
Normal file
1
cdist/conf/type/__qemu_img/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
|||
present
|
|
@ -1 +1,2 @@
|
|||
format
|
||||
state
|
||||
|
|
|
@ -45,11 +45,7 @@ else
|
|||
id="$__object_id"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/state" ]; then
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
else
|
||||
state="present"
|
||||
fi
|
||||
|
||||
repo_id="$(cat "$__object/explorer/repo_id")"
|
||||
|
||||
|
|
|
@ -39,17 +39,8 @@ else
|
|||
uri="$__object_id"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/state" ]; then
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
else
|
||||
state_should="present"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/type" ]; then
|
||||
stype="$(cat "$__object/parameter/type")"
|
||||
else
|
||||
stype="ris"
|
||||
fi
|
||||
|
||||
exp_uri="$(cat "$__object/explorer/service_uri")"
|
||||
exp_id="$(cat "$__object/explorer/service_id")"
|
||||
|
|
|
@ -33,11 +33,7 @@ else
|
|||
uri="$__object_id"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/state" ]; then
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
else
|
||||
state_should="present"
|
||||
fi
|
||||
|
||||
exp_uri="$(cat "$__object/explorer/service_uri")"
|
||||
|
||||
|
|
|
@ -4,12 +4,25 @@ Changelog
|
|||
* Changes are always commented with their author in (braces)
|
||||
* Exception: No braces means author == Nico Schottelius
|
||||
|
||||
3.0.3:
|
||||
3.0.4:
|
||||
* Documentation: Update reference (files path in object space)
|
||||
* Type __apt_ppa: Install required software (Steven Armstrong)
|
||||
* Type __debconf_set_selections: Support --file - to read from stdin
|
||||
* Type __jail: Fix jaildir parameter handling (Jake Guffey)
|
||||
|
||||
|
||||
3.0.3: 2014-01-22
|
||||
* Core: Enhance error message when requirement is missing object id
|
||||
* Core: Add environment variable to select shell for executing scripts (Daniel Heule)
|
||||
* Explorer hostname: Return host name by using uname -n
|
||||
* New Type: __hostname (Steven Armstrong)
|
||||
* Type __cdist: Use default paremeters (Daniel Heule)
|
||||
* Type __key_value: Use default paremeters (Daniel Heule)
|
||||
* Type __line: Use printf instead of echo for printing user input
|
||||
* Type __qemu_img: Use default paremeters (Daniel Heule)
|
||||
* Type __zypper_repo: Use default paremeters (Daniel Heule)
|
||||
* Type __zypper_service: Use default paremeters (Daniel Heule)
|
||||
|
||||
|
||||
3.0.2: 2014-01-19
|
||||
* Documentation: Document all messages sent by types (Daniel Heule)
|
||||
|
|
|
@ -131,7 +131,8 @@ confdir/type/<name>/explorer::
|
|||
|
||||
confdir/type/<name>/files::
|
||||
This directory is reserved for user data and will not be used
|
||||
by cdist at any time
|
||||
by cdist at any time. It can be used for storing supplementary
|
||||
files (like scripts to act as a template or configuration files).
|
||||
|
||||
out/::
|
||||
This directory contains output of cdist and is usually located
|
||||
|
@ -175,9 +176,16 @@ OBJECTS
|
|||
For object to object communication and tests, the following paths are
|
||||
usable within a object directory:
|
||||
|
||||
files::
|
||||
This directory is reserved for user data and will not be used
|
||||
by cdist at any time. It can be used freely by the type
|
||||
(for instance to store template results).
|
||||
changed::
|
||||
This empty file exists in an object directory, if the object has
|
||||
code to be excuted (either remote or local)
|
||||
stdin::
|
||||
This file exists and contains data, if data was provided on stdin
|
||||
when the type was called.
|
||||
|
||||
|
||||
ENVIRONMENT VARIABLES
|
||||
|
|
|
@ -164,8 +164,8 @@ For more details consult sudoers(5)
|
|||
|
||||
TEMPLATING
|
||||
----------
|
||||
* create directory templates/ in your type (convention)
|
||||
* create the template as an executable file like templates/basic.conf.sh, it will output text using shell variables for the values
|
||||
* create directory files/ in your type (convention)
|
||||
* create the template as an executable file like files/basic.conf.sh, it will output text using shell variables for the values
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
#!/bin/sh
|
||||
|
@ -191,7 +191,7 @@ EOF
|
|||
export ROOT='/var/www/test'
|
||||
# render the template
|
||||
mkdir -p "$__object/files"
|
||||
"$__type/templates/basic.conf.sh" > "$__object/files/basic.conf"
|
||||
"$__type/files/basic.conf.sh" > "$__object/files/basic.conf"
|
||||
# send the rendered template
|
||||
__file /etc/nginx/sites-available/test.conf \
|
||||
--state present
|
||||
|
|
Loading…
Reference in a new issue