fix merge conflict

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-03-14 09:26:18 +01:00
commit a50e380174
34 changed files with 566 additions and 146 deletions

4
.gitignore vendored
View file

@ -1,4 +1,8 @@
# -vim
.*.swp
# Ignore generated manpages
doc/man/*.[1-9]
doc/man/.marker
doc/man/man*/
conf/type/*/*.7

View file

@ -27,7 +27,6 @@ MANSRC=$(MANDIR)/cdist.text \
$(MANDIR)/cdist-stages.text \
$(MANDIR)/cdist-type.text \
$(MANDIR)/cdist-type-template.text \
$(MANDIR)/cdist-type__file.text \
################################################################################
@ -47,16 +46,33 @@ all:
man: doc/man/.marker
doc/man/.marker: $(MANSRC) $(MANGENERATED)
for mansrc in $^; do $(A2X) $$mansrc; done
for manpage in $(MANDIR)/*.[1-9]; do cat=$${manpage##*.}; mandir=$(MANDIR)/man$$cat; mkdir -p $$mandir; mv $$manpage $$mandir; done
doc/man/.marker: $(MANDIR)/cdist-reference.text
touch $@
# Only depends on cdist-type__*.text in reality
$(MANDIR)/cdist-reference.text: $(MANSRC) $(MANDIR)/cdist-reference.text.sh
$(MANDIR)/cdist-reference.text.sh
# Manual from core
mancore: $(MANSRC)
for mansrc in $^; do $(A2X) $$mansrc; done
# Manuals from types
mantype:
for man in conf/type/*/man.text; do $(A2X) $$man; done
# Move into manpath directories
manmove: mantype mancore
for manpage in $(MANDIR)/*.[1-9] conf/type/*/*.7; do \
cat=$${manpage##*.}; \
mandir=$(MANDIR)/man$$cat; \
mkdir -p $$mandir; \
mv $$manpage $$mandir; \
done
# Reference depends on conf/type/*/man.text - HOWTO with posix make?
$(MANDIR)/cdist-reference.text: manmove $(MANDIR)/cdist-reference.text.sh
$(MANDIR)/cdist-reference.text.sh
$(A2X) $(MANDIR)/cdist-reference.text
# Move us to the destination as well
make manmove
clean:
rm -rf doc/man/*.html doc/man/*.[1-9] doc/man/man[1-9] $(MANGENERATED)

View file

@ -1,5 +1,20 @@
[[!meta title="cdist - configuration management"]]
.. . .x+=:. s
dF @88> z` ^% :8
'88bu. %8P . <k .88
. '*88888bu . .@8Ned8" :888ooo
.udR88N ^"*8888N .@88u .@^%8888" -*8888888
<888'888k beWE "888L ''888E` x88: `)8b. 8888
9888 'Y" 888E 888E 888E 8888N=*8888 8888
9888 888E 888E 888E %8" R88 8888
9888 888E 888F 888E @8Wou 9% .8888Lu=
?8888u../ .888N..888 888& .888888P` ^%888*
"8888P' `"888*"" R888" ` ^"F 'Y"
"P' "" ""
[[!toc levels=2]]
## Introduction
@ -79,7 +94,7 @@ To install cdist, execute the following commands:
cd cdist
export PATH=$PATH:$(pwd -P)/bin
# If you want the manpages
# If you want the manpages (requires asciidoc to be installed)
make man
export MANPATH=$MANPATH:$(pwd -P)/doc/man
@ -129,3 +144,28 @@ You can join the development ***IRC channel***
Bug reports, questions, patches, etc. should be send to the
[cdist mailing list](http://l.schottelius.org/mailman/listinfo/cdist).
## Used by
If you're using cdist, feel free to send a report to the mailing list.
Interesting information are for instance
* Which services do you manage?
* How many machines do you manage?
* What are the pros/cons you see in cdist?
* General comments/critics
### Nico Schottelius, Systems Group ETH Zurich
Yes, I'm actually eating my own dogfood and currently managing
* [plone](http://plone.org/) (cms)
* [moinmoin](http://moinmo.in/) (wiki)
* [apache](http://httpd.apache.org/) (webserver)
* [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication)
* [ircd-hybrid](http://www.ircd-hybrid.org/) (chat)
* [stunnel](http://stunnel.mirt.net/) (SSL tunnel)
with cdist on a total of **3** production servers of the
[Systems Group](http://www.systems.ethz.ch) at the
[ETH Zurich](http://www.ethz.ch).

View file

@ -19,7 +19,9 @@
#
#
# Fail if something bogus is going on and export all variables
__cdist_version="1.0.3"
# Fail if something bogus is going on
set -u
################################################################################
@ -31,8 +33,6 @@ __cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)"
__cdist_myname=${0##*/};
__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
: ${__cdist_version:="$(cd "$__cdist_abs_mydir/.." && git describe)"}
################################################################################
# Names / Constants
#
@ -57,13 +57,14 @@ __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
: ${__cdist_name_parameter:=parameter}
: ${__cdist_name_parameter_required:=required}
: ${__cdist_name_parameter_optional:=optional}
: ${__cdist_name_singleton:=singleton}
: ${__cdist_name_target_host:=target_host}
: ${__cdist_name_type:=type}
: ${__cdist_name_type_bin:=type_bin}
: ${__cdist_name_type_explorer:=type_explorer}
# Used for IDs
: ${__cdist_sane_regexp:=[A-Za-z0-9/]*[-A-Za-z0-9_/]*}
# Used for IDs: Allow everything not starting with - and .
: ${__cdist_sane_regexp:=[^-\.].*}
# Default remote user
: ${__cdist_remote_user:=root}
@ -162,11 +163,6 @@ __cdist_init_deploy()
ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir"
}
# __cdist_cache_host()
# {
# echo "${__cdist_cache_hosts}/${__cdist_target_host}"
# }
__cdist_type_has_explorer()
{
# We only create output, if there's at least one explorer
@ -196,14 +192,25 @@ __cdist_type_gencode()
echo "${__cdist_type_dir}/$1/${__cdist_name_gencode}"
}
__cdist_type_singleton()
{
echo "${__cdist_type_dir}/$1/${__cdist_name_singleton}"
}
__cdist_type_parameter_dir()
{
echo "$(__cdist_type_dir "$1")/${__cdist_name_parameter}"
}
__cdist_type_parameter_file()
# Shorthand for required and optional
__cdist_type_parameter_required()
{
echo "$(__cdist_type_parameter_dir "$1")/$2"
echo "$(__cdist_type_parameter_dir "$1")/$__cdist_name_parameter_required"
}
__cdist_type_parameter_optional()
{
echo "$(__cdist_type_parameter_dir "$1")/$__cdist_name_parameter_optional"
}
__cdist_type_from_object()

View file

@ -67,4 +67,4 @@ cdist-dir push "$__cdist_target_host" "$__cdist_out_object_dir" \
# And finally - execute the code
cdist-code-run-all "$__cdist_target_host"
echo "Configuration successfully finished."
echo "Configuration successfully finished for $__cdist_target_host"

33
bin/cdist-env Executable file
View file

@ -0,0 +1,33 @@
#!/bin/sh
#
# 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/>.
#
#
# Setup environment for use with cdist
#
. cdist-config
[ $# -eq 0 ] || __cdist_usage "no arguments"
# Allow access to unset variables like PATH and MANPATH
set +u
echo export PATH=$__cdist_abs_mydir:$PATH
cd "$__cdist_abs_mydir/../doc/man"
echo export MANPATH=$(pwd -P):$MANPATH

View file

@ -25,12 +25,18 @@
#
. cdist-config
[ $# -ge 1 ] || __cdist_usage "<id> <options>"
set -eu
__cdist_object_id="$1"; shift
__cdist_type="$__cdist_myname"
# Find out whether type is a singleton or regular type
if [ -f "$(__cdist_type_singleton "$__cdist_type")" ]; then
__cdist_object_id="singleton"
else
[ $# -ge 1 ] || __cdist_usage "<id> <options>"
__cdist_object_id="$1"; shift
fi
echo "$__cdist_object_id" | grep -q "^${__cdist_sane_regexp}\$" || \
__cdist_usage "Insane object id, ${__cdist_object_id}."
@ -72,20 +78,24 @@ while [ $# -gt 0 ]; do
done
# Ensure required parameters are given
while read required; do
if [ ! -f "${tempparameter}/${required}" ]; then
__cdist_usage "Missing required parameter $required"
fi
if [ -f "$(__cdist_type_parameter_required "$__cdist_type")" ]; then
while read required; do
if [ ! -f "${tempparameter}/${required}" ]; then
__cdist_usage "Missing required parameter $required"
fi
mv "${tempparameter}/${required}" "${__cdist_parameter_dir}"
done < "$(__cdist_type_parameter_file "$__cdist_type" "$__cdist_name_parameter_required")"
mv "${tempparameter}/${required}" "${__cdist_parameter_dir}"
done < "$(__cdist_type_parameter_required "$__cdist_type")"
fi
# Allow optional parameters
while read optional; do
if [ -f "${tempparameter}/${optional}" ]; then
mv "${tempparameter}/${optional}" "${__cdist_parameter_dir}"
fi
done < "$(__cdist_type_parameter_file "$__cdist_type" "$__cdist_name_parameter_optional")"
if [ -f "$(__cdist_type_parameter_optional "$__cdist_type")" ]; then
while read optional; do
if [ -f "${tempparameter}/${optional}" ]; then
mv "${tempparameter}/${optional}" "${__cdist_parameter_dir}"
fi
done < "$(__cdist_type_parameter_optional "$__cdist_type")"
fi
# Error out on other paramaters
cd "${tempparameter}"

View file

@ -1,34 +0,0 @@
#
# This is a sample manifest, but used in real world
#
# This is debug and should not be in a production environment
echo "We could access other manifests in $__manifest"
__file /etc/cdist-configured --type file
case "$__target_host" in
# Everybody has this
localhost)
__file test --type file --destination /tmp/cdist-testfile
;;
# Alias in /etc/hosts for localhost
cdist-archlinux)
__package_pacman django --state uninstalled
__package_pacman wireshark-cli --state installed
__package_pacman zsh --state installed
;;
cdist-gentoo)
__package tree --state installed
;;
# Real machines
ikq*)
__package_apt zsh --state installed
__package_apt apache2 --state uninstalled
;;
kr)
__issue iddoesnotmatterhere
;;
esac

View file

@ -0,0 +1,38 @@
#!/bin/sh
#
# 2010-2011 Daniel Roth (dani-cdist@d-roth.li)
#
# 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/file" ]; then
file=$(cat "$__object/parameter/file")
else
file="/$__object_id"
fi
regex=$(cat "$__object/parameter/line")
if [ -f "$file" ]; then
grep -q "^$regex\$" "$file"
if [ $? -eq 1 ]; then
echo "NOTFOUND"
else
echo "FOUND"
fi
else
echo "NOTFOUND"
fi

View file

@ -0,0 +1,33 @@
#!/bin/sh
#
# 2010-2011 Daniel Roth (dani-cdist@d-roth.li)
#
# 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/file" ]; then
file=$(cat "$__object/parameter/file")
else
file="/$__object_id"
fi
result=$(cat "$__object/explorer/findline")
if [ "$result" = "NOTFOUND" ]; then
line=$(cat "$__object/parameter/line")
echo "echo $line >> $file"
fi

View file

@ -0,0 +1 @@
file

View file

@ -0,0 +1 @@
line

View file

@ -0,0 +1,34 @@
#!/bin/sh
#
# 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/>.
#
#
# Check whether file exists or not
#
if [ -f "$__object/parameter/destination" ]; then
destination="$(cat "$__object/parameter/destination")"
else
destination="/$__object_id"
fi
if [ -e "$destination" ]; then
echo yes
else
echo no
fi

View file

@ -41,7 +41,11 @@ esac
# No output if file does not exist - does definitely not match the md5sum :-)
if [ -e "$destination" ]; then
$md5sum < "$destination"
if [ -f "$destination" ]; then
$md5sum < "$destination"
else
echo "NO REGULAR FILE"
fi
else
echo "NO FILE FOUND, NO CHECKSUM CALCULATED."
fi

View file

@ -22,8 +22,6 @@
# example for typewrites later
#
type="$(cat "$__object/parameter/type")"
# If destination was specified, do not use the id
if [ -f "$__object/parameter/destination" ]; then
destination="$(cat "$__object/parameter/destination")"
@ -40,6 +38,7 @@ if ! $(echo "$destination" | grep -q ^/); then
exit 1
fi
# Use correct md5sum binary - MacOSx is different here
case "$os" in
macosx)
md5sum="md5"
@ -50,40 +49,65 @@ case "$os" in
;;
esac
# Copy source if existing
# FIXME: directory handling not supported - add recursive flag?
if [ -f "$__object/parameter/source" ]; then
source="$(cat "$__object/parameter/source")"
type="$(cat "$__object/parameter/type")"
local_md5sum="$($md5sum < "$source")"
remote_md5sum="$(cat "$__object/explorer/md5sum")"
# Is md5sum the right approach?
if [ "$local_md5sum" != "$remote_md5sum" ]; then
# FIXME: This is ugly and hardcoded, replace after 1.0!
# Probably a better aproach is to have the user configured
# ~/.ssh/config to contain the right username
# Probably describe it in cdist-quickstart...
scp "$source" "root@${__target_host}:${destination}"
fi
# No source? Create empty file/dir
else
case "$type" in
directory)
echo mkdir \"$destination\"
;;
file)
echo touch \"$destination\"
;;
*)
echo "Unsupported type: \"$type\"" >&2
case "$type" in
directory)
if [ -f "$__object/parameter/source" ]; then
echo "Source not supported for directory currently - FIXME" >&2
exit 1
;;
esac
fi
else
if [ no = "$(cat "$__object/explorer/exists")" ]; then
echo mkdir \"$destination\"
fi
fi
;;
file)
if [ -f "$__object/parameter/source" ]; then
source="$(cat "$__object/parameter/source")"
if [ -f "$source" ]; then
local_md5sum="$($md5sum < "$source")"
remote_md5sum="$(cat "$__object/explorer/md5sum")"
# FIXME: Is md5sum the right approach?
if [ "$local_md5sum" != "$remote_md5sum" ]; then
# FIXME: This is ugly and hardcoded, replace after 1.0!
# Probably a better aproach is to have the user configured
# ~/.ssh/config to contain the right username
# Probably describe it in cdist-quickstart...
scp "$source" "root@${__target_host}:${destination}"
fi
else
echo "Source \"$source\" does not exist." >&2
exit 1
fi
else
if [ no = "$(cat "$__object/explorer/exists")" ]; then
echo touch \"$destination\"
fi
fi
;;
symlink)
if [ ! -f "$__object/parameter/source" ]; then
echo "Source required for symlink" >&2
exit 1
fi
source="$(cat "$__object/parameter/source")"
# FIXME: handle directories or document & ignore?
echo ln -sf \"$source\" \"$destination\"
;;
*)
echo "Unsupported type: \"$type\"" >&2
exit 1
;;
esac
# Mode settings
if [ -f "$__object/parameter/mode" ]; then
mode="$(cat "$__object/parameters/mode")"
echo chmod \"$mode\" \"$destination\"

View file

@ -1 +0,0 @@
Manage /etc/issue

View file

@ -0,0 +1,41 @@
cdist-type__issue(7)
===================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__issue - Manage issue
DESCRIPTION
-----------
This cdist type allows you to easily setup /etc/issue.
REQUIRED PARAMETERS
-------------------
None.
OPTIONAL PARAMETERS
-------------------
None
EXAMPLES
--------
--------------------------------------------------------------------------------
__issue
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2011 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View file

@ -20,7 +20,7 @@
#
destination=/etc/issue
os="$(cat "out/explorer/os")"
source="$(cat "out/explorer/os")"
case "$os" in
archlinux)

View file

@ -0,0 +1,16 @@
.. . .x+=:. s
dF @88> z` ^% :8
'88bu. %8P . <k .88
. '*88888bu . .@8Ned8" :888ooo
.udR88N ^"*8888N .@88u .@^%8888" -*8888888
<888'888k beWE "888L ''888E` x88: `)8b. 8888
9888 'Y" 888E 888E 888E 8888N=*8888 8888
9888 888E 888E 888E %8" R88 8888
9888 888E 888F 888E @8Wou 9% .8888Lu=
?8888u../ .888N..888 888& .888888P` ^%888*
"8888P' `"888*"" R888" ` ^"F 'Y"
"P' "" ""
Welcome to a cdist automated system!

48
conf/type/__motd/man.text Normal file
View file

@ -0,0 +1,48 @@
cdist-type__motd(7)
===================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__motd - Manage message of the day
DESCRIPTION
-----------
This cdist type allows you to easily setup /etc/motd.
REQUIRED PARAMETERS
-------------------
None.
OPTIONAL PARAMETERS
-------------------
source::
If supplied, copy this file from the host running cdist to the target.
If not supplied, a default message will be placed onto the target.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Use cdist defaults
__motd
# Supply source file from a different type
__file --source "$__type/files/my-motd"
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2011 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

31
conf/type/__motd/manifest Executable file
View file

@ -0,0 +1,31 @@
#!/bin/sh
#
# 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/>.
#
#
destination=/etc/motd
# Select motd source
if [ -f "$__object/parameter/source" ]; then
source="$(cat "$__object/parameter/source")"
else
source="$__type/files/motd"
fi
__file "$destination" --source "$source" --type file

View file

@ -29,7 +29,7 @@ fi
state="$(cat "$__object/parameter/state")"
is_installed="$(grep "^Status: install ok installed" "$__object/explorer/pkg_status")"
is_installed="$(grep "^Status: install ok installed" "$__object/explorer/pkg_status" || true)"
case "$state" in
installed)

View file

@ -1,3 +1,14 @@
1.0.4:
* New type __motd
* New type __addifnosuchline
* Document type __issue
1.0.3: 2011-03-11
* Update regexp used for sane characters
* Allow types without parameters
* Allow type to be singleton
* Type __file learned --type symlink
1.0.2: 2011-03-09
* Add manpages: cdist-type, cdist-type__file, cdist-reference, cdist-explorer
* Make doc/man/ usable as MANPATH entry

3
doc/dev/logs/2011-03-09 Normal file
View file

@ -0,0 +1,3 @@
Steven & Nico:
- types are closed in themselves
- manpage will be stored in conf/type/NAME/man.text

2
doc/dev/todo/daninext Normal file
View file

@ -0,0 +1,2 @@
file-edit
- add_line_to_file_if_not_existing

View file

@ -1 +0,0 @@
Documentation cleanup

View file

@ -1,31 +1,32 @@
Core:
- Support singletons (see types/issue for a good reason)
- probably name them only_once and use that as the internal id!
- cdist-deploy-to: Configure more than one host
- plus parallel mode like in ccollect
Type handler:
- add dependency parameters to core available for every type
--requires
--excludes?
Stage 5 (code execution):
- check return codes
- abort on first error?
- dependencies
Dependencies:
- Add meta parameters like --requires --excludes --depends?
- Build dependency tree
- Exit on any error
- Check return codes
Types to be written/extended:
- __ssh-keys (host/user)
- __service
- __user
- __file_edit
- add_line_to_file_if_not_existing
- delete_line_from_file
- regexp replace (can probably cover all?)
- __file:
- template == [shell script] stdout
- cron
- __file: think about splitting
__file
source
mode
owner
__directory
parents
mode
owner
__link
type symbolic | hard
- __issue: add --source
Documentation:
- Describe Multi master setups
@ -36,8 +37,6 @@ Documentation:
- cdist-trigger after first run from /var/lib/cdist/out/bin?
- Different environments (production, integration, development)
- via version control
- Define how to raise errors in types
- Check all references in manpages, ensure all manpages exist, generic ones:
+ cdist
+ cdist-deploy-to
@ -47,10 +46,6 @@ Documentation:
- install packages only if not existent
- copy file only if different
- DOC document that $type/manifest is executed for every object/instance
- category 7:
- cdist-manifest(7)
- cdist-explorer
- cdist-config-layout
- ensure every file in bin/ has a correspondent manpage
- cdist-code-run-all
- cdist-config
@ -69,8 +64,4 @@ Documentation:
- cdist-run-remote
- cdist-type-build-emulation
- cdist-type-emulator
- Cleanup READMEs
- Ensure html output of manpages are published on the web
- Makefile:
- Include manpage generation

View file

@ -43,10 +43,10 @@ __file /etc/nologin --type file --source "$__type/files/default.nologin"
SEE ALSO
--------
cdist-manifest-run(1),
cdist-manifest-run-all(1),
cdist-manifest-run-init(1),
cdist-type(7)
- cdist-manifest-run(1)
- cdist-manifest-run-all(1)
- cdist-manifest-run-init(1)
- cdist-type(7)
COPYING

View file

@ -83,6 +83,9 @@ conf/type/<name>/::
This directory is referenced by the variable __type (see below).
conf/type/<name>/man.text::
Manpage in Asciidoc format (nequired for inclusion into upstream)
conf/type/<name>/manifest::
Used to generate additional objects from a type.
@ -132,9 +135,9 @@ TYPES
The following types are available:
eof
for type in cdist-type__*.text; do
name_1="${type#cdist-type}"
name_2="${name_1%.text}"
for type in man7/cdist-type__*; do
name_1="${type#man7/cdist-type}"
name_2="${name_1%.7}"
name="$name_2"
echo "- $name"
@ -175,8 +178,9 @@ SEE ALSO
--------
- cdist(7)
eof
for type in cdist-type__*.text; do
name_2="${type%.text}"
for type in man7/cdist-type__*; do
name_1="${type#man7/}"
name_2="${name_1%.7}"
name="$name_2"
echo "- ${name}(7)"

View file

@ -10,7 +10,9 @@ cdist-type - Functionality bundled
SYNOPSIS
--------
Other languages name this module or class
__TYPE ID --parameter value [--parameter value ...]
__TYPE --parameter value [--parameter value ...] (for singletons)
DESCRIPTION
@ -37,7 +39,23 @@ Internally cdist-type-emulator(1) will be called from cdist-manifest-run(1) to
save the given parameters into a cconfig database, so they can be accessed by
the manifest and gencode scripts of the type (see below).
A list of supported types can be found in the cdist-type-listing(7) manpage.
A list of supported types can be found in the cdist-reference(7) manpage.
SINGLETON TYPES
---------------
If a type is flagged as a singleton, it may me used only once. This
is useful for types which can be used only once on a system. If a type
can only be used once, it does not take an
Example:
--------------------------------------------------------------------------------
# __issue type manages /etc/issue
__issue
# Probably your own type - singletons may use parameters
__myfancysingleton --colour green
--------------------------------------------------------------------------------
HOW TO WRITE A NEW TYPE
@ -46,6 +64,7 @@ A type consists of
- parameter (optional)
- manifest (optional)
- singleton (optional)
- explorer (optional)
- gencode (optional)
@ -98,6 +117,20 @@ Always ensure the manifest is executable, otherwise cdist will not be able
to execute it.
SINGLETON - ONLY INSTANCE ONLY
------------------------------
If you want to ensure that a type can only be used once per target, you can
mark it as a singleton: Just create the (empty) file "singleton" in your type
directory. This will also change the way your type must be called:
--------------------------------------------------------------------------------
__YOURTYPE --parameter value
--------------------------------------------------------------------------------
As you can see, the ID is omitted, because it does not make any sense, if your
type can be used only once.
THE TYPE EXPLORERS
------------------
If a type needs to explore specific details, it can provide type specific
@ -153,7 +186,8 @@ If you think your type may be useful for others, ensure it works with the
current master branch of cdist and submit the git url containing the type for
inclusion to the mailinglist **cdist at cdist -- at -- l.schottelius.org**.
Ensure a corresponding manpage named cdist-type__NAME is included.
Ensure a corresponding manpage named man.text in asciidoc format with
the manpage-name "cdist-type__NAME" is included in the type directory.
SEE ALSO

View file

@ -0,0 +1,30 @@
cdist-type-addifnosuchline(1)
======================
Daniel Roth <dani-cdist--@--d-roth.li>
NAME
----
cdist-type-addifnosuchline
SYNOPSIS
--------
cdist-type-addifnosuchline Add if no such line
DESCRIPTION
-----------
cdist-type-addifnosuchline can be used to check a file for existence of a
specific line and adding that if not found
SEE ALSO
--------
cdist(7)
COPYING
-------
Copyright \(C) 2011 Daniel Roth. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).