Merge branch 'master' of https://github.com/telmich/cdist into feature__cdist_autodep_try2

Conflicts:
	docs/man/man7/cdist-manifest.text
This commit is contained in:
Daniel Heule 2014-02-06 15:10:34 +01:00
commit 2b5929c881
91 changed files with 1305 additions and 233 deletions

View file

@ -4,11 +4,48 @@ Changelog
* Changes are always commented with their author in (braces)
* Exception: No braces means author == Nico Schottelius
3.0.2:
3.0.6:
* 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)
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: 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)
* New Type: __block (Steven Armstrong)
* New Type: __mount (Steven Armstrong)
* Type __cron: Replace existing entry when changing it (Daniel Heule)
* Type __ssh_authorized_keys: Use new type __block (Steven Armstrong)
3.0.1: 2014-01-14

View file

@ -0,0 +1,44 @@
raw quote from irc
16:00 < sar> telmich: btw, ich denke nicht dass man install schon zu gross bewerben
sollte
16:00 < telmich> sar: ack
16:00 < sar> telmich: imho sollten wir erst die cdist environments implementieren,
install waere dann eines davon
16:00 < sar> config ein anderes
16:01 < sar> foobar noch ein anderes
16:01 < sar> es macht einfach keinen sinn auf type ebene install vs nicht-install zu
unterscheiden
16:02 < telmich> sar: environments sind bei mir noch nicht ganz im gehirn (ganicht?)
angelangt - hast du (nochmal?) kurz eine idee, was du damit meinst?
16:02 < sar> telmich: wenn man cdist anschaut, dann macht es eigentlich folgendes:
16:03 < sar> - definiere objekte mit hilfe von types
16:03 < sar> - deps zwischen objekten
16:03 < sar> - queue von objekten abarbeiten und auf $etwas anwenden
16:03 < sar> das ist alles
16:04 < sar> telmich: das ist eigentlich ziemlich generisch
16:04 < sar> telmich: fuer mich wuerde es sich hier anbieten das auch so zu
abstrahieren
16:05 < sar> telmich: ein environment (nenn das mal so weil kein besserer name zzt)
koennte das wie $objekt auf $etwas bestimmen
16:05 < sar> telmich: und auch was fuer types es in diesem environment gibt
16:06 < telmich> sar: klingt gut
16:06 < sar> telmich: e.g. es gibt ein environment fuer config -> was wir jetzt haben
16:06 < sar> eins fuer install -> += was im install branch ist (nur die types), den
python code brauchts nacher nicht mehr
16:07 < sar> eins fuer cisco-switch -> hat types um mit cisco zu spielen
16:07 < sar> usw
16:07 < sar> ein environment hat auch eigene remote-{exec,copy} scripte
16:08 < sar> und vielleicht globale explorer, vielleicht auch nicht
16:08 < sar> ein enviroment ist ein cconfig style directory
16:09 < sar> wo man cdist drueber laufen laesst
16:09 < sar> so was in der art
16:13 < telmich> sar: hmmja...klingt gut
16:15 < telmich> vielleicht etwas für cdist 4 oder cdist 5 :-)
16:15 < telmich> aber ich denke auf jeden fall als grundgedanke behaltbar
16:16 < telmich> ok für dich, wenn ich den chat ins docs/dev/logs kopiere als
erinnerungs
16:16 < telmich> s/s$/?/?
16:16 < telmich> s/?$//
16:20 < sar> klar

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -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,13 +176,22 @@ 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
---------------------
ENVIRONMENT VARIABLES (FOR READING)
-----------------------------------
The following environment variables are exported by cdist:
__explorer::
Directory that contains all global explorers.
Available for: initial manifest, explorer, type explorer, shell
@ -219,6 +229,15 @@ __type_explorer::
Directory that contains the type explorers.
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))
SEE ALSO
--------

View file

@ -127,10 +127,16 @@ usage: __git --source SOURCE [--state STATE] [--branch BRANCH]
ENVIRONMENT
-----------
TMPDIR, TEMP, TMP::
Setup the base directory for the temporary directory.
See http://docs.python.org/py3k/library/tempfile.html for
more information. This is rather useful, if the standard
directory used does not allow executables.
Setup the base directory for the temporary directory.
See http://docs.python.org/py3k/library/tempfile.html for
more information. This is rather useful, if the standard
directory used does not allow executables.
CDIST_LOCAL_SHELL::
Selects shell for local script execution, defaults to /bin/sh
CDIST_REMOTE_SHELL::
Selects shell for remote scirpt execution, defaults to /bin/sh
EXIT STATUS

View file

@ -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

View file

@ -128,6 +128,19 @@ All objects that are created in a type manifest are automatically required
from the type that is calling them. This is called "autorequirement" in
cdist jargon.
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_ALLOW_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 AT ANY TIME.
EXECUTE_TYPES_IN_CREATION_ORDER is a EXPERIMENTAL FEATURE !
You can tell cdist to execute all types in the order in which they are created
@ -189,6 +202,26 @@ __package lighttpd --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_ALLOW_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
--------------------------------------------------------------------------------
SEE ALSO