diff --git a/cdist/conf/type/__filesystem/explorer/lsblk b/cdist/conf/type/__filesystem/explorer/lsblk new file mode 100644 index 00000000..9ae544ac --- /dev/null +++ b/cdist/conf/type/__filesystem/explorer/lsblk @@ -0,0 +1,43 @@ +#!/bin/sh +# +# 2016 - 2016 Daniel Heule (hda at sfs.biz) +# +# 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 . +# + +os=$("$__explorer/os") + +if [ -f "$__object/parameter/device" ]; then + blkdev="$(cat "$__object/parameter/device")" +else + blkdev="$__object_id" +fi + +case "$os" in + centos|fedora|redhat|suse|gentoo) + if [ ! -x "$(command -v lsblk)" ]; then + echo "lsblk is required for __filesystem type" >&2 + exit 1 + else + #echo -n $(lsblk -nd -P -o NAME,FSTYPE,LABEL,MOUNTPOINT "$blkdev" 2>/dev/null) + lsblk -nd -P -o NAME,FSTYPE,LABEL,MOUNTPOINT "$blkdev" 2>/dev/null + fi + ;; + *) + echo "__filesystem type lacks implementation for os: $os" >&2 + exit 1 + ;; +esac diff --git a/cdist/conf/type/__filesystem/gencode-remote b/cdist/conf/type/__filesystem/gencode-remote new file mode 100644 index 00000000..3ca1c498 --- /dev/null +++ b/cdist/conf/type/__filesystem/gencode-remote @@ -0,0 +1,102 @@ +#!/bin/sh +# +# 2016 - 2016 Daniel Heule (hda at sfs.biz) +# +# 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 . +# + + +fstype="$(cat "$__object/parameter/fstype")" + +if [ -f "$__object/parameter/device" ]; then + mydev="$(cat "$__object/parameter/device")" +else + mydev="$__object_id" +fi + +label="$(cat "$__object/parameter/label")" +mkfsoptions="$(cat "$__object/parameter/mkfsoptions")" + + +if [ -f "$__object/parameter/force" ]; then + # create filesystem even an other filesystem is on disk or the label is not correct, use with caution ! + forcefs="true" +else + forcefs="false" +fi + + + +blkdev_devname="$(grep -P -o 'NAME="\K[^"]*' "$__object/explorer/lsblk")" +blkdev_fstype="$(grep -P -o 'FSTYPE="\K[^"]*' "$__object/explorer/lsblk")" +blkdev_label="$(grep -P -o 'LABEL="\K[^"]*' "$__object/explorer/lsblk")" +blkdev_mountpoint="$(grep -P -o 'MOUNTPOINT="\K[^"]*' "$__object/explorer/lsblk")" + +if [ -z "$blkdev_devname" ]; then + echo "Specified device $mydev not found on target system" >&2 + exit 1 +fi + +[ "$blkdev_label" = "$label" ] && [ "$blkdev_fstype" = "$fstype" ] && exit 0 + +if [ -n "$blkdev_mountpoint" ]; then + echo "Specified device $mydev is mounted on $blkdev_mountpoint, __filesystem does NOTHING with mountd devices" >&2 + exit 0 +fi + +if [ -n "$blkdev_fstype" ] && [ "$forcefs" != "true" ]; then + if [ "$blkdev_label" != "$label" ]; then + echo "Specified device $mydev has not the spezified label: $blkdev_label, but __filesystem does NOTHING in this case without the --force option" >&2 + exit 0 + fi + if [ "$blkdev_fstype" != "$fstype" ]; then + echo "Specified device $mydev has not the spezified filesystem: $blkdev_fstype, but __filesystem does NOTHING in this case without the --force option" >&2 + exit 0 + fi +fi + + +# ok, all conditions checked, we need to format the device, lets go +opts="$mkfsoptions" +if [ -n "$label" ]; then + opts="$opts -L '$label'" +fi + +case "$fstype" in + ext2|ext3|ext4) + if [ "$forcefs" = "true" ]; then + opts="$opts -F" + fi + echo "mkfs.$fstype $opts /dev/$blkdev_devname" + ;; + btrfs) + if [ "$forcefs" = "true" ]; then + opts="$opts --force" + fi + echo "mkfs.btrfs $opts /dev/$blkdev_devname" + ;; + xfs) + if [ "$forcefs" = "true" ]; then + opts="$opts -f" + fi + echo "mkfs.xfs $opts /dev/$blkdev_devname" + ;; + *) + echo "__filesystem type lacks implementation for filesystem: $fstype" >&2 + exit 1 + ;; +esac +echo "filesystem $fstype on $mydev : /dev/$blkdev_devname created" >> "$__messages_out" diff --git a/cdist/conf/type/__filesystem/man.rst b/cdist/conf/type/__filesystem/man.rst new file mode 100644 index 00000000..c69cc839 --- /dev/null +++ b/cdist/conf/type/__filesystem/man.rst @@ -0,0 +1,80 @@ +cdist-type__filesystem(7) +========================= + +NAME +---- +cdist-type__filesystem - Create Filesystems. + + +DESCRIPTION +----------- +This cdist type allows you to create filesystems on devices. + +If the device is mounted on target, it refuses to do someting. + +If the device has a filesystem other as the specified and/or + the label is not correct, it only make a new filesystem + if you specified --force option + + +REQUIRED PARAMETERS +------------------- +fstype + Filesystem type, for example 'ext3', 'btrfs' or 'xfs' + + + +OPTIONAL PARAMETERS +------------------- +device + Blockdevice for filesystem, Defaults to object_id. + On linux, it can be any by lsblk accepted device notation + + for example + /dev/sdx + or /dev/disk/by-xxxx/xxx + or /dev/mapper/xxxx + +label + Label which sould apply on the filesystem + +mkfsoptions + Additional options which are inserted to the mkfs.xxx call. + + +BOOLEAN PARAMETERS +------------------ +force + Normaly, this type does nothing if a filesystem is found + on the target device. If you specify force, its formated + if the filesystem type or label differs from parameters + Warning: This option can easy lead into data loss ! + +MESSAGES +-------- +filesystem on : created + Filesytem was created on + + +EXAMPLES +-------- + +.. code-block:: sh + + # Ensures that device /dev/sdb is formated with xfs + __filesystem /dev/sdb --fstype xfs --label Testdisk1 + # The same thing with btrfs and disk spezified by pci path to disk 1:0 on vmware + __filesystem dev_sdb --fstype btrfs --device /dev/disk/by-path/pci-0000:0b:00.0-scsi-0:0:0:0 --label Testdisk2 + # Make sure that a multipath san device has a filesystem ... + __filesystem dev_sdb --fstype xfs --device /dev/mapper/360060e80432f560050202f22000023ff --label Testdisk3 + + +AUTHORS +------- +Daniel Heule + + +COPYING +------- +Copyright \(C) 2016 Daniel Heule. Free use of this software is +granted under the terms of the GNU General Public License version 3 or any later version (GPLv3+). diff --git a/cdist/conf/type/__filesystem/parameter/boolean b/cdist/conf/type/__filesystem/parameter/boolean new file mode 100644 index 00000000..14b33226 --- /dev/null +++ b/cdist/conf/type/__filesystem/parameter/boolean @@ -0,0 +1 @@ +force diff --git a/cdist/conf/type/__filesystem/parameter/default/label b/cdist/conf/type/__filesystem/parameter/default/label new file mode 100644 index 00000000..e69de29b diff --git a/cdist/conf/type/__filesystem/parameter/default/mkfsoptions b/cdist/conf/type/__filesystem/parameter/default/mkfsoptions new file mode 100644 index 00000000..e69de29b diff --git a/cdist/conf/type/__filesystem/parameter/optional b/cdist/conf/type/__filesystem/parameter/optional new file mode 100644 index 00000000..79dddc21 --- /dev/null +++ b/cdist/conf/type/__filesystem/parameter/optional @@ -0,0 +1,3 @@ +device +label +mkfsoptions diff --git a/cdist/conf/type/__filesystem/parameter/required b/cdist/conf/type/__filesystem/parameter/required new file mode 100644 index 00000000..98f8b69f --- /dev/null +++ b/cdist/conf/type/__filesystem/parameter/required @@ -0,0 +1 @@ +fstype diff --git a/cdist/conf/type/__locale/man.rst b/cdist/conf/type/__locale/man.rst index e46d14bd..60a4eacc 100644 --- a/cdist/conf/type/__locale/man.rst +++ b/cdist/conf/type/__locale/man.rst @@ -3,7 +3,7 @@ cdist-type__locale(7) NAME ---- -cdit-type__locale - Configure locales +cdist-type__locale - Configure locales DESCRIPTION @@ -34,7 +34,7 @@ EXAMPLES SEE ALSO -------- -:strong:`locale`\ (1), :strong:`localedef`\ (1) +:strong:`locale`\ (1), :strong:`localedef`\ (1), :strong:`cdist-type__locale_system`\ (7) AUTHORS @@ -44,5 +44,6 @@ Nico Schottelius COPYING ------- -Copyright \(C) 2013-2014 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2013-2016 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 or +later (GPLv3+). diff --git a/cdist/conf/type/__locale_system/man.rst b/cdist/conf/type/__locale_system/man.rst index 8eaa5868..fe54c01c 100644 --- a/cdist/conf/type/__locale_system/man.rst +++ b/cdist/conf/type/__locale_system/man.rst @@ -3,18 +3,27 @@ cdist-type__locale_system(7) NAME ---- -cdit-type__locale_system - Set system-wide locale +cdist-type__locale_system - Set system-wide locale DESCRIPTION ----------- This cdist type allows you to modify system-wide locale. +The name of the locale category is given as the object id +(usually you are probably interested in using LANG) OPTIONAL PARAMETERS ------------------- -locale - Any valid locale, defaults to en_US.UTF-8 + +state + present or absent, defaults to present. + If present, sets the locale category to the given value. + If absent, removes the locale category from the system file. + +value + The value for the locale category. + Defaults to en_US.UTF-8. EXAMPLES @@ -22,24 +31,36 @@ EXAMPLES .. code-block:: sh - # Set system locale to en_US.UTF-8 - __locale_system + # Set LANG to en_US.UTF-8 + __locale_system LANG # Same as above, but more explicit - __locale_system --locale en_US.UTF-8 + __locale_system LANG --value en_US.UTF-8 + + # Set category LC_MESSAGES to de_CH.UTF-8 + __locale_system LC_MESSAGES --value de_CH.UTF-8 + + # Remove setting for LC_ALL + __locale_system LC_ALL --state absent + SEE ALSO -------- -:strong:`locale`\ (1), :strong:`localedef`\ (1) +:strong:`locale`\ (1) +:strong:`localedef`\ (1) +:strong:`cdist-type__locale`\ (7) AUTHORS ------- -Carlos Ortigoza +Steven Armstrong , +Carlos Ortigoza , +Nico Schottelius COPYING ------- -Copyright \(C) 2016 Carlos Ortigoza. Free use of this software is -granted under the terms of the GNU General Public License v3 or later (GPLv3+). +Copyright \(C) 2016 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 or +later (GPLv3+). diff --git a/cdist/conf/type/__locale_system/manifest b/cdist/conf/type/__locale_system/manifest index 065b33c3..02cf48df 100644 --- a/cdist/conf/type/__locale_system/manifest +++ b/cdist/conf/type/__locale_system/manifest @@ -1,6 +1,8 @@ #!/bin/sh # -# Carlos Ortigoza (carlos.ortigoza at ungleich.ch) +# 2012-2016 Steven Armstrong (steven-cdist at armstrong.cc) +# 2016 Carlos Ortigoza (carlos.ortigoza at ungleich.ch) +# 2016 Nico Schottelius (nico.schottelius at ungleich.ch) # # This file is part of cdist. # @@ -22,22 +24,32 @@ # os=$(cat "$__global/explorer/os") -locale="$(cat "$__object/parameter/locale")" case "$os" in - centos) - __file /etc/sysconfig/i18n \ - --owner root --group root --mode 644 \ - --state exists - require="__file/etc/sysconfig/i18n" \ - __key_value LANG \ - --file /etc/sysconfig/i18n \ - --delimiter '=' \ - --value "\"$locale\"" - ;; + debian|ubuntu) + locale_conf="/etc/default/locale" + ;; + archlinux) + locale_conf="/etc/locale.conf" + ;; + redhat|centos) + locale_conf="/etc/sysconfig/i18n" + ;; *) - echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 - echo "Please contribute an implementation for it if you can." >&2 - exit 1 - ;; + echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 + echo "Please contribute an implementation for it if you can." >&2 + exit 1 + ;; esac + +__file "$locale_conf" \ + --owner root --group root --mode 644 \ + --state exists + +require="__file/$locale_conf" \ + __key_value "$locale_conf:$__object_id" \ + --file "$locale_conf" \ + --key "$__object_id" \ + --delimiter = \ + --state "$(cat "$__object/parameter/state")" \ + --value "$(cat "$__object/parameter/value")" diff --git a/cdist/conf/type/__locale_system/parameter/default/state b/cdist/conf/type/__locale_system/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__locale_system/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__locale_system/parameter/default/value b/cdist/conf/type/__locale_system/parameter/default/value new file mode 100644 index 00000000..927508f3 --- /dev/null +++ b/cdist/conf/type/__locale_system/parameter/default/value @@ -0,0 +1 @@ +en_US.UTF-8 diff --git a/cdist/conf/type/__locale_system/parameter/optional b/cdist/conf/type/__locale_system/parameter/optional index 1fc74d6c..d0460d86 100644 --- a/cdist/conf/type/__locale_system/parameter/optional +++ b/cdist/conf/type/__locale_system/parameter/optional @@ -1 +1,2 @@ -locale \ No newline at end of file +state +value diff --git a/docs/dev/show_all_exported_variables b/cdist/conf/type/__sysctl/explorer/value similarity index 81% rename from docs/dev/show_all_exported_variables rename to cdist/conf/type/__sysctl/explorer/value index 18acceca..fc85b3d8 100755 --- a/docs/dev/show_all_exported_variables +++ b/cdist/conf/type/__sysctl/explorer/value @@ -1,6 +1,6 @@ #!/bin/sh # -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2014 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -17,9 +17,6 @@ # You should have received a copy of the GNU General Public License # along with cdist. If not, see . # -# -# Generate documentation of exported variables -# - -cat bin/* | awk '/^export/ { print $2 }' +# get the current runtime value +sysctl -n "$__object_id" || true diff --git a/docs/dev/sync-to-testhost b/cdist/conf/type/__sysctl/gencode-remote similarity index 67% rename from docs/dev/sync-to-testhost rename to cdist/conf/type/__sysctl/gencode-remote index cc59eb8d..0f3b0b40 100755 --- a/docs/dev/sync-to-testhost +++ b/cdist/conf/type/__sysctl/gencode-remote @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2014 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -17,12 +17,14 @@ # You should have received a copy of the GNU General Public License # along with cdist. If not, see . # -# -# Sync repo to testhosts -# -dirs="cdist cdist-nutzung" +value_should="$(cat "$__object/parameter/value")" +value_is="$(cat "$__object/explorer/value")" -for dir in $dirs; do - rsync -av --delete /home/users/nico/p/$dir/ root@rnic01:$dir -done +if [ "$value_should" = "$value_is" ]; then + # Nothing to do + exit 0 +fi + +# set the current runtime value +printf 'sysctl -w %s="%s"\n' "$__object_id" "$value_should" diff --git a/cdist/conf/type/__sysctl/man.rst b/cdist/conf/type/__sysctl/man.rst new file mode 100644 index 00000000..d5c6495c --- /dev/null +++ b/cdist/conf/type/__sysctl/man.rst @@ -0,0 +1,39 @@ +cdist-type__sysctl(7) +===================== + +NAME +---- +cdist-type__sysctl - manage sysctl settings + + +DESCRIPTION +----------- +Manages permanent as well as runtime sysctl settings. +Permament settings are set by managing entries in /etc/sysctl.conf. +Runtime settings are set by directly calling the sysctl executable. + + +REQUIRED PARAMETERS +------------------- +value:: + The value to set for the given key (object_id) + + +EXAMPLES +-------- + +.. code-block:: sh + + __sysctl net.ipv4.ip_forward --value 1 + + +AUTHORS +------- +Steven Armstrong + + +COPYING +------- +Copyright \(C) 2014 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 or +later (GPLv3+). diff --git a/cdist/conf/type/__sysctl/manifest b/cdist/conf/type/__sysctl/manifest new file mode 100755 index 00000000..dd317806 --- /dev/null +++ b/cdist/conf/type/__sysctl/manifest @@ -0,0 +1,39 @@ +#!/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 . +# + + +os=$(cat "$__global/explorer/os") + +case "$os" in + redhat|centos|ubuntu|debian|archlinux) + : + ;; + *) + echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 + echo "Please contribute an implementation for it if you can." >&2 + exit 1 + ;; +esac + +__key_value "$__object_name" \ + --key "$__object_id" \ + --file /etc/sysctl.conf \ + --value "$(cat "$__object/parameter/value")" \ + --delimiter '=' diff --git a/cdist/conf/type/__sysctl/parameter/required b/cdist/conf/type/__sysctl/parameter/required new file mode 100644 index 00000000..6d4e1507 --- /dev/null +++ b/cdist/conf/type/__sysctl/parameter/required @@ -0,0 +1 @@ +value diff --git a/docs/changelog b/docs/changelog index ba52d0bd..054910c1 100644 --- a/docs/changelog +++ b/docs/changelog @@ -1,5 +1,10 @@ Changelog --------- +next: + * New type __filesystem: manage filesystems on devices ( Daniel Heule ) + + * New type: __locale_system (Steven Armstrong, Carlos Ortigoza, Nico Schottelius) + * New type: __sysctl (Steven Armstrong) next: * New type: __keyboard: Set keyboard layout (Carlos Ortigoza) @@ -155,7 +160,7 @@ next: * Documentation: Cleanup up, added HTML links (Tomas Pospisek) * Explorer interfaces: Remove test output (Daniel Heule) * Type __jail: Add messaging support (Jake Guffey) - + 3.1.3: 2014-04-29 * New Type: __yum_repo (Steven Armstrong) * Type __hostname: Add support for CentOS (Nico Schottelius) @@ -317,7 +322,7 @@ next: * New Type: __postfix_postconf (Steven Armstrong) * New Type: __postfix_postmap (Steven Armstrong) * New Type: __postfix_reload (Steven Armstrong) - * Type __line: Ensure regex does not contain / + * Type __line: Ensure regex does not contain / * Type __ssh_authorized_keys: Bugfix: Preserve ownership (Steven Armstrong) 2.3.3: 2013-09-09 @@ -395,7 +400,7 @@ next: * Support for CDIST_PATH (Steven Armstrong) 2.1.0pre8: 2012-11-15 - * Type cleanup: __apt_ppa, __apt_ppa_update_index, __file, + * Type cleanup: __apt_ppa, __apt_ppa_update_index, __file, __ssh_authorized_key, __timezone, all install types (Steven Armstrong) * Types: Remove all parameter changing code (Nico Schottelius) * Type __rvm_ruby: Change parameter "default" to be boolean (Nico Schottelius) @@ -459,7 +464,7 @@ next: * Feature __group: Added support for FreeBSD (Jake Guffey) * New Type: __package_zypper (Nico Schottelius) * Feature Types: Initial Support for SuSE Linux (Nico Schottelius) - + 2.0.13: 2012-06-05 * Bugfix __ssh_authorized_key: Ensure it sets proper group (contradict) * Bugfix __addifnosuchline: Fixed quotes/interpolation bug ("a b" became "a b") (Nico Schottelius) @@ -491,7 +496,7 @@ next: * Various smaller bugfixes (Chris Lamb) 2.0.9: 2012-03-12 - * Cleanup documentation: Fix environment variable list to be properly + * Cleanup documentation: Fix environment variable list to be properly displayed (Giel van Schijndel) * Cleanup documentation: Some minor corrections * New Type: __package_opkg (Giel van Schijndel) @@ -500,7 +505,7 @@ next: * Feature __package: Support for OpenWRT (Giel van Schijndel) * Feature __start_on_boot: Support for OpenWRT (Giel van Schijndel) * Feature __start_on_boot: Support for Amazon Linux (Matt Coddington) - * New Example: Use rsync to backup files (Matt Coddington) + * New Example: Use rsync to backup files (Matt Coddington) * Feature core: Exit non-zero, if configuration failed (Nico Schottelius) * Documentation: Describe how to do templating (Aurélien Bondis) @@ -545,7 +550,7 @@ next: (Steven Armstrong, Daniel Maher) * Cleanup: Explicitly require Python >= 3.2 (do not fail implicitly) (Nico Schottelius) * Documentation: (Re)write of the tutorial (Nico Schottelius) - * Feature: __addifnosuchline supports matching on + * Feature: __addifnosuchline supports matching on regular expressions (Daniel Maher) * Feature: __directory, __file, __link: Add --state parameter (Steven Armstrong) diff --git a/docs/dev/fancy-ideas b/docs/dev/fancy-ideas deleted file mode 100644 index 8ee290cd..00000000 --- a/docs/dev/fancy-ideas +++ /dev/null @@ -1,17 +0,0 @@ -== types with namespaces == -- allow types to have namespaces, e.g. - __path/my/type -implemented as a proof of concept at: -https://github.com/asteven/cdist/tree/type-namespaces - - - -Execute all global explorers only when needed #286 - -My intention is to create a brunch of global explorer which are of use in some cases and makes cdist more userfriendly. But now, all global explorers are allways executed, even the return value of the explorers is never used. - -I think a possible approach can be to replace the result files with pipes, and on first read of the pipe, the explorer is executed by the core, all following read calls from the pipe are answered from the core with the result of the first real execute of the explorer. - -So cdist can have an unlimited number of global explorers and only used explorers are executed on the target host, all other explorers laying around are simply ignored. - -Also a possible approach would be to create a new explorer type (dynamic explorers) which are sitting in a different directory to (for example dynexploer) and only this ones are executed with the conditional approach explained above. So the overhead to create pipes and monitor it is only in place on explorers which are not interesting for everyone ... diff --git a/docs/dev/git-post-commit-hook b/docs/dev/git-post-commit-hook deleted file mode 100755 index b16caa2a..00000000 --- a/docs/dev/git-post-commit-hook +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env bash -# Distributed under the terms of the GNU General Public License v2 -# Copyright (c) 2006 Fernando J. Pereda -# -# Git CIA bot in bash. (no, not the POSIX shell, bash). -# It is *heavily* based on Git ciabot.pl by Petr Baudis. -# -# It is meant to be run either on a post-commit hook or in an update -# hook: -# -# post-commit: It parses latest commit and current HEAD to get the -# information it needs. -# -# update: You have to call it once per merged commit: -# -# refname=$1 -# oldhead=$2 -# newhead=$3 -# for merged in $(git rev-list ${oldhead}..${newhead} | tac) ; do -# /path/to/ciabot.bash ${refname} ${merged} -# done -# - -# The project as known to CIA -project="cdist" - -# Set to true if you want the full log to be sent -noisy=false - -# Addresses for the e-mail -from="nico-cia.vc@schottelius.org" -to="cia@cia.vc" - -# SMTP client to use -sendmail="/usr/sbin/sendmail -f ${from} ${to}" - -# Changeset URL -url="http://git.schottelius.org/?p=${project};a=commit;h=@@sha1@@" - -# You shouldn't be touching anything else. -if [[ $# = 0 ]] ; then - refname=$(git symbolic-ref HEAD 2>/dev/null) - merged=$(git rev-parse HEAD) -else - refname=$1 - merged=$2 -fi - -refname=${refname##refs/heads/} - -gitver=$(git --version) -gitver=${gitver##* } - -rev=$(git describe ${merged} 2>/dev/null) -[[ -z ${rev} ]] && rev=${merged:0:12} - -rawcommit=$(git cat-file commit ${merged}) - -author=$(sed -n -e '/^author .*<\([^@]*\).*$/s--\1-p' \ - <<< "${rawcommit}") - -logmessage=$(sed -e '1,/^$/d' <<< "${rawcommit}") -${noisy} || logmessage=$(head -n 1 <<< "${logmessage}") -logmessage=${logmessage//&/&} -logmessage=${logmessage///>} - -ts=$(sed -n -e '/^author .*> \([0-9]\+\).*$/s--\1-p' \ - <<< "${rawcommit}") - -out=" - - - CIA Bash client for Git - ${gitver} - http://dev.gentoo.org/~ferdy/stuff/ciabot.bash - - - ${project} - ${refname} - - ${ts} - - - ${author} - ${rev} - - $(git diff-tree -r --name-only ${merged} | - sed -e '1d' -e 's-.*-&-') - - -${logmessage} - - ${url//@@sha1@@/${merged}} - - -" - -${sendmail} << EOM -Message-ID: <${merged:0:12}.${author}@${project}> -From: ${from} -To: ${to} -Content-type: text/xml -Subject: DeliverXML -${out} -EOM - -# vim: set tw=70 : diff --git a/docs/dev/todo/3.0 b/docs/dev/todo/3.0 deleted file mode 100644 index 97699879..00000000 --- a/docs/dev/todo/3.0 +++ /dev/null @@ -1 +0,0 @@ -- remove __self and all references to it diff --git a/docs/dev/todo/niconext b/docs/dev/todo/niconext deleted file mode 100644 index aa5f6001..00000000 --- a/docs/dev/todo/niconext +++ /dev/null @@ -1,25 +0,0 @@ -- introduce default parameters - - valid for optional parameters only - - stored in parameter/default/$name - - - when/where to save? in emulator? - - read vi fsproperty? - -- cleanup object_id handling - - have a look at singletons - -- update/create docs - - cdist-cache:: - How to get use information about the hosts we have been working on [advanced] - - cdist-scaling-tuning:: - How to scale out with cdist and which tunings to apply. [advanced] - - cdist-installation - How to use cdist to install hosts - - check speech publishing - - and speeches, which may be outdated as well - - Create new video for cdist 2.x - http://www.youtube.com/watch?v=PRMjzy48eTI - - - exec flag is not true for manifest anymore - - SSH HINTS - ssh agent - diff --git a/docs/dev/todo/performance-ideas b/docs/dev/todo/performance-ideas index bbbfe427..0320affa 100644 --- a/docs/dev/todo/performance-ideas +++ b/docs/dev/todo/performance-ideas @@ -1,6 +1,3 @@ -- Migrate scripts from bin/* to functions in bin/cdist-deploy-to - Use one pipe-shell for type execution - Parallelise gencode and code-run of all objects - Diff against local cache only instead of real target -- Use only one ssh session? - - Can be indirectly improved via ssh config already! diff --git a/docs/dev/todo/steven b/docs/dev/todo/steven deleted file mode 100644 index 2aacaa42..00000000 --- a/docs/dev/todo/steven +++ /dev/null @@ -1,118 +0,0 @@ -autorequire: - - objects defined in type manifests should be automatically prerequisites of the current object - - __foo/some-id - __other other-id --state present - => require="__other/other-id" __foo/some-id - - -metaparameters: - - steal the metaparameters from puppet: - - # I have to be there before the other one - __directory /etc/ssh \ - --before __file/etc/ssh/sshd_config - - # the other one has to be there before me - __file /etc/ssh/sshd_config \ - --after __directory/etc/ssh - - # if I change, tell the other one about it - __file /etc/ssh/sshd_config \ - --notify __init_script/etc/rc.d/sshd - - # whenever the other one changes, I want to know - __init_script /etc/rc.d/sshd \ - --subscribe __file/etc/ssh/sshd_config - - - how does a type react to a received 'event'? - - maybe something like: - __some_type/ - manifest - ... - gencode-refresh - ... - - gencode-refresh -> code-refresh -> ssh $target sh -e code-refresh - - - - -logging: - - logging from type emulator without clobbering stdout - maybe implement logging server as described here [1] - [1] http://docs.python.org/py3k/howto/logging-cookbook.html#configuration-server-example - - - use different logger to limit output to current area of interest, - e.g. - explorer.$target_host: explorer related messages for the run for $target_host - manifest.$target_host: manifest related messages for the run for $target_host - ... - then one could filter e.g. on explorer.* - - - more granular debug output, - [2] http://blog.ooz.ie/2011/03/python-logging-extending-standard.html - - - -tests: - - __init__(): - - sets up env: __target_host - - run_initial_manifest(): - - parameter is actually used (from __init__) - - ensure changing the manifest actually runs a different manifest - -> give ConfigInstall Constructor different manifest - -> different manifest is executed. - - test all submitted (from core to type manifest) variables: - - ENVIRONMENT - - they are set - - they contain the correct values - - run_type_manifest(): - - test all submitted (from core to type manifest) variables: - - ENVIRONMENT - - they are set - - they contain the correct values - - same tests as for test_initial_manifest_*? - - run_manifest(): - - test all submitted variables: - - ENVIRONMENT - - including __debug, if debug - - they are set - - they contain the correct values - - does $require work? - - check that exception raised, if manifest is not existent - - object_run(): - - ensure no object is run twice - - ensure requirements are taken into account? - - and order of run is adjusted - - check (from extern?) that all needed variables are setup - - ensure no code-{local, remote} is created, - if gencode is not producing code - - ensure THAT code-{local, remote} contains what gencode created - - abort if gencode-* fails - - abort if code-* fails - - abort == raise(FooException) - - gencode-*: ensure ENVIRONMENT is setup correctly - - run_type_explorer() - - ensure ALL type explores have been run - - ensure output is saved to correct path - - ensure a type with {0,1,2} explorers works ? - - none, one, multiple - - ensure ENVIRONMENT is setup correctly - - fails if ANY of the given explorer fails - - run_global_explorers(): - - ensure ALL type explores have been run - - ensure output is saved to correct path - - ensure a type with {0,1,2} explorers works ? - - none, one, multiple - - ensure ENVIRONMENT is setup correctly - - fails if ANY of the given explorer fails - -Code fixes needed: - - - shutil, os.mkdir, etc. everywhere: catch/reraise exceptions correctly diff --git a/docs/dev/todo/tests b/docs/dev/todo/tests deleted file mode 100644 index d2101980..00000000 --- a/docs/dev/todo/tests +++ /dev/null @@ -1,27 +0,0 @@ -Tests needed for config_install: - - cleanup() - - Fail if cache_dir from previous run cannot be deleted - - Fail if cache_dir cannot be created from current out_dir - - filter() - - ensure logformat is changed: target host is prefixed: - LOGLEVEL: target_host: MESSAGE - - link_emulator(): - - ensure that links to ALL types are created - - ensure that links points to correct executable - - i.e. readlink() works - - AND target of readlink is the correct executable - - remote_mkdir() - - is directory created - - remove_remote_path - - is path removed - - transfer_path - - is src to dst transferred? - -emulator: - may only be called with __ as prefix - fail otherwise!