forked from ungleich-public/cdist
Merge branch 'master' into preos
This commit is contained in:
commit
acddd14ce1
89 changed files with 1162 additions and 144 deletions
32
cdist/conf/type/__apt_key/explorer/state
Executable file
32
cdist/conf/type/__apt_key/explorer/state
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Get the current state of the apt key.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -f "$__object/parameter/keyid" ]; then
|
||||||
|
keyid="$(cat "$__object/parameter/keyid")"
|
||||||
|
else
|
||||||
|
keyid="$__object_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-key export "$keyid" | head -n 1 | grep -Fqe "BEGIN PGP PUBLIC KEY BLOCK" \
|
||||||
|
&& echo present \
|
||||||
|
|| echo absent
|
42
cdist/conf/type/__apt_key/gencode-remote
Executable file
42
cdist/conf/type/__apt_key/gencode-remote
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -f "$__object/parameter/keyid" ]; then
|
||||||
|
keyid="$(cat "$__object/parameter/keyid")"
|
||||||
|
else
|
||||||
|
keyid="$__object_id"
|
||||||
|
fi
|
||||||
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
|
state_is="$(cat "$__object/explorer/state")"
|
||||||
|
|
||||||
|
if [ "$state_should" = "$state_is" ]; then
|
||||||
|
# nothing to do
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$state_should" in
|
||||||
|
present)
|
||||||
|
keyserver="$(cat "$__object/parameter/keyserver")"
|
||||||
|
echo "apt-key adv --keyserver \"$keyserver\" --recv-keys \"$keyid\""
|
||||||
|
;;
|
||||||
|
absent)
|
||||||
|
echo "apt-key del \"$keyid\""
|
||||||
|
;;
|
||||||
|
esac
|
61
cdist/conf/type/__apt_key/man.text
Normal file
61
cdist/conf/type/__apt_key/man.text
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
cdist-type__apt_key(7)
|
||||||
|
======================
|
||||||
|
Steven Armstrong <steven-cdist--@--armstrong.cc>
|
||||||
|
|
||||||
|
|
||||||
|
NAME
|
||||||
|
----
|
||||||
|
cdist-type__apt_key - manage the list of keys used by apt
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
-----------
|
||||||
|
Manages the list of keys used by apt to authenticate packages.
|
||||||
|
|
||||||
|
|
||||||
|
REQUIRED PARAMETERS
|
||||||
|
-------------------
|
||||||
|
None.
|
||||||
|
|
||||||
|
|
||||||
|
OPTIONAL PARAMETERS
|
||||||
|
-------------------
|
||||||
|
state::
|
||||||
|
'present' or 'absent'. Defaults to 'present'
|
||||||
|
|
||||||
|
keyid::
|
||||||
|
the id of the key to add. Defaults to __object_id
|
||||||
|
|
||||||
|
keyserver::
|
||||||
|
the keyserver from which to fetch the key. If omitted the default set in
|
||||||
|
./parameter/default/keyserver is used.
|
||||||
|
|
||||||
|
|
||||||
|
EXAMPLES
|
||||||
|
--------
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
# Add Ubuntu Archive Automatic Signing Key
|
||||||
|
__apt_key 437D05B5
|
||||||
|
# Same thing
|
||||||
|
__apt_key 437D05B5 --state present
|
||||||
|
# Get rid of it
|
||||||
|
__apt_key 437D05B5 --state absent
|
||||||
|
|
||||||
|
# same thing with human readable name and explicit keyid
|
||||||
|
__apt_key UbuntuArchiveKey --keyid 437D05B5
|
||||||
|
|
||||||
|
# same thing with other keyserver
|
||||||
|
__apt_key UbuntuArchiveKey --keyid 437D05B5 --keyserver keyserver.ubuntu.com
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
--------
|
||||||
|
- cdist-type(7)
|
||||||
|
|
||||||
|
|
||||||
|
COPYING
|
||||||
|
-------
|
||||||
|
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
cdist/conf/type/__apt_key/parameter/default/keyserver
Normal file
1
cdist/conf/type/__apt_key/parameter/default/keyserver
Normal file
|
@ -0,0 +1 @@
|
||||||
|
subkeys.pgp.net
|
1
cdist/conf/type/__apt_key/parameter/default/state
Normal file
1
cdist/conf/type/__apt_key/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
||||||
|
present
|
3
cdist/conf/type/__apt_key/parameter/optional
Normal file
3
cdist/conf/type/__apt_key/parameter/optional
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
state
|
||||||
|
keyid
|
||||||
|
keyserver
|
32
cdist/conf/type/__apt_key_uri/explorer/state
Executable file
32
cdist/conf/type/__apt_key_uri/explorer/state
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Get the current state of the apt key.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -f "$__object/parameter/name" ]; then
|
||||||
|
name="$(cat "$__object/parameter/name")"
|
||||||
|
else
|
||||||
|
name="$__object_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-key list | grep -Fqe "$name" \
|
||||||
|
&& echo present \
|
||||||
|
|| echo absent
|
45
cdist/conf/type/__apt_key_uri/gencode-remote
Executable file
45
cdist/conf/type/__apt_key_uri/gencode-remote
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2011-2014 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -f "$__object/parameter/name" ]; then
|
||||||
|
name="$(cat "$__object/parameter/name")"
|
||||||
|
else
|
||||||
|
name="$__object_id"
|
||||||
|
fi
|
||||||
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
|
state_is="$(cat "$__object/explorer/state")"
|
||||||
|
|
||||||
|
if [ "$state_should" = "$state_is" ]; then
|
||||||
|
# nothing to do
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$state_should" in
|
||||||
|
present)
|
||||||
|
uri="$(cat "$__object/parameter/uri")"
|
||||||
|
printf 'curl -s -L "%s" | apt-key add -\n' "$uri"
|
||||||
|
;;
|
||||||
|
absent)
|
||||||
|
cat << DONE
|
||||||
|
keyid=\$(apt-key list | grep -B1 "$name" | awk '/pub/ { print \$2 }' | cut -d'/' -f 2)
|
||||||
|
apt-key del \$keyid
|
||||||
|
DONE
|
||||||
|
;;
|
||||||
|
esac
|
51
cdist/conf/type/__apt_key_uri/man.text
Normal file
51
cdist/conf/type/__apt_key_uri/man.text
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
cdist-type__apt_key_uri(7)
|
||||||
|
==========================
|
||||||
|
Steven Armstrong <steven-cdist--@--armstrong.cc>
|
||||||
|
|
||||||
|
|
||||||
|
NAME
|
||||||
|
----
|
||||||
|
cdist-type__apt_key_uri - add apt key from uri
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
-----------
|
||||||
|
Download a key from an uri and add it to the apt keyring.
|
||||||
|
|
||||||
|
|
||||||
|
REQUIRED PARAMETERS
|
||||||
|
-------------------
|
||||||
|
uri::
|
||||||
|
the uri from which to download the key
|
||||||
|
|
||||||
|
|
||||||
|
OPTIONAL PARAMETERS
|
||||||
|
-------------------
|
||||||
|
state::
|
||||||
|
'present' or 'absent', defaults to 'present'
|
||||||
|
|
||||||
|
name::
|
||||||
|
a name for this key, used when testing if it is already installed.
|
||||||
|
Defaults to __object_id
|
||||||
|
|
||||||
|
|
||||||
|
EXAMPLES
|
||||||
|
--------
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
__apt_key_uri rabbitmq \
|
||||||
|
--name 'RabbitMQ Release Signing Key <info@rabbitmq.com>' \
|
||||||
|
--uri http://www.rabbitmq.com/rabbitmq-signing-key-public.asc \
|
||||||
|
--state present
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
--------
|
||||||
|
- cdist-type(7)
|
||||||
|
|
||||||
|
|
||||||
|
COPYING
|
||||||
|
-------
|
||||||
|
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).
|
21
cdist/conf/type/__apt_key_uri/manifest
Executable file
21
cdist/conf/type/__apt_key_uri/manifest
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2013-2014 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
__package curl
|
1
cdist/conf/type/__apt_key_uri/parameter/default/state
Normal file
1
cdist/conf/type/__apt_key_uri/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
||||||
|
present
|
2
cdist/conf/type/__apt_key_uri/parameter/optional
Normal file
2
cdist/conf/type/__apt_key_uri/parameter/optional
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
state
|
||||||
|
name
|
1
cdist/conf/type/__apt_key_uri/parameter/required
Normal file
1
cdist/conf/type/__apt_key_uri/parameter/required
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uri
|
42
cdist/conf/type/__apt_norecommends/man.text
Normal file
42
cdist/conf/type/__apt_norecommends/man.text
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
cdist-type__apt_norecommends(7)
|
||||||
|
===============================
|
||||||
|
Steven Armstrong <steven-cdist--@--armstrong.cc>
|
||||||
|
|
||||||
|
|
||||||
|
NAME
|
||||||
|
----
|
||||||
|
cdist-type__apt_norecommends - configure apt to not install recommended packages
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
-----------
|
||||||
|
Configure apt to not install any recommended or suggested packages.
|
||||||
|
|
||||||
|
|
||||||
|
REQUIRED PARAMETERS
|
||||||
|
-------------------
|
||||||
|
None.
|
||||||
|
|
||||||
|
|
||||||
|
OPTIONAL PARAMETERS
|
||||||
|
-------------------
|
||||||
|
None.
|
||||||
|
|
||||||
|
|
||||||
|
EXAMPLES
|
||||||
|
--------
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
__apt_norecommends
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
--------
|
||||||
|
- cdist-type(7)
|
||||||
|
|
||||||
|
|
||||||
|
COPYING
|
||||||
|
-------
|
||||||
|
Copyright \(C) 2014 Steven Armstrong. Free use of this software is
|
||||||
|
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
42
cdist/conf/type/__apt_norecommends/manifest
Executable file
42
cdist/conf/type/__apt_norecommends/manifest
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2014 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
os=$(cat "$__global/explorer/os")
|
||||||
|
|
||||||
|
case "$os" in
|
||||||
|
ubuntu|debian)
|
||||||
|
# No stinking recommends thank you very much.
|
||||||
|
# If I want something installed I will do so myself.
|
||||||
|
__file /etc/apt/apt.conf.d/99-no-recommends \
|
||||||
|
--owner root --group root --mode 644 \
|
||||||
|
--source - << DONE
|
||||||
|
APT::Install-Recommends "0";
|
||||||
|
APT::Install-Suggests "0";
|
||||||
|
DONE
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
cat >&2 << DONE
|
||||||
|
The developer of this type (${__type##*/}) did not think your operating system
|
||||||
|
($os) would have any use for it. If you think otherwise please submit a patch.
|
||||||
|
DONE
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
0
cdist/conf/type/__apt_norecommends/singleton
Normal file
0
cdist/conf/type/__apt_norecommends/singleton
Normal file
|
@ -16,7 +16,8 @@ This cdist type allows manage ubuntu ppa repositories.
|
||||||
REQUIRED PARAMETERS
|
REQUIRED PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
state::
|
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
|
OPTIONAL PARAMETERS
|
||||||
|
@ -29,6 +30,8 @@ EXAMPLES
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
# Enable a ppa repository
|
# Enable a ppa repository
|
||||||
|
__apt_ppa ppa:sans-intern/missing-bits
|
||||||
|
# same as
|
||||||
__apt_ppa ppa:sans-intern/missing-bits --state present
|
__apt_ppa ppa:sans-intern/missing-bits --state present
|
||||||
|
|
||||||
# Disable a ppa repository
|
# Disable a ppa repository
|
||||||
|
@ -43,5 +46,5 @@ SEE ALSO
|
||||||
|
|
||||||
COPYING
|
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).
|
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/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.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -20,9 +20,10 @@
|
||||||
|
|
||||||
name="$__object_id"
|
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 \
|
__file /usr/local/bin/remove-apt-repository \
|
||||||
--source "$__type/files/remove-apt-repository" \
|
--source "$__type/files/remove-apt-repository" \
|
||||||
--mode 0755
|
--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
|
15
cdist/conf/type/__apt_source/files/source.list.template
Executable file
15
cdist/conf/type/__apt_source/files/source.list.template
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -u
|
||||||
|
|
||||||
|
entry="$uri $distribution $component"
|
||||||
|
cat << DONE
|
||||||
|
# Created by cdist ${__type##*/}
|
||||||
|
# Do not change. Changes will be overwritten.
|
||||||
|
#
|
||||||
|
|
||||||
|
# $name
|
||||||
|
deb ${forcedarch} $entry
|
||||||
|
DONE
|
||||||
|
if [ -f "$__object/parameter/include-src" ]; then
|
||||||
|
echo "deb-src $entry"
|
||||||
|
fi
|
69
cdist/conf/type/__apt_source/man.text
Normal file
69
cdist/conf/type/__apt_source/man.text
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
cdist-type__apt_source(7)
|
||||||
|
=========================
|
||||||
|
Steven Armstrong <steven-cdist--@--armstrong.cc>
|
||||||
|
|
||||||
|
|
||||||
|
NAME
|
||||||
|
----
|
||||||
|
cdist-type__apt_source - manage apt sources
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
-----------
|
||||||
|
This cdist type allows you to manage apt sources.
|
||||||
|
|
||||||
|
|
||||||
|
REQUIRED PARAMETERS
|
||||||
|
-------------------
|
||||||
|
uri::
|
||||||
|
the uri to the apt repository
|
||||||
|
|
||||||
|
|
||||||
|
OPTIONAL PARAMETERS
|
||||||
|
-------------------
|
||||||
|
arch::
|
||||||
|
set this if you need to force and specific arch (ubuntu specific)
|
||||||
|
|
||||||
|
state::
|
||||||
|
'present' or 'absent', defaults to 'present'
|
||||||
|
|
||||||
|
distribution::
|
||||||
|
the distribution codename to use. Defaults to DISTRIB_CODENAME from
|
||||||
|
the targets /etc/lsb-release
|
||||||
|
|
||||||
|
component::
|
||||||
|
space delimited list of components to enable. Defaults to an empty string.
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN PARAMETERS
|
||||||
|
------------------
|
||||||
|
include-src::
|
||||||
|
include deb-src entries
|
||||||
|
|
||||||
|
|
||||||
|
EXAMPLES
|
||||||
|
--------
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
__apt_source rabbitmq \
|
||||||
|
--uri http://www.rabbitmq.com/debian/ \
|
||||||
|
--distribution testing \
|
||||||
|
--component main \
|
||||||
|
--include-src \
|
||||||
|
--state present
|
||||||
|
|
||||||
|
__apt_source canonical_partner \
|
||||||
|
--uri http://archive.canonical.com/ \
|
||||||
|
--component partner --state present
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
--------
|
||||||
|
- cdist-type(7)
|
||||||
|
|
||||||
|
|
||||||
|
COPYING
|
||||||
|
-------
|
||||||
|
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).
|
56
cdist/conf/type/__apt_source/manifest
Executable file
56
cdist/conf/type/__apt_source/manifest
Executable file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2011-2013 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
name="$__object_id"
|
||||||
|
state="$(cat "$__object/parameter/state")"
|
||||||
|
uri="$(cat "$__object/parameter/uri")"
|
||||||
|
|
||||||
|
if [ -f "$__object/parameter/distribution" ]; then
|
||||||
|
distribution="$(cat "$__object/parameter/distribution")"
|
||||||
|
else
|
||||||
|
distribution="$(cat "$__global/explorer/lsb_codename")"
|
||||||
|
fi
|
||||||
|
if [ -f "$__object/parameter/component" ]; then
|
||||||
|
component="$(cat "$__object/parameter/component")"
|
||||||
|
else
|
||||||
|
component=""
|
||||||
|
fi
|
||||||
|
if [ -f "$__object/parameter/arch" ]; then
|
||||||
|
forcedarch="[arch=$(cat "$__object/parameter/arch")]"
|
||||||
|
else
|
||||||
|
forcedarch=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# export variables for use in template
|
||||||
|
export name
|
||||||
|
export uri
|
||||||
|
export distribution
|
||||||
|
export component
|
||||||
|
export forcedarch
|
||||||
|
|
||||||
|
# generate file from template
|
||||||
|
mkdir "$__object/files"
|
||||||
|
"$__type/files/source.list.template" > "$__object/files/source.list"
|
||||||
|
__file "/etc/apt/sources.list.d/${name}.list" \
|
||||||
|
--source "$__object/files/source.list" \
|
||||||
|
--owner root --group root --mode 0644 \
|
||||||
|
--state "$state"
|
||||||
|
|
||||||
|
require="$__object_name" __apt_update_index
|
1
cdist/conf/type/__apt_source/parameter/boolean
Normal file
1
cdist/conf/type/__apt_source/parameter/boolean
Normal file
|
@ -0,0 +1 @@
|
||||||
|
include-src
|
1
cdist/conf/type/__apt_source/parameter/default/state
Normal file
1
cdist/conf/type/__apt_source/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
||||||
|
present
|
4
cdist/conf/type/__apt_source/parameter/optional
Normal file
4
cdist/conf/type/__apt_source/parameter/optional
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
state
|
||||||
|
distribution
|
||||||
|
component
|
||||||
|
arch
|
1
cdist/conf/type/__apt_source/parameter/required
Normal file
1
cdist/conf/type/__apt_source/parameter/required
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uri
|
34
cdist/conf/type/__ccollect_source/explorer/cksum
Executable file
34
cdist/conf/type/__ccollect_source/explorer/cksum
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Retrieve the md5sum of a file to be created, if it is already existing.
|
||||||
|
#
|
||||||
|
|
||||||
|
destination="/$__object_id"
|
||||||
|
|
||||||
|
if [ -e "$destination" ]; then
|
||||||
|
if [ -f "$destination" ]; then
|
||||||
|
cksum < "$destination"
|
||||||
|
else
|
||||||
|
echo "NO REGULAR FILE"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "NO FILE FOUND, NO CHECKSUM CALCULATED."
|
||||||
|
fi
|
47
cdist/conf/type/__ccollect_source/explorer/stat
Executable file
47
cdist/conf/type/__ccollect_source/explorer/stat
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2013 Steven Armstrong (steven-cdist armstrong.cc)
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
destination="/$__object_id"
|
||||||
|
|
||||||
|
# nothing to work with, nothing we could do
|
||||||
|
[ -e "$destination" ] || exit 0
|
||||||
|
|
||||||
|
os=$("$__explorer/os")
|
||||||
|
case "$os" in
|
||||||
|
"freebsd")
|
||||||
|
# FIXME: should be something like this based on man page, but can not test
|
||||||
|
stat -f "type: %ST
|
||||||
|
owner: %Du %Su
|
||||||
|
group: %Dg %Sg
|
||||||
|
mode: %Op %Sp
|
||||||
|
size: %Dz
|
||||||
|
links: %Dl
|
||||||
|
" "$destination"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
stat --printf="type: %F
|
||||||
|
owner: %u %U
|
||||||
|
group: %g %G
|
||||||
|
mode: %a %A
|
||||||
|
size: %s
|
||||||
|
links: %h
|
||||||
|
" "$destination"
|
||||||
|
;;
|
||||||
|
esac
|
33
cdist/conf/type/__ccollect_source/explorer/type
Executable file
33
cdist/conf/type/__ccollect_source/explorer/type
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2013 Steven Armstrong (steven-cdist armstrong.cc)
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
destination="/$__object_id"
|
||||||
|
|
||||||
|
if [ ! -e "$destination" ]; then
|
||||||
|
echo none
|
||||||
|
elif [ -h "$destination" ]; then
|
||||||
|
echo symlink
|
||||||
|
elif [ -f "$destination" ]; then
|
||||||
|
echo file
|
||||||
|
elif [ -d "$destination" ]; then
|
||||||
|
echo directory
|
||||||
|
else
|
||||||
|
echo unknown
|
||||||
|
fi
|
93
cdist/conf/type/__ccollect_source/gencode-remote
Executable file
93
cdist/conf/type/__ccollect_source/gencode-remote
Executable file
|
@ -0,0 +1,93 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2014 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
destination="/$__object_id"
|
||||||
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
|
type="$(cat "$__object/explorer/type")"
|
||||||
|
stat_file="$__object/explorer/stat"
|
||||||
|
|
||||||
|
|
||||||
|
get_current_value() {
|
||||||
|
if [ -s "$stat_file" ]; then
|
||||||
|
_name="$1"
|
||||||
|
_value="$2"
|
||||||
|
case "$_value" in
|
||||||
|
[0-9]*)
|
||||||
|
_index=2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
_index=3
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
awk '/'"$_name"':/ { print $'$_index' }' "$stat_file"
|
||||||
|
unset _name _value _index
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_group() {
|
||||||
|
echo chgrp \"$1\" \"$destination\"
|
||||||
|
echo chgrp $1 >> "$__messages_out"
|
||||||
|
}
|
||||||
|
|
||||||
|
set_owner() {
|
||||||
|
echo chown \"$1\" \"$destination\"
|
||||||
|
echo chown $1 >> "$__messages_out"
|
||||||
|
}
|
||||||
|
|
||||||
|
set_mode() {
|
||||||
|
echo chmod \"$1\" \"$destination\"
|
||||||
|
echo chmod $1 >> "$__messages_out"
|
||||||
|
}
|
||||||
|
|
||||||
|
set_attributes=
|
||||||
|
case "$state_should" in
|
||||||
|
present|exists)
|
||||||
|
# Note: Mode - needs to happen last as a chown/chgrp can alter mode by
|
||||||
|
# clearing S_ISUID and S_ISGID bits (see chown(2))
|
||||||
|
for attribute in group owner mode; do
|
||||||
|
if [ -f "$__object/parameter/$attribute" ]; then
|
||||||
|
value_should="$(cat "$__object/parameter/$attribute")"
|
||||||
|
|
||||||
|
# change 0xxx format to xxx format => same as stat returns
|
||||||
|
if [ "$attribute" = mode ]; then
|
||||||
|
value_should="$(echo $value_should | sed 's/^0\(...\)/\1/')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
value_is="$(get_current_value "$attribute" "$value_should")"
|
||||||
|
if [ -f "$__object/files/set-attributes" -o "$value_should" != "$value_is" ]; then
|
||||||
|
"set_$attribute" "$value_should"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
absent)
|
||||||
|
if [ "$type" = "file" ]; then
|
||||||
|
echo rm -f \"$destination\"
|
||||||
|
echo remove >> "$__messages_out"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Unknown state: $state_should" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
64
cdist/conf/type/__ccollect_source/man.text
Normal file
64
cdist/conf/type/__ccollect_source/man.text
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
cdist-type__ccollect_source(7)
|
||||||
|
==============================
|
||||||
|
Nico Schottelius <nico-cdist--@--schottelius.org>
|
||||||
|
|
||||||
|
|
||||||
|
NAME
|
||||||
|
----
|
||||||
|
cdist-type__ccollect_source - Manage ccollect sources
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
-----------
|
||||||
|
This cdist type allows you to create or delete ccollect sources.
|
||||||
|
|
||||||
|
REQUIRED PARAMETERS
|
||||||
|
-------------------
|
||||||
|
source::
|
||||||
|
The source from which to backup
|
||||||
|
destination::
|
||||||
|
The destination directory
|
||||||
|
|
||||||
|
|
||||||
|
OPTIONAL PARAMETERS
|
||||||
|
-------------------
|
||||||
|
state::
|
||||||
|
'present' or 'absent', defaults to 'present'
|
||||||
|
ccollectconf::
|
||||||
|
The CCOLLECT_CONF directory. Defaults to /etc/ccollect.
|
||||||
|
|
||||||
|
|
||||||
|
OPTIONAL MULTIPLE PARAMETERS
|
||||||
|
----------------------------
|
||||||
|
exclude::
|
||||||
|
Paths to exclude of backup
|
||||||
|
|
||||||
|
BOOLEAN PARAMETERS
|
||||||
|
------------------
|
||||||
|
verbose::
|
||||||
|
Whether to report backup verbosely
|
||||||
|
|
||||||
|
EXAMPLES
|
||||||
|
--------
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
__ccollect_source doc.ungleich.ch \
|
||||||
|
--source doc.ungleich.ch:/ \
|
||||||
|
--destination /backup/doc.ungleich.ch \
|
||||||
|
--exclude '/proc/*' --exclude '/sys/*' \
|
||||||
|
--verbose
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
--------
|
||||||
|
- cdist-type(7)
|
||||||
|
- ccollect(1)
|
||||||
|
- http://www.nico.schottelius.org/software/ccollect/
|
||||||
|
|
||||||
|
|
||||||
|
COPYING
|
||||||
|
-------
|
||||||
|
Copyright \(C) 2014 Nico Schottelius. Free use of this software is
|
||||||
|
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
53
cdist/conf/type/__ccollect_source/manifest
Executable file
53
cdist/conf/type/__ccollect_source/manifest
Executable file
|
@ -0,0 +1,53 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2014 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
name="$__object_id"
|
||||||
|
state="$(cat "$__object/parameter/state")"
|
||||||
|
source="$(cat "$__object/parameter/source")"
|
||||||
|
destination="$(cat "$__object/parameter/destination")"
|
||||||
|
ccollectconf="$(cat "$__object/parameter/ccollectconf" | sed 's,/$,,')"
|
||||||
|
|
||||||
|
sourcedir="$ccollectconf/sources"
|
||||||
|
basedir="$sourcedir/$name"
|
||||||
|
|
||||||
|
destination_file="$basedir/destination"
|
||||||
|
source_file="$basedir/source"
|
||||||
|
exclude_file="$basedir/exclude"
|
||||||
|
verbose_file="$basedir/verbose"
|
||||||
|
|
||||||
|
__directory "$basedir" --state "$state"
|
||||||
|
|
||||||
|
export require="__directory$basedir"
|
||||||
|
echo "$destination" | __file "$destination_file" --source - --state "$state"
|
||||||
|
echo "$source" | __file "$source_file" --source - --state "$state"
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Booleans
|
||||||
|
if [ -f "$__object/parameter/verbose" ]; then
|
||||||
|
verbosestate="present"
|
||||||
|
else
|
||||||
|
verbosestate="absent"
|
||||||
|
fi
|
||||||
|
__file "$verbose_file" --state "$verbosestate"
|
||||||
|
|
||||||
|
if [ -f "$__object/parameter/exclude" ]; then
|
||||||
|
__file "$exclude_file" --source - --state "$state" \
|
||||||
|
< "$__object/parameter/exclude"
|
||||||
|
fi
|
1
cdist/conf/type/__ccollect_source/parameter/boolean
Normal file
1
cdist/conf/type/__ccollect_source/parameter/boolean
Normal file
|
@ -0,0 +1 @@
|
||||||
|
verbose
|
|
@ -0,0 +1 @@
|
||||||
|
/etc/ccollect
|
|
@ -0,0 +1 @@
|
||||||
|
present
|
2
cdist/conf/type/__ccollect_source/parameter/optional
Normal file
2
cdist/conf/type/__ccollect_source/parameter/optional
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
ccollectconf
|
||||||
|
state
|
|
@ -0,0 +1 @@
|
||||||
|
exclude
|
2
cdist/conf/type/__ccollect_source/parameter/required
Normal file
2
cdist/conf/type/__ccollect_source/parameter/required
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
source
|
||||||
|
destination
|
|
@ -27,23 +27,11 @@ else
|
||||||
shell=""
|
shell=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/username" ]; then
|
username="$(cat "$__object/parameter/username")"
|
||||||
username="$(cat "$__object/parameter/username")"
|
|
||||||
else
|
|
||||||
username="cdist"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$__object/parameter/branch" ]; then
|
branch="$(cat "$__object/parameter/branch")"
|
||||||
branch="$(cat "$__object/parameter/branch")"
|
|
||||||
else
|
|
||||||
branch="master"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$__object/parameter/source" ]; then
|
source="$(cat "$__object/parameter/source")"
|
||||||
source="$(cat "$__object/parameter/source")"
|
|
||||||
else
|
|
||||||
source="git://github.com/telmich/cdist.git"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Currently hardcoded - if anyone cares, make a parameter
|
# Currently hardcoded - if anyone cares, make a parameter
|
||||||
# out of it
|
# 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
|
#!/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.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -21,6 +21,12 @@
|
||||||
# Setup selections
|
# Setup selections
|
||||||
#
|
#
|
||||||
|
|
||||||
|
filename="$(cat "$__object/parameter/file")"
|
||||||
|
|
||||||
|
if [ "$filename" = "-" ]; then
|
||||||
|
filename="$__object/stdin"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "debconf-set-selections << __file-eof"
|
echo "debconf-set-selections << __file-eof"
|
||||||
cat "$(cat "$__object/parameter/file")"
|
cat "$filename"
|
||||||
echo "__file-eof"
|
echo "__file-eof"
|
||||||
|
|
|
@ -18,6 +18,7 @@ REQUIRED PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
file::
|
file::
|
||||||
Use the given filename as input for debconf-set-selections(1)
|
Use the given filename as input for debconf-set-selections(1)
|
||||||
|
If filename is "-", read from stdin.
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
|
@ -29,6 +30,10 @@ __debconf_set_selections nslcd --file /path/to/file
|
||||||
|
|
||||||
# Setup configuration for nslcd from another type
|
# Setup configuration for nslcd from another type
|
||||||
__debconf_set_selections nslcd --file "$__type/files/preseed/nslcd"
|
__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
|
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).
|
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
||||||
|
|
|
@ -23,22 +23,17 @@ state_is="$(cat "$__object/explorer/state")"
|
||||||
owner_is="$(cat "$__object/explorer/owner")"
|
owner_is="$(cat "$__object/explorer/owner")"
|
||||||
group_is="$(cat "$__object/explorer/group")"
|
group_is="$(cat "$__object/explorer/group")"
|
||||||
|
|
||||||
state_should=present
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")"
|
|
||||||
|
|
||||||
branch=master
|
branch="$(cat "$__object/parameter/branch")"
|
||||||
[ -f "$__object/parameter/branch" ] && branch="$(cat "$__object/parameter/branch")"
|
|
||||||
|
|
||||||
source="$(cat "$__object/parameter/source")"
|
source="$(cat "$__object/parameter/source")"
|
||||||
|
|
||||||
destination="/$__object_id"
|
destination="/$__object_id"
|
||||||
|
|
||||||
owner=""
|
owner="$(cat "$__object/parameter/owner")"
|
||||||
[ -f "$__object/parameter/owner" ] && owner="$(cat "$__object/parameter/owner")"
|
group="$(cat "$__object/parameter/group")"
|
||||||
group=""
|
mode="$(cat "$__object/parameter/mode")"
|
||||||
[ -f "$__object/parameter/group" ] && group="$(cat "$__object/parameter/group")"
|
|
||||||
mode=""
|
|
||||||
[ -f "$__object/parameter/mode" ] && mode="$(cat "$__object/parameter/mode")"
|
|
||||||
|
|
||||||
[ "$state_should" = "$state_is" -a \
|
[ "$state_should" = "$state_is" -a \
|
||||||
"$owner" = "$owner_is" -a \
|
"$owner" = "$owner_is" -a \
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
|
|
||||||
__package git --state present
|
__package git --state present
|
||||||
|
|
||||||
state_should=present
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")"
|
|
||||||
|
|
||||||
# Let __directory handle removal of git repos
|
# Let __directory handle removal of git repos
|
||||||
|
|
||||||
|
|
1
cdist/conf/type/__git/parameter/default/branch
Normal file
1
cdist/conf/type/__git/parameter/default/branch
Normal file
|
@ -0,0 +1 @@
|
||||||
|
master
|
1
cdist/conf/type/__git/parameter/default/group
Normal file
1
cdist/conf/type/__git/parameter/default/group
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
1
cdist/conf/type/__git/parameter/default/mode
Normal file
1
cdist/conf/type/__git/parameter/default/mode
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
1
cdist/conf/type/__git/parameter/default/owner
Normal file
1
cdist/conf/type/__git/parameter/default/owner
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
1
cdist/conf/type/__git/parameter/default/state
Normal file
1
cdist/conf/type/__git/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
||||||
|
present
|
|
@ -22,17 +22,9 @@
|
||||||
# virtual machines.
|
# virtual machines.
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ -f "$__object/parameter/jaildir" ]; then
|
jaildir="$(cat "$__object/parameter/jaildir")"
|
||||||
jaildir="$(cat "$__object/parameter/name")"
|
|
||||||
else
|
|
||||||
jaildir="/usr/jail"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$__object/parameter/jailbase" ]; then
|
jailbase="$(cat "$__object/parameter/jailbase")"
|
||||||
jailbase="$(cat "$__object/parameter/jailbase")"
|
|
||||||
else
|
|
||||||
jailbase=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
state="$(cat "$__object/parameter/state")"
|
state="$(cat "$__object/parameter/state")"
|
||||||
|
|
||||||
|
|
|
@ -66,11 +66,7 @@ else
|
||||||
devfsenable="true"
|
devfsenable="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/devfs-ruleset" ]; then
|
devfsruleset="$(cat "$__object/parameter/devfs-ruleset")"
|
||||||
devfsruleset="$(cat "$__object/parameter/devfs-ruleset")"
|
|
||||||
else
|
|
||||||
devfsruleset="jailrules"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# devfs_ruleset being defined without devfs_enable being true
|
# devfs_ruleset being defined without devfs_enable being true
|
||||||
# is pointless. Treat this as an error.
|
# is pointless. Treat this as an error.
|
||||||
|
@ -84,14 +80,11 @@ if [ -f "$__object/parameter/onboot" ]; then
|
||||||
onboot="true"
|
onboot="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/jaildir" ]; then
|
jaildir="$(cat "$__object/parameter/jaildir")"
|
||||||
jaildir="$(cat "$__object/parameter/name")"
|
|
||||||
else
|
|
||||||
jaildir="/usr/jail"
|
|
||||||
fi
|
|
||||||
|
|
||||||
present="$(cat "$__object/explorer/present")"
|
present="$(cat "$__object/explorer/present")"
|
||||||
status="$(cat "$__object/explorer/status")"
|
status="$(cat "$__object/explorer/status")"
|
||||||
|
|
||||||
# Handle ip="iface|addr, iface|addr" format
|
# Handle ip="iface|addr, iface|addr" format
|
||||||
if [ $(expr "${ip}" : ".*|.*") -gt "0" ]; then
|
if [ $(expr "${ip}" : ".*|.*") -gt "0" ]; then
|
||||||
# If we have multiple IPs defined, $interface doesn't make sense because ip="iface|addr, iface|addr" implies it
|
# If we have multiple IPs defined, $interface doesn't make sense because ip="iface|addr, iface|addr" implies it
|
||||||
|
|
|
@ -33,11 +33,7 @@ if [ ! "$os" = "freebsd" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/jaildir" ]; then
|
jaildir="$(cat "$__object/parameter/jaildir")"
|
||||||
jaildir="$(cat "$__object/parameter/name")"
|
|
||||||
else
|
|
||||||
jaildir="/usr/jail"
|
|
||||||
fi
|
|
||||||
|
|
||||||
__directory ${jaildir} --parents
|
__directory ${jaildir} --parents
|
||||||
|
|
||||||
|
|
1
cdist/conf/type/__jail/parameter/default/devfs-ruleset
Normal file
1
cdist/conf/type/__jail/parameter/default/devfs-ruleset
Normal file
|
@ -0,0 +1 @@
|
||||||
|
jailrules
|
1
cdist/conf/type/__jail/parameter/default/jailbase
Normal file
1
cdist/conf/type/__jail/parameter/default/jailbase
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
1
cdist/conf/type/__jail/parameter/default/jaildir
Normal file
1
cdist/conf/type/__jail/parameter/default/jaildir
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/usr/jail
|
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
key="$__object_id"
|
key="$__object_id"
|
||||||
[ -f "$__object/parameter/key" ] && key="$(cat "$__object/parameter/key")"
|
[ -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")"
|
file="$(cat "$__object/parameter/file")"
|
||||||
delimiter="$(cat "$__object/parameter/delimiter")"
|
delimiter="$(cat "$__object/parameter/delimiter")"
|
||||||
|
|
|
@ -19,8 +19,7 @@
|
||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
state_should=present
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")"
|
|
||||||
|
|
||||||
if [ "$state_should" = "present" -a ! -f "$__object/parameter/value" ]; then
|
if [ "$state_should" = "present" -a ! -f "$__object/parameter/value" ]; then
|
||||||
echo "Missing required parameter 'value'" >&2
|
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
|
|
@ -27,11 +27,7 @@ else
|
||||||
name="$__object_id"
|
name="$__object_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/state" ]; then
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
state_should="$(cat "$__object/parameter/state")"
|
|
||||||
else
|
|
||||||
state_should="present"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep -q -E "(centos|redhat|amazon)" "$__global/explorer/os"; then
|
if grep -q -E "(centos|redhat|amazon)" "$__global/explorer/os"; then
|
||||||
opts="-y --quiet"
|
opts="-y --quiet"
|
||||||
|
|
1
cdist/conf/type/__package_yum/parameter/default/state
Normal file
1
cdist/conf/type/__package_yum/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
||||||
|
present
|
|
@ -34,17 +34,8 @@ else
|
||||||
name="$__object_id"
|
name="$__object_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/state" ]; then
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
state_should="$(cat "$__object/parameter/state")"
|
ptype="$(cat "$__object/parameter/ptype")"
|
||||||
else
|
|
||||||
state_should="present"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$__object/parameter/ptype" ]; then
|
|
||||||
ptype="$(cat "$__object/parameter/ptype")"
|
|
||||||
else
|
|
||||||
ptype="package"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$__object/parameter/version" ]; then
|
if [ -f "$__object/parameter/version" ]; then
|
||||||
version_should="$(cat "$__object/parameter/version")"
|
version_should="$(cat "$__object/parameter/version")"
|
||||||
|
|
1
cdist/conf/type/__package_zypper/parameter/default/state
Normal file
1
cdist/conf/type/__package_zypper/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
||||||
|
present
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org)
|
# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
|
# 2014 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -17,7 +18,6 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
|
|
||||||
if [ -f "$__object/parameter/name" ]; then
|
if [ -f "$__object/parameter/name" ]; then
|
||||||
name="$(cat "$__object/parameter/name")"
|
name="$(cat "$__object/parameter/name")"
|
||||||
|
@ -25,21 +25,18 @@ else
|
||||||
name="$__object_id"
|
name="$__object_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
parameter_state="$__object/parameter/state"
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
if [ -f "$_parameter_state" ]; then
|
|
||||||
state_should=$(cat "$__object/parameter/state")
|
|
||||||
else
|
|
||||||
state_should="present"
|
|
||||||
fi
|
|
||||||
|
|
||||||
runs="$(cat "$__object/explorer/runs")"
|
if [ -s "$__object/explorer/runs" ]; then
|
||||||
if [ "$runs" ]; then
|
|
||||||
state_is="present"
|
state_is="present"
|
||||||
else
|
else
|
||||||
state_is="absent"
|
state_is="absent"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ "$state_is" = "$state_should" ] && exit 0
|
if [ "$state_is" = "$state_should" ]; then
|
||||||
|
# nothing to do
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
|
|
1
cdist/conf/type/__process/parameter/default/state
Normal file
1
cdist/conf/type/__process/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
|
# State: absent is handled by manifest - we need only to do stuff if image is
|
||||||
# not existing and state != absent
|
# not existing and state != absent
|
||||||
#
|
#
|
||||||
state="present"
|
state="$(cat "$__object/parameter/state")"
|
||||||
[ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")"
|
|
||||||
[ "$state" = "absent" ] && exit 0
|
[ "$state" = "absent" ] && exit 0
|
||||||
|
|
||||||
exists="$(cat "$__object/explorer/exists")"
|
exists="$(cat "$__object/explorer/exists")"
|
||||||
|
@ -13,8 +12,7 @@ exists="$(cat "$__object/explorer/exists")"
|
||||||
# Still there? Create image
|
# Still there? Create image
|
||||||
#
|
#
|
||||||
|
|
||||||
format=qcow2
|
format="$(cat "$__object/parameter/format")"
|
||||||
[ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")"
|
|
||||||
size="$(cat "$__object/parameter/size")"
|
size="$(cat "$__object/parameter/size")"
|
||||||
diskimage="/$__object_id"
|
diskimage="/$__object_id"
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
# Default settings
|
# Default settings
|
||||||
#
|
#
|
||||||
|
|
||||||
format=qcow2
|
format="$(cat "$__object/parameter/format")"
|
||||||
state=present
|
state="$(cat "$__object/parameter/state")"
|
||||||
[ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")"
|
|
||||||
[ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")"
|
|
||||||
|
|
||||||
diskimage="/$__object_id"
|
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
|
format
|
||||||
|
state
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")"
|
user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")"
|
||||||
state_should="$(cat "$__object/parameter/state" 2>/dev/null || echo "present")"
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
|
|
||||||
mkdir "$__object/files"
|
mkdir "$__object/files"
|
||||||
# file has to be sorted for comparison with `comm`
|
# file has to be sorted for comparison with `comm`
|
||||||
|
|
1
cdist/conf/type/__user_groups/parameter/default/state
Normal file
1
cdist/conf/type/__user_groups/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
||||||
|
present
|
|
@ -45,11 +45,7 @@ else
|
||||||
id="$__object_id"
|
id="$__object_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/state" ]; then
|
state="$(cat "$__object/parameter/state")"
|
||||||
state="$(cat "$__object/parameter/state")"
|
|
||||||
else
|
|
||||||
state="present"
|
|
||||||
fi
|
|
||||||
|
|
||||||
repo_id="$(cat "$__object/explorer/repo_id")"
|
repo_id="$(cat "$__object/explorer/repo_id")"
|
||||||
|
|
||||||
|
|
|
@ -39,17 +39,8 @@ else
|
||||||
uri="$__object_id"
|
uri="$__object_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/state" ]; then
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
state_should="$(cat "$__object/parameter/state")"
|
stype="$(cat "$__object/parameter/type")"
|
||||||
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_uri="$(cat "$__object/explorer/service_uri")"
|
||||||
exp_id="$(cat "$__object/explorer/service_id")"
|
exp_id="$(cat "$__object/explorer/service_id")"
|
||||||
|
|
|
@ -33,11 +33,7 @@ else
|
||||||
uri="$__object_id"
|
uri="$__object_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/state" ]; then
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
state_should="$(cat "$__object/parameter/state")"
|
|
||||||
else
|
|
||||||
state_should="present"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exp_uri="$(cat "$__object/explorer/service_uri")"
|
exp_uri="$(cat "$__object/explorer/service_uri")"
|
||||||
|
|
||||||
|
|
|
@ -163,8 +163,12 @@ class Config(object):
|
||||||
"""Short name for object list retrieval"""
|
"""Short name for object list retrieval"""
|
||||||
for cdist_object in core.CdistObject.list_objects(self.local.object_path,
|
for cdist_object in core.CdistObject.list_objects(self.local.object_path,
|
||||||
self.local.type_path):
|
self.local.type_path):
|
||||||
|
if cdist_object.cdist_type.is_install:
|
||||||
|
self.log.debug("Running in config mode, ignoring install object: {0}".format(cdist_object))
|
||||||
|
else:
|
||||||
yield cdist_object
|
yield cdist_object
|
||||||
|
|
||||||
|
|
||||||
def iterate_once(self):
|
def iterate_once(self):
|
||||||
"""
|
"""
|
||||||
Iterate over the objects once - helper method for
|
Iterate over the objects once - helper method for
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#
|
#
|
||||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
# 2011-2013 Nico Schottelius (nico-cdist at schottelius.org)
|
# 2011-2013 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
|
# 2014 Daniel Heule (hda at sfs.biz)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -211,13 +212,13 @@ class CdistObject(object):
|
||||||
"""Checks wether this cdist object exists on the file systems."""
|
"""Checks wether this cdist object exists on the file systems."""
|
||||||
return os.path.exists(self.absolute_path)
|
return os.path.exists(self.absolute_path)
|
||||||
|
|
||||||
def create(self):
|
def create(self, allow_overwrite=False):
|
||||||
"""Create this cdist object on the filesystem.
|
"""Create this cdist object on the filesystem.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
os.makedirs(self.absolute_path, exist_ok=False)
|
os.makedirs(self.absolute_path, exist_ok=allow_overwrite)
|
||||||
absolute_parameter_path = os.path.join(self.base_path, self.parameter_path)
|
absolute_parameter_path = os.path.join(self.base_path, self.parameter_path)
|
||||||
os.makedirs(absolute_parameter_path, exist_ok=False)
|
os.makedirs(absolute_parameter_path, exist_ok=allow_overwrite)
|
||||||
except EnvironmentError as error:
|
except EnvironmentError as error:
|
||||||
raise cdist.Error('Error creating directories for cdist object: %s: %s' % (self, error))
|
raise cdist.Error('Error creating directories for cdist object: %s: %s' % (self, error))
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,11 @@ class CdistType(object):
|
||||||
"""Check whether a type is a singleton."""
|
"""Check whether a type is a singleton."""
|
||||||
return os.path.isfile(os.path.join(self.absolute_path, "singleton"))
|
return os.path.isfile(os.path.join(self.absolute_path, "singleton"))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_install(self):
|
||||||
|
"""Check whether a type is used for installation (if not: for configuration)"""
|
||||||
|
return os.path.isfile(os.path.join(self.absolute_path, "install"))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def explorers(self):
|
def explorers(self):
|
||||||
"""Return a list of available explorers"""
|
"""Return a list of available explorers"""
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#
|
#
|
||||||
# 2011-2013 Nico Schottelius (nico-cdist at schottelius.org)
|
# 2011-2013 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
# 2012 Steven Armstrong (steven-cdist at armstrong.cc)
|
# 2012 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
# 2014 Daniel Heule (hda at sfs.biz)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -71,6 +72,7 @@ class Emulator(object):
|
||||||
raise MissingRequiredEnvironmentVariableError(e.args[0])
|
raise MissingRequiredEnvironmentVariableError(e.args[0])
|
||||||
|
|
||||||
self.object_base_path = os.path.join(self.global_path, "object")
|
self.object_base_path = os.path.join(self.global_path, "object")
|
||||||
|
self.typeorder_path = os.path.join(self.global_path, "typeorder")
|
||||||
|
|
||||||
self.type_name = os.path.basename(argv[0])
|
self.type_name = os.path.basename(argv[0])
|
||||||
self.cdist_type = core.CdistType(self.type_base_path, self.type_name)
|
self.cdist_type = core.CdistType(self.type_base_path, self.type_name)
|
||||||
|
@ -128,7 +130,6 @@ class Emulator(object):
|
||||||
self.args = parser.parse_args(self.argv[1:])
|
self.args = parser.parse_args(self.argv[1:])
|
||||||
self.log.debug('Args: %s' % self.args)
|
self.log.debug('Args: %s' % self.args)
|
||||||
|
|
||||||
|
|
||||||
def setup_object(self):
|
def setup_object(self):
|
||||||
# Setup object_id - FIXME: unset / do not setup anymore!
|
# Setup object_id - FIXME: unset / do not setup anymore!
|
||||||
if not self.cdist_type.is_singleton:
|
if not self.cdist_type.is_singleton:
|
||||||
|
@ -144,14 +145,21 @@ class Emulator(object):
|
||||||
if value is not None:
|
if value is not None:
|
||||||
self.parameters[key] = value
|
self.parameters[key] = value
|
||||||
|
|
||||||
if self.cdist_object.exists:
|
if self.cdist_object.exists and not 'CDIST_OVERRIDE' in self.env:
|
||||||
if self.cdist_object.parameters != self.parameters:
|
if self.cdist_object.parameters != self.parameters:
|
||||||
raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s"
|
raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s"
|
||||||
% (self.cdist_object.name, " ".join(self.cdist_object.source), self.cdist_object.parameters, self.object_source, self.parameters)
|
% (self.cdist_object.name, " ".join(self.cdist_object.source), self.cdist_object.parameters, self.object_source, self.parameters)
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
if self.cdist_object.exists:
|
||||||
|
self.log.debug('Object %s override forced with CDIST_OVERRIDE',self.cdist_object.name)
|
||||||
|
self.cdist_object.create(True)
|
||||||
else:
|
else:
|
||||||
self.cdist_object.create()
|
self.cdist_object.create()
|
||||||
self.cdist_object.parameters = self.parameters
|
self.cdist_object.parameters = self.parameters
|
||||||
|
# record the created object in typeorder file
|
||||||
|
with open(self.typeorder_path, 'a') as typeorderfile:
|
||||||
|
print(self.cdist_object.name, file=typeorderfile)
|
||||||
|
|
||||||
# Record / Append source
|
# Record / Append source
|
||||||
self.cdist_object.source.append(self.object_source)
|
self.cdist_object.source.append(self.object_source)
|
||||||
|
@ -181,6 +189,23 @@ class Emulator(object):
|
||||||
def record_requirements(self):
|
def record_requirements(self):
|
||||||
"""record requirements"""
|
"""record requirements"""
|
||||||
|
|
||||||
|
if "CDIST_ORDER_DEPENDENCY" in self.env:
|
||||||
|
# load object name created bevor this one from typeorder file ...
|
||||||
|
with open(self.typeorder_path, 'r') as typecreationfile:
|
||||||
|
typecreationorder = typecreationfile.readlines()
|
||||||
|
# get the type created bevore this one ...
|
||||||
|
try:
|
||||||
|
lastcreatedtype = typecreationorder[-2].strip()
|
||||||
|
if 'require' in self.env:
|
||||||
|
self.env['require'] += " " + lastcreatedtype
|
||||||
|
else:
|
||||||
|
self.env['require'] = lastcreatedtype
|
||||||
|
self.log.debug("Injecting require for CDIST_ORDER_DEPENDENCY: %s for %s", lastcreatedtype, self.cdist_object.name)
|
||||||
|
except IndexError:
|
||||||
|
# if no second last line, we are on the first type, so do not set a requirement
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if "require" in self.env:
|
if "require" in self.env:
|
||||||
requirements = self.env['require']
|
requirements = self.env['require']
|
||||||
self.log.debug("reqs = " + requirements)
|
self.log.debug("reqs = " + requirements)
|
||||||
|
@ -198,7 +223,7 @@ class Emulator(object):
|
||||||
self.log.error("%s requires object %s without object id. Defined at %s" % (self.cdist_object.name, requirement, self.object_source))
|
self.log.error("%s requires object %s without object id. Defined at %s" % (self.cdist_object.name, requirement, self.object_source))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
self.log.debug("Recording requirement: " + requirement)
|
self.log.debug("Recording requirement: %s", requirement)
|
||||||
|
|
||||||
# Save the sanitised version, not the user supplied one
|
# Save the sanitised version, not the user supplied one
|
||||||
# (__file//bar => __file/bar)
|
# (__file//bar => __file/bar)
|
||||||
|
|
|
@ -58,10 +58,10 @@ class ObjectClassTestCase(test.CdistTestCase):
|
||||||
|
|
||||||
def test_list_type_names(self):
|
def test_list_type_names(self):
|
||||||
type_names = list(cdist.core.CdistObject.list_type_names(object_base_path))
|
type_names = list(cdist.core.CdistObject.list_type_names(object_base_path))
|
||||||
self.assertEqual(type_names, ['__first', '__second', '__third'])
|
self.assertEqual(sorted(type_names), ['__first', '__second', '__third'])
|
||||||
|
|
||||||
def test_list_objects(self):
|
def test_list_objects(self):
|
||||||
found_objects = list(core.CdistObject.list_objects(object_base_path, type_base_path))
|
found_objects = sorted(list(core.CdistObject.list_objects(object_base_path, type_base_path)))
|
||||||
self.assertEqual(found_objects, self.expected_objects)
|
self.assertEqual(found_objects, self.expected_objects)
|
||||||
|
|
||||||
def test_create_singleton(self):
|
def test_create_singleton(self):
|
||||||
|
|
|
@ -34,7 +34,7 @@ class TypeTestCase(test.CdistTestCase):
|
||||||
def test_list_type_names(self):
|
def test_list_type_names(self):
|
||||||
base_path = op.join(fixtures, 'list_types')
|
base_path = op.join(fixtures, 'list_types')
|
||||||
type_names = core.CdistType.list_type_names(base_path)
|
type_names = core.CdistType.list_type_names(base_path)
|
||||||
self.assertEqual(type_names, ['__first', '__second', '__third'])
|
self.assertEqual(sorted(type_names), ['__first', '__second', '__third'])
|
||||||
|
|
||||||
def test_list_types(self):
|
def test_list_types(self):
|
||||||
base_path = op.join(fixtures, 'list_types')
|
base_path = op.join(fixtures, 'list_types')
|
||||||
|
@ -44,7 +44,7 @@ class TypeTestCase(test.CdistTestCase):
|
||||||
core.CdistType(base_path, '__second'),
|
core.CdistType(base_path, '__second'),
|
||||||
core.CdistType(base_path, '__third'),
|
core.CdistType(base_path, '__third'),
|
||||||
]
|
]
|
||||||
self.assertEqual(types, types_expected)
|
self.assertEqual(sorted(types), types_expected)
|
||||||
|
|
||||||
def test_only_one_instance(self):
|
def test_only_one_instance(self):
|
||||||
base_path = fixtures
|
base_path = fixtures
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#
|
#
|
||||||
# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
# 2012-2013 Nico Schottelius (nico-cdist at schottelius.org)
|
# 2012-2013 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
|
# 2014 Daniel Heule (hda at sfs.biz)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -129,6 +130,44 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase):
|
||||||
expected = ['__planet/Saturn', '__moon/Prometheus']
|
expected = ['__planet/Saturn', '__moon/Prometheus']
|
||||||
self.assertEqual(sorted(cdist_object.autorequire), sorted(expected))
|
self.assertEqual(sorted(cdist_object.autorequire), sorted(expected))
|
||||||
|
|
||||||
|
class OverrideTestCase(test.CdistTestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.temp_dir = self.mkdtemp()
|
||||||
|
handle, self.script = self.mkstemp(dir=self.temp_dir)
|
||||||
|
os.close(handle)
|
||||||
|
base_path = self.temp_dir
|
||||||
|
|
||||||
|
self.local = local.Local(
|
||||||
|
target_host=self.target_host,
|
||||||
|
base_path=base_path,
|
||||||
|
exec_path=test.cdist_exec_path,
|
||||||
|
add_conf_dirs=[conf_dir])
|
||||||
|
self.local.create_files_dirs()
|
||||||
|
|
||||||
|
self.manifest = core.Manifest(self.target_host, self.local)
|
||||||
|
self.env = self.manifest.env_initial_manifest(self.script)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
shutil.rmtree(self.temp_dir)
|
||||||
|
|
||||||
|
def test_override_negative(self):
|
||||||
|
argv = ['__file', '/tmp/foobar']
|
||||||
|
emu = emulator.Emulator(argv, env=self.env)
|
||||||
|
emu.run()
|
||||||
|
argv = ['__file', '/tmp/foobar','--mode','404']
|
||||||
|
emu = emulator.Emulator(argv, env=self.env)
|
||||||
|
self.assertRaises(cdist.Error, emu.run)
|
||||||
|
|
||||||
|
def test_override_feature(self):
|
||||||
|
argv = ['__file', '/tmp/foobar']
|
||||||
|
emu = emulator.Emulator(argv, env=self.env)
|
||||||
|
emu.run()
|
||||||
|
argv = ['__file', '/tmp/foobar','--mode','404']
|
||||||
|
self.env['CDIST_OVERRIDE'] = 'on'
|
||||||
|
emu = emulator.Emulator(argv, env=self.env)
|
||||||
|
emu.run()
|
||||||
|
|
||||||
|
|
||||||
class ArgumentsTestCase(test.CdistTestCase):
|
class ArgumentsTestCase(test.CdistTestCase):
|
||||||
|
|
||||||
|
@ -182,7 +221,7 @@ class ArgumentsTestCase(test.CdistTestCase):
|
||||||
object_id = 'some-id'
|
object_id = 'some-id'
|
||||||
value = 'some value'
|
value = 'some value'
|
||||||
argv = [type_name, object_id, '--required1', value, '--required2', value]
|
argv = [type_name, object_id, '--required1', value, '--required2', value]
|
||||||
print(self.env)
|
# print(self.env)
|
||||||
os.environ.update(self.env)
|
os.environ.update(self.env)
|
||||||
emu = emulator.Emulator(argv)
|
emu = emulator.Emulator(argv)
|
||||||
emu.run()
|
emu.run()
|
||||||
|
|
|
@ -4,12 +4,47 @@ Changelog
|
||||||
* Changes are always commented with their author in (braces)
|
* Changes are always commented with their author in (braces)
|
||||||
* Exception: No braces means author == Nico Schottelius
|
* Exception: No braces means author == Nico Schottelius
|
||||||
|
|
||||||
3.0.3:
|
|
||||||
|
3.0.7: 2014-02-08
|
||||||
|
* Core: Allow dependencies to be created based execution order (Daniel Heule)
|
||||||
|
* Core: Add tests for override (Daniel Heule)
|
||||||
|
|
||||||
|
3.0.6: 2014-02-06
|
||||||
|
* New Type: __apt_key (Steven Armstrong)
|
||||||
|
* New Type: __apt_key_uri (Steven Armstrong)
|
||||||
|
* New Type: __apt_norecommends (Steven Armstrong)
|
||||||
|
* New Type: __apt_source (Steven Armstrong)
|
||||||
|
* New Type: __ccollect_source
|
||||||
|
* Type __git: Use default parameters (Daniel Heule)
|
||||||
|
* Type __jail: Use default parameters (Daniel Heule)
|
||||||
|
* Type __package_yum: Use default parameters (Daniel Heule)
|
||||||
|
* Type __package_zypper: Use default parameters (Daniel Heule)
|
||||||
|
* Type __user_groups: Use default parameters (Daniel Heule)
|
||||||
|
|
||||||
|
3.0.5: 2014-02-05
|
||||||
|
* Core: Introduce override concept (Daniel Heule)
|
||||||
|
* Type __process: Make --state absent work (Steven Armstrong)
|
||||||
|
* Documentation: Update documentation for environment variables
|
||||||
|
|
||||||
|
3.0.4: 2014-01-29
|
||||||
|
* Core: Ignore install types in config mode
|
||||||
|
* Documentation: Update reference (files path in object space)
|
||||||
|
* Documentation: Update best practise: Replaces templates/ with files/
|
||||||
|
* 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: Enhance error message when requirement is missing object id
|
||||||
* Core: Add environment variable to select shell for executing scripts (Daniel Heule)
|
* Core: Add environment variable to select shell for executing scripts (Daniel Heule)
|
||||||
* Explorer hostname: Return host name by using uname -n
|
* Explorer hostname: Return host name by using uname -n
|
||||||
* New Type: __hostname (Steven Armstrong)
|
* 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 __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
|
3.0.2: 2014-01-19
|
||||||
* Documentation: Document all messages sent by types (Daniel Heule)
|
* Documentation: Document all messages sent by types (Daniel Heule)
|
||||||
|
@ -18,7 +53,6 @@ Changelog
|
||||||
* Type __cron: Replace existing entry when changing it (Daniel Heule)
|
* Type __cron: Replace existing entry when changing it (Daniel Heule)
|
||||||
* Type __ssh_authorized_keys: Use new type __block (Steven Armstrong)
|
* Type __ssh_authorized_keys: Use new type __block (Steven Armstrong)
|
||||||
|
|
||||||
|
|
||||||
3.0.1: 2014-01-14
|
3.0.1: 2014-01-14
|
||||||
* Core: Copy only files, not directories (Steven Armstrong)
|
* Core: Copy only files, not directories (Steven Armstrong)
|
||||||
* Core: Allow hostnames to start with /
|
* Core: Allow hostnames to start with /
|
||||||
|
|
|
@ -131,7 +131,8 @@ confdir/type/<name>/explorer::
|
||||||
|
|
||||||
confdir/type/<name>/files::
|
confdir/type/<name>/files::
|
||||||
This directory is reserved for user data and will not be used
|
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/::
|
out/::
|
||||||
This directory contains output of cdist and is usually located
|
This directory contains output of cdist and is usually located
|
||||||
|
@ -175,13 +176,22 @@ OBJECTS
|
||||||
For object to object communication and tests, the following paths are
|
For object to object communication and tests, the following paths are
|
||||||
usable within a object directory:
|
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::
|
changed::
|
||||||
This empty file exists in an object directory, if the object has
|
This empty file exists in an object directory, if the object has
|
||||||
code to be excuted (either remote or local)
|
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
|
ENVIRONMENT VARIABLES (FOR READING)
|
||||||
---------------------
|
-----------------------------------
|
||||||
|
The following environment variables are exported by cdist:
|
||||||
|
|
||||||
__explorer::
|
__explorer::
|
||||||
Directory that contains all global explorers.
|
Directory that contains all global explorers.
|
||||||
Available for: initial manifest, explorer, type explorer, shell
|
Available for: initial manifest, explorer, type explorer, shell
|
||||||
|
@ -219,6 +229,18 @@ __type_explorer::
|
||||||
Directory that contains the type explorers.
|
Directory that contains the type explorers.
|
||||||
Available for: type explorer
|
Available for: type explorer
|
||||||
|
|
||||||
|
ENVIRONMENT VARIABLES (FOR WRITING)
|
||||||
|
-----------------------------------
|
||||||
|
The following environment variables influence the behaviour of cdist:
|
||||||
|
|
||||||
|
require::
|
||||||
|
Setup dependencies between objects (see cdist-manifest(7))
|
||||||
|
|
||||||
|
CDIST_ALLOW_OVERRIDE::
|
||||||
|
Allow overwriting type parameters (see cdist-manifest(7))
|
||||||
|
|
||||||
|
CDIST_ORDER_DEPENDENCY::
|
||||||
|
Create dependencies based on the execution order (see cdist-manifest(7))
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
--------
|
--------
|
||||||
|
@ -227,6 +249,6 @@ SEE ALSO
|
||||||
|
|
||||||
COPYING
|
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).
|
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
||||||
eof
|
eof
|
||||||
|
|
|
@ -164,8 +164,8 @@ For more details consult sudoers(5)
|
||||||
|
|
||||||
TEMPLATING
|
TEMPLATING
|
||||||
----------
|
----------
|
||||||
* create directory templates/ in your type (convention)
|
* create directory files/ 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 the template as an executable file like files/basic.conf.sh, it will output text using shell variables for the values
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
@ -191,7 +191,7 @@ EOF
|
||||||
export ROOT='/var/www/test'
|
export ROOT='/var/www/test'
|
||||||
# render the template
|
# render the template
|
||||||
mkdir -p "$__object/files"
|
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
|
# send the rendered template
|
||||||
__file /etc/nginx/sites-available/test.conf \
|
__file /etc/nginx/sites-available/test.conf \
|
||||||
--state present
|
--state present
|
||||||
|
|
|
@ -128,6 +128,34 @@ All objects that are created in a type manifest are automatically required
|
||||||
from the type that is calling them. This is called "autorequirement" in
|
from the type that is calling them. This is called "autorequirement" in
|
||||||
cdist jargon.
|
cdist jargon.
|
||||||
|
|
||||||
|
CREATE DEPENDENCIES FROM EXECUTION ORDER
|
||||||
|
-----------------------------------------
|
||||||
|
You can tell cdist to execute all types in the order in which they are created
|
||||||
|
in the manifest by setting up the variable CDIST_ORDER_DEPENDENCY.
|
||||||
|
When cdist sees that this variable is setup, the current created object
|
||||||
|
automatically depends on the previously created object.
|
||||||
|
|
||||||
|
It essentially helps you to build up blocks of code that build upon each other
|
||||||
|
(like first creating the directory xyz than the file below the directory).
|
||||||
|
|
||||||
|
THIS IS A BETA FEATURE AND MAY BE REMOVED OR CHANGED AT ANY TIME.
|
||||||
|
|
||||||
|
|
||||||
|
OVERRIDES
|
||||||
|
---------
|
||||||
|
In some special cases, you would like to create an already defined object
|
||||||
|
with different parameters. In normal situations this leads to an error in cdist.
|
||||||
|
If you whish, you can setup the environment variable CDIST_OVERRIDE
|
||||||
|
(any value or even empty is ok) to tell cdist, that this object override is
|
||||||
|
wanted and should be accepted.
|
||||||
|
ATTENTION: Only use this feature if you are 100% sure in which order
|
||||||
|
cdist encounter the affected objects, otherwhise this results
|
||||||
|
into an undefined situation.
|
||||||
|
|
||||||
|
THIS IS A BETA FEATURE AND MAY BE REMOVED OR CHANGED AT ANY TIME.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
--------
|
--------
|
||||||
|
@ -161,6 +189,50 @@ __package lighttpd --state present
|
||||||
require="__package/lighttpd" __package munin --state present
|
require="__package/lighttpd" __package munin --state present
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
How to override objects:
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
# for example in the inital manifest
|
||||||
|
|
||||||
|
# reate user account foobar with some hash for password
|
||||||
|
__user foobar --password 'some_fancy_hash' --home /home/foobarexample
|
||||||
|
|
||||||
|
# ... many statements and includes in the manifest later ...
|
||||||
|
# somewhere in a conditionaly sourced manifest
|
||||||
|
# (e.g. for example only sourced if a special application is on the target host)
|
||||||
|
|
||||||
|
# this leads to an error ...
|
||||||
|
__user foobar --password 'some_other_hash'
|
||||||
|
|
||||||
|
# this tells cdist, that you know that this is an override and should be accepted
|
||||||
|
CDIST_OVERRIDE=yes __user foobar --password 'some_other_hash'
|
||||||
|
# its only an override, means the parameter --home is not touched
|
||||||
|
# and stay at the original value of /home/foobarexample
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Dependencies defined by execution order work as following:
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Tells cdist to execute all types in the order in which they are created ...
|
||||||
|
export CDIST_ORDER_DEPENDENCY=on
|
||||||
|
__sample_type 1
|
||||||
|
require="__some_type_somewhere/id" __sample_type 2
|
||||||
|
__example_type 23
|
||||||
|
# Now this types are executed in the creation order until the variable is unset
|
||||||
|
unset CDIST_ORDER_DEPENDENCY
|
||||||
|
# all now following types cdist makes the order ..
|
||||||
|
__not_in_order_type 42
|
||||||
|
|
||||||
|
# how it works :
|
||||||
|
# this lines above are translated to:
|
||||||
|
__sample_type 1
|
||||||
|
require="__some_type_somewhere/id __sample_type/1" __sample_type 2
|
||||||
|
require="__sample_type/2" __example_type 23
|
||||||
|
__not_in_order_type 42
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
|
@ -171,5 +243,5 @@ SEE ALSO
|
||||||
|
|
||||||
COPYING
|
COPYING
|
||||||
-------
|
-------
|
||||||
Copyright \(C) 2010-2012 Nico Schottelius. Free use of this software is
|
Copyright \(C) 2010-2014 Nico Schottelius. Free use of this software is
|
||||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
||||||
|
|
|
@ -20,6 +20,6 @@ you can join the
|
||||||
### Commercial support
|
### Commercial support
|
||||||
|
|
||||||
You can request commercial support for cdist from
|
You can request commercial support for cdist from
|
||||||
[my company](http://firma.schottelius.org/english/).
|
[my company](http://www.ungleich.ch/english/).
|
||||||
|
|
||||||
[[!tag cdist unix]]
|
[[!tag cdist unix]]
|
||||||
|
|
Loading…
Reference in a new issue