Merge remote branch 'nico/master'

This commit is contained in:
Steven Armstrong 2011-04-05 22:45:16 +02:00
commit da532a9068
17 changed files with 145 additions and 39 deletions

15
README
View file

@ -106,14 +106,15 @@ how to use cdist.
There are at least the following branches available:
* master: the development branch
* 1.5: Focus on object orientation instead of global stage orientation
* 1.6: New types, cleaned up \_\_package* types, internal cleanup
Old versions:
* 1.5: Focus on object orientation instead of global stage orientation
* 1.4: Support for redefiniton of objects (if equal)
* 1.3: Support for local and remote code execution (current stable)
* 1.2: Dependencies supported
* 1.1: __file to __file, __directory, __link migration
* 1.1: \_\_file to \_\_file, \_\_directory, \_\_link migration
* 1.0: First official release
Other branches may be available for features or bugfixes, but they
@ -123,7 +124,7 @@ may vanish at any point. To select a specific branch use
git checkout -b <name> origin/<name>
# Stay on a specific version
version=1.5
version=1.6
git checkout -b $version origin/$version
### Mirrors
@ -145,6 +146,14 @@ If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break.
The master branch on the other hand is the development branch and may not be
working, break your setup or eat the tree in your garden.
### Upgrading from 1.5 to 1.6
* If you used **\_\_package_apt --preseed**, you need to use the new
type **\_\_debconf_set_selections** instead.
* The **\_\_package** types accepted either --state deinstalled or
--state uninstaaled. Starting with 1.6, it was made consistently
to --state removed.
### Upgrading from 1.3 to 1.5
No incompatiblities.

View file

@ -19,7 +19,7 @@
#
#
__cdist_version="1.5.0"
__cdist_version="1.6.0pre"
# Fail if something bogus is going on
set -u

51
conf/explorer/os_version Executable file
View file

@ -0,0 +1,51 @@
#!/bin/sh
#
# 2010-2011 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/>.
#
#
# All os variables are lower case
#
#
case "$($__explorer/os)" in
archlinux)
# empty, but well...
cat /etc/arch-release
;;
debian)
cat /etc/debian_version
;;
fedora)
cat /etc/fedora-release
;;
gentoo)
cat /etc/gentoo-release
;;
macosx|*bsd|solaris)
uname -r
;;
redhat)
cat /etc/redhat-release
;;
suse)
cat /etc/SuSE-release
;;
ubuntu)
lsb_release -sr
;;
esac

View file

@ -17,7 +17,7 @@ It dispatches the actual work to the package system dependant types.
REQUIRED PARAMETERS
-------------------
state::
The state the package should be in, either "installed" or "uninstalled"
The state the package should be in, either "installed" or "removed"
OPTIONAL PARAMETERS

View file

@ -46,10 +46,14 @@ case "$state" in
echo $aptget install \"$name\"
fi
;;
uninstalled)
removed)
# Remove only if existent
if [ -n "$is_installed" ]; then
echo $aptget remove \"$name\"
fi
;;
*)
echo "Unknown state: $state" >&2
exit 1
;;
esac

View file

@ -17,7 +17,7 @@ manage packages.
REQUIRED PARAMETERS
-------------------
state::
Either "installed" or "deinstalled".
Either "installed" or "removed".
OPTIONAL PARAMETERS
@ -37,7 +37,7 @@ __package_apt zsh --state installed
__package_apt webserver --state installed --name nginx
# Remove obsolete package
__package_apt puppet --state deinstalled
__package_apt puppet --state removed
--------------------------------------------------------------------------------

View file

@ -44,9 +44,13 @@ case "$state" in
echo pacman "$pacopts" -S \"$name\"
fi
;;
uninstalled)
removed)
if [ "$pkg_version" ]; then
echo pacman "$pacopts" -R \"$name\"
fi
;;
*)
echo "Unknown state: $state" >&2
exit 1
;;
esac

View file

@ -17,7 +17,7 @@ packages.
REQUIRED PARAMETERS
-------------------
state::
Either "installed" or "deinstalled".
Either "installed" or "removed".
OPTIONAL PARAMETERS
@ -37,7 +37,7 @@ __package_pacman zsh --state installed
__package_pacman python --state installed --name python2
# Remove obsolete package
__package_pacman puppet --state deinstalled
__package_pacman puppet --state removed
--------------------------------------------------------------------------------

View file

@ -39,9 +39,13 @@ case "$state" in
echo yum $opts install \"$name\"
fi
;;
uninstalled)
removed)
if ! grep -q "$not_installed" "$__object/explorer/pkg_version"; then
echo yum $opts remove \"$name\"
fi
;;
*)
echo "Unknown state: $state" >&2
exit 1
;;
esac

View file

@ -18,7 +18,7 @@ slightly confusing error message "Error: Nothing to do".
REQUIRED PARAMETERS
-------------------
state::
Either "installed" or "deinstalled".
Either "installed" or "removed".
OPTIONAL PARAMETERS
@ -38,7 +38,7 @@ __package_yum zsh --state installed
__package_yum python --state installed --name python2
# Remove obsolete package
__package_yum puppet --state deinstalled
__package_yum puppet --state removed
--------------------------------------------------------------------------------

View file

@ -32,10 +32,6 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then
file="$__object/explorer/passwd"
case "$property" in
password)
field=3
file="$__object/explorer/shadow"
;;
gid)
if $(echo "$new_value" | grep -q '^[0-9][0-9]*$'); then
field=4
@ -45,10 +41,14 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then
field=1
fi
;;
uid) field=3 ;;
password)
field=3
file="$__object/explorer/shadow"
;;
comment) field=5 ;;
home) field=6 ;;
shell) field=7 ;;
uid) field=3 ;;
esac
export field

View file

@ -1,7 +1,10 @@
1.6.0:
* New Type __package_yum
* New type __debconf_set_selections
* New explorer os_version
* Fix Type __group in case of __group NAME syntax
* Fix __package* types: consistently name --state removed instead of
uninstalled or deinstalled
* Type __package gained Fedora support
* Removed --preseed support from __package_apt
* explorer/os: gained Fedora support

View file

@ -0,0 +1,24 @@
Some openbsd experiements:
# pkg_add foo
Can't find foo
# echo $?
0
#
# pkg_info foo
# echo $?
0
# pkg_add -s vim
Ambiguous: vim could be vim-7.2.444-gtk2 vim-7.2.444-no_x11
# pkg_add -s vim--no_x11
# echo $?
0
# pkg_add -s vimfooooooooo
Can't find vimfooooooooo
# pkg_add -s vim--foooooooo
Can't find vim--foooooooo
# echo $?
0

View file

@ -1 +1,3 @@
- adjust documentation / stages
Documentation:
- update stages
- go through all manpages and ensure __ and co are correct

View file

@ -23,6 +23,19 @@ CORE
[20:22] kr:bin%
- probably remove or improve cdist-type-template
- add $__tmp?
- for use in manifest, code, etc.?
- for creating temporary files, etc.
- How to cleanly implement "restart service if config file changed"
- Cache
- add example how to use
- export variable $__cache
-> for current host
-> add function to cdist-config, import from cdist-cache
- check all all internal variables are prefixed with __cdist
TYPES
------
@ -31,18 +44,12 @@ TYPES
- regexp replace (can probably cover all?)
-> aka sed.
- __cron
- __user:
- __user
add option to include --create-home
fix __user NAME case (same issue as __group)
DOCUMENTATION
--------------
- asciidoc interprets __, which we use for variables
names -> seek through docs and replace with \_\_!
- check all all internal variables are prefixed with __cdist
- reference explorers in cdist-reference!
Cache:
- add example how to use
- export variable $__cache
-> for current host
-> add function to cdist-config, import from cdist-cache

View file

@ -45,9 +45,11 @@ cdist-reference - Variable, path and type reference for cdist
DESCRIPTION
-----------
Various scripts which are not in the core need information on how
to find information. This manpage summarises the available environment
variables, types and paths and clearifies with part may access which variables.
This reference summarises
- environment variables
- paths
- types
PATHS
@ -62,7 +64,6 @@ conf/manifest/init::
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/*::
@ -103,15 +104,12 @@ conf/type/<name>/parameters/optional::
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).
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).
out/explorer::
@ -122,7 +120,6 @@ out/object::
out/object/<object>::
Contains all object specific information.
This directory is referenced by the variable __object (see below).
out/object/<object>/explorers::
@ -138,8 +135,8 @@ TYPES
The available types are listed in the SEE ALSO section
and are referenced as cdist-type__TYPENAME.
VARIABLES
---------
ENVIRONMENT VARIABLES
---------------------
__explorer::
Directory that contains all explorers.
Available for: explorer

View file

@ -59,7 +59,8 @@ HOW TO SUBMIT A NEW TYPE
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.
AND asciidoc is able to compile it (i.e. do NOT have to many "=" in the second
line).
SEE ALSO