diff --git a/.gitignore b/.gitignore index 2a193c2a..4258c2eb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,26 +2,29 @@ .*.swp # Ignore generated manpages -docs/man/.marker -docs/man/man1/*.1 -docs/man/man7/*.7 -docs/man/man*/*.html -docs/man/man*/*.xml -docs/man/man*/docbook-xsl.css -docs/man/man7/cdist-type__*.rst -docs/man/man7/cdist-reference.rst +docs/src/.marker +docs/src/man1/*.1 +docs/src/man7/*.7 +docs/src/man7/cdist-type__*.rst +docs/src/cdist-reference.rst # Ignore cdist cache for version control /cache/ # Python: cache, distutils, distribution in general __pycache__/ +*.pyc MANIFEST dist/ cdist/version.py -#sphinx build dir +# sphinx build dirs, cache _build/ +docs/dist + +# Ignore temp files used for signing +cdist-*.tar.gz +cdist-*.tar.gz.asc # Packaging: Archlinux /PKGBUILD diff --git a/Makefile b/Makefile index e584fc63..417140c5 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ helper=./bin/build-helper -MANDIR=docs/man +DOCS_SRC_DIR=docs/src SPEECHDIR=docs/speeches TYPEDIR=cdist/conf/type @@ -36,17 +36,19 @@ CHANGELOG_FILE=docs/changelog PYTHON_VERSION=cdist/version.py -SPHINXM=make -C $(MANDIR) man -SPHINXH=make -C $(MANDIR) html +SPHINXM=make -C $(DOCS_SRC_DIR) man +SPHINXH=make -C $(DOCS_SRC_DIR) html +SPHINXC=make -C $(DOCS_SRC_DIR) clean ################################################################################ # Manpages # -MAN1DSTDIR=$(MANDIR)/man1 -MAN7DSTDIR=$(MANDIR)/man7 +MAN1DSTDIR=$(DOCS_SRC_DIR)/man1 +MAN7DSTDIR=$(DOCS_SRC_DIR)/man7 # Manpages #1: Types # Use shell / ls to get complete list - $(TYPEDIR)/*/man.rst does not work -MANTYPESRC=$(shell ls $(TYPEDIR)/*/man.rst) +# Using ls does not work if no file with given pattern exist, so use wildcard +MANTYPESRC=$(wildcard $(TYPEDIR)/*/man.rst) MANTYPEPREFIX=$(subst $(TYPEDIR)/,$(MAN7DSTDIR)/cdist-type,$(MANTYPESRC)) MANTYPES=$(subst /man.rst,.rst,$(MANTYPEPREFIX)) @@ -55,32 +57,35 @@ $(MAN7DSTDIR)/cdist-type%.rst: $(TYPEDIR)/%/man.rst ln -sf "../../../$^" $@ # Manpages #2: reference -MANREF=$(MAN7DSTDIR)/cdist-reference.rst -MANREFSH=$(MANDIR)/cdist-reference.rst.sh +DOCSREF=$(MAN7DSTDIR)/cdist-reference.rst +DOCSREFSH=$(DOCS_SRC_DIR)/cdist-reference.rst.sh -$(MANREF): $(MANREFSH) - $(MANREFSH) +$(DOCSREF): $(DOCSREFSH) + $(DOCSREFSH) # Manpages #3: generic part -mansphinxman: $(MANTYPES) $(MANREF) +man: $(MANTYPES) $(DOCSREF) $(PYTHON_VERSION) $(SPHINXM) -mansphinxhtml: $(MANTYPES) $(MANREF) +html: $(MANTYPES) $(DOCSREF) $(PYTHON_VERSION) $(SPHINXH) -man: mansphinxman mansphinxhtml +docs: man html + +docs-clean: + $(SPHINXC) # Manpages #5: release part MANWEBDIR=$(WEBBASE)/man/$(CHANGELOG_VERSION) -MANBUILDDIR=$(MANDIR)/_build/html +HTMLBUILDDIR=docs/dist/html -man-dist: man +docs-dist: html rm -rf "${MANWEBDIR}" mkdir -p "${MANWEBDIR}" # mkdir -p "${MANWEBDIR}/man1" "${MANWEBDIR}/man7" # cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${MANWEBDIR}/man1 # cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${MANWEBDIR}/man7 - cp -R ${MANBUILDDIR}/* ${MANWEBDIR} + cp -R ${HTMLBUILDDIR}/* ${MANWEBDIR} cd ${MANWEBDIR} && git add . && git commit -m "cdist manpages update: $(CHANGELOG_VERSION)" || true man-latest-link: web-pub @@ -88,6 +93,22 @@ man-latest-link: web-pub ssh staticweb.ungleich.ch \ "cd /home/services/www/nico/nico.schottelius.org/www/software/cdist/man/ && rm -f latest && ln -sf "$(CHANGELOG_VERSION)" latest" +# Manpages: .cdist Types +DOT_CDIST_PATH=${HOME}/.cdist +DOTMAN7DSTDIR=$(MAN7DSTDIR) +DOTTYPEDIR=$(DOT_CDIST_PATH)/type +DOTMANTYPESRC=$(wildcard $(DOTTYPEDIR)/*/man.rst) +DOTMANTYPEPREFIX=$(subst $(DOTTYPEDIR)/,$(DOTMAN7DSTDIR)/cdist-type,$(DOTMANTYPESRC)) +DOTMANTYPES=$(subst /man.rst,.rst,$(DOTMANTYPEPREFIX)) + +# Link manpage: do not create man.html but correct named file +$(DOTMAN7DSTDIR)/cdist-type%.rst: $(DOTTYPEDIR)/%/man.rst + ln -sf "$^" $@ + +# Manpages #3: generic part +dotman: $(DOTMANTYPES) + $(SPHINXM) + ################################################################################ # Speeches # @@ -127,7 +148,7 @@ web-doc: web-dist: web-blog web-doc -web-pub: web-dist man-dist speeches-dist +web-pub: web-dist docs-dist speeches-dist cd "${WEBDIR}" && make pub web-release-all: man-latest-link @@ -192,12 +213,12 @@ release: # clean: - rm -f $(MAN7DSTDIR)/cdist-reference.rst + rm -f $(DOCS_SRC_DIR)/cdist-reference.rst - find "$(MANDIR)" -mindepth 2 -type l \ + find "$(DOCS_SRC_DIR)" -mindepth 2 -type l \ | xargs rm -f - make -C $(MANDIR) clean + make -C $(DOCS_SRC_DIR) clean find * -name __pycache__ | xargs rm -rf @@ -208,6 +229,10 @@ clean: rm -f MANIFEST PKGBUILD rm -rf dist/ + # Signed release + rm -f cdist-*.tar.gz + rm -f cdist-*.tar.gz.asc + distclean: clean rm -f cdist/version.py @@ -221,3 +246,6 @@ pub: test: $(helper) $@ + +pep8: + $(helper) $@ diff --git a/bin/build-helper b/bin/build-helper index 31789a2e..46b139d1 100755 --- a/bin/build-helper +++ b/bin/build-helper @@ -153,7 +153,90 @@ eof fi printf "Enter tag description for ${target_version}: " read tagmessage - git tag "$target_version" -m "$$tagmessage" + + # setup for signed tags: + # gpg --fulL-gen-key + # gpg --list-secret-keys --keyid-format LONG + # git config --local user.signingkey + # for exporting pub key: + # gpg --armor --export > pubkey.asc + # gpg --output pubkey.gpg --export + # show tag with signature + # git show + # verify tag signature + # git tag -v + # + # gpg verify signature + # gpg --verify + # gpg --no-default-keyring --keyring --verify + # Ensure gpg-agent is running. + export GPG_TTY=$(tty) + gpg-agent + + git tag -s "$target_version" -m "$tagmessage" + git push --tags + ;; + + sign-git-release) + if [ $# -lt 2 ] + then + printf "usage: $0 sign-git-release TAG TOKEN [ARCHIVE]\n" + printf " if ARCHIVE is not specified then it is created\n" + exit 1 + fi + tag="$1" + if ! git rev-parse -q --verify "${tag}" >/dev/null 2>&1 + then + printf "Tag \"${tag}\" not found.\n" + exit 1 + fi + token="$2" + if [ $# -gt 2 ] + then + archivename="$3" + else + archivename="cdist-${tag}.tar.gz" + git archive --prefix="cdist-${tag}/" -o "${archivename}" "${tag}" \ + || exit 1 + fi + gpg --armor --detach-sign "${archivename}" || exit 1 + + # make github release + curl -H "Authorization: token ${token}" \ + --request POST \ + --data "{ \"tag_name\":\"${tag}\", \ + \"target_commitish\":\"master\", \ + \"name\": \"${tag}\", \ + \"body\":\"${tag}\", \ + \"draft\":false, \ + \"prerelease\": false}" \ + "https://api.github.com/repos/ungleich/cdist/releases" || exit 1 + + # get release ID + repoid=$(curl "https://api.github.com/repos/ungleich/cdist/releases/tags/${tag}" \ + | python3 -c 'import json; import sys; print(json.loads(sys.stdin.read())["id"])') \ + || exit 1 + + # upload archive and then signature + curl -H "Authorization: token ${token}" \ + -H "Accept: application/vnd.github.manifold-preview" \ + -H "Content-Type: application/x-gtar" \ + --data-binary @${archivename} \ + "https://uploads.github.com/repos/ungleich/cdist/releases/${repoid}/assets?name=${archivename}" \ + || exit 1 + curl -H "Authorization: token ${token}" \ + -H "Accept: application/vnd.github.manifold-preview" \ + -H "Content-Type: application/pgp-signature" \ + --data-binary @${archivename}.asc \ + "https://uploads.github.com/repos/ungleich/cdist/releases/${repoid}/assets?name=${archivename}.asc" \ + || exit 1 + + # remove generated files (archive and asc) + if [ $# -eq 2] + then + rm -f "${archivename}" + fi + rm -f "${archivename}.asc" ;; release) @@ -166,9 +249,10 @@ eof # First check everything is sane "$0" check-date "$0" check-unittest + "$0" check-pep8 # Generate version file to be included in packaging - "$0" version + "$0" target-version # Ensure the git status is clean, else abort if ! git diff-index --name-only --exit-code HEAD ; then @@ -206,8 +290,10 @@ eof "$0" check-date "$0" check-unittest - # Generate man pages (indirect check if they build) - make man + # Generate documentation (man and html) + # First, clean old generated docs + make docs-clean + make docs # Generate speeches (indirect check if they build) make speeches @@ -218,6 +304,11 @@ eof # Tag the current commit "$0" release-git-tag + # sign git tag + printf "Enter github authentication token: " + read token + "$0" sign-git-release "${target_version}" "${token}" + # Also merge back the version branch if [ "$masterbranch" = yes ]; then git checkout master @@ -268,6 +359,32 @@ eof fi ;; + pep8) + pep8 "${basedir}" "${basedir}/scripts/cdist" | less + ;; + + check-pep8) + "$0" pep8 + echo "Please review pep8 report." + while true + do + echo "Continue (yes/no)?" + any= + read any + case "$any" in + yes) + break + ;; + no) + exit 1 + ;; + *) + echo "Please answer with 'yes' or 'no' explicitly." + ;; + esac + done + ;; + version-branch) "$0" changelog-version | cut -d. -f '1,2' ;; @@ -276,6 +393,11 @@ eof echo "VERSION = \"$(git describe)\"" > cdist/version.py ;; + target-version) + target_version=$($0 changelog-version) + echo "VERSION = \"${target_version}\"" > cdist/version.py + ;; + *) echo "Unknown helper target $@ - aborting" exit 1 diff --git a/bin/build-helper.freebsd b/bin/build-helper.freebsd new file mode 100755 index 00000000..183129db --- /dev/null +++ b/bin/build-helper.freebsd @@ -0,0 +1,468 @@ +#!/bin/sh +# +# 2011-2013 Nico Schottelius (nico-cdist at schottelius.org) +# 2016 Darko Poljak (darko.poljak at gmail.com) +# +# 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 . +# +# +# This file contains the heavy lifting found usually in the Makefile +# + +# vars for make +helper=$0 + +basedir=${0%/*}/../ +# run_as is used to check how the script is called (by $0 value) +# currently supported sufixes for $0 are: +# .freebsd - run as freebsd +basename=${0##*/} +run_as=${basename#*.} +case "$run_as" in + freebsd) + to_a=cdist-configuration-management + to_d=googlegroups.com + from_a=darko.poljak + from_d=gmail.com + ml_name="Darko Poljak" + ml_sig_name="Darko" + + # vars for make + WEBDIR=../vcs/www.nico.schottelius.org + ;; + *) + to_a=cdist + to_d=l.schottelius.org + from_a=nico-cdist + from_d=schottelius.org + ml_name="Nico -telmich- Schottelius" + ml_sig_name="Nico" + + # vars for make + WEBDIR=$$HOME/vcs/www.nico.schottelius.org + ;; +esac + +# Change to checkout directory +cd "$basedir" + +version=$(git describe) + +option=$1; shift + +case "$option" in + print-make-vars) + printf "helper: ${helper}\n" + printf "WEBDIR: ${WEBDIR}\n" + ;; + print-runas) + printf "run_as: $run_as\n" + ;; + changelog-changes) + if [ "$#" -eq 1 ]; then + start=$1 + else + start="[[:digit:]]" + fi + + end="[[:digit:]]" + + awk -F: "BEGIN { start=0 } + { + if(start == 0) { + if (\$0 ~ /^$start/) { + start = 1 + } + } else { + if (\$0 ~ /^$end/) { + exit + } else { + print \$0 + } + } + }" "$basedir/docs/changelog" + ;; + + changelog-version) + # get version from changelog + grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/:.*//' + ;; + + check-date) + # verify date in changelog is today + date_today="$(date +%Y-%m-%d)" + date_changelog=$(grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/.*: //') + + if [ "$date_today" != "$date_changelog" ]; then + echo "Date in changelog is not today" + echo "Changelog: $date_changelog" + exit 1 + fi + ;; + + check-unittest) + "$0" test + ;; + + blog) + version=$1; shift + blogfile=$1; shift + dir=${blogfile%/*} + file=${blogfile##*/} + + + cat << eof > "$blogfile" +[[!meta title="Cdist $version released"]] + +Here's a short overview about the changes found in version ${version}: + +eof + + $0 changelog-changes "$version" >> "$blogfile" + + cat << eof >> "$blogfile" +For more information visit the [[cdist homepage|software/cdist]]. + +[[!tag cdist config unix]] +eof + cd "$dir" + git add "$file" + # Allow git commit to fail if there are no changes + git commit -m "cdist blog update: $version" "$blogfile" || true + ;; + + ml-release) + if [ $# -ne 1 ]; then + echo "$0 ml-release version" >&2 + exit 1 + fi + + version=$1; shift + + to=${to_a}@${to_d} + from=${from_a}@${from_d} + + ( + cat << eof +From: ${ml_name} <$from> +To: cdist mailing list <$to> +Subject: cdist $version released + +Hello .*, + +cdist $version has been released with the following changes: + +eof + + "$0" changelog-changes "$version" + cat << eof + +Cheers, + +${ml_sig_name} + +-- +Automatisation at its best level. With cdist. +eof + ) | /usr/sbin/sendmail -f "$from" "$to" + ;; + + release-git-tag) + target_version=$($0 changelog-version) + if git rev-parse --verify refs/tags/$target_version 2>/dev/null; then + echo "Tag for $target_version exists, aborting" + exit 1 + fi + printf "Enter tag description for ${target_version}: " + read tagmessage + + # setup for signed tags: + # gpg --fulL-gen-key + # gpg --list-secret-keys --keyid-format LONG + # git config --local user.signingkey + # for exporting pub key: + # gpg --armor --export > pubkey.asc + # gpg --output pubkey.gpg --export + # show tag with signature + # git show + # verify tag signature + # git tag -v + # + # gpg verify signature + # gpg --verify + # gpg --no-default-keyring --keyring --verify + # Ensure gpg-agent is running. + export GPG_TTY=$(tty) + gpg-agent + + git tag -s "$target_version" -m "$tagmessage" + git push --tags + ;; + + sign-git-release) + if [ $# -lt 2 ] + then + printf "usage: $0 sign-git-release TAG TOKEN [ARCHIVE]\n" + printf " if ARCHIVE is not specified then it is created\n" + exit 1 + fi + tag="$1" + if ! git rev-parse -q --verify "${tag}" >/dev/null 2>&1 + then + printf "Tag \"${tag}\" not found.\n" + exit 1 + fi + token="$2" + if [ $# -gt 2 ] + then + archivename="$3" + else + archivename="cdist-${tag}.tar.gz" + git archive --prefix="cdist-${tag}/" -o "${archivename}" "${tag}" \ + || exit 1 + fi + gpg --armor --detach-sign "${archivename}" || exit 1 + + # make github release + curl -H "Authorization: token ${token}" \ + --request POST \ + --data "{ \"tag_name\":\"${tag}\", \ + \"target_commitish\":\"master\", \ + \"name\": \"${tag}\", \ + \"body\":\"${tag}\", \ + \"draft\":false, \ + \"prerelease\": false}" \ + "https://api.github.com/repos/ungleich/cdist/releases" || exit 1 + + # get release ID + repoid=$(curl "https://api.github.com/repos/ungleich/cdist/releases/tags/${tag}" \ + | python3 -c 'import json; import sys; print(json.loads(sys.stdin.read())["id"])') \ + || exit 1 + + # upload archive and then signature + curl -H "Authorization: token ${token}" \ + -H "Accept: application/vnd.github.manifold-preview" \ + -H "Content-Type: application/x-gtar" \ + --data-binary @${archivename} \ + "https://uploads.github.com/repos/ungleich/cdist/releases/${repoid}/assets?name=${archivename}" \ + || exit 1 + curl -H "Authorization: token ${token}" \ + -H "Accept: application/vnd.github.manifold-preview" \ + -H "Content-Type: application/pgp-signature" \ + --data-binary @${archivename}.asc \ + "https://uploads.github.com/repos/ungleich/cdist/releases/${repoid}/assets?name=${archivename}.asc" \ + || exit 1 + + # remove generated files (archive and asc) + if [ $# -eq 2] + then + rm -f "${archivename}" + fi + rm -f "${archivename}.asc" + ;; + + release) + set -e + target_version=$($0 changelog-version) + target_branch=$($0 version-branch) + + echo "Beginning release process for $target_version" + + # First check everything is sane + "$0" check-date + "$0" check-unittest + "$0" check-pep8 + + # Generate version file to be included in packaging + "$0" target-version + + # Ensure the git status is clean, else abort + if ! git diff-index --name-only --exit-code HEAD ; then + echo "Unclean tree, see files above, aborting" + exit 1 + fi + + # Ensure we are on the master branch + masterbranch=yes + if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then + echo "Releases are happening from the master branch, aborting" + + echo "Enter the magic word to release anyway" + read magicword + + if [ "$magicword" = "iknowwhatido" ]; then + masterbranch=no + else + exit 1 + fi + fi + + if [ "$masterbranch" = yes ]; then + # Ensure version branch exists + if ! git rev-parse --verify refs/heads/$target_branch 2>/dev/null; then + git branch "$target_branch" + fi + + # Merge master branch into version branch + git checkout "$target_branch" + git merge master + fi + + # Verify that after the merge everything works + "$0" check-date + "$0" check-unittest + + # Generate documentation (man and html) + # First, clean old generated docs + make helper=${helper} WEBDIR=${WEBDIR} docs-clean + make helper=${helper} WEBDIR=${WEBDIR} docs + + # Generate speeches (indirect check if they build) + make helper=${helper} WEBDIR=${WEBDIR} speeches + + ############################################################# + # Everything green, let's do the release + + # Tag the current commit + "$0" release-git-tag + + # sign git tag + printf "Enter github authentication token: " + read token + "$0" sign-git-release "${target_version}" "${token}" + + # Also merge back the version branch + if [ "$masterbranch" = yes ]; then + git checkout master + git merge "$target_branch" + fi + + # Publish git changes + case "$run_as" in + freebsd) + # if we are not Nico :) then just push, no mirror + git push + # push also new branch and set up tracking + git push -u origin "${target_branch}" + ;; + *) + make helper=${helper} WEBDIR=${WEBDIR} pub + ;; + esac + + # publish man, speeches, website + if [ "$masterbranch" = yes ]; then + make helper=${helper} WEBDIR=${WEBDIR} web-release-all + else + make helper=${helper} WEBDIR=${WEBDIR} web-release-all-no-latest + fi + + # Ensure that pypi release has the right version + "$0" version + + # Create and publish package for pypi + make helper=${helper} WEBDIR=${WEBDIR} pypi-release + + case "$run_as" in + freebsd) + ;; + *) + # Archlinux release is based on pypi + make archlinux-release + ;; + esac + + # Announce change on ML + make helper=${helper} WEBDIR=${WEBDIR} ml-release + + cat << eof +Manual steps post release: + + - linkedin + - hackernews + - reddit + - twitter + +eof + + case "$run_as" in + freebsd) + cat < cdist/version.py + ;; + + target-version) + target_version=$($0 changelog-version) + echo "VERSION = \"${target_version}\"" > cdist/version.py + ;; + + *) + echo "Unknown helper target $@ - aborting" + exit 1 + ;; + +esac diff --git a/cdist/__init__.py b/cdist/__init__.py index 4454a3ac..9068ae69 100644 --- a/cdist/__init__.py +++ b/cdist/__init__.py @@ -21,6 +21,7 @@ import os import subprocess +import hashlib import cdist.version @@ -41,28 +42,48 @@ BANNER = """ "P' "" "" """ -REMOTE_COPY = "scp -o User=root -q" -REMOTE_EXEC = "ssh -o User=root -q" +REMOTE_COPY = "scp -o User=root" +REMOTE_EXEC = "ssh -o User=root" + class Error(Exception): """Base exception class for this project""" pass + class UnresolvableRequirementsError(cdist.Error): """Resolving requirements failed""" pass + +class CdistBetaRequired(cdist.Error): + """Beta functionality is used but beta is not enabled""" + + def __init__(self, command, arg): + self.command = command + self.arg = arg + + def __str__(self): + err_msg = ("\'{}\' argument of \'{}\' command is beta, but beta is " + "not enabled. If you want to use it please enable beta " + "functionalities by using the -b/--enable-beta command " + "line flag.") + return err_msg.format(self.arg, self.command) + + class CdistObjectError(Error): """Something went wrong with an object""" - + def __init__(self, cdist_object, message): self.name = cdist_object.name self.source = " ".join(cdist_object.source) self.message = message - def __str__(self): - return '%s: %s (defined at %s)' % (self.name, self.message, self.source) + return '%s: %s (defined at %s)' % (self.name, + self.message, + self.source) + def file_to_list(filename): """Return list from \n seperated file""" @@ -77,3 +98,11 @@ def file_to_list(filename): lines = [] return lines + + +def str_hash(s): + """Return hash of string s""" + if isinstance(s, str): + return hashlib.md5(s.encode('utf-8')).hexdigest() + else: + raise Error("Param should be string") diff --git a/cdist/conf/explorer/machine_type b/cdist/conf/explorer/machine_type index 74789f5a..eb3c9d36 100755 --- a/cdist/conf/explorer/machine_type +++ b/cdist/conf/explorer/machine_type @@ -22,6 +22,17 @@ # FIXME: other system types (not linux ...) +if [ -d "/proc/vz" -a ! -d "/proc/bc" ]; then + echo openvz + exit +fi + +if [ -e "/proc/1/environ" ] && + cat "/proc/1/environ" | tr '\000' '\n' | grep -Eiq '^container='; then + echo lxc + exit +fi + if [ -r /proc/cpuinfo ]; then # this should only exist on virtual guest machines, # tested on vmware, xen, kvm @@ -37,11 +48,12 @@ if [ -r /proc/cpuinfo ]; then if grep -q -i 'vmware' /sys/class/dmi/id/product_name; then echo "virtual_by_vmware" exit - else - if grep -q -i 'bochs' /sys/class/dmi/id/product_name; then - echo "virtual_by_kvm" - exit - fi + elif grep -q -i 'bochs' /sys/class/dmi/id/product_name; then + echo "virtual_by_kvm" + exit + elif grep -q -i 'virtualbox' /sys/class/dmi/id/product_name; then + echo "virtual_by_virtualbox" + exit fi fi fi diff --git a/cdist/conf/explorer/os b/cdist/conf/explorer/os index de1d29c3..094685ea 100755 --- a/cdist/conf/explorer/os +++ b/cdist/conf/explorer/os @@ -39,6 +39,11 @@ if [ -f /etc/cdist-preos ]; then exit 0 fi +if [ -d /gnu/store ]; then + echo guixsd + exit 0 +fi + ### Debian and derivatives if grep -q ^DISTRIB_ID=Ubuntu /etc/lsb-release 2>/dev/null; then echo ubuntu @@ -72,6 +77,11 @@ if [ -f /etc/owl-release ]; then fi ### Redhat and derivatives +if grep -q ^Scientific /etc/redhat-release 2>/dev/null; then + echo scientific + exit 0 +fi + if grep -q ^CentOS /etc/redhat-release 2>/dev/null; then echo centos exit 0 diff --git a/cdist/conf/explorer/os_version b/cdist/conf/explorer/os_version index 6c7becdc..58f750b0 100755 --- a/cdist/conf/explorer/os_version +++ b/cdist/conf/explorer/os_version @@ -54,7 +54,7 @@ case "$($__explorer/os)" in owl) cat /etc/owl-release ;; - redhat|centos|mitel) + redhat|centos|mitel|scientific) cat /etc/redhat-release ;; slackware) diff --git a/cdist/conf/type/__apt_key/man.rst b/cdist/conf/type/__apt_key/man.rst index 43dc89b1..9009877e 100644 --- a/cdist/conf/type/__apt_key/man.rst +++ b/cdist/conf/type/__apt_key/man.rst @@ -1,8 +1,9 @@ cdist-type__apt_key(7) ====================== -Manage the list of keys used by apt -Steven Armstrong +NAME +---- +cdist-type__apt_key - Manage the list of keys used by apt DESCRIPTION @@ -24,8 +25,8 @@ keyid the id of the key to add. Defaults to __object_id keyserver - the keyserver from which to fetch the key. If omitted the default set in - ./parameter/default/keyserver is used. + the keyserver from which to fetch the key. If omitted the default set + in ./parameter/default/keyserver is used. EXAMPLES @@ -47,12 +48,14 @@ EXAMPLES __apt_key UbuntuArchiveKey --keyid 437D05B5 --keyserver keyserver.ubuntu.com -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2014 Steven Armstrong. 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. diff --git a/cdist/conf/type/__apt_key_uri/man.rst b/cdist/conf/type/__apt_key_uri/man.rst index a235e13a..82a191b9 100644 --- a/cdist/conf/type/__apt_key_uri/man.rst +++ b/cdist/conf/type/__apt_key_uri/man.rst @@ -1,8 +1,9 @@ cdist-type__apt_key_uri(7) ========================== -Add apt key from uri -Steven Armstrong +NAME +---- +cdist-type__apt_key_uri - Add apt key from uri DESCRIPTION @@ -37,12 +38,14 @@ EXAMPLES --state present -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2014 Steven Armstrong. 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. diff --git a/cdist/conf/type/__apt_norecommends/man.rst b/cdist/conf/type/__apt_norecommends/man.rst index 232bb166..001fffe4 100644 --- a/cdist/conf/type/__apt_norecommends/man.rst +++ b/cdist/conf/type/__apt_norecommends/man.rst @@ -1,8 +1,9 @@ cdist-type__apt_norecommends(7) =============================== -Configure apt to not install recommended packages -Steven Armstrong +NAME +---- +cdist-type__apt_norecommends - Configure apt to not install recommended packages DESCRIPTION @@ -28,12 +29,14 @@ EXAMPLES __apt_norecommends -SEE ALSO --------- -- `cdist-type(7) `_ +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 (GPLv3). +Copyright \(C) 2014 Steven Armstrong. 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. diff --git a/cdist/conf/type/__apt_ppa/man.rst b/cdist/conf/type/__apt_ppa/man.rst index e39bd6b2..8347c908 100644 --- a/cdist/conf/type/__apt_ppa/man.rst +++ b/cdist/conf/type/__apt_ppa/man.rst @@ -1,8 +1,9 @@ cdist-type__apt_ppa(7) ====================== -Manage ppa repositories -Steven Armstrong +NAME +---- +cdist-type__apt_ppa - Manage ppa repositories DESCRIPTION @@ -36,12 +37,14 @@ EXAMPLES __apt_ppa ppa:sans-intern/missing-bits --state absent -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2014 Steven Armstrong. 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. diff --git a/cdist/conf/type/__apt_source/man.rst b/cdist/conf/type/__apt_source/man.rst index 70649c4b..8aa6c144 100644 --- a/cdist/conf/type/__apt_source/man.rst +++ b/cdist/conf/type/__apt_source/man.rst @@ -1,8 +1,9 @@ cdist-type__apt_source(7) ========================= -Manage apt sources -Steven Armstrong +NAME +---- +cdist-type__apt_source - Manage apt sources DESCRIPTION @@ -55,12 +56,14 @@ EXAMPLES --component partner --state present -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2011-2014 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2014 Steven Armstrong. 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. diff --git a/cdist/conf/type/__apt_update_index/man.rst b/cdist/conf/type/__apt_update_index/man.rst index 2fc66c65..3031902f 100644 --- a/cdist/conf/type/__apt_update_index/man.rst +++ b/cdist/conf/type/__apt_update_index/man.rst @@ -1,8 +1,9 @@ cdist-type__apt_update_index(7) =============================== -Update apt's package index -Steven Armstrong +NAME +---- +cdist-type__apt_update_index - Update apt's package index DESCRIPTION @@ -27,12 +28,14 @@ EXAMPLES __apt_update_index -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011 Steven Armstrong. 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. diff --git a/cdist/conf/type/__block/man.rst b/cdist/conf/type/__block/man.rst index 4b7d61dc..90e50381 100644 --- a/cdist/conf/type/__block/man.rst +++ b/cdist/conf/type/__block/man.rst @@ -1,8 +1,9 @@ cdist-type__block(7) ==================== -Manage blocks of text in files -Steven Armstrong +NAME +---- +cdist-type__block - Manage blocks of text in files DESCRIPTION @@ -68,12 +69,14 @@ EXAMPLES DONE -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2013 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2013 Steven Armstrong. 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. diff --git a/cdist/conf/type/__ccollect_source/man.rst b/cdist/conf/type/__ccollect_source/man.rst index 12fb8f42..617571bb 100644 --- a/cdist/conf/type/__ccollect_source/man.rst +++ b/cdist/conf/type/__ccollect_source/man.rst @@ -1,8 +1,9 @@ cdist-type__ccollect_source(7) ============================== -Manage ccollect sources -Nico Schottelius +NAME +---- +cdist-type__ccollect_source - Manage ccollect sources DESCRIPTION @@ -52,12 +53,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- ccollect(1) -- http://www.nico.schottelius.org/software/ccollect/ +:strong:`ccollect`\ (1) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2014 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2014 Nico Schottelius. 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. diff --git a/cdist/conf/type/__ccollect_source/manifest b/cdist/conf/type/__ccollect_source/manifest index 89c2ef2b..b95b75c3 100755 --- a/cdist/conf/type/__ccollect_source/manifest +++ b/cdist/conf/type/__ccollect_source/manifest @@ -40,7 +40,9 @@ echo "$source" | __file "$source_file" --source - --state "$state" ################################################################################ # Booleans -if [ -f "$__object/parameter/verbose" ]; then +if [ "${state}" = "absent" ]; then + verbosestate="absent" +elif [ -f "$__object/parameter/verbose" ]; then verbosestate="present" else verbosestate="absent" diff --git a/cdist/conf/type/__cdist/man.rst b/cdist/conf/type/__cdist/man.rst index f15d3b73..f02f848a 100644 --- a/cdist/conf/type/__cdist/man.rst +++ b/cdist/conf/type/__cdist/man.rst @@ -1,8 +1,9 @@ cdist-type__cdist(7) ==================== -Manage cdist installations -Nico Schottelius +NAME +---- +cdist-type__cdist - Manage cdist installations DESCRIPTION @@ -49,12 +50,14 @@ EXAMPLES __cdist --source "git://git.schottelius.org/cdist" /home/cdist/cdist -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2013 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2013 Nico Schottelius. 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. diff --git a/cdist/conf/type/__cdistmarker/man.rst b/cdist/conf/type/__cdistmarker/man.rst index 22e711b6..f3a8bafe 100644 --- a/cdist/conf/type/__cdistmarker/man.rst +++ b/cdist/conf/type/__cdistmarker/man.rst @@ -1,8 +1,9 @@ cdist-type__cdistmarker(7) ========================== -Add a timestamped cdist marker. -Daniel Maher +NAME +---- +cdist-type__cdistmarker - Add a timestamped cdist marker. DESCRIPTION @@ -41,12 +42,14 @@ EXAMPLES __cdistmarker --destination /tmp/cdist_marker --format '+%s' -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Daniel Maher COPYING ------- -Copyright \(C) 2011 Daniel Maher. Free use of this software is granted under -the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011 Daniel Maher. 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. diff --git a/cdist/conf/type/__config_file/man.rst b/cdist/conf/type/__config_file/man.rst index 49b63984..5e0e58bd 100644 --- a/cdist/conf/type/__config_file/man.rst +++ b/cdist/conf/type/__config_file/man.rst @@ -1,8 +1,9 @@ cdist-type__config_file(7) ========================== -Manages config files -Steven Armstrong +NAME +---- +cdist-type__config_file - _Manages config files DESCRIPTION @@ -47,11 +48,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__file(7) `_ +:strong:`cdist-type__file`\ (7) + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul/man.rst b/cdist/conf/type/__consul/man.rst index 77fae852..19ceb535 100644 --- a/cdist/conf/type/__consul/man.rst +++ b/cdist/conf/type/__consul/man.rst @@ -1,8 +1,9 @@ cdist-type__consul(7) ===================== -Install consul -Steven Armstrong +NAME +---- +cdist-type__consul - Install consul DESCRIPTION @@ -40,12 +41,14 @@ EXAMPLES --version 0.4.1 -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul/manifest b/cdist/conf/type/__consul/manifest index 0187d959..b16c5749 100755 --- a/cdist/conf/type/__consul/manifest +++ b/cdist/conf/type/__consul/manifest @@ -23,7 +23,7 @@ os=$(cat "$__global/explorer/os") case "$os" in - centos|redhat|ubuntu|debian|archlinux|gentoo) + scientific|centos|redhat|ubuntu|debian|archlinux|gentoo) # any linux should work : ;; diff --git a/cdist/conf/type/__consul_agent/man.rst b/cdist/conf/type/__consul_agent/man.rst index d75425d7..966abc60 100644 --- a/cdist/conf/type/__consul_agent/man.rst +++ b/cdist/conf/type/__consul_agent/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_agent(7) =========================== -Manage the consul agent -Steven Armstrong +NAME +---- +cdist-type__consul_agent - Manage the consul agent DESCRIPTION @@ -110,7 +111,7 @@ enable-syslog enables logging to syslog verify-incoming - enforce the use of TLS and verify a client's authenticity on incomming connections + enforce the use of TLS and verify a client's authenticity on incoming connections verify-outgoing enforce the use of TLS and verify the peers authenticity on outgoing connections @@ -164,11 +165,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- http://www.consul.io/docs/agent/options.html +consul documentation at: . + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul_agent/manifest b/cdist/conf/type/__consul_agent/manifest index e98d770b..07bf3b26 100755 --- a/cdist/conf/type/__consul_agent/manifest +++ b/cdist/conf/type/__consul_agent/manifest @@ -23,7 +23,7 @@ os=$(cat "$__global/explorer/os") case "$os" in - centos|debian|redhat|ubuntu) + scientific|centos|debian|redhat|ubuntu) # whitelist safeguard : ;; diff --git a/cdist/conf/type/__consul_check/man.rst b/cdist/conf/type/__consul_check/man.rst index e12d9ca8..9694c7af 100644 --- a/cdist/conf/type/__consul_check/man.rst +++ b/cdist/conf/type/__consul_check/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_check(7) ============================= -Manages consul checks -Steven Armstrong +NAME +---- +cdist-type__consul_check - Manages consul checks DESCRIPTION @@ -10,7 +11,7 @@ DESCRIPTION Generate and deploy check definitions for a consul agent. See http://www.consul.io/docs/agent/checks.html for parameter documentation. -Use either script toghether with interval, or use ttl. +Use either script together with interval, or use ttl. REQUIRED PARAMETERS @@ -85,11 +86,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__consul_agent(7) `_ +:strong:`cdist-type__consul_agent`\ (7) + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015-2016 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015-2016 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul_reload/man.rst b/cdist/conf/type/__consul_reload/man.rst index f66bb545..f48a041a 100644 --- a/cdist/conf/type/__consul_reload/man.rst +++ b/cdist/conf/type/__consul_reload/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_reload(7) ============================ -Reload consul -Steven Armstrong +NAME +---- +cdist-type__consul_reload - Reload consul DESCRIPTION @@ -28,12 +29,14 @@ EXAMPLES __consul_reload -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul_service/man.rst b/cdist/conf/type/__consul_service/man.rst index 9a8efaab..bcfe4067 100644 --- a/cdist/conf/type/__consul_service/man.rst +++ b/cdist/conf/type/__consul_service/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_service(7) ============================= -Manages consul services -Steven Armstrong +NAME +---- +cdist-type__consul_service - Manages consul services DESCRIPTION @@ -65,11 +66,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__consul_agent(7) `_ +:strong:`cdist-type__consul_agent`\ (7) + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul_template/man.rst b/cdist/conf/type/__consul_template/man.rst index bcdb94e3..f13c699d 100644 --- a/cdist/conf/type/__consul_template/man.rst +++ b/cdist/conf/type/__consul_template/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_template(7) ============================== -Manage the consul-template service -Steven Armstrong +NAME +---- +cdist-type__consul_template - Manage the consul-template service DESCRIPTION @@ -124,11 +125,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- https://github.com/hashicorp/consul-template +consul documentation at: . + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul_template/manifest b/cdist/conf/type/__consul_template/manifest index 83d2aae4..fd249185 100755 --- a/cdist/conf/type/__consul_template/manifest +++ b/cdist/conf/type/__consul_template/manifest @@ -22,7 +22,7 @@ os=$(cat "$__global/explorer/os") case "$os" in - centos|redhat) + scientific|centos|redhat) # whitelist safeguard service_onchange='service consul-template status >/dev/null && service consul-template reload || true' \ ;; diff --git a/cdist/conf/type/__consul_template_template/man.rst b/cdist/conf/type/__consul_template_template/man.rst index 6264f696..b2e3820b 100644 --- a/cdist/conf/type/__consul_template_template/man.rst +++ b/cdist/conf/type/__consul_template_template/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_template_template(7) ======================================= -Manage consul-template templates -Steven Armstrong +NAME +---- +cdist-type__consul_template_template - Manage consul-template templates DESCRIPTION @@ -67,12 +68,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__consul_template(7) `_ -- `cdist-type__consul_template_config(7) `_ +:strong:`cdist-type__consul_template`\ (7), :strong:`cdist-type__consul_template_config`\ (7) + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015-2016 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015-2016 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul_watch_checks/man.rst b/cdist/conf/type/__consul_watch_checks/man.rst index c1e8c0a7..a9a9f58d 100644 --- a/cdist/conf/type/__consul_watch_checks/man.rst +++ b/cdist/conf/type/__consul_watch_checks/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_watch_checks(7) ================================== -Manages consul checks watches -Steven Armstrong +NAME +---- +cdist-type__consul_watch_checks - Manages consul checks watches DESCRIPTION @@ -54,12 +55,19 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__consul_agent(7) `_ -- http://www.consul.io/docs/agent/watches.html +:strong:`cdist-type__consul_agent`\ (7) + +consul documentation at: . + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul_watch_event/man.rst b/cdist/conf/type/__consul_watch_event/man.rst index ea9bc61a..6fe60d40 100644 --- a/cdist/conf/type/__consul_watch_event/man.rst +++ b/cdist/conf/type/__consul_watch_event/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_watch_event(7) ================================= -Manages consul event watches -Steven Armstrong +NAME +---- +cdist-type__consul_watch_event - Manages consul event watches DESCRIPTION @@ -47,12 +48,19 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__consul_agent(7) `_ -- http://www.consul.io/docs/agent/watches.html +:strong:`cdist-type__consul_agent`\ (7) + +consul documentation at: . + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul_watch_key/man.rst b/cdist/conf/type/__consul_watch_key/man.rst index 90e952b8..a12f8425 100644 --- a/cdist/conf/type/__consul_watch_key/man.rst +++ b/cdist/conf/type/__consul_watch_key/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_watch_key(7) =============================== -Manages consul key watches -Steven Armstrong +NAME +---- +cdist-type__consul_watch_key - Manages consul key watches DESCRIPTION @@ -44,12 +45,19 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__consul_agent(7) `_ -- http://www.consul.io/docs/agent/watches.html +:strong:`cdist-type__consul_agent`\ (7) + +consul documentation at: . + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul_watch_keyprefix/man.rst b/cdist/conf/type/__consul_watch_keyprefix/man.rst index 8ee5822d..c600323c 100644 --- a/cdist/conf/type/__consul_watch_keyprefix/man.rst +++ b/cdist/conf/type/__consul_watch_keyprefix/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_watch_keyprefix(7) ===================================== -Manages consul keyprefix watches -Steven Armstrong +NAME +---- +cdist-type__consul_watch_keyprefix - Manages consul keyprefix watches DESCRIPTION @@ -44,12 +45,19 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__consul_agent(7) `_ -- http://www.consul.io/docs/agent/watches.html +:strong:`cdist-type__consul_agent`\ (7) + +consul documentation at: . + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul_watch_nodes/man.rst b/cdist/conf/type/__consul_watch_nodes/man.rst index b5f0a5ce..d886a586 100644 --- a/cdist/conf/type/__consul_watch_nodes/man.rst +++ b/cdist/conf/type/__consul_watch_nodes/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_watch_nodes(7) ================================= -Manages consul nodes watches -Steven Armstrong +NAME +---- +cdist-type__consul_watch_nodes - Manages consul nodes watches DESCRIPTION @@ -40,12 +41,19 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__consul_agent(7) `_ -- http://www.consul.io/docs/agent/watches.html +:strong:`cdist-type__consul_agent`\ (7) + +consul documentation at: . + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul_watch_service/man.rst b/cdist/conf/type/__consul_watch_service/man.rst index 1cc2c00d..37cabcc9 100644 --- a/cdist/conf/type/__consul_watch_service/man.rst +++ b/cdist/conf/type/__consul_watch_service/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_watch_service(7) =================================== -Manages consul service watches -Steven Armstrong +NAME +---- +cdist-type__consul_watch_service - Manages consul service watches DESCRIPTION @@ -64,12 +65,19 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__consul_agent(7) `_ -- http://www.consul.io/docs/agent/watches.html +:strong:`cdist-type__consul_agent`\ (7) + +consul documentation at: . + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__consul_watch_services/man.rst b/cdist/conf/type/__consul_watch_services/man.rst index bf766222..cea5f901 100644 --- a/cdist/conf/type/__consul_watch_services/man.rst +++ b/cdist/conf/type/__consul_watch_services/man.rst @@ -1,8 +1,9 @@ cdist-type__consul_watch_services(7) ==================================== -Manages consul services watches -Steven Armstrong +NAME +---- +cdist-type__consul_watch_services - Manages consul services watches DESCRIPTION @@ -40,12 +41,19 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__consul_agent(7) `_ -- http://www.consul.io/docs/agent/watches.html +:strong:`cdist-type__consul_agent`\ (7) + +consul documentation at: . + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__cron/man.rst b/cdist/conf/type/__cron/man.rst index 353f6bae..d0694738 100644 --- a/cdist/conf/type/__cron/man.rst +++ b/cdist/conf/type/__cron/man.rst @@ -1,8 +1,9 @@ cdist-type__cron(7) =================== -Installs and manages cron jobs -Steven Armstrong +NAME +---- +cdist-type__cron - Installs and manages cron jobs DESCRIPTION @@ -67,11 +68,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- crontab(5) +:strong:`crontab`\ (5) + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2011-2013 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2013 Steven Armstrong. 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. diff --git a/cdist/conf/type/__debconf_set_selections/man.rst b/cdist/conf/type/__debconf_set_selections/man.rst index 37aa65b9..58c25b81 100644 --- a/cdist/conf/type/__debconf_set_selections/man.rst +++ b/cdist/conf/type/__debconf_set_selections/man.rst @@ -1,8 +1,9 @@ cdist-type__debconf_set_selections(7) ===================================== -Setup debconf selections -Nico Schottelius +NAME +---- +cdist-type__debconf_set_selections - Setup debconf selections DESCRIPTION @@ -36,12 +37,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__update_alternatives(7) `_ -- debconf-set-selections(1) +:strong:`debconf-set-selections`\ (1), :strong:`cdist-type__update_alternatives`\ (7) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2011-2014 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2014 Nico Schottelius. 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. diff --git a/cdist/conf/type/__directory/man.rst b/cdist/conf/type/__directory/man.rst index 279763a1..74b00afe 100644 --- a/cdist/conf/type/__directory/man.rst +++ b/cdist/conf/type/__directory/man.rst @@ -1,8 +1,9 @@ cdist-type__directory(7) ======================== -Manage a directory -Nico Schottelius +NAME +---- +cdist-type__directory - Manage a directory DESCRIPTION @@ -87,12 +88,14 @@ EXAMPLES --owner root --group root --mode 0755 --state present -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Nico Schottelius 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). +Copyright \(C) 2011 Nico Schottelius. 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. diff --git a/cdist/conf/type/__dog_vdi/man.rst b/cdist/conf/type/__dog_vdi/man.rst index 3e6155a6..4be1920d 100644 --- a/cdist/conf/type/__dog_vdi/man.rst +++ b/cdist/conf/type/__dog_vdi/man.rst @@ -1,8 +1,9 @@ cdist-type__dog_vdi(7) ====================== -Manage Sheepdog VM images -Nico Schottelius +NAME +---- +cdist-type__dog_vdi - Manage Sheepdog VM images DESCRIPTION @@ -42,12 +43,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- dog(8) -- qemu(1) +:strong:`qemu`\ (1), :strong:`dog`\ (8) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2014 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2014 Nico Schottelius. 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. diff --git a/cdist/conf/type/__file/man.rst b/cdist/conf/type/__file/man.rst index 73336581..7d9b413b 100644 --- a/cdist/conf/type/__file/man.rst +++ b/cdist/conf/type/__file/man.rst @@ -1,8 +1,9 @@ cdist-type__file(7) =================== -Manage files. -Nico Schottelius +NAME +---- +cdist-type__file - Manage files. DESCRIPTION @@ -98,12 +99,14 @@ EXAMPLES DONE -SEE ALSO --------- -* `cdist-type(7) `_ +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2011-2013 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2013 Nico Schottelius. 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. 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..1c103ac9 --- /dev/null +++ b/cdist/conf/type/__filesystem/man.rst @@ -0,0 +1,81 @@ +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 anything. + +If the device has a filesystem other then the specified and/or +the label is not correct, it only makes a new filesystem +if you have 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 lsblk accepted device notation. + + | + | For example: + | /dev/sdx + | or /dev/disk/by-xxxx/xxx + | or /dev/mapper/xxxx + +label + Label which should be applied on the filesystem. + +mkfsoptions + Additional options which are inserted to the mkfs.xxx call. + + +BOOLEAN PARAMETERS +------------------ +force + Normally, this type does nothing if a filesystem is found + on the target device. If you specify force, it's formatted + if the filesystem type or label differs from parameters. + Warning: This option can easily lead into data loss! + +MESSAGES +-------- +filesystem on \: created + Filesystem was created on + + +EXAMPLES +-------- + +.. code-block:: sh + + # Ensures that device /dev/sdb is formatted 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/__firewalld_rule/man.rst b/cdist/conf/type/__firewalld_rule/man.rst index d953b3d2..53ae52b8 100644 --- a/cdist/conf/type/__firewalld_rule/man.rst +++ b/cdist/conf/type/__firewalld_rule/man.rst @@ -1,8 +1,9 @@ cdist-type__firewalld_rule(7) ============================= -Configure firewalld rules -Nico Schottelius +NAME +---- +cdist-type__firewalld_rule - Configure firewalld rules DESCRIPTION @@ -64,12 +65,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__iptables_rule(7) `_ -- firewalld(8) +:strong:`cdist-type__iptables_rule`\ (7), :strong:`firewalld`\ (8) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2015 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Nico Schottelius. 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. diff --git a/cdist/conf/type/__firewalld_start/gencode-remote b/cdist/conf/type/__firewalld_start/gencode-remote new file mode 100644 index 00000000..7a3b6298 --- /dev/null +++ b/cdist/conf/type/__firewalld_start/gencode-remote @@ -0,0 +1,84 @@ +#!/bin/sh +# +# 2016 Darko Poljak(darko.poljak at ungleich.ch) +# +# 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 . +# +# + +startstate="$(cat "$__object/parameter/startstate")" +init=$(cat "$__global/explorer/init") + +os=$(cat "$__global/explorer/os") +os_version=$(cat "$__global/explorer/os_version") +name="firewalld" + +case "${startstate}" in + present) + cmd="start" + ;; + absent) + cmd="stop" + ;; + *) + echo "Unknown startstate: ${startstate}" >&2 + exit 1 + ;; +esac + +if [ "$init" = 'systemd' ]; then + # this handles ALL linux distros with systemd + # e.g. archlinux, gentoo in some cases, new RHEL and SLES versions + echo "systemctl \"$cmd\" \"$name\"" +else + case "$os" in + debian) + case "$os_version" in + [1-7]*) + echo "service \"$name\" \"$cmd\"" + ;; + 8*) + echo "systemctl \"$cmd\" \"$name\"" + ;; + *) + echo "Unsupported version $os_version of $os" >&2 + exit 1 + ;; + esac + ;; + + gentoo) + echo service \"$name\" \"$cmd\" + ;; + + amazon|scientific|centos|fedora|owl|redhat|suse) + echo service \"$name\" \"$cmd\" + ;; + + openwrt) + echo "/etc/init.d/\"$name\" \"$cmd\"" + ;; + + ubuntu) + echo "service \"$name\" \"$cmd\"" + ;; + + *) + echo "Unsupported os: $os" >&2 + exit 1 + ;; + esac +fi diff --git a/cdist/conf/type/__firewalld_start/man.rst b/cdist/conf/type/__firewalld_start/man.rst new file mode 100644 index 00000000..03232b72 --- /dev/null +++ b/cdist/conf/type/__firewalld_start/man.rst @@ -0,0 +1,53 @@ +cdist-type__firewalld_start(7) +============================= + +NAME +---- +cdist-type__firewalld_start - start and enable firewalld + + +DESCRIPTION +----------- +This cdist type allows you to start and enable firewalld. + + +REQUIRED PARAMETERS +------------------- +None + +OPTIONAL PARAMETERS +------------------- +startstate + 'present' or 'absent', start/stop firewalld. Default is 'present'. +bootstate + 'present' or 'absent', enable/disable firewalld on boot. Default is 'present'. + + +EXAMPLES +-------- + +.. code-block:: sh + + # start and enable firewalld + __firewalld_start + + # only enable firewalld to start on boot + __firewalld_start --startstate present --bootstate absent + + +SEE ALSO +-------- +:strong:`firewalld`\ (8) + + +AUTHORS +------- +Darko Poljak + + +COPYING +------- +Copyright \(C) 2016 Darko Poljak. 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. diff --git a/docs/dev/sync-to-testhost b/cdist/conf/type/__firewalld_start/manifest old mode 100755 new mode 100644 similarity index 76% rename from docs/dev/sync-to-testhost rename to cdist/conf/type/__firewalld_start/manifest index cc59eb8d..2c6a0219 --- a/docs/dev/sync-to-testhost +++ b/cdist/conf/type/__firewalld_start/manifest @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2016 Darko Poljak (darko.poljak at ungleich.ch) # # This file is part of cdist. # @@ -16,13 +16,8 @@ # # 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" +bootstate="$(cat "$__object/parameter/bootstate")" -for dir in $dirs; do - rsync -av --delete /home/users/nico/p/$dir/ root@rnic01:$dir -done +__package firewalld +require="__package/firewalld" __start_on_boot firewalld --state "${bootstate}" diff --git a/cdist/conf/type/__firewalld_start/parameter/default/bootstate b/cdist/conf/type/__firewalld_start/parameter/default/bootstate new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__firewalld_start/parameter/default/bootstate @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__firewalld_start/parameter/default/startstate b/cdist/conf/type/__firewalld_start/parameter/default/startstate new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__firewalld_start/parameter/default/startstate @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__firewalld_start/parameter/optional b/cdist/conf/type/__firewalld_start/parameter/optional new file mode 100644 index 00000000..934c7d0d --- /dev/null +++ b/cdist/conf/type/__firewalld_start/parameter/optional @@ -0,0 +1,2 @@ +bootstate +startstate diff --git a/cdist/conf/type/__firewalld_start/singleton b/cdist/conf/type/__firewalld_start/singleton new file mode 100644 index 00000000..e69de29b diff --git a/cdist/conf/type/__git/man.rst b/cdist/conf/type/__git/man.rst index 75f6e48b..64adfd2f 100644 --- a/cdist/conf/type/__git/man.rst +++ b/cdist/conf/type/__git/man.rst @@ -1,8 +1,9 @@ cdist-type__git(7) ================== -Get and or keep git repositories up-to-date -Nico Schottelius +NAME +---- +cdist-type__git - Get and or keep git repositories up-to-date DESCRIPTION @@ -46,12 +47,14 @@ EXAMPLES __git /home/nico/cdist --source git://github.com/telmich/cdist.git --branch 2.1 -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Nico Schottelius. 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. diff --git a/cdist/conf/type/__group/man.rst b/cdist/conf/type/__group/man.rst index 912dd226..614f3d57 100644 --- a/cdist/conf/type/__group/man.rst +++ b/cdist/conf/type/__group/man.rst @@ -1,8 +1,9 @@ cdist-type__group(7) ==================== -Manage groups -Steven Armstrong +NAME +---- +cdist-type__group - Manage groups DESCRIPTION @@ -66,12 +67,14 @@ EXAMPLES __group foobar --gid 1234 --password 'crypted-password-string' -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2011-2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__hostname/gencode-remote b/cdist/conf/type/__hostname/gencode-remote index 9fac7bf4..4eb08723 100755 --- a/cdist/conf/type/__hostname/gencode-remote +++ b/cdist/conf/type/__hostname/gencode-remote @@ -40,7 +40,7 @@ case "$os" in exit 0 fi ;; - centos) + scientific|centos|openbsd) if [ "$name_sysconfig" = "$name_should" -a "$name_running" = "$name_should" ]; then exit 0 fi @@ -64,7 +64,7 @@ else echo "hostname '$name_should'" echo "printf '%s\n' '$name_should' > /etc/hostname" ;; - centos) + centos|openbsd) echo "hostname '$name_should'" ;; suse) diff --git a/cdist/conf/type/__hostname/man.rst b/cdist/conf/type/__hostname/man.rst index 32d452f7..d23a3b8a 100644 --- a/cdist/conf/type/__hostname/man.rst +++ b/cdist/conf/type/__hostname/man.rst @@ -1,8 +1,9 @@ cdist-type__hostname(7) ======================= -Set the hostname -Steven Armstrong +NAME +---- +cdist-type__hostname - Set the hostname DESCRIPTION @@ -38,12 +39,14 @@ EXAMPLES __hostname --name some-static-hostname -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2012 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Steven Armstrong. 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. diff --git a/cdist/conf/type/__hostname/manifest b/cdist/conf/type/__hostname/manifest index 76f962e0..823d2f7e 100755 --- a/cdist/conf/type/__hostname/manifest +++ b/cdist/conf/type/__hostname/manifest @@ -23,7 +23,14 @@ os=$(cat "$__global/explorer/os") if [ -f "$__object/parameter/name" ]; then name_should="$(cat "$__object/parameter/name")" else - name_should="$(echo "${__target_host%%.*}")" + case "$os" in + openbsd) + name_should="$(echo "${__target_host}")" + ;; + *) + name_should="$(echo "${__target_host%%.*}")" + ;; + esac fi @@ -38,13 +45,16 @@ case "$os" in # handled in gencode-remote : ;; - centos) + scientific|centos) __key_value sysconfig-hostname \ --file /etc/sysconfig/network \ --delimiter '=' \ --key HOSTNAME \ --value "$name_should" --exact_delimiter ;; + openbsd) + echo "$name_should" | __file /etc/myname --source - + ;; *) not_supported ;; diff --git a/cdist/conf/type/__iptables_apply/man.rst b/cdist/conf/type/__iptables_apply/man.rst index 40605351..76e1f6bf 100644 --- a/cdist/conf/type/__iptables_apply/man.rst +++ b/cdist/conf/type/__iptables_apply/man.rst @@ -1,8 +1,9 @@ cdist-type__iptables_apply(7) ============================= -Apply the rules -Nico Schottelius +NAME +---- +cdist-type__iptables_apply - Apply the rules DESCRIPTION @@ -28,12 +29,17 @@ None (__iptables_apply is used by __iptables_rule) SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__iptables_rule(7) `_ -- iptables(8) +:strong:`cdist-type__iptables_rule`\ (7), :strong:`iptables`\ (8) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2013 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2013 Nico Schottelius. 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. diff --git a/cdist/conf/type/__iptables_rule/man.rst b/cdist/conf/type/__iptables_rule/man.rst index 5ee02f9c..92d8859f 100644 --- a/cdist/conf/type/__iptables_rule/man.rst +++ b/cdist/conf/type/__iptables_rule/man.rst @@ -1,8 +1,9 @@ cdist-type__iptables_rule(7) ============================ -Deploy iptable rulesets -Nico Schottelius +NAME +---- +cdist-type__iptables_rule - Deploy iptable rulesets DESCRIPTION @@ -49,12 +50,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__iptables_apply(7) `_ -- iptables(8) +:strong:`cdist-type__iptables_apply`\ (7), :strong:`iptables`\ (8) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2013 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2013 Nico Schottelius. 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. diff --git a/cdist/conf/type/__issue/man.rst b/cdist/conf/type/__issue/man.rst index 4a6c1f8d..097f2c01 100644 --- a/cdist/conf/type/__issue/man.rst +++ b/cdist/conf/type/__issue/man.rst @@ -1,8 +1,9 @@ cdist-type__issue(7) ==================== -Manage issue -Nico Schottelius +NAME +---- +cdist-type__issue - Manage issue DESCRIPTION @@ -33,12 +34,14 @@ EXAMPLES __issue --source "$__type/files/myfancyissue" -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Nico Schottelius 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). +Copyright \(C) 2011 Nico Schottelius. 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. diff --git a/cdist/conf/type/__jail/man.rst b/cdist/conf/type/__jail/man.rst index 38ec4f96..7fc8f455 100644 --- a/cdist/conf/type/__jail/man.rst +++ b/cdist/conf/type/__jail/man.rst @@ -1,13 +1,14 @@ cdist-type__jail(7) =================== -Manage FreeBSD jails -Jake Guffey +NAME +---- +cdist-type__jail - Manage FreeBSD jails DESCRIPTION ----------- -This type is used on FreeBSD to manage jails. +This type is used on FreeBSD to manage jails by calling the appropriate per-version subtype. REQUIRED PARAMETERS @@ -107,10 +108,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ +:strong:`jail`\ (8) + + +AUTHORS +------- +Jake Guffey COPYING ------- -Copyright \(C) 2012 Jake Guffey. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012,2016 Jake Guffey. 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. diff --git a/cdist/conf/type/__jail/manifest b/cdist/conf/type/__jail/manifest index 2d29e263..6df52c59 100755 --- a/cdist/conf/type/__jail/manifest +++ b/cdist/conf/type/__jail/manifest @@ -37,6 +37,19 @@ jaildir="$(cat "$__object/parameter/jaildir")" __directory ${jaildir} --parents +set -- "$@" "$__object_id" "--state" "$state" +cd "$__object/parameter" +for property in $(ls .); do + set -- "$@" "--$property" "$(cat "$property")" +done + +ver="$(cat "$__global/explorer/os_version")" +if [ -n "$(echo "$ver" | grep '^10\.' )" ]; then # Version is 10.x + __jail_freebsd10 "$@" +else + __jail_freebsd9 "$@" +fi + # Debug #set +x diff --git a/cdist/conf/type/__jail/explorer/basepresent b/cdist/conf/type/__jail_freebsd10/explorer/basepresent similarity index 100% rename from cdist/conf/type/__jail/explorer/basepresent rename to cdist/conf/type/__jail_freebsd10/explorer/basepresent diff --git a/cdist/conf/type/__jail/explorer/present b/cdist/conf/type/__jail_freebsd10/explorer/present similarity index 100% rename from cdist/conf/type/__jail/explorer/present rename to cdist/conf/type/__jail_freebsd10/explorer/present diff --git a/cdist/conf/type/__jail/explorer/status b/cdist/conf/type/__jail_freebsd10/explorer/status similarity index 100% rename from cdist/conf/type/__jail/explorer/status rename to cdist/conf/type/__jail_freebsd10/explorer/status diff --git a/cdist/conf/type/__jail_freebsd10/gencode-local b/cdist/conf/type/__jail_freebsd10/gencode-local new file mode 100755 index 00000000..d4b89730 --- /dev/null +++ b/cdist/conf/type/__jail_freebsd10/gencode-local @@ -0,0 +1,52 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# 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 . +# +# +# The __jail type creates, configures, and deletes FreeBSD jails for use as +# virtual machines. +# + +# Debug +#exec >&2 +#set -x + +jaildir="$(cat "$__object/parameter/jaildir")" + +jailbase="$(cat "$__object/parameter/jailbase")" + +state="$(cat "$__object/parameter/state")" + +if [ "$state" = "present" ] && [ -z "$jailbase" ]; then + exec >&2 + echo "jailbase is a REQUIRED parameter when state=present!" + exit 1 +fi + +remotebase="${jaildir}/jailbase.tgz" +basepresent="$(cat "$__object/explorer/basepresent")" + +if [ "$state" = "present" ]; then + if [ "$basepresent" = "NONE" ]; then + echo "$__remote_copy" "${jailbase}" "$__target_host:${remotebase}" + fi # basepresent=NONE +fi # state=present + +# Debug +#set +x + diff --git a/cdist/conf/type/__jail_freebsd10/gencode-remote b/cdist/conf/type/__jail_freebsd10/gencode-remote new file mode 100755 index 00000000..ae68616d --- /dev/null +++ b/cdist/conf/type/__jail_freebsd10/gencode-remote @@ -0,0 +1,362 @@ +#!/bin/sh +# +# 2012,2014,2016 Jake Guffey (jake.guffey at jointheirstm.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 . +# +# +# The __jail_freebsd10 type creates, configures, and deletes FreeBSD +# jails for use as virtual machines on FreeBSD 10.x. +# + +# Debug +#exec >&2 +#set -x + +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name="$__object_id" +fi + +state="$(cat "$__object/parameter/state")" + +started="true" +# If the user wants the jail gone, it implies it shouldn't be started. +[ -f "$__object/parameter/stopped" -o "$state" = "absent" ] && started="false" + +if [ -f "$__object/parameter/ip" ]; then + ip="$(cat "$__object/parameter/ip")" +else +# IP is an optional param when $state=absent, but +# when $state=present, it's required. Enforce this. + if [ "$state" = "present" ]; then + exec >&2 + echo "If --state is 'present,' --ip must be given\!" + exit 1 + fi +fi + +if [ -f "$__object/parameter/hostname" ]; then + hostname="$(cat "$__object/parameter/hostname")" +else + hostname="$name" +fi + +if [ -f "$__object/parameter/devfs-disable" ]; then + devfsenable="false" +else + devfsenable="true" +fi + +devfsruleset="$(cat "$__object/parameter/devfs-ruleset")" + +# devfs_ruleset being defined without devfs_enable being true +# is pointless. Treat this as an error. +if [ -n "$devfsruleset" -a "$devfsenable" = "false" ]; then + exec >&2 + echo "Can't have --devfs-ruleset defined with --devfs-disable" + exit 1 +fi + +if [ -f "$__object/parameter/onboot" ]; then + onboot="true" +fi + +jaildir="$(cat "$__object/parameter/jaildir")" + +present="$(cat "$__object/explorer/present")" +#present="$(cat "$__type/explorer/present")" +status="$(cat "$__object/explorer/status")" + +# Handle ip="addr, addr" format +if [ $(expr "${ip}" : ".*, .*") -gt "0" ]; then + SAVE_IFS="$IFS" + IFS=", " + for cur_ip in ${ip}; do + # Just get the last IP address for SSH to listen on + mgmt_ip=$(echo "${ip}" | cut '-d ' -f1) # In case using "ip netmask" format rather than CIDR + done + IFS="$SAVE_IFS" +else + mgmt_ip=$(echo "${ip}" | cut '-d ' -f1) # In case using "ip netmask" format rather than CIDR +fi + +stopJail() { +# Check $status before issuing command + if [ "$status" = "STARTED" ]; then + echo "/etc/rc.d/jail stop ${name}" + echo "stop" >> "$__messages_out" + fi +} + +startJail() { +# Check $status before issuing command + if [ "$status" = "NOTSTART" ]; then + echo "/etc/rc.d/jail start ${name}" + echo "start" >> "$__messages_out" + fi +} + +deleteJail() { +# Unmount the jail's mountpoints if necessary + cat <=1 rw mount is mounted still + for DIR in "${output}"; do + umount -F "/etc/fstab.${name}" "\$(echo "${DIR}" | awk '{print $3}')" + done + fi + output="\$(mount | grep "\/${name} (")" || true + if [ -n "\${output}" ]; then # ro mount is mounted still + umount -F "/etc/fstab.${name}" "\$(echo "${output}" | awk '{print $3}')" + fi +EOF +# Remove the jail's rw mountpoints + echo "rm -rf \"${jaildir}/rw/${name}\"" +# Remove the jail directory + echo "rm -rf \"${jaildir}/${name}\"" +# Remove the jail's fstab + echo "rm -f \"/etc/fstab.${name}\"" +# Remove jail entry from jail.conf + cat <> "$__messages_out" +} + +createJail() { +# Create the jail directory +cat <> "$__messages_out" + +# Create the ro+rw mountpoint entries in fstab +cat </etc/fstab.${name} <>/etc/rc.conf + elif [ ! "\$(echo \$jail_enable | tr '[a-z]' '[A-Z]' | tr -d '"')" = "YES" ]; then # jail_enable="NO" + sed -i '.bak' 's/^jail_enable=.*$/jail_enable="YES"/g' /etc/rc.conf # fix this -^ + rm -f /etc/rc.conf.bak + fi + + jailfile=/etc/jail.conf + jailheader="${name} {" + + jaildata="path=\"${jaildir}/${name}\";" + + if [ "$devfsenable" = "true" ]; then + jaildata="\$jaildata + mount.devfs;" + else + jaildata="\$jaildata + mount.nodevfs;" + fi + + jaildata="\$jaildata + host.hostname=\"${hostname}\"; + ip4.addr=\"${ip}\"; + exec.start=\"/bin/sh /etc/rc\"; + exec.stop=\"/bin/sh /etc/rc.shutdown\"; + exec.consolelog=\"/var/log/jail_${name}_console.log\"; + mount.fstab=\"/etc/fstab.${name}\"; + allow.mount; + exec.clean; + allow.set_hostname=0; + allow.sysvipc=0; + allow.raw_sockets=0;" + + jailtrailer="}" + + if [ "$devfsenable" = "true" ] && [ "${devfsruleset}" = "jailrules" ]; then # The default ruleset is to be used + if [ ! -f /etc/devfs.rules ]; then + touch /etc/devfs.rules + fi + if [ -z "\$(grep '\[jailrules=' /etc/devfs.rules)" ]; then # The default ruleset doesn't exist + # Get the highest-numbered ruleset + highest="\$(sed -n 's/\[.*=\([0-9]*\)\]/\1/pg' /etc/devfs.rules | sort -u | tail -n 1)" || true + # increment by 1 + [ -z "\$highest" ] && highest=10 + let num="\${highest}+1" 2>&1 >/dev/null # Close the FD==fail... + # add default ruleset + cat >>/etc/devfs.rules <>\"\$jailfile\"" + +# Add $name to jail_list if $onboot=yes +if [ "$onboot" = "yes" ]; then + + # first check to see whether jail_enable="YES" exists in rc.conf or not and add it + # if necessary + + cat <> "$__messages_out" +fi + +# Add the normal entries into the jail's rc.conf +cat <"${jaildir}/rw/${name}/etc/rc.conf" +echo sshd_enable=\"YES\" >>"${jaildir}/rw/${name}/etc/rc.conf" +echo sendmail_enable=\"NONE\" >>"${jaildir}/rw/${name}/etc/rc.conf" +echo syslogd_enable=\"YES\" >>"${jaildir}/rw/${name}/etc/rc.conf" +echo syslogd_flags=\"-ss\" >>"${jaildir}/rw/${name}/etc/rc.conf" + +EOF +# Configure SSHd's listening address +cat <= 10.0 to manage jails. + + +REQUIRED PARAMETERS +------------------- +state + Either "present" or "absent", defaults to "present". + +jailbase + The location of the .tgz archive containing the base fs for your jails. + + +OPTIONAL PARAMETERS +------------------- +name + The name of the jail. Default is to use the object_id as the jail name. + +ip + The ifconfig style IP/netmask combination to use for the jail guest. If + the state parameter is "present," this parameter is required. + +hostname + The FQDN to use for the jail guest. Defaults to the name parameter. + +interface + The name of the physical interface on the jail server to bind the jail to. + Defaults to the first interface found in the output of ifconfig -l. + +devfs-ruleset + The name of the devfs ruleset to associate with the jail. Defaults to + "jailrules." This ruleset must be copied to the server via another type. + To use this option, devfs-enable must be "true." + +jaildir + The location on the remote server to use for hosting jail filesystems. + Defaults to /usr/jail. + +BOOLEAN PARAMETERS +------------------ +stopped + Do not start the jail + +devfs-disable + Whether to disallow devfs mounting within the jail + +onboot + Whether to add the jail to rc.conf's jail_list variable. + + +CAVEATS +------- +This type does not currently support modification of jail options. If, for +example a jail needs to have its IP address or netmask changed, the jail must +be removed then re-added with the correct IP address/netmask or the appropriate +modifications to jail.conf need to be made through alternate means. + +MESSAGES +-------- +start + The jail was started +stop + The jail was stopped +create: + The jail was created +delete + The jail was deleted +onboot + The jail was configured to start on boot + +EXAMPLES +-------- + +.. code-block:: sh + + # Create a jail called www + __jail_freebsd10 www --state present --ip "192.168.1.2" --jailbase /my/jail/base.tgz + + # Remove the jail called www + __jail_freebsd10 www --state absent --jailbase /my/jail/base.tgz + + # The jail www should not be started + __jail_freebsd10 www --state present --stopped \ + --ip "192.168.1.2 netmask 255.255.255.0" \ + --jailbase /my/jail/base.tgz + + # Use the name variable explicitly + __jail_freebsd10 thisjail --state present --name www \ + --ip "192.168.1.2" \ + --jailbase /my/jail/base.tgz + + # Go nuts + __jail_freebsd10 lotsofoptions --state present --name testjail \ + --ip "192.168.1.100 netmask 255.255.255.0" \ + --hostname "testjail.example.com" --interface "em0" \ + --onboot --jailbase /my/jail/base.tgz --jaildir /jails + + +SEE ALSO +-------- +:strong:`jail`\ (8) + + +AUTHORS +------- +Jake Guffey + + +COPYING +------- +Copyright \(C) 2012-2016 Jake Guffey. 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. diff --git a/cdist/conf/type/__jail_freebsd10/parameter/boolean b/cdist/conf/type/__jail_freebsd10/parameter/boolean new file mode 100644 index 00000000..39144f6f --- /dev/null +++ b/cdist/conf/type/__jail_freebsd10/parameter/boolean @@ -0,0 +1,3 @@ +onboot +stopped +devfs-disable diff --git a/cdist/conf/type/__jail_freebsd10/parameter/default/devfs-ruleset b/cdist/conf/type/__jail_freebsd10/parameter/default/devfs-ruleset new file mode 100644 index 00000000..f602aa0a --- /dev/null +++ b/cdist/conf/type/__jail_freebsd10/parameter/default/devfs-ruleset @@ -0,0 +1 @@ +jailrules diff --git a/cdist/conf/type/__jail_freebsd10/parameter/default/jailbase b/cdist/conf/type/__jail_freebsd10/parameter/default/jailbase new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/cdist/conf/type/__jail_freebsd10/parameter/default/jailbase @@ -0,0 +1 @@ + diff --git a/cdist/conf/type/__jail_freebsd10/parameter/default/jaildir b/cdist/conf/type/__jail_freebsd10/parameter/default/jaildir new file mode 100644 index 00000000..ec7d86c6 --- /dev/null +++ b/cdist/conf/type/__jail_freebsd10/parameter/default/jaildir @@ -0,0 +1 @@ +/usr/jail diff --git a/cdist/conf/type/__jail_freebsd10/parameter/default/state b/cdist/conf/type/__jail_freebsd10/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__jail_freebsd10/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__jail_freebsd10/parameter/optional b/cdist/conf/type/__jail_freebsd10/parameter/optional new file mode 100644 index 00000000..b36f0fa5 --- /dev/null +++ b/cdist/conf/type/__jail_freebsd10/parameter/optional @@ -0,0 +1,8 @@ +name +ip +hostname +interface +devfs-ruleset +jaildir +jailbase +state diff --git a/cdist/conf/type/__jail_freebsd9/explorer/basepresent b/cdist/conf/type/__jail_freebsd9/explorer/basepresent new file mode 100755 index 00000000..034128d5 --- /dev/null +++ b/cdist/conf/type/__jail_freebsd9/explorer/basepresent @@ -0,0 +1,54 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# 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 . +# +# +# See if the jailbase.tgz or $jaildir/base dir exists +# + +# Debug +#exec >&2 +#set -x + +if [ -f "$__object/parameter/jaildir" ]; then + jaildir="$(cat "$__object/parameter/jaildir")" +else + jaildir="/usr/jail" +fi + +name="base:jailbase.tgz" +out="" + +save_IFS="$IFS" +IFS=":" +for cur in $name; do + if [ -e "${jaildir}/$cur" ]; then + out="${out}:${cur}" + fi +done +IFS="$save_IFS" + +if [ -z "$out" ]; then + echo "NONE" +else + echo "${out}" +fi + +# Debug +#set +x + diff --git a/cdist/conf/type/__jail_freebsd9/explorer/present b/cdist/conf/type/__jail_freebsd9/explorer/present new file mode 100755 index 00000000..ddfb805c --- /dev/null +++ b/cdist/conf/type/__jail_freebsd9/explorer/present @@ -0,0 +1,43 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# 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 . +# +# +# See if the requested jail exists +# + +# Debug +#exec >&2 +#set -x + +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name=$__object_id +fi + +if [ -f "$__object/parameter/jaildir" ]; then + jaildir="$(cat "$__object/parameter/jaildir")" +else + jaildir="/usr/jail" +fi + +[ -d "${jaildir}/$name" ] && echo "EXISTS" || echo "NOTEXIST" + +#set +x + diff --git a/cdist/conf/type/__jail_freebsd9/explorer/status b/cdist/conf/type/__jail_freebsd9/explorer/status new file mode 100755 index 00000000..1ceba212 --- /dev/null +++ b/cdist/conf/type/__jail_freebsd9/explorer/status @@ -0,0 +1,52 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# 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 . +# +# +# See if the requested jail is started +# + +# Debug +#exec >&2 +#set -x + +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name="$__object_id" +fi + +if [ -f "$__object/parameter/jaildir" ]; then + jaildir="$(cat "$__object/parameter/jaildir")" +else + jaildir="/usr/jail" +fi +# backslash-escaped $jaildir +sjaildir="$(echo ${jaildir} | sed 's#/#\\/#g')" + +jls_output="$(jls | grep "[ ]${sjaildir}\/${name}\$")" || true + +if [ -n "${jls_output}" ]; then + echo "STARTED" +else + echo "NOTSTART" +fi + +# Debug +#set +x + diff --git a/cdist/conf/type/__jail/gencode-local b/cdist/conf/type/__jail_freebsd9/gencode-local similarity index 100% rename from cdist/conf/type/__jail/gencode-local rename to cdist/conf/type/__jail_freebsd9/gencode-local diff --git a/cdist/conf/type/__jail/gencode-remote b/cdist/conf/type/__jail_freebsd9/gencode-remote similarity index 98% rename from cdist/conf/type/__jail/gencode-remote rename to cdist/conf/type/__jail_freebsd9/gencode-remote index c88f3361..6a4c64de 100755 --- a/cdist/conf/type/__jail/gencode-remote +++ b/cdist/conf/type/__jail_freebsd9/gencode-remote @@ -1,6 +1,6 @@ #!/bin/sh # -# 2012,2014 Jake Guffey (jake.guffey at eprotex.com) +# 2012,2014,2016 Jake Guffey (jake.guffey at jointheirstm.org) # # This file is part of cdist. # @@ -18,8 +18,8 @@ # along with cdist. If not, see . # # -# The __jail type creates, configures, and deletes FreeBSD jails for use as -# virtual machines. +# The __jail_freebsd9 type creates, configures, and deletes FreeBSD jails +# for use as virtual machines on FreeBSD 9.x and before. # # Debug @@ -354,3 +354,4 @@ else # The jail does not currently exist exit 0 fi fi + diff --git a/cdist/conf/type/__jail_freebsd9/man.rst b/cdist/conf/type/__jail_freebsd9/man.rst new file mode 100644 index 00000000..cc79c785 --- /dev/null +++ b/cdist/conf/type/__jail_freebsd9/man.rst @@ -0,0 +1,124 @@ +cdist-type__jail_freebsd9(7) +============================ + +NAME +---- +cdist-type__jail_freebsd9 - Manage FreeBSD jails + + +DESCRIPTION +----------- +This type is used on FreeBSD <= 9.x to manage jails. + + +REQUIRED PARAMETERS +------------------- +state + Either "present" or "absent", defaults to "present". + +jailbase + The location of the .tgz archive containing the base fs for your jails. + + +OPTIONAL PARAMETERS +------------------- +name + The name of the jail. Default is to use the object_id as the jail name. + +ip + The ifconfig style IP/netmask combination to use for the jail guest. If + the state parameter is "present," this parameter is required. + +hostname + The FQDN to use for the jail guest. Defaults to the name parameter. + +interface + The name of the physical interface on the jail server to bind the jail to. + Defaults to the first interface found in the output of ifconfig -l. + +devfs-ruleset + The name of the devfs ruleset to associate with the jail. Defaults to + "jailrules." This ruleset must be copied to the server via another type. + To use this option, devfs-enable must be "true." + +jaildir + The location on the remote server to use for hosting jail filesystems. + Defaults to /usr/jail. + +BOOLEAN PARAMETERS +------------------ +stopped + Do not start the jail + +devfs-disable + Whether to disallow devfs mounting within the jail + +onboot + Whether to add the jail to rc.conf's jail_list variable. + + +CAVEATS +------- +This type does not currently support modification of jail options. If, for +example a jail needs to have its IP address or netmask changed, the jail must +be removed then re-added with the correct IP address/netmask or the appropriate +line (jail__ip="...") modified within rc.conf through some alternate +means. + +MESSAGES +-------- +start + The jail was started +stop + The jail was stopped +create: + The jail was created +delete + The jail was deleted +onboot + The jail was configured to start on boot + +EXAMPLES +-------- + +.. code-block:: sh + + # Create a jail called www + __jail_freebsd9 www --state present --ip "192.168.1.2" --jailbase /my/jail/base.tgz + + # Remove the jail called www + __jail_freebsd9 www --state absent --jailbase /my/jail/base.tgz + + # The jail www should not be started + __jail_freebsd9 www --state present --stopped \ + --ip "192.168.1.2 netmask 255.255.255.0" \ + --jailbase /my/jail/base.tgz + + # Use the name variable explicitly + __jail_freebsd9 thisjail --state present --name www \ + --ip "192.168.1.2" \ + --jailbase /my/jail/base.tgz + + # Go nuts + __jail_freebsd9 lotsofoptions --state present --name testjail \ + --ip "192.168.1.100 netmask 255.255.255.0" \ + --hostname "testjail.example.com" --interface "em0" \ + --onboot --jailbase /my/jail/base.tgz --jaildir /jails + + +SEE ALSO +-------- +:strong:`jail`\ (8) + + +AUTHORS +------- +Jake Guffey + + +COPYING +------- +Copyright \(C) 2012-2016 Jake Guffey. 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. diff --git a/cdist/conf/type/__jail_freebsd9/parameter/boolean b/cdist/conf/type/__jail_freebsd9/parameter/boolean new file mode 100644 index 00000000..39144f6f --- /dev/null +++ b/cdist/conf/type/__jail_freebsd9/parameter/boolean @@ -0,0 +1,3 @@ +onboot +stopped +devfs-disable diff --git a/cdist/conf/type/__jail_freebsd9/parameter/default/devfs-ruleset b/cdist/conf/type/__jail_freebsd9/parameter/default/devfs-ruleset new file mode 100644 index 00000000..f602aa0a --- /dev/null +++ b/cdist/conf/type/__jail_freebsd9/parameter/default/devfs-ruleset @@ -0,0 +1 @@ +jailrules diff --git a/cdist/conf/type/__jail_freebsd9/parameter/default/jailbase b/cdist/conf/type/__jail_freebsd9/parameter/default/jailbase new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/cdist/conf/type/__jail_freebsd9/parameter/default/jailbase @@ -0,0 +1 @@ + diff --git a/cdist/conf/type/__jail_freebsd9/parameter/default/jaildir b/cdist/conf/type/__jail_freebsd9/parameter/default/jaildir new file mode 100644 index 00000000..ec7d86c6 --- /dev/null +++ b/cdist/conf/type/__jail_freebsd9/parameter/default/jaildir @@ -0,0 +1 @@ +/usr/jail diff --git a/cdist/conf/type/__jail_freebsd9/parameter/default/state b/cdist/conf/type/__jail_freebsd9/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__jail_freebsd9/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__jail_freebsd9/parameter/optional b/cdist/conf/type/__jail_freebsd9/parameter/optional new file mode 100644 index 00000000..b36f0fa5 --- /dev/null +++ b/cdist/conf/type/__jail_freebsd9/parameter/optional @@ -0,0 +1,8 @@ +name +ip +hostname +interface +devfs-ruleset +jaildir +jailbase +state diff --git a/cdist/conf/type/__key_value/man.rst b/cdist/conf/type/__key_value/man.rst index 4b259c75..f069d989 100644 --- a/cdist/conf/type/__key_value/man.rst +++ b/cdist/conf/type/__key_value/man.rst @@ -1,8 +1,9 @@ cdist-type__key_value(7) ======================== -Change property values in files -Steven Armstrong +NAME +---- +cdist-type__key_value - Change property values in files DESCRIPTION @@ -71,21 +72,23 @@ EXAMPLES --delimiter ' = ' --comment '# my linux kernel should act as a router' # Remove existing key/value - __key_value LEGACY_KEY --file /etc/somefile --state absent --delimiter '=' + __key_value LEGACY_KEY --file /etc/somefile --state absent --delimiter '=' MORE INFORMATION ---------------- This type try to handle as many values as possible, so it doesn't use regexes. -So you need to exactly specify the key and delimiter. Delimiter can be of any lenght. +So you need to exactly specify the key and delimiter. Delimiter can be of any length. -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011 Steven Armstrong. 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. diff --git a/cdist/conf/type/__keyboard/man.rst b/cdist/conf/type/__keyboard/man.rst new file mode 100644 index 00000000..0eb4cde9 --- /dev/null +++ b/cdist/conf/type/__keyboard/man.rst @@ -0,0 +1,37 @@ +cdist-type__keyboard(7) +======================= + +NAME +---- +cdit-type__keyboard - Set keyboard layout + + +DESCRIPTION +----------- +This cdist type allows you to modify keyboard layout. + + +REQUIRED PARAMETERS +------------------- +type + Any valid type, for example "us" + + +EXAMPLES +-------- + +.. code-block:: sh + + # Set keyboard type to "us" + __keyboard --type "us" + + +AUTHORS +------- +Carlos Ortigoza + + +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+). diff --git a/cdist/conf/type/__keyboard/manifest b/cdist/conf/type/__keyboard/manifest new file mode 100644 index 00000000..3bfddf0b --- /dev/null +++ b/cdist/conf/type/__keyboard/manifest @@ -0,0 +1,50 @@ +#!/bin/sh +# +# Carlos Ortigoza (carlos.ortigoza at ungleich.ch) +# +# 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 . +# +# +# Configure keyboard type by modifying /etc/sysconfig/keyboard file. +# + +os=$(cat "$__global/explorer/os") +keyboard_type="$(cat "$__object/parameter/type")" + +case "$os" in + centos) + __file /etc/sysconfig/keyboard \ + --owner root --group root --mode 644 \ + --state exists + + require="__file/etc/sysconfig/keyboard" \ + __key_value KEYTABLE \ + --file /etc/sysconfig/keyboard \ + --delimiter '=' \ + --value "\"$keyboard_type\"" + + require="__file/etc/sysconfig/keyboard" \ + __key_value LAYOUT \ + --file /etc/sysconfig/keyboard \ + --delimiter '=' \ + --value "\"$keyboard_type\"" + ;; + *) + 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 diff --git a/cdist/conf/type/__keyboard/parameter/required b/cdist/conf/type/__keyboard/parameter/required new file mode 100644 index 00000000..aa80e646 --- /dev/null +++ b/cdist/conf/type/__keyboard/parameter/required @@ -0,0 +1 @@ +type diff --git a/cdist/conf/type/__keyboard/singleton b/cdist/conf/type/__keyboard/singleton new file mode 100644 index 00000000..e69de29b diff --git a/cdist/conf/type/__line/man.rst b/cdist/conf/type/__line/man.rst index f6d71a5a..e6adce9c 100644 --- a/cdist/conf/type/__line/man.rst +++ b/cdist/conf/type/__line/man.rst @@ -1,8 +1,9 @@ cdist-type__line(7) =================== -Manage lines in files -Nico Schottelius +NAME +---- +cdist-type__line - Manage lines in files DESCRIPTION @@ -60,11 +61,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- grep(1) +:strong:`grep`\ (1) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2012-2013 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012-2013 Nico Schottelius. 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. diff --git a/cdist/conf/type/__link/man.rst b/cdist/conf/type/__link/man.rst index 654b097b..9dc4665f 100644 --- a/cdist/conf/type/__link/man.rst +++ b/cdist/conf/type/__link/man.rst @@ -1,8 +1,9 @@ cdist-type__link(7) =================== -Manage links (hard and symbolic) -Nico Schottelius +NAME +---- +cdist-type__link - Manage links (hard and symbolic) DESCRIPTION @@ -46,12 +47,14 @@ EXAMPLES __link /opt/plone --state absent -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2012 Nico Schottelius. 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. diff --git a/cdist/conf/type/__locale/man.rst b/cdist/conf/type/__locale/man.rst index df337739..60a4eacc 100644 --- a/cdist/conf/type/__locale/man.rst +++ b/cdist/conf/type/__locale/man.rst @@ -1,8 +1,9 @@ cdist-type__locale(7) ===================== -Configure locales -Nico Schottelius +NAME +---- +cdist-type__locale - Configure locales DESCRIPTION @@ -33,12 +34,16 @@ EXAMPLES SEE ALSO -------- -- locale(1) -- localedef(1) -- `cdist-type(7) `_ +:strong:`locale`\ (1), :strong:`localedef`\ (1), :strong:`cdist-type__locale_system`\ (7) + + +AUTHORS +------- +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/manifest b/cdist/conf/type/__locale/manifest index c1837ae3..d360e9f3 100644 --- a/cdist/conf/type/__locale/manifest +++ b/cdist/conf/type/__locale/manifest @@ -30,7 +30,7 @@ case "$os" in # Debian needs a seperate package __package locales --state present ;; - archlinux|suse|ubuntu|centos) + archlinux|suse|ubuntu|scientific|centos) : ;; *) diff --git a/cdist/conf/type/__locale_system/man.rst b/cdist/conf/type/__locale_system/man.rst new file mode 100644 index 00000000..03d36960 --- /dev/null +++ b/cdist/conf/type/__locale_system/man.rst @@ -0,0 +1,64 @@ +cdist-type__locale_system(7) +============================ + +NAME +---- +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 +------------------- + +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 +-------- + +.. code-block:: sh + + # Set LANG to en_US.UTF-8 + __locale_system LANG + + # Same as above, but more explicit + __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:`cdist-type__locale`\ (7) + + +AUTHORS +------- +| Steven Armstrong +| Carlos Ortigoza +| Nico Schottelius + + +COPYING +------- +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 new file mode 100644 index 00000000..02cf48df --- /dev/null +++ b/cdist/conf/type/__locale_system/manifest @@ -0,0 +1,55 @@ +#!/bin/sh +# +# 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. +# +# 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 . +# +# +# Configure system-wide locale by modifying i18n file. +# + +os=$(cat "$__global/explorer/os") + +case "$os" in + 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 + ;; +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 new file mode 100644 index 00000000..d0460d86 --- /dev/null +++ b/cdist/conf/type/__locale_system/parameter/optional @@ -0,0 +1,2 @@ +state +value diff --git a/cdist/conf/type/__motd/man.rst b/cdist/conf/type/__motd/man.rst index 988e2d02..17369684 100644 --- a/cdist/conf/type/__motd/man.rst +++ b/cdist/conf/type/__motd/man.rst @@ -1,8 +1,9 @@ cdist-type__motd(7) =================== -Manage message of the day -Nico Schottelius +NAME +---- +cdist-type__motd - Manage message of the day DESCRIPTION @@ -34,12 +35,14 @@ EXAMPLES __motd --source "$__type/files/my-motd" -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Nico Schottelius 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). +Copyright \(C) 2011 Nico Schottelius. 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. diff --git a/cdist/conf/type/__mount/man.rst b/cdist/conf/type/__mount/man.rst index 696dfbd4..d719a1cd 100644 --- a/cdist/conf/type/__mount/man.rst +++ b/cdist/conf/type/__mount/man.rst @@ -1,8 +1,9 @@ cdist-type__mount(7) ==================== -Manage filesystem mounts -Steven Armstrong +NAME +---- +cdit-type__mount - Manage filesystem mounts DESCRIPTION @@ -70,12 +71,14 @@ EXAMPLES --options "mfsmaster=mfsmaster.domain.tld,mfssubfolder=/one,nonempty,_netdev" -SEE ALSO --------- -- `cdist-type(7) `_ +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 (GPLv3). +Copyright \(C) 2014 Steven Armstrong. 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. diff --git a/cdist/conf/type/__mysql_database/man.rst b/cdist/conf/type/__mysql_database/man.rst index 88f1eecd..1e245a08 100644 --- a/cdist/conf/type/__mysql_database/man.rst +++ b/cdist/conf/type/__mysql_database/man.rst @@ -1,8 +1,9 @@ cdist-type__mysql_database(7) ============================= -Manage a MySQL database -Benedikt Koeppel +NAME +---- +cdist-type__mysql_database - Manage a MySQL database DESCRIPTION @@ -35,12 +36,14 @@ EXAMPLES __mysql_database "cdist" --name "cdist" --user "myuser" --password "mypwd" -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Benedikt Koeppel COPYING ------- -Copyright \(C) 2012 Benedikt Koeppel. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Benedikt Koeppel. 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. diff --git a/cdist/conf/type/__package/man.rst b/cdist/conf/type/__package/man.rst index 1ada06a7..fc36402b 100644 --- a/cdist/conf/type/__package/man.rst +++ b/cdist/conf/type/__package/man.rst @@ -1,8 +1,9 @@ cdist-type__package(7) ====================== -Manage packages -Steven Armstrong +NAME +---- +cdist-type__package - Manage packages DESCRIPTION @@ -50,12 +51,14 @@ EXAMPLES __package vim --state present --type __package_apt -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011 Steven Armstrong. 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. diff --git a/cdist/conf/type/__package/manifest b/cdist/conf/type/__package/manifest index 6b0daa98..525691bb 100755 --- a/cdist/conf/type/__package/manifest +++ b/cdist/conf/type/__package/manifest @@ -30,7 +30,7 @@ else # By default determine package manager based on operating system os="$(cat "$__global/explorer/os")" case "$os" in - amazon|centos|fedora|redhat) type="yum" ;; + amazon|scientific|centos|fedora|redhat) type="yum" ;; archlinux) type="pacman" ;; debian|ubuntu|devuan) type="apt" ;; freebsd) @@ -43,6 +43,7 @@ else gentoo) type="emerge" ;; suse) type="zypper" ;; openwrt) type="opkg" ;; + openbsd) type="pkg_openbsd" ;; *) echo "Don't know how to manage packages on: $os" >&2 exit 1 diff --git a/cdist/conf/type/__package/parameter/boolean b/cdist/conf/type/__package/parameter/boolean new file mode 100644 index 00000000..effcb218 --- /dev/null +++ b/cdist/conf/type/__package/parameter/boolean @@ -0,0 +1 @@ +upgrade diff --git a/cdist/conf/type/__package/parameter/optional b/cdist/conf/type/__package/parameter/optional index d674f32e..bb3f5154 100644 --- a/cdist/conf/type/__package/parameter/optional +++ b/cdist/conf/type/__package/parameter/optional @@ -4,3 +4,4 @@ type pkgsite state ptype +repo diff --git a/cdist/conf/type/__package_apt/man.rst b/cdist/conf/type/__package_apt/man.rst index ec28c0cc..0a7958d4 100644 --- a/cdist/conf/type/__package_apt/man.rst +++ b/cdist/conf/type/__package_apt/man.rst @@ -1,8 +1,9 @@ cdist-type__package_apt(7) ========================== -Manage packages with apt-get -Nico Schottelius +NAME +---- +cdist-type__package_apt - Manage packages with apt-get DESCRIPTION @@ -45,11 +46,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ +:strong:`cdist-type__package`\ (7) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2012 Nico Schottelius. 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. diff --git a/cdist/conf/type/__package_emerge/man.rst b/cdist/conf/type/__package_emerge/man.rst index fe06031e..88adaff0 100644 --- a/cdist/conf/type/__package_emerge/man.rst +++ b/cdist/conf/type/__package_emerge/man.rst @@ -1,8 +1,9 @@ cdist-type__package_emerge(7) ============================= -Manage packages with portage -Thomas Oettli +NAME +---- +cdist-type__package_emerge - Manage packages with portage DESCRIPTION @@ -46,12 +47,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ -- `cdist-type__package_emerge_dependencies(7) `_ +:strong:`cdist-type__package`\ (7), :strong:`cdist-type__package_emerge_dependencies`\ (7) + + +AUTHORS +------- +Thomas Oettli COPYING ------- -Copyright \(C) 2013 Thomas Oettli. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2013 Thomas Oettli. 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. diff --git a/cdist/conf/type/__package_emerge_dependencies/man.rst b/cdist/conf/type/__package_emerge_dependencies/man.rst index 21af86e3..598d31f1 100644 --- a/cdist/conf/type/__package_emerge_dependencies/man.rst +++ b/cdist/conf/type/__package_emerge_dependencies/man.rst @@ -1,8 +1,9 @@ cdist-type__package_emerge_dependencies(7) ========================================== -Install dependencies for __package_emerge -Thomas Oettli +NAME +---- +cdist-type__package_emerge_dependencies - Install dependencies for __package_emerge DESCRIPTION @@ -35,12 +36,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ -- `cdist-type__package_emerge(7) `_ +:strong:`cdist-type__package`\ (7), :strong:`cdist-type__package_emerge`\ (7) + + +AUTHORS +------- +Thomas Oettli COPYING ------- -Copyright \(C) 2013 Thomas Oettli. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2013 Thomas Oettli. 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. diff --git a/cdist/conf/type/__package_luarocks/man.rst b/cdist/conf/type/__package_luarocks/man.rst index ff7fea83..5dc10195 100644 --- a/cdist/conf/type/__package_luarocks/man.rst +++ b/cdist/conf/type/__package_luarocks/man.rst @@ -1,8 +1,9 @@ cdist-type__package_luarocks(7) =============================== -Manage luarocks packages -Christian G. Warden +NAME +---- +cdist-type__package_luarocks - Manage luarocks packages DESCRIPTION @@ -38,11 +39,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ +:strong:`cdist-type__package`\ (7) + + +AUTHORS +------- +Christian G. Warden COPYING ------- -Copyright \(C) 2012 SwellPath, Inc. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 SwellPath, Inc. 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. diff --git a/cdist/conf/type/__package_opkg/man.rst b/cdist/conf/type/__package_opkg/man.rst index 9af17988..0fd40b33 100644 --- a/cdist/conf/type/__package_opkg/man.rst +++ b/cdist/conf/type/__package_opkg/man.rst @@ -1,8 +1,9 @@ cdist-type__package_opkg(7) =========================== -Manage packages with opkg -Giel van Schijndel +NAME +---- +cdist-type__package_opkg - Manage packages with opkg DESCRIPTION @@ -38,11 +39,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ +:strong:`cdist-type__package`\ (7) + + +AUTHORS +------- +Giel van Schijndel COPYING ------- -Copyright \(C) 2012 Giel van Schijndel. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Giel van Schijndel. 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. diff --git a/cdist/conf/type/__package_pacman/man.rst b/cdist/conf/type/__package_pacman/man.rst index 3d8845a5..2686202d 100644 --- a/cdist/conf/type/__package_pacman/man.rst +++ b/cdist/conf/type/__package_pacman/man.rst @@ -1,8 +1,9 @@ cdist-type__package_pacman(7) ============================= -Manage packages with pacman -Nico Schottelius +NAME +---- +cdist-type__package_pacman - Manage packages with pacman DESCRIPTION @@ -41,11 +42,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ +:strong:`cdist-type__package`\ (7) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2012 Nico Schottelius. 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. diff --git a/cdist/conf/type/__package_pip/man.rst b/cdist/conf/type/__package_pip/man.rst index b312fff5..234ceee2 100644 --- a/cdist/conf/type/__package_pip/man.rst +++ b/cdist/conf/type/__package_pip/man.rst @@ -1,8 +1,9 @@ cdist-type__package_pip(7) ========================== -Manage packages with pip -Nico Schottelius +NAME +---- +cdist-type__package_pip - Manage packages with pip DESCRIPTION @@ -48,11 +49,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ +:strong:`cdist-type__package`\ (7) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Nico Schottelius. 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. diff --git a/cdist/conf/type/__package_pkg_freebsd/man.rst b/cdist/conf/type/__package_pkg_freebsd/man.rst index c728cc9a..b06c7faf 100644 --- a/cdist/conf/type/__package_pkg_freebsd/man.rst +++ b/cdist/conf/type/__package_pkg_freebsd/man.rst @@ -1,8 +1,9 @@ cdist-type__package_pkg_freebsd(7) ================================== -Manage FreeBSD packages -Jake Guffey +NAME +---- +cdist-type__package_pkg_freebsd - Manage FreeBSD packages DESCRIPTION @@ -53,11 +54,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ +:strong:`cdist-type__package`\ (7) + + +AUTHORS +------- +Jake Guffey COPYING ------- -Copyright \(C) 2012 Jake Guffey. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Jake Guffey. 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. diff --git a/cdist/conf/type/__package_pkg_openbsd/man.rst b/cdist/conf/type/__package_pkg_openbsd/man.rst index f9a746b9..0814029f 100644 --- a/cdist/conf/type/__package_pkg_openbsd/man.rst +++ b/cdist/conf/type/__package_pkg_openbsd/man.rst @@ -1,8 +1,9 @@ cdist-type__package_pkg(7) ========================== -Manage OpenBSD packages -Andi Brönnimann +NAME +---- +cdist-type__package_pkg - Manage OpenBSD packages DESCRIPTION @@ -53,8 +54,12 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ +:strong:`cdist-type__package`\ (7) + + +AUTHORS +------- +Andi Brönnimann COPYING diff --git a/cdist/conf/type/__package_pkgng_freebsd/man.rst b/cdist/conf/type/__package_pkgng_freebsd/man.rst index 36f1a7d8..251e2c5f 100644 --- a/cdist/conf/type/__package_pkgng_freebsd/man.rst +++ b/cdist/conf/type/__package_pkgng_freebsd/man.rst @@ -1,8 +1,9 @@ cdist-type__package_pkgng_freebsd(7) ==================================== -Manage FreeBSD packages with pkg-ng -Jake Guffey +NAME +---- +cdist-type__package_pkgng_freebsd - Manage FreeBSD packages with pkg-ng DESCRIPTION @@ -84,11 +85,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ +:strong:`cdist-type__package`\ (7) + + +AUTHORS +------- +Jake Guffey COPYING ------- -Copyright \(C) 2014 Jake Guffey. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2014 Jake Guffey. 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. diff --git a/cdist/conf/type/__package_rubygem/man.rst b/cdist/conf/type/__package_rubygem/man.rst index 4cb9af04..96ad21f7 100644 --- a/cdist/conf/type/__package_rubygem/man.rst +++ b/cdist/conf/type/__package_rubygem/man.rst @@ -1,8 +1,9 @@ cdist-type__package_rubygem(7) ============================== -Manage rubygem packages -Chase Allen James +NAME +---- +cdist-type__package_rubygem - Manage rubygem packages DESCRIPTION @@ -38,11 +39,18 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ +:strong:`cdist-type__package`\ (7) + + +AUTHORS +------- +Chase Allen James COPYING ------- -Copyright \(C) 2011 Chase Allen James. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). + +Copyright \(C) 2011 Chase Allen James. 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. diff --git a/cdist/conf/type/__package_update_index/gencode-remote b/cdist/conf/type/__package_update_index/gencode-remote index 589e7202..bf6a532d 100755 --- a/cdist/conf/type/__package_update_index/gencode-remote +++ b/cdist/conf/type/__package_update_index/gencode-remote @@ -29,7 +29,7 @@ else # By default determine package manager based on operating system os="$(cat "$__global/explorer/os")" case "$os" in - amazon|centos|fedora|redhat) type="yum" ;; + amazon|scientific|centos|fedora|redhat) type="yum" ;; debian|ubuntu|devuan) type="apt" ;; archlinux) type="pacman" ;; *) diff --git a/cdist/conf/type/__package_update_index/man.rst b/cdist/conf/type/__package_update_index/man.rst index a16d29ce..454aa05b 100644 --- a/cdist/conf/type/__package_update_index/man.rst +++ b/cdist/conf/type/__package_update_index/man.rst @@ -1,8 +1,9 @@ cdist-type__package_update_index(7) =================================== -Update the package index -Ricardo Catalinas Jiménez +NAME +---- +cdist-type__update_index - Update the package index DESCRIPTION @@ -21,7 +22,7 @@ OPTIONAL PARAMETERS type The package manager to use. Default is determined based on the $os explorer variable. - e.g. + e.g. * apt for Debian * yum for Red Hat * pacman for Arch Linux @@ -39,12 +40,15 @@ EXAMPLES __package_update_index --type apt -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Ricardo Catalinas Jiménez COPYING ------- -Copyright \(C) 2014 Ricardo Catalinas Jiménez. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). + +Copyright \(C) 2014 Ricardo Catalinas Jiménez. 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. diff --git a/cdist/conf/type/__package_upgrade_all/gencode-remote b/cdist/conf/type/__package_upgrade_all/gencode-remote index 4d034816..9dd3ddf6 100755 --- a/cdist/conf/type/__package_upgrade_all/gencode-remote +++ b/cdist/conf/type/__package_upgrade_all/gencode-remote @@ -30,7 +30,7 @@ else # By default determine package manager based on operating system os="$(cat "$__global/explorer/os")" case "$os" in - amazon|centos|fedora|redhat) type="yum" ;; + amazon|scientific|centos|fedora|redhat) type="yum" ;; debian|ubuntu|devuan) type="apt" ;; archlinux) type="pacman" ;; *) diff --git a/cdist/conf/type/__package_upgrade_all/man.rst b/cdist/conf/type/__package_upgrade_all/man.rst index 146a8259..62cbc43d 100644 --- a/cdist/conf/type/__package_upgrade_all/man.rst +++ b/cdist/conf/type/__package_upgrade_all/man.rst @@ -1,8 +1,9 @@ cdist-type__package_upgrade_all(7) ================================== -Upgrade all the installed packages -Ricardo Catalinas Jiménez +NAME +---- +cdist-type__package_upgrade_all - Upgrade all the installed packages DESCRIPTION @@ -39,12 +40,14 @@ EXAMPLES __package_upgrade_all --type apt -SEE ALSO --------- -- `cdist-type(7) `_ - +AUTHORS +------- +Ricardo Catalinas Jiménez COPYING ------- -Copyright \(C) 2014 Ricardo Catalinas Jiménez. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). + +Copyright \(C) 2014 Ricardo Catalinas Jiménez. 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. diff --git a/cdist/conf/type/__package_yum/gencode-remote b/cdist/conf/type/__package_yum/gencode-remote index 32a794a0..08c5c2b5 100755 --- a/cdist/conf/type/__package_yum/gencode-remote +++ b/cdist/conf/type/__package_yum/gencode-remote @@ -37,7 +37,7 @@ fi state_should="$(cat "$__object/parameter/state")" -if grep -q -E "(centos|redhat|amazon)" "$__global/explorer/os"; then +if grep -q -E "(scientific|centos|redhat|amazon)" "$__global/explorer/os"; then opts="-y --quiet" else opts="--assumeyes --quiet" diff --git a/cdist/conf/type/__package_yum/man.rst b/cdist/conf/type/__package_yum/man.rst index 65e56c7a..45ad9a55 100644 --- a/cdist/conf/type/__package_yum/man.rst +++ b/cdist/conf/type/__package_yum/man.rst @@ -1,8 +1,9 @@ cdist-type__package_yum(7) ========================== -Manage packages with yum -Nico Schottelius +NAME +---- +cdist-type__package_yum - Manage packages with yum DESCRIPTION @@ -48,11 +49,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ +:strong:`cdist-type__package`\ (7) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2012 Nico Schottelius. 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. diff --git a/cdist/conf/type/__package_zypper/man.rst b/cdist/conf/type/__package_zypper/man.rst index 2df22e72..0051359b 100644 --- a/cdist/conf/type/__package_zypper/man.rst +++ b/cdist/conf/type/__package_zypper/man.rst @@ -1,8 +1,9 @@ cdist-type__package_zypper(7) ============================= -Manage packages with zypper -Daniel Heule +NAME +---- +cdist-type__package_zypper - Manage packages with zypper DESCRIPTION @@ -55,12 +56,18 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__package(7) `_ +:strong:`cdist-type__package`\ (7) + + +AUTHORS +------- +Daniel Heule COPYING ------- Copyright \(C) 2012 Nico Schottelius. Copyright \(C) 2013 Daniel Heule. -Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3). +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. diff --git a/cdist/conf/type/__pacman_conf/man.rst b/cdist/conf/type/__pacman_conf/man.rst index 930035fa..6b8adfc9 100644 --- a/cdist/conf/type/__pacman_conf/man.rst +++ b/cdist/conf/type/__pacman_conf/man.rst @@ -1,8 +1,9 @@ cdist-type__pacman_conf(7) ========================== -Manage pacman configuration -Dominique Roux +NAME +---- +cdist-type__pacman_conf - Manage pacman configuration DESCRIPTION @@ -58,11 +59,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- grep(1) +:strong:`grep`\ (1) + + +AUTHORS +------- +Dominique Roux COPYING ------- -Copyright \(C) 2015 Dominique Roux. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Dominique Roux. 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. diff --git a/cdist/conf/type/__pacman_conf_integrate/man.rst b/cdist/conf/type/__pacman_conf_integrate/man.rst index 6a856efe..c21b56d8 100644 --- a/cdist/conf/type/__pacman_conf_integrate/man.rst +++ b/cdist/conf/type/__pacman_conf_integrate/man.rst @@ -1,8 +1,9 @@ cdist-type__pacman_conf_integrate(7) ==================================== -Integrate default pacman.conf to cdist conform and vice versa -Dominique Roux +NAME +---- +cdist-type__pacman_conf_integrate - Integrate default pacman.conf to cdist conform and vice versa DESCRIPTION @@ -34,11 +35,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- grep(1) +:strong:`grep`\ (1) + + +AUTHORS +------- +Dominique Roux COPYING ------- -Copyright \(C) 2015 Dominique Roux. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Dominique Roux. 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. diff --git a/cdist/conf/type/__pf_apply/man.rst b/cdist/conf/type/__pf_apply/man.rst index 0b440e2d..eee345e7 100644 --- a/cdist/conf/type/__pf_apply/man.rst +++ b/cdist/conf/type/__pf_apply/man.rst @@ -1,12 +1,9 @@ cdist-type__pf_apply(7) ======================= -Apply pf(4) ruleset on \*BSD - -Jake Guffey - NAME ---- +cdist-type__pf_apply - Apply pf(4) ruleset on \*BSD DESCRIPTION @@ -42,12 +39,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__pf_ruleset(7) `_ -- pf(4) +:strong:`pf`\ (4), :strong:`cdist-type__pf_ruleset`\ (7) + + +AUTHORS +------- +Jake Guffey COPYING ------- -Copyright \(C) 2012 Jake Guffey. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Jake Guffey. 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. diff --git a/cdist/conf/type/__pf_ruleset/man.rst b/cdist/conf/type/__pf_ruleset/man.rst index b3e9b073..5719e94e 100644 --- a/cdist/conf/type/__pf_ruleset/man.rst +++ b/cdist/conf/type/__pf_ruleset/man.rst @@ -1,8 +1,9 @@ cdist-type__pf_ruleset(7) ========================= -Copy a pf(4) ruleset to $__target_host -Jake Guffey +NAME +---- +cdist-type__pf_ruleset - Copy a pf(4) ruleset to $__target_host DESCRIPTION @@ -38,11 +39,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- pf(4) +:strong:`pf`\ (4) + + +AUTHORS +------- +Jake Guffey COPYING ------- -Copyright \(C) 2012 Jake Guffey. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Jake Guffey. 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. diff --git a/cdist/conf/type/__postfix/man.rst b/cdist/conf/type/__postfix/man.rst index d10a9960..43b158e0 100644 --- a/cdist/conf/type/__postfix/man.rst +++ b/cdist/conf/type/__postfix/man.rst @@ -1,8 +1,9 @@ cdist-type__postfix(7) ====================== -Install postfix -Steven Armstrong +NAME +---- +cdist-type__postfix - Install postfix DESCRIPTION @@ -28,12 +29,14 @@ EXAMPLES __postfix -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2012 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Steven Armstrong. 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. diff --git a/cdist/conf/type/__postfix/manifest b/cdist/conf/type/__postfix/manifest index 43443e1e..b425e072 100755 --- a/cdist/conf/type/__postfix/manifest +++ b/cdist/conf/type/__postfix/manifest @@ -22,7 +22,7 @@ os=$(cat "$__global/explorer/os") case "$os" in - ubuntu|debian|archlinux|suse|centos|devuan) + ubuntu|debian|archlinux|suse|scientific|centos|devuan) __package postfix --state present ;; *) diff --git a/cdist/conf/type/__postfix_master/man.rst b/cdist/conf/type/__postfix_master/man.rst index 4853e687..07756f74 100644 --- a/cdist/conf/type/__postfix_master/man.rst +++ b/cdist/conf/type/__postfix_master/man.rst @@ -1,8 +1,9 @@ cdist-type__postfix_master(7) ============================= -Configure postfix master.cf -Steven Armstrong +NAME +---- +cdist-type__postfix_master - Configure postfix master.cf DESCRIPTION @@ -67,12 +68,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- master(5) +:strong:`master`\ (5) + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2012 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). - +Copyright \(C) 2012 Steven Armstrong. 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. diff --git a/cdist/conf/type/__postfix_master/manifest b/cdist/conf/type/__postfix_master/manifest index 3d82c526..af71b88e 100755 --- a/cdist/conf/type/__postfix_master/manifest +++ b/cdist/conf/type/__postfix_master/manifest @@ -22,7 +22,7 @@ os=$(cat "$__global/explorer/os") case "$os" in - ubuntu|debian|archlinux|centos|devuan) + ubuntu|debian|archlinux|scientific|centos|devuan) : ;; *) diff --git a/cdist/conf/type/__postfix_postconf/explorer/value b/cdist/conf/type/__postfix_postconf/explorer/value index d451bce6..17126c94 100755 --- a/cdist/conf/type/__postfix_postconf/explorer/value +++ b/cdist/conf/type/__postfix_postconf/explorer/value @@ -22,7 +22,7 @@ os=$("$__explorer/os") case "$os" in - ubuntu|debian|archlinux|suse|centos|devuan) + ubuntu|debian|archlinux|suse|scientific|centos|devuan) : ;; *) diff --git a/cdist/conf/type/__postfix_postconf/gencode-remote b/cdist/conf/type/__postfix_postconf/gencode-remote index b3557640..f886499b 100755 --- a/cdist/conf/type/__postfix_postconf/gencode-remote +++ b/cdist/conf/type/__postfix_postconf/gencode-remote @@ -21,7 +21,7 @@ os=$(cat "$__global/explorer/os") case "$os" in - ubuntu|debian|archlinux|suse|centos|devuan) + ubuntu|debian|archlinux|suse|scientific|centos|devuan) : ;; *) diff --git a/cdist/conf/type/__postfix_postconf/man.rst b/cdist/conf/type/__postfix_postconf/man.rst index e07e136f..3222d4a7 100644 --- a/cdist/conf/type/__postfix_postconf/man.rst +++ b/cdist/conf/type/__postfix_postconf/man.rst @@ -1,8 +1,9 @@ cdist-type__postfix_postconf(7) =============================== -Configure postfix main.cf -Steven Armstrong +NAME +---- +cdist-type__postfix_postconf - Configure postfix main.cf DESCRIPTION @@ -37,11 +38,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- postconf(5) +:strong:`postconf`\ (5) + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2012 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Steven Armstrong. 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. diff --git a/cdist/conf/type/__postfix_postmap/man.rst b/cdist/conf/type/__postfix_postmap/man.rst index ecee6722..2a82b44a 100644 --- a/cdist/conf/type/__postfix_postmap/man.rst +++ b/cdist/conf/type/__postfix_postmap/man.rst @@ -1,8 +1,9 @@ cdist-type__postfix_postmap(7) ============================== -Run postmap on the given file -Steven Armstrong +NAME +---- +cdist-type__postfix_postmap - Run postmap on the given file DESCRIPTION @@ -28,12 +29,14 @@ EXAMPLES __postfix_postmap /etc/postfix/generic -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2012 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Steven Armstrong. 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. diff --git a/cdist/conf/type/__postfix_reload/gencode-remote b/cdist/conf/type/__postfix_reload/gencode-remote index 7323606c..0efd6022 100755 --- a/cdist/conf/type/__postfix_reload/gencode-remote +++ b/cdist/conf/type/__postfix_reload/gencode-remote @@ -22,7 +22,7 @@ os=$(cat "$__global/explorer/os") case "$os" in - ubuntu|debian|archlinux|centos|devuan) + ubuntu|debian|archlinux|scientific|centos|devuan) echo "postfix reload" ;; *) diff --git a/cdist/conf/type/__postfix_reload/man.rst b/cdist/conf/type/__postfix_reload/man.rst index c5101953..944e22fa 100644 --- a/cdist/conf/type/__postfix_reload/man.rst +++ b/cdist/conf/type/__postfix_reload/man.rst @@ -1,8 +1,9 @@ cdist-type__postfix_reload(7) ============================= -Tell postfix to reload its configuration -Steven Armstrong +NAME +---- +cdist-type__postfix_reload - Tell postfix to reload its configuration DESCRIPTION @@ -28,12 +29,14 @@ EXAMPLES __postfix_reload -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2012 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Steven Armstrong. 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. diff --git a/cdist/conf/type/__postgres_database/man.rst b/cdist/conf/type/__postgres_database/man.rst index 152ee910..acceec9b 100644 --- a/cdist/conf/type/__postgres_database/man.rst +++ b/cdist/conf/type/__postgres_database/man.rst @@ -1,8 +1,9 @@ cdist-type__postgres_database(7) ================================ -Create/drop postgres databases -Steven Armstrong +NAME +---- +cdist-type__postgres_database - Create/drop postgres databases DESCRIPTION @@ -29,11 +30,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__postgres_role(7) `_ +:strong:`cdist-type__postgres_role`\ (7) + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011 Steven Armstrong. 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. diff --git a/cdist/conf/type/__postgres_role/man.rst b/cdist/conf/type/__postgres_role/man.rst index 6384568f..11fd73d5 100644 --- a/cdist/conf/type/__postgres_role/man.rst +++ b/cdist/conf/type/__postgres_role/man.rst @@ -1,8 +1,9 @@ cdist-type__postgres_role(7) ============================ -Manage postgres roles -Steven Armstrong +NAME +---- +cdist-type__postgres_role - Manage postgres roles DESCRIPTION @@ -47,12 +48,20 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__postgres_database(7) `_ -- http://www.postgresql.org/docs/current/static/sql-createrole.html +:strong:`cdist-type__postgres_database`\ (7) + +postgresql documentation at: +. + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011 Steven Armstrong. 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. diff --git a/cdist/conf/type/__process/man.rst b/cdist/conf/type/__process/man.rst index 09032a1a..e439f37c 100644 --- a/cdist/conf/type/__process/man.rst +++ b/cdist/conf/type/__process/man.rst @@ -1,8 +1,9 @@ cdist-type__process(7) ====================== -Start or stop process -Nico Schottelius +NAME +---- +cdist-type__process - Start or stop process DESCRIPTION @@ -57,11 +58,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__start_on_boot(7) `_ +:strong:`cdist-type__start_on_boot`\ (7) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011-2012 Nico Schottelius. 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. diff --git a/cdist/conf/type/__pyvenv/man.rst b/cdist/conf/type/__pyvenv/man.rst old mode 100755 new mode 100644 index bdc1166c..d7de92fa --- a/cdist/conf/type/__pyvenv/man.rst +++ b/cdist/conf/type/__pyvenv/man.rst @@ -1,8 +1,9 @@ cdist-type__pyvenv(7) ===================== -Create or remove python virtual environment -Darko Poljak +NAME +---- +cdist-type__pyvenv - Create or remove python virtual environment DESCRIPTION @@ -66,13 +67,13 @@ EXAMPLES __pyvenv /home/services/djangoenv --venvparams "--copies --system-site-packages" -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Darko Poljak COPYING ------- Copyright \(C) 2016 Darko Poljak. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +granted under the terms of the GNU General Public License v3 or later (GPLv3+). diff --git a/cdist/conf/type/__qemu_img/man.rst b/cdist/conf/type/__qemu_img/man.rst index 598e06ab..210c7f5f 100644 --- a/cdist/conf/type/__qemu_img/man.rst +++ b/cdist/conf/type/__qemu_img/man.rst @@ -1,8 +1,9 @@ cdist-type__qemu_img(7) ======================= -Manage VM disk images -Nico Schottelius +NAME +---- +cdist-type__qemu_img - Manage VM disk images DESCRIPTION @@ -36,11 +37,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- qemu-img(1) +:strong:`qemu-img`\ (1) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2012-2014 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012-2014 Nico Schottelius. 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. diff --git a/cdist/conf/type/__rbenv/man.rst b/cdist/conf/type/__rbenv/man.rst index 314507fe..607019cf 100644 --- a/cdist/conf/type/__rbenv/man.rst +++ b/cdist/conf/type/__rbenv/man.rst @@ -1,8 +1,9 @@ cdist-type__rbenv(7) ==================== -Manage rbenv installation -Nico Schottelius +NAME +---- +cdist-type__rbenv - Manage rbenv installation DESCRIPTION @@ -35,12 +36,14 @@ EXAMPLES __rbenv /home/bastian --state absent -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2012-2014 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012-2014 Nico Schottelius. 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. diff --git a/cdist/conf/type/__rsync/man.rst b/cdist/conf/type/__rsync/man.rst index bc7b1bca..94b06d63 100644 --- a/cdist/conf/type/__rsync/man.rst +++ b/cdist/conf/type/__rsync/man.rst @@ -1,8 +1,9 @@ cdist-type__rsync(7) ==================== -Mirror directories using rsync -Nico Schottelius +NAME +---- +cdist-type__rsync - Mirror directories using rsync DESCRIPTION @@ -97,11 +98,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- rsync(1) +:strong:`rsync`\ (1) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2015 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Nico Schottelius. 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. diff --git a/cdist/conf/type/__rvm/man.rst b/cdist/conf/type/__rvm/man.rst index 8a3f72f5..3a914304 100644 --- a/cdist/conf/type/__rvm/man.rst +++ b/cdist/conf/type/__rvm/man.rst @@ -1,8 +1,9 @@ cdist-type__rvm(7) ================== -Install rvm for a given user -Evax Software +NAME +---- +cdist-type__rvm - Install rvm for a given user DESCRIPTION @@ -30,10 +31,13 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__rvm_ruby(7) `_ -- `cdist-type__rvm_gemset(7) `_ -- `cdist-type__rvm_gem(7) `_ +:strong:`cdist-type__rvm_gem`\ (7), :strong:`cdist-type__rvm_gemset`\ (7), +:strong:`cdist-type__rvm_ruby`\ (7) + + +AUTHORS +------- +Evax Software COPYING diff --git a/cdist/conf/type/__rvm_gem/man.rst b/cdist/conf/type/__rvm_gem/man.rst index 39d93065..5f3fba97 100644 --- a/cdist/conf/type/__rvm_gem/man.rst +++ b/cdist/conf/type/__rvm_gem/man.rst @@ -1,8 +1,9 @@ cdist-type__rvm_gemset(7) ========================== -Manage Ruby gems through rvm -Evax Software +NAME +---- +cdist-type__rvm_gemset - Manage Ruby gems through rvm DESCRIPTION @@ -42,10 +43,13 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__rvm(7) `_ -- `cdist-type__rvm_ruby(7) `_ -- `cdist-type__rvm_gemset(7) `_ +:strong:`cdist-type__rvm`\ (7), :strong:`cdist-type__rvm_gemset`\ (7), +:strong:`cdist-type__rvm_ruby`\ (7) + + +AUTHORS +------- +Evax Software COPYING diff --git a/cdist/conf/type/__rvm_gemset/man.rst b/cdist/conf/type/__rvm_gemset/man.rst index 422130cb..fca4c36a 100644 --- a/cdist/conf/type/__rvm_gemset/man.rst +++ b/cdist/conf/type/__rvm_gemset/man.rst @@ -1,8 +1,9 @@ cdist-type__rvm_gemset(7) ========================== -Manage gemsets through rvm -Evax Software +NAME +---- +cdist-type__rvm_gemset - Manage gemsets through rvm DESCRIPTION @@ -40,10 +41,13 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__rvm(7) `_ -- `cdist-type__rvm_ruby(7) `_ -- `cdist-type__rvm_gem(7) `_ +:strong:`cdist-type__rvm`\ (7), :strong:`cdist-type__rvm_gem`\ (7), +:strong:`cdist-type__rvm_ruby`\ (7) + + +AUTHORS +------- +Evax Software COPYING diff --git a/cdist/conf/type/__rvm_ruby/man.rst b/cdist/conf/type/__rvm_ruby/man.rst index dbb1c9a2..f6e71e12 100644 --- a/cdist/conf/type/__rvm_ruby/man.rst +++ b/cdist/conf/type/__rvm_ruby/man.rst @@ -1,8 +1,9 @@ cdist-type__rvm_ruby(7) ======================= -Manage ruby installations through rvm -Evax Software +NAME +---- +cdist-type__rvm_ruby - Manage ruby installations through rvm DESCRIPTION @@ -41,10 +42,13 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__rvm(7) `_ -- `cdist-type__rvm_gemset(7) `_ -- `cdist-type__rvm_gem(7) `_ +:strong:`cdist-type__rvm`\ (7), :strong:`cdist-type__rvm_gem`\ (7), +:strong:`cdist-type__rvm_gemset`\ (7) + + +AUTHORS +------- +Evax Software COPYING diff --git a/cdist/conf/type/__ssh_authorized_key/man.rst b/cdist/conf/type/__ssh_authorized_key/man.rst index 984ea51b..b58ad879 100644 --- a/cdist/conf/type/__ssh_authorized_key/man.rst +++ b/cdist/conf/type/__ssh_authorized_key/man.rst @@ -1,8 +1,9 @@ cdist-type__ssh_authorized_key(7) ================================= -Manage a single ssh authorized key entry -Steven Armstrong +NAME +---- +cdist-type__ssh_authorized_key - Manage a single ssh authorized key entry DESCRIPTION @@ -54,11 +55,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist__ssh_authorized_keys(7) `_ -- sshd(8) +:strong:`cdist__ssh_authorized_keys`\ (7), :strong:`sshd`\ (8) + + +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 (GPLv3). +Copyright \(C) 2014 Steven Armstrong. 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. diff --git a/cdist/conf/type/__ssh_authorized_keys/man.rst b/cdist/conf/type/__ssh_authorized_keys/man.rst index 0907c2b3..ba310ff9 100644 --- a/cdist/conf/type/__ssh_authorized_keys/man.rst +++ b/cdist/conf/type/__ssh_authorized_keys/man.rst @@ -1,8 +1,9 @@ cdist-type__ssh_authorized_keys(7) ================================== -Manage ssh authorized_keys files -Steven Armstrong +NAME +---- +cdist-type__ssh_authorized_keys - Manage ssh authorized_keys files DESCRIPTION @@ -104,11 +105,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- sshd(8) +:strong:`sshd`\ (8) + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2012-2014 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012-2014 Steven Armstrong. 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. diff --git a/cdist/conf/type/__ssh_dot_ssh/man.rst b/cdist/conf/type/__ssh_dot_ssh/man.rst index 1b84c924..7d35affa 100644 --- a/cdist/conf/type/__ssh_dot_ssh/man.rst +++ b/cdist/conf/type/__ssh_dot_ssh/man.rst @@ -1,12 +1,9 @@ cdist-type__ssh_dot_ssh(7) ========================== -Manage .ssh directory - -Nico Schottelius - NAME ---- +cdist-type__ssh_dot_ssh - Manage .ssh directory DESCRIPTION @@ -36,11 +33,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__ssh_authorized_keys(7) `_ +:strong:`cdist-type__ssh_authorized_keys`\ (7) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2014 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2014 Nico Schottelius. 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. diff --git a/cdist/conf/type/__staged_file/man.rst b/cdist/conf/type/__staged_file/man.rst index ed977b28..9a6ba732 100644 --- a/cdist/conf/type/__staged_file/man.rst +++ b/cdist/conf/type/__staged_file/man.rst @@ -1,8 +1,9 @@ cdist-type__staged_file(7) ========================== -Manage staged files -Steven Armstrong +NAME +---- +cdist-type__staged_file - Manage staged files DESCRIPTION @@ -14,7 +15,7 @@ cdist) and then deployed to the target host using the __file type. REQUIRED PARAMETERS ------------------- source - the URL from which to retreive the source file. + the URL from which to retrieve the source file. e.g. * https://dl.bintray.com/mitchellh/consul/0.4.1_linux_amd64.zip @@ -98,11 +99,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__file(7) `_ +:strong:`cdist-type__file`\ (7) + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2015 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2015 Steven Armstrong. 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. diff --git a/cdist/conf/type/__start_on_boot/explorer/state b/cdist/conf/type/__start_on_boot/explorer/state index ca0f3a51..d49f01c7 100644 --- a/cdist/conf/type/__start_on_boot/explorer/state +++ b/cdist/conf/type/__start_on_boot/explorer/state @@ -47,7 +47,7 @@ else [ -f "/etc/init/${name}.conf" ] && state="present" ;; - amazon|centos|fedora|owl|redhat) + amazon|scientific|centos|fedora|owl|redhat) state=$(chkconfig --level "$runlevel" "$name" || echo absent) [ "$state" ] || state="present" ;; diff --git a/cdist/conf/type/__start_on_boot/gencode-remote b/cdist/conf/type/__start_on_boot/gencode-remote index 057f9f48..e77132c9 100644 --- a/cdist/conf/type/__start_on_boot/gencode-remote +++ b/cdist/conf/type/__start_on_boot/gencode-remote @@ -59,7 +59,7 @@ case "$state_should" in echo rc-update add \"$name\" \"$target_runlevel\" ;; - amazon|centos|fedora|owl|redhat|suse) + amazon|scientific|centos|fedora|owl|redhat|suse) echo chkconfig \"$name\" on ;; diff --git a/cdist/conf/type/__start_on_boot/man.rst b/cdist/conf/type/__start_on_boot/man.rst index 2fb2c7d9..851d1a89 100644 --- a/cdist/conf/type/__start_on_boot/man.rst +++ b/cdist/conf/type/__start_on_boot/man.rst @@ -1,8 +1,9 @@ cdist-type__start_on_boot(7) ============================ -Manage stuff to be started at boot -Nico Schottelius +NAME +---- +cdist-type__start_on_boot - Manage stuff to be started at boot DESCRIPTION @@ -44,11 +45,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__process(7) `_ +:strong:`cdist-type__process`\ (7) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Nico Schottelius. 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. 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/cdist/conf/type/__sysctl/gencode-remote b/cdist/conf/type/__sysctl/gencode-remote new file mode 100755 index 00000000..0f3b0b40 --- /dev/null +++ b/cdist/conf/type/__sysctl/gencode-remote @@ -0,0 +1,30 @@ +#!/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 . +# + +value_should="$(cat "$__object/parameter/value")" +value_is="$(cat "$__object/explorer/value")" + +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..6873003e --- /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/cdist/conf/type/__timezone/man.rst b/cdist/conf/type/__timezone/man.rst index 083f4fe6..8a945c16 100644 --- a/cdist/conf/type/__timezone/man.rst +++ b/cdist/conf/type/__timezone/man.rst @@ -1,8 +1,9 @@ cdist-type__timezone(7) ======================= -Allows one to configure the desired localtime timezone. -Ramon Salvadó +NAME +---- +cdist-type__timezone - Allows one to configure the desired localtime timezone. DESCRIPTION @@ -33,9 +34,9 @@ EXAMPLES __timezone US/Central -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Ramon Salvadó COPYING diff --git a/cdist/conf/type/__timezone/manifest b/cdist/conf/type/__timezone/manifest index 8ddfd122..bcbe41c3 100755 --- a/cdist/conf/type/__timezone/manifest +++ b/cdist/conf/type/__timezone/manifest @@ -38,7 +38,7 @@ case "$os" in # whitelist : ;; - centos) + scientific|centos) __package tzdata --state present export require="__package/tzdata" __file /etc/sysconfig/clock \ diff --git a/cdist/conf/type/__update_alternatives/man.rst b/cdist/conf/type/__update_alternatives/man.rst index 477ee88c..73d82d11 100644 --- a/cdist/conf/type/__update_alternatives/man.rst +++ b/cdist/conf/type/__update_alternatives/man.rst @@ -1,8 +1,9 @@ cdist-type__update_alternatives(7) ================================== -Configure alternatives -Nico Schottelius +NAME +---- +cdist-type__update_alternatives - Configure alternatives DESCRIPTION @@ -29,12 +30,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- `cdist-type__debconf_set_selections(7) `_ -- update-alternatives(8) +:strong:`cdist-type__debconf_set_selections`\ (7), :strong:`update-alternatives`\ (8) + + +AUTHORS +------- +Nico Schottelius COPYING ------- -Copyright \(C) 2013 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2013 Nico Schottelius. 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. diff --git a/cdist/conf/type/__user/man.rst b/cdist/conf/type/__user/man.rst index c690a559..5001bfa4 100644 --- a/cdist/conf/type/__user/man.rst +++ b/cdist/conf/type/__user/man.rst @@ -1,8 +1,9 @@ cdist-type__user(7) =================== -Manage users -Steven Armstrong +NAME +---- +cdist-type__user - Manage users DESCRIPTION @@ -83,11 +84,17 @@ EXAMPLES SEE ALSO -------- -- `cdist-type(7) `_ -- usermod(8) or pw(8) +:strong:`pw`\ (8), :strong:`usermod`\ (8) + + +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2011 Steven Armstrong. 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. diff --git a/cdist/conf/type/__user_groups/man.rst b/cdist/conf/type/__user_groups/man.rst index 4458a6cf..6767b7a8 100644 --- a/cdist/conf/type/__user_groups/man.rst +++ b/cdist/conf/type/__user_groups/man.rst @@ -1,8 +1,9 @@ cdist-type__user_groups(7) ========================== -Manage user groups -Steven Armstrong +NAME +---- +cdist-type__user_groups - Manage user groups DESCRIPTION @@ -38,12 +39,14 @@ EXAMPLES --group webuser2 --state absent -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Steven Armstrong COPYING ------- -Copyright \(C) 2012 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2012 Steven Armstrong. 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. diff --git a/cdist/conf/type/__yum_repo/man.rst b/cdist/conf/type/__yum_repo/man.rst index 396f271c..94366c3a 100644 --- a/cdist/conf/type/__yum_repo/man.rst +++ b/cdist/conf/type/__yum_repo/man.rst @@ -1,8 +1,9 @@ cdist-type__yum_repo(7) ======================= -Manage yum repositories -Steven Armstrong +NAME +---- +cdist-type__yum_repo - Manage yum repositories DESCRIPTION @@ -110,12 +111,14 @@ EXAMPLES --gpgkey https://fedoraproject.org/static/0608B895.txt -SEE ALSO --------- -- `cdist-type(7) `_ +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 (GPLv3). +Copyright \(C) 2014 Steven Armstrong. 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. diff --git a/cdist/conf/type/__yum_repo/manifest b/cdist/conf/type/__yum_repo/manifest index 9bb63c3c..950c3b7a 100755 --- a/cdist/conf/type/__yum_repo/manifest +++ b/cdist/conf/type/__yum_repo/manifest @@ -22,7 +22,7 @@ os=$(cat "$__global/explorer/os") state="$(cat "$__object/parameter/state")" case "$os" in - centos) + scientific|centos) repo_name="$__object_id" export repo_name repo_file="/etc/yum.repos.d/${repo_name}.repo" diff --git a/cdist/conf/type/__zypper_repo/man.rst b/cdist/conf/type/__zypper_repo/man.rst index e3bc1d4f..73799d91 100644 --- a/cdist/conf/type/__zypper_repo/man.rst +++ b/cdist/conf/type/__zypper_repo/man.rst @@ -1,8 +1,9 @@ cdist-type__zypper_repo(7) ========================== -Repository management with zypper -Daniel Heule +NAME +---- +cdist-type__zypper_repo - Repository management with zypper DESCRIPTION @@ -59,12 +60,14 @@ EXAMPLES __zypper_repo testrepo4 --state disabled --repo_id 4 -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Daniel Heule COPYING ------- -Copyright \(C) 2013 Daniel Heule. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2013 Daniel Heule. 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. diff --git a/cdist/conf/type/__zypper_service/man.rst b/cdist/conf/type/__zypper_service/man.rst index 377d30e1..ea48aebb 100644 --- a/cdist/conf/type/__zypper_service/man.rst +++ b/cdist/conf/type/__zypper_service/man.rst @@ -1,8 +1,9 @@ cdist-type__zypper_service(7) ============================= -Service management with zypper -Daniel Heule +NAME +---- +cdist-type__zypper_service - Service management with zypper DESCRIPTION @@ -19,10 +20,10 @@ uri OPTIONAL PARAMETERS ------------------- service_desc - If supplied, use the service_desc and not the object id as descritpion for the service. + If supplied, use the service_desc and not the object id as description for the service. state - Either "present" or "absent", defaults to "present" + Either "present" or "absent", defaults to "present" type Defaults to "ris", the standard type of services at SLES11. For other values, see manpage of zypper. @@ -52,12 +53,14 @@ EXAMPLES __zypper_service INTERNAL_SLES11_SP3 --state absent --uri "http://path/to/your/ris/dir" -SEE ALSO --------- -- `cdist-type(7) `_ +AUTHORS +------- +Daniel Heule COPYING ------- -Copyright \(C) 2013 Daniel Heule. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +Copyright \(C) 2013 Daniel Heule. 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. diff --git a/cdist/config.py b/cdist/config.py index f5e62ce1..b0131601 100644 --- a/cdist/config.py +++ b/cdist/config.py @@ -27,6 +27,8 @@ import sys import time import pprint import itertools +import tempfile +import socket import cdist @@ -35,25 +37,77 @@ import cdist.exec.remote from cdist import core + +def inspect_ssh_mux_opts(): + """Inspect whether or not ssh supports multiplexing options. + + Return string containing multiplexing options if supported. + If ControlPath is supported then placeholder for that path is + specified and can be used for final string formatting. + For example, this function can return string: + "-o ControlMaster=auto -o ControlPersist=125 -o ControlPath={}". + Then it can be formatted: + mux_opts_string.format('/tmp/tmpxxxxxx/ssh-control-path'). + """ + import subprocess + + wanted_mux_opts = { + "ControlPath": "{}", + "ControlMaster": "auto", + "ControlPersist": "125", + } + mux_opts = " ".join([" -o {}={}".format( + x, wanted_mux_opts[x]) for x in wanted_mux_opts]) + try: + subprocess.check_output("ssh {}".format(mux_opts), + stderr=subprocess.STDOUT, shell=True) + except subprocess.CalledProcessError as e: + subproc_output = e.output.decode().lower() + if "bad configuration option" in subproc_output: + return "" + return mux_opts + + class Config(object): """Cdist main class to hold arbitrary data""" - def __init__(self, local, remote, dry_run=False): + def __init__(self, local, remote, dry_run=False, jobs=None): - self.local = local - self.remote = remote - self.log = logging.getLogger(self.local.target_host) - self.dry_run = dry_run + self.local = local + self.remote = remote + self.log = logging.getLogger(self.local.target_host[0]) + self.dry_run = dry_run + self.jobs = jobs - self.explorer = core.Explorer(self.local.target_host, self.local, self.remote) + self.explorer = core.Explorer(self.local.target_host, self.local, + self.remote, jobs=self.jobs) self.manifest = core.Manifest(self.local.target_host, self.local) - self.code = core.Code(self.local.target_host, self.local, self.remote) + self.code = core.Code(self.local.target_host, self.local, self.remote) def _init_files_dirs(self): """Prepare files and directories for the run""" self.local.create_files_dirs() self.remote.create_files_dirs() + @staticmethod + def hostfile_process_line(line): + """Return host from read line or None if no host present.""" + if not line: + return None + # remove comment if present + comment_index = line.find('#') + if comment_index >= 0: + host = line[:comment_index] + else: + host = line + # remove leading and trailing whitespaces + host = host.strip() + # skip empty lines + if host: + return host + else: + return None + @staticmethod def hosts(source): """Yield hosts from source. @@ -64,17 +118,18 @@ class Config(object): import fileinput try: for host in fileinput.input(files=(source)): - # remove leading and trailing whitespace - yield host.strip() - except (IOError, OSError) as e: - raise cdist.Error("Error reading hosts from \'{}\'".format( - source)) + host = Config.hostfile_process_line(host) + if host: + yield host + except (IOError, OSError, UnicodeError) as e: + raise cdist.Error( + "Error reading hosts from file \'{}\': {}".format( + source, e)) else: if source: for host in source: yield host - @classmethod def commandline(cls, args): """Configure remote system""" @@ -84,83 +139,168 @@ class Config(object): log = logging.getLogger("cdist") if args.manifest == '-' and args.hostfile == '-': - raise cdist.Error(("Cannot read both, manifest and host file, " - "from stdin")) + raise cdist.Error(("Cannot read both, manifest and host file, " + "from stdin")) + # if no host source is specified then read hosts from stdin if not (args.hostfile or args.host): args.hostfile = '-' - + initial_manifest_tempfile = None if args.manifest == '-': # read initial manifest from stdin - import tempfile try: - handle, initial_manifest_temp_path = tempfile.mkstemp(prefix='cdist.stdin.') + handle, initial_manifest_temp_path = tempfile.mkstemp( + prefix='cdist.stdin.') with os.fdopen(handle, 'w') as fd: fd.write(sys.stdin.read()) except (IOError, OSError) as e: - raise cdist.Error("Creating tempfile for stdin data failed: %s" % e) - + raise cdist.Error(("Creating tempfile for stdin data " + "failed: %s" % e)) + args.manifest = initial_manifest_temp_path import atexit atexit.register(lambda: os.remove(initial_manifest_temp_path)) - + process = {} failed_hosts = [] time_start = time.time() + # default remote cmd patterns + args.remote_exec_pattern = None + args.remote_copy_pattern = None + + args_dict = vars(args) + # if remote-exec and/or remote-copy args are None then user + # didn't specify command line options nor env vars: + # inspect multiplexing options for default cdist.REMOTE_COPY/EXEC + if (args_dict['remote_copy'] is None or + args_dict['remote_exec'] is None): + mux_opts = inspect_ssh_mux_opts() + if args_dict['remote_exec'] is None: + args.remote_exec_pattern = cdist.REMOTE_EXEC + mux_opts + if args_dict['remote_copy'] is None: + args.remote_copy_pattern = cdist.REMOTE_COPY + mux_opts + + if args.out_path: + base_root_path = args.out_path + else: + base_root_path = tempfile.mkdtemp() + hostcnt = 0 for host in itertools.chain(cls.hosts(args.host), cls.hosts(args.hostfile)): + hostdir = cdist.str_hash(host) + host_base_path = os.path.join(base_root_path, hostdir) + + log.debug("Base root path for target host \"{}\" is \"{}\"".format( + host, host_base_path)) + hostcnt += 1 if args.parallel: log.debug("Creating child process for %s", host) - process[host] = multiprocessing.Process(target=cls.onehost, args=(host, args, True)) + process[host] = multiprocessing.Process( + target=cls.onehost, + args=(host, host_base_path, hostdir, args, True)) process[host].start() else: try: - cls.onehost(host, args, parallel=False) + cls.onehost(host, host_base_path, hostdir, + args, parallel=False) except cdist.Error as e: failed_hosts.append(host) - + # Catch errors in parallel mode when joining if args.parallel: for host in process.keys(): log.debug("Joining process %s", host) process[host].join() - + if not process[host].exitcode == 0: failed_hosts.append(host) - + time_end = time.time() log.info("Total processing time for %s host(s): %s", hostcnt, - (time_end - time_start)) - + (time_end - time_start)) + if len(failed_hosts) > 0: - raise cdist.Error("Failed to configure the following hosts: " + - " ".join(failed_hosts)) - + raise cdist.Error("Failed to configure the following hosts: " + + " ".join(failed_hosts)) + @classmethod - def onehost(cls, host, args, parallel): + def onehost(cls, host, host_base_path, host_dir_name, args, parallel): """Configure ONE system""" log = logging.getLogger(host) - + try: + control_path = os.path.join(host_base_path, "ssh-control-path") + # If we constructed patterns for remote commands then there is + # placeholder for ssh ControlPath, format it and we have unique + # ControlPath for each host. + # + # If not then use args.remote_exec/copy that user specified. + if args.remote_exec_pattern: + remote_exec = args.remote_exec_pattern.format(control_path) + else: + remote_exec = args.remote_exec + if args.remote_copy_pattern: + remote_copy = args.remote_copy_pattern.format(control_path) + else: + remote_copy = args.remote_copy + log.debug("remote_exec for host \"{}\": {}".format( + host, remote_exec)) + log.debug("remote_copy for host \"{}\": {}".format( + host, remote_copy)) + + try: + # getaddrinfo returns a list of 5-tuples: + # (family, type, proto, canonname, sockaddr) + # where sockaddr is: + # (address, port) for AF_INET, + # (address, port, flow_info, scopeid) for AF_INET6 + ip_addr = socket.getaddrinfo( + host, None, type=socket.SOCK_STREAM)[0][4][0] + # gethostbyaddr returns triple + # (hostname, aliaslist, ipaddrlist) + host_name = socket.gethostbyaddr(ip_addr)[0] + log.debug("derived host_name for host \"{}\": {}".format( + host, host_name)) + except (socket.gaierror, socket.herror) as e: + log.warn("Could not derive host_name for {}" + ", $host_name will be empty. Error is: {}".format( + host, e)) + # in case of error provide empty value + host_name = '' + + try: + host_fqdn = socket.getfqdn(host) + log.debug("derived host_fqdn for host \"{}\": {}".format( + host, host_fqdn)) + except socket.herror as e: + log.warn("Could not derive host_fqdn for {}" + ", $host_fqdn will be empty. Error is: {}".format( + host, e)) + # in case of error provide empty value + host_fqdn = '' + + target_host = (host, host_name, host_fqdn) + local = cdist.exec.local.Local( - target_host=host, + target_host=target_host, + base_root_path=host_base_path, + host_dir_name=host_dir_name, initial_manifest=args.manifest, - base_path=args.out_path, add_conf_dirs=args.conf_dir) remote = cdist.exec.remote.Remote( - target_host=host, - remote_exec=args.remote_exec, - remote_copy=args.remote_copy) - - c = cls(local, remote, dry_run=args.dry_run) + target_host=target_host, + remote_exec=remote_exec, + remote_copy=remote_copy) + + c = cls(local, remote, dry_run=args.dry_run, jobs=args.jobs) c.run() - + except cdist.Error as e: log.error(e) if parallel: @@ -168,7 +308,7 @@ class Config(object): sys.exit(1) else: raise - + except KeyboardInterrupt: # Ignore in parallel mode, we are existing anyway if parallel: @@ -188,49 +328,50 @@ class Config(object): self.iterate_until_finished() self.local.save_cache() - self.log.info("Finished successful run in %s seconds", time.time() - start_time) - + self.log.info("Finished successful run in %s seconds", + time.time() - start_time) def object_list(self): """Short name for object list retrieval""" - for cdist_object in core.CdistObject.list_objects(self.local.object_path, - self.local.type_path, - self.local.object_marker_name): + for cdist_object in core.CdistObject.list_objects( + self.local.object_path, self.local.type_path, + self.local.object_marker_name): if cdist_object.cdist_type.is_install: - self.log.debug("Running in config mode, ignoring install object: {0}".format(cdist_object)) + self.log.debug(("Running in config mode, ignoring install " + "object: {0}").format(cdist_object)) else: yield cdist_object - def iterate_once(self): """ - Iterate over the objects once - helper method for + Iterate over the objects once - helper method for iterate_until_finished """ - objects_changed = False + objects_changed = False for cdist_object in self.object_list(): if cdist_object.requirements_unfinished(cdist_object.requirements): """We cannot do anything for this poor object""" continue - + if cdist_object.state == core.CdistObject.STATE_UNDEF: """Prepare the virgin object""" - + self.object_prepare(cdist_object) objects_changed = True - + if cdist_object.requirements_unfinished(cdist_object.autorequire): - """The previous step created objects we depend on - wait for them""" + """The previous step created objects we depend on - + wait for them + """ continue - + if cdist_object.state == core.CdistObject.STATE_PREPARED: self.object_run(cdist_object) objects_changed = True return objects_changed - def iterate_until_finished(self): """ Go through all objects and solve them @@ -256,22 +397,32 @@ class Config(object): requirement_names = [] autorequire_names = [] - for requirement in cdist_object.requirements_unfinished(cdist_object.requirements): + for requirement in cdist_object.requirements_unfinished( + cdist_object.requirements): requirement_names.append(requirement.name) - for requirement in cdist_object.requirements_unfinished(cdist_object.autorequire): + for requirement in cdist_object.requirements_unfinished( + cdist_object.autorequire): autorequire_names.append(requirement.name) requirements = "\n ".join(requirement_names) - autorequire = "\n ".join(autorequire_names) - info_string.append("%s requires:\n %s\n%s autorequires:\n %s" % (cdist_object.name, requirements, cdist_object.name, autorequire)) + autorequire = "\n ".join(autorequire_names) + info_string.append(("%s requires:\n" + " %s\n" + "%s ""autorequires:\n" + " %s" % ( + cdist_object.name, + requirements, cdist_object.name, + autorequire))) - raise cdist.UnresolvableRequirementsError("The requirements of the following objects could not be resolved:\n%s" % - ("\n".join(info_string))) + raise cdist.UnresolvableRequirementsError( + ("The requirements of the following objects could not be " + "resolved:\n%s") % ("\n".join(info_string))) def object_prepare(self, cdist_object): """Prepare object: Run type explorer + manifest""" - self.log.info("Running manifest and explorers for " + cdist_object.name) + self.log.info( + "Running manifest and explorers for " + cdist_object.name) self.explorer.run_type_explorers(cdist_object) self.manifest.run_type_manifest(cdist_object) cdist_object.state = core.CdistObject.STATE_PREPARED @@ -281,7 +432,8 @@ class Config(object): self.log.debug("Trying to run object %s" % (cdist_object.name)) if cdist_object.state == core.CdistObject.STATE_DONE: - raise cdist.Error("Attempting to run an already finished object: %s", cdist_object) + raise cdist.Error(("Attempting to run an already finished " + "object: %s"), cdist_object) cdist_type = cdist_object.cdist_type @@ -304,7 +456,6 @@ class Config(object): else: self.log.info("Skipping code execution due to DRY RUN") - # Mark this object as done self.log.debug("Finishing run of " + cdist_object.name) cdist_object.state = core.CdistObject.STATE_DONE diff --git a/cdist/core/__init__.py b/cdist/core/__init__.py index d773fc01..41e00a3a 100644 --- a/cdist/core/__init__.py +++ b/cdist/core/__init__.py @@ -20,10 +20,10 @@ # # -from cdist.core.cdist_type import CdistType -from cdist.core.cdist_type import NoSuchTypeError -from cdist.core.cdist_object import CdistObject -from cdist.core.cdist_object import IllegalObjectIdError -from cdist.core.explorer import Explorer -from cdist.core.manifest import Manifest -from cdist.core.code import Code +from cdist.core.cdist_type import CdistType +from cdist.core.cdist_type import NoSuchTypeError +from cdist.core.cdist_object import CdistObject +from cdist.core.cdist_object import IllegalObjectIdError +from cdist.core.explorer import Explorer +from cdist.core.manifest import Manifest +from cdist.core.code import Code diff --git a/cdist/core/cdist_object.py b/cdist/core/cdist_object.py index 8c6ee9c9..262db8bf 100644 --- a/cdist/core/cdist_object.py +++ b/cdist/core/cdist_object.py @@ -32,6 +32,7 @@ from cdist.util import fsproperty log = logging.getLogger(__name__) + class IllegalObjectIdError(cdist.Error): def __init__(self, object_id, message=None): self.object_id = object_id @@ -40,14 +41,17 @@ class IllegalObjectIdError(cdist.Error): def __str__(self): return '%s: %s' % (self.message, self.object_id) + class MissingObjectIdError(cdist.Error): def __init__(self, type_name): self.type_name = type_name - self.message = "Type %s requires object id (is not a singleton type)" % self.type_name + self.message = ("Type %s requires object id (is not a " + "singleton type)") % self.type_name def __str__(self): return '%s' % (self.message) + class CdistObject(object): """Represents a cdist object. @@ -64,7 +68,7 @@ class CdistObject(object): STATE_DONE = "done" def __init__(self, cdist_type, base_path, object_marker, object_id): - self.cdist_type = cdist_type # instance of Type + self.cdist_type = cdist_type # instance of Type self.base_path = base_path self.object_id = object_id @@ -74,7 +78,8 @@ class CdistObject(object): self.sanitise_object_id() self.name = self.join_name(self.cdist_type.name, self.object_id) - self.path = os.path.join(self.cdist_type.path, self.object_id, self.object_marker) + self.path = os.path.join(self.cdist_type.path, self.object_id, + self.object_marker) self.absolute_path = os.path.join(self.base_path, self.path) self.code_local_path = os.path.join(self.path, "code-local") @@ -84,12 +89,13 @@ class CdistObject(object): @classmethod def list_objects(cls, object_base_path, type_base_path, object_marker): """Return a list of object instances""" - for object_name in cls.list_object_names(object_base_path, object_marker): + for object_name in cls.list_object_names( + object_base_path, object_marker): type_name, object_id = cls.split_name(object_name) yield cls(cdist.core.CdistType(type_base_path, type_name), - base_path=object_base_path, - object_marker=object_marker, - object_id=object_id) + base_path=object_base_path, + object_marker=object_marker, + object_id=object_id) @classmethod def list_object_names(cls, object_base_path, object_marker): @@ -125,26 +131,34 @@ class CdistObject(object): def validate_object_id(self): if self.cdist_type.is_singleton and self.object_id: - raise IllegalObjectIdError('singleton objects can\'t have a object_id') + raise IllegalObjectIdError(('singleton objects can\'t have an ' + 'object_id')) - """Validate the given object_id and raise IllegalObjectIdError if it's not valid. + """Validate the given object_id and raise IllegalObjectIdError + if it's not valid. """ if self.object_id: if self.object_marker in self.object_id.split(os.sep): - raise IllegalObjectIdError(self.object_id, 'object_id may not contain \'%s\'' % self.object_marker) + raise IllegalObjectIdError( + self.object_id, ('object_id may not contain ' + '\'%s\'') % self.object_marker) if '//' in self.object_id: - raise IllegalObjectIdError(self.object_id, 'object_id may not contain //') + raise IllegalObjectIdError( + self.object_id, 'object_id may not contain //') if self.object_id == '.': - raise IllegalObjectIdError(self.object_id, 'object_id may not be a .') + raise IllegalObjectIdError( + self.object_id, 'object_id may not be a .') # If no object_id and type is not singleton => error out if not self.object_id and not self.cdist_type.is_singleton: raise MissingObjectIdError(self.cdist_type.name) - # Does not work: AttributeError: 'CdistObject' object has no attribute 'parameter_path' + # Does not work: + # AttributeError: + # 'CdistObject' object has no attribute 'parameter_path' - #"Type %s is not a singleton type - missing object id (parameters: %s)" % - # (self.cdist_type.name, self.parameters)) + # "Type %s is not a singleton type - missing object id + # (parameters: %s)" % (self.cdist_type.name, self.parameters)) def object_from_name(self, object_name): """Convenience method for creating an object instance from an object name. @@ -152,7 +166,8 @@ class CdistObject(object): Mainly intended to create objects when resolving requirements. e.g: - .object_from_name('__other/object') -> + .object_from_name('__other/object') -> + """ @@ -164,7 +179,8 @@ class CdistObject(object): cdist_type = self.cdist_type.__class__(type_path, type_name) - return self.__class__(cdist_type, base_path, object_marker, object_id=object_id) + return self.__class__(cdist_type, base_path, object_marker, + object_id=object_id) def __repr__(self): return '' % self.name @@ -172,7 +188,7 @@ class CdistObject(object): def __eq__(self, other): """define equality as 'name is the same'""" return self.name == other.name - + def __hash__(self): return hash(self.name) @@ -205,14 +221,22 @@ class CdistObject(object): # return relative path return os.path.join(self.path, "explorer") - requirements = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'require')) - autorequire = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'autorequire')) - parameters = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.parameter_path)) - explorers = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.explorer_path)) - state = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "state")) - source = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, "source")) - code_local = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_local_path)) - code_remote = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_remote_path)) + requirements = fsproperty.FileListProperty( + lambda obj: os.path.join(obj.absolute_path, 'require')) + autorequire = fsproperty.FileListProperty( + lambda obj: os.path.join(obj.absolute_path, 'autorequire')) + parameters = fsproperty.DirectoryDictProperty( + lambda obj: os.path.join(obj.base_path, obj.parameter_path)) + explorers = fsproperty.DirectoryDictProperty( + lambda obj: os.path.join(obj.base_path, obj.explorer_path)) + state = fsproperty.FileStringProperty( + lambda obj: os.path.join(obj.absolute_path, "state")) + source = fsproperty.FileListProperty( + lambda obj: os.path.join(obj.absolute_path, "source")) + code_local = fsproperty.FileStringProperty( + lambda obj: os.path.join(obj.base_path, obj.code_local_path)) + code_remote = fsproperty.FileStringProperty( + lambda obj: os.path.join(obj.base_path, obj.code_remote_path)) @property def exists(self): @@ -224,10 +248,12 @@ class CdistObject(object): """ try: os.makedirs(self.absolute_path, exist_ok=allow_overwrite) - absolute_parameter_path = os.path.join(self.base_path, self.parameter_path) + absolute_parameter_path = os.path.join(self.base_path, + self.parameter_path) os.makedirs(absolute_parameter_path, exist_ok=allow_overwrite) except EnvironmentError as error: - raise cdist.Error('Error creating directories for cdist object: %s: %s' % (self, error)) + raise cdist.Error(('Error creating directories for cdist object: ' + '%s: %s') % (self, error)) def requirements_unfinished(self, requirements): """Return state whether requirements are satisfied""" diff --git a/cdist/core/cdist_type.py b/cdist/core/cdist_type.py index d5b4ea3e..a548f365 100644 --- a/cdist/core/cdist_type.py +++ b/cdist/core/cdist_type.py @@ -24,6 +24,7 @@ import os import cdist + class NoSuchTypeError(cdist.Error): def __init__(self, name, type_path, type_absolute_path): self.name = name @@ -31,7 +32,8 @@ class NoSuchTypeError(cdist.Error): self.type_absolute_path = type_absolute_path def __str__(self): - return "Type '%s' does not exist at %s" % (self.type_path, self.type_absolute_path) + return "Type '%s' does not exist at %s" % ( + self.type_path, self.type_absolute_path) class CdistType(object): @@ -75,13 +77,13 @@ class CdistType(object): """Return a list of type names""" return os.listdir(base_path) - _instances = {} + def __new__(cls, *args, **kwargs): """only one instance of each named type may exist""" # name is second argument name = args[1] - if not name in cls._instances: + if name not in cls._instances: instance = super(CdistType, cls).__new__(cls) cls._instances[name] = instance # return instance so __init__ is called @@ -103,7 +105,8 @@ class CdistType(object): @property def is_install(self): - """Check whether a type is used for installation (if not: for configuration)""" + """Check whether a type is used for installation + (if not: for configuration)""" return os.path.isfile(os.path.join(self.absolute_path, "install")) @property @@ -111,7 +114,8 @@ class CdistType(object): """Return a list of available explorers""" if not self.__explorers: try: - self.__explorers = os.listdir(os.path.join(self.absolute_path, "explorer")) + self.__explorers = os.listdir(os.path.join(self.absolute_path, + "explorer")) except EnvironmentError: # error ignored self.__explorers = [] @@ -123,7 +127,9 @@ class CdistType(object): if not self.__required_parameters: parameters = [] try: - with open(os.path.join(self.absolute_path, "parameter", "required")) as fd: + with open(os.path.join(self.absolute_path, + "parameter", + "required")) as fd: for line in fd: parameters.append(line.strip()) except EnvironmentError: @@ -139,7 +145,9 @@ class CdistType(object): if not self.__required_multiple_parameters: parameters = [] try: - with open(os.path.join(self.absolute_path, "parameter", "required_multiple")) as fd: + with open(os.path.join(self.absolute_path, + "parameter", + "required_multiple")) as fd: for line in fd: parameters.append(line.strip()) except EnvironmentError: @@ -155,7 +163,9 @@ class CdistType(object): if not self.__optional_parameters: parameters = [] try: - with open(os.path.join(self.absolute_path, "parameter", "optional")) as fd: + with open(os.path.join(self.absolute_path, + "parameter", + "optional")) as fd: for line in fd: parameters.append(line.strip()) except EnvironmentError: @@ -171,7 +181,9 @@ class CdistType(object): if not self.__optional_multiple_parameters: parameters = [] try: - with open(os.path.join(self.absolute_path, "parameter", "optional_multiple")) as fd: + with open(os.path.join(self.absolute_path, + "parameter", + "optional_multiple")) as fd: for line in fd: parameters.append(line.strip()) except EnvironmentError: @@ -187,7 +199,9 @@ class CdistType(object): if not self.__boolean_parameters: parameters = [] try: - with open(os.path.join(self.absolute_path, "parameter", "boolean")) as fd: + with open(os.path.join(self.absolute_path, + "parameter", + "boolean")) as fd: for line in fd: parameters.append(line.strip()) except EnvironmentError: @@ -202,7 +216,9 @@ class CdistType(object): if not self.__parameter_defaults: defaults = {} try: - defaults_dir = os.path.join(self.absolute_path, "parameter", "default") + defaults_dir = os.path.join(self.absolute_path, + "parameter", + "default") for name in os.listdir(defaults_dir): try: with open(os.path.join(defaults_dir, name)) as fd: diff --git a/cdist/core/code.py b/cdist/core/code.py index 5374bcdf..cfc1316a 100644 --- a/cdist/core/code.py +++ b/cdist/core/code.py @@ -36,20 +36,29 @@ common: env: PATH: prepend directory with type emulator symlinks == local.bin_path __target_host: the target host we are working on + __target_hostname: the target hostname provided from __target_host + __target_fqdn: the target's fully qualified domain name provided from + __target_host __cdist_manifest: full qualified path of the manifest == script - __cdist_type_base_path: full qualified path to the directory where types are defined for use in type emulator - == local.type_path + __cdist_type_base_path: full qualified path to the directory where + types are defined for use in type emulator + == local.type_path gencode-local script: full qualified path to a types gencode-local env: __target_host: the target host we are working on - __global: full qualified path to the global output dir == local.out_path + __target_hostname: the target hostname provided from __target_host + __target_fqdn: the target's fully qualified domain name provided from + __target_host + __global: full qualified path to the global + output dir == local.out_path __object: full qualified path to the object's dir __object_id: the objects id __object_fq: full qualified object id, iow: $type.name + / + object_id __type: full qualified path to the type's dir + __files: full qualified path to the files dir returns: string containing the generated code or None @@ -58,11 +67,16 @@ gencode-remote env: __target_host: the target host we are working on - __global: full qualified path to the global output dir == local.out_path + __target_hostname: the target hostname provided from __target_host + __target_fqdn: the target's fully qualified domain name provided from + __target_host + __global: full qualified path to the global + output dir == local.out_path __object: full qualified path to the object's dir __object_id: the objects id __object_fq: full qualified object id, iow: $type.name + / + object_id __type: full qualified path to the type's dir + __files: full qualified path to the files dir returns: string containing the generated code or None @@ -84,18 +98,25 @@ class Code(object): """Generates and executes cdist code scripts. """ + # target_host is tuple (target_host, target_hostname, target_fqdn) def __init__(self, target_host, local, remote): - self.target_host = target_host + self.target_host = target_host[0] + self.target_hostname = target_host[1] + self.target_fqdn = target_host[2] self.local = local self.remote = remote self.env = { - '__target_host': self.target_host, + '__target_host': self.target_host[0], + '__target_hostname': self.target_host[1], + '__target_fqdn': self.target_host[2], '__global': self.local.base_path, + '__files': self.local.files_path, } def _run_gencode(self, cdist_object, which): cdist_type = cdist_object.cdist_type - script = os.path.join(self.local.type_path, getattr(cdist_type, 'gencode_%s_path' % which)) + script = os.path.join(self.local.type_path, + getattr(cdist_type, 'gencode_%s_path' % which)) if os.path.isfile(script): env = os.environ.copy() env.update(self.env) @@ -105,8 +126,9 @@ class Code(object): '__object_id': cdist_object.object_id, '__object_name': cdist_object.name, }) - message_prefix=cdist_object.name - return self.local.run_script(script, env=env, return_output=True, message_prefix=message_prefix) + message_prefix = cdist_object.name + return self.local.run_script(script, env=env, return_output=True, + message_prefix=message_prefix) def run_gencode_local(self, cdist_object): """Run the gencode-local script for the given cdist object.""" @@ -117,21 +139,26 @@ class Code(object): return self._run_gencode(cdist_object, 'remote') def transfer_code_remote(self, cdist_object): - """Transfer the code_remote script for the given object to the remote side.""" - source = os.path.join(self.local.object_path, cdist_object.code_remote_path) - destination = os.path.join(self.remote.object_path, cdist_object.code_remote_path) + """Transfer the code_remote script for the given object to the + remote side.""" + source = os.path.join(self.local.object_path, + cdist_object.code_remote_path) + destination = os.path.join(self.remote.object_path, + cdist_object.code_remote_path) # FIXME: BUG: do not create destination, but top level of destination! self.remote.mkdir(destination) self.remote.transfer(source, destination) def _run_code(self, cdist_object, which, env=None): which_exec = getattr(self, which) - script = os.path.join(which_exec.object_path, getattr(cdist_object, 'code_%s_path' % which)) + script = os.path.join(which_exec.object_path, + getattr(cdist_object, 'code_%s_path' % which)) return which_exec.run_script(script, env=env) def run_code_local(self, cdist_object): """Run the code-local script for the given cdist object.""" - # Put some env vars, to allow read only access to the parameters over $__object + # Put some env vars, to allow read only access to the parameters + # over $__object env = os.environ.copy() env.update(self.env) env.update({ @@ -141,10 +168,13 @@ class Code(object): return self._run_code(cdist_object, 'local', env=env) def run_code_remote(self, cdist_object): - """Run the code-remote script for the given cdist object on the remote side.""" - # Put some env vars, to allow read only access to the parameters over $__object which is already on the remote side + """Run the code-remote script for the given cdist object on the + remote side.""" + # Put some env vars, to allow read only access to the parameters + # over $__object which is already on the remote side env = { - '__object': os.path.join(self.remote.object_path, cdist_object.path), + '__object': os.path.join(self.remote.object_path, + cdist_object.path), '__object_id': cdist_object.object_id, } return self._run_code(cdist_object, 'remote', env=env) diff --git a/cdist/core/explorer.py b/cdist/core/explorer.py index 41851bd6..ef85431c 100644 --- a/cdist/core/explorer.py +++ b/cdist/core/explorer.py @@ -23,6 +23,7 @@ import logging import os import glob +import multiprocessing import cdist @@ -31,7 +32,8 @@ common: runs only remotely, needs local and remote to construct paths env: - __explorer: full qualified path to other global explorers on remote side + __explorer: full qualified path to other global explorers on + remote side -> remote.global_explorer_path a global explorer is: @@ -52,7 +54,8 @@ type explorer is: __object: full qualified path to the object's remote dir __object_id: the objects id __object_fq: full qualified object id, iow: $type.name + / + object_id - __type_explorer: full qualified path to the other type explorers on remote side + __type_explorer: full qualified path to the other type explorers on + remote side creates: nothing, returns output @@ -63,20 +66,26 @@ class Explorer(object): """Executes cdist explorers. """ - def __init__(self, target_host, local, remote): + def __init__(self, target_host, local, remote, jobs=None): self.target_host = target_host - self.log = logging.getLogger(target_host) + self._open_logger() self.local = local self.remote = remote self.env = { - '__target_host': self.target_host, + '__target_host': self.target_host[0], + '__target_hostname': self.target_host[1], + '__target_fqdn': self.target_host[2], '__explorer': self.remote.global_explorer_path, } self._type_explorers_transferred = [] + self.jobs = jobs - ### global + def _open_logger(self): + self.log = logging.getLogger(self.target_host[0]) + + # global def list_global_explorer_names(self): """Return a list of global explorer names.""" @@ -89,24 +98,74 @@ class Explorer(object): """ self.log.info("Running global explorers") self.transfer_global_explorers() + if self.jobs is None: + self._run_global_explorers_seq(out_path) + else: + self._run_global_explorers_parallel(out_path) + + def _run_global_explorer(self, explorer, out_path): + output = self.run_global_explorer(explorer) + path = os.path.join(out_path, explorer) + with open(path, 'w') as fd: + fd.write(output) + + def _run_global_explorers_seq(self, out_path): + self.log.info("Running global explorers sequentially") for explorer in self.list_global_explorer_names(): - output = self.run_global_explorer(explorer) - path = os.path.join(out_path, explorer) - with open(path, 'w') as fd: - fd.write(output) + self._run_global_explorer(explorer, out_path) + + def _run_global_explorers_parallel(self, out_path): + self.log.info("Running global explorers in {} parallel jobs".format( + self.jobs)) + self.log.debug("Multiprocessing start method is {}".format( + multiprocessing.get_start_method())) + self.log.debug(("Starting multiprocessing Pool for global " + "explorers run")) + with multiprocessing.Pool(self.jobs) as pool: + self.log.debug("Starting async for global explorer run") + results = [ + pool.apply_async(self._run_global_explorer, (e, out_path,)) + for e in self.list_global_explorer_names() + ] + + self.log.debug("Waiting async results for global explorer runs") + for r in results: + r.get() # self._run_global_explorer returns None + self.log.debug(("Multiprocessing run for global explorers " + "finished")) + + # logger is not pickable, so remove it when we pickle + def __getstate__(self): + state = self.__dict__.copy() + if 'log' in state: + del state['log'] + return state + + # recreate logger when we unpickle + def __setstate__(self, state): + self.__dict__.update(state) + self._open_logger() def transfer_global_explorers(self): """Transfer the global explorers to the remote side.""" self.remote.mkdir(self.remote.global_explorer_path) - self.remote.transfer(self.local.global_explorer_path, self.remote.global_explorer_path) - self.remote.run(["chmod", "0700", "%s/*" % (self.remote.global_explorer_path)]) + if self.jobs is None: + self.remote.transfer(self.local.global_explorer_path, + self.remote.global_explorer_path) + else: + self.remote.transfer_dir_parallel( + self.local.global_explorer_path, + self.remote.global_explorer_path, + self.jobs) + self.remote.run(["chmod", "0700", + "%s/*" % (self.remote.global_explorer_path)]) def run_global_explorer(self, explorer): """Run the given global explorer and return it's output.""" script = os.path.join(self.remote.global_explorer_path, explorer) return self.remote.run_script(script, env=self.env, return_output=True) - ### type + # type def list_type_explorer_names(self, cdist_type): """Return a list of explorer names for the given type.""" @@ -121,37 +180,48 @@ class Explorer(object): in the object. """ - self.log.debug("Transfering type explorers for type: %s", cdist_object.cdist_type) + self.log.debug("Transfering type explorers for type: %s", + cdist_object.cdist_type) self.transfer_type_explorers(cdist_object.cdist_type) - self.log.debug("Transfering object parameters for object: %s", cdist_object.name) + self.log.debug("Transfering object parameters for object: %s", + cdist_object.name) self.transfer_object_parameters(cdist_object) for explorer in self.list_type_explorer_names(cdist_object.cdist_type): output = self.run_type_explorer(explorer, cdist_object) - self.log.debug("Running type explorer '%s' for object '%s'", explorer, cdist_object.name) + self.log.debug("Running type explorer '%s' for object '%s'", + explorer, cdist_object.name) cdist_object.explorers[explorer] = output def run_type_explorer(self, explorer, cdist_object): - """Run the given type explorer for the given object and return it's output.""" + """Run the given type explorer for the given object and return + it's output.""" cdist_type = cdist_object.cdist_type env = self.env.copy() env.update({ - '__object': os.path.join(self.remote.object_path, cdist_object.path), + '__object': os.path.join(self.remote.object_path, + cdist_object.path), '__object_id': cdist_object.object_id, '__object_name': cdist_object.name, '__object_fq': cdist_object.path, - '__type_explorer': os.path.join(self.remote.type_path, cdist_type.explorer_path) + '__type_explorer': os.path.join(self.remote.type_path, + cdist_type.explorer_path) }) - script = os.path.join(self.remote.type_path, cdist_type.explorer_path, explorer) + script = os.path.join(self.remote.type_path, cdist_type.explorer_path, + explorer) return self.remote.run_script(script, env=env, return_output=True) def transfer_type_explorers(self, cdist_type): - """Transfer the type explorers for the given type to the remote side.""" + """Transfer the type explorers for the given type to the + remote side.""" if cdist_type.explorers: if cdist_type.name in self._type_explorers_transferred: - self.log.debug("Skipping retransfer of type explorers for: %s", cdist_type) + self.log.debug("Skipping retransfer of type explorers for: %s", + cdist_type) else: - source = os.path.join(self.local.type_path, cdist_type.explorer_path) - destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) + source = os.path.join(self.local.type_path, + cdist_type.explorer_path) + destination = os.path.join(self.remote.type_path, + cdist_type.explorer_path) self.remote.mkdir(destination) self.remote.transfer(source, destination) self.remote.run(["chmod", "0700", "%s/*" % (destination)]) @@ -160,7 +230,9 @@ class Explorer(object): def transfer_object_parameters(self, cdist_object): """Transfer the parameters for the given object to the remote side.""" if cdist_object.parameters: - source = os.path.join(self.local.object_path, cdist_object.parameter_path) - destination = os.path.join(self.remote.object_path, cdist_object.parameter_path) + source = os.path.join(self.local.object_path, + cdist_object.parameter_path) + destination = os.path.join(self.remote.object_path, + cdist_object.parameter_path) self.remote.mkdir(destination) self.remote.transfer(source, destination) diff --git a/cdist/core/manifest.py b/cdist/core/manifest.py index 240e57a1..a16e9346 100644 --- a/cdist/core/manifest.py +++ b/cdist/core/manifest.py @@ -32,10 +32,16 @@ common: env: PATH: prepend directory with type emulator symlinks == local.bin_path __target_host: the target host we are working on - __global: full qualified path to the global output dir == local.out_path + __target_hostname: the target hostname provided from __target_host + __target_fqdn: the target's fully qualified domain name provided from + __target_host + __global: full qualified path to the global + output dir == local.out_path __cdist_manifest: full qualified path of the manifest == script - __cdist_type_base_path: full qualified path to the directory where types are defined for use in type emulator + __cdist_type_base_path: full qualified path to the directory where + types are defined for use in type emulator == local.type_path + __files: full qualified path to the files dir initial manifest is: script: full qualified path to the initial manifest @@ -57,6 +63,7 @@ type manifeste is: creates: new objects through type emulator ''' + class NoInitialManifestError(cdist.Error): """ Display missing initial manifest: @@ -71,7 +78,9 @@ class NoInitialManifestError(cdist.Error): if user_supplied: if os.path.islink(manifest_path): - self.message = "%s: %s -> %s" % (msg_header, manifest_path, os.path.realpath(manifest_path)) + self.message = "%s: %s -> %s" % ( + msg_header, manifest_path, + os.path.realpath(manifest_path)) else: self.message = "%s: %s" % (msg_header, manifest_path) else: @@ -89,17 +98,21 @@ class Manifest(object): self.target_host = target_host self.local = local - self.log = logging.getLogger(self.target_host) + self.log = logging.getLogger(self.target_host[0]) self.env = { 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), - '__cdist_type_base_path': self.local.type_path, # for use in type emulator + # for use in type emulator + '__cdist_type_base_path': self.local.type_path, '__global': self.local.base_path, - '__target_host': self.target_host, + '__target_host': self.target_host[0], + '__target_hostname': self.target_host[1], + '__target_fqdn': self.target_host[2], + '__files': self.local.files_path, } - if self.log.getEffectiveLevel() == logging.DEBUG: - self.env.update({'__cdist_debug': "yes" }) + if self.log.getEffectiveLevel() == logging.DEBUG: + self.env.update({'__cdist_debug': "yes"}) def env_initial_manifest(self, initial_manifest): env = os.environ.copy() @@ -122,11 +135,14 @@ class Manifest(object): if not os.path.isfile(initial_manifest): raise NoInitialManifestError(initial_manifest, user_supplied) - message_prefix="initialmanifest" - self.local.run_script(initial_manifest, env=self.env_initial_manifest(initial_manifest), message_prefix=message_prefix) + message_prefix = "initialmanifest" + self.local.run_script(initial_manifest, + env=self.env_initial_manifest(initial_manifest), + message_prefix=message_prefix) def env_type_manifest(self, cdist_object): - type_manifest = os.path.join(self.local.type_path, cdist_object.cdist_type.manifest_path) + type_manifest = os.path.join(self.local.type_path, + cdist_object.cdist_type.manifest_path) env = os.environ.copy() env.update(self.env) env.update({ @@ -141,7 +157,10 @@ class Manifest(object): return env def run_type_manifest(self, cdist_object): - type_manifest = os.path.join(self.local.type_path, cdist_object.cdist_type.manifest_path) + type_manifest = os.path.join(self.local.type_path, + cdist_object.cdist_type.manifest_path) message_prefix = cdist_object.name if os.path.isfile(type_manifest): - self.local.run_script(type_manifest, env=self.env_type_manifest(cdist_object), message_prefix=message_prefix) + self.local.run_script(type_manifest, + env=self.env_type_manifest(cdist_object), + message_prefix=message_prefix) diff --git a/cdist/emulator.py b/cdist/emulator.py index 3f553412..b04ed130 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -29,10 +29,12 @@ import sys import cdist from cdist import core + class MissingRequiredEnvironmentVariableError(cdist.Error): def __init__(self, name): self.name = name - self.message = "Emulator requires the environment variable %s to be setup" % self.name + self.message = ("Emulator requires the environment variable %s to be " + "setup" % self.name) def __str__(self): return self.message @@ -41,7 +43,7 @@ class MissingRequiredEnvironmentVariableError(cdist.Error): class DefaultList(list): """Helper class to allow default values for optional_multiple parameters. - @see https://groups.google.com/forum/#!msg/comp.lang.python/sAUvkJEDpRc/RnRymrzJVDYJ + @see https://groups.google.com/forum/#!msg/comp.lang.python/sAUvkJEDpRc/RnRymrzJVDYJ """ def __copy__(self): return [] @@ -54,20 +56,24 @@ class DefaultList(list): class Emulator(object): def __init__(self, argv, stdin=sys.stdin.buffer, env=os.environ): - self.argv = argv - self.stdin = stdin - self.env = env + self.argv = argv + self.stdin = stdin + self.env = env - self.object_id = '' + self.object_id = '' try: - self.global_path = self.env['__global'] - self.target_host = self.env['__target_host'] + self.global_path = self.env['__global'] + self.target_host = ( + self.env['__target_host'], + self.env['__target_hostname'], + self.env['__target_fqdn'] + ) # Internal variables - self.object_source = self.env['__cdist_manifest'] + self.object_source = self.env['__cdist_manifest'] self.type_base_path = self.env['__cdist_type_base_path'] - self.object_marker = self.env['__cdist_object_marker'] + self.object_marker = self.env['__cdist_object_marker'] except KeyError as e: raise MissingRequiredEnvironmentVariableError(e.args[0]) @@ -75,8 +81,8 @@ class Emulator(object): self.object_base_path = os.path.join(self.global_path, "object") self.typeorder_path = os.path.join(self.global_path, "typeorder") - self.type_name = os.path.basename(argv[0]) - self.cdist_type = core.CdistType(self.type_base_path, self.type_name) + self.type_name = os.path.basename(argv[0]) + self.cdist_type = core.CdistType(self.type_base_path, self.type_name) self.__init_log() @@ -88,7 +94,8 @@ class Emulator(object): self.save_stdin() self.record_requirements() self.record_auto_requirements() - self.log.debug("Finished %s %s" % (self.cdist_object.path, self.parameters)) + self.log.debug("Finished %s %s" % ( + self.cdist_object.path, self.parameters)) def __init_log(self): """Setup logging facility""" @@ -98,30 +105,38 @@ class Emulator(object): else: logging.root.setLevel(logging.INFO) - self.log = logging.getLogger(self.target_host) + self.log = logging.getLogger(self.target_host[0]) def commandline(self): """Parse command line""" - parser = argparse.ArgumentParser(add_help=False, argument_default=argparse.SUPPRESS) + parser = argparse.ArgumentParser(add_help=False, + argument_default=argparse.SUPPRESS) for parameter in self.cdist_type.required_parameters: argument = "--" + parameter - parser.add_argument(argument, dest=parameter, action='store', required=True) + parser.add_argument(argument, dest=parameter, action='store', + required=True) for parameter in self.cdist_type.required_multiple_parameters: argument = "--" + parameter - parser.add_argument(argument, dest=parameter, action='append', required=True) + parser.add_argument(argument, dest=parameter, action='append', + required=True) for parameter in self.cdist_type.optional_parameters: argument = "--" + parameter - parser.add_argument(argument, dest=parameter, action='store', required=False, - default=self.cdist_type.parameter_defaults.get(parameter, None)) + default = self.cdist_type.parameter_defaults.get(parameter, None) + parser.add_argument(argument, dest=parameter, action='store', + required=False, default=default) for parameter in self.cdist_type.optional_multiple_parameters: argument = "--" + parameter - parser.add_argument(argument, dest=parameter, action='append', required=False, - default=DefaultList.create(self.cdist_type.parameter_defaults.get(parameter, None))) + default = DefaultList.create( + self.cdist_type.parameter_defaults.get( + parameter, None)) + parser.add_argument(argument, dest=parameter, action='append', + required=False, default=default) for parameter in self.cdist_type.boolean_parameters: argument = "--" + parameter - parser.add_argument(argument, dest=parameter, action='store_const', const='') + parser.add_argument(argument, dest=parameter, + action='store_const', const='') # If not singleton support one positional parameter if not self.cdist_type.is_singleton: @@ -140,23 +155,31 @@ class Emulator(object): del self.args.object_id # Instantiate the cdist object we are defining - self.cdist_object = core.CdistObject(self.cdist_type, - self.object_base_path, self.object_marker, self.object_id) + self.cdist_object = core.CdistObject( + self.cdist_type, self.object_base_path, self.object_marker, + self.object_id) # Create object with given parameters self.parameters = {} - for key,value in vars(self.args).items(): + for key, value in vars(self.args).items(): if value is not None: self.parameters[key] = value - if self.cdist_object.exists and not 'CDIST_OVERRIDE' in self.env: + if self.cdist_object.exists and 'CDIST_OVERRIDE' not in self.env: if self.cdist_object.parameters != self.parameters: - raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s" - % (self.cdist_object.name, " ".join(self.cdist_object.source), self.cdist_object.parameters, self.object_source, self.parameters) - ) + errmsg = ("Object %s already exists with conflicting " + "parameters:\n%s: %s\n%s: %s" % ( + self.cdist_object.name, + " ".join(self.cdist_object.source), + self.cdist_object.parameters, + self.object_source, + self.parameters)) + self.log.error(errmsg) + raise cdist.Error(errmsg) else: if self.cdist_object.exists: - self.log.debug('Object %s override forced with CDIST_OVERRIDE',self.cdist_object.name) + self.log.debug(('Object %s override forced with ' + 'CDIST_OVERRIDE'), self.cdist_object.name) self.cdist_object.create(True) else: self.cdist_object.create() @@ -169,6 +192,7 @@ class Emulator(object): self.cdist_object.source.append(self.object_source) chunk_size = 65536 + def _read_stdin(self): return self.stdin.read(self.chunk_size) @@ -190,11 +214,41 @@ class Emulator(object): except EnvironmentError as e: raise cdist.Error('Failed to read from stdin: %s' % e) + def record_requirement(self, requirement): + """record requirement and return recorded requirement""" + + # Raises an error, if object cannot be created + try: + cdist_object = self.cdist_object.object_from_name(requirement) + except core.cdist_type.NoSuchTypeError as e: + self.log.error(("%s requires object %s, but type %s does not" + " exist. Defined at %s" % ( + self.cdist_object.name, + requirement, e.name, self.object_source))) + raise + except core.cdist_object.MissingObjectIdError as e: + self.log.error(("%s requires object %s without object id." + " Defined at %s" % (self.cdist_object.name, + requirement, + self.object_source))) + raise + + self.log.debug("Recording requirement: %s", requirement) + + # Save the sanitised version, not the user supplied one + # (__file//bar => __file/bar) + # This ensures pattern matching is done against sanitised list + self.cdist_object.requirements.append(cdist_object.name) + + return cdist_object.name + def record_requirements(self): """record requirements""" - # Inject the predecessor, but not if its an override (this would leed to an circular dependency) - if "CDIST_ORDER_DEPENDENCY" in self.env and not 'CDIST_OVERRIDE' in self.env: + # Inject the predecessor, but not if its an override + # (this would leed to an circular dependency) + if ("CDIST_ORDER_DEPENDENCY" in self.env and + 'CDIST_OVERRIDE' not in self.env): # load object name created bevor this one from typeorder file ... with open(self.typeorder_path, 'r') as typecreationfile: typecreationorder = typecreationfile.readlines() @@ -205,48 +259,38 @@ class Emulator(object): self.env['require'] += " " + lastcreatedtype else: self.env['require'] = lastcreatedtype - self.log.debug("Injecting require for CDIST_ORDER_DEPENDENCY: %s for %s", lastcreatedtype, self.cdist_object.name) + self.log.debug(("Injecting require for " + "CDIST_ORDER_DEPENDENCY: %s for %s"), + lastcreatedtype, self.cdist_object.name) except IndexError: - # if no second last line, we are on the first type, so do not set a requirement + # if no second last line, we are on the first type, + # so do not set a requirement pass - if "require" in self.env: requirements = self.env['require'] self.log.debug("reqs = " + requirements) for requirement in requirements.split(" "): # Ignore empty fields - probably the only field anyway - if len(requirement) == 0: continue - - # Raises an error, if object cannot be created - try: - cdist_object = self.cdist_object.object_from_name(requirement) - except core.cdist_type.NoSuchTypeError as e: - self.log.error("%s requires object %s, but type %s does not exist. Defined at %s" % (self.cdist_object.name, requirement, e.name, self.object_source)) - raise - except core.cdist_object.MissingObjectIdError as e: - self.log.error("%s requires object %s without object id. Defined at %s" % (self.cdist_object.name, requirement, self.object_source)) - raise - - self.log.debug("Recording requirement: %s", requirement) - - # Save the sanitised version, not the user supplied one - # (__file//bar => __file/bar) - # This ensures pattern matching is done against sanitised list - self.cdist_object.requirements.append(cdist_object.name) + if len(requirement) == 0: + continue + self.record_requirement(requirement) def record_auto_requirements(self): - """An object shall automatically depend on all objects that it defined in it's type manifest. + """An object shall automatically depend on all objects that it + defined in it's type manifest. """ - # __object_name is the name of the object whose type manifest is currently executed + # __object_name is the name of the object whose type manifest is + # currently executed __object_name = self.env.get('__object_name', None) if __object_name: # The object whose type manifest is currently run parent = self.cdist_object.object_from_name(__object_name) # The object currently being defined current_object = self.cdist_object - # As parent defined current_object it shall automatically depend on it. + # As parent defined current_object it shall automatically + # depend on it. # But only if the user hasn't said otherwise. # Must prevent circular dependencies. - if not parent.name in current_object.requirements: + if parent.name not in current_object.requirements: parent.autorequire.append(current_object.name) diff --git a/cdist/exec/local.py b/cdist/exec/local.py index c0554831..93301063 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -33,6 +33,10 @@ import tempfile import cdist import cdist.message from cdist import core +import cdist.exec.util as exec_util + +CONF_SUBDIRS_LINKED = ["explorer", "files", "manifest", "type", ] + class Local(object): """Execute commands locally. @@ -43,43 +47,33 @@ class Local(object): """ def __init__(self, target_host, + base_root_path, + host_dir_name, exec_path=sys.argv[0], initial_manifest=None, - base_path=None, add_conf_dirs=None): self.target_host = target_host - - # FIXME: stopped: create base that does not require moving later - if base_path: - base_path_parent = base_path - else: - base_path_parent = tempfile.mkdtemp() - import atexit - atexit.register(lambda: shutil.rmtree(base_path_parent)) - self.hostdir = self._hostdir() - self.base_path = os.path.join(base_path_parent, self.hostdir) - - self._init_log() - self._init_permissions() - - self.mkdir(self.base_path) - - # FIXME: as well - self._init_cache_dir(None) + self.hostdir = host_dir_name + self.base_path = os.path.join(base_root_path, "data") self.exec_path = exec_path self.custom_initial_manifest = initial_manifest - self._add_conf_dirs = add_conf_dirs + self._init_log() + self._init_permissions() + self.mkdir(self.base_path) + # FIXME: create dir that does not require moving later + self._init_cache_dir(None) self._init_paths() self._init_object_marker() self._init_conf_dirs() @property def dist_conf_dir(self): - return os.path.abspath(os.path.join(os.path.dirname(cdist.__file__), "conf")) + return os.path.abspath(os.path.join(os.path.dirname(cdist.__file__), + "conf")) @property def home_dir(self): @@ -88,15 +82,20 @@ class Local(object): else: return None - def _hostdir(self): - if os.path.isabs(self.target_host): - hostdir = self.target_host[1:] - else: - hostdir = self.target_host - return hostdir - def _init_log(self): - self.log = logging.getLogger(self.target_host) + self.log = logging.getLogger(self.target_host[0]) + + # logger is not pickable, so remove it when we pickle + def __getstate__(self): + state = self.__dict__.copy() + if 'log' in state: + del state['log'] + return state + + # recreate logger when we unpickle + def __setstate__(self, state): + self.__dict__.update(state) + self._init_log() def _init_permissions(self): # Setup file permissions using umask @@ -106,15 +105,17 @@ class Local(object): # Depending on out_path self.bin_path = os.path.join(self.base_path, "bin") self.conf_path = os.path.join(self.base_path, "conf") - self.global_explorer_out_path = os.path.join(self.base_path, "explorer") + self.global_explorer_out_path = os.path.join(self.base_path, + "explorer") self.object_path = os.path.join(self.base_path, "object") self.messages_path = os.path.join(self.base_path, "messages") + self.files_path = os.path.join(self.conf_path, "files") # Depending on conf_path self.global_explorer_path = os.path.join(self.conf_path, "explorer") self.manifest_path = os.path.join(self.conf_path, "manifest") self.initial_manifest = (self.custom_initial_manifest or - os.path.join(self.manifest_path, "init")) + os.path.join(self.manifest_path, "init")) self.type_path = os.path.join(self.conf_path, "type") @@ -160,8 +161,8 @@ class Local(object): with open(self.object_marker_file, 'w') as fd: fd.write("%s\n" % self.object_marker_name) - self.log.debug("Object marker %s saved in %s" % (self.object_marker_name, self.object_marker_file)) - + self.log.debug("Object marker %s saved in %s" % ( + self.object_marker_name, self.object_marker_file)) def _init_cache_dir(self, cache_dir): if cache_dir: @@ -170,7 +171,8 @@ class Local(object): if self.home_dir: self.cache_path = os.path.join(self.home_dir, "cache") else: - raise cdist.Error("No homedir setup and no cache dir location given") + raise cdist.Error( + "No homedir setup and no cache dir location given") def rmdir(self, path): """Remove directory on the local side.""" @@ -182,18 +184,23 @@ class Local(object): self.log.debug("Local mkdir: %s", path) os.makedirs(path, exist_ok=True) - def run(self, command, env=None, return_output=False, message_prefix=None): + def run(self, command, env=None, return_output=False, message_prefix=None, + save_output=True): """Run the given command with the given environment. Return the output as a string. """ self.log.debug("Local run: %s", command) - assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command + assert isinstance(command, (list, tuple)), ( + "list or tuple argument expected, got: %s" % command) if env is None: env = os.environ.copy() - # Export __target_host for use in __remote_{copy,exec} scripts - env['__target_host'] = self.target_host + # Export __target_host, __target_hostname, __target_fqdn + # for use in __remote_{copy,exec} scripts + env['__target_host'] = self.target_host[0] + env['__target_hostname'] = self.target_host[1] + env['__target_fqdn'] = self.target_host[2] # Export for emulator env['__cdist_object_marker'] = self.object_marker_name @@ -203,28 +210,37 @@ class Local(object): env.update(message.env) try: - if return_output: - return subprocess.check_output(command, env=env).decode() + if save_output: + output, errout = exec_util.call_get_output(command, env=env) + self.log.debug("Local stdout: {}".format(output)) + # Currently, stderr is not captured. + # self.log.debug("Local stderr: {}".format(errout)) + if return_output: + return output.decode() else: + # In some cases no output is saved. + # This is used for shell command, stdout and stderr + # must not be catched. subprocess.check_call(command, env=env) - except subprocess.CalledProcessError: - raise cdist.Error("Command failed: " + " ".join(command)) + except subprocess.CalledProcessError as e: + exec_util.handle_called_process_error(e, command) except OSError as error: raise cdist.Error(" ".join(command) + ": " + error.args[1]) finally: if message_prefix: message.merge_messages() - def run_script(self, script, env=None, return_output=False, message_prefix=None): + def run_script(self, script, env=None, return_output=False, + message_prefix=None): """Run the given script with the given environment. Return the output as a string. """ - command = [ os.environ.get('CDIST_LOCAL_SHELL',"/bin/sh") , "-e"] + command = [os.environ.get('CDIST_LOCAL_SHELL', "/bin/sh"), "-e"] command.append(script) - return self.run(command=command, env=env, return_output=return_output, message_prefix=message_prefix) - + return self.run(command=command, env=env, return_output=return_output, + message_prefix=message_prefix) def save_cache(self): destination = os.path.join(self.cache_path, self.hostdir) @@ -234,9 +250,14 @@ class Local(object): if os.path.exists(destination): shutil.rmtree(destination) except PermissionError as e: - raise cdist.Error("Cannot delete old cache %s: %s" % (destination, e)) + raise cdist.Error( + "Cannot delete old cache %s: %s" % (destination, e)) shutil.move(self.base_path, destination) + # add target_host since cache dir can be hash-ed target_host + host_cache_path = os.path.join(destination, "target_host") + with open(host_cache_path, 'w') as hostf: + print(self.target_host[0], file=hostf) def _create_messages(self): """Create empty messages""" @@ -244,14 +265,14 @@ class Local(object): pass def _create_conf_path_and_link_conf_dirs(self): - # Link destination directories - for sub_dir in [ "explorer", "manifest", "type" ]: + # Create destination directories + for sub_dir in CONF_SUBDIRS_LINKED: self.mkdir(os.path.join(self.conf_path, sub_dir)) # Iterate over all directories and link the to the output dir for conf_dir in self.conf_dirs: self.log.debug("Checking conf_dir %s ..." % (conf_dir)) - for sub_dir in [ "explorer", "manifest", "type" ]: + for sub_dir in CONF_SUBDIRS_LINKED: current_dir = os.path.join(conf_dir, sub_dir) # Allow conf dirs to contain only partial content @@ -260,18 +281,21 @@ class Local(object): for entry in os.listdir(current_dir): rel_entry_path = os.path.join(sub_dir, entry) - src = os.path.abspath(os.path.join(conf_dir, sub_dir, entry)) + src = os.path.abspath(os.path.join(conf_dir, + sub_dir, + entry)) dst = os.path.join(self.conf_path, sub_dir, entry) # Already exists? remove and link if os.path.exists(dst): os.unlink(dst) - + self.log.debug("Linking %s to %s ..." % (src, dst)) try: os.symlink(src, dst) except OSError as e: - raise cdist.Error("Linking %s %s to %s failed: %s" % (sub_dir, src, dst, e.__str__())) + raise cdist.Error("Linking %s %s to %s failed: %s" % ( + sub_dir, src, dst, e.__str__())) def _link_types_for_emulator(self): """Link emulator to types""" @@ -283,4 +307,6 @@ class Local(object): try: os.symlink(src, dst) except OSError as e: - raise cdist.Error("Linking emulator from %s to %s failed: %s" % (src, dst, e.__str__())) + raise cdist.Error( + "Linking emulator from %s to %s failed: %s" % ( + src, dst, e.__str__())) diff --git a/cdist/exec/remote.py b/cdist/exec/remote.py index 77e2c8be..9c70bdf4 100644 --- a/cdist/exec/remote.py +++ b/cdist/exec/remote.py @@ -26,8 +26,11 @@ import sys import glob import subprocess import logging +import multiprocessing import cdist +import cdist.exec.util as exec_util + class DecodeError(cdist.Error): def __init__(self, command): @@ -64,17 +67,31 @@ class Remote(object): self.type_path = os.path.join(self.conf_path, "type") self.global_explorer_path = os.path.join(self.conf_path, "explorer") - self.log = logging.getLogger(self.target_host) + self._open_logger() self._init_env() + def _open_logger(self): + self.log = logging.getLogger(self.target_host[0]) + + # logger is not pickable, so remove it when we pickle + def __getstate__(self): + state = self.__dict__.copy() + if 'log' in state: + del state['log'] + return state + + # recreate logger when we unpickle + def __setstate__(self, state): + self.__dict__.update(state) + self._open_logger() + def _init_env(self): """Setup environment for scripts - HERE????""" # FIXME: better do so in exec functions that require it! os.environ['__remote_copy'] = self._copy os.environ['__remote_exec'] = self._exec - def create_files_dirs(self): self.rmdir(self.base_path) self.mkdir(self.base_path) @@ -100,20 +117,56 @@ class Remote(object): for f in glob.glob1(source, '*'): command = self._copy.split() path = os.path.join(source, f) - command.extend([path, '{0}:{1}'.format(self.target_host, destination)]) + command.extend([path, '{0}:{1}'.format( + self.target_host[0], destination)]) self._run_command(command) else: command = self._copy.split() - command.extend([source, '{0}:{1}'.format(self.target_host, destination)]) + command.extend([source, '{0}:{1}'.format( + self.target_host[0], destination)]) self._run_command(command) + def transfer_dir_parallel(self, source, destination, jobs): + """Transfer a directory to the remote side in parallel mode.""" + self.log.debug("Remote transfer: %s -> %s", source, destination) + self.rmdir(destination) + if os.path.isdir(source): + self.mkdir(destination) + self.log.info("Remote transfer in {} parallel jobs".format( + jobs)) + self.log.debug("Multiprocessing start method is {}".format( + multiprocessing.get_start_method())) + self.log.debug(("Starting multiprocessing Pool for parallel " + "remote transfer")) + with multiprocessing.Pool(jobs) as pool: + self.log.debug("Starting async for parallel transfer") + commands = [] + for f in glob.glob1(source, '*'): + command = self._copy.split() + path = os.path.join(source, f) + command.extend([path, '{0}:{1}'.format( + self.target_host[0], destination)]) + commands.append(command) + results = [ + pool.apply_async(self._run_command, (cmd,)) + for cmd in commands + ] + + self.log.debug("Waiting async results for parallel transfer") + for r in results: + r.get() # self._run_command returns None + self.log.debug(("Multiprocessing for parallel transfer " + "finished")) + else: + raise cdist.Error("Source {} is not a directory".format(source)) + def run_script(self, script, env=None, return_output=False): """Run the given script with the given environment on the remote side. Return the output as a string. """ - command = [ os.environ.get('CDIST_REMOTE_SHELL',"/bin/sh") , "-e"] + command = [os.environ.get('CDIST_REMOTE_SHELL', "/bin/sh"), "-e"] command.append(script) return self.run(command, env, return_output) @@ -125,7 +178,7 @@ class Remote(object): """ # prefix given command with remote_exec cmd = self._exec.split() - cmd.append(self.target_host) + cmd.append(self.target_host[0]) # FIXME: replace this by -o SendEnv name -o SendEnv name ... to ssh? # can't pass environment to remote side, so prepend command with @@ -147,8 +200,8 @@ class Remote(object): # /bin/csh will execute this script in the right way. if env: remote_env = [" export %s=%s;" % item for item in env.items()] - string_cmd = ("/bin/sh -c '" + " ".join(remote_env) - + " ".join(command) + "'") + string_cmd = ("/bin/sh -c '" + " ".join(remote_env) + + " ".join(command) + "'") cmd.append(string_cmd) else: cmd.extend(command) @@ -159,20 +212,26 @@ class Remote(object): Return the output as a string. """ - assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command + assert isinstance(command, (list, tuple)), ( + "list or tuple argument expected, got: %s" % command) - # export target_host for use in __remote_{exec,copy} scripts + # export target_host, target_hostname, target_fqdn + # for use in __remote_{exec,copy} scripts os_environ = os.environ.copy() - os_environ['__target_host'] = self.target_host + os_environ['__target_host'] = self.target_host[0] + os_environ['__target_hostname'] = self.target_host[1] + os_environ['__target_fqdn'] = self.target_host[2] self.log.debug("Remote run: %s", command) try: + output, errout = exec_util.call_get_output(command, env=os_environ) + self.log.debug("Remote stdout: {}".format(output)) + # Currently, stderr is not captured. + # self.log.debug("Remote stderr: {}".format(errout)) if return_output: - return subprocess.check_output(command, env=os_environ).decode() - else: - subprocess.check_call(command, env=os_environ) - except subprocess.CalledProcessError: - raise cdist.Error("Command failed: " + " ".join(command)) + return output.decode() + except subprocess.CalledProcessError as e: + exec_util.handle_called_process_error(e, command) except OSError as error: raise cdist.Error(" ".join(command) + ": " + error.args[1]) except UnicodeDecodeError: diff --git a/cdist/exec/util.py b/cdist/exec/util.py new file mode 100644 index 00000000..864a73a3 --- /dev/null +++ b/cdist/exec/util.py @@ -0,0 +1,155 @@ +# -*- coding: utf-8 -*- +# +# 2016 Darko Poljak (darko.poljak at gmail.com) +# +# 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 . +# +# + +import subprocess +import sys +from tempfile import TemporaryFile + +import cdist + + +# IMPORTANT: +# with the code below in python 3.5 when command is executed and error +# occurs then stderr is not captured. +# As it seems from documentation, it is only captured when using +# subprocess.run method with stderr=subprocess.PIPE and is captured +# into CompletedProcess resulting object or into CalledProcessError +# in case of error (only if specified capturing). +# +# If using PIPE then the run is slow. run method uses communicate method +# and internally it uses buffering. +# +# For now we will use capturing only stdout. stderr is written directly to +# stderr from child process. +# +# STDERR_UNSUPPORTED = '' +# +# +# def call_get_output(command, env=None): +# """Run the given command with the given environment. +# Return the tuple of stdout and stderr output as a byte strings. +# """ +# +# assert isinstance(command, (list, tuple)), ( +# "list or tuple argument expected, got: {}".format(command)) +# +# if sys.version_info >= (3, 5): +# return call_get_out_err(command, env) +# else: +# return (call_get_stdout(command, env), STDERR_UNSUPPORTED) +# +# +# def handle_called_process_error(err, command): +# if sys.version_info >= (3, 5): +# errout = err.stderr +# else: +# errout = STDERR_UNSUPPORTED +# raise cdist.Error("Command failed: " + " ".join(command) + +# " with returncode: {} and stdout: {}, stderr: {}".format( +# err.returncode, err.output, errout)) +# +# +# def call_get_stdout(command, env=None): +# """Run the given command with the given environment. +# Return the stdout output as a byte string, stderr is ignored. +# """ +# assert isinstance(command, (list, tuple)), ( +# "list or tuple argument expected, got: {}".format(command)) +# +# with TemporaryFile() as fout: +# subprocess.check_call(command, env=env, stdout=fout) +# fout.seek(0) +# output = fout.read() +# +# return output +# +# +# def call_get_out_err(command, env=None): +# """Run the given command with the given environment. +# Return the tuple of stdout and stderr output as a byte strings. +# """ +# assert isinstance(command, (list, tuple)), ( +# "list or tuple argument expected, got: {}".format(command)) +# +# with TemporaryFile() as fout, TemporaryFile() as ferr: +# subprocess.check_call(command, env=env, +# stdout=fout, stderr=ferr) +# fout.seek(0) +# ferr.seek(0) +# output = (fout.read(), ferr.read()) +# +# return output + +# +# The code below with bufsize=0 does not work either, communicate +# internally uses buffering. It works in case of error, but if everything +# is ok and there is no output in stderr then execution is very very slow. +# +# def _call_get_out_err(command, env=None): +# """Run the given command with the given environment. +# Return the tuple of stdout and stderr output as a byte strings. +# """ +# assert isinstance(command, (list, tuple)), ( +# "list or tuple argument expected, got: {}".format(command)) +# +# result = subprocess.run(command, env=env, bufsize=0, +# stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True) +# +# return (result.stdout, result.stderr) + + +def call_get_output(command, env=None): + """Run the given command with the given environment. + Return the tuple of stdout and stderr output as a byte strings. + """ + + assert isinstance(command, (list, tuple)), ( + "list or tuple argument expected, got: {}".format(command)) + return (_call_get_stdout(command, env), None) + + +def handle_called_process_error(err, command): + # Currently, stderr is not captured. + # errout = None + # raise cdist.Error("Command failed: " + " ".join(command) + + # (" with returncode: {}\n" + # "stdout: {}\n" + # "stderr: {}").format( + # err.returncode, err.output, errout)) + raise cdist.Error("Command failed: " + " ".join(command) + + (" with returncode: {}\n" + "stdout: {}").format( + err.returncode, err.output)) + + +def _call_get_stdout(command, env=None): + """Run the given command with the given environment. + Return the stdout output as a byte string, stderr is ignored. + """ + assert isinstance(command, (list, tuple)), ( + "list or tuple argument expected, got: {}".format(command)) + + with TemporaryFile() as fout: + subprocess.check_call(command, env=env, stdout=fout) + fout.seek(0) + output = fout.read() + + return output diff --git a/cdist/log.py b/cdist/log.py index 8c3aac79..2341c282 100644 --- a/cdist/log.py +++ b/cdist/log.py @@ -22,6 +22,7 @@ import logging + class Log(logging.Logger): def __init__(self, name): diff --git a/cdist/message.py b/cdist/message.py index f9b0c313..98a6e8cf 100644 --- a/cdist/message.py +++ b/cdist/message.py @@ -37,8 +37,9 @@ class Message(object): self.prefix = prefix self.global_messages = messages - in_fd, self.messages_in = tempfile.mkstemp(suffix='.cdist_message_in') - out_fd, self.messages_out = tempfile.mkstemp(suffix='.cdist_message_out') + in_fd, self.messages_in = tempfile.mkstemp(suffix='.cdist_message_in') + out_fd, self.messages_out = tempfile.mkstemp( + suffix='.cdist_message_out') os.close(in_fd) os.close(out_fd) @@ -48,7 +49,7 @@ class Message(object): @property def env(self): env = {} - env['__messages_in'] = self.messages_in + env['__messages_in'] = self.messages_in env['__messages_out'] = self.messages_out return env diff --git a/cdist/shell.py b/cdist/shell.py index d0921bc9..9378efc3 100644 --- a/cdist/shell.py +++ b/cdist/shell.py @@ -22,6 +22,7 @@ import logging import os import subprocess +import tempfile # initialise cdist import cdist.exec.local @@ -31,35 +32,51 @@ import cdist.config log = logging.getLogger(__name__) + class Shell(object): - + def __init__(self, shell=None): self.shell = shell - self.target_host = "cdist-shell-no-target-host" + self.target_host = ( + "cdist-shell-no-target-host", + "cdist-shell-no-target-host", + "cdist-shell-no-target-host", + ) + + host_dir_name = cdist.str_hash(self.target_host[0]) + base_root_path = tempfile.mkdtemp() + host_base_path = os.path.join(base_root_path, host_dir_name) + self.local = cdist.exec.local.Local( - target_host=self.target_host) + target_host=self.target_host, + base_root_path=host_base_path, + host_dir_name=host_dir_name) def _init_shell(self): """Select shell to execute, if not specified by user""" if not self.shell: - self.shell = os.environ.get('SHELL',"/bin/sh") + self.shell = os.environ.get('SHELL', "/bin/sh") def _init_files_dirs(self): self.local.create_files_dirs() def _init_environment(self): self.env = os.environ.copy() - additional_env = { + additional_env = { 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), - '__cdist_type_base_path': self.local.type_path, # for use in type emulator + # for use in type emulator + '__cdist_type_base_path': self.local.type_path, '__cdist_manifest': "cdist shell", '__global': self.local.base_path, - '__target_host': self.target_host, + '__target_host': self.target_host[0], + '__target_hostname': self.target_host[1], + '__target_fqdn': self.target_host[2], '__manifest': self.local.manifest_path, '__explorer': self.local.global_explorer_path, + '__files': self.local.files_path, } self.env.update(additional_env) @@ -70,7 +87,8 @@ class Shell(object): self._init_environment() log.info("Starting shell...") - self.local.run([self.shell], self.env) + # save_output=False -> do not catch stdout and stderr + self.local.run([self.shell], self.env, save_output=False) log.info("Finished shell.") @classmethod diff --git a/cdist/sphinxext/__init__.py b/cdist/sphinxext/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/cdist/sphinxext/manpage.py b/cdist/sphinxext/manpage.py new file mode 100644 index 00000000..97b41f03 --- /dev/null +++ b/cdist/sphinxext/manpage.py @@ -0,0 +1,82 @@ +import sphinx.builders.manpage +import sphinx.writers.manpage +from docutils.frontend import OptionParser +from sphinx.util.console import bold, darkgreen +from six import string_types +from docutils.io import FileOutput +from os import path +from sphinx.util.nodes import inline_all_toctrees +from sphinx import addnodes + +""" + Extension based on sphinx builtin manpage. + It does not write its own .SH NAME based on config, + but leaves everything to actual reStructuredText file content. +""" + + +class ManualPageTranslator(sphinx.writers.manpage.ManualPageTranslator): + + def header(self): + tmpl = (".TH \"%(title_upper)s\" \"%(manual_section)s\"" + " \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n") + return tmpl % self._docinfo + + +class ManualPageWriter(sphinx.writers.manpage.ManualPageWriter): + + def __init__(self, builder): + super().__init__(builder) + self.translator_class = ( + self.builder.translator_class or ManualPageTranslator) + + +class ManualPageBuilder(sphinx.builders.manpage.ManualPageBuilder): + + name = 'cman' + + def write(self, *ignored): + docwriter = ManualPageWriter(self) + docsettings = OptionParser( + defaults=self.env.settings, + components=(docwriter,), + read_config_files=True).get_default_values() + + self.info(bold('writing... '), nonl=True) + + for info in self.config.man_pages: + docname, name, description, authors, section = info + if isinstance(authors, string_types): + if authors: + authors = [authors] + else: + authors = [] + + targetname = '%s.%s' % (name, section) + self.info(darkgreen(targetname) + ' { ', nonl=True) + destination = FileOutput( + destination_path=path.join(self.outdir, targetname), + encoding='utf-8') + + tree = self.env.get_doctree(docname) + docnames = set() + largetree = inline_all_toctrees(self, docnames, docname, tree, + darkgreen, [docname]) + self.info('} ', nonl=True) + self.env.resolve_references(largetree, docname, self) + # remove pending_xref nodes + for pendingnode in largetree.traverse(addnodes.pending_xref): + pendingnode.replace_self(pendingnode.children) + + largetree.settings = docsettings + largetree.settings.title = name + largetree.settings.subtitle = description + largetree.settings.authors = authors + largetree.settings.section = section + + docwriter.write(largetree, destination) + self.info() + + +def setup(app): + app.add_builder(ManualPageBuilder) diff --git a/cdist/test/__init__.py b/cdist/test/__init__.py index ab767699..83b0c618 100644 --- a/cdist/test/__init__.py +++ b/cdist/test/__init__.py @@ -28,14 +28,20 @@ cdist_base_path = os.path.abspath( cdist_exec_path = os.path.join(cdist_base_path, "scripts/cdist") -global_fixtures_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "fixtures")) +global_fixtures_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), + "fixtures")) + class CdistTestCase(unittest.TestCase): remote_exec = os.path.join(global_fixtures_dir, "remote", "exec") remote_copy = os.path.join(global_fixtures_dir, "remote", "copy") - target_host = 'cdisttesthost' + target_host = ( + 'cdisttesthost', + 'cdisttesthost', + 'cdisttesthost', + ) def mkdtemp(self, **kwargs): return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) diff --git a/cdist/test/banner/__init__.py b/cdist/test/banner/__init__.py index 4b0ab6ac..957b7b12 100644 --- a/cdist/test/banner/__init__.py +++ b/cdist/test/banner/__init__.py @@ -27,6 +27,7 @@ import unittest import cdist import cdist.banner + class Banner(unittest.TestCase): def setUp(self): self.banner = cdist.BANNER + "\n" @@ -38,5 +39,5 @@ class Banner(unittest.TestCase): sys.stdout = output cdist.banner.banner(None) - + self.assertEqual(output.getvalue(), self.banner) diff --git a/cdist/test/cdist_object/__init__.py b/cdist/test/cdist_object/__init__.py index 9c075acb..d03c0642 100644 --- a/cdist/test/cdist_object/__init__.py +++ b/cdist/test/cdist_object/__init__.py @@ -57,29 +57,37 @@ class ObjectClassTestCase(test.CdistTestCase): self.expected_objects = [] for cdist_object_name in expected_object_names: cdist_type, cdist_object_id = cdist_object_name.split("/", 1) - cdist_object = core.CdistObject(core.CdistType(type_base_path, cdist_type), self.object_base_path, - OBJECT_MARKER_NAME, cdist_object_id) + cdist_object = core.CdistObject(core.CdistType(type_base_path, + cdist_type), + self.object_base_path, + OBJECT_MARKER_NAME, + cdist_object_id) cdist_object.create() self.expected_objects.append(cdist_object) - + def tearDown(self): shutil.rmtree(self.tempdir) def test_list_object_names(self): - found_object_names = sorted(list(core.CdistObject.list_object_names(self.object_base_path, OBJECT_MARKER_NAME))) - self.assertEqual(found_object_names, expected_object_names) + found_object_names = sorted(list(core.CdistObject.list_object_names( + self.object_base_path, OBJECT_MARKER_NAME))) + self.assertEqual(found_object_names, expected_object_names) def test_list_type_names(self): - type_names = list(cdist.core.CdistObject.list_type_names(self.object_base_path)) - self.assertEqual(sorted(type_names), ['__first', '__second', '__third']) + type_names = list(cdist.core.CdistObject.list_type_names( + self.object_base_path)) + self.assertEqual(sorted(type_names), + ['__first', '__second', '__third']) def test_list_objects(self): - found_objects = sorted(list(core.CdistObject.list_objects(self.object_base_path, type_base_path, OBJECT_MARKER_NAME))) + found_objects = sorted(list(core.CdistObject.list_objects( + self.object_base_path, type_base_path, OBJECT_MARKER_NAME))) self.assertEqual(found_objects, self.expected_objects) def test_create_singleton(self): """Check whether creating an object without id (singleton) works""" - singleton = self.expected_objects[0].object_from_name("__test_singleton") + singleton = self.expected_objects[0].object_from_name( + "__test_singleton") # came here - everything fine def test_create_singleton_not_singleton_type(self): @@ -88,6 +96,7 @@ class ObjectClassTestCase(test.CdistTestCase): with self.assertRaises(cdist.core.cdist_object.MissingObjectIdError): self.expected_objects[0].object_from_name("__first") + class ObjectIdTestCase(test.CdistTestCase): def setUp(self): @@ -97,11 +106,14 @@ class ObjectIdTestCase(test.CdistTestCase): self.expected_objects = [] for cdist_object_name in expected_object_names: cdist_type, cdist_object_id = cdist_object_name.split("/", 1) - cdist_object = core.CdistObject(core.CdistType(type_base_path, cdist_type), self.object_base_path, - OBJECT_MARKER_NAME, cdist_object_id) + cdist_object = core.CdistObject(core.CdistType(type_base_path, + cdist_type), + self.object_base_path, + OBJECT_MARKER_NAME, + cdist_object_id) cdist_object.create() self.expected_objects.append(cdist_object) - + def tearDown(self): shutil.rmtree(self.tempdir) @@ -109,31 +121,39 @@ class ObjectIdTestCase(test.CdistTestCase): cdist_type = core.CdistType(type_base_path, '__third') illegal_object_id = '/object_id//may/not/contain/double/slash' with self.assertRaises(core.IllegalObjectIdError): - core.CdistObject(cdist_type, self.object_base_path, OBJECT_MARKER_NAME, illegal_object_id) + core.CdistObject(cdist_type, self.object_base_path, + OBJECT_MARKER_NAME, illegal_object_id) def test_object_id_contains_object_marker(self): cdist_type = core.CdistType(type_base_path, '__third') - illegal_object_id = 'object_id/may/not/contain/%s/anywhere' % OBJECT_MARKER_NAME + illegal_object_id = ( + 'object_id/may/not/contain/%s/anywhere' % OBJECT_MARKER_NAME) with self.assertRaises(core.IllegalObjectIdError): - core.CdistObject(cdist_type, self.object_base_path, OBJECT_MARKER_NAME, illegal_object_id) + core.CdistObject(cdist_type, self.object_base_path, + OBJECT_MARKER_NAME, illegal_object_id) def test_object_id_contains_object_marker_string(self): cdist_type = core.CdistType(type_base_path, '__third') - illegal_object_id = 'object_id/may/contain_%s_in_filename' % OBJECT_MARKER_NAME - core.CdistObject(cdist_type, self.object_base_path, OBJECT_MARKER_NAME, illegal_object_id) + illegal_object_id = ( + 'object_id/may/contain_%s_in_filename' % OBJECT_MARKER_NAME) + core.CdistObject(cdist_type, self.object_base_path, + OBJECT_MARKER_NAME, illegal_object_id) # if we get here, the test passed def test_object_id_contains_only_dot(self): cdist_type = core.CdistType(type_base_path, '__third') illegal_object_id = '.' with self.assertRaises(core.IllegalObjectIdError): - core.CdistObject(cdist_type, self.object_base_path, OBJECT_MARKER_NAME, illegal_object_id) + core.CdistObject(cdist_type, self.object_base_path, + OBJECT_MARKER_NAME, illegal_object_id) def test_object_id_on_singleton_type(self): cdist_type = core.CdistType(type_base_path, '__test_singleton') illegal_object_id = 'object_id' with self.assertRaises(core.IllegalObjectIdError): - core.CdistObject(cdist_type, self.object_base_path, OBJECT_MARKER_NAME, illegal_object_id) + core.CdistObject(cdist_type, self.object_base_path, + OBJECT_MARKER_NAME, illegal_object_id) + class ObjectTestCase(test.CdistTestCase): @@ -142,13 +162,14 @@ class ObjectTestCase(test.CdistTestCase): self.object_base_path = self.tempdir self.cdist_type = core.CdistType(type_base_path, '__third') - self.cdist_object = core.CdistObject(self.cdist_type, self.object_base_path, OBJECT_MARKER_NAME, 'moon') + self.cdist_object = core.CdistObject(self.cdist_type, + self.object_base_path, + OBJECT_MARKER_NAME, 'moon') self.cdist_object.create() self.cdist_object.parameters['planet'] = 'Saturn' self.cdist_object.parameters['name'] = 'Prometheus' - def tearDown(self): self.cdist_object.prepared = False self.cdist_object.ran = False @@ -166,22 +187,29 @@ class ObjectTestCase(test.CdistTestCase): self.assertEqual(self.cdist_object.object_id, 'moon') def test_path(self): - self.assertEqual(self.cdist_object.path, "__third/moon/%s" % OBJECT_MARKER_NAME) + self.assertEqual(self.cdist_object.path, + "__third/moon/%s" % OBJECT_MARKER_NAME) def test_absolute_path(self): - self.assertEqual(self.cdist_object.absolute_path, os.path.join(self.object_base_path, "__third/moon/%s" % OBJECT_MARKER_NAME)) + self.assertEqual(self.cdist_object.absolute_path, + os.path.join(self.object_base_path, + "__third/moon/%s" % OBJECT_MARKER_NAME)) def test_code_local_path(self): - self.assertEqual(self.cdist_object.code_local_path, "__third/moon/%s/code-local" % OBJECT_MARKER_NAME) + self.assertEqual(self.cdist_object.code_local_path, + "__third/moon/%s/code-local" % OBJECT_MARKER_NAME) def test_code_remote_path(self): - self.assertEqual(self.cdist_object.code_remote_path, "__third/moon/%s/code-remote" % OBJECT_MARKER_NAME) + self.assertEqual(self.cdist_object.code_remote_path, + "__third/moon/%s/code-remote" % OBJECT_MARKER_NAME) def test_parameter_path(self): - self.assertEqual(self.cdist_object.parameter_path, "__third/moon/%s/parameter" % OBJECT_MARKER_NAME) + self.assertEqual(self.cdist_object.parameter_path, + "__third/moon/%s/parameter" % OBJECT_MARKER_NAME) def test_explorer_path(self): - self.assertEqual(self.cdist_object.explorer_path, "__third/moon/%s/explorer" % OBJECT_MARKER_NAME) + self.assertEqual(self.cdist_object.explorer_path, + "__third/moon/%s/explorer" % OBJECT_MARKER_NAME) def test_parameters(self): expected_parameters = {'planet': 'Saturn', 'name': 'Prometheus'} @@ -190,32 +218,39 @@ class ObjectTestCase(test.CdistTestCase): def test_explorers(self): self.assertEqual(self.cdist_object.explorers, {}) - # FIXME: actually testing fsproperty.DirectoryDictProperty here, move to their own test case + # FIXME: actually testing fsproperty.DirectoryDictProperty here, + # move to their own test case def test_explorers_assign_dict(self): expected = {'first': 'foo', 'second': 'bar'} # when set, written to file self.cdist_object.explorers = expected - object_explorer_path = os.path.join(self.cdist_object.base_path, self.cdist_object.explorer_path) + object_explorer_path = os.path.join(self.cdist_object.base_path, + self.cdist_object.explorer_path) self.assertTrue(os.path.isdir(object_explorer_path)) # when accessed, read from file self.assertEqual(self.cdist_object.explorers, expected) # remove dynamically created folder self.cdist_object.explorers = {} - os.rmdir(os.path.join(self.cdist_object.base_path, self.cdist_object.explorer_path)) + os.rmdir(os.path.join(self.cdist_object.base_path, + self.cdist_object.explorer_path)) - # FIXME: actually testing fsproperty.DirectoryDictProperty here, move to their own test case + # FIXME: actually testing fsproperty.DirectoryDictProperty here, + # move to their own test case def test_explorers_assign_key_value(self): expected = {'first': 'foo', 'second': 'bar'} - object_explorer_path = os.path.join(self.cdist_object.base_path, self.cdist_object.explorer_path) - for key,value in expected.items(): + object_explorer_path = os.path.join(self.cdist_object.base_path, + self.cdist_object.explorer_path) + for key, value in expected.items(): # when set, written to file self.cdist_object.explorers[key] = value - self.assertTrue(os.path.isfile(os.path.join(object_explorer_path, key))) + self.assertTrue(os.path.isfile(os.path.join(object_explorer_path, + key))) # when accessed, read from file self.assertEqual(self.cdist_object.explorers, expected) # remove dynamically created folder self.cdist_object.explorers = {} - os.rmdir(os.path.join(self.cdist_object.base_path, self.cdist_object.explorer_path)) + os.rmdir(os.path.join(self.cdist_object.base_path, + self.cdist_object.explorer_path)) def test_requirements(self): expected = [] @@ -226,15 +261,18 @@ class ObjectTestCase(test.CdistTestCase): def test_state_prepared(self): self.cdist_object.state = core.CdistObject.STATE_PREPARED - self.assertEqual(self.cdist_object.state, core.CdistObject.STATE_PREPARED) + self.assertEqual(self.cdist_object.state, + core.CdistObject.STATE_PREPARED) def test_state_running(self): self.cdist_object.state = core.CdistObject.STATE_RUNNING - self.assertEqual(self.cdist_object.state, core.CdistObject.STATE_RUNNING) + self.assertEqual(self.cdist_object.state, + core.CdistObject.STATE_RUNNING) def test_state_done(self): self.cdist_object.state = core.CdistObject.STATE_DONE - self.assertEqual(self.cdist_object.state, core.CdistObject.STATE_DONE) + self.assertEqual(self.cdist_object.state, + core.CdistObject.STATE_DONE) def test_source(self): self.assertEqual(list(self.cdist_object.source), []) diff --git a/cdist/test/cdist_type/__init__.py b/cdist/test/cdist_type/__init__.py index ccbf6742..feb5fa15 100644 --- a/cdist/test/cdist_type/__init__.py +++ b/cdist/test/cdist_type/__init__.py @@ -34,7 +34,8 @@ class TypeTestCase(test.CdistTestCase): def test_list_type_names(self): base_path = op.join(fixtures, 'list_types') type_names = core.CdistType.list_type_names(base_path) - self.assertEqual(sorted(type_names), ['__first', '__second', '__third']) + self.assertEqual(sorted(type_names), + ['__first', '__second', '__third']) def test_list_types(self): base_path = op.join(fixtures, 'list_types') @@ -54,7 +55,8 @@ class TypeTestCase(test.CdistTestCase): def test_nonexistent_type(self): base_path = fixtures - self.assertRaises(core.NoSuchTypeError, core.CdistType, base_path, '__i-dont-exist') + self.assertRaises(core.NoSuchTypeError, core.CdistType, base_path, + '__i-dont-exist') def test_name(self): base_path = fixtures @@ -74,27 +76,32 @@ class TypeTestCase(test.CdistTestCase): def test_absolute_path(self): base_path = fixtures cdist_type = core.CdistType(base_path, '__name_path') - self.assertEqual(cdist_type.absolute_path, os.path.join(base_path, '__name_path')) + self.assertEqual(cdist_type.absolute_path, + os.path.join(base_path, '__name_path')) def test_manifest_path(self): base_path = fixtures cdist_type = core.CdistType(base_path, '__name_path') - self.assertEqual(cdist_type.manifest_path, os.path.join('__name_path', 'manifest')) + self.assertEqual(cdist_type.manifest_path, + os.path.join('__name_path', 'manifest')) def test_explorer_path(self): base_path = fixtures cdist_type = core.CdistType(base_path, '__name_path') - self.assertEqual(cdist_type.explorer_path, os.path.join('__name_path', 'explorer')) + self.assertEqual(cdist_type.explorer_path, + os.path.join('__name_path', 'explorer')) def test_gencode_local_path(self): base_path = fixtures cdist_type = core.CdistType(base_path, '__name_path') - self.assertEqual(cdist_type.gencode_local_path, os.path.join('__name_path', 'gencode-local')) + self.assertEqual(cdist_type.gencode_local_path, + os.path.join('__name_path', 'gencode-local')) def test_gencode_remote_path(self): base_path = fixtures cdist_type = core.CdistType(base_path, '__name_path') - self.assertEqual(cdist_type.gencode_remote_path, os.path.join('__name_path', 'gencode-remote')) + self.assertEqual(cdist_type.gencode_remote_path, + os.path.join('__name_path', 'gencode-remote')) def test_singleton_is_singleton(self): base_path = fixtures @@ -119,17 +126,20 @@ class TypeTestCase(test.CdistTestCase): def test_with_required_parameters(self): base_path = fixtures cdist_type = core.CdistType(base_path, '__with_required_parameters') - self.assertEqual(cdist_type.required_parameters, ['required1', 'required2']) + self.assertEqual(cdist_type.required_parameters, + ['required1', 'required2']) def test_without_required_parameters(self): base_path = fixtures - cdist_type = core.CdistType(base_path, '__without_required_parameters') + cdist_type = core.CdistType(base_path, + '__without_required_parameters') self.assertEqual(cdist_type.required_parameters, []) def test_with_optional_parameters(self): base_path = fixtures cdist_type = core.CdistType(base_path, '__with_optional_parameters') - self.assertEqual(cdist_type.optional_parameters, ['optional1', 'optional2']) + self.assertEqual(cdist_type.optional_parameters, + ['optional1', 'optional2']) def test_without_optional_parameters(self): base_path = fixtures @@ -139,7 +149,8 @@ class TypeTestCase(test.CdistTestCase): def test_with_boolean_parameters(self): base_path = fixtures cdist_type = core.CdistType(base_path, '__with_boolean_parameters') - self.assertEqual(cdist_type.boolean_parameters, ['boolean1', 'boolean2']) + self.assertEqual(cdist_type.boolean_parameters, + ['boolean1', 'boolean2']) def test_without_boolean_parameters(self): base_path = fixtures @@ -158,5 +169,4 @@ class TypeTestCase(test.CdistTestCase): cdist_type = core.CdistType(base_path, '__directory_in_default') self.assertEqual( list(sorted(cdist_type.parameter_defaults.keys())), - ['bar', 'foo'] - ) + ['bar', 'foo']) diff --git a/cdist/test/code/__init__.py b/cdist/test/code/__init__.py index 689fcff6..83c93f8b 100644 --- a/cdist/test/code/__init__.py +++ b/cdist/test/code/__init__.py @@ -36,15 +36,19 @@ my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') conf_dir = op.join(fixtures, 'conf') + class CodeTestCase(test.CdistTestCase): def setUp(self): self.local_dir = self.mkdtemp() + self.hostdir = cdist.str_hash(self.target_host[0]) + self.host_base_path = os.path.join(self.local_dir, self.hostdir) self.local = local.Local( - target_host=self.target_host, - base_path = self.local_dir, - exec_path = cdist.test.cdist_exec_path, + target_host=self.target_host, + base_root_path=self.host_base_path, + host_dir_name=self.hostdir, + exec_path=cdist.test.cdist_exec_path, add_conf_dirs=[conf_dir]) self.local.create_files_dirs() @@ -52,16 +56,19 @@ class CodeTestCase(test.CdistTestCase): remote_exec = self.remote_exec remote_copy = self.remote_copy self.remote = remote.Remote( - target_host=self.target_host, - remote_exec=remote_exec, + target_host=self.target_host, + remote_exec=remote_exec, remote_copy=remote_copy, base_path=self.remote_dir) self.remote.create_files_dirs() self.code = code.Code(self.target_host, self.local, self.remote) - self.cdist_type = core.CdistType(self.local.type_path, '__dump_environment') - self.cdist_object = core.CdistObject(self.cdist_type, self.local.object_path, 'whatever', self.local.object_marker_name) + self.cdist_type = core.CdistType(self.local.type_path, + '__dump_environment') + self.cdist_object = core.CdistObject( + self.cdist_type, self.local.object_path, 'whatever', + self.local.object_marker_name) self.cdist_object.create() def tearDown(self): @@ -73,42 +80,66 @@ class CodeTestCase(test.CdistTestCase): output_dict = {} for line in output_string.split('\n'): if line: - junk,value = line.split(': ') + junk, value = line.split(': ') key = junk.split(' ')[1] output_dict[key] = value - self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__target_host'], + self.local.target_host[0]) + self.assertEqual(output_dict['__target_hostname'], + self.local.target_host[1]) + self.assertEqual(output_dict['__target_fqdn'], + self.local.target_host[2]) self.assertEqual(output_dict['__global'], self.local.base_path) self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path) - self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) - self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) + self.assertEqual(output_dict['__object'], + self.cdist_object.absolute_path) + self.assertEqual(output_dict['__object_id'], + self.cdist_object.object_id) self.assertEqual(output_dict['__object_name'], self.cdist_object.name) + self.assertEqual(output_dict['__files'], self.local.files_path) def test_run_gencode_remote_environment(self): output_string = self.code.run_gencode_remote(self.cdist_object) output_dict = {} for line in output_string.split('\n'): if line: - junk,value = line.split(': ') + junk, value = line.split(': ') key = junk.split(' ')[1] output_dict[key] = value - self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__target_host'], + self.local.target_host[0]) + self.assertEqual(output_dict['__target_hostname'], + self.local.target_host[1]) + self.assertEqual(output_dict['__target_fqdn'], + self.local.target_host[2]) self.assertEqual(output_dict['__global'], self.local.base_path) self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path) - self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) - self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) + self.assertEqual(output_dict['__object'], + self.cdist_object.absolute_path) + self.assertEqual(output_dict['__object_id'], + self.cdist_object.object_id) self.assertEqual(output_dict['__object_name'], self.cdist_object.name) + self.assertEqual(output_dict['__files'], self.local.files_path) def test_transfer_code_remote(self): - self.cdist_object.code_remote = self.code.run_gencode_remote(self.cdist_object) + self.cdist_object.code_remote = self.code.run_gencode_remote( + self.cdist_object) self.code.transfer_code_remote(self.cdist_object) - destination = os.path.join(self.remote.object_path, self.cdist_object.code_remote_path) + destination = os.path.join(self.remote.object_path, + self.cdist_object.code_remote_path) self.assertTrue(os.path.isfile(destination)) def test_run_code_local(self): - self.cdist_object.code_local = self.code.run_gencode_local(self.cdist_object) + self.cdist_object.code_local = self.code.run_gencode_local( + self.cdist_object) self.code.run_code_local(self.cdist_object) def test_run_code_remote_environment(self): - self.cdist_object.code_remote = self.code.run_gencode_remote(self.cdist_object) + self.cdist_object.code_remote = self.code.run_gencode_remote( + self.cdist_object) self.code.transfer_code_remote(self.cdist_object) self.code.run_code_remote(self.cdist_object) + +if __name__ == '__main__': + import unittest + unittest.main() diff --git a/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local b/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local index 771894fb..7fa70342 100755 --- a/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local +++ b/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local @@ -1,8 +1,11 @@ #!/bin/sh echo "echo __target_host: $__target_host" +echo "echo __target_hostname: $__target_hostname" +echo "echo __target_fqdn: $__target_fqdn" echo "echo __global: $__global" echo "echo __type: $__type" echo "echo __object: $__object" echo "echo __object_id: $__object_id" echo "echo __object_name: $__object_name" +echo "echo __files: $__files" diff --git a/cdist/test/config/__init__.py b/cdist/test/config/__init__.py index a36567de..db753f41 100644 --- a/cdist/test/config/__init__.py +++ b/cdist/test/config/__init__.py @@ -44,6 +44,7 @@ expected_object_names = sorted([ '__second/on-the', '__third/moon']) + class ConfigRunTestCase(test.CdistTestCase): def setUp(self): @@ -54,10 +55,13 @@ class ConfigRunTestCase(test.CdistTestCase): self.temp_dir = self.mkdtemp() self.local_dir = os.path.join(self.temp_dir, "local") - os.mkdir(self.local_dir) + self.hostdir = cdist.str_hash(self.target_host[0]) + self.host_base_path = os.path.join(self.local_dir, self.hostdir) + os.makedirs(self.host_base_path) self.local = cdist.exec.local.Local( target_host=self.target_host, - base_path=self.local_dir) + base_root_path=self.host_base_path, + host_dir_name=self.hostdir) # Setup test objects self.object_base_path = op.join(self.temp_dir, 'object') @@ -65,8 +69,11 @@ class ConfigRunTestCase(test.CdistTestCase): self.objects = [] for cdist_object_name in expected_object_names: cdist_type, cdist_object_id = cdist_object_name.split("/", 1) - cdist_object = core.CdistObject(core.CdistType(type_base_path, cdist_type), self.object_base_path, - self.local.object_marker_name, cdist_object_id) + cdist_object = core.CdistObject(core.CdistType(type_base_path, + cdist_type), + self.object_base_path, + self.local.object_marker_name, + cdist_object_id) cdist_object.create() self.objects.append(cdist_object) @@ -81,8 +88,8 @@ class ConfigRunTestCase(test.CdistTestCase): remote_exec=self.remote_exec, base_path=self.remote_dir) - self.local.object_path = self.object_base_path - self.local.type_path = type_base_path + self.local.object_path = self.object_base_path + self.local.type_path = type_base_path self.config = cdist.config.Config(self.local, self.remote) @@ -95,14 +102,14 @@ class ConfigRunTestCase(test.CdistTestCase): shutil.rmtree(self.temp_dir) def test_dependency_resolution(self): - first = self.object_index['__first/man'] - second = self.object_index['__second/on-the'] - third = self.object_index['__third/moon'] + first = self.object_index['__first/man'] + second = self.object_index['__second/on-the'] + third = self.object_index['__third/moon'] first.requirements = [second.name] second.requirements = [third.name] - # First run: + # First run: # solves first and maybe second (depending on the order in the set) self.config.iterate_once() self.assertTrue(third.state == third.STATE_DONE) @@ -110,11 +117,11 @@ class ConfigRunTestCase(test.CdistTestCase): self.config.iterate_once() self.assertTrue(second.state == second.STATE_DONE) - try: self.config.iterate_once() except cdist.Error: - # Allow failing, because the third run may or may not be unecessary already, + # Allow failing, because the third run may or may not be + # unecessary already, # depending on the order of the objects pass self.assertTrue(first.state == first.STATE_DONE) @@ -123,8 +130,8 @@ class ConfigRunTestCase(test.CdistTestCase): """Ensure an exception is thrown for unresolvable depedencies""" # Create to objects depending on each other - no solution possible - first = self.object_index['__first/man'] - second = self.object_index['__second/on-the'] + first = self.object_index['__first/man'] + second = self.object_index['__second/on-the'] first.requirements = [second.name] second.requirements = [first.name] @@ -153,21 +160,23 @@ class ConfigRunTestCase(test.CdistTestCase): with self.assertRaises(cdist.core.cdist_object.MissingObjectIdError): self.config.iterate_until_finished() - def test_dryrun(self): """Test if the dryrun option is working like expected""" drylocal = cdist.exec.local.Local( target_host=self.target_host, - base_path=self.local_dir, - #exec_path can not derivated from sys.argv in case of unittest ... - exec_path=os.path.abspath(os.path.join(my_dir,'../../../scripts/cdist')), - initial_manifest=os.path.join(fixtures, 'manifest/dryrun_manifest'), - add_conf_dirs=[ fixtures ] ) + base_root_path=self.host_base_path, + host_dir_name=self.hostdir, + # exec_path can not derivated from sys.argv in case of unittest + exec_path=os.path.abspath(os.path.join( + my_dir, '../../../scripts/cdist')), + initial_manifest=os.path.join(fixtures, + 'manifest/dryrun_manifest'), + add_conf_dirs=[fixtures]) dryrun = cdist.config.Config(drylocal, self.remote, dry_run=True) dryrun.run() # if we are here, dryrun works like expected - + # Currently the resolving code will simply detect that this object does # not exist. It should probably check if the type is a singleton as well @@ -179,3 +188,8 @@ class ConfigRunTestCase(test.CdistTestCase): # first.requirements = ['__singleton_test/foo'] # with self.assertRaises(cdist.core.?????): # self.config.iterate_until_finished() + +if __name__ == "__main__": + import unittest + + unittest.main() diff --git a/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py index f90e5320..4fd0ed40 100644 --- a/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -40,6 +40,7 @@ my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') conf_dir = op.join(fixtures, 'conf') + class EmulatorTestCase(test.CdistTestCase): def setUp(self): @@ -47,10 +48,13 @@ class EmulatorTestCase(test.CdistTestCase): handle, self.script = self.mkstemp(dir=self.temp_dir) os.close(handle) base_path = self.temp_dir + hostdir = cdist.str_hash(self.target_host[0]) + host_base_path = os.path.join(base_path, hostdir) self.local = local.Local( target_host=self.target_host, - base_path=base_path, + base_root_path=host_base_path, + host_dir_name=hostdir, exec_path=test.cdist_exec_path, add_conf_dirs=[conf_dir]) self.local.create_files_dirs() @@ -68,7 +72,8 @@ class EmulatorTestCase(test.CdistTestCase): def test_nonexistent_type_exec(self): argv = ['__does-not-exist'] - self.assertRaises(core.cdist_type.NoSuchTypeError, emulator.Emulator, argv, env=self.env) + self.assertRaises(core.cdist_type.NoSuchTypeError, emulator.Emulator, + argv, env=self.env) def test_nonexistent_type_requirement(self): argv = ['__file', '/tmp/foobar'] @@ -78,7 +83,8 @@ class EmulatorTestCase(test.CdistTestCase): def test_illegal_object_id_requirement(self): argv = ['__file', '/tmp/foobar'] - self.env['require'] = "__file/bad/id/with/%s/inside" % self.local.object_marker_name + self.env['require'] = ( + "__file/bad/id/with/%s/inside") % self.local.object_marker_name emu = emulator.Emulator(argv, env=self.env) self.assertRaises(core.IllegalObjectIdError, emu.run) @@ -123,10 +129,14 @@ class EmulatorTestCase(test.CdistTestCase): emu.run() # now load the objects and verify the require parameter of the objects cdist_type = core.CdistType(self.local.type_path, '__planet') - erde_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, 'erde') - mars_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, 'mars') + erde_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, 'erde') + mars_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, 'mars') cdist_type = core.CdistType(self.local.type_path, '__file') - file_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, '/tmp/cdisttest') + file_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, + '/tmp/cdisttest') # now test the recorded requirements self.assertTrue(len(erde_object.requirements) == 0) self.assertEqual(list(mars_object.requirements), ['__planet/erde']) @@ -134,15 +144,110 @@ class EmulatorTestCase(test.CdistTestCase): # if we get here all is fine +class EmulatorConflictingRequirementsTestCase(test.CdistTestCase): + + def setUp(self): + self.temp_dir = self.mkdtemp() + handle, self.script = self.mkstemp(dir=self.temp_dir) + os.close(handle) + base_path = self.temp_dir + hostdir = cdist.str_hash(self.target_host[0]) + host_base_path = os.path.join(base_path, hostdir) + + self.local = local.Local( + target_host=self.target_host, + base_root_path=host_base_path, + host_dir_name=hostdir, + exec_path=test.cdist_exec_path, + add_conf_dirs=[conf_dir]) + self.local.create_files_dirs() + + self.manifest = core.Manifest(self.target_host, self.local) + self.env = self.manifest.env_initial_manifest(self.script) + self.env['__cdist_object_marker'] = self.local.object_marker_name + + def tearDown(self): + shutil.rmtree(self.temp_dir) + + def test_object_different_requirements_req_none(self): + argv = ['__directory', 'spam'] + emu = emulator.Emulator(argv, env=self.env) + emu.run() + argv = ['__file', 'eggs'] + self.env['require'] = '__directory/spam' + emu = emulator.Emulator(argv, env=self.env) + emu.run() + argv = ['__file', 'eggs'] + if 'require' in self.env: + del self.env['require'] + emu = emulator.Emulator(argv, env=self.env) + emu.run() + + cdist_type = core.CdistType(self.local.type_path, '__file') + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, 'eggs') + reqs = set(('__directory/spam',)) + self.assertEqual(reqs, set(cdist_object.requirements)) + + def test_object_different_requirements_none_req(self): + argv = ['__directory', 'spam'] + emu = emulator.Emulator(argv, env=self.env) + emu.run() + argv = ['__file', 'eggs'] + if 'require' in self.env: + del self.env['require'] + emu = emulator.Emulator(argv, env=self.env) + emu.run() + argv = ['__file', 'eggs'] + self.env['require'] = '__directory/spam' + emu = emulator.Emulator(argv, env=self.env) + emu.run() + + cdist_type = core.CdistType(self.local.type_path, '__file') + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, 'eggs') + reqs = set(('__directory/spam',)) + self.assertEqual(reqs, set(cdist_object.requirements)) + + def test_object_different_requirements(self): + argv = ['__directory', 'spam'] + emu = emulator.Emulator(argv, env=self.env) + emu.run() + argv = ['__directory', 'spameggs'] + emu = emulator.Emulator(argv, env=self.env) + emu.run() + + argv = ['__file', 'eggs'] + if 'require' in self.env: + del self.env['require'] + self.env['require'] = '__directory/spam' + emu = emulator.Emulator(argv, env=self.env) + emu.run() + + argv = ['__file', 'eggs'] + self.env['require'] = '__directory/spameggs' + emu = emulator.Emulator(argv, env=self.env) + emu.run() + + cdist_type = core.CdistType(self.local.type_path, '__file') + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, 'eggs') + reqs = set(('__directory/spam', '__directory/spameggs',)) + self.assertEqual(reqs, set(cdist_object.requirements)) + + class AutoRequireEmulatorTestCase(test.CdistTestCase): def setUp(self): self.temp_dir = self.mkdtemp() base_path = os.path.join(self.temp_dir, "out") + hostdir = cdist.str_hash(self.target_host[0]) + host_base_path = os.path.join(base_path, hostdir) self.local = local.Local( target_host=self.target_host, - base_path=base_path, + base_root_path=host_base_path, + host_dir_name=hostdir, exec_path=test.cdist_exec_path, add_conf_dirs=[conf_dir]) self.local.create_files_dirs() @@ -155,11 +260,13 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase): initial_manifest = os.path.join(self.local.manifest_path, "init") self.manifest.run_initial_manifest(initial_manifest) cdist_type = core.CdistType(self.local.type_path, '__saturn') - cdist_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, '') + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, '') self.manifest.run_type_manifest(cdist_object) expected = ['__planet/Saturn', '__moon/Prometheus'] self.assertEqual(sorted(cdist_object.autorequire), sorted(expected)) + class OverrideTestCase(test.CdistTestCase): def setUp(self): @@ -167,10 +274,13 @@ class OverrideTestCase(test.CdistTestCase): handle, self.script = self.mkstemp(dir=self.temp_dir) os.close(handle) base_path = self.temp_dir + hostdir = cdist.str_hash(self.target_host[0]) + host_base_path = os.path.join(base_path, hostdir) self.local = local.Local( target_host=self.target_host, - base_path=base_path, + base_root_path=host_base_path, + host_dir_name=hostdir, exec_path=test.cdist_exec_path, add_conf_dirs=[conf_dir]) self.local.create_files_dirs() @@ -186,7 +296,7 @@ class OverrideTestCase(test.CdistTestCase): argv = ['__file', '/tmp/foobar'] emu = emulator.Emulator(argv, env=self.env) emu.run() - argv = ['__file', '/tmp/foobar','--mode','404'] + argv = ['__file', '/tmp/foobar', '--mode', '404'] emu = emulator.Emulator(argv, env=self.env) self.assertRaises(cdist.Error, emu.run) @@ -194,7 +304,7 @@ class OverrideTestCase(test.CdistTestCase): argv = ['__file', '/tmp/foobar'] emu = emulator.Emulator(argv, env=self.env) emu.run() - argv = ['__file', '/tmp/foobar','--mode','404'] + argv = ['__file', '/tmp/foobar', '--mode', '404'] self.env['CDIST_OVERRIDE'] = 'on' emu = emulator.Emulator(argv, env=self.env) emu.run() @@ -205,12 +315,15 @@ class ArgumentsTestCase(test.CdistTestCase): def setUp(self): self.temp_dir = self.mkdtemp() base_path = self.temp_dir + hostdir = cdist.str_hash(self.target_host[0]) + host_base_path = os.path.join(base_path, hostdir) handle, self.script = self.mkstemp(dir=self.temp_dir) os.close(handle) self.local = local.Local( target_host=self.target_host, - base_path=base_path, + base_root_path=host_base_path, + host_dir_name=hostdir, exec_path=test.cdist_exec_path, add_conf_dirs=[conf_dir]) self.local.create_files_dirs() @@ -223,13 +336,17 @@ class ArgumentsTestCase(test.CdistTestCase): shutil.rmtree(self.temp_dir) def test_arguments_with_dashes(self): - argv = ['__arguments_with_dashes', 'some-id', '--with-dash', 'some value'] + argv = ['__arguments_with_dashes', 'some-id', '--with-dash', + 'some value'] os.environ.update(self.env) emu = emulator.Emulator(argv) emu.run() - cdist_type = core.CdistType(self.local.type_path, '__arguments_with_dashes') - cdist_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, 'some-id') + cdist_type = core.CdistType(self.local.type_path, + '__arguments_with_dashes') + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, + 'some-id') self.assertTrue('with-dash' in cdist_object.parameters) def test_boolean(self): @@ -241,7 +358,9 @@ class ArgumentsTestCase(test.CdistTestCase): emu.run() cdist_type = core.CdistType(self.local.type_path, type_name) - cdist_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, object_id) + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, + object_id) self.assertTrue('boolean1' in cdist_object.parameters) self.assertFalse('boolean2' in cdist_object.parameters) # empty file -> True @@ -253,13 +372,16 @@ class ArgumentsTestCase(test.CdistTestCase): type_name = '__arguments_required' object_id = 'some-id' value = 'some value' - argv = [type_name, object_id, '--required1', value, '--required2', value] + argv = [type_name, object_id, '--required1', value, + '--required2', value] os.environ.update(self.env) emu = emulator.Emulator(argv) emu.run() cdist_type = core.CdistType(self.local.type_path, type_name) - cdist_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, object_id) + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, + object_id) self.assertTrue('required1' in cdist_object.parameters) self.assertTrue('required2' in cdist_object.parameters) self.assertEqual(cdist_object.parameters['required1'], value) @@ -285,7 +407,9 @@ class ArgumentsTestCase(test.CdistTestCase): emu.run() cdist_type = core.CdistType(self.local.type_path, type_name) - cdist_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, object_id) + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, + object_id) self.assertTrue('optional1' in cdist_object.parameters) self.assertFalse('optional2' in cdist_object.parameters) self.assertEqual(cdist_object.parameters['optional1'], value) @@ -300,7 +424,9 @@ class ArgumentsTestCase(test.CdistTestCase): emu.run() cdist_type = core.CdistType(self.local.type_path, type_name) - cdist_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, object_id) + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, + object_id) self.assertTrue('optional1' in cdist_object.parameters) self.assertFalse('optional2' in cdist_object.parameters) self.assertEqual(cdist_object.parameters['optional1'], value) @@ -314,10 +440,13 @@ class StdinTestCase(test.CdistTestCase): self.temp_dir = self.mkdtemp() base_path = os.path.join(self.temp_dir, "out") + hostdir = cdist.str_hash(self.target_host[0]) + host_base_path = os.path.join(base_path, hostdir) self.local = local.Local( target_host=self.target_host, - base_path=base_path, + base_root_path=host_base_path, + host_dir_name=hostdir, exec_path=test.cdist_exec_path, add_conf_dirs=[conf_dir]) @@ -352,7 +481,9 @@ class StdinTestCase(test.CdistTestCase): ###################################################################### # Create path where stdin should reside at cdist_type = core.CdistType(self.local.type_path, type_name) - cdist_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, object_id) + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, + object_id) stdin_out_path = os.path.join(cdist_object.absolute_path, 'stdin') ###################################################################### @@ -366,3 +497,8 @@ class StdinTestCase(test.CdistTestCase): stdin_saved_by_emulator = fd.read() self.assertEqual(random_string, stdin_saved_by_emulator) + + +if __name__ == '__main__': + import unittest + unittest.main() diff --git a/cdist/test/exec/fixtures/conf/type/__cdist_test_type/gencode-local b/cdist/test/exec/fixtures/conf/type/__cdist_test_type/gencode-local index 771894fb..3d568ad3 100755 --- a/cdist/test/exec/fixtures/conf/type/__cdist_test_type/gencode-local +++ b/cdist/test/exec/fixtures/conf/type/__cdist_test_type/gencode-local @@ -1,6 +1,8 @@ #!/bin/sh echo "echo __target_host: $__target_host" +echo "echo __target_hostname: $__target_hostname" +echo "echo __target_fqdn: $__target_fqdn" echo "echo __global: $__global" echo "echo __type: $__type" echo "echo __object: $__object" diff --git a/cdist/test/exec/local.py b/cdist/test/exec/local.py index 12a0d47b..0efdfa0a 100644 --- a/cdist/test/exec/local.py +++ b/cdist/test/exec/local.py @@ -39,18 +39,26 @@ conf_dir = op.join(fixtures, "conf") bin_true = "true" bin_false = "false" + class LocalTestCase(test.CdistTestCase): def setUp(self): - target_host = 'localhost' + target_host = ( + 'localhost', + 'localhost', + 'localhost', + ) self.temp_dir = self.mkdtemp() self.out_parent_path = self.temp_dir - self.out_path = op.join(self.out_parent_path, target_host) + self.hostdir = cdist.str_hash(target_host[0]) + self.host_base_path = op.join(self.out_parent_path, self.hostdir) + self.out_path = op.join(self.host_base_path, "data") self.local = local.Local( target_host=target_host, - base_path=self.out_parent_path, + base_root_path=self.host_base_path, + host_dir_name=self.hostdir, exec_path=test.cdist_exec_path ) @@ -59,47 +67,61 @@ class LocalTestCase(test.CdistTestCase): def tearDown(self): shutil.rmtree(self.temp_dir) - ### test api + # test api def test_cache_path(self): - self.assertEqual(self.local.cache_path, os.path.join(self.home_dir, "cache")) + self.assertEqual(self.local.cache_path, + os.path.join(self.home_dir, "cache")) def test_conf_path(self): - self.assertEqual(self.local.conf_path, os.path.join(self.out_path, "conf")) + self.assertEqual(self.local.conf_path, + os.path.join(self.out_path, "conf")) def test_out_path(self): self.assertEqual(self.local.base_path, self.out_path) def test_bin_path(self): - self.assertEqual(self.local.bin_path, os.path.join(self.out_path, "bin")) + self.assertEqual(self.local.bin_path, + os.path.join(self.out_path, "bin")) def test_global_explorer_out_path(self): - self.assertEqual(self.local.global_explorer_out_path, os.path.join(self.out_path, "explorer")) + self.assertEqual(self.local.global_explorer_out_path, + os.path.join(self.out_path, "explorer")) def test_object_path(self): - self.assertEqual(self.local.object_path, os.path.join(self.out_path, "object")) + self.assertEqual(self.local.object_path, + os.path.join(self.out_path, "object")) - ### /test api + # /test api - ### test internal implementation + # test internal implementation def test_global_explorer_path(self): - self.assertEqual(self.local.global_explorer_path, os.path.join(self.out_path, "conf", "explorer")) + self.assertEqual(self.local.global_explorer_path, + os.path.join(self.out_path, "conf", "explorer")) def test_manifest_path(self): - self.assertEqual(self.local.manifest_path, os.path.join(self.out_path, "conf", "manifest")) + self.assertEqual(self.local.manifest_path, + os.path.join(self.out_path, "conf", "manifest")) def test_type_path(self): - self.assertEqual(self.local.type_path, os.path.join(self.out_path, "conf", "type")) + self.assertEqual(self.local.type_path, + os.path.join(self.out_path, "conf", "type")) def test_dist_conf_dir_linking(self): - """Ensure that links are correctly created for types included in distribution""" + """Ensure that links are correctly created for types included + in distribution""" - test_type="__file" + test_type = "__file" link_test_local = local.Local( - target_host='localhost', - base_path=self.out_parent_path, + target_host=( + 'localhost', + 'localhost', + 'localhost', + ), + base_root_path=self.host_base_path, + host_dir_name=self.hostdir, exec_path=test.cdist_exec_path, ) @@ -110,13 +132,19 @@ class LocalTestCase(test.CdistTestCase): self.assertTrue(os.path.isdir(our_type_dir)) def test_added_conf_dir_linking(self): - """Ensure that links are correctly created for types in added conf directories""" + """Ensure that links are correctly created for types in added conf + directories""" - test_type="__cdist_test_type" + test_type = "__cdist_test_type" link_test_local = local.Local( - target_host='localhost', - base_path=self.out_parent_path, + target_host=( + 'localhost', + 'localhost', + 'localhost', + ), + base_root_path=self.host_base_path, + host_dir_name=self.hostdir, exec_path=test.cdist_exec_path, add_conf_dirs=[conf_dir] ) @@ -128,15 +156,21 @@ class LocalTestCase(test.CdistTestCase): self.assertTrue(os.path.isdir(our_type_dir)) def test_conf_dir_from_path_linking(self): - """Ensure that links are correctly created for types in conf directories which are defined in CDIST_PATH""" + """Ensure that links are correctly created for types in conf + directories which are defined in CDIST_PATH""" - test_type="__cdist_test_type" + test_type = "__cdist_test_type" os.environ['CDIST_PATH'] = conf_dir link_test_local = local.Local( - target_host='localhost', - base_path=self.out_parent_path, + target_host=( + 'localhost', + 'localhost', + 'localhost', + ), + base_root_path=self.host_base_path, + host_dir_name=self.hostdir, exec_path=test.cdist_exec_path, ) @@ -146,7 +180,7 @@ class LocalTestCase(test.CdistTestCase): self.assertTrue(os.path.isdir(our_type_dir)) - ### other tests + # other tests def test_run_success(self): self.local.run([bin_true]) @@ -170,7 +204,8 @@ class LocalTestCase(test.CdistTestCase): handle, script = self.mkstemp(dir=self.temp_dir) with os.fdopen(handle, "w") as fd: fd.writelines(["#!/bin/sh\n", "echo foobar"]) - self.assertEqual(self.local.run_script(script, return_output=True), "foobar\n") + self.assertEqual(self.local.run_script(script, return_output=True), + "foobar\n") def test_mkdir(self): temp_dir = self.mkdtemp(dir=self.temp_dir) diff --git a/cdist/test/exec/remote.py b/cdist/test/exec/remote.py index 89e9dbc8..45dabb18 100644 --- a/cdist/test/exec/remote.py +++ b/cdist/test/exec/remote.py @@ -24,6 +24,7 @@ import getpass import shutil import string import random +import multiprocessing import cdist from cdist import test @@ -34,55 +35,67 @@ class RemoteTestCase(test.CdistTestCase): def setUp(self): self.temp_dir = self.mkdtemp() - self.target_host = 'localhost' + self.target_host = ( + 'localhost', + 'localhost', + 'localhost', + ) self.base_path = self.temp_dir user = getpass.getuser() remote_exec = "ssh -o User=%s -q" % user remote_copy = "scp -o User=%s -q" % user - self.remote = remote.Remote(self.target_host, base_path=self.base_path, remote_exec=remote_exec, remote_copy=remote_copy) + self.remote = remote.Remote(self.target_host, base_path=self.base_path, + remote_exec=remote_exec, + remote_copy=remote_copy) def tearDown(self): shutil.rmtree(self.temp_dir) - ### test api + # test api def test_conf_path(self): - self.assertEqual(self.remote.conf_path, os.path.join(self.base_path, "conf")) + self.assertEqual(self.remote.conf_path, + os.path.join(self.base_path, "conf")) def test_object_path(self): - self.assertEqual(self.remote.object_path, os.path.join(self.base_path, "object")) + self.assertEqual(self.remote.object_path, + os.path.join(self.base_path, "object")) def test_type_path(self): - self.assertEqual(self.remote.type_path, os.path.join(self.base_path, "conf", "type")) + self.assertEqual(self.remote.type_path, + os.path.join(self.base_path, "conf", "type")) def test_global_explorer_path(self): - self.assertEqual(self.remote.global_explorer_path, os.path.join(self.base_path, "conf", "explorer")) + self.assertEqual(self.remote.global_explorer_path, + os.path.join(self.base_path, "conf", "explorer")) - ### /test api + # /test api def test_run_success(self): - self.remote.run(['/bin/true']) + self.remote.run(['true']) def test_run_fail(self): - self.assertRaises(cdist.Error, self.remote.run, ['/bin/false']) + self.assertRaises(cdist.Error, self.remote.run, ['false']) def test_run_script_success(self): handle, script = self.mkstemp(dir=self.temp_dir) with os.fdopen(handle, "w") as fd: - fd.writelines(["#!/bin/sh\n", "/bin/true"]) + fd.writelines(["#!/bin/sh\n", "true"]) self.remote.run_script(script) def test_run_script_fail(self): handle, script = self.mkstemp(dir=self.temp_dir) with os.fdopen(handle, "w") as fd: - fd.writelines(["#!/bin/sh\n", "/bin/false"]) - self.assertRaises(remote.RemoteScriptError, self.remote.run_script, script) + fd.writelines(["#!/bin/sh\n", "false"]) + self.assertRaises(cdist.Error, self.remote.run_script, + script) def test_run_script_get_output(self): handle, script = self.mkstemp(dir=self.temp_dir) with os.fdopen(handle, "w") as fd: fd.writelines(["#!/bin/sh\n", "echo foobar"]) - self.assertEqual(self.remote.run_script(script, return_output=True), "foobar\n") + self.assertEqual(self.remote.run_script(script, return_output=True), + "foobar\n") def test_mkdir(self): temp_dir = self.mkdtemp(dir=self.temp_dir) @@ -113,8 +126,24 @@ class RemoteTestCase(test.CdistTestCase): # test if the payload file is in the target directory self.assertTrue(os.path.isfile(os.path.join(target, source_file_name))) - def test_create_directories(self): - self.remote.create_directories() + def test_transfer_dir_parallel(self): + source = self.mkdtemp(dir=self.temp_dir) + # put 8 files in the directory as payload + filenames = [] + for x in range(8): + handle, source_file = self.mkstemp(dir=source) + os.close(handle) + source_file_name = os.path.split(source_file)[-1] + filenames.append(source_file_name) + target = self.mkdtemp(dir=self.temp_dir) + self.remote.transfer_dir_parallel(source, target, + multiprocessing.cpu_count()) + # test if the payload files are in the target directory + for filename in filenames: + self.assertTrue(os.path.isfile(os.path.join(target, filename))) + + def test_create_files_dirs(self): + self.remote.create_files_dirs() self.assertTrue(os.path.isdir(self.remote.base_path)) self.assertTrue(os.path.isdir(self.remote.conf_path)) @@ -125,8 +154,10 @@ class RemoteTestCase(test.CdistTestCase): os.chmod(remote_exec_path, 0o755) remote_exec = remote_exec_path remote_copy = "echo" - r = remote.Remote(self.target_host, base_path=self.base_path, remote_exec=remote_exec, remote_copy=remote_copy) - self.assertEqual(r.run('/bin/true', return_output=True), "%s\n" % self.target_host) + r = remote.Remote(self.target_host, base_path=self.base_path, + remote_exec=remote_exec, remote_copy=remote_copy) + self.assertEqual(r.run('true', return_output=True), + "%s\n" % self.target_host[0]) def test_run_script_target_host_in_env(self): handle, remote_exec_path = self.mkstemp(dir=self.temp_dir) @@ -135,16 +166,21 @@ class RemoteTestCase(test.CdistTestCase): os.chmod(remote_exec_path, 0o755) remote_exec = remote_exec_path remote_copy = "echo" - r = remote.Remote(self.target_host, base_path=self.base_path, remote_exec=remote_exec, remote_copy=remote_copy) + r = remote.Remote(self.target_host, base_path=self.base_path, + remote_exec=remote_exec, remote_copy=remote_copy) handle, script = self.mkstemp(dir=self.temp_dir) with os.fdopen(handle, "w") as fd: - fd.writelines(["#!/bin/sh\n", "/bin/true"]) - self.assertEqual(r.run_script(script, return_output=True), "%s\n" % self.target_host) + fd.writelines(["#!/bin/sh\n", "true"]) + self.assertEqual(r.run_script(script, return_output=True), + "%s\n" % self.target_host[0]) def test_run_script_with_env_target_host_in_env(self): handle, script = self.mkstemp(dir=self.temp_dir) with os.fdopen(handle, "w") as fd: - fd.writelines(["#!/bin/sh\n", 'if [ "$__object" ]; then echo $__object; else echo no_env; fi\n']) + fd.writelines([ + "#!/bin/sh\n", + ('if [ "$__object" ]; then echo $__object; ' + 'else echo no_env; fi\n')]) os.chmod(script, 0o755) handle, remote_exec_path = self.mkstemp(dir=self.temp_dir) with os.fdopen(handle, 'w') as fd: @@ -152,7 +188,8 @@ class RemoteTestCase(test.CdistTestCase): os.chmod(remote_exec_path, 0o755) remote_exec = remote_exec_path remote_copy = "echo" - r = remote.Remote(self.target_host, base_path=self.base_path, remote_exec=remote_exec, remote_copy=remote_copy) + r = remote.Remote(self.target_host, base_path=self.base_path, + remote_exec=remote_exec, remote_copy=remote_copy) output = r.run_script(script, return_output=True) self.assertEqual(output, "no_env\n") @@ -164,7 +201,8 @@ class RemoteTestCase(test.CdistTestCase): env = { '__object': 'test_object', } - r = remote.Remote(self.target_host, base_path=self.base_path, remote_exec=remote_exec, remote_copy=remote_copy) + r = remote.Remote(self.target_host, base_path=self.base_path, + remote_exec=remote_exec, remote_copy=remote_copy) output = r.run_script(script, env=env, return_output=True) self.assertEqual(output, "test_object\n") diff --git a/cdist/test/explorer/__init__.py b/cdist/test/explorer/__init__.py index 335d0e32..fc66020d 100644 --- a/cdist/test/explorer/__init__.py +++ b/cdist/test/explorer/__init__.py @@ -23,6 +23,7 @@ import os import shutil import getpass +import multiprocessing import cdist from cdist import core @@ -36,17 +37,21 @@ my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') conf_dir = op.join(fixtures, "conf") + class ExplorerClassTestCase(test.CdistTestCase): def setUp(self): - self.temp_dir = self.mkdtemp() - self.local_path = os.path.join(self.temp_dir, "local") - self.remote_base_path = os.path.join(self.temp_dir, "remote") + self.temp_dir = self.mkdtemp() + self.local_path = os.path.join(self.temp_dir, "local") + hostdir = cdist.str_hash(self.target_host[0]) + base_root_path = os.path.join(self.local_path, hostdir) + self.remote_base_path = os.path.join(self.temp_dir, "remote") os.makedirs(self.remote_base_path) self.local = local.Local( target_host=self.target_host, - base_path=self.local_path, + base_root_path=base_root_path, + host_dir_name=hostdir, exec_path=test.cdist_exec_path, add_conf_dirs=[conf_dir], ) @@ -54,15 +59,15 @@ class ExplorerClassTestCase(test.CdistTestCase): self.local.create_files_dirs() self.remote = remote.Remote( - target_host=self.target_host, + target_host=self.target_host, remote_exec=self.remote_exec, remote_copy=self.remote_copy, base_path=self.remote_base_path) self.remote.create_files_dirs() self.explorer = explorer.Explorer( - self.target_host, - self.local, + self.target_host, + self.local, self.remote) def tearDown(self): @@ -79,7 +84,8 @@ class ExplorerClassTestCase(test.CdistTestCase): self.explorer.transfer_global_explorers() source = self.local.global_explorer_path destination = self.remote.global_explorer_path - self.assertEqual(sorted(os.listdir(source)), sorted(os.listdir(destination))) + self.assertEqual(sorted(os.listdir(source)), + sorted(os.listdir(destination))) def test_run_global_explorer(self): """Checkt that running ONE global explorer works""" @@ -101,14 +107,16 @@ class ExplorerClassTestCase(test.CdistTestCase): def test_list_type_explorer_names(self): cdist_type = core.CdistType(self.local.type_path, '__test_type') expected = cdist_type.explorers - self.assertEqual(self.explorer.list_type_explorer_names(cdist_type), expected) + self.assertEqual(self.explorer.list_type_explorer_names(cdist_type), + expected) def test_transfer_type_explorers(self): """Test if transferring type explorers works""" cdist_type = core.CdistType(self.local.type_path, '__test_type') self.explorer.transfer_type_explorers(cdist_type) source = os.path.join(self.local.type_path, cdist_type.explorer_path) - destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) + destination = os.path.join(self.remote.type_path, + cdist_type.explorer_path) self.assertEqual(os.listdir(source), os.listdir(destination)) def test_transfer_type_explorers_only_once(self): @@ -116,7 +124,8 @@ class ExplorerClassTestCase(test.CdistTestCase): # first transfer self.explorer.transfer_type_explorers(cdist_type) source = os.path.join(self.local.type_path, cdist_type.explorer_path) - destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) + destination = os.path.join(self.remote.type_path, + cdist_type.explorer_path) self.assertEqual(os.listdir(source), os.listdir(destination)) # nuke destination folder content, but recreate directory shutil.rmtree(destination) @@ -127,24 +136,81 @@ class ExplorerClassTestCase(test.CdistTestCase): def test_transfer_object_parameters(self): cdist_type = core.CdistType(self.local.type_path, '__test_type') - cdist_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, 'whatever') + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, + 'whatever') cdist_object.create() - cdist_object.parameters = {'first': 'first value', 'second': 'second value'} + cdist_object.parameters = { + 'first': 'first value', + 'second': 'second value' + } self.explorer.transfer_object_parameters(cdist_object) - source = os.path.join(self.local.object_path, cdist_object.parameter_path) - destination = os.path.join(self.remote.object_path, cdist_object.parameter_path) - self.assertEqual(sorted(os.listdir(source)), sorted(os.listdir(destination))) + source = os.path.join(self.local.object_path, + cdist_object.parameter_path) + destination = os.path.join(self.remote.object_path, + cdist_object.parameter_path) + self.assertEqual(sorted(os.listdir(source)), + sorted(os.listdir(destination))) def test_run_type_explorer(self): cdist_type = core.CdistType(self.local.type_path, '__test_type') - cdist_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, 'whatever') + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, + 'whatever') self.explorer.transfer_type_explorers(cdist_type) output = self.explorer.run_type_explorer('world', cdist_object) self.assertEqual(output, 'hello\n') def test_run_type_explorers(self): cdist_type = core.CdistType(self.local.type_path, '__test_type') - cdist_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, 'whatever') + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, + 'whatever') cdist_object.create() self.explorer.run_type_explorers(cdist_object) self.assertEqual(cdist_object.explorers, {'world': 'hello'}) + + def test_jobs_parameter(self): + self.assertIsNone(self.explorer.jobs) + expl = explorer.Explorer( + self.target_host, + self.local, + self.remote, + jobs=8) + self.assertEqual(expl.jobs, 8) + + def test_transfer_global_explorers_parallel(self): + expl = explorer.Explorer( + self.target_host, + self.local, + self.remote, + jobs=multiprocessing.cpu_count()) + self.assertIsNotNone(expl.jobs) + + expl.transfer_global_explorers() + source = self.local.global_explorer_path + destination = self.remote.global_explorer_path + self.assertEqual(sorted(os.listdir(source)), + sorted(os.listdir(destination))) + + def test_run_parallel_jobs(self): + expl = explorer.Explorer( + self.target_host, + self.local, + self.remote, + jobs=multiprocessing.cpu_count()) + self.assertIsNotNone(expl.jobs) + out_path = self.mkdtemp() + + expl.run_global_explorers(out_path) + names = sorted(expl.list_global_explorer_names()) + output = sorted(os.listdir(out_path)) + + self.assertEqual(names, output) + shutil.rmtree(out_path) + + +if __name__ == '__main__': + import unittest + + unittest.main() diff --git a/cdist/test/manifest/__init__.py b/cdist/test/manifest/__init__.py index cc60c844..3e07c1a7 100644 --- a/cdist/test/manifest/__init__.py +++ b/cdist/test/manifest/__init__.py @@ -40,6 +40,7 @@ my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') conf_dir = op.join(fixtures, 'conf') + class ManifestTestCase(test.CdistTestCase): def setUp(self): @@ -48,22 +49,26 @@ class ManifestTestCase(test.CdistTestCase): self.temp_dir = self.mkdtemp() out_path = self.temp_dir + hostdir = cdist.str_hash(self.target_host[0]) + base_root_path = os.path.join(out_path, hostdir) self.local = local.Local( target_host=self.target_host, - base_path=out_path, - exec_path = cdist.test.cdist_exec_path, + base_root_path=base_root_path, + host_dir_name=hostdir, + exec_path=cdist.test.cdist_exec_path, add_conf_dirs=[conf_dir]) self.local.create_files_dirs() self.manifest = manifest.Manifest(self.target_host, self.local) - self.log = logging.getLogger(self.target_host) + self.log = logging.getLogger(self.target_host[0]) def tearDown(self): os.environ = self.orig_environ shutil.rmtree(self.temp_dir) def test_initial_manifest_environment(self): - initial_manifest = os.path.join(self.local.manifest_path, "dump_environment") + initial_manifest = os.path.join(self.local.manifest_path, + "dump_environment") handle, output_file = self.mkstemp(dir=self.temp_dir) os.close(handle) os.environ['__cdist_test_out'] = output_file @@ -74,17 +79,26 @@ class ManifestTestCase(test.CdistTestCase): output_dict = {} for line in output_string.split('\n'): if line: - key,value = line.split(': ') + key, value = line.split(': ') output_dict[key] = value self.assertTrue(output_dict['PATH'].startswith(self.local.bin_path)) - self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__target_host'], + self.local.target_host[0]) + self.assertEqual(output_dict['__target_hostname'], + self.local.target_host[1]) + self.assertEqual(output_dict['__target_fqdn'], + self.local.target_host[2]) self.assertEqual(output_dict['__global'], self.local.base_path) - self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_path) + self.assertEqual(output_dict['__cdist_type_base_path'], + self.local.type_path) self.assertEqual(output_dict['__manifest'], self.local.manifest_path) + self.assertEqual(output_dict['__files'], self.local.files_path) def test_type_manifest_environment(self): cdist_type = core.CdistType(self.local.type_path, '__dump_environment') - cdist_object = core.CdistObject(cdist_type, self.local.object_path, self.local.object_marker_name, 'whatever') + cdist_object = core.CdistObject(cdist_type, self.local.object_path, + self.local.object_marker_name, + 'whatever') handle, output_file = self.mkstemp(dir=self.temp_dir) os.close(handle) os.environ['__cdist_test_out'] = output_file @@ -95,16 +109,23 @@ class ManifestTestCase(test.CdistTestCase): output_dict = {} for line in output_string.split('\n'): if line: - key,value = line.split(': ') + key, value = line.split(': ') output_dict[key] = value self.assertTrue(output_dict['PATH'].startswith(self.local.bin_path)) - self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__target_host'], + self.local.target_host[0]) + self.assertEqual(output_dict['__target_hostname'], + self.local.target_host[1]) + self.assertEqual(output_dict['__target_fqdn'], + self.local.target_host[2]) self.assertEqual(output_dict['__global'], self.local.base_path) - self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_path) + self.assertEqual(output_dict['__cdist_type_base_path'], + self.local.type_path) self.assertEqual(output_dict['__type'], cdist_type.absolute_path) self.assertEqual(output_dict['__object'], cdist_object.absolute_path) self.assertEqual(output_dict['__object_id'], cdist_object.object_id) self.assertEqual(output_dict['__object_name'], cdist_object.name) + self.assertEqual(output_dict['__files'], self.local.files_path) def test_debug_env_setup(self): current_level = self.log.getEffectiveLevel() @@ -112,3 +133,8 @@ class ManifestTestCase(test.CdistTestCase): manifest = cdist.core.manifest.Manifest(self.target_host, self.local) self.assertTrue("__cdist_debug" in manifest.env) self.log.setLevel(current_level) + + +if __name__ == '__main__': + import unittest + unittest.main() diff --git a/cdist/test/manifest/fixtures/conf/manifest/dump_environment b/cdist/test/manifest/fixtures/conf/manifest/dump_environment index 7ce983ab..702145e2 100755 --- a/cdist/test/manifest/fixtures/conf/manifest/dump_environment +++ b/cdist/test/manifest/fixtures/conf/manifest/dump_environment @@ -3,7 +3,10 @@ cat > $__cdist_test_out << DONE PATH: $PATH __target_host: $__target_host +__target_hostname: $__target_hostname +__target_fqdn: $__target_fqdn __global: $__global __cdist_type_base_path: $__cdist_type_base_path __manifest: $__manifest +__files: $__files DONE diff --git a/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest b/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest index e135de35..757d07b5 100755 --- a/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest +++ b/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest @@ -3,6 +3,8 @@ cat > $__cdist_test_out << DONE PATH: $PATH __target_host: $__target_host +__target_hostname: $__target_hostname +__target_fqdn: $__target_fqdn __global: $__global __cdist_type_base_path: $__cdist_type_base_path __type: $__type @@ -10,4 +12,5 @@ __self: $__self __object: $__object __object_id: $__object_id __object_name: $__object_name +__files: $__files DONE diff --git a/cdist/test/message/__init__.py b/cdist/test/message/__init__.py index 653847f1..61cd5d97 100644 --- a/cdist/test/message/__init__.py +++ b/cdist/test/message/__init__.py @@ -25,14 +25,15 @@ import tempfile from cdist import test import cdist.message + class MessageTestCase(test.CdistTestCase): def setUp(self): - self.prefix="cdist-test" + self.prefix = "cdist-test" self.content = "A very short story" self.tempfile = tempfile.mkstemp()[1] self.message = cdist.message.Message(prefix=self.prefix, - messages=self.tempfile) + messages=self.tempfile) def tearDown(self): os.remove(self.tempfile) @@ -48,7 +49,6 @@ class MessageTestCase(test.CdistTestCase): self.assertIn('__messages_in', env) self.assertIn('__messages_out', env) - def test_copy_content(self): """ Ensure content copying is working diff --git a/cdist/util/fsproperty.py b/cdist/util/fsproperty.py index 98de09f8..e458fd9e 100644 --- a/cdist/util/fsproperty.py +++ b/cdist/util/fsproperty.py @@ -136,7 +136,7 @@ class DirectoryDict(collections.MutableMapping): with open(os.path.join(self.path, key), "w") as fd: if (not hasattr(value, 'strip') and (hasattr(value, '__getitem__') or - hasattr(value, '__iter__'))): + hasattr(value, '__iter__'))): # if it looks like a sequence and quacks like a sequence, # it is a sequence for v in value: @@ -175,14 +175,19 @@ class FileBasedProperty(object): """ :param path: string or callable - Abstract super class. Subclass and set the class member attribute_class accordingly. + Abstract super class. Subclass and set the class member + attribute_class accordingly. Usage with a sublcass: class Foo(object): - # note that the actual DirectoryDict is stored as __parameters on the instance - parameters = DirectoryDictProperty(lambda instance: os.path.join(instance.absolute_path, 'parameter')) - # note that the actual DirectoryDict is stored as __other_dict on the instance + # note that the actual DirectoryDict is stored as __parameters + # on the instance + parameters = DirectoryDictProperty( + lambda instance: os.path.join(instance.absolute_path, + 'parameter')) + # note that the actual DirectoryDict is stored as __other_dict + # on the instance other_dict = DirectoryDictProperty('/tmp/other_dict') def __init__(self): diff --git a/completions/bash/cdist-completion.bash b/completions/bash/cdist-completion.bash new file mode 100644 index 00000000..c756fca8 --- /dev/null +++ b/completions/bash/cdist-completion.bash @@ -0,0 +1,59 @@ +_cdist() +{ + local cur prev prevprev opts cmds projects + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + prevprev="${COMP_WORDS[COMP_CWORD-2]}" + opts="-h --help -d --debug -v --verbose -V --version" + cmds="banner shell config" + + case "${prevprev}" in + shell) + case "${prev}" in + -s|--shell) + shells=$(grep -v '^#' /etc/shells) + COMPREPLY=( $(compgen -W "${shells}" -- ${cur}) ) + return 0 + ;; + esac + ;; + esac + + case "${prev}" in + -*) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + banner) + opts="-h --help -d --debug -v --verbose" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + shell) + opts="-h --help -d --debug -v --verbose -s --shell" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + config) + opts="-h --help -d --debug -v --verbose -b --enable-beta \ + -c --conf-dir -f --file -i --initial-manifest -j --jobs \ + -n --dry-run -o --out-dir -p --parallel -s --sequential \ + --remote-copy --remote-exec" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + ;; + *) + ;; + esac + + if [[ ${cur} == -* ]]; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + COMPREPLY=( $(compgen -W "${cmds}" -- ${cur}) ) + return 0 +} + +complete -F _cdist cdist diff --git a/completions/zsh/_cdist b/completions/zsh/_cdist new file mode 100644 index 00000000..18fda0f0 --- /dev/null +++ b/completions/zsh/_cdist @@ -0,0 +1,48 @@ +#compdef cdist + +_cdist() +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments \ + '1: :->opts_cmds'\ + '*: :->opts' + + case $state in + opts_cmds) + _arguments '1:Options and commands:(banner config shell -h --help -d --debug -v --verbose -V --version)' + ;; + *) + case $words[2] in + -*) + opts=(-h --help -d --debug -v --verbose -V --version) + compadd "$@" -- $opts + ;; + banner) + opts=(-h --help -d --debug -v --verbose) + compadd "$@" -- $opts + ;; + shell) + case $words[3] in + -s|--shell) + shells=($(grep -v '^#' /etc/shells)) + compadd "$@" -- $shells + ;; + *) + opts=(-h --help -d --debug -v --verbose -s --shell) + compadd "$@" -- $opts + ;; + esac + ;; + config) + opts=(-h --help -d --debug -v --verbose -b --enable-beta -c --conf-dir -f --file -i --initial-manifest -j --jobs -n --dry-run -o --out-dir -p --parallel -s --sequential --remote-copy --remote-exec) + compadd "$@" -- $opts + ;; + *) + ;; + esac + esac +} + +_cdist "$@" diff --git a/docs/2016-06-06.org b/docs/2016-06-06.org new file mode 100644 index 00000000..8e3624a8 --- /dev/null +++ b/docs/2016-06-06.org @@ -0,0 +1,7 @@ +* Enhance cdist speed +** Start separate server with own option +** Reconfigure normal sshd with appropriate options +** Start various own daemons +** Use custom multiplexing protocol +** Support native Python code +*** Use manifest.py instead of manifest if available diff --git a/docs/changelog b/docs/changelog index dada1d90..dac0e205 100644 --- a/docs/changelog +++ b/docs/changelog @@ -1,6 +1,54 @@ Changelog --------- +next: + * New type: __firewalld_start: start/stop firewalld and/or enable/disable start on boot (Darko Poljak) + +4.3.1: 2016-08-22 + * Documentation: Spelling fixes (Darko Poljak) + * Type __filesystem: Spelling fixes (Dmitry Bogatov) + * Core: Add target_host file to cache since cache dir name can be hash (Darko Poljak) + * Core: Improve hostfile: support comments, skip empty lines (Darko Poljak) + +4.3.0: 2016-08-19 + * Documentation: Add Parallelization chapter (Darko Poljak) + * Core: Add -b, --enable-beta option for enabling beta functionalities (Darko Poljak) + * Core: Add -j, --jobs option for parallel execution and add parallel support for global explorers (currently in beta) (Darko Poljak) + * Core: Add derived env vars for target hostname and fqdn (Darko Poljak) + * New type: __keyboard: Set keyboard layout (Carlos Ortigoza) + * Documentation: Re-license types' man pages to GPLV3+ (Dmitry Bogatov, Darko Poljak) + * New type __filesystem: manage filesystems on devices (Daniel Heule) + * New type: __locale_system (Steven Armstrong, Carlos Ortigoza, Nico Schottelius) + * New type: __sysctl (Steven Armstrong) + +4.2.2: 2016-07-26 + * Core: Fix ssh ControlPath socket file error (Darko Poljak) + * Documentation: Update cdist man page and cdist-references (Darko Poljak) + * Documentation: Change cdist and cdist-type__pyvenv man page licenses to GPLv3+ (Darko Poljak) + * Documentation: Add FILES to cdist man page (Darko Poljak) + +4.2.1: 2016-07-18 + * Build: Fix signed release (Darko Poljak) + * Build: Fix building docs (Darko Poljak) + * Documentation: Fix man pages (Dmitry Bogatov) + * Documentation: Fix spellings (Dmitry Bogatov) + +4.2.0: 2016-07-16 + * Build: Make github signed release (Darko Poljak) + * Core: Fix hostdir: use hash instead of target host (Steven Armstrong) + * Core: pep8 (Darko Poljak) + * Documentation: Restructure and fix and improve docs and manpages (Darko Poljak) + * Core: Add files directory for static files (Darko Poljak) + * Custom: Add bash and zsh completions (Darko Poljak) + * Core: Improve error reporting for local and remote run command (Darko Poljak) + * New type: __jail_freebsd9: Handle jail management on FreeBSD <= 9.X (Jake Guffey) + * New type: __jail_freebsd10: Handle jail management on FreeBSD >= 10.0 (Jake Guffey) + * Type __jail: Dynamically select the correct jail subtype based on target host OS (Jake Guffey) + * Explorer __machine_type: add openvz and lxc + * Explorer __os __os_version: add scientific + * Type various: add scientific + * Explorer __machine_type: add virtualbox (Stu Zhao) + 4.1.0: 2016-05-27 * Documentation: Migrate to reStructuredText format and sphinx (Darko Poljak) * Core: Add -f option to read additional hosts from file/stdin (Darko Poljak) @@ -37,7 +85,7 @@ Changelog * Type __consul_agent: Use systemd for Debian 8 (Nico Schottelius) * Type __firewalld_rule: Ensure firewalld package is present (David Hürlimann) * Type __locale: Support CentOS (David Hürlimann) - * Type __staged_file: Fix comparision operator (Nico Schottelius) + * Type __staged_file: Fix comparison operator (Nico Schottelius) * Type __user_groups: Support old Linux versions (Daniel Heule) 3.1.12: 2015-03-19 @@ -123,7 +171,7 @@ Changelog * 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) @@ -224,7 +272,7 @@ Changelog 3.0.1: 2014-01-14 * Core: Copy only files, not directories (Steven Armstrong) * Core: Allow hostnames to start with / (Nico Schottelius) - * Type __line: Remove unecessary backslash escape (Nico Schottelius) + * Type __line: Remove unnecessary backslash escape (Nico Schottelius) * Type __directory: Add messaging support (Daniel Heule) * Type __directory: Do not generate code if mode is 0xxx (Daniel Heule) * Type __package: Fix typo in optional parameter ptype (Daniel Heule) @@ -285,7 +333,7 @@ Changelog * 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 @@ -363,7 +411,7 @@ Changelog * 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) @@ -427,7 +475,7 @@ Changelog * 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) @@ -459,7 +507,7 @@ Changelog * 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) @@ -468,7 +516,7 @@ Changelog * 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) @@ -513,7 +561,7 @@ Changelog (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! diff --git a/docs/legal/Benedikt_Koeppel.email b/docs/legal/Benedikt_Koeppel.email new file mode 100644 index 00000000..71fb39e9 --- /dev/null +++ b/docs/legal/Benedikt_Koeppel.email @@ -0,0 +1,185 @@ +From kaction Fri Jul 22 10:45:09 2016 +Return-path: +Envelope-to: KAction@gnu.org +Delivery-date: Fri, 22 Jul 2016 03:42:02 -0400 +Received: from fencepost.gnu.org [208.118.235.10] + by searing with POP3 (fetchmail-6.3.26) + for (single-drop); Fri, 22 Jul 2016 10:45:09 +0300 (MSK) +Received: from eggs.gnu.org ([2001:4830:134:3::10]:42146) + by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) + (Exim 4.82) + (envelope-from ) + id 1bQV5t-0001Ct-WA + for KAction@gnu.org; Fri, 22 Jul 2016 03:42:02 -0400 +Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) + (envelope-from ) + id 1bQV5r-000365-7C + for KAction@gnu.org; Fri, 22 Jul 2016 03:42:00 -0400 +X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org +X-Spam-Level: +X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,HTML_MESSAGE, + T_DKIM_INVALID autolearn=disabled version=3.3.2 +Received: from mail-oi0-x22f.google.com ([2607:f8b0:4003:c06::22f]:32858) + by eggs.gnu.org with esmtp (Exim 4.71) + (envelope-from ) + id 1bQV5q-00035k-WC + for KAction@gnu.org; Fri, 22 Jul 2016 03:41:59 -0400 +Received: by mail-oi0-x22f.google.com with SMTP id j185so152015483oih.0 + for ; Fri, 22 Jul 2016 00:41:58 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=benediktkoeppel.ch; s=google; + h=mime-version:in-reply-to:references:from:date:message-id:subject:to; + bh=blJePxf1Q0zVh1kUkaKI6tKoOKbPV9CkRqLrYN8tz+4=; + b=VSpfcDF2tO+mgrTfZGlhHaqbtfYNe/QCbkSH5jWx8CVaItTuu88pTzdHuNZPtYrlQO + KZ6R/7xJrqGdWnKFCUibDAKI1Pd9OAx+ahQsYT5M7eKQt+nM9cMxaiyBjTTPfpF9UVa/ + /anpDGs/Bs6Z/p6c3ElNJOunfeEeS7kscr+Do= +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:mime-version:in-reply-to:references:from:date + :message-id:subject:to; + bh=blJePxf1Q0zVh1kUkaKI6tKoOKbPV9CkRqLrYN8tz+4=; + b=azAT/E+JYRP5bGvTI3t2BGCNsNfHxSWK+NKOtaWNYo1lyATKw9nJsSl1g6osLeanFr + JjpwlqHUN7v18z5ETqI+kvrmUShZjrgzGYE+yQuq++E4z/0C2YOUf+XZkGFVACguKRNt + HmOufiJNmkB2fYsIRMw3R21hLnM5QkIBlujmwbdxrtWyQSQ8Mfr4+sOnfp1ltHKaixIe + phfyJ6K6qP2h71VShDZmopg8Sg9rz6DSHbFDy8Ka9UTT3DXC+sLpdKFAfSebl0Tgd0eE + r0JND1fwL3pDQCxo4uK+GVM3q/usdTgzBwLnlg22clN1eca2oqrqdQdLQzgGuWYOmQg9 + +tTg== +X-Gm-Message-State: AEkoous0GycxMsszEEqNZrxNJGSADUJISKsdXl4E3+tACC8xUjLdUl3dFeAjSq6rGKkDeLMDrrfVceDa+nAo8A== +X-Received: by 10.157.19.98 with SMTP id q31mr1158747otq.125.1469173317562; + Fri, 22 Jul 2016 00:41:57 -0700 (PDT) +MIME-Version: 1.0 +Received: by 10.202.93.135 with HTTP; Fri, 22 Jul 2016 00:41:38 -0700 (PDT) +In-Reply-To: +References: +From: =?UTF-8?Q?Benedikt_K=C3=B6ppel?= +Date: Fri, 22 Jul 2016 09:41:38 +0200 +Message-ID: +Subject: Re: cdist contribution relicensing +To: Dmitry Bogatov +Content-Type: multipart/alternative; boundary=001a1135177ab4fbf60538349102 +X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] +X-Received-From: 2607:f8b0:4003:c06::22f +X-UIDL: S)T"!() wrote: + +> +> Hello, dear contributors of cdist project! +> +> Recently we discovered licensing issue with your contribution. Namely, +> while most of code is GPLv3+, including some of code written by you, +> manpages (man.txt, now man.rst) are GPLv3 only licensed. +> +> On behalf of cdist releasers (Darko and Nico), I (another cdist +> contributor and cdist Debian maintainer) ask you to permit relicense +> your contribution from GPLv3 to GPLv3+. Without your permission, we +> would be stuck the day when GPLv4 come (hope it will never come, but +> still), or have to reimplement your contribution. +> +> If you agree, please respond with something like +> +> I, #name# <#email#> permit to relicense all my contribution to +> cdist project, source code https://github.com/ungleich/cdist +> to GNU General Public license, version 3 or (at your option) +> any later version, as published by Free Software Foundation. +> +> #day# Jule 2016 year. +> +> If possible, GPG-sign such email. Do not include anything else +> valuable in this email that you do not want to be stored forever in +> public. +> +> Dear contributors, when replying to this email, please do not send +> copy to other contributors -- save their inbox storage. +> +> Thank you in advance for one more contribution. +> +> -- +> Accept: text/plain, text/x-diff +> Accept-Language: eo,en,ru +> X-Web-Site: sinsekvu.github.io +> + +--001a1135177ab4fbf60538349102 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +

On Wed, Jul 20, 2016 at 5:09 PM, = +Dmitry Bogatov <KAction@gnu.org> wrote:

+Hello, dear contributors of cdist project!
+
+Recently we discovered licensing issue with your contribution. Namely,
+while most of code is GPLv3+, including some of code written by you,
+manpages (man.txt, now man.rst) are GPLv3 only licensed.
+
+On behalf of cdist releasers (Darko and Nico), I (another cdist
+contributor and cdist Debian maintainer) ask you to permit relicense
+your contribution from GPLv3 to GPLv3+. Without your permission, we
+would be stuck the day when GPLv4 come (hope it will never come, but
+still), or have to reimplement your contribution.
+
+If you agree, please respond with something like
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 I, #name# <#email#> permit to relicense a= +ll my contribution to
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cdist project, source code https://gith= +ub.com/ungleich/cdist
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 to GNU General Public license, version 3 or (at= + your option)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 any later version, as published by Free Softwar= +e Foundation.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 #day# Jule 2016 year.
+
+If possible, GPG-sign such email. Do not include anything else
+valuable in this email that you do not want to be stored forever in
+public.
+
+Dear contributors, when replying to this email, please do not send
+copy to other contributors -- save their inbox storage.
+
+Thank you in advance for one more contribution.
+
+--
+Accept: text/plain, text/x-diff
+Accept-Language: eo,en,ru
+X-Web-Site: sinsekvu.github.io
+

+ +--001a1135177ab4fbf60538349102-- + diff --git a/docs/legal/Chase_James.email b/docs/legal/Chase_James.email new file mode 100644 index 00000000..c57c62fd --- /dev/null +++ b/docs/legal/Chase_James.email @@ -0,0 +1,185 @@ +From kaction Wed Jul 20 21:30:05 2016 +Return-path: +Envelope-to: KAction@gnu.org +Delivery-date: Wed, 20 Jul 2016 14:25:53 -0400 +Received: from fencepost.gnu.org [208.118.235.10] + by searing with POP3 (fetchmail-6.3.26) + for (single-drop); Wed, 20 Jul 2016 21:30:05 +0300 (MSK) +Received: from eggs.gnu.org ([2001:4830:134:3::10]:48289) + by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) + (Exim 4.82) + (envelope-from ) + id 1bPwBt-00025s-Lu + for KAction@gnu.org; Wed, 20 Jul 2016 14:25:53 -0400 +Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) + (envelope-from ) + id 1bPwBr-0007tM-Uq + for KAction@gnu.org; Wed, 20 Jul 2016 14:25:53 -0400 +X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org +X-Spam-Level: +X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,HTML_MESSAGE, + T_DKIM_INVALID autolearn=disabled version=3.3.2 +Received: from mail-io0-x236.google.com ([2607:f8b0:4001:c06::236]:32874) + by eggs.gnu.org with esmtp (Exim 4.71) + (envelope-from ) + id 1bPwBr-0007t9-NK + for KAction@gnu.org; Wed, 20 Jul 2016 14:25:51 -0400 +Received: by mail-io0-x236.google.com with SMTP id 38so55303707iol.0 + for ; Wed, 20 Jul 2016 11:25:50 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=nu-ex-com.20150623.gappssmtp.com; s=20150623; + h=mime-version:references:in-reply-to:from:date:message-id:subject:to; + bh=jeiFw5Oto9q90WQrIDawOh/M0DSQuTm6MsNWzCa2iqM=; + b=w2EjWx2jk9uB85wrWykVmNEy9QEg28aOHaekBeO8iyoODPF2j8MsXjtXhvUs+4ZxLF + 9fo3qkCLMV9NrPtteb8y4y5kTjbAHJsskIf7r2vdmG1VavbaHlkg8RNya2D90M46cJtz + uaQHQsup+ukaia6j5rQOSq96ioa+hB6mDifxDyvuHY8nbnKnZ3ZYcs+XWnMEBFYa+fPr + Uy/WEnszBVLXVBWh8DN4KNYNuIenzTo0UBSscrriq4vVs3+7uzqimK2jK2OGYAx6sNot + S/DRbSGlY4HRrELgfL654UZsdExXAgphu1X+ibAjCaFjPPK/Nn+rOBif9KFmjLI5c+pF + tLQw== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:mime-version:references:in-reply-to:from:date + :message-id:subject:to; + bh=jeiFw5Oto9q90WQrIDawOh/M0DSQuTm6MsNWzCa2iqM=; + b=QzC2SV8Hl3lehpfi0nN2IboohDGuxFsjoqLSL38THT412ruqWgwQoVLbBQg4XRmAgg + rrT2sR8LCCTHJqUBjFlaTIOAFxxWj8ji9E9p9BNTHHvQ6Gqhl5U3SOPAXvtFtoEPEoLa + 9EyNGzjO7VqsZHoYcYgXf/Tpw8Nsro14Lnv7ShbPS5ZNitwwXlVO+7v1FvxxARQskM3a + NWmw5/8fXLqsd5bQATq6Lq3APmV2wZFmVdJ9QZam9BZHqq5X11hLf6t4r0OgEyhwZ4/o + MX1rJvYL7Qnc3Gy6iQJTw8IJeECYP1jJ+g87C15kgKiyE70x2Xg/dPTPi5wuO2OSBnNq + 0gAg== +X-Gm-Message-State: ALyK8tKkwgnTTOBYgFgESByuR5isjDNaKDDSP1OBDQYyhq6gPsDbGeLfq9zPZ7jm2ZciBSSvH2DS7EF+bA/qcw== +X-Received: by 10.107.130.170 with SMTP id m42mr43873568ioi.78.1469039149834; + Wed, 20 Jul 2016 11:25:49 -0700 (PDT) +MIME-Version: 1.0 +References: +In-Reply-To: +From: nx +Date: Wed, 20 Jul 2016 18:25:40 +0000 +Message-ID: +Subject: Re: cdist contribution relicensing +To: Dmitry Bogatov +Content-Type: multipart/alternative; boundary=001a113bd076affa64053815546c +X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] +X-Received-From: 2607:f8b0:4001:c06::236 +X-UIDL: ~j$"!G$!#!92;"!/;T"! + +--001a113bd076affa64053815546c +Content-Type: text/plain; charset=UTF-8 + +I, Chase James , permit to relicense all my +contribution to cdist project, source code https://github.com/ungleich/cdist + to GNU General Public license, version 3 or (at your option) any later +version, as published by Free Software Foundation. + +20 July 2016 + +On Wed, Jul 20, 2016 at 11:10 AM Dmitry Bogatov wrote: + +> +> Hello, dear contributors of cdist project! +> +> Recently we discovered licensing issue with your contribution. Namely, +> while most of code is GPLv3+, including some of code written by you, +> manpages (man.txt, now man.rst) are GPLv3 only licensed. +> +> On behalf of cdist releasers (Darko and Nico), I (another cdist +> contributor and cdist Debian maintainer) ask you to permit relicense +> your contribution from GPLv3 to GPLv3+. Without your permission, we +> would be stuck the day when GPLv4 come (hope it will never come, but +> still), or have to reimplement your contribution. +> +> If you agree, please respond with something like +> +> I, #name# <#email#> permit to relicense all my contribution to +> cdist project, source code https://github.com/ungleich/cdist +> to GNU General Public license, version 3 or (at your option) +> any later version, as published by Free Software Foundation. +> +> #day# Jule 2016 year. +> +> If possible, GPG-sign such email. Do not include anything else +> valuable in this email that you do not want to be stored forever in +> public. +> +> Dear contributors, when replying to this email, please do not send +> copy to other contributors -- save their inbox storage. +> +> Thank you in advance for one more contribution. +> +> -- +> Accept: text/plain, text/x-diff +> Accept-Language: eo,en,ru +> X-Web-Site: sinsekvu.github.io +> + +--001a113bd076affa64053815546c +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +
I, Chase James <nx-cdist@nu-ex.com>, permit to relicense a= +ll my contribution to=C2=A0cdist project,= + source code=C2=A0= +https://github.com/ungleich/cdist=C2=A0to GNU General Public license, version 3 or (at your option)=C2= +=A0any later version, as published by Fre= +e Software Foundation.

20 July 2016
= +

On Wed, Jul 20, 2016 = +at 11:10 AM Dmitry Bogatov <KAction@g= +nu.org> wrote:

+Hello, dear contributors of cdist project!
+
+Recently we discovered licensing issue with your contribution. Namely,
+while most of code is GPLv3+, including some of code written by you,
+manpages (man.txt, now man.rst) are GPLv3 only licensed.
+
+On behalf of cdist releasers (Darko and Nico), I (another cdist
+contributor and cdist Debian maintainer) ask you to permit relicense
+your contribution from GPLv3 to GPLv3+. Without your permission, we
+would be stuck the day when GPLv4 come (hope it will never come, but
+still), or have to reimplement your contribution.
+
+If you agree, please respond with something like
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 I, #name# <#email#> permit to relicense a= +ll my contribution to
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cdist project, source code https://gith= +ub.com/ungleich/cdist
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 to GNU General Public license, version 3 or (at= + your option)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 any later version, as published by Free Softwar= +e Foundation.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 #day# Jule 2016 year.
+
+If possible, GPG-sign such email. Do not include anything else
+valuable in this email that you do not want to be stored forever in
+public.
+
+Dear contributors, when replying to this email, please do not send
+copy to other contributors -- save their inbox storage.
+
+Thank you in advance for one more contribution.
+
+--
+Accept: text/plain, text/x-diff
+Accept-Language: eo,en,ru
+X-Web-Site: sinsekvu.github.io
+
+ +--001a113bd076affa64053815546c-- + diff --git a/docs/legal/Christian_Warden.email b/docs/legal/Christian_Warden.email new file mode 100644 index 00000000..798b3201 --- /dev/null +++ b/docs/legal/Christian_Warden.email @@ -0,0 +1,122 @@ +From kaction Wed Jul 20 18:25:04 2016 +Return-path: +Envelope-to: KAction@gnu.org +Delivery-date: Wed, 20 Jul 2016 11:20:15 -0400 +Received: from fencepost.gnu.org [208.118.235.10] + by searing with POP3 (fetchmail-6.3.26) + for (single-drop); Wed, 20 Jul 2016 18:25:04 +0300 (MSK) +Received: from eggs.gnu.org ([2001:4830:134:3::10]:34238) + by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) + (Exim 4.82) + (envelope-from ) + id 1bPtIF-000809-Ob + for KAction@gnu.org; Wed, 20 Jul 2016 11:20:15 -0400 +Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) + (envelope-from ) + id 1bPtIB-0006jv-SP + for KAction@gnu.org; Wed, 20 Jul 2016 11:20:15 -0400 +X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org +X-Spam-Level: +X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD, + T_DKIM_INVALID autolearn=disabled version=3.3.2 +Received: from sage.xerus.org ([207.210.217.189]:21397) + by eggs.gnu.org with esmtp (Exim 4.71) + (envelope-from ) + id 1bPtIB-0006cm-9G + for KAction@gnu.org; Wed, 20 Jul 2016 11:20:11 -0400 +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xerus.org; s=sage; + h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date; bh=O5u4neMHAeGrtpVYFlmpULGNH1YPNhLUEaWPXxzf2xk=; + b=KjzaEXo/CKeUuLj2B1Hrf3krvsJgkMnjqvjJM2KfFJWsiiHU9qPlUtaETBG9jE9tD5MTjg/5/Wr/4u+CnA3xLeNBMIDrFaLaPW2vdlqFsRSVsjl3g/a4LqNrIZcU60/Lwlzb4ber5Y5i69MUX4Y/m1p57FjXTlqONbZZzOa82WQ=; +Received: from c-71-59-214-243.hsd1.or.comcast.net ([71.59.214.243] helo=speedy.xerus.org) + by sage.xerus.org (envelope-from ) + with esmtpsa (Exim 4.80 #2 (Debian)) + id 1bPtHk-0005To-3h + for ; Wed, 20 Jul 2016 08:19:44 -0700 +Received: from cwarden by speedy.xerus.org with local (Exim 4.80) + (envelope-from ) + id 1bPtHj-0007NB-6e + for KAction@gnu.org; Wed, 20 Jul 2016 08:19:43 -0700 +Date: Wed, 20 Jul 2016 08:19:43 -0700 +From: "Christian G. Warden" +To: Dmitry Bogatov +Subject: Re: cdist contribution relicensing +Message-ID: <20160720151943.GD8681@xerus.org> +References: +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="eAbsdosE1cNLO4uF" +Content-Disposition: inline +In-Reply-To: +X-Face: jD^+@)>yf8|'#1~7ie$N]>2XN},k*wInk~T->gX/l"0?GDg#b;M[;(4'R94H`6,~p"&"(`$ + ?KVH_(2BuS[Zi(IFt,DWb'j77JZMQ~S0mN]o^>zAGQOaz6/uCSFu(O,jf*(e<*'Sa~yW1k1RC0xhd1 + ]'F2p]Wvt3bJ$i2E69!rDttE@/nw?1kS#-#Al(p=G\{Jj4GaRlN(V=R@+&dqD{`v7Y{!WE_?H!iD2D + Z$ +User-Agent: Mutt/1.6.0 (2016-04-01) +X-Sender-Verification: OK +X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] +X-Received-From: 207.210.217.189 +X-UIDL: Dh>"!+M_"!, waive all copyright and +related rights in my contribution to the cdist project. + +Christian + +On Wed, Jul 20, 2016 at 06:09:46PM +0300, Dmitry Bogatov wrote: +>=20 +> Hello, dear contributors of cdist project! +>=20 +> Recently we discovered licensing issue with your contribution. Namely, +> while most of code is GPLv3+, including some of code written by you, +> manpages (man.txt, now man.rst) are GPLv3 only licensed. +>=20 +> On behalf of cdist releasers (Darko and Nico), I (another cdist +> contributor and cdist Debian maintainer) ask you to permit relicense +> your contribution from GPLv3 to GPLv3+. Without your permission, we +> would be stuck the day when GPLv4 come (hope it will never come, but +> still), or have to reimplement your contribution. +>=20 +> If you agree, please respond with something like +>=20 +> I, #name# <#email#> permit to relicense all my contribution to +> cdist project, source code https://github.com/ungleich/cdist +> to GNU General Public license, version 3 or (at your option) +> any later version, as published by Free Software Foundation. +>=20 +> #day# Jule 2016 year. +>=20 +> If possible, GPG-sign such email. Do not include anything else +> valuable in this email that you do not want to be stored forever in +> public. +>=20 +> Dear contributors, when replying to this email, please do not send +> copy to other contributors -- save their inbox storage. +>=20 +> Thank you in advance for one more contribution. +>=20 +> -- +> Accept: text/plain, text/x-diff +> Accept-Language: eo,en,ru +> X-Web-Site: sinsekvu.github.io + + + +--eAbsdosE1cNLO4uF +Content-Type: application/pgp-signature; name="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1 + +iEYEARECAAYFAlePlo8ACgkQXSJ4OU73l6Ap6wCgjNo7oLH8G6KUECBOTyCoGbMk +wgAAoJHq5Tx5EWNO9pg3YvBtff5m1iHx +=srJn +-----END PGP SIGNATURE----- + +--eAbsdosE1cNLO4uF-- + diff --git a/docs/legal/Daniel_Heule.email b/docs/legal/Daniel_Heule.email new file mode 100644 index 00000000..a66e468c --- /dev/null +++ b/docs/legal/Daniel_Heule.email @@ -0,0 +1,97 @@ +From kaction Thu Jul 21 09:20:03 2016 +Return-path: +Envelope-to: KAction@gnu.org +Delivery-date: Thu, 21 Jul 2016 02:15:43 -0400 +Received: from fencepost.gnu.org [208.118.235.10] + by searing with POP3 (fetchmail-6.3.26) + for (single-drop); Thu, 21 Jul 2016 09:20:03 +0300 (MSK) +Received: from eggs.gnu.org ([2001:4830:134:3::10]:60463) + by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) + (Exim 4.82) + (envelope-from ) + id 1bQ7Go-0005is-V4 + for KAction@gnu.org; Thu, 21 Jul 2016 02:15:43 -0400 +Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) + (envelope-from ) + id 1bQ7Gk-0006QB-Hy + for KAction@gnu.org; Thu, 21 Jul 2016 02:15:41 -0400 +X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org +X-Spam-Level: +X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,HTML_MESSAGE, + RCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.2 +Received: from mail3.sfsservices.biz ([194.93.112.48]:32812) + by eggs.gnu.org with esmtp (Exim 4.71) + (envelope-from ) + id 1bQ7Gk-0006Pg-Ay + for KAction@gnu.org; Thu, 21 Jul 2016 02:15:38 -0400 +X-Received: from localhost (localhost [127.0.0.1]) + by mail3.sfsservices.biz (Postfix) with ESMTP id 4F7C37E219FD + for ; Thu, 21 Jul 2016 08:15:33 +0200 (CEST) +X-Virus-Scanned: amavisd-new at sfsservices.biz +X-Received: from mail3.sfsservices.biz ([127.0.0.1]) + by localhost (mail3.sfsservices.biz [127.0.0.1]) (amavisd-new, port 10023) + with ESMTP id 42FFY6pT6H_v for ; + Thu, 21 Jul 2016 08:15:33 +0200 (CEST) +X-Received: from chsfsd14.sfs-intra.net (chsfsln0001.sfs-intra.net [INTERNAL-IP]) + by mail3.sfsservices.biz (Postfix) with ESMTP + for ; Thu, 21 Jul 2016 08:15:33 +0200 (CEST) +In-Reply-To: +References: +To: Dmitry Bogatov +MIME-Version: 1.0 +Subject: Antwort: cdist contribution relicensing +X-KeepSent: 3BCE55E5:113E83E4-C1257FF7:002232C0; + type=4; name=$KeepSent +X-Mailer: IBM Notes Release 9.0.1FP3 January 13, 2015 +Message-ID: +From: Daniel Heule +Date: Thu, 21 Jul 2016 08:15:32 +0200 +X-MIMETrack: Serialize by Router on chsfsd14/SFS(Release 9.0.1FP6|April 20, 2016) at + 21.07.2016 08:15:32, + Serialize complete at 21.07.2016 08:15:32 +Content-Type: multipart/alternative; boundary="=_alternative 00226206C1257FF7_=" +X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] +X-Received-From: 194.93.112.48 +X-UIDL: LCD"!0Gb!!dH-"!0ma"! + +Dies ist eine mehrteilige Nachricht im MIME-Format. +--=_alternative 00226206C1257FF7_= +Content-Type: text/plain; charset="ISO-8859-1" +Content-Transfer-Encoding: quoted-printable + +I, Daniel Heule, hda@sfs.biz permit to relicense all my contribution to +cdist project, source code https://github.com/ungleich/cdist +to GNU General Public license, version 3 or (at your option) +any later version, as published by Free Software Foundation. + +21 Jule 2016. + + + +Mit freundlichen Gr=FCssen / Kind regards + +Daniel Heule + +--=_alternative 00226206C1257FF7_= +Content-Type: text/html; charset="ISO-8859-1" +Content-Transfer-Encoding: quoted-printable + +I, Daniel Heule, hda@sfs.biz permit to relicense all +my contribution to
+cdist project, source code
https://github.com/ungleich/cdist
+to GNU General Public license, version 3 or (at your option)
+any later version, as published by Free Software Foundation.
+
+21 Jule 2016.
+
+
+
+
Mit freundlichen Gr=FCssen / Kind re= +gards
+
+
Daniel Heule +
+--=_alternative 00226206C1257FF7_=-- + diff --git a/docs/legal/Daniel_Maher.email b/docs/legal/Daniel_Maher.email new file mode 100644 index 00000000..3e7ab892 --- /dev/null +++ b/docs/legal/Daniel_Maher.email @@ -0,0 +1,180 @@ +From kaction Thu Jul 21 17:05:06 2016 +Return-path: +Envelope-to: KAction@gnu.org +Delivery-date: Thu, 21 Jul 2016 10:00:45 -0400 +Received: from fencepost.gnu.org [208.118.235.10] + by searing with POP3 (fetchmail-6.3.26) + for (single-drop); Thu, 21 Jul 2016 17:05:06 +0300 (MSK) +Received: from eggs.gnu.org ([2001:4830:134:3::10]:51771) + by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) + (Exim 4.82) + (envelope-from ) + id 1bQEWr-0007dw-7V + for KAction@gnu.org; Thu, 21 Jul 2016 10:00:45 -0400 +Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) + (envelope-from ) + id 1bQEWm-0005MY-BL + for KAction@gnu.org; Thu, 21 Jul 2016 10:00:44 -0400 +X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org +X-Spam-Level: * +X-Spam-Status: No, score=1.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, + FREEMAIL_REPLY,HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 +Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]:33089) + by eggs.gnu.org with esmtp (Exim 4.71) + (envelope-from ) + id 1bQEWl-0005Lm-Ra + for KAction@gnu.org; Thu, 21 Jul 2016 10:00:40 -0400 +Received: by mail-lf0-x22f.google.com with SMTP id b199so62920486lfe.0 + for ; Thu, 21 Jul 2016 07:00:39 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20120113; + h=mime-version:in-reply-to:references:from:date:message-id:subject:to; + bh=QxAnWA/6Ux99c9jwOxhyzuW7Mgg4vOlk5/YLw6lG7vI=; + b=GxRkrDAKMCBYgbFXFw//11UoxJ1DI3SANR2ZJTIGfJQWun/PdH/UIp9Y/yrUgReQ52 + aF+/xiGwZtwAtNrW5x5sH8t6eKTEDX98F44kqyTn8W0r4UKlFveIGyqGLKhwgiysUa7s + V7t4HeZHf6KuS1M2v7pGHfY8RWNKkcqbAfc1o5RvSf5w7Fma7vwYTfHhpOTHymjJ6Q0r + 9Ite/jxAuZkg1MD1AQftYpJX1MHpEvsZfSwNNl/rc06onY8uF5/WCbORoDJdDvnFnIle + UKDqPxvOO5b82FH1t4YZQy3qN6uJEZj5XHTHNVe0wmnl09hkKJgq2OF7ih1tKLPhxyo+ + MhJw== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:mime-version:in-reply-to:references:from:date + :message-id:subject:to; + bh=QxAnWA/6Ux99c9jwOxhyzuW7Mgg4vOlk5/YLw6lG7vI=; + b=Um0d/lugkccoSfexFcSRQXYK9NPQW24ciOdTfq6HfF1io3u/LCeIg8Vevtk0aY2aJd + 88LeTX66bYD3s3fDRaAo3/GFnjD48IaXkkLNqXD9WHvLdC01RHVerPU0gG0drd28gFfS + BLr6EO7Eyx1VNNFw9eT9PSkzJdRBA73h6zv+/eJLLSI+xz2e9oMlixZ4UnVj7Zc2GDBD + QKftxgjr499rVbkRDXCvjBhEEUdYVJSPlr+gNCnmfy9Me6tqRvjWOwGbxwvnOj/DZ0Lc + s7F7oy6K3DnJMweLH48JsQLiOp4FDJjMydhrxavr2FZ1xdTtDXQzxQCPZfyJsilteQKd + VX1A== +X-Gm-Message-State: ALyK8tJIaYrPzw331bl+6pm5hf75dGrGWIlW3nvRHHCunoAIji4D3HIofy8DADE4ckYnaOxRSf6aYlYIrHPoYg== +X-Received: by 10.25.22.152 with SMTP id 24mr24682317lfw.180.1469109638281; + Thu, 21 Jul 2016 07:00:38 -0700 (PDT) +MIME-Version: 1.0 +Received: by 10.25.85.141 with HTTP; Thu, 21 Jul 2016 07:00:18 -0700 (PDT) +In-Reply-To: +References: +From: dan maher +Date: Thu, 21 Jul 2016 16:00:18 +0200 +Message-ID: +Subject: Re: cdist contribution relicensing +To: Dmitry Bogatov +Content-Type: multipart/alternative; boundary=001a11408306203f8e053825be9d +X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] +X-Received-From: 2a00:1450:4010:c07::22f +X-UIDL: PnS!!MF-!!Y1/!!@L permit to relicense all +my contribution to + cdist project, source code https://github.com/ungleich/cdist + to GNU General Public license, version 3 or (at your option) + any later version, as published by Free Software Foundation. + + 21 July 2016. + +On 20 July 2016 at 17:09, Dmitry Bogatov wrote: + +> +> Hello, dear contributors of cdist project! +> +> Recently we discovered licensing issue with your contribution. Namely, +> while most of code is GPLv3+, including some of code written by you, +> manpages (man.txt, now man.rst) are GPLv3 only licensed. +> +> On behalf of cdist releasers (Darko and Nico), I (another cdist +> contributor and cdist Debian maintainer) ask you to permit relicense +> your contribution from GPLv3 to GPLv3+. Without your permission, we +> would be stuck the day when GPLv4 come (hope it will never come, but +> still), or have to reimplement your contribution. +> +> If you agree, please respond with something like +> +> I, #name# <#email#> permit to relicense all my contribution to +> cdist project, source code https://github.com/ungleich/cdist +> to GNU General Public license, version 3 or (at your option) +> any later version, as published by Free Software Foundation. +> +> #day# Jule 2016 year. +> +> If possible, GPG-sign such email. Do not include anything else +> valuable in this email that you do not want to be stored forever in +> public. +> +> Dear contributors, when replying to this email, please do not send +> copy to other contributors -- save their inbox storage. +> +> Thank you in advance for one more contribution. +> +> -- +> Accept: text/plain, text/x-diff +> Accept-Language: eo,en,ru +> X-Web-Site: sinsekvu.github.io +> + +--001a11408306203f8e053825be9d +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +
=C2=A0 =C2=A0 =C2=A0 =C2=A0 I, Daniel MAHER <phrawzty+cdist@gmail.com> permit= + to relicense all my contribution to
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cdist project, source code https://gith= +ub.com/ungleich/cdist
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 to GNU General Public license, version 3 or (at= + your option)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 any later version, as published by Free Softwar= +e Foundation.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 21 July 2016.
<= +br>
On 20 July 2016 at 17:09, Dmitry Bogatov <KAct= +ion@gnu.org> wrote:

+Hello, dear contributors of cdist project!
+
+Recently we discovered licensing issue with your contribution. Namely,
+while most of code is GPLv3+, including some of code written by you,
+manpages (man.txt, now man.rst) are GPLv3 only licensed.
+
+On behalf of cdist releasers (Darko and Nico), I (another cdist
+contributor and cdist Debian maintainer) ask you to permit relicense
+your contribution from GPLv3 to GPLv3+. Without your permission, we
+would be stuck the day when GPLv4 come (hope it will never come, but
+still), or have to reimplement your contribution.
+
+If you agree, please respond with something like
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 I, #name# <#email#> permit to relicense a= +ll my contribution to
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cdist project, source code https://gith= +ub.com/ungleich/cdist
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 to GNU General Public license, version 3 or (at= + your option)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 any later version, as published by Free Softwar= +e Foundation.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 #day# Jule 2016 year.
+
+If possible, GPG-sign such email. Do not include anything else
+valuable in this email that you do not want to be stored forever in
+public.
+
+Dear contributors, when replying to this email, please do not send
+copy to other contributors -- save their inbox storage.
+
+Thank you in advance for one more contribution.
+
+--
+Accept: text/plain, text/x-diff
+Accept-Language: eo,en,ru
+X-Web-Site: sinsekvu.github.io
+

+ +--001a11408306203f8e053825be9d-- + diff --git a/docs/legal/Giel_van_Schijndel.email b/docs/legal/Giel_van_Schijndel.email new file mode 100644 index 00000000..2f085653 --- /dev/null +++ b/docs/legal/Giel_van_Schijndel.email @@ -0,0 +1,85 @@ +From kaction Thu Jul 21 01:10:04 2016 +Return-path: +Envelope-to: KAction@gnu.org +Delivery-date: Wed, 20 Jul 2016 18:06:32 -0400 +Received: from fencepost.gnu.org [208.118.235.10] + by searing with POP3 (fetchmail-6.3.26) + for (single-drop); Thu, 21 Jul 2016 01:10:04 +0300 (MSK) +Received: from eggs.gnu.org ([2001:4830:134:3::10]:44575) + by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) + (Exim 4.82) + (envelope-from ) + id 1bPzdP-0004KA-R1 + for KAction@gnu.org; Wed, 20 Jul 2016 18:06:31 -0400 +Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) + (envelope-from ) + id 1bPzdL-0005W4-Bl + for KAction@gnu.org; Wed, 20 Jul 2016 18:06:30 -0400 +X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org +X-Spam-Level: +X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD + autolearn=disabled version=3.3.2 +Received: from khitomer.mortis.eu ([185.27.175.75]:55475) + by eggs.gnu.org with esmtp (Exim 4.71) + (envelope-from ) + id 1bPzdL-0005VB-4y + for KAction@gnu.org; Wed, 20 Jul 2016 18:06:27 -0400 +Received: from salidar.dom.custoft.eu (unknown [IPv6:2001:981:4eab:1:7016:52bb:c51b:646d]) + (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) + (Client CN "Giel van Schijndel", Issuer "CAcert Class 3 Root" (not verified)) + by khitomer.mortis.eu (Postfix) with ESMTPS id 0634E1D8 + for ; Thu, 21 Jul 2016 00:06:24 +0200 (CEST) +Received: by salidar.dom.custoft.eu (Postfix, from userid 2079) + id BA3033216E; Thu, 21 Jul 2016 00:06:22 +0200 (CEST) +Date: Thu, 21 Jul 2016 00:06:22 +0200 +From: Giel van Schijndel +To: Dmitry Bogatov +Subject: Re: cdist contribution relicensing +Message-ID: <20160720220622.GC2228@salidar.dom.custoft.eu> +References: +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="2qXFWqzzG3v1+95a" +Content-Disposition: inline +In-Reply-To: +OpenPGP: id=CEE5E742; url=http://gpg.mortis.eu/me.asc +User-Agent: Mutt/1.6.0 (2016-04-01) +X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x +X-Received-From: 185.27.175.75 +X-UIDL: Kgn!!Pf9!!I,+!!#DW"! + + +--2qXFWqzzG3v1+95a +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +I, Giel van Schijndel, hereby give permission to any recipients of my +contributions to the cdist project done up to this date, to redistribute +these or derivatives thereof 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. For clarity: +these contributions should be reachable through the Git commit +identifiable by SHA-1 160-bit hash 7e57575f9e1ad0909750d116e9eabc15c1c77e2c +to be considered "up to this date". + +Signed, July 21th, 2016. + +--=20 +Met vriendelijke groet, +With kind regards, +Giel van Schijndel + +--2qXFWqzzG3v1+95a +Content-Type: application/pgp-signature; name="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1 + +iEYEARECAAYFAleP9dgACgkQZBYm/87l50LVfQCfXo/2XqCwreH0VEmsmYzE5nE/ +zlMAn0D8/9qif3bAwOwDtvFKJWtfabrg +=f6r/ +-----END PGP SIGNATURE----- + +--2qXFWqzzG3v1+95a-- + diff --git a/docs/legal/Jacob_Guffey.email b/docs/legal/Jacob_Guffey.email new file mode 100644 index 00000000..a9892deb --- /dev/null +++ b/docs/legal/Jacob_Guffey.email @@ -0,0 +1,64 @@ +From kaction Sat Jul 23 01:20:04 2016 +Return-path: +Envelope-to: KAction@gnu.org +Delivery-date: Fri, 22 Jul 2016 18:19:30 -0400 +Received: from fencepost.gnu.org [208.118.235.10] + by searing with POP3 (fetchmail-6.3.26) + for (single-drop); Sat, 23 Jul 2016 01:20:04 +0300 (MSK) +Received: from eggs.gnu.org ([2001:4830:134:3::10]:57472) + by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) + (Exim 4.82) + (envelope-from ) + id 1bQin4-0006js-EH + for KAction@gnu.org; Fri, 22 Jul 2016 18:19:30 -0400 +Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) + (envelope-from ) + id 1bQin0-00078i-0H + for KAction@gnu.org; Fri, 22 Jul 2016 18:19:29 -0400 +X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org +X-Spam-Level: +X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD + autolearn=disabled version=3.3.2 +Received: from jhsmtdmz01x.jointheirstm.org ([69.28.94.113]:64009) + by eggs.gnu.org with esmtp (Exim 4.71) + (envelope-from ) + id 1bQimz-00078K-Rx + for KAction@gnu.org; Fri, 22 Jul 2016 18:19:25 -0400 +Received: from moshe.jointheirstm.org (c-98-253-78-203.hsd1.in.comcast.net [98.253.78.203]) + by JHSMTDMZ01X.jointheirstm.org (Postfix) with ESMTPSA id 922972AE606 + for ; Fri, 22 Jul 2016 18:19:23 -0400 (EDT) +Subject: Re: cdist contribution relicensing +To: Dmitry Bogatov +References: +From: Jake Guffey +Message-ID: <57929BB9.1080104@Jointheirstm.org> +Date: Fri, 22 Jul 2016 18:18:33 -0400 +User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 + Thunderbird/38.5.0 +MIME-Version: 1.0 +In-Reply-To: +Content-Type: text/plain; charset=windows-1252 +Content-Transfer-Encoding: 7bit +X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x +X-Received-From: 69.28.94.113 +X-UIDL: B!'#!_Z2!![?h"!'Ij"! + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +I, Jacob Guffey , permit to relicense +all my contributions to the cdist project, source code +https://github.com/ungleich/cdist to GNU General Public license, +version 3 or (at the maintainer's option) any later version, as +published by Free Software Foundation. + +2016-07-22 + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2 + +iF4EAREIAAYFAleSm7YACgkQT+o/hrTzJc0NQwD/b2hjXG6UCJXnVUANmWnVy+/L +ae+7lZhFL8UklI5cb/0BAOC7jjH8FfKz1lL/Arqw4SM64yy3wiwvJjqJDtmuumWl +=VLlV +-----END PGP SIGNATURE----- + diff --git a/docs/legal/README b/docs/legal/README new file mode 100644 index 00000000..91a2a0d3 --- /dev/null +++ b/docs/legal/README @@ -0,0 +1,10 @@ +Around 20 Jule 2016 year was discovered issue, that while all code is +GPLv3+ licensed, type documentation is GPLv3 only. As such +contributors was emailed to ask them permission to relicense to +GPLv3+. + +This directory contains emails, containing permission with all +headers. Not sure about legal significance, since email is so easy to +forge, but it is best option availiable. + + -- Dmitry Bogatov Wed, 20 Jul 2016 18:25:27 +0300 diff --git a/docs/legal/Ricardo_Catalinas.email b/docs/legal/Ricardo_Catalinas.email new file mode 100644 index 00000000..306ec073 --- /dev/null +++ b/docs/legal/Ricardo_Catalinas.email @@ -0,0 +1,183 @@ +From kaction Wed Jul 20 18:15:05 2016 +Return-path: +Envelope-to: KAction@gnu.org +Delivery-date: Wed, 20 Jul 2016 11:13:48 -0400 +Received: from fencepost.gnu.org [208.118.235.10] + by searing with POP3 (fetchmail-6.3.26) + for (single-drop); Wed, 20 Jul 2016 18:15:05 +0300 (MSK) +Received: from eggs.gnu.org ([2001:4830:134:3::10]:33032) + by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) + (Exim 4.82) + (envelope-from ) + id 1bPtBz-0007Ty-T1 + for KAction@gnu.org; Wed, 20 Jul 2016 11:13:48 -0400 +Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) + (envelope-from ) + id 1bPtBx-0005MG-9h + for KAction@gnu.org; Wed, 20 Jul 2016 11:13:46 -0400 +X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org +X-Spam-Level: +X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, + HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 +Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:36812) + by eggs.gnu.org with esmtp (Exim 4.71) + (envelope-from ) + id 1bPtBw-0005Lt-Ul + for KAction@gnu.org; Wed, 20 Jul 2016 11:13:45 -0400 +Received: by mail-wm0-x22f.google.com with SMTP id q128so60444546wma.1 + for ; Wed, 20 Jul 2016 08:13:44 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20120113; + h=mime-version:in-reply-to:references:date:message-id:subject:from:to; + bh=YrPuTGXNLw9oFiHKKS+IheiScrs5DuAEvUTlakl0Mxg=; + b=WyUhnGVNalPpcJVnkHrFy1wNBjA/S7fZujrzehx9NGmJFOnawS4GJeatEZ4Pdj3hcq + sBzndUsU57BoYVn99QGM5eELbngARMKyU81V3sobYs5oeP6tFdKxnDpedgS6+yTKXLjP + ZH/tJiINIpXhjSxJkqw8q/dV5SKz6do840Roj1234XUKinRnUPX+zJt3Kjy2M+/dDfL8 + wp5u9xTIS1c9cA3xYN/rdrsIjbRkgo01Yh1wVaZBYpaWFybX09uOSo4fXFGZ6rKQl8iJ + 3M+S3+wQxaP2PZzj9z0eV/GVNM5+5lVcmUjI/PAqIq6nS6mOawolTB078FMFD9cvDRtS + KiNg== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:mime-version:in-reply-to:references:date + :message-id:subject:from:to; + bh=YrPuTGXNLw9oFiHKKS+IheiScrs5DuAEvUTlakl0Mxg=; + b=EwpgAswQ/18QAMRKkz00dKKmXL7loG/R2ZX6KjvFCsBb0x8sV90eWI+17vBF+GVS1y + k6pXyyfLBFgeFBlgjN8oqaSqHhKNoOzWLNKHpOwAW+WnJ/SyprpxdU1BHz2ZOMDTOJuP + 9NTW8LoB4fU24ns1Yor6ykRMeBGQZDvTT3Zi4JsU48522W1WRXXH/Y4sJRm/hdlSaU18 + 1UN7ySE0Oey6Ufk+yG7M6EwJvY7ZI+zRlPsoknGwofg8H6VH7mKBcDvHc71Wk5tGOVMN + iJeKjmgmReG38Em5C+uGO0h9zjsIYZsYC8dUyRCkfNLD66pRdpFuRFIWhG/PU1aH9hIo + Wlng== +X-Gm-Message-State: ALyK8tLwjExHqmfFbrI69OlGTEDrsSCXwwBlBtD3gfpXU42hI/M5850STADANQROCfznBfKvk/zO9N4+82n/hA== +MIME-Version: 1.0 +X-Received: by 10.194.209.163 with SMTP id mn3mr1847437wjc.45.1469027623430; + Wed, 20 Jul 2016 08:13:43 -0700 (PDT) +Received: by 10.194.228.10 with HTTP; Wed, 20 Jul 2016 08:13:43 -0700 (PDT) +Received: by 10.194.228.10 with HTTP; Wed, 20 Jul 2016 08:13:43 -0700 (PDT) +In-Reply-To: +References: +Date: Wed, 20 Jul 2016 16:13:43 +0100 +Message-ID: +Subject: Re: cdist contribution relicensing +From: =?UTF-8?Q?Ricardo_Catalinas_Jim=C3=A9nez?= +To: Dmitry Bogatov +Content-Type: multipart/alternative; boundary=047d7b3a8d24a8fb78053812a524 +X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] +X-Received-From: 2a00:1450:400c:c09::22f +X-UIDL: H8X!!VF3!!(#b"!\C)!! + +--047d7b3a8d24a8fb78053812a524 +Content-Type: text/plain; charset=UTF-8 + + I, Ricardo Catalinas permit to relicense all my +contribution to + cdist project, source codehttps://github.com/ungleich/cdist + to GNU General Public license, version 3 or (at your option) + any later version, as published by Free Software Foundation. + + 20th Jule 2016 year + +/Ricardo + +On Jul 20, 2016 4:11 PM, "Dmitry Bogatov" wrote: + +> +> Hello, dear contributors of cdist project! +> +> Recently we discovered licensing issue with your contribution. Namely, +> while most of code is GPLv3+, including some of code written by you, +> manpages (man.txt, now man.rst) are GPLv3 only licensed. +> +> On behalf of cdist releasers (Darko and Nico), I (another cdist +> contributor and cdist Debian maintainer) ask you to permit relicense +> your contribution from GPLv3 to GPLv3+. Without your permission, we +> would be stuck the day when GPLv4 come (hope it will never come, but +> still), or have to reimplement your contribution. +> +> If you agree, please respond with something like +> +> I, #name# <#email#> permit to relicense all my contribution to +> cdist project, source code https://github.com/ungleich/cdist +> to GNU General Public license, version 3 or (at your option) +> any later version, as published by Free Software Foundation. +> +> #day# Jule 2016 year. +> +> If possible, GPG-sign such email. Do not include anything else +> valuable in this email that you do not want to be stored forever in +> public. +> +> Dear contributors, when replying to this email, please do not send +> copy to other contributors -- save their inbox storage. +> +> Thank you in advance for one more contribution. +> +> -- +> Accept: text/plain, text/x-diff +> Accept-Language: eo,en,ru +> X-Web-Site: sinsekvu.github.io +> + +--047d7b3a8d24a8fb78053812a524 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable + +

=C2=A0 I, Ricardo Catalinas <jimenezrick@gmail.com> permit to relicense all my contr= +ibution to
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cdist project, source codehttps://github.com/ungleich/cdist
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 to GNU General Public license, version 3 or (at= + your option)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 any later version, as published by Free Softwar= +e Foundation.

+

=C2=A0 =C2=A0 =C2=A0 =C2=A0 20th Jule 2016 year

+

/Ricardo

+

On Jul 20, 2016 4= +:11 PM, "Dmitry Bogatov" <K= +Action@gnu.org> wrote:

+Hello, dear contributors of cdist project!
+
+Recently we discovered licensing issue with your contribution. Namely,
+while most of code is GPLv3+, including some of code written by you,
+manpages (man.txt, now man.rst) are GPLv3 only licensed.
+
+On behalf of cdist releasers (Darko and Nico), I (another cdist
+contributor and cdist Debian maintainer) ask you to permit relicense
+your contribution from GPLv3 to GPLv3+. Without your permission, we
+would be stuck the day when GPLv4 come (hope it will never come, but
+still), or have to reimplement your contribution.
+
+If you agree, please respond with something like
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 I, #name# <#email#> permit to relicense a= +ll my contribution to
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cdist project, source code https://gith= +ub.com/ungleich/cdist
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 to GNU General Public license, version 3 or (at= + your option)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 any later version, as published by Free Softwar= +e Foundation.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 #day# Jule 2016 year.
+
+If possible, GPG-sign such email. Do not include anything else
+valuable in this email that you do not want to be stored forever in
+public.
+
+Dear contributors, when replying to this email, please do not send
+copy to other contributors -- save their inbox storage.
+
+Thank you in advance for one more contribution.
+
+--
+Accept: text/plain, text/x-diff
+Accept-Language: eo,en,ru
+X-Web-Site: sinsekvu.github.io
+
+ +--047d7b3a8d24a8fb78053812a524-- + diff --git a/docs/legal/Steven_Armstrong.email b/docs/legal/Steven_Armstrong.email new file mode 100644 index 00000000..02951a32 --- /dev/null +++ b/docs/legal/Steven_Armstrong.email @@ -0,0 +1,57 @@ +From kaction Thu Jul 21 00:55:04 2016 +Return-path: +Envelope-to: KAction@gnu.org +Delivery-date: Wed, 20 Jul 2016 17:51:39 -0400 +Received: from fencepost.gnu.org [208.118.235.10] + by searing with POP3 (fetchmail-6.3.26) + for (single-drop); Thu, 21 Jul 2016 00:55:04 +0300 (MSK) +Received: from eggs.gnu.org ([2001:4830:134:3::10]:42614) + by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) + (Exim 4.82) + (envelope-from ) + id 1bPzP1-0005f6-89 + for KAction@gnu.org; Wed, 20 Jul 2016 17:51:39 -0400 +Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) + (envelope-from ) + id 1bPzOx-00032C-RS + for KAction@gnu.org; Wed, 20 Jul 2016 17:51:38 -0400 +X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org +X-Spam-Level: +X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD + autolearn=disabled version=3.3.2 +Received: from wolke.armstrong.cc ([136.243.209.126]:37928) + by eggs.gnu.org with esmtp (Exim 4.71) + (envelope-from ) + id 1bPzOx-00031o-L9 + for KAction@gnu.org; Wed, 20 Jul 2016 17:51:35 -0400 +Sender: steven@armstrong.cc +Subject: Re: cdist contribution relicensing +To: Dmitry Bogatov +References: +From: Steven Armstrong +Message-ID: +Date: Wed, 20 Jul 2016 23:51:28 +0200 +MIME-Version: 1.0 +In-Reply-To: +Content-Type: text/plain; charset=windows-1252; format=flowed +Content-Transfer-Encoding: 7bit +X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] +X-Received-From: 136.243.209.126 +X-UIDL: b-6"!eP*"!*!D"!c+f!! + +Dmitry Bogatov wrote on 07/20/16 17:09: +> I, #name# <#email#> permit to relicense all my contribution to +> cdist project, source code https://github.com/ungleich/cdist +> to GNU General Public license, version 3 or (at your option) +> any later version, as published by Free Software Foundation. +> +> #day# Jule 2016 year. + +I, Steven Armstrong , permit to re-license +all my contribution to the cdist project source code +https://github.com/ungleich/cdist to GNU General Public license, version +3 or (at your option) any later version, as published by Free Software +Foundation. + +20 July 2016 + diff --git a/docs/legal/Thomas_Oettli.email b/docs/legal/Thomas_Oettli.email new file mode 100644 index 00000000..eb515a59 --- /dev/null +++ b/docs/legal/Thomas_Oettli.email @@ -0,0 +1,342 @@ +From kaction Tue Aug 2 13:59:41 2016 +Return-path: +Envelope-to: KAction@gnu.org +Delivery-date: Tue, 02 Aug 2016 05:50:23 -0400 +Received: from fencepost.gnu.org [208.118.235.10] + by searing with POP3 (fetchmail-6.3.26) + for (single-drop); Tue, 02 Aug 2016 13:59:41 +0300 (MSK) +Received: from eggs.gnu.org ([2001:4830:134:3::10]:41424) + by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) + (Exim 4.82) + (envelope-from ) + id 1bUWL9-0006S9-Ft + for KAction@gnu.org; Tue, 02 Aug 2016 05:50:23 -0400 +Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) + (envelope-from ) + id 1bUWL1-0007oE-Eo + for KAction@gnu.org; Tue, 02 Aug 2016 05:50:21 -0400 +X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org +X-Spam-Level: +X-Spam-Status: No, score=0.9 required=5.0 tests=BAYES_50,HTML_MESSAGE, + RCVD_IN_DNSWL_NONE,TVD_FW_GRAPHIC_NAME_MID autolearn=disabled version=3.3.2 +Received: from mail2.sfsservices.biz ([194.93.112.42]:43385) + by eggs.gnu.org with esmtp (Exim 4.71) + (envelope-from ) + id 1bUWKe-0007eL-5Z + for KAction@gnu.org; Tue, 02 Aug 2016 05:50:15 -0400 +X-Received: from localhost (localhost [127.0.0.1]) + by mail2.sfsservices.biz (Postfix) with ESMTP id B80B68BEA15B + for ; Tue, 2 Aug 2016 11:49:19 +0200 (CEST) +X-Virus-Scanned: amavisd-new at sfsservices.biz +X-Received: from mail2.sfsservices.biz ([127.0.0.1]) + by localhost (mail2.sfsservices.biz [127.0.0.1]) (amavisd-new, port 10023) + with ESMTP id Kq9SpRTVO-tm for ; + Tue, 2 Aug 2016 11:49:19 +0200 (CEST) +X-Received: from chsfsd15.sfs-intra.net (chsfsln0002.sfs-intra.net [INTERNAL-IP]) + by mail2.sfsservices.biz (Postfix) with ESMTP + for ; Tue, 2 Aug 2016 11:49:19 +0200 (CEST) +In-Reply-To: +References: +Subject: Antwort: cdist contribution relicensing +X-KeepSent: A672E59F:C63BD8B2-C1258003:0035E697; + type=4; name=$KeepSent +To: Dmitry Bogatov +X-Mailer: IBM Notes Release 9.0.1 October 14, 2013 +Message-ID: +From: Thomas Oettli +Date: Tue, 2 Aug 2016 11:49:18 +0200 +X-MIMETrack: Serialize by Router on chsfsd15/SFS(Release 9.0.1FP6|April 20, 2016) at + 02.08.2016 11:49:19 +MIME-Version: 1.0 +Content-type: multipart/related; + Boundary="0__=4EBB0A90DFA660078f9e8a93df938690918c4EBB0A90DFA66007" +X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] +X-Received-From: 194.93.112.42 +X-UIDL: Jb%#!^\~!!pT3"!DD="! + +--0__=4EBB0A90DFA660078f9e8a93df938690918c4EBB0A90DFA66007 +Content-type: multipart/alternative; + Boundary="1__=4EBB0A90DFA660078f9e8a93df938690918c4EBB0A90DFA66007" + +--1__=4EBB0A90DFA660078f9e8a93df938690918c4EBB0A90DFA66007 +Content-type: text/plain; charset=UTF-8 +Content-transfer-encoding: quoted-printable + + +I, Thomas Oettli permit to relicense all my contribution= + to +cdist project, source code https://github.com/ungleich/cdist +to GNU General Public license, version 3 or (at your option) +any later version, as published by Free Software Foundation. + + + +Thomas Oettli +Systemengineer SAP & Linux + +SFS services AG, Corporate IT +Rosenbergsaustrasse 8, CH-9435 Heerbrugg +T +41 71 72 75269 F +41 71 72 75237 +thomas.oettli@sfs.biz www.sfs.biz + + + +Denken Sie an die Umwelt bevor Sie drucken. - Please consider your +environment before printing. + + + + +Von: Dmitry Bogatov +An: Andi Br=C3=B6nnimann , Benedikt Koeppel + , Chase Allen James + , Christian G. Warden , + Daniel Heule , Daniel Maher , Dominique Roux , + Evax Software , Giel van Schijndel , Jake Guffey , J= +ake + Guffey , Nico Schottelius + , Ramon Salvad=C3=B3 + , Ricardo Catalinas Jim=C3=A9nez + , Steven Armstrong + , Thomas Oettli +Kopie: Darko Poljak , Nico Schottelius + +Datum: 20.07.2016 17:11 +Betreff: cdist contribution relicensing + + + + +Hello, dear contributors of cdist project! + +Recently we discovered licensing issue with your contribution. Namely, +while most of code is GPLv3+, including some of code written by you, +manpages (man.txt, now man.rst) are GPLv3 only licensed. + +On behalf of cdist releasers (Darko and Nico), I (another cdist +contributor and cdist Debian maintainer) ask you to permit relicense +your contribution from GPLv3 to GPLv3+. Without your permission, we +would be stuck the day when GPLv4 come (hope it will never come, but +still), or have to reimplement your contribution. + +If you agree, please respond with something like + + I, #name# <#email#> permit to relicense all my contribution to + cdist project, source code https://github.com/ungleich/cdist + to GNU General Public license, version 3 or (at your option) + any later version, as published by Free Software Foundation. + + #day# Jule 2016 year. + +If possible, GPG-sign such email. Do not include anything else +valuable in this email that you do not want to be stored forever in +public. + +Dear contributors, when replying to this email, please do not send +copy to other contributors -- save their inbox storage. + +Thank you in advance for one more contribution. + +-- +Accept: text/plain, text/x-diff +Accept-Language: eo,en,ru +X-Web-Site: sinsekvu.github.io +[Anhang "attsga4c.dat" gel=C3=B6scht von Thomas Oettli/otho/SFS]= + +--1__=4EBB0A90DFA660078f9e8a93df938690918c4EBB0A90DFA66007 +Content-type: text/html; charset=UTF-8 +Content-Disposition: inline +Content-transfer-encoding: quoted-printable + + +

I, Thomas Oettli <otho@sfs.biz> permit to= + relicense all my contribution to
+cdist project, source code
https://github.com/ungleich/cdist
+to GNU General Public license, version 3 or (at your option)
+any later version, as published by Free Software Foundation.

+
+
+
+Thomas Oettli
+Systemengineer SAP & Linux

+
+SFS services AG, Corporate IT
+Rosenbergsaustrasse 8, CH-9435 Heerbrugg
+T +41 71 72 75269   F +41 71 72 75237  

+
thomas.oettli@sfs.biz      www.sfs.biz
+
+
+
+3D"Denken
+
+
+3D"InactiveDmitry Bogatov ---20.07.2016 17:11:48---Hello, dear contribu= +tors of cdist project! Recently we discovered licensing issue with your= + contribu
+
+Von: Dmitry Bogatov <KAction@gnu.org>= +
+An: Andi Br=C3=B6nnimann <andi-cdist@v-n= +et.ch>, Benedikt Koeppel <code@benediktkoeppel.ch>, Chase Alle= +n James <nx-cdist@nu-ex.com>, Christian G. Warden <cwarden@xer= +us.org>, Daniel Heule <hda@sfs.biz>, Daniel Maher <phrawzty= ++cdist@gmail.com>, Dominique Roux <dominique.roux4@gmail.com>,= + Evax Software <contact@evax.fr>, Giel van Schijndel <giel+cdi= +st@mortis.eu>, Jake Guffey <jake.guffey@eprotex.com>, Jake Guf= +fey <jake.guffey@jointheirstm.org>, Nico Schottelius <nico-cdi= +st@schottelius.org>, Ramon Salvad=C3=B3 <rsalvado@gnuine.com>,= + Ricardo Catalinas Jim=C3=A9nez <jimenezrick@gmail.com>, Steven A= +rmstrong <steven-cdist@armstrong.cc>, Thomas Oettli <otho@sfs.= +biz>
+Kopie: Darko Poljak <darko.poljak@gmail.= +com>, Nico Schottelius <nico.schottelius@ungleich.ch> +Datum: 20.07.2016 17:11
+Betreff: = +cdist contribution relicensing
+



+
+
+
+Hello, dear contributors of cdist project!
+
+Recently we discovered licensing issue with your contribution. Namely,<= +br> +while most of code is GPLv3+, including some of code written by you, +manpages (man.txt, now man.rst) are GPLv3 only licensed.
+
+On behalf of cdist releasers (Darko and Nico), I (another cdist
+contributor and cdist Debian maintainer) ask you to permit relicense +your contribution from GPLv3 to GPLv3+. Without your permission, we
= + +would be stuck the day when GPLv4 come (hope it will never come, but +still), or have to reimplement your contribution.
+
+If you agree, please respond with something like
+
+ I, #name# <#email#> permit to relicense all my contribution to= +
+ cdist project, source code
https://github.com/ungleich/cdist
+ to GNU General Public license, version 3 or (at your option)
+ any later version, as published by Free Software Foundation.
+
+        #day# Jule 2016 year.
+
+If possible, GPG-sign such email. Do not include anything else
+valuable in this email that you do not want to be stored forever in
= + +public.
+
+Dear contributors, when replying to this email, please do not send
+copy to other contributors -- save their inbox storage.
+
+Thank you in advance for one more contribution.
+
+--
+Accept: text/plain, text/x-diff
+Accept-Language: eo,en,ru
+X-Web-Site: sinsekvu.github.io
+[Anhang "attsga4c.dat" gel=C3=B6scht von Thomas Oettli/otho/S= +FS]

+= + + +--1__=4EBB0A90DFA660078f9e8a93df938690918c4EBB0A90DFA66007-- + + +--0__=4EBB0A90DFA660078f9e8a93df938690918c4EBB0A90DFA66007 +Content-type: image/gif; + name="16993833.gif" +Content-Disposition: inline; filename="16993833.gif" +Content-ID: <1__=4EBB0A90DFA660078f9e8a93df@sfs-intra.net> +Content-transfer-encoding: base64 + +R0lGODlhVgAqAOUAAPA4IP////AwGPAoEPi4sPBIMPAwEPCAcPiYkPA4GPBwYPjAuPCQgPiooOgg +CPBYSOggAPBAKPAoCPBQOPCIePCIgPiYiPjQyPB4aPigkOgYAPBoWOgoCPBgSPBgUPBoUPCYiPjw +8PBYQPCYkPigmPjAsPjIwPjg2Pjo4Pjw6OgoEPAgCPBIOPjY0PjY2Pjg4PBQQPB4YPCAePCQiPio +mPiwqPjo6PAgAPBAMPBwWPCAaPiQiPiwoPjIyPjQ0Pj48CwAAAAAVgAqAEAI/wADCBTogwIMAAgT +KlwIIAKDgRApTChAsaLFixU9uIAIEYUFDxhDVpyQQWABhgAEbJjBoKXLly4RhIC4YADDBB1kHNjJ +s+fOGhBRpnzgsyhPCicGpoAgtClDBy8E1nRKFSGHgSiYVnUKwQYCm1udCjggFaxCAyU5qlWLgENY +sRTWyp1Lt67du3gHOhDwtq/fv2EFqBA4gS9ghQ7KHk6YWOADw4sRehAqoLLlywIMDJAgQ+0CFSgT +WDaQOTNpA6htDpxAGfVo05k5DNiRV+4ByAklKF5ooEHt3xAx4E54e3ECCCY4amAIoQXwDcP9aiAg +8EOCyNizbxVgQeAFrYcFKP8Y6DZyAYgn9i42QAFE9L8rfAeYuh6DQAbv/UogIZQF8IH0nUUDcBKg +NMF/LjiAnW4AmnUYgxesEFkCA6i1AQQDYKbhewnAsBtDG2poAAc/cBTCAxCQFmJl16H0gUAnZACC +BSOMQKMFCOCIwIwIYOBgQgZ8CCQJ/wUQQg0NJKnkkkrywMCPCEWgXUMNMoQWgVMOBEIHD3TpJZcP +dAAmmBuAEJVcFyjAQgEfUFdkABKJJJIIFFygFgEODKDnnnz26eefgAYq6KCE6nkDdSdNqeiiKZEl +kA04cJCfU6RB9N2kTiWggZ0ciaCeX6oZCd5iFQbQA2iRNSaQgthF8AKrrQr/CViQAaAAa2QsWIfS +iiJqEJesCfFq2QARDCRCiwuJJqxlEIwn1IFFBgikfLUVyNB5wCW6kEoMVODtt95SYEFya0mLkAA5 +kIDAuuy2m6ObAr1nAAYZuNtuA85xhN96A6RAE5R9qSRQcYdVOlAByAImwANVRrbCQFJGJoAHA7Xw +qcIVABswxQOZAAGmVAkwwp0MGMWTj7tqLEIMCrTs8sstzzBXCDQcADPMHxiAEra/QccQg+YCYACR +b+YVw3sBeJBiZafx+iywVwKHAYaoVW311fk9wFp2DnAadNS1RbzgBWIvBgEKAxEAJdh56YydBhsF +IECGCdRttwCi2a13Zg5MUOAvRwh8fK4D4/03gNtvieZABEkV7fjjRZtAwOSUV2755SVcrjnmmxOQ +eeecb77AQBcsx+jpkWmQQtmotx4wBsK5LvtbA8inA+uz555Q4QEBADs= + +--0__=4EBB0A90DFA660078f9e8a93df938690918c4EBB0A90DFA66007 +Content-type: image/gif; + name="16816884.gif" +Content-Disposition: inline; filename="16816884.gif" +Content-ID: <2__=4EBB0A90DFA660078f9e8a93df@sfs-intra.net> +Content-transfer-encoding: base64 + +R0lGODlhNgEiAOQAAP///wCAAACIAJiIAACImACguOj4+Pj40HDI6PjgmND4+Pj46ACIcLigALjw ++OjIcAC40NC4APjw0NDw+HCIAJigAJjg+LjI0LjI6NDIuOjIuOj40PjwuAAAAAAAAAAAACwAAAAA +NgEiAEAI/wABCBxIsKDBgwgTKlzIsKHDhxAjSpxIsaLFixgzClzQQIDHjx4LGFAYoGBJACdRCgxw +suXKlzBZwhyYkqDLmTNb3qS58mbKmipt9hyq8idPo0GBykx6tGlMpQd3QkWpM2fMq0GT7tQo8YFH +BFzDih1LtqzZs2gRDgDJtq0ABg4SJvBIwCTLpUxxYhWqd2revzyzStVb1KpgwkgT50X6d/Bex34h +G2YceXJgn5cDp93MubPnz6BDP5zL1oLo06hTq15d0avbryT5Hp6N+bFJvo4v57Y8WzZlzb+xKq3d +W/HtzL150xauHOjFtWAFSqjwunrbujbvMmYd1aBz7rJB+/9diFfs970R11r3CHchaQHYNfsuL/Mn +/fI0a94Fnp/y/p7byfcfgFv1x59yVAUXXIIH0kdVdv5tN+BRCurWWH6ATRQBBOB16OGHIKJ1gHoh +jUReeA2d55B+aano3XFcFeiiRSxKNCNCN6YmwQQAjAgSAQoAsGNCU2kHGV5GGobjUxMSqCRvSaKY +m0slVUkgcZNp95JksWnVpHHLQdjfUgGKSOJ6QIao5ppsonbmRwVs8OZ6P7Zp5514hjXnW3E15GOd +4Ul1n36DRkWoUYXmZCWATtGGZGbDIToYlYxuKSlRlRalE4uJ/jfgok1q2hSVmzJ1X1YD7VldmgiR +Fh9hGSb/hx6Mzb14IaqI3QqmfJYRB+aUuc66q22y+lbrYsjhCoCqIjnk2kev5mmetNQqG2Oo1War +7bbc/ckqt+CGK65BC1zgrQIZmEiklhHlSNKnZhXYHYoYyRgvvA+5S2uIHLXVbJfAPfookxTa+hh+ +mVb5XX2KOlfkgxArKLCDneqGaKANG2pqcRJfClq/1f07b7KSVYgYvmWSDKOv+wJbGKjIVbYcl3YN +HOCvyW7ZIK+dvQdSewDPGqa8N+MG67E7W9uXkpTCfJzMDutqMLJLEpshlk9uBrJ1HOLIroHH4qvs +1/Yt7PTYnoLtnYNMC2gzp4cGOnDNERpKJoT2NTi3vGRp1hAkQa5FN9ABGIxr+OHVBo744oyntta/ +W9P5WrSNV245Rup1rdCfaNLKN5v6Xj7y0ft2FvpBqrol+EHvRVsjzbA/nSWxPh1pLM4Q663z7nc/ +5XvEs1/Nsq67AW9877UL51zqr61eEAcUwFe6l0h+Wv2XKzNts8W9CxU72mlfNbzUWYZ/NffDl40f +7sZ9TxDzbIl8UAR0Tc9l98WnrzL5sRaHINK44x/7cna8mO0PV8jbn/5yl6r1yK9VgBLdiSR4mtNR +ZHk/65ND6HcdCnrwgyAMoQhDExAAOw== + +--0__=4EBB0A90DFA660078f9e8a93df938690918c4EBB0A90DFA66007 +Content-type: image/gif; + name="graycol.gif" +Content-Disposition: inline; filename="graycol.gif" +Content-ID: <3__=4EBB0A90DFA660078f9e8a93df@sfs-intra.net> +Content-transfer-encoding: base64 + +R0lGODlhEAAQAKECAMzMzAAAAP///wAAACH5BAEAAAIALAAAAAAQABAAAAIXlI+py+0PopwxUbpu +ZRfKZ2zgSJbmSRYAIf4fT3B0aW1pemVkIGJ5IFVsZWFkIFNtYXJ0U2F2ZXIhAAA7 + +--0__=4EBB0A90DFA660078f9e8a93df938690918c4EBB0A90DFA66007-- + + diff --git a/docs/man/index.rst b/docs/man/index.rst deleted file mode 100644 index f0638779..00000000 --- a/docs/man/index.rst +++ /dev/null @@ -1,12 +0,0 @@ -Welcome to cdist documentation -============================== - -Contents: - -.. toctree:: - :titlesonly: - :glob: - :numbered: - - man1/* - man7/* diff --git a/docs/man/man7/cdist-tutorial.rst b/docs/man/man7/cdist-tutorial.rst deleted file mode 100644 index 4899dcb0..00000000 --- a/docs/man/man7/cdist-tutorial.rst +++ /dev/null @@ -1,55 +0,0 @@ -cdist-tutorial(7) -================= -A guided introduction into cdist - -Nico Schottelius - - -INTRODUCTION ------------- -This document gives you a pointer on what to read in -which order and is thus a "guide to the right locations". -So in case you are just starting, just "begin at the beginning" -(Brave New World). You can see the target audience in [] brackets -after the description. - -cdist-quickstart - New to cdist? Want to get your hands dirty? Read this. [beginner] - -cdist-bootstrap - The comprehensive guide to your first cdist installation [beginner] - -cdist-manifest - Learn how to define which hosts get which configurations [beginner] - -cdist-type - Understand how types are working and created [intermediate] - -cdist-best-practice - Hints from real life experience to help you to organise cdist [intermediate] - -cdist-reference - The type, explorers and environment variables reference [intermediate] - -cdist-explorer - Interested in getting more information about the target system? [intermediate] - -cdist-stages - Understand the internal workflow of cdist. [advanced] - -cdist-hacker - README, if you want to extend or modify cdist. [hacker] - - -SEE ALSO --------- -- `cdist(1) <../man1/cdist.html>`_ -- `cdist-type(7) `_ -- `cdist-best-practice(7) `_ -- `cdist-stages(7) `_ -- Brave New World by Aldous Huxley - -COPYING -------- -Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/docs/speeches/2015-10-21-opennebulaconf-cdist.odp b/docs/speeches/2015-10-21-opennebulaconf-cdist.odp new file mode 100644 index 00000000..f76ba9c3 Binary files /dev/null and b/docs/speeches/2015-10-21-opennebulaconf-cdist.odp differ diff --git a/docs/man/Makefile b/docs/src/Makefile similarity index 91% rename from docs/man/Makefile rename to docs/src/Makefile index 721acaf6..2ecf7a32 100644 --- a/docs/man/Makefile +++ b/docs/src/Makefile @@ -5,17 +5,19 @@ SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = -BUILDDIR = _build +BUILDDIR = ../dist +# for cache, etc. +_BUILDDIR = _build # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) - $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/) + $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/) endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +ALLSPHINXOPTS = -d $(_BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . @@ -52,6 +54,7 @@ help: .PHONY: clean clean: rm -rf $(BUILDDIR)/* + rm -rf $(_BUILDDIR)/* .PHONY: html html: @@ -161,7 +164,11 @@ text: .PHONY: man man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + $(SPHINXBUILD) -b cman $(ALLSPHINXOPTS) $(BUILDDIR)/man + mkdir -p $(BUILDDIR)/man/man1 + mkdir -p $(BUILDDIR)/man/man7 + mv -f $(BUILDDIR)/man/*.1 $(BUILDDIR)/man/man1/ + mv -f $(BUILDDIR)/man/*.7 $(BUILDDIR)/man/man7/ @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." diff --git a/docs/man/man7/cdist-best-practice.rst b/docs/src/cdist-best-practice.rst similarity index 91% rename from docs/man/man7/cdist-best-practice.rst rename to docs/src/cdist-best-practice.rst index 13d65cce..493f1506 100644 --- a/docs/man/man7/cdist-best-practice.rst +++ b/docs/src/cdist-best-practice.rst @@ -1,11 +1,8 @@ -cdist-best-practice(7) -====================== +Best practice +============= Practices used in real environments -Nico Schottelius - - -PASSWORDLESS CONNECTIONS +Passwordless connections ------------------------ It is recommended to run cdist with public key authentication. This requires a private/public key pair and the entry @@ -13,7 +10,7 @@ This requires a private/public key pair and the entry See sshd_config(5) and ssh-keygen(1). -SPEEDING UP SSH CONNECTIONS +Speeding up ssh connections --------------------------- When connecting to a new host, the initial delay with ssh connections is pretty big. You can work around this by @@ -27,7 +24,7 @@ inclusion into your ~/.ssh/config:: ControlPersist 10 -SPEEDING UP SHELL EXECUTION +Speeding up shell execution ---------------------------- On the source host, ensure that /bin/sh is *not* bash: bash is quite slow for script execution. Instead, you could use dash after installing it:: @@ -35,7 +32,7 @@ script execution. Instead, you could use dash after installing it:: ln -sf /bin/dash /bin/sh -MULTI MASTER OR ENVIRONMENT SETUPS +Multi master or environment setups ---------------------------------- If you plan to distribute cdist among servers or use different environments, you can do so easily with the included version @@ -61,7 +58,7 @@ you can clone it multiple times:: machine-b % git clone git://your-git-server/cdist -SEPERATING WORK BY GROUPS +Separating work by groups ------------------------- If you are working with different groups on one cdist-configuration, you can delegate to other manifests and have the groups edit only @@ -74,7 +71,7 @@ their manifests. You can use the following snippet in sh -e "$__manifest/cbrg" -MAINTAINING MULTIPLE CONFIGURATIONS +Maintaining multiple configurations ----------------------------------- When you need to manage multiple sites with cdist, like company_a, company_b and private for instance, you can easily use git for this purpose. @@ -135,7 +132,7 @@ The following **.git/config** is taken from a a real world scenario:: Have a look at git-remote(1) to adjust the remote configuration, which allows -MULTIPLE DEVELOPERS WITH DIFFERENT TRUST +Multiple developers with different trust ---------------------------------------- If you are working in an environment that requires different people to work on the same configuration, but having different privileges, you can @@ -152,7 +149,7 @@ implement this scenario with a gateway host and sudo: For more details consult sudoers(5) -TEMPLATING +Templating ---------- * 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 @@ -190,7 +187,7 @@ TEMPLATING --source "$__object/files/basic.conf" -TESTING A NEW TYPE +Testing a new type ------------------ If you want to test a new type on a node, you can tell cdist to only use an object of this type: Use the '--initial-manifest' parameter @@ -211,7 +208,7 @@ of cdist: cdist --initial-manifest - cdist-dev-01.ungleich.ch -OTHER CONTENT IN CDIST REPOSITORY +Other content in cdist repository --------------------------------- Usually the cdist repository contains all configuration items. Sometimes you may have additional resources that @@ -224,15 +221,3 @@ in the repository for such content: It allows you to easily distinguish what is used by cdist and what not and also to store all important files in one repository. - - -SEE ALSO --------- -- `cdist(1) <../man1/cdist.html>`_ -- `cdist-tutorial(7) `_ - - -COPYING -------- -Copyright \(C) 2011-2013 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/docs/man/man7/cdist-bootstrap.rst b/docs/src/cdist-bootstrap.rst similarity index 86% rename from docs/man/man7/cdist-bootstrap.rst rename to docs/src/cdist-bootstrap.rst index df55e2af..c9972a99 100644 --- a/docs/man/man7/cdist-bootstrap.rst +++ b/docs/src/cdist-bootstrap.rst @@ -1,18 +1,11 @@ -cdist-bootstrap(7) -================== -Setup cdist environment - -Nico Schottelius - - -INTRODUCTION ------------- +Bootstrap +========= This document describes the usual steps recommended for a new cdist setup. It is recommended that you have read and understood -cdist-quickstart(7) before digging into this. +`cdist quickstart `_ before digging into this. -LOCATION +Location --------- First of all, you should think about where to store your configuration database and who will be accessing or changing it. Secondly you have to @@ -26,13 +19,13 @@ relies on is recommended, for use as backup as well as to allow easy collaborati with others. For more sophisticated setups developing cdist configurations with multiple -people, have a look at cdist-best-practice(7). +people, have a look at `cdist best practice `_. -SETUP WORKING DIRECTORY AND BRANCH +Setup working directory and branch ---------------------------------- I assume you have a fresh copy of the cdist tree in ~/cdist, cloned from -one of the official urls (see cdist-quickstart(7) if you don't). +one of the official urls (see `cdist quickstart `_ if you don't). Entering the command "git branch" should show you "* master", which indicates you are on the **master** branch. @@ -82,7 +75,7 @@ In this tutorial I use the branch **mycompany**:: From now on, you can use git as usual to commit your changes in your own branch. -PUBLISHING THE CONFIGURATION +Publishing the configuration ---------------------------- Usually a development machine like a notebook should be considered temporary only. For this reason and to enable shareability, the configuration @@ -111,7 +104,7 @@ branch with the **master** branch on the host **loch**. Thus you can commit as usual in your branch and push out changes by entering **git push**. -UPDATING FROM ORIGIN +Updating from origin -------------------- Whenever you want to update your cdist installation, you can use git to do so:: @@ -123,15 +116,3 @@ Whenever you want to update your cdist installation, you can use git to do so:: # Alternative: Update current branch with 2.0 branch from origin cdist% git merge origin/2.0 - - -SEE ALSO --------- -- `cdist(1) <../man1/cdist.html>`_ -- `cdist-tutorial(7) `_ - - -COPYING -------- -Copyright \(C) 2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/docs/man/man7/cdist-explorer.rst b/docs/src/cdist-explorer.rst similarity index 76% rename from docs/man/man7/cdist-explorer.rst rename to docs/src/cdist-explorer.rst index 1bbd7e75..4bb61d7a 100644 --- a/docs/man/man7/cdist-explorer.rst +++ b/docs/src/cdist-explorer.rst @@ -1,11 +1,7 @@ -cdist-explorer(7) -================= -Explore the target systems +Explorer +======== -Nico Schottelius - - -DESCRIPTION +Description ----------- Explorer are small shell scripts, which will be executed on the target host. The aim of the explorer is to give hints to types on how to act on the @@ -36,7 +32,7 @@ error message on stderr, which will cause cdist to abort. You can also use stderr for debugging purposes while developing a new explorer. -EXAMPLES +Examples -------- A very simple explorer may look like this:: @@ -56,16 +52,3 @@ A type explorer, which could check for the status of a package may look like thi # Expect dpkg failing, if package is not known / installed dpkg -s "$name" 2>/dev/null || exit 0 - - -SEE ALSO --------- -- `cdist(1) <../man1/cdist.html>`_ -- `cdist-reference(7) `_ -- `cdist-stages(7) `_ - - -COPYING -------- -Copyright \(C) 2010-2014 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/docs/src/cdist-features.rst b/docs/src/cdist-features.rst new file mode 100644 index 00000000..7018d248 --- /dev/null +++ b/docs/src/cdist-features.rst @@ -0,0 +1,48 @@ +Features +======== + +But cdist ticks differently, here is the feature set that makes it unique: + +Simplicity + There is only one type to extend cdist called **type** + +Design + + Type and core cleanly separated + + Sticks completly to the KISS (keep it simple and stupid) paradigma + + Meaningful error messages - do not lose time debugging error messages + + Consistency in behaviour, naming and documentation + + No surprise factor: Only do what is obviously clear, no magic + + Define target state, do not focus on methods or scripts + + Push architecture: Instantly apply your changes + +Small core + cdist's core is very small - less code, less bugs + +Fast development + Focus on straightforwardness of type creation is a main development objective + Batteries included: A lot of requirements can be solved using standard types + +Modern Programming Language + cdist is written in Python + +Requirements, Scalability + No central server needed, cdist operates in push mode and can be run from any computer + +Requirements, Scalability, Upgrade + cdist only needs to be updated on the master, not on the target hosts + +Requirements, Security + Uses well-know `SSH `_ as transport protocol + +Requirements, Simplicity + Requires only shell and SSH server on the target + +UNIX + Reuse of existing tools like cat, find, mv, ... + +UNIX, familar environment, documentation + Is available as manpages and HTML + +UNIX, simplicity, familar environment + cdist is configured in POSIX shell + diff --git a/docs/man/man7/cdist-hacker.rst b/docs/src/cdist-hacker.rst similarity index 87% rename from docs/man/man7/cdist-hacker.rst rename to docs/src/cdist-hacker.rst index 1d0e7f2e..efc5da4b 100644 --- a/docs/man/man7/cdist-hacker.rst +++ b/docs/src/cdist-hacker.rst @@ -1,11 +1,7 @@ -cdist-hacker(7) -=============== -How to get (stuff) into cdist +Hacking +======= -Nico Schottelius - - -WELCOME +Welcome ------- Welcome dear hacker! I invite you to a tour of pointers to get into the usable configuration mangament system, cdist. @@ -16,14 +12,14 @@ twice before merging or implementing a feature: Less features with good usability are far better than the opposite. -REPORTING BUGS +Reporting bugs -------------- If you believe you've found a bug and verified that it is in the latest version, drop a mail to the cdist mailing list, subject prefixed with "[BUG] " or create an issue on github. -CODING CONVENTIONS (EVERYWHERE) +Coding conventions (everywhere) ------------------------------- If something should be better done or needs to fixed, add the word FIXME nearby, so grepping for FIXME gives all positions that need to be fixed. @@ -31,7 +27,7 @@ nearby, so grepping for FIXME gives all positions that need to be fixed. Indention is 4 spaces (welcome to the python world). -HOW TO SUBMIT STUFF FOR INCLUSION INTO UPSTREAM CDIST +How to submit stuff for inclusion into upstream cdist ----------------------------------------------------- If you did some cool changes to cdist, which you value as a benefit for everybody using cdist, you're welcome to propose inclusion into upstream. @@ -58,9 +54,9 @@ for inclusion to the mailinglist **cdist at cdist -- at -- l.schottelius.org** or open a pull request at http://github.com/telmich/cdist. -HOW TO SUBMIT A NEW TYPE +How to submit a new type ------------------------ -For detailled information about types, see cdist-type(7). +For detailed information about types, see `cdist type `_. Submitting a type works as described above, with the additional requirement that a corresponding manpage named man.text in asciidoc format with @@ -74,9 +70,11 @@ code and thus such a type introduces redundant functionality that is given by core cdist already. -EXAMPLE GIT WORKFLOW +Example git workflow --------------------- -The following workflow works fine for most developers:: +The following workflow works fine for most developers + +.. code-block:: sh # get latest upstream master branch git clone https://github.com/telmich/cdist.git @@ -122,6 +120,8 @@ The following workflow works fine for most developers:: If at any point you want to go back to the original master branch, you can use **git stash** to stash your changes away:: +.. code-block:: sh + # assume you are on documentation_cleanup git stash @@ -133,6 +133,8 @@ use **git stash** to stash your changes away:: Similar when you want to develop another new feature, you go back to the master branch and create another branch based on it:: +.. code-block:: sh + # change to master and update to most recent upstream version git checkout master git fetch -v origin @@ -142,17 +144,3 @@ to the master branch and create another branch based on it:: (you can repeat the code above for as many features as you want to develop in parallel) - - -SEE ALSO --------- -- `cdist(1) <../man1/cdist.html>`_ -- git(1) -- git-checkout(1) -- git-stash(1) - - -COPYING -------- -Copyright \(C) 2011-2013 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/docs/src/cdist-install.rst b/docs/src/cdist-install.rst new file mode 100644 index 00000000..38db1a4e --- /dev/null +++ b/docs/src/cdist-install.rst @@ -0,0 +1,130 @@ +How to install cdist +==================== + +Requirements +------------- + +Source Host +~~~~~~~~~~~ + +This is the machine you use to configure the target hosts. + + * /bin/sh: A posix like shell (for instance bash, dash, zsh) + * Python >= 3.2 + * SSH client + * sphinx (for building html docs and/or the man pages) + +Target Hosts +~~~~~~~~~~~~ + + * /bin/sh: A posix like shell (for instance bash, dash, zsh) + * SSH server + +Install cdist +------------- + +You can install cdist either from git or as a python package. + +From git +~~~~~~~~ + +Cloning cdist from git gives you the advantage of having +a version control in place for development of your own stuff +immediately. + +To install cdist, execute the following commands: + +.. code-block:: sh + + git clone https://github.com/ungleich/cdist.git + cd cdist + export PATH=$PATH:$(pwd -P)/bin + +Available versions in git +^^^^^^^^^^^^^^^^^^^^^^^^^ + + * The active development takes place in the **master** branch + * The released versions can be found in the tags + +Other branches may be available for features or bugfixes, but they +may vanish at any point. To select a specific branch use + +.. code-block:: sh + + # Generic code + git checkout -b origin/ + +So for instance if you want to use and stay with version 4.1, you can use + +.. code-block:: sh + + git checkout -b 4.1 origin/4.1 + +Git mirrors +^^^^^^^^^^^ + +If the main site is down, you can acquire cdist from one of the following sites: + + * git://github.com/telmich/cdist.git `github `_ + * git://git.code.sf.net/p/cdist/code `sourceforge `_ + +Building and using documentation (man and html) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you want to build and use the documentation, run: + +.. code-block:: sh + + make docs + +Documentation comes in two formats, man pages and full HTML +documentation. Documentation is built into distribution's +docs/dist directory. man pages are in docs/dist/man and +HTML documentation in docs/dist/html. + +If you want to use man pages, run: + +.. code-block:: sh + + export MANPATH=$MANPATH:$(pwd -P)/docs/dist/man + +Or you can move man pages from docs/dist/man directory to some +other directory and add it to MANPATH. + +Full HTML documentation can be accessed at docs/dist/html/index.html. + +You can also build only man pages or only html documentation, for +only man pages run: + +.. code-block:: sh + + make man + +for only html documentation run: + +.. code-block:: sh + + make html + +You can also build man pages for types in your ~/.cdist directory: + +.. code-block:: sh + + make dotman + +Built man pages are now in docs/dist/man directory. If you have +some other custom .cdist directory, e.g. /opt/cdist then use: + +.. code-block:: sh + + DOT_CDIST_PATH=/opt/cdist make dotman + +Python package +~~~~~~~~~~~~~~ + +Cdist is available as a python package at +`PyPi `_. You can install it using + +.. code-block:: sh + + pip install cdist diff --git a/docs/src/cdist-intro.rst b/docs/src/cdist-intro.rst new file mode 100644 index 00000000..fad40fe5 --- /dev/null +++ b/docs/src/cdist-intro.rst @@ -0,0 +1,15 @@ +cdist - usable configuration management +======================================= + +.. image:: cdist-logo.png + :alt: cdist-logo + +cdist is a usable configuration management system. +It adheres to the KISS principle and +is being used in small up to enterprise grade environments. +cdist is an alternative to other configuration management systems like + +* `bcfg2 `_ +* `chef `_ +* `cfengine `_ +* `puppet `_. diff --git a/docs/src/cdist-logo.png b/docs/src/cdist-logo.png new file mode 100644 index 00000000..13c27927 Binary files /dev/null and b/docs/src/cdist-logo.png differ diff --git a/docs/man/man7/cdist-manifest.rst b/docs/src/cdist-manifest.rst similarity index 90% rename from docs/man/man7/cdist-manifest.rst rename to docs/src/cdist-manifest.rst index c8984acf..b29cf0d8 100644 --- a/docs/man/man7/cdist-manifest.rst +++ b/docs/src/cdist-manifest.rst @@ -1,11 +1,7 @@ -cdist-manifest(7) -================= -(Re-)Use types +Manifest +======== -Nico Schottelius - - -DESCRIPTION +Description ----------- Manifests are used to define which objects to create. Objects are instances of **types**, like in object oriented programming languages. @@ -41,15 +37,15 @@ In general, manifests are used to define which types are used depending on given conditions. -INITIAL AND TYPE MANIFESTS +Initial and type manifests -------------------------- Cdist knows about two types of manifests: The initial manifest and type manifests. The initial manifest is used to define, which configurations to apply to which hosts. The type manifests are used to create objects -from types. More about manifests in types can be found in cdist-type(7). +from types. More about manifests in types can be found in `cdist type `_. -DEFINE STATE IN THE INITIAL MANIFEST +Define state in the initial manifest ------------------------------------ The **initial manifest** is the entry point for cdist to find out, which **objects** to configure on the selected host. @@ -57,8 +53,8 @@ Cdist expects the initial manifest at **cdist/conf/manifest/init**. Within this initial manifest you define, which objects should be created on which host. To distinguish between hosts, you can use the -environment variable **__target_host**. Let's have a look at a simple -example:: +environment variable **__target_host** and/or **__target_hostname** and/or +**__target_fqdn**. Let's have a look at a simple example:: __cdistmarker @@ -79,12 +75,12 @@ utilises cdist types. Every available type can be executed like a normal command. -SPLITTING UP THE INITIAL MANIFEST +Splitting up the initial manifest --------------------------------- If you want to split up your initial manifest, you can create other shell scripts in **cdist/conf/manifest/** and include them in **cdist/conf/manifest/init**. Cdist provides the environment variable **__manifest** to reference -the directory containing the initial manifest (see cdist-reference(7)). +the directory containing the initial manifest (see `cdist reference `_). The following example would include every file with a **.sh** suffix:: @@ -95,7 +91,7 @@ The following example would include every file with a **.sh** suffix:: done -DEPENDENCIES +Dependencies ------------ If you want to describe that something requires something else, just setup the variable "require" to contain the requirements. Multiple @@ -122,7 +118,7 @@ On line 4 you can see that the instantion of a type "\__link" object needs the object "__file/etc/cdist-configured" to be present, before it can proceed. This also means that the "\__link" command must make sure, that either -"\__file/etc/cdist-configured" allready is present, or, if it's not, it needs +"\__file/etc/cdist-configured" already is present, or, if it's not, it needs to be created. The task of cdist is to make sure, that the dependency will be resolved appropriately and thus "\__file/etc/cdist-configured" be created if necessary before "__link" proceeds (or to abort execution with an error). @@ -154,10 +150,10 @@ from the type that is calling them. This is called "autorequirement" in cdist jargon. You can find an more in depth description of the flow execution of manifests -in cdist-stages(7) and of how types work in cdist-type(7). +in `cdist execution stages `_ and of how types work in `cdist type `_. -CREATE DEPENDENCIES FROM EXECUTION ORDER +Create dependencies from execution order ----------------------------------------- You can tell cdist to execute all types in the order in which they are created in the manifest by setting up the variable CDIST_ORDER_DEPENDENCY. @@ -168,7 +164,7 @@ It essentially helps you to build up blocks of code that build upon each other (like first creating the directory xyz than the file below the directory). -OVERRIDES +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. @@ -184,7 +180,7 @@ CDIST_ORDER_DEPENDENCY will be ignored, because adding a dependency in case of overrides would result in circular dependencies, which is an error. -EXAMPLES +Examples -------- The initial manifest may for instance contain the following code: @@ -220,7 +216,7 @@ How to override objects: .. code-block:: sh - # for example in the inital manifest + # for example in the initial manifest # create user account foobar with some hash for password __user foobar --password 'some_fancy_hash' --home /home/foobarexample @@ -257,15 +253,3 @@ Dependencies defined by execution order work as following: require="__some_type_somewhere/id __sample_type/1" __sample_type 2 require="__sample_type/2" __example_type 23 __not_in_order_type 42 - - -SEE ALSO --------- -- `cdist-tutorial(7) `_ -- `cdist-type(7) `_ - - -COPYING -------- -Copyright \(C) 2010-2014 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/docs/man/man7/cdist-messaging.rst b/docs/src/cdist-messaging.rst similarity index 79% rename from docs/man/man7/cdist-messaging.rst rename to docs/src/cdist-messaging.rst index 6f29a363..ea35c404 100644 --- a/docs/man/man7/cdist-messaging.rst +++ b/docs/src/cdist-messaging.rst @@ -1,10 +1,7 @@ -cdist-messaging(7) -================== -How the initial manifest and types can communication +Messaging +========= -Nico Schottelius - -DESCRIPTION +Description ----------- cdist has a simple but powerful way of allowing communication between the initial manifest and types as well as types and types. @@ -24,11 +21,11 @@ This way overwriting any of the two files by accident does not interfere with other types. The order of execution is not defined unless you create dependencies -between the different objects (see cdist-manifest(7)) and thus you +between the different objects (see `cdist manifest `_) and thus you can only react reliably on messages by objects that you depend on. -AVAILABILITY +Availability ------------ Messaging is possible between all **local** scripts: @@ -38,7 +35,7 @@ Messaging is possible between all **local** scripts: - type/gencode-remote -EXAMPLES +Examples -------- When you want to emit a message use: @@ -95,17 +92,3 @@ Restart sshd on changes if grep -q "^__key_value/PermitRootLogin" "$__messages_in"; then echo $restart fi - - -SEE ALSO --------- -- `cdist(1) <../man1/cdist.html>`_ -- `cdist-manifest(7) `_ -- `cdist-reference(7) `_ -- `cdist-type(7) `_ - - -COPYING -------- -Copyright \(C) 2013 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/docs/src/cdist-os.rst b/docs/src/cdist-os.rst new file mode 100644 index 00000000..4f6b4820 --- /dev/null +++ b/docs/src/cdist-os.rst @@ -0,0 +1,16 @@ +Supported Operating Systems +=========================== + +cdist was tested or is know to run on at least + +* `Archlinux `_ +* `Debian `_ +* `CentOS `_ +* `Fedora `_ +* `FreeBSD `_ +* `Gentoo `_ +* `Mac OS X `_ +* `OpenBSD `_ +* `Redhat `_ +* `Ubuntu `_ +* `XenServer `_ diff --git a/docs/src/cdist-parallelization.rst b/docs/src/cdist-parallelization.rst new file mode 100644 index 00000000..ce9f5bca --- /dev/null +++ b/docs/src/cdist-parallelization.rst @@ -0,0 +1,73 @@ +Parallelization +=============== + +Description +----------- +cdist has two modes of parallel operation. + +One of them is to operate on each host in separate process. This is enabled +with :strong:`-p/--parallel` option. + +The other way is to operate in parallel within one host where you specify +the number of jobs. This is enabled with :strong:`-j/--jobs` option where you +can specify the number of parallel jobs. By default, +:strong:`multiprocessing.cpu_count()` is used. For this mode only global +explorers are currently supported and this option is still in :strong:`beta`. + +You can, of course, use those two options together. This means that each host +will be processed by its own process. Within each process cdist will operate +using specified number of parallel jobs. + +For more info on those options see :strong:`cdist`\ (1). + + +Examples +-------- + +.. code-block:: sh + + # Configure hosts read from file hosts.file in parallel + $ cdist config -p -f hosts.file + + # Configure hosts read from file hosts.file sequentially but using default + # number of parallel jobs + $ cdist config -b -j -f hosts.file + + # Configure hosts read from file hosts.file in parallel using 16 + # parallel jobs + $ cdist config -b -j 16 -p -f hosts.file + + +Caveats +------- +When operating in parallel, either by operating in parallel for each host +(-p/--parallel) or by parallel jobs within a host (-j/--jobs), and depending +on target SSH server and its configuration you may encounter connection drops. +This is controlled with sshd :strong:MaxStartups configuration options. +You may also encounter session open refusal. This happens with ssh multiplexing +when you reach maximum number of open sessions permitted per network +connection. In this case ssh will disable multiplexing. +This limit is controlled with sshd :strong:MaxSessions configuration +options. For more details refer to :strong:`sshd_config`\ (5). + +For example, if you reach :strong:`MaxSessions` sessions you may get the +following output: + +.. code-block:: sh + + $ cdist config -b -j 11 -v 78.47.116.244 + INFO: cdist: version 4.2.2-55-g640b7f9 + INFO: 78.47.116.244: Running global explorers + INFO: 78.47.116.244: Remote transfer in 11 parallel jobs + channel 22: open failed: administratively prohibited: open failed + mux_client_request_session: session request failed: Session open refused by peer + ControlSocket /tmp/tmpuah6fw_t/d886d4b7e4425a102a54bfaff4d2288b/ssh-control-path already exists, disabling multiplexing + INFO: 78.47.116.244: Running global explorers in 11 parallel jobs + channel 22: open failed: administratively prohibited: open failed + mux_client_request_session: session request failed: Session open refused by peer + ControlSocket /tmp/tmpuah6fw_t/d886d4b7e4425a102a54bfaff4d2288b/ssh-control-path already exists, disabling multiplexing + INFO: 78.47.116.244: Running initial manifest /tmp/tmpuah6fw_t/d886d4b7e4425a102a54bfaff4d2288b/data/conf/manifest/init + INFO: 78.47.116.244: Running manifest and explorers for __file/root/host.file + INFO: 78.47.116.244: Generating code for __file/root/host.file + INFO: 78.47.116.244: Finished successful run in 18.655028820037842 seconds + INFO: cdist: Total processing time for 1 host(s): 19.159148693084717 diff --git a/docs/man/man7/cdist-quickstart.rst b/docs/src/cdist-quickstart.rst similarity index 83% rename from docs/man/man7/cdist-quickstart.rst rename to docs/src/cdist-quickstart.rst index d1186ffe..7c967691 100644 --- a/docs/man/man7/cdist-quickstart.rst +++ b/docs/src/cdist-quickstart.rst @@ -1,28 +1,18 @@ -cdist-quickstart(7) -=================== -Jump in and enjoy cdist +Quickstart +========== -Nico Schottelius - - -INTRODUCTION ------------- This tutorial is aimed at people learning cdist and shows typical approaches as well as gives an easy start into the world of configuration management. -This tutorial assumes you are configuring **localhost**, because -it is always available. Just replace **localhost** with your target -host for real life usage. - - - -QUICK START - GET YOUR HANDS DIRTY NOW --------------------------------------- For those who just want to configure a system with the cdist configuration management and do not need (or want) to understand everything. +This tutorial assumes you are configuring **localhost**, because +it is always available. Just replace **localhost** with your target +host for real life usage. + Cdist uses **ssh** for communication and transportation and usually logs into the **target host** as the **root** user. So you need to configure the **ssh server** @@ -78,18 +68,12 @@ code into your shell to get started and configure localhost:: # Find out that cdist created /etc/cdist-configured ls -l /etc/cdist-configured +Note: cdist/conf is configuration directory shipped with cdist distribution. +If exists, ~/.cdist, is also automatically used as cdist configuration +directory. So in the above example you could create ~/.cdist directory, +then ~/.cdist/manifest sub-directory and create init manifest +~/.cdist/manifest/init. + That's it, you've successfully used cdist to configure your first host! Continue reading the next sections, to understand what you did and how to create a more sophisticated configuration. - - -SEE ALSO --------- -- `cdist(1) <../man1/cdist.html>`_ -- `cdist-tutorial(7) `_ - - -COPYING -------- -Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/docs/man/cdist-reference.rst.sh b/docs/src/cdist-reference.rst.sh similarity index 71% rename from docs/man/cdist-reference.rst.sh rename to docs/src/cdist-reference.rst.sh index 132d37b4..97b22473 100755 --- a/docs/man/cdist-reference.rst.sh +++ b/docs/src/cdist-reference.rst.sh @@ -29,20 +29,17 @@ __cdist_myname=${0##*/}; __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" filename="${__cdist_myname%.sh}" -dest="$__cdist_abs_mydir/man7/$filename" +dest="$__cdist_abs_mydir/$filename" cd "$__cdist_abs_mydir" exec > "$dest" cat << eof -cdist-reference(7) -================== +Reference +========= Variable, path and type reference for cdist -Nico Schottelius - - -EXPLORERS +Explorers --------- The following global explorers are available: @@ -56,22 +53,26 @@ eof cat << eof -PATHS +Paths ----- \$HOME/.cdist - The standard cdist configuration directory relative to your home directory - This is usually the place you want to store your site specific configuration + The standard cdist configuration directory relative to your home directory. + This is usually the place you want to store your site specific configuration. cdist/conf/ - The distribution configuration directory - This contains types and explorers to be used + The distribution configuration directory. + This contains types and explorers to be used. confdir Cdist will use all available configuration directories and create a temporary confdir containing links to the real configuration directories. This way it is possible to merge configuration directories. By default it consists of everything in \$HOME/.cdist and cdist/conf/. - For more details see cdist(1) + For more details see cdist(1). + +confdir/files/ + Cdist does not care about this directory besides providing access to it. + It is thought to be a general file storage area. confdir/manifest/init This is the central entry point. @@ -87,27 +88,27 @@ confdir/manifest/* maintain different groups of hosts. confdir/explorer/ - 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 \`_. confdir/type/ Contains all available types, which are used to provide - some kind of functionality. See cdist-type(7). + some kind of functionality. See \`cdist type \`_. confdir/type// Home of the type . This directory is referenced by the variable __type (see below). confdir/type//man.rst - Manpage in reStructuredText format (required for inclusion into upstream) + Manpage in reStructuredText format (required for inclusion into upstream). confdir/type//manifest Used to generate additional objects from a type. confdir/type//gencode-local - Used to generate code to be executed on the source host + Used to generate code to be executed on the source host. confdir/type//gencode-remote - Used to generate code to be executed on the target host + Used to generate code to be executed on the target host. confdir/type//parameter/required Parameters required by type, \n separated list. @@ -126,7 +127,7 @@ confdir/type//parameter/boolean confdir/type//explorer Location of the type specific explorers. This directory is referenced by the variable __type_explorer (see below). - See cdist-explorer(7). + See \`cdist explorer \`_. confdir/type//files This directory is reserved for user data and will not be used @@ -151,27 +152,28 @@ out/object/ out/object//explorers Output of type specific explorers, per object. -TYPES +Types ----- The following types are available: eof -for type in $(ls man7/cdist-type__*.rst | LC_ALL=C sort); do +# If there is no such file then ls prints error to stderr, +# so redirect stderr to /dev/null. +for type in $(ls man7/cdist-type__*.rst 2>/dev/null | LC_ALL=C sort); do no_dir="${type#man7/}"; no_type="${no_dir#cdist-type}"; name="${no_type%.rst}"; - name_no_underline="$(echo $name | sed 's/^__/\\__/g')" manref="${no_dir%.rst}" man="${manref}(7)" - echo "- $name_no_underline" "(\`${man} <${manref}.html>\`_)" + echo "- $name" "(\`${man} \`_)" done cat << eof -OBJECTS +Objects ------- For object to object communication and tests, the following paths are usable within a object directory: @@ -182,85 +184,93 @@ files (for instance to store template results). changed This empty file exists in an object directory, if the object has - code to be executed (either remote or local) + code to be executed (either remote or local). stdin This file exists and contains data, if data was provided on stdin when the type was called. -ENVIRONMENT VARIABLES (FOR READING) +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 + Available for: initial manifest, explorer, type explorer, shell. +__files + Directory that contains content from the "files" subdirectories + from the configuration directories. + Available for: initial manifest, type manifest, type gencode, shell. __manifest Directory that contains the initial manifest. - Available for: initial manifest, type manifest, shell + Available for: initial manifest, type manifest, shell. __global Directory that contains generic output like explorer. - Available for: initial manifest, type manifest, type gencode, shell + Available for: initial manifest, type manifest, type gencode, shell. __messages_in File to read messages from. - Available for: initial manifest, type manifest, type gencode + Available for: initial manifest, type manifest, type gencode. __messages_out File to write messages. - Available for: initial manifest, type manifest, type gencode + Available for: initial manifest, type manifest, type gencode. __object Directory that contains the current object. - Available for: type manifest, type explorer, type gencode and code scripts + Available for: type manifest, type explorer, type gencode and code scripts. __object_id The type unique object id. - Available for: type manifest, type explorer, type gencode and code scripts + Available for: type manifest, type explorer, type gencode and code scripts. 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. __object_name The full qualified name of the current object. - Available for: type manifest, type explorer, type gencode + 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, shell + The host we are deploying to. This is primary variable. It's content is + literally the one user passed in. + Available for: explorer, initial manifest, type explorer, type manifest, type gencode, shell. +__target_hostname + The hostname of host we are deploying to. This variable is derived from + **__target_host** (using **socket.getaddrinfo(__target_host)** and then + **socket.gethostbyaddr()**). + Available for: explorer, initial manifest, type explorer, type manifest, type gencode, shell. +__target_fqdn + The fully qualified domain name of the host we are deploying to. + This variable is derived from **__target_host** + (using **socket.getfqdn()**). + Available for: explorer, initial manifest, type explorer, type manifest, type gencode, shell. __type Path to the current type. - Available for: type manifest, type gencode + Available for: type manifest, type gencode. __type_explorer Directory that contains the type explorers. - Available for: type explorer + Available for: type explorer. -ENVIRONMENT VARIABLES (FOR WRITING) +Environment variables (for writing) ----------------------------------- The following environment variables influence the behaviour of cdist: require - Setup dependencies between objects (see cdist-manifest(7)) + Setup dependencies between objects (see \`cdist manifest \`_). + +CDIST_PATH + Colon delimited list of config directories. CDIST_LOCAL_SHELL - Use this shell locally instead of /bin/sh to execute scripts + Use this shell locally instead of /bin/sh to execute scripts. CDIST_REMOTE_SHELL - Use this shell remotely instead of /bin/sh to execute scripts + Use this shell remotely instead of /bin/sh to execute scripts. CDIST_OVERRIDE - Allow overwriting type parameters (see cdist-manifest(7)) + Allow overwriting type parameters (see \`cdist manifest \`_). CDIST_ORDER_DEPENDENCY - Create dependencies based on the execution order (see cdist-manifest(7)) + Create dependencies based on the execution order (see \`cdist manifest \`_). CDIST_REMOTE_EXEC - Use this command for remote execution (should behave like ssh) + Use this command for remote execution (should behave like ssh). CDIST_REMOTE_COPY - Use this command for remote copy (should behave like scp) - -SEE ALSO --------- -- \`cdist(1) <../man1/cdist.html>\`_ - - -COPYING -------- -Copyright \(C) 2011-2014 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). + Use this command for remote copy (should behave like scp). eof diff --git a/docs/man/man7/cdist-remote-exec-copy.rst b/docs/src/cdist-remote-exec-copy.rst similarity index 56% rename from docs/man/man7/cdist-remote-exec-copy.rst rename to docs/src/cdist-remote-exec-copy.rst index 27b78d42..882f0bc2 100644 --- a/docs/man/man7/cdist-remote-exec-copy.rst +++ b/docs/src/cdist-remote-exec-copy.rst @@ -1,12 +1,6 @@ -cdist-remote-exec-copy(7) -========================= -How to use remote exec and copy +Remote exec and copy commands +============================= -Nico Schottelius - - -INTRO ------ Cdist interacts with the target host in two ways: - it executes code (__remote_exec) @@ -15,8 +9,8 @@ Cdist interacts with the target host in two ways: By default this is accomplished with ssh and scp respectively. The default implementations used by cdist are:: - __remote_exec: ssh -o User=root -q - __remote_copy: scp -o User=root -q + __remote_exec: ssh -o User=root + __remote_copy: scp -o User=root The user can override these defaults by providing custom implementations and passing them to cdist with the --remote-exec and/or --remote-copy arguments. @@ -27,19 +21,3 @@ For __remote_copy, it must behave like scp. With this simple interface the user can take total control of how cdist interacts with the target when required, while the default implementation remains as simple as possible. - - -EXAMPLES --------- -See cdist/other/examples/remote/ for some example implementations. - - -SEE ALSO --------- -- `cdist(1) <../man1/cdist.html>`_ - - -COPYING -------- -Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/docs/man/man7/cdist-stages.rst b/docs/src/cdist-stages.rst similarity index 78% rename from docs/man/man7/cdist-stages.rst rename to docs/src/cdist-stages.rst index 4b29585d..fd19ce0d 100644 --- a/docs/man/man7/cdist-stages.rst +++ b/docs/src/cdist-stages.rst @@ -1,16 +1,13 @@ -cdist-stages(7) -=============== -Stages used during configuration deployment +Execution stages +================ -Nico Schottelius - -DESCRIPTION +Description ----------- Starting the execution of deployment with cdist, cdist passes through different stages. -STAGE 1: TARGET INFORMATION RETRIEVAL +Stage 1: target information retrieval ------------------------------------- In this stage information is collected about the target host using so called explorers. Every existing explorer is run on the target and the output of all @@ -18,7 +15,7 @@ explorers are copied back into the local cache. The results can be used by manifests and types. -STAGE 2: RUN THE INITIAL MANIFEST +Stage 2: run the initial manifest --------------------------------- The initial manifest, which should be used for mappings of hosts to types, is executed. This stage creates objects in a cconfig database that contains @@ -27,7 +24,7 @@ no conflicts may occur, i.e. no object of the same type with the same id may be created, if it has different parameters. -STAGE 3: OBJECT INFORMATION RETRIEVAL +Stage 3: object information retrieval ------------------------------------- Every object is checked whether its type has explorers and if so, these are executed on the target host. The results are transferred back @@ -35,7 +32,7 @@ and can be used in the following stages to decide what changes need to be made on the target to implement the desired state. -STAGE 4: RUN THE OBJECT MANIFEST +Stage 4: run the object manifest -------------------------------- Every object is checked whether its type has a executable manifest. The manifest script may generate and change the created objects. In other words, @@ -49,7 +46,7 @@ may occur during the merge. A conflict would mean that two different objects try to create the same object, which indicates a broken configuration. -STAGE 5: CODE GENERATION +Stage 5: code generation ------------------------ In this stage for every created object its type is checked for executable gencode scripts. The gencode scripts generate the code to be executed on the @@ -57,30 +54,18 @@ target on stdout. If the gencode executables fail, they must print diagnostic messages on stderr and exit non-zero. -STAGE 6: CODE EXECUTION +Stage 6: code execution ----------------------- For every object the resulting code from the previous stage is transferred to the target host and executed there to apply the configuration changes. -STAGE 7: CACHE +Stage 7: cache -------------- The cache stores the information from the current run for later use. -SUMMARY +Summary ------- If, and only if, all the stages complete without an errors, the configuration will be applied to the target. - - -SEE ALSO --------- -- `cdist(1) <../man1/cdist.html>`_ -- `cdist-reference(7) `_ - - -COPYING -------- -Copyright \(C) 2010-2012 Nico Schottelius, Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/docs/src/cdist-support.rst b/docs/src/cdist-support.rst new file mode 100644 index 00000000..2343500e --- /dev/null +++ b/docs/src/cdist-support.rst @@ -0,0 +1,28 @@ +Support +------- + +IRC +~~~ + +You can join the development ***IRC channel*** +`#cstar on irc.freenode.net `_. + +Mailing list +~~~~~~~~~~~~ + +Bug reports, questions, patches, etc. should be send to the +`cdist mailing list `_. + +Linkedin +~~~~~~~~ + +If you have an account +at `Linked in `_, +you can join the +`cdist group `_. + +Commercial support +~~~~~~~~~~~~~~~~~~ + +You can request commercial support for cdist from +`my company `_. diff --git a/docs/man/man7/cdist-troubleshooting.rst b/docs/src/cdist-troubleshooting.rst similarity index 74% rename from docs/man/man7/cdist-troubleshooting.rst rename to docs/src/cdist-troubleshooting.rst index 075c3480..b016e845 100644 --- a/docs/man/man7/cdist-troubleshooting.rst +++ b/docs/src/cdist-troubleshooting.rst @@ -1,11 +1,7 @@ -cdist-troubleshooting(7) -======================== -Common problems and their solutions +Troubleshooting +=============== -Nico Schottelius - - -ERROR IN MANIFEST IS NOT CONSIDERED AN ERROR BY CDIST +Error in manifest is not considered an error by cdist ----------------------------------------------------- Situation: You are executing other scripts from a manifest. This script fails, but cdist does not recognise the error. @@ -47,15 +43,3 @@ you write to use the -e flag: % cat ~/.cdist/manifest/special #!/bin/sh -e ... - - -SEE ALSO --------- -- `cdist(1) <../man1/cdist.html>`_ -- `cdist-tutorial(7) `_ - - -COPYING -------- -Copyright \(C) 2013 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/docs/man/man7/cdist-type.rst b/docs/src/cdist-type.rst similarity index 88% rename from docs/man/man7/cdist-type.rst rename to docs/src/cdist-type.rst index cfd331e1..62694fd8 100644 --- a/docs/man/man7/cdist-type.rst +++ b/docs/src/cdist-type.rst @@ -1,28 +1,24 @@ -cdist-type(7) -============= -Functionality bundled +cdist type +========== -Nico Schottelius - - -SYNOPSIS --------- - -:: - - __TYPE ID --parameter value [--parameter value ...] - __TYPE --parameter value [--parameter value ...] (for singletons) - - -DESCRIPTION +Description ----------- Types are the main component of cdist and define functionality. If you use cdist, you'll write a type for every functionality you would like to use. +Synopsis +-------- -HOW TO USE A TYPE +.. code-block:: sh + + __TYPE ID --parameter value [--parameter value ...] + __TYPE --parameter value [--parameter value ...] (for singletons) + + +How to use a type ----------------- + You can use types from the initial manifest or the type manifest like a normal shell command: @@ -34,10 +30,10 @@ normal shell command: # Ensure tree is installed __package tree --state installed -A list of supported types can be found in the cdist-reference(7) manpage. +A list of supported types can be found in the `cdist reference `_ manpage. -SINGLETON TYPES +Singleton types --------------- If a type is flagged as a singleton, it may be used only once per host. This is useful for types which can be used only once on a @@ -55,7 +51,7 @@ Example: __myfancysingleton --colour green -HOW TO WRITE A NEW TYPE +How to write a new type ----------------------- A type consists of @@ -71,7 +67,7 @@ two underscores (__) to prevent collisions with other executables in $PATH. To implement a new type, create the directory **cdist/conf/type/__NAME**. -DEFINING PARAMETERS +Defining parameters ------------------- Every type consists of required, optional and boolean parameters, which must each be declared in a newline separated file in **parameter/required**, @@ -99,7 +95,7 @@ Example: echo use_ssl >> cdist/conf/type/__nginx_vhost/parameter/boolean -USING PARAMETERS +Using parameters ---------------- The parameters given to a type can be accessed and used in all type scripts (e.g manifest, gencode, explorer). Note that boolean parameters are @@ -130,12 +126,12 @@ Example: (e.g. in cdist/conf/type/__nginx_vhost/manifest) # parameter with multiple values if [ -f "$__object/parameter/server_alias" ]; then for alias in $(cat "$__object/parameter/server_alias"); do - echo $alias > /some/where/usefull + echo $alias > /some/where/useful done fi -INPUT FROM STDIN +Input from stdin ---------------- Every type can access what has been written on stdin when it has been called. The result is saved into the **stdin** file in the object directory. @@ -165,7 +161,7 @@ In the __file type, stdin is used as source for the file, if - is used for sourc .... -WRITING THE MANIFEST +Writing the manifest -------------------- In the manifest of a type you can use other types, so your type extends their functionality. A good example is the __package type, which in @@ -187,13 +183,13 @@ a shortened version looks like this: __package_$type "$@" As you can see, the type can reference different environment variables, -which are documented in cdist-reference(7). +which are documented in `cdist reference `_. Always ensure the manifest is executable, otherwise cdist will not be able -to execute it. For more information about manifests see cdist-manifest(7). +to execute it. For more information about manifests see `cdist manifest `_. -SINGLETON - ONE INSTANCE ONLY +Singleton - one 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 @@ -213,7 +209,7 @@ As you can see, the object ID is omitted, because it does not make any sense, if your type can be used only once. -THE TYPE EXPLORERS +The type explorers ------------------ If a type needs to explore specific details, it can provide type specific explorers, which will be executed on the target for every created object. @@ -235,7 +231,7 @@ client, like this (shortened version from the type __file): fi -WRITING THE GENCODE SCRIPT +Writing the gencode script -------------------------- There are two gencode scripts: **gencode-local** and **gencode-remote**. The output of gencode-local is executed locally, whereas @@ -256,7 +252,7 @@ script, you can write to stderr: echo "touch /etc/cdist-configured" -VARIABLE ACCESS FROM THE GENERATED SCRIPTS +Variable access from the generated scripts ------------------------------------------ In the generated scripts, you have access to the following cdist variables @@ -277,7 +273,7 @@ So when you generate a script with the following content, it will work: fi -HINTS FOR TYPEWRITERS +Hints for typewriters ---------------------- It must be assumed that the target is pretty dumb and thus does not have high level tools like ruby installed. If a type requires specific tools to be present @@ -294,21 +290,8 @@ a folder named "files" within the type (again, because cdist guarantees to never ever touch this folder). -HOW TO INCLUDE A TYPE INTO UPSTREAM CDIST +How to include a type into upstream cdist ----------------------------------------- If you think your type may be useful for others, ensure it works with the -current master branch of cdist and have a look at cdist-hacker(7) on +current master branch of cdist and have a look at `cdist hacking `_ on how to submit it. - -SEE ALSO --------- -- `cdist-explorer(7) `_ -- `cdist-hacker(7) `_ -- `cdist-stages(7) `_ -- `cdist-tutorial(7) `_ - - -COPYING -------- -Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/docs/src/cdist-types.rst b/docs/src/cdist-types.rst new file mode 100644 index 00000000..d5104667 --- /dev/null +++ b/docs/src/cdist-types.rst @@ -0,0 +1,8 @@ +cdist types +=========== + +.. toctree:: + :titlesonly: + :glob: + + man7/* diff --git a/docs/src/cdist-update.rst b/docs/src/cdist-update.rst new file mode 100644 index 00000000..e810d6e9 --- /dev/null +++ b/docs/src/cdist-update.rst @@ -0,0 +1,188 @@ +How to update cdist +=================== + +Update the git installation +--------------------------- + +To upgrade cdist in the current branch use + +.. code-block:: sh + + git pull + + # Also update the manpages + ./build man + export MANPATH=$MANPATH:$(pwd -P)/doc/man + +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. + +Safely upgrading to new versions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To upgrade to **any** further cdist version, you can take the +following procedure to do a safe upgrade: + +.. code-block:: sh + + # Create new branch to try out the update + git checkout -b upgrade_cdist + + # Get latest cdist version in git database + git fetch -v + + # see what will happen on merge - replace + # master with the branch you plan to merge + git diff upgrade_cdist..origin/master + + # Merge the new version + git merge origin/master + +Now you can ensure all custom types work with the new version. +Assume that you need to go back to an older version during +the migration/update, you can do so as follows: + +.. code-block:: sh + + # commit changes + git commit -m ... + + # go back to original branch + git checkout master + +After that, you can go back and continue the upgrade: + +.. code-block:: sh + + # git checkout upgrade_cdist + + +Update the python package +------------------------- + +To upgrade to the lastet version do + +.. code-block:: sh + + pip install --upgrade cdist + +General update instructions +--------------------------- + +Updating from 3.0 to 3.1 +~~~~~~~~~~~~~~~~~~~~~~~~ + +The type **\_\_ssh_authorized_keys** now also manages existing keys, +not only the ones added by cdist. + +Updating from 2.3 to 3.0 +~~~~~~~~~~~~~~~~~~~~~~~~ + +The **changed** attribute of objects has been removed. +Use `messaging `_ instead. + +Updating from 2.2 to 2.3 +~~~~~~~~~~~~~~~~~~~~~~~~ + +No incompatibilities. + +Updating from 2.1 to 2.2 +~~~~~~~~~~~~~~~~~~~~~~~~ + +Starting with 2.2, the syntax for requiring a singleton type changed: +Old format: + +.. code-block:: sh + + require="__singleton_type/singleton" ... + +New format: + +.. code-block:: sh + + require="__singleton_type" ... + +Internally the "singleton" object id was dropped to make life more easy. +You can probably fix your configuration by running the following code +snippet (currently untested, please report back if it works for you): + +.. code-block:: sh + + find ~/.cdist/* -type f -exec sed -i 's,/singleton,,' {} \; + +Updating from 2.0 to 2.1 +~~~~~~~~~~~~~~~~~~~~~~~~ + +Have a look at the update guide for [[2.0 to 2.1|2.0-to-2.1]]. + + * Type **\_\_package* and \_\_process** use --state **present** or **absent**. + The states **removed/installed** and **stopped/running** have been removed. + Support for the new states is already present in 2.0. + * Type **\_\_directory**: Parameter --parents and --recursive are now boolean + The old "yes/no" values need to be removed. + * Type **\_\_rvm_ruby**: Parameter --default is now boolean + The old "yes/no" values need to be removed. + * Type **\_\_rvm_gemset**: Parameter --default is now boolean + The old "yes/no" values need to be removed. + * Type **\_\_addifnosuchline** and **\_\_removeline** have been replaced by **\_\_line** + * The **conf** directory is now located at **cdist/conf**. + You need to migrate your types, explorers and manifests + manually to the new location. + * Replace the variable **\_\_self** by **\_\_object_name** + Support for the variable **\_\_object_name** is already present in 2.0. + * The types **\_\_autofs**, **\_\_autofs_map** and **\_\_autofs_reload** have been removed + (no maintainer, no users) + * Type **\_\_user**: Parameter --groups removed (use the new \_\_user_groups type) + * Type **\_\_ssh_authorized_key** has been replaced by more flexible type + **\_\_ssh_authorized_keys** + +Updating from 1.7 to 2.0 +~~~~~~~~~~~~~~~~~~~~~~~~ + +* Ensure python (>= 3.2) is installed on the source host +* Use "cdist config host" instead of "cdist-deploy-to host" +* Use "cdist config -p host1 host2" instead of "cdist-mass-deploy" +* Use "cdist banner" for fun +* Use **\_\_object_name** instead of **\_\_self** in manifests + +Updating from 1.6 to 1.7 +~~~~~~~~~~~~~~~~~~~~~~~~ + +* If you used the global explorer **hardware_type**, you need to change + your code to use **machine** instead. + +Updating 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. + +Updating from 1.3 to 1.5 +~~~~~~~~~~~~~~~~~~~~~~~~ + +No incompatibilities. + +Updating from 1.2 to 1.3 +~~~~~~~~~~~~~~~~~~~~~~~~ + +Rename **gencode** of every type to **gencode-remote**. + +Updating from 1.1 to 1.2 +~~~~~~~~~~~~~~~~~~~~~~~~ + +No incompatibilities. + +Updating from 1.0 to 1.1 +~~~~~~~~~~~~~~~~~~~~~~~~ + +In 1.1 the type **\_\_file** was split into **\_\_directory**, **\_\_file** and +**\_\_link**. The parameter **--type** was removed from **\_\_file**. Thus you +need to replace **\_\_file** calls in your manifests: + + * Remove --type from all \_\_file calls + * If type was symlink, use \_\_link and --type symbolic + * If type was directory, use \_\_directory diff --git a/docs/src/cdist-why.rst b/docs/src/cdist-why.rst new file mode 100644 index 00000000..e6aefefd --- /dev/null +++ b/docs/src/cdist-why.rst @@ -0,0 +1,72 @@ +Why should I use cdist? +======================= + +There are several motivations to use cdist, these +are probably the most popular ones. + +Known language +-------------- + +Cdist is being configured in +`shell script `_. +Shell script is used by UNIX system engineers for decades. +So when cdist is introduced, your staff does not need to learn a new +`DSL `_ +or programming language. + +Powerful language +----------------- + +Not only is shell scripting widely known by system engineers, +but it is also a very powerful language. Here are some features +which make daily work easy: + + * Configuration can react dynamicly on explored values + * High level string manipulation (using sed, awk, grep) + * Conditional support (**if, case**) + * Loop support (**for, while**) + * Support for dependencies between cdist types + +More than shell scripting +------------------------- + +If you compare regular shell scripting with cdist, there is one major +difference: When using cdist types, +the results are +`idempotent `_. +In practise that means it does not matter in which order you +call cdist types, the result is always the same. + +Zero dependency configuration management +---------------------------------------- + +Cdist requires very litte on a target system. Even better, +in almost all cases all dependencies are usually fulfilled. +Cdist does not require an agent or a high level programming +languages on the target host: it will run on any host that +has a **ssh server running** and a posix compatible shell +(**/bin/sh**). Compared to other configuration management systems, +it does not require to open up an additional port. + +Push based distribution +----------------------- + +Cdist uses the push based model for configuration. In this +scenario, one (or more) computers connect the target hosts +and apply the configuration. That way the source host has +very little requirements: Cdist can even run on a sysadmin +notebook that is loosely connected to the network and has +limited amount of resources. + +Furthermore, from a security point of view, only one machine +needs access to the target hosts. No target hosts will ever +need to connect back to the source host, which contains the +full configuration. + +Highly scalable +--------------- + +If at some point you manage more hosts than can be handled from +a single source host, you can simply add more resources: Either +add more cores to one host or add hosts. +Cdist will utilise the given resources in parallel. diff --git a/docs/man/conf.py b/docs/src/conf.py similarity index 79% rename from docs/man/conf.py rename to docs/src/conf.py index 7df4ed25..a63a14ff 100644 --- a/docs/man/conf.py +++ b/docs/src/conf.py @@ -15,21 +15,31 @@ import sys import os +import sphinx_rtd_theme # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath(os.path.join( + os.path.dirname(os.path.realpath(__file__)), "..", ".."))) + +# Import cdist after sys.path fixup above. + +import cdist.version # nopep8 - ignore error that import is not at top # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = [] +extensions = [ + 'cdist.sphinxext.manpage', + 'sphinx.ext.extlinks', +] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -39,22 +49,21 @@ templates_path = ['_templates'] source_suffix = ['.rst'] # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = 'cdist' -#copyright = '2016, Darko Poljak' -#author = 'Darko Poljak' +# copyright = '2016, Darko Poljak' +# author = 'Darko Poljak' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -import cdist.version version = cdist.version.VERSION # The full version, including alpha/beta/rc tags. release = version @@ -68,9 +77,9 @@ language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -79,27 +88,27 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # The reST default role (used for this markup: `text`) to use for all # documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False +# keep_warnings = False # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False @@ -109,120 +118,121 @@ todo_include_todos = False # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -import sphinx_rtd_theme html_theme = 'sphinx_rtd_theme' html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. # " v documentation" by default. -#html_title = 'cdist-docs v0.0.1' +# html_title = 'cdist-docs v0.0.1' # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (relative to this directory) to use as a favicon of -# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# the docs. This file should be a Windows icon file (.ico) +# being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +# html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -#html_extra_path = [] +# html_extra_path = [] # If not None, a 'Last updated on:' timestamp is inserted at every page # bottom, using the given strftime format. # The empty string is equivalent to '%b %d, %Y'. -#html_last_updated_fmt = None +# html_last_updated_fmt = None # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True +html_use_smartypants = False # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None -#html_file_suffix = "" +# html_file_suffix = None +# html_file_suffix = "" # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh' -#html_search_language = 'en' +# html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # 'ja' uses this config value. # 'zh' user can custom change `jieba` dictionary path. -#html_search_options = {'type': 'default'} +# html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. -#html_search_scorer = 'scorer.js' +# html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. htmlhelp_basename = 'cdistdoc' # -- Options for LaTeX output --------------------------------------------- -latex_elements = { +# latex_elements = { # The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', +# 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', +# 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. -#'preamble': '', +# 'preamble': '', # Latex figure (float) alignment -#'figure_align': 'htbp', -} +# 'figure_align': 'htbp', +# } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, @@ -234,51 +244,54 @@ latex_documents = [ # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -mandir = os.path.dirname(os.path.realpath(__file__)) -man_pages = [] +root_mandir = os.path.dirname(os.path.realpath(__file__)) +mandirs = [] for mansubdir in ('man1', 'man7'): - for root, dirs, files in os.walk(os.path.join(mandir, mansubdir)): + mandirs.append((os.path.join(root_mandir, mansubdir), mansubdir[-1])) +man_pages = [] +for mandir, section in mandirs: + for root, dirs, files in os.walk(mandir): for fname in files: froot, fext = os.path.splitext(fname) if fext == '.rst': - man_page = (os.path.join(mansubdir, froot), froot, '', - [], mansubdir[-1]) + man_page = (os.path.join('man' + str(section), froot), + froot, '', [], section) man_pages.append(man_page) -#man_pages = [ +# man_pages = [ # ('cdist-type', 'cdist-type', 'cdist-type documentation', # [author], 1), # ('man7/cdist-type__file', 'cdist-type__file', # '', [], 1), # ('cdist-type__directory', 'cdist-type__directory', # 'cdist-type__directory documentation', [author], 1), -#] +# ] # If true, show URL addresses after external links. -#man_show_urls = False +# man_show_urls = False # -- Options for Texinfo output ------------------------------------------- @@ -293,13 +306,13 @@ texinfo_documents = [ ] # Documents to append as an appendix to all manuals. -#texinfo_appendices = [] +# texinfo_appendices = [] # If false, no module index is generated. -#texinfo_domain_indices = True +# texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' +# texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False +# texinfo_no_detailmenu = False diff --git a/docs/src/index.rst b/docs/src/index.rst new file mode 100644 index 00000000..b33b707d --- /dev/null +++ b/docs/src/index.rst @@ -0,0 +1,32 @@ +Welcome to cdist documentation +============================== + +Contents: + +.. toctree:: + :maxdepth: 2 + :glob: + :numbered: + + cdist-intro + cdist-why + cdist-os + cdist-install + cdist-update + cdist-support + cdist-features + cdist-quickstart + man1/cdist + cdist-bootstrap + cdist-manifest + cdist-type + cdist-types + cdist-explorer + cdist-messaging + cdist-parallelization + cdist-reference + cdist-best-practice + cdist-stages + cdist-remote-exec-copy + cdist-hacker + cdist-troubleshooting diff --git a/docs/man/man1/cdist.rst b/docs/src/man1/cdist.rst similarity index 53% rename from docs/man/man1/cdist.rst rename to docs/src/man1/cdist.rst index 21edee11..52562e14 100644 --- a/docs/man/man1/cdist.rst +++ b/docs/src/man1/cdist.rst @@ -1,8 +1,9 @@ cdist(1) ======== -Usable Configuration Management -Nico Schottelius +NAME +---- +cdist - Usable Configuration Management SYNOPSIS @@ -14,7 +15,10 @@ SYNOPSIS cdist banner [-h] [-d] [-v] - cdist config [-h] [-d] [-V] [-c CONF_DIR] [-f HOSTFILE] [-i MANIFEST] [-p] [-s] [host [host ...]] + cdist config [-h] [-d] [-v] [-b] [-c CONF_DIR] [-f HOSTFILE] + [-i MANIFEST] [-j [JOBS]] [-n] [-o OUT_PATH] [-p] [-s] + [--remote-copy REMOTE_COPY] [--remote-exec REMOTE_EXEC] + [host [host ...]] cdist shell [-h] [-d] [-v] [-s SHELL] @@ -22,20 +26,23 @@ SYNOPSIS DESCRIPTION ----------- cdist is the frontend executable to the cdist configuration management. -cdist supports different subcommands as explained below. +It supports different subcommands as explained below. + +It is written in Python so it requires :strong:`python`\ (1) to be installed. +It requires a minimal Python version 3.2. GENERAL ------- All commands accept the following options: +.. option:: -h, --help + + Show the help screen + .. option:: -d, --debug Set log level to debug -.. option:: -h, --help - - Show the help screen - .. option:: -v, --verbose Set log level to info, be more verbose @@ -53,11 +60,12 @@ cdist posters - a must have for every office. CONFIG ------ -Configure one or more hosts +Configure one or more hosts. -.. option:: -h, --help +.. option:: -b, --enable-beta - Show the help screen + Enable beta functionalities. Beta functionalities include the + following options: -j/--jobs. .. option:: -c CONF_DIR, --conf-dir CONF_DIR @@ -74,19 +82,32 @@ Configure one or more hosts Read additional hosts to operate on from specified file or from stdin if '-' (each host on separate line). If no host or host file is specified then, by default, - read hosts from stdin. + read hosts from stdin. For the file format see below. .. option:: -i MANIFEST, --initial-manifest MANIFEST Path to a cdist manifest or - to read from stdin +.. option:: -j [JOBS], --jobs [JOBS] + + Specify the maximum number of parallel jobs; currently only + global explorers are supported (currently in beta) + +.. option:: -n, --dry-run + + Do not execute code + +.. option:: -o OUT_PATH, --out-dir OUT_PATH + + Directory to save cdist output in + .. option:: -p, --parallel Operate on multiple hosts in parallel .. option:: -s, --sequential - Operate on multiple hosts sequentially + Operate on multiple hosts sequentially (default) .. option:: --remote-copy REMOTE_COPY @@ -96,6 +117,20 @@ Configure one or more hosts Command to use for remote execution (should behave like ssh) + +HOSTFILE FORMAT +~~~~~~~~~~~~~~~ +HOSTFILE contains hosts per line. +All characters after and including '#' until the end of line is a comment. +In a line, all leading and trailing whitespace characters are ignored. +Empty lines are ignored/skipped. + +Hostfile line is processed like the following. First, all comments are +removed. Then all leading and trailing whitespace characters are stripped. +If such a line results in empty line it is ignored/skipped. Otherwise, +host string is used. + + SHELL ----- This command allows you to spawn a shell that enables access @@ -103,10 +138,19 @@ to the types as commands. It can be thought as an "interactive manifest" environment. See below for example usage. Its primary use is for debugging type parameters. -.. option:: -s/--shell +.. option:: -s SHELL, --shell SHELL - Select shell to use, defaults to current shell + Select shell to use, defaults to current shell. Used shell should + be POSIX compatible shell. +FILES +----- +~/.cdist + Your personal cdist config directory. If exists it will be + automatically used. +cdist/conf + The distribution configuration directory. It contains official types and + explorers. This path is relative to cdist installation directory. EXAMPLES -------- @@ -128,6 +172,10 @@ EXAMPLES # Configure hosts read from file loadbalancers % cdist config -f loadbalancers + # Configure hosts read from file web.hosts using 16 parallel jobs + # (beta functionality) + % cdist config -b -j 16 -f web.hosts + # Display banner cdist banner @@ -152,35 +200,53 @@ TMPDIR, TEMP, TMP more information. This is rather useful, if the standard directory used does not allow executables. +CDIST_PATH + Colon delimited list of config directories. + CDIST_LOCAL_SHELL - Selects shell for local script execution, defaults to /bin/sh + Selects shell for local script execution, defaults to /bin/sh. CDIST_REMOTE_SHELL - Selects shell for remote scirpt execution, defaults to /bin/sh + Selects shell for remote script execution, defaults to /bin/sh. + +CDIST_OVERRIDE + Allow overwriting type parameters. + +CDIST_ORDER_DEPENDENCY + Create dependencies based on the execution order. CDIST_REMOTE_EXEC - Use this command for remote execution (should behave like ssh) + Use this command for remote execution (should behave like ssh). CDIST_REMOTE_COPY - Use this command for remote copy (should behave like scp) + Use this command for remote copy (should behave like scp). EXIT STATUS ----------- The following exit values shall be returned: -0 - Successful completion -1 - One or more host configurations failed +0 Successful completion. + +1 One or more host configurations failed. -SEE ALSO --------- -- `cdist-type(7) <../man7/cdist-type.html>`_ -- `cdist-reference(7) <../man7/cdist-reference.html>`_ +AUTHORS +------- +Nico Schottelius +CAVEATS +------- +When operating in parallel, either by operating in parallel for each host +(-p/--parallel) or by parallel jobs within a host (-j/--jobs), and depending +on target SSH server and its configuration you may encounter connection drops. +This is controlled with sshd :strong:`MaxStartups` configuration options. +You may also encounter session open refusal. This happens with ssh multiplexing +when you reach maximum number of open sessions permitted per network +connection. In this case ssh will disable multiplexing. +This limit is controlled with sshd :strong:`MaxSessions` configuration +options. For more details refer to :strong:`sshd_config`\ (5). COPYING ------- Copyright \(C) 2011-2013 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). +granted under the terms of the GNU General Public License v3 or later (GPLv3+). diff --git a/docs/src/man7/.gitignore b/docs/src/man7/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/docs/web/cdist/documentation.mdwn b/docs/web/cdist/documentation.mdwn index db25b566..56c2798e 100644 --- a/docs/web/cdist/documentation.mdwn +++ b/docs/web/cdist/documentation.mdwn @@ -1,7 +1,7 @@ [[!meta title="Documentation"]] -You can browse the latest -[latest version of the manpages](/software/cdist/man/latest) or +You can browse the +[latest version of the documentation](/software/cdist/man/latest) or have a look at [all versions](/software/cdist/man). You can also view [speeches about cdist](/software/cdist/speeches). diff --git a/docs/web/cdist/features.mdwn b/docs/web/cdist/features.mdwn index a97f2013..77c61382 100644 --- a/docs/web/cdist/features.mdwn +++ b/docs/web/cdist/features.mdwn @@ -3,7 +3,7 @@ But cdist ticks differently, here is the feature set that makes it unique: [[!table data=""" Keywords | Description Simplicity | There is only one type to extend cdist called ***type*** -Design | Type and core cleanly seperated +Design | Type and core cleanly separated Design | Sticks completly to the KISS (keep it simple and stupid) paradigma Design | Meaningful error messages - do not lose time debugging error messages Design | Consistency in behaviour, naming and documentation diff --git a/docs/web/cdist/install.mdwn b/docs/web/cdist/install.mdwn index ce6ca877..cff2d369 100644 --- a/docs/web/cdist/install.mdwn +++ b/docs/web/cdist/install.mdwn @@ -17,114 +17,6 @@ This is the machine you use to configure the target hosts. * /bin/sh: A posix like shell (for instance bash, dash, zsh) * SSH server -## Requirement Installation: Python >= 3.2 - -Ensure you have at least Python 3.2 or newer installed on -the **source host**. -You can check this by running **python -V**: - - % python -V - Python 3.3.0 - -### Archlinux - -Archlinux includes a recent python in the extra repository. -You can install it using - - pacman -S python - -### CentOS - -See the "From source" section - -### Debian - -For Debian **wheezy** or newer: - - aptitude install python3 - -On **squeeze** you can add following line in **/etc/apt/sources.list** - - deb http://ftp.debian.org/debian wheezy main - -And add pinning entry in **/etc/apt/preferences.d/wheezy**: - - Package: * - Pin: release n=wheezy - Pin-Priority: 1 - -Please be aware that both **openssh-server** and **openssh-client** might be -removed on **python3.2** installation. You surely want to reinstall them: - - apt-get install -t wheezy openssh-server openssh-client - -For older Debian versions, installing python 3.2 from source is required. - -If you want to build the cdist manpages: - - aptitude install --without-recommends asciidoc xsltproc - -### Fedora - -Fedora 15 and newer includes a recent python. -You can install it using - - yum install python3 - -### FreeBSD - -For the port: - - cd /usr/ports/lang/python32/ && make install clean - -For the package: - - pkg_add -r python32 - -You can also use any newer version, but at least python 3.2 is required. - -### Gentoo - -Gentoo only provides python 3.2 in testing packages (http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=3). -If you want to ensure nothing breaks you must set back the python version to what was default before. - - emerge -av =python-3.2.2 --autounmask-write - emerge -av =python-3.2.2 - eselect python list - eselect python list set python3.2 - -### Max OS X - -You can choose between Homebrew and Macports, either way works: - -[Homebrew](http://mxcl.github.com/homebrew/) variant: - - brew install python3 - -[Macports](http://www.macports.org/install.php) variant: - - port install python32 - ln -s /opt/local/bin/python3.2 /opt/local/bin/python3 - -### Redhat - -See the "From source" section - -### From Source - -For those operating systems not yet supporting Python 3.2: - - pyversion=3.2.3 - wget http://www.python.org/ftp/python/$pyversion/Python-${pyversion}.tar.bz2 - tar xvfj Python-${pyversion}.tar.bz2 - cd Python-${pyversion} - ./configure - make - sudo make install - -This installs python 3.2 to /usr/local/bin. -Ensure this directory is in your PATH environment variable. - ## Install cdist You can install cdist either from git or as a python package. @@ -141,10 +33,8 @@ To install cdist, execute the following commands: cd cdist export PATH=$PATH:$(pwd -P)/bin -If you want to build and use the manpages, run: - - make man - export MANPATH=$MANPATH:$(pwd -P)/doc/man +From version 4.2.0 cdist tags and github releases are signed. +You can get GPG public key used for signing [here](/software/cdist/pgp-key-EFD2AE4EC36B6901.asc). #### Available versions in git @@ -169,6 +59,36 @@ If the main site is down, you can acquire cdist from one of the following sites: * git://github.com/telmich/cdist.git ([github](https://github.com/telmich/cdist)) * git://git.code.sf.net/p/cdist/code ([sourceforge](https://sourceforge.net/p/cdist/code)) +#### Building and using documentation (man and html) + +If you want to build and use the documentation, run: + + make docs + +Documentation comes in two formats, man pages and full HTML +documentation. Documentation is built into distribution's +docs/dist directory. man pages are in docs/dist/man and +HTML documentation in docs/dist/html. + +If you want to use man pages, run: + + export MANPATH=$MANPATH:$(pwd -P)/docs/dist/man + +Or you can move manpages from docs/dist/man directory to some +other directory and add it to MANPATH. + +Full HTML documentation can be accessed at docs/dist/html/index.html. + +You can also build manpages for types in your ~/.cdist directory: + + make dotman + +Built manpages are now in docs/dist/man directory. If you have +some other custom .cdist directory, e.g. /opt/cdist then use: + + DOT_CDIST_PATH=/opt/cdist make dotman + + ### Python Package Cdist is available as a python package at diff --git a/docs/web/cdist/os.mdwn b/docs/web/cdist/os.mdwn index 24992439..3677f52c 100644 --- a/docs/web/cdist/os.mdwn +++ b/docs/web/cdist/os.mdwn @@ -5,6 +5,7 @@ cdist was tested or is know to run on at least * [Archlinux](http://www.archlinux.org/) * [Debian](http://www.debian.org/) * [CentOS](http://www.centos.org/) + * [Scientific](https://www.scientificlinux.org/) * [Fedora](http://fedoraproject.org/) * [FreeBSD](http://www.freebsd.org) * [Gentoo](http://www.gentoo.org/) diff --git a/docs/web/cdist/pgp-key-EFD2AE4EC36B6901.asc b/docs/web/cdist/pgp-key-EFD2AE4EC36B6901.asc new file mode 100644 index 00000000..1762d7c1 --- /dev/null +++ b/docs/web/cdist/pgp-key-EFD2AE4EC36B6901.asc @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v2 + +mQINBFeCnRQBEACoybnhBEubglOHJrZQ8PKcdeQaGZRoTc3cDs84lr6a9HiLeoBO +f8x9fpN4LJbaJOyFJLcvVHHcljvooCLqL5t8/pj7Lyvq1AYuMAeS2Wy19amy3tE5 +aYYdN85idE/m81B+nD76URL4UjXm0T9ITNLbSE3cZTh/25fsFLub+CHauuP0zxJJ +4SlWnIvvcx1hg9n0la9M1DwcNSdI9A7bZLHIM3Ixuq8HTXcuuozXvJOxTgKZ6Yfs +UmTW7mMykbcxcNZx9bADj8kJOEf9FlJzalkW3XVGbBBYgwDrqoRGl+gtt5up71cE +N0NSL6+6mNJBW3ek9kI88z2qUlVe5UXZQxe5sgjrcnE2sPJkAjCiYUXhVzjV5Oo1 +CZ8m1egZLM4IWwAVg8lTizSozYWm9Rs5BcHRVSbQenXoJffTYJY//UE7sAkAfKCf +vsHCdc1H1yK2OwC418nj/T2Zu8Yt0CWiQT3Sogtqz6R7HgVCmSqEdQl3+VL2hQkk +4s0lSOCtBpe0R700phJ67QsnCB8cGMqfUbYZ9cEppJwPA3X3tZd5BJ2OYFU/qhrM +SJ9konAWxnFkViBz0MCKhVjMh6DsH40xdQQsrXsF2aSwEv3MFw/sj+xt1KIuRE5i +IDrZpbaWVjshoJVH6l4eK01DfxRHRJdj8AyH/xJTQQRal2J4CNWjtl+NzwARAQAB +tDB1bmdsZWljaCBHbWJIICh1bmdsZWljaCBGT1NTKSA8Zm9zc0B1bmdsZWljaC5j +aD6JAjcEEwEIACEFAleCnRQCGwMFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQ +79KuTsNraQGQ6w//dLuEsGzhqQ4FdYwpTOOfcWB6+i42PGb2TgXzwbx5kgzKv6oi +nGuMlXKfamaqbCQuPRyHxR34VRgJslDcvhIXDhB7ELdi5ib8vpA2bX082Es9cKUB +TSGPtp8y7n9aN9ebu/HWLQu88YdAHEcB8BhSuMmcxGvRM1H2a59lW5WizQ7KUPLt +5a8UeELmf/Xz0k4YLP39ApXHxfis0kbGYBni6f7WsyVw2SBEqiG6Z9XktRcSo0e/ +RlZb8FlEQgkZtafmFh2qLS710sll8bcD4Xqktzy4ztUgp6ImtpUY8CwdO9H8VCZK +xCwEIX3W25qAXiV8aFSJ9T4M15dkZivq1vvAEmE0G1zEi8AwI3NGjMXDh61A1yH3 +auHdSOPzdlICqZDBDlX70tmzL3MBOBy32DkVMwe5JHlj9RBjrpp/B3wch1La2NND +4tFEzYMYlkDxCjJKpNqGDZO+ZqHA7dOx3sx6XPlGtSyWnFfFPu2bBvrDhyORmMbO +20pLotDXIzJ8qNCsZ6XAiJ1PDeHintxbRwJxERScv3EcvcE/lcxrlS/TX9LbBJPE +0y/JMpXLx+9WdG5KpDCxpuZHVyKkcXP0TAPq/IG+VPo9wTGg6cy///Se2PKBbuMm +X90VVM/C5PYmDjJ+IxZckBm6oXLJSZd0rETrf0G4HQCznnA8oiQbZu1ac/O5Ag0E +V4KdFAEQALoVDmDKujONT1yDT+AFUc2a/IBBU7V5Ut86+ZdiXltKVpQA3Dc17bdt +GS5YqMVnIaKZ7MqRhfo0XeVzyTBzjGLr+2EZdWb51I7JNto/HVZgUOvon9BiMoTK +KUOD8gFlhblCcKd/aVOJXPDzKYfu2jgBmgtcHecbyXRbjlha6l0/jsFJj0VJySQv +pj2AftKtb7mltz5Wfm/FkUfpEYGl2NSucW3bYNe0j6BmQXqRqLupeoSdmWrPT+oa +RXxKfM0Ug43WnNYgXsAwU383pdfmYIzxsV7RRIXZZswNKuMj4XyDp1hvF4++6Nqb +ySsCGWRWYG1TK0yCQyzRYvaaY15W9ZX8q91Qx9R6RksXs8bjDmHKo55z4V3Dy5KG +dwanyatmEwkbcKjFECK84V8zNJDspsLS1BGiUF69qWdU/wREMs4kp0gUC+3Fbguf +u/v4yc87SO9QvIIv2lWp3nRpQC5661+SK4dB2SVYL88Yd+LFoe883qI5GQIFLad+ +Q5Y/c305r44VOlACV/EsP01LoHHfSsTeneoBUW8ndoKyE3yJ5LKYUV9caROG4/Wh +hGWulkZTXSUXv8q6rUoCIkJiTPPnozwjtErlGyNGcnG1WR55sRV8SFr/SflnUDh9 +tAo+I1xegS+B9W+I89jv3ujkpDVNoST8nb44EZrAq/R0WST48zDHABEBAAGJAh8E +GAEIAAkFAleCnRQCGwwACgkQ79KuTsNraQH7Iw//YclkUN193xbaOho/y4Dj4vk1 +/Gl4bRgek5CkeMll2uxvsvaVEhL1fbBOR501kmYKzCynkESWft8FG7LNxLi7t3Y9 +XrnvvIqPVGAwD8x1+fj+LWCAOZAcFQ3nPSXRY+aZ545G5Mu24EHKsaBEFiyGlDSY +6+XLJchQEpUwVn3MIk9RKCyYi9pAdofgvHuDbB8fFz2YGyjmBn+WbZCmvTm62AIP +WzaNBx507l9LBObY2teBTFLFOnUmNW0QLNpV8lGlWv/rVGfzqD3VVavRNGcXLkI9 +spv4r5ci9tQWwW52Z8fAFMo4yWeeWnS0uk4vKtq3ANwFqFtxLuA8WBy9FYQ/5BR0 +RdbI0a/iVN2rJcZxGqUbz22U+4N7g89EmHA40LFsWmIl5duAtXZ3XIlMFzCuXwYf +u9fpLUs6uIdRuVVg/qVJva608hn/7/fEqetbwoHmmSBVUSOQYdMZZ5SyR8zDUbBh +acGOOPRSN7tJG8ycoPSQKQci4fXEpqkBfojalqNKGgJUj+5IWApZWvZV0Z6fFLO7 +Q2vd1jXYb4lKv04pfxqfOuOlSy9w6ElNewF4V7jSdGqfitw2lQNXlC1EaoajkiZJ +Evcb9b5HexuJPI3cxyJGZyUYyqk2FF0ztGigbhK986iyKILJB+OqiLbAs3KIgezD +vsomtv+pm41l0JK+Xps= +=/2wY +-----END PGP PUBLIC KEY BLOCK----- diff --git a/docs/web/cdist/support.mdwn b/docs/web/cdist/support.mdwn index 39388c5a..4f92853b 100644 --- a/docs/web/cdist/support.mdwn +++ b/docs/web/cdist/support.mdwn @@ -8,7 +8,7 @@ You can join the development ***IRC channel*** ### Mailing list Bug reports, questions, patches, etc. should be send to the -[cdist mailing list](http://l.schottelius.org/mailman/listinfo/cdist). +[cdist mailing list](https://groups.google.com/forum/#!forum/cdist-configuration-management). ### Linkedin @@ -17,6 +17,9 @@ at [Linked in](http://www.linkedin.com/), you can join the [cdist group](http://www.linkedin.com/groups/cdist-configuration-management-3952797). +### Chat +Chat with us: [ungleich chat](https://chat.ungleich.ch/channel/cdist). + ### Commercial support You can request commercial support for cdist from diff --git a/docs/web/cdist/update.mdwn b/docs/web/cdist/update.mdwn index 28f41da7..df4617bb 100644 --- a/docs/web/cdist/update.mdwn +++ b/docs/web/cdist/update.mdwn @@ -67,7 +67,7 @@ Use [messaging](/software/cdist/man/3.0.0/man7/cdist-messaging.html) instead. ### Updating from 2.2 to 2.3 -No incompatiblities. +No incompatibilities. ### Updating from 2.1 to 2.2 @@ -134,7 +134,7 @@ Have a look at the update guide for [[2.0 to 2.1|2.0-to-2.1]]. ### Updating from 1.3 to 1.5 -No incompatiblities. +No incompatibilities. ### Updating from 1.2 to 1.3 @@ -142,7 +142,7 @@ Rename **gencode** of every type to **gencode-remote**. ### Updating from 1.1 to 1.2 -No incompatiblities. +No incompatibilities. ### Updating from 1.0 to 1.1 diff --git a/docs/web/cdist/update/2.0-to-2.1.mdwn b/docs/web/cdist/update/2.0-to-2.1.mdwn index 1d0037ab..3b5f5dc4 100644 --- a/docs/web/cdist/update/2.0-to-2.1.mdwn +++ b/docs/web/cdist/update/2.0-to-2.1.mdwn @@ -10,7 +10,7 @@ explorers and manifest to custom directories. This document will guide you to a successful update. -## Preperation +## Preparation As for every software and system you use in production, you should first of all make a backup of your data. To prevent any breakage, it is @@ -35,7 +35,7 @@ Now try to merge upstream into the new branch. % git merge origin/2.1 Fix any conflicts that may have been occurred due to local changes -and then **git add** and *git commit** those changes. This should seldomly +and then **git add** and *git commit** those changes. This should seldom occur and if, it's mostly for people hacking on the cdist core. ## Move "conf" directory diff --git a/scripts/cdist b/scripts/cdist index 6baa28f3..91dec2c9 100755 --- a/scripts/cdist +++ b/scripts/cdist @@ -21,28 +21,39 @@ # # -def inspect_ssh_mux_opts(control_path_dir="~/.ssh/"): - """Inspect whether or not ssh supports multiplexing options""" - import subprocess - import os - control_path = os.path.join(control_path_dir, - "cdist.socket.master-%l-%r@%h:%p") - wanted_mux_opts = { - "ControlPath": control_path, - "ControlMaster": "auto", - "ControlPersist": "125", - } - mux_opts = " ".join([" -o {}={}".format(x, - wanted_mux_opts[x]) for x in wanted_mux_opts]) +# list of beta arguments for sub-commands +BETA_ARGS = { + 'config': ['jobs', ], +} + + +def check_positive_int(value): + import argparse + try: - subprocess.check_output("ssh {}".format(mux_opts), - stderr=subprocess.STDOUT, shell=True) - except subprocess.CalledProcessError as e: - subproc_output = e.output.decode().lower() - if "bad configuration option" in subproc_output: - return "" - return mux_opts + val = int(value) + except ValueError as e: + raise argparse.ArgumentTypeError( + "{} is invalid int value".format(value)) + if val <= 0: + raise argparse.ArgumentTypeError( + "{} is invalid positive int value".format(val)) + return val + + +def check_beta(args_dict): + if 'beta' not in args_dict: + args_dict['beta'] = False + # Check only if beta is not enabled: if beta option is specified then + # raise error. + if not args_dict['beta']: + cmd = args_dict['command'] + if cmd in BETA_ARGS: + for arg in BETA_ARGS[cmd]: + if arg in args_dict and args_dict[arg]: + raise cdist.CdistBetaRequired(cmd, arg) + def commandline(): """Parse command line""" @@ -51,87 +62,108 @@ def commandline(): import cdist.banner import cdist.config import cdist.shell - import tempfile import shutil import os + import multiprocessing # Construct parser others can reuse parser = {} # Options _all_ parsers have in common parser['loglevel'] = argparse.ArgumentParser(add_help=False) - parser['loglevel'].add_argument('-d', '--debug', - help='Set log level to debug', action='store_true', - default=False) - parser['loglevel'].add_argument('-v', '--verbose', - help='Set log level to info, be more verbose', - action='store_true', default=False) + parser['loglevel'].add_argument( + '-d', '--debug', help='Set log level to debug', + action='store_true', default=False) + parser['loglevel'].add_argument( + '-v', '--verbose', help='Set log level to info, be more verbose', + action='store_true', default=False) # Main subcommand parser - parser['main'] = argparse.ArgumentParser(description='cdist ' - + cdist.VERSION, - parents=[parser['loglevel']]) - parser['main'].add_argument('-V', '--version', - help='Show version', action='version', - version='%(prog)s ' + cdist.VERSION) - parser['sub'] = parser['main'].add_subparsers(title="Commands", - dest="command") + parser['main'] = argparse.ArgumentParser( + description='cdist ' + cdist.VERSION, parents=[parser['loglevel']]) + parser['main'].add_argument( + '-V', '--version', help='Show version', action='version', + version='%(prog)s ' + cdist.VERSION) + parser['sub'] = parser['main'].add_subparsers( + title="Commands", dest="command") # Banner - parser['banner'] = parser['sub'].add_parser('banner', - parents=[parser['loglevel']]) + parser['banner'] = parser['sub'].add_parser( + 'banner', parents=[parser['loglevel']]) parser['banner'].set_defaults(func=cdist.banner.banner) # Config - parser['config'] = parser['sub'].add_parser('config', - parents=[parser['loglevel']]) - parser['config'].add_argument('host', nargs='*', - help='host(s) to operate on') - parser['config'].add_argument('-c', '--conf-dir', - help=('Add configuration directory (can be repeated, ' - 'last one wins)'), action='append') - parser['config'].add_argument('-f', '--file', - help=('Read additional hosts to operate on from specified file ' - 'or from stdin if \'-\' (each host on separate line). ' - 'If no host or host file is specified then, by default, ' - 'read hosts from stdin.'), - dest='hostfile', required=False) - parser['config'].add_argument('-i', '--initial-manifest', - help='Path to a cdist manifest or \'-\' to read from stdin.', - dest='manifest', required=False) - parser['config'].add_argument('-n', '--dry-run', - help='Do not execute code', action='store_true') - parser['config'].add_argument('-o', '--out-dir', - help='Directory to save cdist output in', dest="out_path") - parser['config'].add_argument('-p', '--parallel', - help='Operate on multiple hosts in parallel', - action='store_true', dest='parallel') - parser['config'].add_argument('-s', '--sequential', - help='Operate on multiple hosts sequentially (default)', - action='store_false', dest='parallel') + parser['config'] = parser['sub'].add_parser( + 'config', parents=[parser['loglevel']]) + parser['config'].add_argument( + 'host', nargs='*', help='host(s) to operate on') + parser['config'].add_argument( + '-b', '--enable-beta', + help=('Enable beta functionalities. Beta functionalities ' + 'include the following options: -j/--jobs.'), + action='store_true', dest='beta', default=False) + parser['config'].add_argument( + '-c', '--conf-dir', + help=('Add configuration directory (can be repeated, ' + 'last one wins)'), action='append') + parser['config'].add_argument( + '-f', '--file', + help=('Read additional hosts to operate on from specified file ' + 'or from stdin if \'-\' (each host on separate line). ' + 'If no host or host file is specified then, by default, ' + 'read hosts from stdin.'), + dest='hostfile', required=False) + parser['config'].add_argument( + '-i', '--initial-manifest', + help='Path to a cdist manifest or \'-\' to read from stdin.', + dest='manifest', required=False) + parser['config'].add_argument( + '-j', '--jobs', nargs='?', type=check_positive_int, + help=('Specify the maximum number of parallel jobs, currently ' + 'only global explorers are supported (currently in beta'), + action='store', dest='jobs', + const=multiprocessing.cpu_count()) + parser['config'].add_argument( + '-n', '--dry-run', + help='Do not execute code', action='store_true') + parser['config'].add_argument( + '-o', '--out-dir', + help='Directory to save cdist output in', dest="out_path") + parser['config'].add_argument( + '-p', '--parallel', + help='Operate on multiple hosts in parallel', + action='store_true', dest='parallel') + parser['config'].add_argument( + '-s', '--sequential', + help='Operate on multiple hosts sequentially (default)', + action='store_false', dest='parallel') # remote-copy and remote-exec defaults are environment variables # if set; if not then None - these will be futher handled after # parsing to determine implementation default - parser['config'].add_argument('--remote-copy', - help='Command to use for remote copy (should behave like scp)', - action='store', dest='remote_copy', - default=os.environ.get('CDIST_REMOTE_COPY')) - parser['config'].add_argument('--remote-exec', - help=('Command to use for remote execution ' - '(should behave like ssh)'), - action='store', dest='remote_exec', - default=os.environ.get('CDIST_REMOTE_EXEC')) + parser['config'].add_argument( + '--remote-copy', + help='Command to use for remote copy (should behave like scp)', + action='store', dest='remote_copy', + default=os.environ.get('CDIST_REMOTE_COPY')) + parser['config'].add_argument( + '--remote-exec', + help=('Command to use for remote execution ' + '(should behave like ssh)'), + action='store', dest='remote_exec', + default=os.environ.get('CDIST_REMOTE_EXEC')) parser['config'].set_defaults(func=cdist.config.Config.commandline) # Shell - parser['shell'] = parser['sub'].add_parser('shell', - parents=[parser['loglevel']]) - parser['shell'].add_argument('-s', '--shell', - help='Select shell to use, defaults to current shell') + parser['shell'] = parser['sub'].add_parser( + 'shell', parents=[parser['loglevel']]) + parser['shell'].add_argument( + '-s', '--shell', + help=('Select shell to use, defaults to current shell. Used shell' + ' should be POSIX compatible shell.')) parser['shell'].set_defaults(func=cdist.shell.Shell.commandline) - for p in parser: - parser[p].epilog = "Get cdist at http://www.nico.schottelius.org/software/cdist/" + parser[p].epilog = ( + "Get cdist at http://www.nico.schottelius.org/software/cdist/") args = parser['main'].parse_args(sys.argv[1:]) @@ -140,26 +172,6 @@ def commandline(): logging.root.setLevel(logging.INFO) if args.debug: logging.root.setLevel(logging.DEBUG) - args_dict = vars(args) - # if command with remote_copy and remote_exec params - if 'remote_copy' in args_dict and 'remote_exec' in args_dict: - # if remote-exec and/or remote-copy args are None then user - # didn't specify command line options nor env vars: - # inspect multiplexing options for default cdist.REMOTE_COPY/EXEC - if args_dict['remote_copy'] is None or args_dict['remote_exec'] is None: - control_path_dir = tempfile.mkdtemp() - import atexit - atexit.register(lambda: shutil.rmtree(control_path_dir)) - mux_opts = inspect_ssh_mux_opts(control_path_dir) - if args_dict['remote_exec'] is None: - args.remote_exec = cdist.REMOTE_EXEC + mux_opts - if args_dict['remote_copy'] is None: - args.remote_copy = cdist.REMOTE_COPY + mux_opts - - if args.command == 'config': - if args.manifest == '-' and args.hostfile == '-': - print('cdist config: error: cannot read both, manifest and host file, from stdin') - sys.exit(1) log.debug(args) log.info("version %s" % cdist.VERSION) @@ -179,6 +191,7 @@ def commandline(): parser['main'].print_help() sys.exit(0) + check_beta(vars(args)) args.func(args) if __name__ == "__main__": @@ -188,10 +201,9 @@ if __name__ == "__main__": cdistpythonversion = '3.2' if sys.version < cdistpythonversion: print('Python >= ' + cdistpythonversion + - ' is required on the source host.', file=sys.stderr) + ' is required on the source host.', file=sys.stderr) sys.exit(1) - exit_code = 0 try: diff --git a/setup.py b/setup.py index c484a269..f29a8998 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ import cdist import os import re + def data_finder(data_dir): entries = [] for name in os.listdir(data_dir): @@ -29,17 +30,18 @@ os.chdir("cdist") package_data = data_finder("conf") os.chdir(cur) + setup( - name = "cdist", - packages = ["cdist", "cdist.core", "cdist.exec", "cdist.util" ], + name="cdist", + packages=["cdist", "cdist.core", "cdist.exec", "cdist.util", ], package_data={'cdist': package_data}, - scripts = ["scripts/cdist"], - version = cdist.version.VERSION, - description = "A Usable Configuration Management System", - author = "Nico Schottelius", - author_email = "nico-cdist-pypi@schottelius.org", - url = "http://www.nico.schottelius.org/software/cdist/", - classifiers = [ + scripts=["scripts/cdist"], + version=cdist.version.VERSION, + description="A Usable Configuration Management System", + author="Nico Schottelius", + author_email="nico-cdist-pypi@schottelius.org", + url="http://www.nico.schottelius.org/software/cdist/", + classifiers=[ "Development Status :: 6 - Mature", "Environment :: Console", "Intended Audience :: System Administrators", @@ -57,10 +59,11 @@ setup( "Topic :: System :: Software Distribution", "Topic :: Utilities" ], - long_description = ''' + long_description=''' cdist is a usable configuration management system. - It adheres to the KISS principle and is being used in small up to enterprise grade environments. - cdist is an alternative to other configuration management systems like + It adheres to the KISS principle and is being used in small up to + enterprise grade environments. + cdist is an alternative to other configuration management systems like cfengine, bcfg2, chef and puppet. ''' )