Merge branch 'master' into feature_init_process

Conflicts:
	doc/changelog
	doc/dev/todo/niconext
	doc/man/cdist-reference.text.sh
	lib/cdist/core/explorer.py

doc/man/cdist-reference.text.sh documents better reachability of
variables - also suitable for master?

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-02-14 13:53:16 +01:00
commit 2b380b7dc1
55 changed files with 921 additions and 360 deletions

View file

@ -1,15 +1,37 @@
2.0.6:
Changelog
---------
* Changes are always commented with their author in (braces)
* Exception: No braces means author == Nico Schottelius
2.0.8:
* Cleanup: Better hint to source of error
* Cleanup: Remove support for __debug variable in manifests (Type != Core
debugging)
2.0.7: 2012-02-13
* Bugfix __file: Use chmod after chown/chgrp (Matt Coddington)
* Bugfix __user: Correct shadow field in explorer (Matt Coddington)
* Bugfix __link: Properly handle existing links (Steven Armstrong)
* Bugfix __key_value: More robust implementation (Steven Armstrong)
* Bugfix __user: Fix for changing a user's group by name (Matt Coddington)
* New Type: __package_pip
* Bugfix/Cleanup: Correctly allow Object ID to start and end with /, but
not contain //.
2.0.6: 2012-01-28
* Bugfix __apt_ppa:
Also remove the [ppa-name].list file, if empty. (Tim Kersten)
* Bugfix __group:
Referenced wrong variable name (Matt Coddington)
* Feature __package_apt:
Initial support for virtual packages (Evax Software)
* Feature Core: Added new dependency resolver (Steven Armstrong)
* Feature Explorer, __package_yum: Support Amazon Linux (Matt Coddington)
* New Type: __rvm (Evax Software)
* New Type: __rvm_gem (Evax Software)
* New Type: __rvm_gemset (Evax Software)
* New Type: __rvm_ruby (Evax Software)
* New Explorer: runlevel
* Documentation: Update of reference (environment variables)
* Feature core: Added new dependency resolver (Steven Armstrong)
2.0.5: 2012-01-18
* Bugfix __key_value: Use correct delimiters

View file

@ -0,0 +1,36 @@
If a type explorer depends on a command that will be generated by another type,
the operation fails, as can be seen below.
This may be a corner case, but is hapenning with __package_pip and
__python_virtualenv.
[19:10] brief:cdist% ./bin/cdist config -v loch
INFO: loch: Running global explorers
INFO: loch: Running initial manifest /home/users/nico/privat/firmen/local.ch/vcs/cdist/conf/manifest
INFO: loch: Running object manifests and type explorers
INFO: loch: Running manifest and explorers for __git/root/shinken
INFO: loch: Running manifest and explorers for __package_pip/pyro
/var/lib/cdist/conf/type/__package_pip/explorer/state: line 38: /root/shinken_virtualenv/bin/pip: No such file or directory
INFO: loch: Running manifest and explorers for __python_virtualenv/root/shinken_virtualenv
INFO: loch: Running manifest and explorers for __directory/pyro
INFO: loch: Running manifest and explorers for __directory/root/shinken
INFO: loch: Running manifest and explorers for __directory/root/shinken_virtualenv
INFO: loch: Running manifest and explorers for __package/git
INFO: loch: Running manifest and explorers for __package/python-virtualenv
INFO: loch: Running manifest and explorers for __package_pacman/git
INFO: loch: Running manifest and explorers for __package_pacman/python-virtualenv
INFO: loch: Generating and executing code
INFO: loch: Generating and executing code for __package_pacman/git
INFO: loch: Generating and executing code for __package/git
INFO: loch: Generating and executing code for __directory/root/shinken
INFO: loch: Generating and executing code for __git/root/shinken
fatal: write error: No space left on device
fatal: index-pack failed
ERROR: loch: Code that raised the error:
git clone --quiet "git://github.com/naparuba/shinken.git" "/root/shinken"
ERROR: Remote script execution failed: ssh -o User=root -q loch /bin/sh -e /var/lib/cdist/object/__git/root/shinken/.cdist/code-remote
WARNING: Failed to deploy to the following hosts: loch
INFO: Total processing time for 1 host(s): 340.62370681762695
[19:17] brief:cdist% ./bin/cdist config -v loch

View file

@ -0,0 +1,18 @@
__typename /foo/bar # possible, usual use case
require="__a//b" __typename /foo/bar # possible and happens often for __a/$id in loops
__typename /foo/bar/ # trailing slash will be stripped, can be documented
__typename /foo//bar//baz # // will be converted to / implicitly through fs; error prone; disallow
require="__a//b//c" __typename # // will be converted to / implicitly through fs; error prone; disallow
Solution:
1) allow require __a//b: type __a, object id /b
=> strip first slash of object id, as we do in non-dep-mode
2) allow _one_ trailing /: __type /foo/bar/ and require="__foo/abc/"
=> strip one leading slash of object id
3) disallow // within object id
4) disallow starting or ending / after 1) and 2)

View file

@ -0,0 +1,23 @@
possible dependencies:
- unix pattern __foo/*
- object: __foo//bar, __foo/bar
- singleton with object_id: __foo/singleton
- singleton without object_id: __foo/
solving dependencies:
solve_dep(object, run_list):
- list = [me]
- if status == IN_DEPENDENCY:
fail: circular dependency
- status = IN_DEPENDENCY
- create_list_of_deps(object)
- try pattern expansion
- for each dependency:
if object does not exist:
fail
else:
list.append(solve_dep(object, run_list)):
- status == IN_LIST
- return [me, dependencies [, dependencies of dependencies]]

View file

@ -11,15 +11,25 @@ echo "Testing documentation..."
./build clean && ./build man || exit 1
# get version
changelog_version=$(head -n1 doc/changelog | sed 's/:.*//')
changelog_version=$(grep '^[[:digit:]]' doc/changelog | head -n1 | sed 's/:.*//')
#git_version=$(git describe)
lib_version=$(grep ^VERSION lib/cdist/__init__.py | sed -e 's/.*= //' -e 's/"//g')
# get date
date_today="$(date +%Y-%m-%d)"
date_changelog=$(grep '^[[:digit:]]' doc/changelog | head -n1 | sed 's/.*: //')
echo "Ensure you fixed/prepared version files: $files"
echo "changelog: $changelog_version"
#echo "git: $git_version"
echo "lib: $lib_version"
if [ "$date_today" != "$date_changelog" ]; then
echo "Messed up date, not releasing:"
echo "Changelog: $date_changelog"
exit 1
fi
if [ "$lib_version" != "$changelog_version" ]; then
echo "Messed up versions, not releasing"
exit 1

View file

@ -34,7 +34,6 @@ USER INTERFACE
TYPES
------
- Add testing framework (proposed by Evax Software)
- __user
add option to include --create-home
- ensure that all types, which support --state support
present and absent (consistent look and feel)

View file

@ -1,9 +1,17 @@
- __init_script?
to enable/disable startup of init stuff
http://linuxhelp.blogspot.com/2006/04/enabling-and-disabling-services-during_01.html
2.0.8 features / cleanups:
- cleanup object_id handling
- have a look at singletons
- remove useless
ERROR: monitoring02: Code that raised the error:
- ensure that all types, which support --state support
present and absent (consistent look and feel)
--------------------------------------------------------------------------------
- update/create docs
- document __remote_copy and __remote_exec
- cdist-cache::
How to get use information about the hosts we have been working on [advanced]
- cdist-scaling-tuning::
@ -17,3 +25,4 @@
- exec flag is not true for manifest anymore
- SSH HINTS - ssh agent

View file

@ -49,10 +49,10 @@ The following global explorers are available:
eof
(
cd ../../conf/explorer
for explorer in *; do
echo "- $explorer"
done
cd ../../conf/explorer
for explorer in *; do
echo "- $explorer"
done
)
cat << eof
@ -62,77 +62,77 @@ PATHS
If not specified otherwise, all paths are relative to the checkout directory.
conf/::
Contains the (static) configuration like manifests, types and explorers.
Contains the (static) configuration like manifests, types and explorers.
conf/manifest/init::
This is the central entry point used by cdist-manifest-init(1).
It is an executable (+x bit set) shell script that can use
values from the explorers to decide which configuration to create
for the specified target host.
It should be primary used to define mapping from configurations to hosts.
This is the central entry point used by cdist-manifest-init(1).
It is an executable (+x bit set) shell script that can use
values from the explorers to decide which configuration to create
for the specified target host.
It should be primary used to define mapping from configurations to hosts.
conf/manifest/*::
All other files in this directory are not directly used by cdist, but you
can seperate configuration mappings, if you have a lot of code in the
manifest/init file. This may also be helpful to have different admins
maintain different groups of hosts.
All other files in this directory are not directly used by cdist, but you
can seperate configuration mappings, if you have a lot of code in the
manifest/init file. This may also be helpful to have different admins
maintain different groups of hosts.
conf/explorer/<name>::
Contains explorers to be run on the target hosts, see cdist-explorer(7).
Contains explorers to be run on the target hosts, see cdist-explorer(7).
conf/type/::
Contains all available types, which are used to provide
some kind of functionality. See cdist-type(7).
Contains all available types, which are used to provide
some kind of functionality. See cdist-type(7).
conf/type/<name>/::
Home of the type <name>.
Home of the type <name>.
This directory is referenced by the variable __type (see below).
This directory is referenced by the variable __type (see below).
conf/type/<name>/man.text::
Manpage in Asciidoc format (required for inclusion into upstream)
Manpage in Asciidoc format (required for inclusion into upstream)
conf/type/<name>/manifest::
Used to generate additional objects from a type.
Used to generate additional objects from a type.
conf/type/<name>/gencode-local::
Used to generate code to be executed on the server.
Used to generate code to be executed on the server.
conf/type/<name>/gencode-remote::
Used to generate code to be executed on the client.
Used to generate code to be executed on the client.
conf/type/<name>/parameters/required::
Parameters required by type, \n seperated list.
Parameters required by type, \n seperated list.
conf/type/<name>/parameters/optional::
Parameters optionally accepted by type, \n seperated list.
Parameters optionally accepted by type, \n seperated list.
conf/type/<name>/explorer::
Location of the type specific explorers.
This directory is referenced by the variable __type_explorer (see below).
See cdist-explorer(7).
Location of the type specific explorers.
This directory is referenced by the variable __type_explorer (see below).
See cdist-explorer(7).
out/::
This directory contains output of cdist and is usually located
in a temporary directory and thus will be removed after the run.
This directory is referenced by the variable __global (see below).
This directory contains output of cdist and is usually located
in a temporary directory and thus will be removed after the run.
This directory is referenced by the variable __global (see below).
out/explorer::
Output of general explorers.
Output of general explorers.
out/object::
Objects created for the host.
Objects created for the host.
out/object/<object>::
Contains all object specific information.
This directory is referenced by the variable __object (see below).
Contains all object specific information.
This directory is referenced by the variable __object (see below).
out/object/<object>/explorers::
Output of type specific explorers, per object.
Output of type specific explorers, per object.
tmp_dir::
A tempdir and a tempfile is used by cdist internally,
which will be removed when the scripts end automatically.
A tempdir and a tempfile is used by cdist internally,
which will be removed when the scripts end automatically.
TYPES
-----
@ -141,13 +141,13 @@ The following types are available:
eof
for type in man7/cdist-type__*.text; do
no_dir="${type#man7/}";
no_type="${no_dir#cdist-type}";
name="${no_type%.text}";
name_no_underline="$(echo $name | sed 's/^__/\\__/g')"
man="${no_dir%.text}(7)"
no_dir="${type#man7/}";
no_type="${no_dir#cdist-type}";
name="${no_type%.text}";
name_no_underline="$(echo $name | sed 's/^__/\\__/g')"
man="${no_dir%.text}(7)"
echo "- $name_no_underline" "($man)"
echo "- $name_no_underline" "($man)"
done
cat << eof
@ -159,8 +159,8 @@ For object to object communication and tests, the following paths are
usable within a object directory:
changed::
This empty file exists in an object directory, if the object has
code to be excuted (either remote or local)
This empty file exists in an object directory, if the object has
code to be excuted (either remote or local)
ENVIRONMENT VARIABLES
@ -169,33 +169,37 @@ __explorer::
Directory that contains all global explorers.
Available for: explorer, type explorer
__manifest::
Directory that contains the initial manifest.
Available for: initial manifest
Directory that contains the initial manifest.
Available for: initial manifest
__global::
Directory that contains generic output like explorer.
Available for: initial manifest, type manifest, type gencode
Directory that contains generic output like explorer.
Available for: initial manifest, type manifest, type gencode
__object::
Directory that contains the current object.
Available for: type manifest, type explorer, type gencode
Directory that contains the current object.
Available for: type manifest, type explorer, type gencode
__object_id::
The type unique object id.
Available for: type manifest, type explorer, type gencode
Note: The leading "/" will always be stripped.
The type unique object id.
Available for: type manifest, type explorer, type gencode
Note: The leading and the trailing "/" will always be stripped (caused by
the filesystem database and ensured by the core).
Note: Double slashes ("//") will not be fixed and result in an error.
__self::
DEPRECATED: Same as __object_name, do not use anymore, use __object_name instead.
Will be removed in cdist 3.x.
DEPRECATED: Same as __object_name, do not use anymore, use __object_name instead.
Will be removed in cdist 3.x.
__object_name::
The full qualified name of the current object.
Available for: type manifest, type explorer, type gencode
The full qualified name of the current object.
Available for: type manifest, type explorer, type gencode
__target_host::
The host we are deploying to.
Available for: explorer, initial manifest, type explorer, type manifest, type gencode
__type::
Path to the current type.
Available for: type manifest, type gencode
Path to the current type.
Available for: type manifest, type gencode
__type_explorer::
Directory that contains the type explorers.
Available for: type explorer
Directory that contains the type explorers.
Available for: type explorer
SEE ALSO

View file

@ -61,12 +61,19 @@ including it.
HOW TO SUBMIT A NEW TYPE
------------------------
For detailled information about types, see cdist-type(7).
Submitting a type works as described above, with the additional requirement
that a corresponding manpage named man.text in asciidoc format with
the manpage-name "cdist-type__NAME" is included in the type directory
AND asciidoc is able to compile it (i.e. do NOT have to many "=" in the second
line).
Warning: Submitting "exec" or "run" types that simply echo their parameter in
gencode* will not be accepted, because they are of no use. Every type can output
code and thus such a type introduces redundant functionality that is given by
core cdist already.
SEE ALSO
--------