diff --git a/.gitignore b/.gitignore index b86e4a99..6e2d4437 100644 --- a/.gitignore +++ b/.gitignore @@ -2,20 +2,27 @@ .*.swp # Ignore generated manpages -doc/man/.marker -doc/man/man1/*.1 -doc/man/man7/*.7 -doc/man/man*/*.html -doc/man/man*/*.xml -doc/man/man7/cdist-type__*.text -doc/man/man7/cdist-reference.text -doc/man/man*/docbook-xsl.css +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__*.text +docs/man/man7/cdist-reference.text # Ignore cdist cache for version control /cache/ -# Python / cache +# Python: cache, distutils, distribution in general __pycache__/ +MANIFEST +dist/ +cdist/version.py -# Is static and will never be included -lib/cdist/version_static.py +# Packaging: Archlinux +/PKGBUILD +/cdist-*.pkg.tar.xz +/cdist-*.tar.gz +/pkg +/src diff --git a/.version b/.version index 3d45b5c6..71f08595 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.0.14 +2.1.0-pre1 diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..a675f446 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include docs/changelog +recursive-include docs/gfx *.png *.text +recursive-include docs *.text *.html *.1 *.7 diff --git a/PKGBUILD.in b/PKGBUILD.in new file mode 100755 index 00000000..a4e744ae --- /dev/null +++ b/PKGBUILD.in @@ -0,0 +1,26 @@ +#!/bin/sh + +version=$(git describe) +outfile=${0%.in} + +cat << eof > "${outfile}" +pkgname=cdist +pkgver=$version +pkgrel=1 +pkgdesc='A Usable Configuration Management System"' +arch=('any') +url='http://www.nico.schottelius.org/software/cdist/' +license=('GPL3') +depends=('python>=3.2.0') +source=("http://pypi.python.org/packages/source/c/cdist/cdist-\${pkgver}.tar.gz") + +package() { + cd cdist-\${pkgver} + python3 setup.py build install --root="\${pkgdir}" + mv "\${pkgdir}"/usr/bin/cdist.py "\${pkgdir}"/usr/bin/cdist + + #install -Dm644 offlineimap.1 "\${pkgdir}"/usr/share/man/man1/offlineimap.1 +} +eof + +makepkg -g >> "${outfile}" diff --git a/bin/cdist b/bin/cdist index 75047acb..5a6ce92f 100755 --- a/bin/cdist +++ b/bin/cdist @@ -1,7 +1,7 @@ -#!/usr/bin/env python3 +#!/bin/sh # -*- coding: utf-8 -*- # -# 2010-2012 Nico Schottelius (nico-cdist at schottelius.org) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -20,229 +20,10 @@ # # -def commandline(): - """Parse command line""" - import argparse +# Wrapper for real script to allow execution from checkout +dir=${0%/*} - import cdist.banner - import cdist.config - import cdist.install - - # 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) - - # 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") - - # Banner - parser['banner'] = parser['sub'].add_parser('banner', - parents=[parser['loglevel']]) - parser['banner'].set_defaults(func=cdist.banner.banner) - - # Config and install (common stuff) - parser['configinstall'] = argparse.ArgumentParser(add_help=False) - parser['configinstall'].add_argument('host', nargs='+', - help='one or more hosts to operate on') - parser['configinstall'].add_argument('-c', '--cdist-home', - help='Change cdist home (default: .. from bin directory)', - action='store') - parser['configinstall'].add_argument('-i', '--initial-manifest', - help='Path to a cdist manifest or \'-\' to read from stdin.', - dest='manifest', required=False) - parser['configinstall'].add_argument('-p', '--parallel', - help='Operate on multiple hosts in parallel', - action='store_true', dest='parallel') - parser['configinstall'].add_argument('-s', '--sequential', - help='Operate on multiple hosts sequentially (default)', - action='store_false', dest='parallel') - - parser['configinstall'].add_argument('--remote-copy', - help='Command to use for remote copy (should behave like scp)', - action='store', dest='remote_copy', - default="scp -o User=root -q") - parser['configinstall'].add_argument('--remote-exec', - help='Command to use for remote execution (should behave like ssh)', - action='store', dest='remote_exec', - default="ssh -o User=root -q") - - # Config - parser['config'] = parser['sub'].add_parser('config', - parents=[parser['loglevel'], parser['configinstall']]) - parser['config'].set_defaults(func=config) - - # Install - # 20120525/sar: commented until it actually does something - #parser['install'] = parser['sub'].add_parser('install', - # parents=[parser['loglevel'], parser['configinstall']]) - #parser['install'].set_defaults(func=install) - - for p in parser: - parser[p].epilog = "Get cdist at http://www.nico.schottelius.org/software/cdist/" - - args = parser['main'].parse_args(sys.argv[1:]) - - # Loglevels are handled globally in here and debug wins over verbose - if args.verbose: - logging.root.setLevel(logging.INFO) - if args.debug: - logging.root.setLevel(logging.DEBUG) - - log.debug(args) - args.func(args) - -def config(args): - configinstall(args, mode=cdist.config.Config) - -def install(args): - configinstall(args, mode=cdist.install.Install) - -def configinstall(args, mode): - """Configure or install remote system""" - import multiprocessing - import time - - 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.') - 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) - - args.manifest = initial_manifest_temp_path - import atexit - atexit.register(lambda: os.remove(initial_manifest_temp_path)) - - process = {} - failed_hosts = [] - time_start = time.time() - - for host in args.host: - if args.parallel: - log.debug("Creating child process for %s", host) - process[host] = multiprocessing.Process(target=configinstall_onehost, args=(host, args, mode, True)) - process[host].start() - else: - try: - configinstall_onehost(host, args, mode, 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", len(args.host), - (time_end - time_start)) - - if len(failed_hosts) > 0: - raise cdist.Error("Failed to deploy to the following hosts: " + - " ".join(failed_hosts)) - -def configinstall_onehost(host, args, mode, parallel): - """Configure or install ONE remote system""" - - try: - import cdist.context - - context = cdist.context.Context( - target_host=host, - remote_copy=args.remote_copy, - remote_exec=args.remote_exec, - initial_manifest=args.manifest, - base_path=args.cdist_home, - exec_path=sys.argv[0], - debug=args.debug) - - c = mode(context) - c.deploy_and_cleanup() - context.cleanup() - - except cdist.Error as e: - # We are running in our own process here, need to sys.exit! - if parallel: - log.error(e) - sys.exit(1) - else: - raise - - except KeyboardInterrupt: - # Ignore in parallel mode, we are existing anyway - if parallel: - sys.exit(0) - # Pass back to controlling code in sequential mode - else: - raise - -def emulator(): - """Prepare and run emulator""" - import cdist.emulator - emulator = cdist.emulator.Emulator(sys.argv) - return emulator.run() - -if __name__ == "__main__": - # Sys is needed for sys.exit() - import sys - - cdistpythonversion = '3.2' - if sys.version < cdistpythonversion: - print('Cdist requires Python >= ' + cdistpythonversion + - ' on the source host.', file=sys.stderr) - sys.exit(1) - - - exit_code = 0 - - try: - import logging - import os - import re - - # Ensure our /lib/ is included into PYTHON_PATH - sys.path.insert(0, os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) - - # And now import our stuff - import cdist - - log = logging.getLogger("cdist") - - logging.basicConfig(format='%(levelname)s: %(message)s') - - if re.match("__", os.path.basename(sys.argv[0])): - emulator() - else: - commandline() - - except KeyboardInterrupt: - pass - - except cdist.Error as e: - log.error(e) - exit_code = 1 - - # Determine exit code by return value of function - - sys.exit(exit_code) +# Ensure version is present - the bundled/shipped version contains a static version, +# the git version contains a dynamic version +"$dir/../build" version +PYTHONPATH="${dir}/../" "$dir/../scripts/cdist" "$@" diff --git a/build b/build index a9647ff1..def72470 100755 --- a/build +++ b/build @@ -26,6 +26,7 @@ # exit on any error #set -e +basedir=${0%/*} version=$(git describe) # Manpage and HTML @@ -39,145 +40,296 @@ WEBMAN=$WEBBASE/man/$version WEBPAGE=${WEBBASE}.mdwn # Documentation -MANDIR=doc/man +MANDIR=docs/man MAN1DSTDIR=${MANDIR}/man1 MAN7DSTDIR=${MANDIR}/man7 -SPEECHESDIR=doc/speeches +SPEECHESDIR=docs/speeches + +# Change to checkout directory +cd "$basedir" case "$1" in - man) - set -e - "$0" mangen - "$0" mantype - "$0" manbuild - ;; - - manbuild) - trap abort INT - abort() { - kill 0 - } - for section in 1 7; do - for src in ${MANDIR}/man${section}/*.text; do - manpage="${src%.text}.$section" - if [ ! -f "$manpage" -o "$manpage" -ot "$src" ]; then - echo "Compiling man page for $src" - $A2XM "$src" - fi - htmlpage="${src%.text}.html" - if [ ! -f "$htmlpage" -o "$htmlpage" -ot "$src" ]; then - echo "Compiling html page for $src" - $A2XH "$src" - fi - done - done - ;; - - mantype) - for mansrc in conf/type/*/man.text; do - dst="$(echo $mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')" - ln -sf "../../../$mansrc" "$dst" - done - ;; - - mangen) - ${MANDIR}/cdist-reference.text.sh - ;; - - release) - ./doc/dev/releasechecklist - ;; - - speeches) - cd "$SPEECHESDIR" - for speech in *tex; do - pdflatex "$speech" - pdflatex "$speech" - pdflatex "$speech" - done - ;; - - webmain) - cp README ${WEBPAGE} - cd ${WEBDIR} && git commit -m "cdist main update" ${WEBPAGE} - cd ${WEBDIR} && make pub - ;; - - web) - cp README ${WEBPAGE} - rm -rf ${WEBMAN} - mkdir -p ${WEBMAN}/man1 ${WEBMAN}/man7 - - # old stuff - # rm -rf ${WEBDIR}/${WEBBASE}/speeches && mkdir ${WEBDIR}/${WEBBASE}/speeches - # cp ${SPEECHESDIR}/*.pdf ${WEBDIR}/${WEBBASE}/speeches - # git describe > ${WEBDIR}/${WEBBASE}/man/VERSION - - cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${WEBMAN}/man1 - cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${WEBMAN}/man7 - - cd ${WEBDIR} && git add ${WEBBASE} - cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} - cd ${WEBDIR} && make pub - - # Fix ikiwiki, which does not like symlinks for pseudo security - ssh tee.schottelius.org \ - "cd /home/services/www/nico/www.nico.schottelius.org/www/software/cdist/man && - rm -f latest && ln -sf "$version" latest" - ;; - - p|pu|pub) - for remote in "" github sf ethz; do - echo "Pushing to $remote" - git push --mirror $remote - done - ;; - - clean) - rm -f ${MAN7DSTDIR}/cdist-reference.text lib/cdist/version.py - find "${MANDIR}" -mindepth 2 -type l \ - -o -name "*.1" \ - -o -name "*.7" \ - -o -name "*.html" \ - -o -name "*.xml" \ - | xargs rm -f - ;; - - test) - shift # skip t - export PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib - - if [ $# -lt 1 ]; then - python3 -m cdist.test - else - python3 -m unittest "$@" - fi - ;; - - version-dynamic) - cd lib/cdist/ - ln -sf version_dynamic.py version.py + man) + set -e + "$0" mangen + "$0" mantype + "$0" manbuild ;; - version-dist) - version=$(cat .version) - cd lib/cdist/ - echo "VERSION=\"$version\"" > version_static.py - ln -sf version_static.py version.py + manbuild) + trap abort INT + abort() { + kill 0 + } + for section in 1 7; do + for src in ${MANDIR}/man${section}/*.text; do + manpage="${src%.text}.$section" + if [ ! -f "$manpage" -o "$manpage" -ot "$src" ]; then + echo "Compiling man page for $src" + $A2XM "$src" + fi + htmlpage="${src%.text}.html" + if [ ! -f "$htmlpage" -o "$htmlpage" -ot "$src" ]; then + echo "Compiling html page for $src" + $A2XH "$src" + fi + done + done + ;; + + mantype) + for mansrc in cdist/conf/type/*/man.text; do + dst="$(echo $mansrc | sed -e 's;cdist/conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;docs/man/man7/;')" + ln -sf "../../../$mansrc" "$dst" + done + ;; + + mangen) + ${MANDIR}/cdist-reference.text.sh + ;; + + dist) + set -e + # Do the checks + $0 dist-check + + # Git changes - everything depends on this + $0 dist-tag + $0 dist-branch-merge + + # Pypi first - is the base for others + $0 dist-pypi + + # Archlinux depends on successful pypi ;-) + $0 dist-archlinux + + # Update website (includes documentation) + $0 web + + $0 pub + + $0 dist-freecode + + $0 dist-post + ;; + + changelog-version) + # get version from changelog and ensure it's not already present + grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/:.*//' + ;; + + dist-check) + set -e + echo "Verifying documentation building works ..." + $0 clean + $0 man + + changelog_version=$($0 changelog-version) + echo "Target version from changelog: $changelog_version" + + if git show --quiet $changelog_version >/dev/null 2>&1; then + echo "Version $changelog_version already exists, aborting." + exit 1 + fi + + # verify date in changelog + 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 + + ;; + + dist-post) + cat << notes + + To be done manually... + + - freecode release + - blog entry + - linkedin entry + - mailinglist update +notes + + ;; + + dist-tag) + version=$($0 changelog-version) + # add tag + printf "Enter tag description for %s> " "$version" + read tagmessage + git tag "$version" -m "$tagmessage" + ;; + + dist-branch-merge) + version=$($0 changelog-version) + target_branch=${version%\.*} + current_branch=$(git rev-parse --abbrev-ref HEAD) + + if [ "$target_branch" = "$current_branch" ]; then + echo "Skipping merge, already on destination branch" + else + printf "Press enter to git merge $current_branch into \"$target_branch\" > " + read prompt + git checkout "$target_branch" + git merge "$current_branch" + git checkout "$current_branch" + fi + ;; + + dist-archlinux) + $0 dist-archlinux-makepkg + $0 dist-archlinux-aur-upload + ;; + + dist-archlinux-makepkg) + ./PKGBUILD.in + makepkg -c --source + ;; + + dist-archlinux-aur-upload) + version=$($0 changelog-version) + tar=cdist-${version}-1.src.tar.gz + burp -c system "$tar" + ;; + + dist-freecode) + version=$($0 changelog-version) + api_token=$(awk '/machine freecode login/ { print $8 }' ~/.netrc) + + printf "Enter tag list for freecode release %s> " "$version" + read taglist + + printf "Enter changelog for freecode release %s> " "$version" + read changelog + + echo "Submit preview" + cat << eof +tag_list = $taglist +changelog = $changelog +version = $version +eof + printf "Press enter to submit to freecode> " + read dummy + + cat << eof | cfreecode-api release-add cdist + { + "auth_code": "$api_token", + "release": { + "tag_list": "$taglist", + "version": "$version", + "changelog": "$changelog", + "hidden_from_frontpage": false + } + } +eof + + ;; + + dist-pypi) + $0 man + $0 version + python3 setup.py sdist upload + ;; + + speeches) + cd "$SPEECHESDIR" + for speech in *tex; do + pdflatex "$speech" + pdflatex "$speech" + pdflatex "$speech" + done + ;; + + webmain) + cp README ${WEBPAGE} + cd ${WEBDIR} && git commit -m "cdist main update" ${WEBPAGE} + cd ${WEBDIR} && make pub + ;; + + web) + cp README ${WEBPAGE} + rm -rf ${WEBMAN} + mkdir -p ${WEBMAN}/man1 ${WEBMAN}/man7 + + cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${WEBMAN}/man1 + cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${WEBMAN}/man7 + + cd ${WEBDIR} && git add ${WEBBASE} + cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} + cd ${WEBDIR} && make pub + + # Fix ikiwiki, which does not like symlinks for pseudo security + ssh tee.schottelius.org \ + "cd /home/services/www/nico/www.nico.schottelius.org/www/software/cdist/man && + rm -f latest && ln -sf "$version" latest" + ;; + + p|pu|pub) + for remote in "" github sf ethz; do + echo "Pushing to $remote" + git push --mirror $remote + done + ;; + + clean) + rm -f ${MAN7DSTDIR}/cdist-reference.text + + find "${MANDIR}" -mindepth 2 -type l \ + -o -name "*.1" \ + -o -name "*.7" \ + -o -name "*.html" \ + -o -name "*.xml" \ + | xargs rm -f + + find * -name __pycache__ | xargs rm -rf + ;; + clean-dist) + rm -f cdist/version.py MANIFEST PKGBUILD + rm -rf cache/ dist/ + + # Archlinux + rm -f cdist-*.pkg.tar.xz cdist-*.tar.gz + rm -rf pkg/ src/ + ;; + + very-clean) + $0 clean + $0 clean-dist + ;; + + test) + shift # skip t + export PYTHONPATH="$(pwd -P)" + + if [ $# -lt 1 ]; then + python3 -m cdist.test + else + python3 -m unittest "$@" + fi + ;; + + version) + echo "VERSION=\"$version\"" > cdist/version.py ;; *) - echo '' - echo 'Welcome to cdist!' - echo '' - echo 'Here are the possible targets:' - echo '' - echo ' clean: Remove build stuff' - echo ' man: Build manpages (requires Asciidoc)' - echo ' test: Run tests' - echo '' - echo '' - echo "Unknown target, \"$1\"" >&2 - exit 1 - ;; + echo '' + echo 'Welcome to cdist!' + echo '' + echo 'Here are the possible targets:' + echo '' + echo ' clean: Remove build stuff' + echo ' man: Build manpages (requires Asciidoc)' + echo ' test: Run tests' + echo '' + echo '' + echo "Unknown target, \"$1\"" >&2 + exit 1 + ;; + esac diff --git a/lib/cdist/__init__.py b/cdist/__init__.py similarity index 100% rename from lib/cdist/__init__.py rename to cdist/__init__.py diff --git a/lib/cdist/banner.py b/cdist/banner.py similarity index 100% rename from lib/cdist/banner.py rename to cdist/banner.py diff --git a/conf/.gitignore b/cdist/conf/.gitignore similarity index 100% rename from conf/.gitignore rename to cdist/conf/.gitignore diff --git a/conf/README b/cdist/conf/README similarity index 100% rename from conf/README rename to cdist/conf/README diff --git a/conf/explorer/hostname b/cdist/conf/explorer/hostname similarity index 100% rename from conf/explorer/hostname rename to cdist/conf/explorer/hostname diff --git a/conf/explorer/interfaces b/cdist/conf/explorer/interfaces similarity index 100% rename from conf/explorer/interfaces rename to cdist/conf/explorer/interfaces diff --git a/conf/explorer/lsb_codename b/cdist/conf/explorer/lsb_codename similarity index 100% rename from conf/explorer/lsb_codename rename to cdist/conf/explorer/lsb_codename diff --git a/conf/explorer/lsb_description b/cdist/conf/explorer/lsb_description similarity index 100% rename from conf/explorer/lsb_description rename to cdist/conf/explorer/lsb_description diff --git a/conf/explorer/lsb_id b/cdist/conf/explorer/lsb_id similarity index 100% rename from conf/explorer/lsb_id rename to cdist/conf/explorer/lsb_id diff --git a/conf/explorer/lsb_release b/cdist/conf/explorer/lsb_release similarity index 100% rename from conf/explorer/lsb_release rename to cdist/conf/explorer/lsb_release diff --git a/conf/explorer/machine b/cdist/conf/explorer/machine similarity index 100% rename from conf/explorer/machine rename to cdist/conf/explorer/machine diff --git a/conf/explorer/os b/cdist/conf/explorer/os similarity index 100% rename from conf/explorer/os rename to cdist/conf/explorer/os diff --git a/conf/explorer/os_version b/cdist/conf/explorer/os_version similarity index 100% rename from conf/explorer/os_version rename to cdist/conf/explorer/os_version diff --git a/conf/explorer/runlevel b/cdist/conf/explorer/runlevel similarity index 100% rename from conf/explorer/runlevel rename to cdist/conf/explorer/runlevel diff --git a/cdist/conf/manifest/sample-from-distribution b/cdist/conf/manifest/sample-from-distribution new file mode 100755 index 00000000..56d52cf5 --- /dev/null +++ b/cdist/conf/manifest/sample-from-distribution @@ -0,0 +1,62 @@ +## # +## # Sample manifest from cdist distribution +## # +## +## # Every machine becomes a marker, so sysadmins know that automatic +## # configurations are happening +## __file /etc/cdist-configured +## __cdistmarker +## +## case "$__target_host" in +## # Everybody has this +## localhost) +## require="__file/etc/cdist-configured" __link /tmp/cdist-testfile \ +## --source /etc/cdist-configured --type symbolic +## require="__directory/tmp/cdist-test-dir" __file /tmp/cdist-test-dir/test-file \ +## --mode 0750 --owner nobody --group root +## __directory /tmp/cdist-test-dir --mode 4777 +## +## require="__file/etc/cdist-configured __link/tmp/cdist-testfile" \ +## __file /tmp/cdist-another-testfile +## +## ;; +## +## # +## # Use an alias in /etc/hosts for localhost to use these hosts: +## # +## # 127.0.0.1 localhost.localdomain localhost cdist-archlinux +## # +## cdist-archlinux) +## # This is the specific package type for pacman +## __package_pacman zsh --state installed +## +## # The __package type autoselect the right type based on the os +## __package vim --state installed +## +## # If the type is a singleton, it does not take an object id +## __issue +## ;; +## # This is how it would look like on gentoo +## cdist-gentoo) +## # Same stuff for gentoo +## __package tree --state installed +## ;; +## +## cdist-debian) +## __package_apt atop --state installed +## __package apache2 --state removed +## ;; +## +## cdist-redhat) +## __issue +## __motd +## ;; +## +## # Real machines may be used with their hostname or fqdn, +## # depending on how you call cdist +## # ... +## # ;; +## # machine.example.org) +## # ... +## # ;; +## esac diff --git a/conf/type/__apt_ppa/explorer/state b/cdist/conf/type/__apt_ppa/explorer/state similarity index 100% rename from conf/type/__apt_ppa/explorer/state rename to cdist/conf/type/__apt_ppa/explorer/state diff --git a/conf/type/__apt_ppa/files/remove-apt-repository b/cdist/conf/type/__apt_ppa/files/remove-apt-repository similarity index 100% rename from conf/type/__apt_ppa/files/remove-apt-repository rename to cdist/conf/type/__apt_ppa/files/remove-apt-repository diff --git a/conf/type/__apt_ppa/gencode-remote b/cdist/conf/type/__apt_ppa/gencode-remote similarity index 100% rename from conf/type/__apt_ppa/gencode-remote rename to cdist/conf/type/__apt_ppa/gencode-remote diff --git a/conf/type/__apt_ppa/man.text b/cdist/conf/type/__apt_ppa/man.text similarity index 100% rename from conf/type/__apt_ppa/man.text rename to cdist/conf/type/__apt_ppa/man.text diff --git a/conf/type/__apt_ppa/manifest b/cdist/conf/type/__apt_ppa/manifest similarity index 100% rename from conf/type/__apt_ppa/manifest rename to cdist/conf/type/__apt_ppa/manifest diff --git a/conf/type/__apt_ppa/parameter/required b/cdist/conf/type/__apt_ppa/parameter/required similarity index 100% rename from conf/type/__apt_ppa/parameter/required rename to cdist/conf/type/__apt_ppa/parameter/required diff --git a/conf/type/__apt_update_index/gencode-remote b/cdist/conf/type/__apt_update_index/gencode-remote similarity index 100% rename from conf/type/__apt_update_index/gencode-remote rename to cdist/conf/type/__apt_update_index/gencode-remote diff --git a/conf/type/__apt_update_index/man.text b/cdist/conf/type/__apt_update_index/man.text similarity index 100% rename from conf/type/__apt_update_index/man.text rename to cdist/conf/type/__apt_update_index/man.text diff --git a/conf/type/__apt_update_index/singleton b/cdist/conf/type/__apt_update_index/singleton similarity index 100% rename from conf/type/__apt_update_index/singleton rename to cdist/conf/type/__apt_update_index/singleton diff --git a/conf/type/__autofs_map/man.text b/cdist/conf/type/__autofs_map/man.text similarity index 100% rename from conf/type/__autofs_map/man.text rename to cdist/conf/type/__autofs_map/man.text diff --git a/conf/type/__autofs_map/manifest b/cdist/conf/type/__autofs_map/manifest similarity index 100% rename from conf/type/__autofs_map/manifest rename to cdist/conf/type/__autofs_map/manifest diff --git a/conf/type/__autofs_map/parameter/optional b/cdist/conf/type/__autofs_map/parameter/optional similarity index 100% rename from conf/type/__autofs_map/parameter/optional rename to cdist/conf/type/__autofs_map/parameter/optional diff --git a/conf/type/__autofs_map/parameter/required b/cdist/conf/type/__autofs_map/parameter/required similarity index 100% rename from conf/type/__autofs_map/parameter/required rename to cdist/conf/type/__autofs_map/parameter/required diff --git a/conf/type/__autofs_master/files/auto.master.header b/cdist/conf/type/__autofs_master/files/auto.master.header similarity index 100% rename from conf/type/__autofs_master/files/auto.master.header rename to cdist/conf/type/__autofs_master/files/auto.master.header diff --git a/conf/type/__autofs_master/gencode-local b/cdist/conf/type/__autofs_master/gencode-local similarity index 100% rename from conf/type/__autofs_master/gencode-local rename to cdist/conf/type/__autofs_master/gencode-local diff --git a/conf/type/__autofs_master/man.text b/cdist/conf/type/__autofs_master/man.text similarity index 100% rename from conf/type/__autofs_master/man.text rename to cdist/conf/type/__autofs_master/man.text diff --git a/conf/type/__autofs_master/manifest b/cdist/conf/type/__autofs_master/manifest similarity index 100% rename from conf/type/__autofs_master/manifest rename to cdist/conf/type/__autofs_master/manifest diff --git a/conf/type/__autofs_master/parameter/optional b/cdist/conf/type/__autofs_master/parameter/optional similarity index 100% rename from conf/type/__autofs_master/parameter/optional rename to cdist/conf/type/__autofs_master/parameter/optional diff --git a/conf/type/__autofs_master/singleton b/cdist/conf/type/__autofs_master/singleton similarity index 100% rename from conf/type/__autofs_master/singleton rename to cdist/conf/type/__autofs_master/singleton diff --git a/conf/type/__cdistmarker/gencode-remote b/cdist/conf/type/__cdistmarker/gencode-remote similarity index 100% rename from conf/type/__cdistmarker/gencode-remote rename to cdist/conf/type/__cdistmarker/gencode-remote diff --git a/conf/type/__cdistmarker/man.text b/cdist/conf/type/__cdistmarker/man.text similarity index 100% rename from conf/type/__cdistmarker/man.text rename to cdist/conf/type/__cdistmarker/man.text diff --git a/conf/type/__cdistmarker/parameter/optional b/cdist/conf/type/__cdistmarker/parameter/optional similarity index 100% rename from conf/type/__cdistmarker/parameter/optional rename to cdist/conf/type/__cdistmarker/parameter/optional diff --git a/conf/type/__cdistmarker/singleton b/cdist/conf/type/__cdistmarker/singleton similarity index 100% rename from conf/type/__cdistmarker/singleton rename to cdist/conf/type/__cdistmarker/singleton diff --git a/conf/type/__cron/explorer/entry b/cdist/conf/type/__cron/explorer/entry similarity index 100% rename from conf/type/__cron/explorer/entry rename to cdist/conf/type/__cron/explorer/entry diff --git a/conf/type/__cron/gencode-remote b/cdist/conf/type/__cron/gencode-remote similarity index 100% rename from conf/type/__cron/gencode-remote rename to cdist/conf/type/__cron/gencode-remote diff --git a/conf/type/__cron/man.text b/cdist/conf/type/__cron/man.text similarity index 100% rename from conf/type/__cron/man.text rename to cdist/conf/type/__cron/man.text diff --git a/conf/type/__cron/manifest b/cdist/conf/type/__cron/manifest similarity index 100% rename from conf/type/__cron/manifest rename to cdist/conf/type/__cron/manifest diff --git a/conf/type/__cron/parameter/optional b/cdist/conf/type/__cron/parameter/optional similarity index 100% rename from conf/type/__cron/parameter/optional rename to cdist/conf/type/__cron/parameter/optional diff --git a/conf/type/__cron/parameter/required b/cdist/conf/type/__cron/parameter/required similarity index 100% rename from conf/type/__cron/parameter/required rename to cdist/conf/type/__cron/parameter/required diff --git a/conf/type/__debconf_set_selections/gencode-remote b/cdist/conf/type/__debconf_set_selections/gencode-remote similarity index 100% rename from conf/type/__debconf_set_selections/gencode-remote rename to cdist/conf/type/__debconf_set_selections/gencode-remote diff --git a/conf/type/__debconf_set_selections/man.text b/cdist/conf/type/__debconf_set_selections/man.text similarity index 100% rename from conf/type/__debconf_set_selections/man.text rename to cdist/conf/type/__debconf_set_selections/man.text diff --git a/conf/type/__debconf_set_selections/parameter/required b/cdist/conf/type/__debconf_set_selections/parameter/required similarity index 100% rename from conf/type/__debconf_set_selections/parameter/required rename to cdist/conf/type/__debconf_set_selections/parameter/required diff --git a/conf/type/__directory/explorer/state b/cdist/conf/type/__directory/explorer/state similarity index 100% rename from conf/type/__directory/explorer/state rename to cdist/conf/type/__directory/explorer/state diff --git a/conf/type/__directory/gencode-remote b/cdist/conf/type/__directory/gencode-remote similarity index 89% rename from conf/type/__directory/gencode-remote rename to cdist/conf/type/__directory/gencode-remote index 56bd73a1..21f4c5b6 100755 --- a/conf/type/__directory/gencode-remote +++ b/cdist/conf/type/__directory/gencode-remote @@ -18,7 +18,6 @@ # along with cdist. If not, see . # -# Check state and exit if nothing needs to be done state_should="present" [ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" state_is="$(cat "$__object/explorer/state")" @@ -27,9 +26,9 @@ state_is="$(cat "$__object/explorer/state")" destination="/$__object_id" mkdiropt="" -grep yes "$__object/parameter/parents" >/dev/null 2>&1 && mkdiropt="-p" +[ -f "$__object/parameter/parents" ] && mkdiropt="-p" recursive="" -grep yes "$__object/parameter/recursive" >/dev/null 2>&1 && recursive="-R" +[ -f "$__object/parameter/recursive" ] && recursive="-R" case "$state_should" in present) diff --git a/conf/type/__directory/man.text b/cdist/conf/type/__directory/man.text similarity index 80% rename from conf/type/__directory/man.text rename to cdist/conf/type/__directory/man.text index afba0875..1f4def7d 100644 --- a/conf/type/__directory/man.text +++ b/cdist/conf/type/__directory/man.text @@ -32,13 +32,15 @@ mode:: owner:: User to chown to. + +BOOLEAN PARAMETERS +------------------ parents:: - Whether to create parents as well (mkdir -p behaviour). Must be yes or no. + Whether to create parents as well (mkdir -p behaviour) recursive:: If supplied the chgrp and chown call will run recursively. This does *not* influence the behaviour of chmod. - Must be yes or no. EXAMPLES @@ -55,13 +57,18 @@ __directory /tmp/foobar --state absent __directory /etc --owner root --group root --mode 0755 # Create nfs service directory, including parents -__directory /home/services/nfs --parents yes +__directory /home/services/nfs --parents # Change permissions recursively -__directory /home/services --recursive yes --owner root --group root +__directory /home/services --recursive --owner root --group root # Setup a temp directory __directory /local --mode 1777 + +# Take it all +__directory /home/services/kvm --recursive --parents \ + --owner root --group root --mode 0755 --state present + -------------------------------------------------------------------------------- diff --git a/cdist/conf/type/__directory/parameter/boolean b/cdist/conf/type/__directory/parameter/boolean new file mode 100644 index 00000000..357c5e81 --- /dev/null +++ b/cdist/conf/type/__directory/parameter/boolean @@ -0,0 +1,2 @@ +parents +recursive diff --git a/conf/type/__directory/parameter/optional b/cdist/conf/type/__directory/parameter/optional similarity index 56% rename from conf/type/__directory/parameter/optional rename to cdist/conf/type/__directory/parameter/optional index 27f9d76a..08798bc5 100644 --- a/conf/type/__directory/parameter/optional +++ b/cdist/conf/type/__directory/parameter/optional @@ -2,5 +2,3 @@ state group mode owner -parents -recursive diff --git a/conf/type/__file/explorer/cksum b/cdist/conf/type/__file/explorer/cksum similarity index 100% rename from conf/type/__file/explorer/cksum rename to cdist/conf/type/__file/explorer/cksum diff --git a/conf/type/__file/explorer/exists b/cdist/conf/type/__file/explorer/exists similarity index 100% rename from conf/type/__file/explorer/exists rename to cdist/conf/type/__file/explorer/exists diff --git a/conf/type/__file/gencode-local b/cdist/conf/type/__file/gencode-local similarity index 100% rename from conf/type/__file/gencode-local rename to cdist/conf/type/__file/gencode-local diff --git a/conf/type/__file/gencode-remote b/cdist/conf/type/__file/gencode-remote similarity index 100% rename from conf/type/__file/gencode-remote rename to cdist/conf/type/__file/gencode-remote diff --git a/conf/type/__file/man.text b/cdist/conf/type/__file/man.text similarity index 100% rename from conf/type/__file/man.text rename to cdist/conf/type/__file/man.text diff --git a/conf/type/__file/manifest b/cdist/conf/type/__file/manifest similarity index 100% rename from conf/type/__file/manifest rename to cdist/conf/type/__file/manifest diff --git a/conf/type/__file/parameter/optional b/cdist/conf/type/__file/parameter/optional similarity index 100% rename from conf/type/__file/parameter/optional rename to cdist/conf/type/__file/parameter/optional diff --git a/conf/type/__group/TODO b/cdist/conf/type/__group/TODO similarity index 100% rename from conf/type/__group/TODO rename to cdist/conf/type/__group/TODO diff --git a/conf/type/__group/explorer/group b/cdist/conf/type/__group/explorer/group similarity index 100% rename from conf/type/__group/explorer/group rename to cdist/conf/type/__group/explorer/group diff --git a/conf/type/__group/explorer/gshadow b/cdist/conf/type/__group/explorer/gshadow similarity index 100% rename from conf/type/__group/explorer/gshadow rename to cdist/conf/type/__group/explorer/gshadow diff --git a/conf/type/__group/gencode-remote b/cdist/conf/type/__group/gencode-remote similarity index 100% rename from conf/type/__group/gencode-remote rename to cdist/conf/type/__group/gencode-remote diff --git a/conf/type/__group/man.text b/cdist/conf/type/__group/man.text similarity index 100% rename from conf/type/__group/man.text rename to cdist/conf/type/__group/man.text diff --git a/conf/type/__group/parameter/optional b/cdist/conf/type/__group/parameter/optional similarity index 100% rename from conf/type/__group/parameter/optional rename to cdist/conf/type/__group/parameter/optional diff --git a/conf/type/__issue/files/archlinux b/cdist/conf/type/__issue/files/archlinux similarity index 100% rename from conf/type/__issue/files/archlinux rename to cdist/conf/type/__issue/files/archlinux diff --git a/conf/type/__issue/files/default b/cdist/conf/type/__issue/files/default similarity index 100% rename from conf/type/__issue/files/default rename to cdist/conf/type/__issue/files/default diff --git a/conf/type/__issue/files/redhat b/cdist/conf/type/__issue/files/redhat similarity index 100% rename from conf/type/__issue/files/redhat rename to cdist/conf/type/__issue/files/redhat diff --git a/conf/type/__issue/man.text b/cdist/conf/type/__issue/man.text similarity index 100% rename from conf/type/__issue/man.text rename to cdist/conf/type/__issue/man.text diff --git a/conf/type/__issue/manifest b/cdist/conf/type/__issue/manifest similarity index 100% rename from conf/type/__issue/manifest rename to cdist/conf/type/__issue/manifest diff --git a/conf/type/__issue/parameter/optional b/cdist/conf/type/__issue/parameter/optional similarity index 100% rename from conf/type/__issue/parameter/optional rename to cdist/conf/type/__issue/parameter/optional diff --git a/conf/type/__issue/singleton b/cdist/conf/type/__issue/singleton similarity index 100% rename from conf/type/__issue/singleton rename to cdist/conf/type/__issue/singleton diff --git a/conf/type/__jail/.gitignore b/cdist/conf/type/__jail/.gitignore similarity index 100% rename from conf/type/__jail/.gitignore rename to cdist/conf/type/__jail/.gitignore diff --git a/conf/type/__jail/explorer/basepresent b/cdist/conf/type/__jail/explorer/basepresent similarity index 100% rename from conf/type/__jail/explorer/basepresent rename to cdist/conf/type/__jail/explorer/basepresent diff --git a/conf/type/__jail/explorer/present b/cdist/conf/type/__jail/explorer/present similarity index 100% rename from conf/type/__jail/explorer/present rename to cdist/conf/type/__jail/explorer/present diff --git a/conf/type/__jail/explorer/status b/cdist/conf/type/__jail/explorer/status similarity index 100% rename from conf/type/__jail/explorer/status rename to cdist/conf/type/__jail/explorer/status diff --git a/conf/type/__jail/gencode-local b/cdist/conf/type/__jail/gencode-local similarity index 100% rename from conf/type/__jail/gencode-local rename to cdist/conf/type/__jail/gencode-local diff --git a/conf/type/__jail/gencode-remote b/cdist/conf/type/__jail/gencode-remote similarity index 100% rename from conf/type/__jail/gencode-remote rename to cdist/conf/type/__jail/gencode-remote diff --git a/conf/type/__jail/man.text b/cdist/conf/type/__jail/man.text similarity index 100% rename from conf/type/__jail/man.text rename to cdist/conf/type/__jail/man.text diff --git a/conf/type/__jail/manifest b/cdist/conf/type/__jail/manifest similarity index 100% rename from conf/type/__jail/manifest rename to cdist/conf/type/__jail/manifest diff --git a/conf/type/__jail/parameter/optional b/cdist/conf/type/__jail/parameter/optional similarity index 100% rename from conf/type/__jail/parameter/optional rename to cdist/conf/type/__jail/parameter/optional diff --git a/conf/type/__jail/parameter/required b/cdist/conf/type/__jail/parameter/required similarity index 100% rename from conf/type/__jail/parameter/required rename to cdist/conf/type/__jail/parameter/required diff --git a/conf/type/__key_value/explorer/state b/cdist/conf/type/__key_value/explorer/state similarity index 100% rename from conf/type/__key_value/explorer/state rename to cdist/conf/type/__key_value/explorer/state diff --git a/conf/type/__key_value/gencode-remote b/cdist/conf/type/__key_value/gencode-remote similarity index 100% rename from conf/type/__key_value/gencode-remote rename to cdist/conf/type/__key_value/gencode-remote diff --git a/conf/type/__key_value/man.text b/cdist/conf/type/__key_value/man.text similarity index 100% rename from conf/type/__key_value/man.text rename to cdist/conf/type/__key_value/man.text diff --git a/conf/type/__key_value/manifest b/cdist/conf/type/__key_value/manifest similarity index 100% rename from conf/type/__key_value/manifest rename to cdist/conf/type/__key_value/manifest diff --git a/conf/type/__key_value/parameter/optional b/cdist/conf/type/__key_value/parameter/optional similarity index 100% rename from conf/type/__key_value/parameter/optional rename to cdist/conf/type/__key_value/parameter/optional diff --git a/conf/type/__key_value/parameter/required b/cdist/conf/type/__key_value/parameter/required similarity index 100% rename from conf/type/__key_value/parameter/required rename to cdist/conf/type/__key_value/parameter/required diff --git a/conf/type/__line/explorer/state b/cdist/conf/type/__line/explorer/state similarity index 100% rename from conf/type/__line/explorer/state rename to cdist/conf/type/__line/explorer/state diff --git a/conf/type/__line/gencode-remote b/cdist/conf/type/__line/gencode-remote similarity index 100% rename from conf/type/__line/gencode-remote rename to cdist/conf/type/__line/gencode-remote diff --git a/conf/type/__line/man.text b/cdist/conf/type/__line/man.text similarity index 100% rename from conf/type/__line/man.text rename to cdist/conf/type/__line/man.text diff --git a/conf/type/__line/parameter/optional b/cdist/conf/type/__line/parameter/optional similarity index 100% rename from conf/type/__line/parameter/optional rename to cdist/conf/type/__line/parameter/optional diff --git a/conf/type/__link/explorer/state b/cdist/conf/type/__link/explorer/state similarity index 100% rename from conf/type/__link/explorer/state rename to cdist/conf/type/__link/explorer/state diff --git a/conf/type/__link/gencode-remote b/cdist/conf/type/__link/gencode-remote similarity index 100% rename from conf/type/__link/gencode-remote rename to cdist/conf/type/__link/gencode-remote diff --git a/conf/type/__link/man.text b/cdist/conf/type/__link/man.text similarity index 100% rename from conf/type/__link/man.text rename to cdist/conf/type/__link/man.text diff --git a/conf/type/__link/manifest b/cdist/conf/type/__link/manifest similarity index 100% rename from conf/type/__link/manifest rename to cdist/conf/type/__link/manifest diff --git a/conf/type/__link/parameter/optional b/cdist/conf/type/__link/parameter/optional similarity index 100% rename from conf/type/__link/parameter/optional rename to cdist/conf/type/__link/parameter/optional diff --git a/conf/type/__link/parameter/required b/cdist/conf/type/__link/parameter/required similarity index 100% rename from conf/type/__link/parameter/required rename to cdist/conf/type/__link/parameter/required diff --git a/conf/type/__mkfs/gencode-remote b/cdist/conf/type/__mkfs/gencode-remote similarity index 100% rename from conf/type/__mkfs/gencode-remote rename to cdist/conf/type/__mkfs/gencode-remote diff --git a/conf/type/__mkfs/install b/cdist/conf/type/__mkfs/install similarity index 100% rename from conf/type/__mkfs/install rename to cdist/conf/type/__mkfs/install diff --git a/conf/type/__mkfs/man.text b/cdist/conf/type/__mkfs/man.text similarity index 100% rename from conf/type/__mkfs/man.text rename to cdist/conf/type/__mkfs/man.text diff --git a/conf/type/__mkfs/manifest b/cdist/conf/type/__mkfs/manifest similarity index 100% rename from conf/type/__mkfs/manifest rename to cdist/conf/type/__mkfs/manifest diff --git a/conf/type/__mkfs/parameter/optional b/cdist/conf/type/__mkfs/parameter/optional similarity index 100% rename from conf/type/__mkfs/parameter/optional rename to cdist/conf/type/__mkfs/parameter/optional diff --git a/conf/type/__mkfs/parameter/required b/cdist/conf/type/__mkfs/parameter/required similarity index 100% rename from conf/type/__mkfs/parameter/required rename to cdist/conf/type/__mkfs/parameter/required diff --git a/conf/type/__motd/files/motd b/cdist/conf/type/__motd/files/motd similarity index 100% rename from conf/type/__motd/files/motd rename to cdist/conf/type/__motd/files/motd diff --git a/conf/type/__motd/man.text b/cdist/conf/type/__motd/man.text similarity index 100% rename from conf/type/__motd/man.text rename to cdist/conf/type/__motd/man.text diff --git a/conf/type/__motd/manifest b/cdist/conf/type/__motd/manifest similarity index 100% rename from conf/type/__motd/manifest rename to cdist/conf/type/__motd/manifest diff --git a/conf/type/__motd/parameter/optional b/cdist/conf/type/__motd/parameter/optional similarity index 100% rename from conf/type/__motd/parameter/optional rename to cdist/conf/type/__motd/parameter/optional diff --git a/conf/type/__motd/singleton b/cdist/conf/type/__motd/singleton similarity index 100% rename from conf/type/__motd/singleton rename to cdist/conf/type/__motd/singleton diff --git a/conf/type/__mysql_database/gencode-remote b/cdist/conf/type/__mysql_database/gencode-remote similarity index 100% rename from conf/type/__mysql_database/gencode-remote rename to cdist/conf/type/__mysql_database/gencode-remote diff --git a/conf/type/__mysql_database/man.text b/cdist/conf/type/__mysql_database/man.text similarity index 100% rename from conf/type/__mysql_database/man.text rename to cdist/conf/type/__mysql_database/man.text diff --git a/conf/type/__mysql_database/parameter/optional b/cdist/conf/type/__mysql_database/parameter/optional similarity index 100% rename from conf/type/__mysql_database/parameter/optional rename to cdist/conf/type/__mysql_database/parameter/optional diff --git a/conf/type/__package/man.text b/cdist/conf/type/__package/man.text similarity index 95% rename from conf/type/__package/man.text rename to cdist/conf/type/__package/man.text index 9ad9747a..69ecf0ad 100644 --- a/conf/type/__package/man.text +++ b/cdist/conf/type/__package/man.text @@ -35,7 +35,6 @@ type:: state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). EXAMPLES diff --git a/conf/type/__package/manifest b/cdist/conf/type/__package/manifest similarity index 100% rename from conf/type/__package/manifest rename to cdist/conf/type/__package/manifest diff --git a/conf/type/__package/parameter/optional b/cdist/conf/type/__package/parameter/optional similarity index 100% rename from conf/type/__package/parameter/optional rename to cdist/conf/type/__package/parameter/optional diff --git a/conf/type/__package_apt/explorer/state b/cdist/conf/type/__package_apt/explorer/state similarity index 100% rename from conf/type/__package_apt/explorer/state rename to cdist/conf/type/__package_apt/explorer/state diff --git a/conf/type/__package_apt/gencode-remote b/cdist/conf/type/__package_apt/gencode-remote similarity index 77% rename from conf/type/__package_apt/gencode-remote rename to cdist/conf/type/__package_apt/gencode-remote index 14b2f884..a80d707e 100755 --- a/conf/type/__package_apt/gencode-remote +++ b/cdist/conf/type/__package_apt/gencode-remote @@ -33,18 +33,6 @@ else state_should="present" fi -# Correct pre 2.1 naming - FIXME in 2.1 -case "$state_should" in - installed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - removed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac - # FIXME: use grep directly, state is a list, not a line! state_is="$(cat "$__object/explorer/state")" case "$state_is" in diff --git a/conf/type/__package_apt/man.text b/cdist/conf/type/__package_apt/man.text similarity index 88% rename from conf/type/__package_apt/man.text rename to cdist/conf/type/__package_apt/man.text index 7e880054..35c34d33 100644 --- a/conf/type/__package_apt/man.text +++ b/cdist/conf/type/__package_apt/man.text @@ -26,7 +26,6 @@ name:: state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). EXAMPLES @@ -52,5 +51,5 @@ SEE ALSO COPYING ------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is +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/conf/type/__package_apt/notes.txt b/cdist/conf/type/__package_apt/notes.txt similarity index 100% rename from conf/type/__package_apt/notes.txt rename to cdist/conf/type/__package_apt/notes.txt diff --git a/conf/type/__package_apt/parameter/optional b/cdist/conf/type/__package_apt/parameter/optional similarity index 100% rename from conf/type/__package_apt/parameter/optional rename to cdist/conf/type/__package_apt/parameter/optional diff --git a/conf/type/__package_luarocks/explorer/pkg_status b/cdist/conf/type/__package_luarocks/explorer/pkg_status similarity index 100% rename from conf/type/__package_luarocks/explorer/pkg_status rename to cdist/conf/type/__package_luarocks/explorer/pkg_status diff --git a/conf/type/__package_luarocks/gencode-remote b/cdist/conf/type/__package_luarocks/gencode-remote similarity index 75% rename from conf/type/__package_luarocks/gencode-remote rename to cdist/conf/type/__package_luarocks/gencode-remote index e8a7240c..7a5a5b04 100755 --- a/conf/type/__package_luarocks/gencode-remote +++ b/cdist/conf/type/__package_luarocks/gencode-remote @@ -34,18 +34,6 @@ if [ -f "$__object/parameter/state" ]; then else state_should="present" fi -# Correct pre 2.1 naming - FIXME in 2.1 -case "$state_should" in - installed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - removed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac - if grep -q "(installed)" "$__object/explorer/pkg_status"; then state_is="present" diff --git a/conf/type/__package_luarocks/man.text b/cdist/conf/type/__package_luarocks/man.text similarity index 93% rename from conf/type/__package_luarocks/man.text rename to cdist/conf/type/__package_luarocks/man.text index 75083821..18a80a79 100644 --- a/conf/type/__package_luarocks/man.text +++ b/cdist/conf/type/__package_luarocks/man.text @@ -25,7 +25,6 @@ name:: state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). EXAMPLES diff --git a/conf/type/__package_luarocks/manifest b/cdist/conf/type/__package_luarocks/manifest similarity index 100% rename from conf/type/__package_luarocks/manifest rename to cdist/conf/type/__package_luarocks/manifest diff --git a/conf/type/__package_luarocks/parameter/optional b/cdist/conf/type/__package_luarocks/parameter/optional similarity index 100% rename from conf/type/__package_luarocks/parameter/optional rename to cdist/conf/type/__package_luarocks/parameter/optional diff --git a/conf/type/__package_opkg/explorer/pkg_status b/cdist/conf/type/__package_opkg/explorer/pkg_status similarity index 100% rename from conf/type/__package_opkg/explorer/pkg_status rename to cdist/conf/type/__package_opkg/explorer/pkg_status diff --git a/conf/type/__package_opkg/gencode-remote b/cdist/conf/type/__package_opkg/gencode-remote similarity index 99% rename from conf/type/__package_opkg/gencode-remote rename to cdist/conf/type/__package_opkg/gencode-remote index 99f86632..43f1ad8a 100755 --- a/conf/type/__package_opkg/gencode-remote +++ b/cdist/conf/type/__package_opkg/gencode-remote @@ -59,4 +59,3 @@ if [ "$state_is" != "$state_should" ]; then ;; esac fi - diff --git a/conf/type/__package_opkg/man.text b/cdist/conf/type/__package_opkg/man.text similarity index 100% rename from conf/type/__package_opkg/man.text rename to cdist/conf/type/__package_opkg/man.text diff --git a/conf/type/__package_opkg/parameter/optional b/cdist/conf/type/__package_opkg/parameter/optional similarity index 100% rename from conf/type/__package_opkg/parameter/optional rename to cdist/conf/type/__package_opkg/parameter/optional diff --git a/conf/type/__package_pacman/explorer/pkg_version b/cdist/conf/type/__package_pacman/explorer/pkg_version similarity index 100% rename from conf/type/__package_pacman/explorer/pkg_version rename to cdist/conf/type/__package_pacman/explorer/pkg_version diff --git a/conf/type/__package_pacman/gencode-remote b/cdist/conf/type/__package_pacman/gencode-remote similarity index 77% rename from conf/type/__package_pacman/gencode-remote rename to cdist/conf/type/__package_pacman/gencode-remote index 9918d28d..02744fa8 100755 --- a/conf/type/__package_pacman/gencode-remote +++ b/cdist/conf/type/__package_pacman/gencode-remote @@ -36,16 +36,6 @@ if [ -f "$__object/parameter/state" ]; then else state_should="present" fi -case "$state_should" in - installed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - removed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac pkg_version="$(cat "$__object/explorer/pkg_version")" if [ -z "$pkg_version" ]; then diff --git a/conf/type/__package_pacman/man.text b/cdist/conf/type/__package_pacman/man.text similarity index 94% rename from conf/type/__package_pacman/man.text rename to cdist/conf/type/__package_pacman/man.text index b6d07c94..17c2037a 100644 --- a/conf/type/__package_pacman/man.text +++ b/cdist/conf/type/__package_pacman/man.text @@ -26,7 +26,6 @@ name:: state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). EXAMPLES diff --git a/conf/type/__package_pacman/parameter/optional b/cdist/conf/type/__package_pacman/parameter/optional similarity index 100% rename from conf/type/__package_pacman/parameter/optional rename to cdist/conf/type/__package_pacman/parameter/optional diff --git a/conf/type/__package_pip/explorer/state b/cdist/conf/type/__package_pip/explorer/state similarity index 100% rename from conf/type/__package_pip/explorer/state rename to cdist/conf/type/__package_pip/explorer/state diff --git a/conf/type/__package_pip/gencode-remote b/cdist/conf/type/__package_pip/gencode-remote similarity index 100% rename from conf/type/__package_pip/gencode-remote rename to cdist/conf/type/__package_pip/gencode-remote diff --git a/conf/type/__package_pip/man.text b/cdist/conf/type/__package_pip/man.text similarity index 100% rename from conf/type/__package_pip/man.text rename to cdist/conf/type/__package_pip/man.text diff --git a/conf/type/__package_pip/parameter/optional b/cdist/conf/type/__package_pip/parameter/optional similarity index 100% rename from conf/type/__package_pip/parameter/optional rename to cdist/conf/type/__package_pip/parameter/optional diff --git a/conf/type/__package_pkg_freebsd/explorer/pkg_version b/cdist/conf/type/__package_pkg_freebsd/explorer/pkg_version similarity index 100% rename from conf/type/__package_pkg_freebsd/explorer/pkg_version rename to cdist/conf/type/__package_pkg_freebsd/explorer/pkg_version diff --git a/conf/type/__package_pkg_freebsd/gencode-remote b/cdist/conf/type/__package_pkg_freebsd/gencode-remote similarity index 99% rename from conf/type/__package_pkg_freebsd/gencode-remote rename to cdist/conf/type/__package_pkg_freebsd/gencode-remote index f7dbbd7f..3f5ebde7 100755 --- a/conf/type/__package_pkg_freebsd/gencode-remote +++ b/cdist/conf/type/__package_pkg_freebsd/gencode-remote @@ -137,4 +137,3 @@ fi # Debug #set +x - diff --git a/conf/type/__package_pkg_freebsd/man.text b/cdist/conf/type/__package_pkg_freebsd/man.text similarity index 85% rename from conf/type/__package_pkg_freebsd/man.text rename to cdist/conf/type/__package_pkg_freebsd/man.text index 3087cae1..f1589037 100644 --- a/conf/type/__package_pkg_freebsd/man.text +++ b/cdist/conf/type/__package_pkg_freebsd/man.text @@ -41,16 +41,16 @@ EXAMPLES -------------------------------------------------------------------------------- # Ensure zsh is installed -__package_pkg_freebsd zsh --state installed +__package_pkg_freebsd zsh --state present # Ensure vim is installed, use flavor no_x11 -__package_pkg_freebsd vim --state installed --flavor no_x11 +__package_pkg_freebsd vim --state present --flavor no_x11 # If you don't want to follow pythonX packages, but always use python -__package_pkg_freebsd python --state installed --name python2 +__package_pkg_freebsd python --state present --name python2 # Remove obsolete package -__package_pkg_freebsd puppet --state removed +__package_pkg_freebsd puppet --state absent -------------------------------------------------------------------------------- diff --git a/conf/type/__package_pkg_freebsd/parameter/optional b/cdist/conf/type/__package_pkg_freebsd/parameter/optional similarity index 100% rename from conf/type/__package_pkg_freebsd/parameter/optional rename to cdist/conf/type/__package_pkg_freebsd/parameter/optional diff --git a/conf/type/__package_pkg_openbsd/explorer/pkg_version b/cdist/conf/type/__package_pkg_openbsd/explorer/pkg_version similarity index 100% rename from conf/type/__package_pkg_openbsd/explorer/pkg_version rename to cdist/conf/type/__package_pkg_openbsd/explorer/pkg_version diff --git a/conf/type/__package_pkg_openbsd/gencode-remote b/cdist/conf/type/__package_pkg_openbsd/gencode-remote similarity index 82% rename from conf/type/__package_pkg_openbsd/gencode-remote rename to cdist/conf/type/__package_pkg_openbsd/gencode-remote index 7788c210..1df87997 100755 --- a/conf/type/__package_pkg_openbsd/gencode-remote +++ b/cdist/conf/type/__package_pkg_openbsd/gencode-remote @@ -47,17 +47,6 @@ if [ -f "$__object/parameter/state" ]; then else state_should="present" fi -# Correct pre 2.1 naming - FIXME in 2.1 -case "$state_should" in - installed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - removed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac pkg_version="$(cat "$__object/explorer/pkg_version")" diff --git a/conf/type/__package_pkg_openbsd/man.text b/cdist/conf/type/__package_pkg_openbsd/man.text similarity index 94% rename from conf/type/__package_pkg_openbsd/man.text rename to cdist/conf/type/__package_pkg_openbsd/man.text index 91c8d378..8fcc3216 100644 --- a/conf/type/__package_pkg_openbsd/man.text +++ b/cdist/conf/type/__package_pkg_openbsd/man.text @@ -28,7 +28,6 @@ flavor:: state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). EXAMPLES diff --git a/conf/type/__package_pkg_openbsd/parameter/optional b/cdist/conf/type/__package_pkg_openbsd/parameter/optional similarity index 100% rename from conf/type/__package_pkg_openbsd/parameter/optional rename to cdist/conf/type/__package_pkg_openbsd/parameter/optional diff --git a/conf/type/__package_rubygem/explorer/pkg_status b/cdist/conf/type/__package_rubygem/explorer/pkg_status similarity index 100% rename from conf/type/__package_rubygem/explorer/pkg_status rename to cdist/conf/type/__package_rubygem/explorer/pkg_status diff --git a/conf/type/__package_rubygem/gencode-remote b/cdist/conf/type/__package_rubygem/gencode-remote similarity index 75% rename from conf/type/__package_rubygem/gencode-remote rename to cdist/conf/type/__package_rubygem/gencode-remote index 059e125e..6256e308 100755 --- a/conf/type/__package_rubygem/gencode-remote +++ b/cdist/conf/type/__package_rubygem/gencode-remote @@ -32,17 +32,6 @@ if [ -f "$__object/parameter/state" ]; then else state_should="present" fi -# Correct pre 2.1 naming - FIXME in 2.1 -case "$state_should" in - installed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - removed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac if grep -q true "$__object/explorer/pkg_status"; then state_is="present" diff --git a/conf/type/__package_rubygem/man.text b/cdist/conf/type/__package_rubygem/man.text similarity index 93% rename from conf/type/__package_rubygem/man.text rename to cdist/conf/type/__package_rubygem/man.text index 55b202dc..feefe699 100644 --- a/conf/type/__package_rubygem/man.text +++ b/cdist/conf/type/__package_rubygem/man.text @@ -25,7 +25,6 @@ name:: state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). EXAMPLES diff --git a/conf/type/__package_rubygem/parameter/optional b/cdist/conf/type/__package_rubygem/parameter/optional similarity index 100% rename from conf/type/__package_rubygem/parameter/optional rename to cdist/conf/type/__package_rubygem/parameter/optional diff --git a/conf/type/__package_yum/explorer/pkg_version b/cdist/conf/type/__package_yum/explorer/pkg_version similarity index 100% rename from conf/type/__package_yum/explorer/pkg_version rename to cdist/conf/type/__package_yum/explorer/pkg_version diff --git a/conf/type/__package_yum/gencode-remote b/cdist/conf/type/__package_yum/gencode-remote similarity index 78% rename from conf/type/__package_yum/gencode-remote rename to cdist/conf/type/__package_yum/gencode-remote index 71c8034a..9c98c257 100755 --- a/conf/type/__package_yum/gencode-remote +++ b/cdist/conf/type/__package_yum/gencode-remote @@ -32,16 +32,6 @@ if [ -f "$__object/parameter/state" ]; then else state_should="present" fi -case "$state_should" in - installed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - removed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac if grep -q -E "(centos|redhat|amazon)" "$__global/explorer/os"; then opts="-y --quiet" diff --git a/conf/type/__package_yum/man.text b/cdist/conf/type/__package_yum/man.text similarity index 94% rename from conf/type/__package_yum/man.text rename to cdist/conf/type/__package_yum/man.text index 30c3f308..9aabf7fb 100644 --- a/conf/type/__package_yum/man.text +++ b/cdist/conf/type/__package_yum/man.text @@ -53,5 +53,5 @@ SEE ALSO COPYING ------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is +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/conf/type/__package_yum/parameter/optional b/cdist/conf/type/__package_yum/parameter/optional similarity index 100% rename from conf/type/__package_yum/parameter/optional rename to cdist/conf/type/__package_yum/parameter/optional diff --git a/conf/type/__package_zypper/explorer/pkg_version b/cdist/conf/type/__package_zypper/explorer/pkg_version similarity index 100% rename from conf/type/__package_zypper/explorer/pkg_version rename to cdist/conf/type/__package_zypper/explorer/pkg_version diff --git a/conf/type/__package_zypper/gencode-remote b/cdist/conf/type/__package_zypper/gencode-remote similarity index 100% rename from conf/type/__package_zypper/gencode-remote rename to cdist/conf/type/__package_zypper/gencode-remote diff --git a/conf/type/__package_zypper/man.text b/cdist/conf/type/__package_zypper/man.text similarity index 100% rename from conf/type/__package_zypper/man.text rename to cdist/conf/type/__package_zypper/man.text diff --git a/conf/type/__package_zypper/parameter/optional b/cdist/conf/type/__package_zypper/parameter/optional similarity index 100% rename from conf/type/__package_zypper/parameter/optional rename to cdist/conf/type/__package_zypper/parameter/optional diff --git a/conf/type/__partition_msdos/install b/cdist/conf/type/__partition_msdos/install similarity index 100% rename from conf/type/__partition_msdos/install rename to cdist/conf/type/__partition_msdos/install diff --git a/conf/type/__partition_msdos/man.text b/cdist/conf/type/__partition_msdos/man.text similarity index 100% rename from conf/type/__partition_msdos/man.text rename to cdist/conf/type/__partition_msdos/man.text diff --git a/conf/type/__partition_msdos/manifest b/cdist/conf/type/__partition_msdos/manifest similarity index 100% rename from conf/type/__partition_msdos/manifest rename to cdist/conf/type/__partition_msdos/manifest diff --git a/conf/type/__partition_msdos/parameter/optional b/cdist/conf/type/__partition_msdos/parameter/optional similarity index 100% rename from conf/type/__partition_msdos/parameter/optional rename to cdist/conf/type/__partition_msdos/parameter/optional diff --git a/conf/type/__partition_msdos/parameter/required b/cdist/conf/type/__partition_msdos/parameter/required similarity index 100% rename from conf/type/__partition_msdos/parameter/required rename to cdist/conf/type/__partition_msdos/parameter/required diff --git a/conf/type/__partition_msdos_apply/explorer/partitions b/cdist/conf/type/__partition_msdos_apply/explorer/partitions similarity index 100% rename from conf/type/__partition_msdos_apply/explorer/partitions rename to cdist/conf/type/__partition_msdos_apply/explorer/partitions diff --git a/conf/type/__partition_msdos_apply/files/lib.sh b/cdist/conf/type/__partition_msdos_apply/files/lib.sh similarity index 100% rename from conf/type/__partition_msdos_apply/files/lib.sh rename to cdist/conf/type/__partition_msdos_apply/files/lib.sh diff --git a/conf/type/__partition_msdos_apply/gencode-remote b/cdist/conf/type/__partition_msdos_apply/gencode-remote similarity index 100% rename from conf/type/__partition_msdos_apply/gencode-remote rename to cdist/conf/type/__partition_msdos_apply/gencode-remote diff --git a/conf/type/__partition_msdos_apply/install b/cdist/conf/type/__partition_msdos_apply/install similarity index 100% rename from conf/type/__partition_msdos_apply/install rename to cdist/conf/type/__partition_msdos_apply/install diff --git a/conf/type/__partition_msdos_apply/man.text b/cdist/conf/type/__partition_msdos_apply/man.text similarity index 100% rename from conf/type/__partition_msdos_apply/man.text rename to cdist/conf/type/__partition_msdos_apply/man.text diff --git a/conf/type/__partition_msdos_apply/singleton b/cdist/conf/type/__partition_msdos_apply/singleton similarity index 100% rename from conf/type/__partition_msdos_apply/singleton rename to cdist/conf/type/__partition_msdos_apply/singleton diff --git a/conf/type/__pf_apply/explorer/rcvar b/cdist/conf/type/__pf_apply/explorer/rcvar similarity index 100% rename from conf/type/__pf_apply/explorer/rcvar rename to cdist/conf/type/__pf_apply/explorer/rcvar diff --git a/conf/type/__pf_apply/gencode-remote b/cdist/conf/type/__pf_apply/gencode-remote similarity index 100% rename from conf/type/__pf_apply/gencode-remote rename to cdist/conf/type/__pf_apply/gencode-remote diff --git a/conf/type/__pf_apply/man.text b/cdist/conf/type/__pf_apply/man.text similarity index 96% rename from conf/type/__pf_apply/man.text rename to cdist/conf/type/__pf_apply/man.text index 55bf5745..2e0d7802 100644 --- a/conf/type/__pf_apply/man.text +++ b/cdist/conf/type/__pf_apply/man.text @@ -1,5 +1,5 @@ cdist-type__pf_apply(7) -================================== +======================= Jake Guffey diff --git a/conf/type/__pf_apply/singleton b/cdist/conf/type/__pf_apply/singleton similarity index 100% rename from conf/type/__pf_apply/singleton rename to cdist/conf/type/__pf_apply/singleton diff --git a/conf/type/__pf_ruleset/explorer/cksum b/cdist/conf/type/__pf_ruleset/explorer/cksum similarity index 100% rename from conf/type/__pf_ruleset/explorer/cksum rename to cdist/conf/type/__pf_ruleset/explorer/cksum diff --git a/conf/type/__pf_ruleset/explorer/rcvar b/cdist/conf/type/__pf_ruleset/explorer/rcvar similarity index 100% rename from conf/type/__pf_ruleset/explorer/rcvar rename to cdist/conf/type/__pf_ruleset/explorer/rcvar diff --git a/conf/type/__pf_ruleset/gencode-local b/cdist/conf/type/__pf_ruleset/gencode-local similarity index 100% rename from conf/type/__pf_ruleset/gencode-local rename to cdist/conf/type/__pf_ruleset/gencode-local diff --git a/conf/type/__pf_ruleset/gencode-remote b/cdist/conf/type/__pf_ruleset/gencode-remote similarity index 100% rename from conf/type/__pf_ruleset/gencode-remote rename to cdist/conf/type/__pf_ruleset/gencode-remote diff --git a/conf/type/__pf_ruleset/man.text b/cdist/conf/type/__pf_ruleset/man.text similarity index 97% rename from conf/type/__pf_ruleset/man.text rename to cdist/conf/type/__pf_ruleset/man.text index 68601fad..5c368e77 100644 --- a/conf/type/__pf_ruleset/man.text +++ b/cdist/conf/type/__pf_ruleset/man.text @@ -1,5 +1,5 @@ cdist-type__pf_ruleset(7) -================================== +========================= Jake Guffey diff --git a/conf/type/__pf_ruleset/parameter/optional b/cdist/conf/type/__pf_ruleset/parameter/optional similarity index 100% rename from conf/type/__pf_ruleset/parameter/optional rename to cdist/conf/type/__pf_ruleset/parameter/optional diff --git a/conf/type/__pf_ruleset/parameter/required b/cdist/conf/type/__pf_ruleset/parameter/required similarity index 100% rename from conf/type/__pf_ruleset/parameter/required rename to cdist/conf/type/__pf_ruleset/parameter/required diff --git a/conf/type/__pf_ruleset/singleton b/cdist/conf/type/__pf_ruleset/singleton similarity index 100% rename from conf/type/__pf_ruleset/singleton rename to cdist/conf/type/__pf_ruleset/singleton diff --git a/conf/type/__postgres_database/explorer/state b/cdist/conf/type/__postgres_database/explorer/state similarity index 100% rename from conf/type/__postgres_database/explorer/state rename to cdist/conf/type/__postgres_database/explorer/state diff --git a/conf/type/__postgres_database/gencode-remote b/cdist/conf/type/__postgres_database/gencode-remote similarity index 100% rename from conf/type/__postgres_database/gencode-remote rename to cdist/conf/type/__postgres_database/gencode-remote diff --git a/conf/type/__postgres_database/man.text b/cdist/conf/type/__postgres_database/man.text similarity index 100% rename from conf/type/__postgres_database/man.text rename to cdist/conf/type/__postgres_database/man.text diff --git a/conf/type/__postgres_database/parameter/optional b/cdist/conf/type/__postgres_database/parameter/optional similarity index 100% rename from conf/type/__postgres_database/parameter/optional rename to cdist/conf/type/__postgres_database/parameter/optional diff --git a/conf/type/__postgres_database/parameter/required b/cdist/conf/type/__postgres_database/parameter/required similarity index 100% rename from conf/type/__postgres_database/parameter/required rename to cdist/conf/type/__postgres_database/parameter/required diff --git a/conf/type/__postgres_role/explorer/state b/cdist/conf/type/__postgres_role/explorer/state similarity index 100% rename from conf/type/__postgres_role/explorer/state rename to cdist/conf/type/__postgres_role/explorer/state diff --git a/conf/type/__postgres_role/gencode-remote b/cdist/conf/type/__postgres_role/gencode-remote similarity index 100% rename from conf/type/__postgres_role/gencode-remote rename to cdist/conf/type/__postgres_role/gencode-remote diff --git a/conf/type/__postgres_role/man.text b/cdist/conf/type/__postgres_role/man.text similarity index 100% rename from conf/type/__postgres_role/man.text rename to cdist/conf/type/__postgres_role/man.text diff --git a/conf/type/__postgres_role/parameter/optional b/cdist/conf/type/__postgres_role/parameter/optional similarity index 100% rename from conf/type/__postgres_role/parameter/optional rename to cdist/conf/type/__postgres_role/parameter/optional diff --git a/conf/type/__postgres_role/parameter/required b/cdist/conf/type/__postgres_role/parameter/required similarity index 100% rename from conf/type/__postgres_role/parameter/required rename to cdist/conf/type/__postgres_role/parameter/required diff --git a/conf/type/__process/explorer/runs b/cdist/conf/type/__process/explorer/runs similarity index 100% rename from conf/type/__process/explorer/runs rename to cdist/conf/type/__process/explorer/runs diff --git a/conf/type/__process/gencode-remote b/cdist/conf/type/__process/gencode-remote similarity index 77% rename from conf/type/__process/gencode-remote rename to cdist/conf/type/__process/gencode-remote index 3411734e..e4519f3c 100755 --- a/conf/type/__process/gencode-remote +++ b/cdist/conf/type/__process/gencode-remote @@ -26,16 +26,6 @@ else fi state_should="$(cat "$__object/parameter/state")" -case "$state_should" in - running) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - stopped) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac runs="$(cat "$__object/explorer/runs")" if [ "$runs" ]; then diff --git a/conf/type/__process/man.text b/cdist/conf/type/__process/man.text similarity index 100% rename from conf/type/__process/man.text rename to cdist/conf/type/__process/man.text diff --git a/conf/type/__process/parameter/optional b/cdist/conf/type/__process/parameter/optional similarity index 100% rename from conf/type/__process/parameter/optional rename to cdist/conf/type/__process/parameter/optional diff --git a/conf/type/__process/parameter/required b/cdist/conf/type/__process/parameter/required similarity index 100% rename from conf/type/__process/parameter/required rename to cdist/conf/type/__process/parameter/required diff --git a/conf/type/__qemu_img/explorer/exists b/cdist/conf/type/__qemu_img/explorer/exists similarity index 100% rename from conf/type/__qemu_img/explorer/exists rename to cdist/conf/type/__qemu_img/explorer/exists diff --git a/conf/type/__qemu_img/gencode-remote b/cdist/conf/type/__qemu_img/gencode-remote similarity index 100% rename from conf/type/__qemu_img/gencode-remote rename to cdist/conf/type/__qemu_img/gencode-remote diff --git a/conf/type/__qemu_img/man.text b/cdist/conf/type/__qemu_img/man.text similarity index 100% rename from conf/type/__qemu_img/man.text rename to cdist/conf/type/__qemu_img/man.text diff --git a/conf/type/__qemu_img/manifest b/cdist/conf/type/__qemu_img/manifest similarity index 100% rename from conf/type/__qemu_img/manifest rename to cdist/conf/type/__qemu_img/manifest diff --git a/conf/type/__qemu_img/parameter/optional b/cdist/conf/type/__qemu_img/parameter/optional similarity index 100% rename from conf/type/__qemu_img/parameter/optional rename to cdist/conf/type/__qemu_img/parameter/optional diff --git a/conf/type/__qemu_img/parameter/required b/cdist/conf/type/__qemu_img/parameter/required similarity index 100% rename from conf/type/__qemu_img/parameter/required rename to cdist/conf/type/__qemu_img/parameter/required diff --git a/conf/type/__rvm/explorer/state b/cdist/conf/type/__rvm/explorer/state similarity index 100% rename from conf/type/__rvm/explorer/state rename to cdist/conf/type/__rvm/explorer/state diff --git a/conf/type/__rvm/gencode-remote b/cdist/conf/type/__rvm/gencode-remote similarity index 100% rename from conf/type/__rvm/gencode-remote rename to cdist/conf/type/__rvm/gencode-remote diff --git a/conf/type/__rvm/man.text b/cdist/conf/type/__rvm/man.text similarity index 100% rename from conf/type/__rvm/man.text rename to cdist/conf/type/__rvm/man.text diff --git a/conf/type/__rvm/manifest b/cdist/conf/type/__rvm/manifest similarity index 100% rename from conf/type/__rvm/manifest rename to cdist/conf/type/__rvm/manifest diff --git a/conf/type/__rvm/parameter/required b/cdist/conf/type/__rvm/parameter/required similarity index 100% rename from conf/type/__rvm/parameter/required rename to cdist/conf/type/__rvm/parameter/required diff --git a/conf/type/__rvm_gem/explorer/state b/cdist/conf/type/__rvm_gem/explorer/state similarity index 100% rename from conf/type/__rvm_gem/explorer/state rename to cdist/conf/type/__rvm_gem/explorer/state diff --git a/conf/type/__rvm_gem/gencode-remote b/cdist/conf/type/__rvm_gem/gencode-remote similarity index 100% rename from conf/type/__rvm_gem/gencode-remote rename to cdist/conf/type/__rvm_gem/gencode-remote diff --git a/conf/type/__rvm_gem/man.text b/cdist/conf/type/__rvm_gem/man.text similarity index 100% rename from conf/type/__rvm_gem/man.text rename to cdist/conf/type/__rvm_gem/man.text diff --git a/conf/type/__rvm_gem/parameter/optional b/cdist/conf/type/__rvm_gem/parameter/optional similarity index 100% rename from conf/type/__rvm_gem/parameter/optional rename to cdist/conf/type/__rvm_gem/parameter/optional diff --git a/conf/type/__rvm_gem/parameter/required b/cdist/conf/type/__rvm_gem/parameter/required similarity index 100% rename from conf/type/__rvm_gem/parameter/required rename to cdist/conf/type/__rvm_gem/parameter/required diff --git a/conf/type/__rvm_gemset/explorer/state b/cdist/conf/type/__rvm_gemset/explorer/state similarity index 100% rename from conf/type/__rvm_gemset/explorer/state rename to cdist/conf/type/__rvm_gemset/explorer/state diff --git a/conf/type/__rvm_gemset/gencode-remote b/cdist/conf/type/__rvm_gemset/gencode-remote similarity index 100% rename from conf/type/__rvm_gemset/gencode-remote rename to cdist/conf/type/__rvm_gemset/gencode-remote diff --git a/conf/type/__rvm_gemset/man.text b/cdist/conf/type/__rvm_gemset/man.text similarity index 100% rename from conf/type/__rvm_gemset/man.text rename to cdist/conf/type/__rvm_gemset/man.text diff --git a/conf/type/__rvm_gemset/parameter/optional b/cdist/conf/type/__rvm_gemset/parameter/optional similarity index 100% rename from conf/type/__rvm_gemset/parameter/optional rename to cdist/conf/type/__rvm_gemset/parameter/optional diff --git a/conf/type/__rvm_gemset/parameter/required b/cdist/conf/type/__rvm_gemset/parameter/required similarity index 100% rename from conf/type/__rvm_gemset/parameter/required rename to cdist/conf/type/__rvm_gemset/parameter/required diff --git a/conf/type/__rvm_ruby/explorer/state b/cdist/conf/type/__rvm_ruby/explorer/state similarity index 100% rename from conf/type/__rvm_ruby/explorer/state rename to cdist/conf/type/__rvm_ruby/explorer/state diff --git a/conf/type/__rvm_ruby/gencode-remote b/cdist/conf/type/__rvm_ruby/gencode-remote similarity index 100% rename from conf/type/__rvm_ruby/gencode-remote rename to cdist/conf/type/__rvm_ruby/gencode-remote diff --git a/conf/type/__rvm_ruby/man.text b/cdist/conf/type/__rvm_ruby/man.text similarity index 100% rename from conf/type/__rvm_ruby/man.text rename to cdist/conf/type/__rvm_ruby/man.text diff --git a/conf/type/__rvm_ruby/parameter/optional b/cdist/conf/type/__rvm_ruby/parameter/optional similarity index 100% rename from conf/type/__rvm_ruby/parameter/optional rename to cdist/conf/type/__rvm_ruby/parameter/optional diff --git a/conf/type/__rvm_ruby/parameter/required b/cdist/conf/type/__rvm_ruby/parameter/required similarity index 100% rename from conf/type/__rvm_ruby/parameter/required rename to cdist/conf/type/__rvm_ruby/parameter/required diff --git a/conf/type/__ssh_authorized_key/explorer/dstuser_group b/cdist/conf/type/__ssh_authorized_key/explorer/dstuser_group similarity index 100% rename from conf/type/__ssh_authorized_key/explorer/dstuser_group rename to cdist/conf/type/__ssh_authorized_key/explorer/dstuser_group diff --git a/conf/type/__ssh_authorized_key/man.text b/cdist/conf/type/__ssh_authorized_key/man.text similarity index 100% rename from conf/type/__ssh_authorized_key/man.text rename to cdist/conf/type/__ssh_authorized_key/man.text diff --git a/conf/type/__ssh_authorized_key/manifest b/cdist/conf/type/__ssh_authorized_key/manifest similarity index 100% rename from conf/type/__ssh_authorized_key/manifest rename to cdist/conf/type/__ssh_authorized_key/manifest diff --git a/conf/type/__ssh_authorized_key/parameter/optional b/cdist/conf/type/__ssh_authorized_key/parameter/optional similarity index 100% rename from conf/type/__ssh_authorized_key/parameter/optional rename to cdist/conf/type/__ssh_authorized_key/parameter/optional diff --git a/conf/type/__start_on_boot/explorer/state b/cdist/conf/type/__start_on_boot/explorer/state similarity index 100% rename from conf/type/__start_on_boot/explorer/state rename to cdist/conf/type/__start_on_boot/explorer/state diff --git a/conf/type/__start_on_boot/gencode-remote b/cdist/conf/type/__start_on_boot/gencode-remote similarity index 100% rename from conf/type/__start_on_boot/gencode-remote rename to cdist/conf/type/__start_on_boot/gencode-remote diff --git a/conf/type/__start_on_boot/man.text b/cdist/conf/type/__start_on_boot/man.text similarity index 100% rename from conf/type/__start_on_boot/man.text rename to cdist/conf/type/__start_on_boot/man.text diff --git a/conf/type/__start_on_boot/parameter/optional b/cdist/conf/type/__start_on_boot/parameter/optional similarity index 100% rename from conf/type/__start_on_boot/parameter/optional rename to cdist/conf/type/__start_on_boot/parameter/optional diff --git a/conf/type/__timezone/man.text b/cdist/conf/type/__timezone/man.text similarity index 100% rename from conf/type/__timezone/man.text rename to cdist/conf/type/__timezone/man.text diff --git a/conf/type/__timezone/manifest b/cdist/conf/type/__timezone/manifest similarity index 100% rename from conf/type/__timezone/manifest rename to cdist/conf/type/__timezone/manifest diff --git a/conf/type/__user/TODO b/cdist/conf/type/__user/TODO similarity index 100% rename from conf/type/__user/TODO rename to cdist/conf/type/__user/TODO diff --git a/conf/type/__user/explorer/group b/cdist/conf/type/__user/explorer/group similarity index 100% rename from conf/type/__user/explorer/group rename to cdist/conf/type/__user/explorer/group diff --git a/conf/type/__user/explorer/passwd b/cdist/conf/type/__user/explorer/passwd similarity index 100% rename from conf/type/__user/explorer/passwd rename to cdist/conf/type/__user/explorer/passwd diff --git a/conf/type/__user/explorer/shadow b/cdist/conf/type/__user/explorer/shadow similarity index 100% rename from conf/type/__user/explorer/shadow rename to cdist/conf/type/__user/explorer/shadow diff --git a/conf/type/__user/gencode-remote b/cdist/conf/type/__user/gencode-remote similarity index 100% rename from conf/type/__user/gencode-remote rename to cdist/conf/type/__user/gencode-remote diff --git a/conf/type/__user/man.text b/cdist/conf/type/__user/man.text similarity index 100% rename from conf/type/__user/man.text rename to cdist/conf/type/__user/man.text diff --git a/conf/type/__user/parameter/optional b/cdist/conf/type/__user/parameter/optional similarity index 100% rename from conf/type/__user/parameter/optional rename to cdist/conf/type/__user/parameter/optional diff --git a/lib/cdist/config.py b/cdist/config.py similarity index 100% rename from lib/cdist/config.py rename to cdist/config.py diff --git a/lib/cdist/config_install.py b/cdist/config_install.py similarity index 96% rename from lib/cdist/config_install.py rename to cdist/config_install.py index 3aadca86..2c1edc44 100644 --- a/lib/cdist/config_install.py +++ b/cdist/config_install.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2010-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -48,9 +48,9 @@ class ConfigInstall(object): self.remote = context.remote # Initialise local directory structure - self.local.create_directories() + self.local.create_files_dirs() # Initialise remote directory structure - self.remote.create_directories() + self.remote.create_files_dirs() self.explorer = core.Explorer(self.context.target_host, self.local, self.remote) self.manifest = core.Manifest(self.context.target_host, self.local) @@ -79,7 +79,6 @@ class ConfigInstall(object): def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" - self.local.link_emulator(self.context.exec_path) self.explorer.run_global_explorers(self.local.global_explorer_out_path) self.manifest.run_initial_manifest(self.context.initial_manifest) diff --git a/lib/cdist/context.py b/cdist/context.py similarity index 88% rename from lib/cdist/context.py rename to cdist/context.py index 8b468739..92e683a3 100644 --- a/lib/cdist/context.py +++ b/cdist/context.py @@ -38,26 +38,18 @@ class Context(object): remote_copy, remote_exec, initial_manifest=False, - base_path=False, + add_conf_dirs=[], exec_path=sys.argv[0], debug=False): - self.debug = debug - + self.debug = debug self.target_host = target_host - - # Only required for testing self.exec_path = exec_path # Context logging self.log = logging.getLogger(self.target_host) self.log.addFilter(self) - # Local base directory - self.base_path = (base_path or - os.path.abspath(os.path.join(os.path.dirname(__file__), - os.pardir, os.pardir))) - # Local temp directory # FIXME: if __cdist_out_dir can be given from the outside, the same directory will be used for all hosts if '__cdist_out_dir' in os.environ: @@ -67,7 +59,7 @@ class Context(object): self.temp_dir = tempfile.mkdtemp() self.out_path = os.path.join(self.temp_dir, "out") - self.local = local.Local(self.target_host, self.base_path, self.out_path) + self.local = local.Local(self.target_host, self.out_path, self.exec_path, add_conf_dirs=add_conf_dirs) self.initial_manifest = (initial_manifest or os.path.join(self.local.manifest_path, "init")) diff --git a/lib/cdist/core/__init__.py b/cdist/core/__init__.py similarity index 100% rename from lib/cdist/core/__init__.py rename to cdist/core/__init__.py diff --git a/lib/cdist/core/cdist_object.py b/cdist/core/cdist_object.py similarity index 100% rename from lib/cdist/core/cdist_object.py rename to cdist/core/cdist_object.py diff --git a/lib/cdist/core/cdist_type.py b/cdist/core/cdist_type.py similarity index 99% rename from lib/cdist/core/cdist_type.py rename to cdist/core/cdist_type.py index 86f3ced1..44e192fc 100644 --- a/lib/cdist/core/cdist_type.py +++ b/cdist/core/cdist_type.py @@ -24,7 +24,6 @@ import os import cdist - class NoSuchTypeError(cdist.Error): def __init__(self, type_path, type_absolute_path): self.type_path = type_path diff --git a/lib/cdist/core/code.py b/cdist/core/code.py similarity index 99% rename from lib/cdist/core/code.py rename to cdist/core/code.py index 2ffef9cf..fa1ed3c1 100644 --- a/lib/cdist/core/code.py +++ b/cdist/core/code.py @@ -103,7 +103,6 @@ class Code(object): '__object': cdist_object.absolute_path, '__object_id': cdist_object.object_id, '__object_name': cdist_object.name, - '__self': cdist_object.name, }) return self.local.run_script(script, env=env, return_output=True) diff --git a/lib/cdist/core/explorer.py b/cdist/core/explorer.py similarity index 100% rename from lib/cdist/core/explorer.py rename to cdist/core/explorer.py diff --git a/lib/cdist/core/manifest.py b/cdist/core/manifest.py similarity index 98% rename from lib/cdist/core/manifest.py rename to cdist/core/manifest.py index 4b798883..5faeccd1 100644 --- a/lib/cdist/core/manifest.py +++ b/cdist/core/manifest.py @@ -96,7 +96,6 @@ class Manifest(object): '__object': cdist_object.absolute_path, '__object_id': cdist_object.object_id, '__object_name': cdist_object.name, - '__self': cdist_object.name, '__type': cdist_object.cdist_type.absolute_path, '__cdist_manifest': script, }) diff --git a/lib/cdist/emulator.py b/cdist/emulator.py similarity index 100% rename from lib/cdist/emulator.py rename to cdist/emulator.py diff --git a/lib/cdist/exec/__init__.py b/cdist/exec/__init__.py similarity index 100% rename from lib/cdist/exec/__init__.py rename to cdist/exec/__init__.py diff --git a/lib/cdist/exec/local.py b/cdist/exec/local.py similarity index 52% rename from lib/cdist/exec/local.py rename to cdist/exec/local.py index e510a8fb..7ef11458 100644 --- a/lib/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -20,8 +20,6 @@ # # -# FIXME: common base class with Remote? - import io import os import sys @@ -39,34 +37,73 @@ class Local(object): Directly accessing the local side from python code is a bug. """ - def __init__(self, target_host, local_base_path, out_path): + def __init__(self, target_host, out_path, exec_path, add_conf_dirs=[], cache_dir=None): + self.target_host = target_host - self.base_path = local_base_path - - # Local input - self.cache_path = os.path.join(self.base_path, "cache") - self.conf_path = os.path.join(self.base_path, "conf") - self.global_explorer_path = os.path.join(self.conf_path, "explorer") - self.manifest_path = os.path.join(self.conf_path, "manifest") - self.type_path = os.path.join(self.conf_path, "type") - # FIXME: should not be needed anywhere - self.lib_path = os.path.join(self.base_path, "lib") - - # Local output self.out_path = out_path - self.bin_path = os.path.join(self.out_path, "bin") - self.global_explorer_out_path = os.path.join(self.out_path, "explorer") - self.object_path = os.path.join(self.out_path, "object") + self.exec_path = exec_path + self._add_conf_dirs = add_conf_dirs + + self._init_log() + self._init_permissions() + self._init_paths() + self._init_cache_dir(cache_dir) + self._init_conf_dirs() + + @property + def dist_conf_dir(self): + return os.path.abspath(os.path.join(os.path.dirname(cdist.__file__), "conf")) + + @property + def home_dir(self): + if 'HOME' in os.environ: + return os.path.join(os.environ['HOME'], ".cdist") + else: + return None + + def _init_log(self): self.log = logging.getLogger(self.target_host) + def _init_permissions(self): # Setup file permissions using umask os.umask(0o077) - def create_directories(self): - self.mkdir(self.out_path) - self.mkdir(self.global_explorer_out_path) - self.mkdir(self.bin_path) + def _init_paths(self): + # Depending on out_path + self.bin_path = os.path.join(self.out_path, "bin") + self.conf_path = os.path.join(self.out_path, "conf") + self.global_explorer_out_path = os.path.join(self.out_path, "explorer") + self.object_path = os.path.join(self.out_path, "object") + + # 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.type_path = os.path.join(self.conf_path, "type") + + def _init_conf_dirs(self): + self.conf_dirs = [] + + # Comes with the distribution + system_conf_dir = os.path.abspath(os.path.join(os.path.dirname(cdist.__file__), "conf")) + self.conf_dirs.append(system_conf_dir) + + # Is the default place for user created explorer, type and manifest + if self.home_dir: + self.conf_dirs.append(self.home_dir) + + # Add user supplied directories + if self._add_conf_dirs: + self.conf_dirs.extend(self._add_conf_dirs) + + def _init_cache_dir(self, cache_dir): + if cache_dir: + self.cache_path = cache_dir + else: + 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") def rmdir(self, path): """Remove directory on the local side.""" @@ -111,9 +148,51 @@ class Local(object): return self.run(command, env, return_output) - def link_emulator(self, exec_path): + def create_files_dirs(self): + self._create_context_dirs() + self._create_conf_path_and_link_conf_dirs() + self._link_types_for_emulator() + + def _create_context_dirs(self): + self.mkdir(self.out_path) + + self.mkdir(self.conf_path) + self.mkdir(self.global_explorer_out_path) + self.mkdir(self.bin_path) + + def _create_conf_path_and_link_conf_dirs(self): + # Link destination directories + for sub_dir in [ "explorer", "manifest", "type" ]: + 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" ]: + current_dir = os.path.join(conf_dir, sub_dir) + + # Allow conf dirs to contain only partial content + if not os.path.exists(current_dir): + continue + + for entry in os.listdir(current_dir): + rel_entry_path = os.path.join(sub_dir, entry) + src = 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__())) + + def _link_types_for_emulator(self): """Link emulator to types""" - src = os.path.abspath(exec_path) + src = os.path.abspath(self.exec_path) for cdist_type in core.CdistType.list_types(self.type_path): dst = os.path.join(self.bin_path, cdist_type.name) self.log.debug("Linking emulator: %s to %s", src, dst) diff --git a/lib/cdist/exec/remote.py b/cdist/exec/remote.py similarity index 99% rename from lib/cdist/exec/remote.py rename to cdist/exec/remote.py index 487beea3..07c6614b 100644 --- a/lib/cdist/exec/remote.py +++ b/cdist/exec/remote.py @@ -57,7 +57,7 @@ class Remote(object): self.log = logging.getLogger(self.target_host) - def create_directories(self): + def create_files_dirs(self): self.rmdir(self.base_path) self.mkdir(self.base_path) self.mkdir(self.conf_path) diff --git a/lib/cdist/install.py b/cdist/install.py similarity index 100% rename from lib/cdist/install.py rename to cdist/install.py diff --git a/lib/cdist/resolver.py b/cdist/resolver.py similarity index 100% rename from lib/cdist/resolver.py rename to cdist/resolver.py diff --git a/lib/cdist/test/__init__.py b/cdist/test/__init__.py similarity index 78% rename from lib/cdist/test/__init__.py rename to cdist/test/__init__.py index faa9dc2d..3d9b1a2e 100644 --- a/lib/cdist/test/__init__.py +++ b/cdist/test/__init__.py @@ -24,13 +24,17 @@ import unittest import tempfile cdist_base_path = os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../")) + os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../../")) -cdist_exec_path = os.path.join(cdist_base_path, "bin/cdist") +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")) class CdistTestCase(unittest.TestCase): + remote_exec = os.path.join(global_fixtures_dir, "remote", "exec") + remote_copy = os.path.join(global_fixtures_dir, "remote", "copy") + def mkdtemp(self, **kwargs): return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) diff --git a/lib/cdist/test/__main__.py b/cdist/test/__main__.py similarity index 100% rename from lib/cdist/test/__main__.py rename to cdist/test/__main__.py diff --git a/lib/cdist/test/autorequire/__init__.py b/cdist/test/autorequire/__init__.py similarity index 94% rename from lib/cdist/test/autorequire/__init__.py rename to cdist/test/autorequire/__init__.py index 2263cbf9..bd763fd3 100644 --- a/lib/cdist/test/autorequire/__init__.py +++ b/cdist/test/autorequire/__init__.py @@ -34,7 +34,7 @@ import cdist.context import os.path as op my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') -local_base_path = fixtures +add_conf_dir = op.join(fixtures, 'conf') class AutorequireTestCase(test.CdistTestCase): @@ -48,7 +48,9 @@ class AutorequireTestCase(test.CdistTestCase): self.context = cdist.context.Context( target_host=self.target_host, - base_path=local_base_path, + remote_copy='/bin/true', + remote_exec='/bin/true', + add_conf_dirs=add_conf_dir, exec_path=test.cdist_exec_path, debug=False) self.config = config.Config(self.context) diff --git a/lib/cdist/test/autorequire/fixtures/conf/explorer/.keep b/cdist/test/autorequire/fixtures/conf/explorer/.keep similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/explorer/.keep rename to cdist/test/autorequire/fixtures/conf/explorer/.keep diff --git a/lib/cdist/test/autorequire/fixtures/conf/manifest/circular_dependency b/cdist/test/autorequire/fixtures/conf/manifest/circular_dependency similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/manifest/circular_dependency rename to cdist/test/autorequire/fixtures/conf/manifest/circular_dependency diff --git a/lib/cdist/test/autorequire/fixtures/conf/manifest/implicit_dependencies b/cdist/test/autorequire/fixtures/conf/manifest/implicit_dependencies similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/manifest/implicit_dependencies rename to cdist/test/autorequire/fixtures/conf/manifest/implicit_dependencies diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__addifnosuchline/.keep b/cdist/test/autorequire/fixtures/conf/type/__addifnosuchline/.keep similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__addifnosuchline/.keep rename to cdist/test/autorequire/fixtures/conf/type/__addifnosuchline/.keep diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__directory/.keep b/cdist/test/autorequire/fixtures/conf/type/__directory/.keep similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__directory/.keep rename to cdist/test/autorequire/fixtures/conf/type/__directory/.keep diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest b/cdist/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest rename to cdist/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__package/manifest b/cdist/test/autorequire/fixtures/conf/type/__package/manifest similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__package/manifest rename to cdist/test/autorequire/fixtures/conf/type/__package/manifest diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__package_special/.keep b/cdist/test/autorequire/fixtures/conf/type/__package_special/.keep similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__package_special/.keep rename to cdist/test/autorequire/fixtures/conf/type/__package_special/.keep diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest b/cdist/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest rename to cdist/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__top/manifest b/cdist/test/autorequire/fixtures/conf/type/__top/manifest similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__top/manifest rename to cdist/test/autorequire/fixtures/conf/type/__top/manifest diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__user/.keep b/cdist/test/autorequire/fixtures/conf/type/__user/.keep similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__user/.keep rename to cdist/test/autorequire/fixtures/conf/type/__user/.keep diff --git a/lib/cdist/test/banner/__init__.py b/cdist/test/banner/__init__.py similarity index 100% rename from lib/cdist/test/banner/__init__.py rename to cdist/test/banner/__init__.py diff --git a/lib/cdist/test/code/__init__.py b/cdist/test/code/__init__.py similarity index 96% rename from lib/cdist/test/code/__init__.py rename to cdist/test/code/__init__.py index dc701cce..8bc937b0 100644 --- a/lib/cdist/test/code/__init__.py +++ b/cdist/test/code/__init__.py @@ -44,7 +44,7 @@ class CodeTestCase(test.CdistTestCase): self.local_base_path = local_base_path self.out_path = self.mkdtemp() self.local = local.Local(self.target_host, self.local_base_path, self.out_path) - self.local.create_directories() + self.local.create_files_dirs() self.remote_base_path = self.mkdtemp() self.user = getpass.getuser() @@ -78,7 +78,6 @@ class CodeTestCase(test.CdistTestCase): 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['__self'], self.cdist_object.name) def test_run_gencode_remote_environment(self): output_string = self.code.run_gencode_remote(self.cdist_object) @@ -94,7 +93,6 @@ class CodeTestCase(test.CdistTestCase): 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['__self'], self.cdist_object.name) def test_transfer_code_remote(self): self.cdist_object.code_remote = self.code.run_gencode_remote(self.cdist_object) diff --git a/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local b/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local similarity index 88% rename from lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local rename to cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local index ed1265c9..771894fb 100755 --- a/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local +++ b/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local @@ -6,4 +6,3 @@ echo "echo __type: $__type" echo "echo __object: $__object" echo "echo __object_id: $__object_id" echo "echo __object_name: $__object_name" -echo "echo __self: $__self" diff --git a/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-remote b/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-remote similarity index 100% rename from lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-remote rename to cdist/test/code/fixtures/conf/type/__dump_environment/gencode-remote diff --git a/lib/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py similarity index 93% rename from lib/cdist/test/emulator/__init__.py rename to cdist/test/emulator/__init__.py index ff18fe87..1b77bdb6 100644 --- a/lib/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -33,8 +33,6 @@ from cdist import core from cdist import config import cdist.context -local_base_path = test.cdist_base_path - class EmulatorTestCase(test.CdistTestCase): def setUp(self): @@ -45,8 +43,11 @@ class EmulatorTestCase(test.CdistTestCase): os.close(handle) self.target_host = 'localhost' out_path = self.temp_dir - self.local = local.Local(self.target_host, local_base_path, out_path) - self.local.create_directories() + self.local = local.Local( + target_host=self.target_host, + out_path=out_path, + exec_path=test.cdist_exec_path) + self.local.create_files_dirs() self.env = { 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), '__target_host': self.target_host, @@ -112,10 +113,11 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase): self.temp_dir = self.mkdtemp() self.target_host = 'localhost' out_path = self.temp_dir - _local_base_path = fixtures - self.local = local.Local(self.target_host, _local_base_path, out_path) - self.local.create_directories() - self.local.link_emulator(cdist.test.cdist_exec_path) + self.local = local.Local( + target_host=self.target_host, + out_path=out_path, + exec_path=test.cdist_exec_path) + self.local.create_files_dirs() self.manifest = core.Manifest(self.target_host, self.local) def tearDown(self): @@ -139,10 +141,13 @@ class ArgumentsTestCase(test.CdistTestCase): out_path = self.temp_dir handle, self.script = self.mkstemp(dir=self.temp_dir) os.close(handle) - _local_base_path = fixtures - self.local = local.Local(self.target_host, _local_base_path, out_path) - self.local.create_directories() - self.local.link_emulator(test.cdist_exec_path) + + self.local = local.Local( + target_host=self.target_host, + out_path=out_path, + exec_path=test.cdist_exec_path) + self.local.create_files_dirs() + self.env = { 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), '__target_host': self.target_host, @@ -230,13 +235,11 @@ class StdinTestCase(test.CdistTestCase): self.target_host = 'localhost' self.temp_dir = self.mkdtemp() os.environ['__cdist_out_dir'] = self.temp_dir - local_base_path = fixtures self.context = cdist.context.Context( target_host=self.target_host, remote_copy='scp -o User=root -q', remote_exec='ssh -o User=root -q', - base_path=local_base_path, exec_path=test.cdist_exec_path, debug=False) self.config = config.Config(self.context) diff --git a/lib/cdist/test/emulator/fixtures/conf/explorer/.keep b/cdist/test/emulator/fixtures/conf/explorer/.keep similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/explorer/.keep rename to cdist/test/emulator/fixtures/conf/explorer/.keep diff --git a/lib/cdist/test/emulator/fixtures/conf/manifest/init b/cdist/test/emulator/fixtures/conf/manifest/init similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/manifest/init rename to cdist/test/emulator/fixtures/conf/manifest/init diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__arguments_boolean/parameter/boolean b/cdist/test/emulator/fixtures/conf/type/__arguments_boolean/parameter/boolean similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__arguments_boolean/parameter/boolean rename to cdist/test/emulator/fixtures/conf/type/__arguments_boolean/parameter/boolean diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__arguments_optional/parameter/optional b/cdist/test/emulator/fixtures/conf/type/__arguments_optional/parameter/optional similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__arguments_optional/parameter/optional rename to cdist/test/emulator/fixtures/conf/type/__arguments_optional/parameter/optional diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__arguments_required/parameter/required b/cdist/test/emulator/fixtures/conf/type/__arguments_required/parameter/required similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__arguments_required/parameter/required rename to cdist/test/emulator/fixtures/conf/type/__arguments_required/parameter/required diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required b/cdist/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required rename to cdist/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required diff --git a/cdist/test/emulator/fixtures/conf/type/__file b/cdist/test/emulator/fixtures/conf/type/__file new file mode 120000 index 00000000..1ed684b9 --- /dev/null +++ b/cdist/test/emulator/fixtures/conf/type/__file @@ -0,0 +1 @@ +../../../../../conf/type/__file \ No newline at end of file diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/manifest b/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/manifest similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/manifest rename to cdist/test/emulator/fixtures/conf/type/__file_from_stdin/manifest diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required b/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required rename to cdist/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__moon/manifest b/cdist/test/emulator/fixtures/conf/type/__moon/manifest similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__moon/manifest rename to cdist/test/emulator/fixtures/conf/type/__moon/manifest diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/optional b/cdist/test/emulator/fixtures/conf/type/__moon/parameter/optional similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/optional rename to cdist/test/emulator/fixtures/conf/type/__moon/parameter/optional diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/required b/cdist/test/emulator/fixtures/conf/type/__moon/parameter/required similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/required rename to cdist/test/emulator/fixtures/conf/type/__moon/parameter/required diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__planet/manifest b/cdist/test/emulator/fixtures/conf/type/__planet/manifest similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__planet/manifest rename to cdist/test/emulator/fixtures/conf/type/__planet/manifest diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__planet/parameter/optional b/cdist/test/emulator/fixtures/conf/type/__planet/parameter/optional similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__planet/parameter/optional rename to cdist/test/emulator/fixtures/conf/type/__planet/parameter/optional diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__saturn/manifest b/cdist/test/emulator/fixtures/conf/type/__saturn/manifest similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__saturn/manifest rename to cdist/test/emulator/fixtures/conf/type/__saturn/manifest diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__saturn/singleton b/cdist/test/emulator/fixtures/conf/type/__saturn/singleton similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__saturn/singleton rename to cdist/test/emulator/fixtures/conf/type/__saturn/singleton diff --git a/lib/cdist/test/exec/__init__.py b/cdist/test/exec/__init__.py similarity index 100% rename from lib/cdist/test/exec/__init__.py rename to cdist/test/exec/__init__.py diff --git a/lib/cdist/test/exec/local.py b/cdist/test/exec/local.py similarity index 66% rename from lib/cdist/test/exec/local.py rename to cdist/test/exec/local.py index e6f2c2b0..687c13a5 100644 --- a/lib/cdist/test/exec/local.py +++ b/cdist/test/exec/local.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -25,9 +26,6 @@ import shutil import string import random -#import logging -#logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s') - import cdist from cdist import test from cdist.exec import local @@ -35,17 +33,23 @@ from cdist.exec import local import os.path as op my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') -local_base_path = fixtures - +conf_dir = op.join(fixtures, "conf") class LocalTestCase(test.CdistTestCase): def setUp(self): - self.temp_dir = self.mkdtemp() + target_host = 'localhost' + self.temp_dir = self.mkdtemp() self.out_path = self.temp_dir - self.base_path = local_base_path - self.local = local.Local(target_host, self.base_path, self.out_path) + + self.local = local.Local( + target_host=target_host, + out_path=self.out_path, + exec_path=test.cdist_exec_path + ) + + self.home_dir = os.path.join(os.environ['HOME'], ".cdist") def tearDown(self): shutil.rmtree(self.temp_dir) @@ -53,19 +57,10 @@ class LocalTestCase(test.CdistTestCase): ### test api def test_cache_path(self): - self.assertEqual(self.local.cache_path, os.path.join(self.base_path, "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.base_path, "conf")) - - def test_global_explorer_path(self): - self.assertEqual(self.local.global_explorer_path, os.path.join(self.base_path, "conf", "explorer")) - - def test_manifest_path(self): - self.assertEqual(self.local.manifest_path, os.path.join(self.base_path, "conf", "manifest")) - - def test_type_path(self): - self.assertEqual(self.local.type_path, os.path.join(self.base_path, "conf", "type")) + self.assertEqual(self.local.conf_path, os.path.join(self.out_path, "conf")) def test_out_path(self): self.assertEqual(self.local.out_path, self.out_path) @@ -81,6 +76,53 @@ class LocalTestCase(test.CdistTestCase): ### /test api + ### test internal implementation + + def test_global_explorer_path(self): + 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")) + + def test_type_path(self): + 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""" + + test_type="__file" + + link_test_local = local.Local( + target_host='localhost', + out_path=self.out_path, + exec_path=test.cdist_exec_path, + ) + + link_test_local._create_conf_path_and_link_conf_dirs() + + our_type_dir = os.path.join(link_test_local.type_path, test_type) + + 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""" + + test_type="__cdist_test_type" + + link_test_local = local.Local( + target_host='localhost', + out_path=self.out_path, + exec_path=test.cdist_exec_path, + add_conf_dirs=[conf_dir] + ) + + link_test_local._create_conf_path_and_link_conf_dirs() + + our_type_dir = os.path.join(link_test_local.type_path, test_type) + + self.assertTrue(os.path.isdir(our_type_dir)) + + ### other tests def test_run_success(self): self.local.run(['/bin/true']) @@ -98,7 +140,7 @@ class LocalTestCase(test.CdistTestCase): handle, script = self.mkstemp(dir=self.temp_dir) with os.fdopen(handle, "w") as fd: fd.writelines(["#!/bin/sh\n", "/bin/false"]) - self.assertRaises(local.LocalScriptError, self.local.run_script, script) + self.assertRaises(cdist.Error, self.local.run_script, script) def test_run_script_get_output(self): handle, script = self.mkstemp(dir=self.temp_dir) @@ -117,7 +159,8 @@ class LocalTestCase(test.CdistTestCase): self.local.rmdir(temp_dir) self.assertFalse(os.path.isdir(temp_dir)) - def test_create_directories(self): - self.local.create_directories() + def test_create_files_dirs(self): + self.local.create_files_dirs() self.assertTrue(os.path.isdir(self.local.out_path)) self.assertTrue(os.path.isdir(self.local.bin_path)) + self.assertTrue(os.path.isdir(self.local.conf_path)) diff --git a/lib/cdist/test/exec/remote.py b/cdist/test/exec/remote.py similarity index 100% rename from lib/cdist/test/exec/remote.py rename to cdist/test/exec/remote.py diff --git a/lib/cdist/test/explorer/__init__.py b/cdist/test/explorer/__init__.py similarity index 82% rename from lib/cdist/test/explorer/__init__.py rename to cdist/test/explorer/__init__.py index 257ad8a9..bb39d006 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/cdist/test/explorer/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -35,35 +35,46 @@ from cdist.core import explorer import os.path as op my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') -local_base_path = fixtures +conf_dir = op.join(fixtures, "conf") class ExplorerClassTestCase(test.CdistTestCase): def setUp(self): self.target_host = 'localhost' - self.local_base_path = local_base_path - self.out_path = self.mkdtemp() - self.local = local.Local(self.target_host, self.local_base_path, self.out_path) - self.local.create_directories() + self.temp_dir = self.mkdtemp() + self.out_path = os.path.join(self.temp_dir, "out") + self.remote_base_path = os.path.join(self.temp_dir, "remote") + os.makedirs(self.remote_base_path) - self.remote_base_path = self.mkdtemp() - self.user = getpass.getuser() - remote_exec = "ssh -o User=%s -q" % self.user - remote_copy = "scp -o User=%s -q" % self.user - self.remote = remote.Remote(self.target_host, self.remote_base_path, remote_exec, remote_copy) + self.local = local.Local( + target_host=self.target_host, + out_path=self.out_path, + exec_path=test.cdist_exec_path, + add_conf_dirs=[conf_dir]) - self.explorer = explorer.Explorer(self.target_host, self.local, self.remote) + self.local.create_files_dirs() + + self.remote = remote.Remote( + self.target_host, + self.remote_base_path, + self.remote_exec, + self.remote_copy) + + self.explorer = explorer.Explorer( + self.target_host, + self.local, + self.remote) self.log = logging.getLogger(self.target_host) def tearDown(self): - shutil.rmtree(self.out_path) - shutil.rmtree(self.remote_base_path) + shutil.rmtree(self.temp_dir) def test_list_global_explorer_names(self): - expected = ['foobar', 'global'] - self.assertEqual(self.explorer.list_global_explorer_names(), expected) + names = self.explorer.list_global_explorer_names() + self.assertIn("foobar", names) + self.assertIn("global", names) def test_transfer_global_explorers(self): self.explorer.transfer_global_explorers() diff --git a/lib/cdist/test/explorer/fixtures/conf/explorer/foobar b/cdist/test/explorer/fixtures/conf/explorer/foobar similarity index 100% rename from lib/cdist/test/explorer/fixtures/conf/explorer/foobar rename to cdist/test/explorer/fixtures/conf/explorer/foobar diff --git a/lib/cdist/test/explorer/fixtures/conf/explorer/global b/cdist/test/explorer/fixtures/conf/explorer/global similarity index 100% rename from lib/cdist/test/explorer/fixtures/conf/explorer/global rename to cdist/test/explorer/fixtures/conf/explorer/global diff --git a/lib/cdist/test/explorer/fixtures/conf/type/__test_type/explorer/world b/cdist/test/explorer/fixtures/conf/type/__test_type/explorer/world similarity index 100% rename from lib/cdist/test/explorer/fixtures/conf/type/__test_type/explorer/world rename to cdist/test/explorer/fixtures/conf/type/__test_type/explorer/world diff --git a/lib/cdist/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter b/cdist/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter similarity index 100% rename from lib/cdist/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter rename to cdist/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter diff --git a/cdist/test/fixtures/remote b/cdist/test/fixtures/remote new file mode 120000 index 00000000..c5db6358 --- /dev/null +++ b/cdist/test/fixtures/remote @@ -0,0 +1 @@ +../../../other/examples/remote/local \ No newline at end of file diff --git a/lib/cdist/test/manifest/__init__.py b/cdist/test/manifest/__init__.py similarity index 96% rename from lib/cdist/test/manifest/__init__.py rename to cdist/test/manifest/__init__.py index a188c788..61a815a9 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/cdist/test/manifest/__init__.py @@ -49,8 +49,7 @@ class ManifestTestCase(test.CdistTestCase): self.target_host = 'localhost' out_path = self.temp_dir self.local = local.Local(self.target_host, local_base_path, out_path) - self.local.create_directories() - self.local.link_emulator(cdist.test.cdist_exec_path) + self.local.create_files_dirs() self.manifest = manifest.Manifest(self.target_host, self.local) self.log = logging.getLogger(self.target_host) @@ -101,7 +100,6 @@ class ManifestTestCase(test.CdistTestCase): 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['__self'], cdist_object.name) def test_debug_env_setup(self): self.log.setLevel(logging.DEBUG) diff --git a/lib/cdist/test/manifest/fixtures/conf/manifest/dump_environment b/cdist/test/manifest/fixtures/conf/manifest/dump_environment similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/manifest/dump_environment rename to cdist/test/manifest/fixtures/conf/manifest/dump_environment diff --git a/lib/cdist/test/manifest/fixtures/conf/manifest/init b/cdist/test/manifest/fixtures/conf/manifest/init similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/manifest/init rename to cdist/test/manifest/fixtures/conf/manifest/init diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest b/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest rename to cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__moon/.keep b/cdist/test/manifest/fixtures/conf/type/__moon/.keep similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__moon/.keep rename to cdist/test/manifest/fixtures/conf/type/__moon/.keep diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__moon/manifest b/cdist/test/manifest/fixtures/conf/type/__moon/manifest similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__moon/manifest rename to cdist/test/manifest/fixtures/conf/type/__moon/manifest diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/optional b/cdist/test/manifest/fixtures/conf/type/__moon/parameter/optional similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/optional rename to cdist/test/manifest/fixtures/conf/type/__moon/parameter/optional diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/required b/cdist/test/manifest/fixtures/conf/type/__moon/parameter/required similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/required rename to cdist/test/manifest/fixtures/conf/type/__moon/parameter/required diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__planet/.keep b/cdist/test/manifest/fixtures/conf/type/__planet/.keep similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__planet/.keep rename to cdist/test/manifest/fixtures/conf/type/__planet/.keep diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__planet/manifest b/cdist/test/manifest/fixtures/conf/type/__planet/manifest similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__planet/manifest rename to cdist/test/manifest/fixtures/conf/type/__planet/manifest diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__planet/parameter/optional b/cdist/test/manifest/fixtures/conf/type/__planet/parameter/optional similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__planet/parameter/optional rename to cdist/test/manifest/fixtures/conf/type/__planet/parameter/optional diff --git a/lib/cdist/test/object/__init__.py b/cdist/test/object/__init__.py similarity index 100% rename from lib/cdist/test/object/__init__.py rename to cdist/test/object/__init__.py diff --git a/lib/cdist/test/object/fixtures/object/__first/.keep b/cdist/test/object/fixtures/object/__first/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/object/__first/.keep rename to cdist/test/object/fixtures/object/__first/.keep diff --git a/lib/cdist/test/object/fixtures/object/__first/man/.cdist/.keep b/cdist/test/object/fixtures/object/__first/man/.cdist/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/object/__first/man/.cdist/.keep rename to cdist/test/object/fixtures/object/__first/man/.cdist/.keep diff --git a/lib/cdist/test/object/fixtures/object/__second/.keep b/cdist/test/object/fixtures/object/__second/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/object/__second/.keep rename to cdist/test/object/fixtures/object/__second/.keep diff --git a/lib/cdist/test/object/fixtures/object/__second/on-the/.cdist/.keep b/cdist/test/object/fixtures/object/__second/on-the/.cdist/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/object/__second/on-the/.cdist/.keep rename to cdist/test/object/fixtures/object/__second/on-the/.cdist/.keep diff --git a/lib/cdist/test/object/fixtures/object/__third/.keep b/cdist/test/object/fixtures/object/__third/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/object/__third/.keep rename to cdist/test/object/fixtures/object/__third/.keep diff --git a/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/.keep b/cdist/test/object/fixtures/object/__third/moon/.cdist/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/object/__third/moon/.cdist/.keep rename to cdist/test/object/fixtures/object/__third/moon/.cdist/.keep diff --git a/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/name b/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/name similarity index 100% rename from lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/name rename to cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/name diff --git a/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/planet b/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/planet similarity index 100% rename from lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/planet rename to cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/planet diff --git a/lib/cdist/test/object/fixtures/type/__first/.keep b/cdist/test/object/fixtures/type/__first/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/type/__first/.keep rename to cdist/test/object/fixtures/type/__first/.keep diff --git a/lib/cdist/test/object/fixtures/type/__second/.keep b/cdist/test/object/fixtures/type/__second/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/type/__second/.keep rename to cdist/test/object/fixtures/type/__second/.keep diff --git a/lib/cdist/test/object/fixtures/type/__third/.keep b/cdist/test/object/fixtures/type/__third/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/type/__third/.keep rename to cdist/test/object/fixtures/type/__third/.keep diff --git a/lib/cdist/test/resolver/__init__.py b/cdist/test/resolver/__init__.py similarity index 100% rename from lib/cdist/test/resolver/__init__.py rename to cdist/test/resolver/__init__.py diff --git a/lib/cdist/test/resolver/fixtures/object/__first/.keep b/cdist/test/resolver/fixtures/object/__first/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__first/.keep rename to cdist/test/resolver/fixtures/object/__first/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__first/child/.cdist/.keep b/cdist/test/resolver/fixtures/object/__first/child/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__first/child/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__first/child/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__first/dog/.cdist/.keep b/cdist/test/resolver/fixtures/object/__first/dog/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__first/dog/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__first/dog/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__first/man/.cdist/.keep b/cdist/test/resolver/fixtures/object/__first/man/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__first/man/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__first/man/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__first/woman/.cdist/.keep b/cdist/test/resolver/fixtures/object/__first/woman/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__first/woman/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__first/woman/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__second/.keep b/cdist/test/resolver/fixtures/object/__second/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__second/.keep rename to cdist/test/resolver/fixtures/object/__second/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__second/on-the/.cdist/.keep b/cdist/test/resolver/fixtures/object/__second/on-the/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__second/on-the/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__second/on-the/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__second/under-the/.cdist/.keep b/cdist/test/resolver/fixtures/object/__second/under-the/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__second/under-the/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__second/under-the/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__third/.keep b/cdist/test/resolver/fixtures/object/__third/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__third/.keep rename to cdist/test/resolver/fixtures/object/__third/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__third/moon/.cdist/.keep b/cdist/test/resolver/fixtures/object/__third/moon/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__third/moon/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__third/moon/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/name b/cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/name similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/name rename to cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/name diff --git a/lib/cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/planet b/cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/planet similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/planet rename to cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/planet diff --git a/lib/cdist/test/resolver/fixtures/type/__first/.keep b/cdist/test/resolver/fixtures/type/__first/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/type/__first/.keep rename to cdist/test/resolver/fixtures/type/__first/.keep diff --git a/lib/cdist/test/resolver/fixtures/type/__second/.keep b/cdist/test/resolver/fixtures/type/__second/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/type/__second/.keep rename to cdist/test/resolver/fixtures/type/__second/.keep diff --git a/lib/cdist/test/resolver/fixtures/type/__third/.keep b/cdist/test/resolver/fixtures/type/__third/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/type/__third/.keep rename to cdist/test/resolver/fixtures/type/__third/.keep diff --git a/lib/cdist/test/type/__init__.py b/cdist/test/type/__init__.py similarity index 100% rename from lib/cdist/test/type/__init__.py rename to cdist/test/type/__init__.py diff --git a/lib/cdist/test/type/fixtures/__install/install b/cdist/test/type/fixtures/__install/install similarity index 100% rename from lib/cdist/test/type/fixtures/__install/install rename to cdist/test/type/fixtures/__install/install diff --git a/lib/cdist/test/type/fixtures/__name_path/.keep b/cdist/test/type/fixtures/__name_path/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__name_path/.keep rename to cdist/test/type/fixtures/__name_path/.keep diff --git a/lib/cdist/test/type/fixtures/__not_install/.keep b/cdist/test/type/fixtures/__not_install/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__not_install/.keep rename to cdist/test/type/fixtures/__not_install/.keep diff --git a/lib/cdist/test/type/fixtures/__not_singleton/.keep b/cdist/test/type/fixtures/__not_singleton/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__not_singleton/.keep rename to cdist/test/type/fixtures/__not_singleton/.keep diff --git a/lib/cdist/test/type/fixtures/__singleton/singleton b/cdist/test/type/fixtures/__singleton/singleton similarity index 100% rename from lib/cdist/test/type/fixtures/__singleton/singleton rename to cdist/test/type/fixtures/__singleton/singleton diff --git a/lib/cdist/test/type/fixtures/__with_boolean_parameters/parameter/boolean b/cdist/test/type/fixtures/__with_boolean_parameters/parameter/boolean similarity index 100% rename from lib/cdist/test/type/fixtures/__with_boolean_parameters/parameter/boolean rename to cdist/test/type/fixtures/__with_boolean_parameters/parameter/boolean diff --git a/lib/cdist/test/type/fixtures/__with_explorers/explorer/whatever b/cdist/test/type/fixtures/__with_explorers/explorer/whatever similarity index 100% rename from lib/cdist/test/type/fixtures/__with_explorers/explorer/whatever rename to cdist/test/type/fixtures/__with_explorers/explorer/whatever diff --git a/lib/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional b/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional similarity index 100% rename from lib/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional rename to cdist/test/type/fixtures/__with_optional_parameters/parameter/optional diff --git a/lib/cdist/test/type/fixtures/__with_required_parameters/parameter/required b/cdist/test/type/fixtures/__with_required_parameters/parameter/required similarity index 100% rename from lib/cdist/test/type/fixtures/__with_required_parameters/parameter/required rename to cdist/test/type/fixtures/__with_required_parameters/parameter/required diff --git a/lib/cdist/test/type/fixtures/__without_boolean_parameters/.keep b/cdist/test/type/fixtures/__without_boolean_parameters/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__without_boolean_parameters/.keep rename to cdist/test/type/fixtures/__without_boolean_parameters/.keep diff --git a/lib/cdist/test/type/fixtures/__without_explorers/.keep b/cdist/test/type/fixtures/__without_explorers/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__without_explorers/.keep rename to cdist/test/type/fixtures/__without_explorers/.keep diff --git a/lib/cdist/test/type/fixtures/__without_optional_parameters/.keep b/cdist/test/type/fixtures/__without_optional_parameters/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__without_optional_parameters/.keep rename to cdist/test/type/fixtures/__without_optional_parameters/.keep diff --git a/lib/cdist/test/type/fixtures/__without_required_parameters/.keep b/cdist/test/type/fixtures/__without_required_parameters/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__without_required_parameters/.keep rename to cdist/test/type/fixtures/__without_required_parameters/.keep diff --git a/lib/cdist/test/type/fixtures/list_types/__first/.keep b/cdist/test/type/fixtures/list_types/__first/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/list_types/__first/.keep rename to cdist/test/type/fixtures/list_types/__first/.keep diff --git a/lib/cdist/test/type/fixtures/list_types/__second/.keep b/cdist/test/type/fixtures/list_types/__second/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/list_types/__second/.keep rename to cdist/test/type/fixtures/list_types/__second/.keep diff --git a/lib/cdist/test/type/fixtures/list_types/__third/.keep b/cdist/test/type/fixtures/list_types/__third/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/list_types/__third/.keep rename to cdist/test/type/fixtures/list_types/__third/.keep diff --git a/lib/cdist/test/util/__init__.py b/cdist/test/util/__init__.py similarity index 100% rename from lib/cdist/test/util/__init__.py rename to cdist/test/util/__init__.py diff --git a/lib/cdist/test/util/fsproperty.py b/cdist/test/util/fsproperty.py similarity index 100% rename from lib/cdist/test/util/fsproperty.py rename to cdist/test/util/fsproperty.py diff --git a/lib/cdist/util/__init__.py b/cdist/util/__init__.py similarity index 100% rename from lib/cdist/util/__init__.py rename to cdist/util/__init__.py diff --git a/lib/cdist/util/fsproperty.py b/cdist/util/fsproperty.py similarity index 100% rename from lib/cdist/util/fsproperty.py rename to cdist/util/fsproperty.py diff --git a/conf/manifest/init.sample b/conf/manifest/init.sample deleted file mode 100755 index fca959e2..00000000 --- a/conf/manifest/init.sample +++ /dev/null @@ -1,69 +0,0 @@ -# -# This is a sample manifest, but used in real world -# - -# This is debug and should not be in a production environment -# echo "We could access other manifests in $__manifest" - -# Every machine becomes a marker, so sysadmins know that automatic -# configurations are happening -__file /etc/cdist-configured - -case "$__target_host" in - # Everybody has this - localhost) - require="__file/etc/cdist-configured" __link /tmp/cdist-testfile \ - --source /etc/cdist-configured --type symbolic - require="__directory/tmp/cdist-test-dir" __file /tmp/cdist-test-dir/test-file \ - --mode 0750 --owner nobody --group root - __directory /tmp/cdist-test-dir --mode 4777 - - require="__file/etc/cdist-configured __link/tmp/cdist-testfile" \ - __file /tmp/cdist-another-testfile - - ;; - - # - # Examples using different types - # - - # - # Use an alias in /etc/hosts for localhost to use these hosts: - # - # 127.0.0.1 localhost.localdomain localhost cdist-archlinux - # - cdist-archlinux) - # This is the specific package type for pacman - __package_pacman zsh --state installed - - # The __package type autoselect the right type based on the os - __package vim --state installed - - # If the type is a singleton, it does not take an object id - __issue - ;; - # This is how it would look like on gentoo - cdist-gentoo) - # Same stuff for gentoo - __package tree --state installed - ;; - - cdist-debian) - __package_apt atop --state installed - __package apache2 --state removed - ;; - - cdist-redhat) - __issue - __motd - ;; - - # Real machines may be used with their hostname or fqdn, - # depending on how you call cdist-deploy-to - # machine) - # ... - # ;; - # machine.example.org) - # ... - # ;; -esac diff --git a/conf/type/__addifnosuchline/explorer/findline b/conf/type/__addifnosuchline/explorer/findline deleted file mode 100755 index b45bd6ea..00000000 --- a/conf/type/__addifnosuchline/explorer/findline +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Daniel Roth (dani-cdist@d-roth.li) -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -if [ -f "$__object/parameter/file" ]; then - file=$(cat "$__object/parameter/file") -else - file="/$__object_id" -fi - -if [ -f "$__object/parameter/regex" ]; then - regex=$(cat "$__object/parameter/regex") -else - wrap=$(cat "$__object/parameter/line") - regex="^$wrap\$" -fi - -if [ -f "$file" ]; then - # sh -e is our environment, we know what we do, - # skip error detection for now - set +e - grep -q "$regex" "$file" - if [ $? -eq 1 ]; then - echo "NOTFOUND" - else - echo "FOUND" - fi -else - echo "NOTFOUND" -fi diff --git a/conf/type/__addifnosuchline/gencode-remote b/conf/type/__addifnosuchline/gencode-remote deleted file mode 100755 index 1276e5d0..00000000 --- a/conf/type/__addifnosuchline/gencode-remote +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Daniel Roth (dani-cdist@d-roth.li) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -if [ -f "$__object/parameter/file" ]; then - file=$(cat "$__object/parameter/file") -else - file="/$__object_id" -fi - -result=$(cat "$__object/explorer/findline") - -if [ "$result" = "NOTFOUND" ]; then - line=$(cat "$__object/parameter/line") - echo "echo \"$line\" >> $file" -fi diff --git a/conf/type/__addifnosuchline/man.text b/conf/type/__addifnosuchline/man.text deleted file mode 100644 index ba3825ff..00000000 --- a/conf/type/__addifnosuchline/man.text +++ /dev/null @@ -1,52 +0,0 @@ -cdist-type__addifnosuchline(7) -============================== -Daniel Roth - - -NAME ----- -cdist-type__addifnosuchline - Add a line (if not existing already) - - -DESCRIPTION ------------ -This type can be used to check a file for existence of a -specific line and adding it, if it was not found. - - -REQUIRED PARAMETERS -------------------- -line:: - Specifies the content which shall be added if not existing. - - -OPTIONAL PARAMETERS -------------------- -file:: - If supplied, use this as the destination file. - Otherwise the object_id is used. -regex:: - If supplied, search for this regex. - Otherwise entire line must be matched. - -EXAMPLES --------- - --------------------------------------------------------------------------------- -# Creates or appends the line specified in "include_www" to the file "lighttpd.conf" -__addifnosuchline www --file /etc/lighttpd.conf --line include_www - -# Adds the line "include_git" to the file "lighttpd.conf" -__addifnosuchline /etc/lighttpd.conf --line include_git --------------------------------------------------------------------------------- - - -SEE ALSO --------- -- cdist-type(7) - - -COPYING -------- -Copyright \(C) 2011 Daniel Roth. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__addifnosuchline/manifest b/conf/type/__addifnosuchline/manifest deleted file mode 100644 index ccc82471..00000000 --- a/conf/type/__addifnosuchline/manifest +++ /dev/null @@ -1 +0,0 @@ -echo "WARNING: Type __addifnosuchline is deprecated and will be removed in cdist 2.1. Please use __line instead" >&2 diff --git a/conf/type/__addifnosuchline/parameter/optional b/conf/type/__addifnosuchline/parameter/optional deleted file mode 100644 index 7ecfcde9..00000000 --- a/conf/type/__addifnosuchline/parameter/optional +++ /dev/null @@ -1,2 +0,0 @@ -file -regex diff --git a/conf/type/__addifnosuchline/parameter/required b/conf/type/__addifnosuchline/parameter/required deleted file mode 100644 index a999a0c2..00000000 --- a/conf/type/__addifnosuchline/parameter/required +++ /dev/null @@ -1 +0,0 @@ -line diff --git a/conf/type/__removeline/man.text b/conf/type/__removeline/man.text deleted file mode 100644 index dba8b625..00000000 --- a/conf/type/__removeline/man.text +++ /dev/null @@ -1,50 +0,0 @@ -cdist-type__removeline(7) -========================= -Daniel Roth - - -NAME ----- -cdist-type__removeline - Remove a line (if existing) - - -DESCRIPTION ------------ -This type can be used to check a file for existence of a -specific line and removeing it, if it was found. - - -REQUIRED PARAMETERS -------------------- -line:: - Specifies the content which shall be removed if existing. - - -OPTIONAL PARAMETERS -------------------- -file:: - If supplied, use this as the destination file. - Otherwise the object_id is used. - - -EXAMPLES --------- - --------------------------------------------------------------------------------- -# Removes the line specifiend in "include_www" from the file "lighttpd.conf" -__removeline www --file /etc/lighttpd.conf --line include_www - -# Removes the line "include_git" from the file "lighttpd.conf" -__removeline /etc/lighttpd.conf --line include_git --------------------------------------------------------------------------------- - - -SEE ALSO --------- -- cdist-type(7) - - -COPYING -------- -Copyright \(C) 2011 Daniel Roth. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__removeline/manifest b/conf/type/__removeline/manifest deleted file mode 100644 index 63528795..00000000 --- a/conf/type/__removeline/manifest +++ /dev/null @@ -1 +0,0 @@ -echo "WARNING: Type __removeline is deprecated and will be removed in cdist 2.1. Please use __line instead" >&2 diff --git a/conf/type/__removeline/parameter/optional b/conf/type/__removeline/parameter/optional deleted file mode 100644 index f73f3093..00000000 --- a/conf/type/__removeline/parameter/optional +++ /dev/null @@ -1 +0,0 @@ -file diff --git a/conf/type/__removeline/parameter/required b/conf/type/__removeline/parameter/required deleted file mode 100644 index a999a0c2..00000000 --- a/conf/type/__removeline/parameter/required +++ /dev/null @@ -1 +0,0 @@ -line diff --git a/conf/type/__rvm_gem/manifest b/conf/type/__rvm_gem/manifest deleted file mode 100755 index a551472d..00000000 --- a/conf/type/__rvm_gem/manifest +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# 2012 Evax Software -# -# 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 . -# - -gem="$__object_id" -gemset="$(cat "$__object/parameter/gemset")" -ruby="$(echo "$gemset" | cut -d '@' -f 1)" -gemsetname="$(echo "$gemset" | cut -d '@' -f 2)" -user="$(cat "$__object/parameter/user")" -state="$(cat "$__object/explorer/state")" -if [ -f "$__object/parameter/default" ]; then - default="$(cat "$__object/parameter/default")" -else - default="no" - echo $default > "$__object/parameter/default" -fi - -__rvm "$user" --state present -require="__rvm/$user" \ - __rvm_ruby $ruby --user "$user" --state present --default $default -require="__rvm_ruby/$ruby" \ - __rvm_gemset $gemset --user "$user" --state present --default $default diff --git a/conf/type/__rvm_gemset/manifest b/conf/type/__rvm_gemset/manifest deleted file mode 100755 index b69395ea..00000000 --- a/conf/type/__rvm_gemset/manifest +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# -# 2012 Evax Software -# -# 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 . -# - -gemset="$__object_id" -ruby="$(echo "$gemset" | cut -d '@' -f 1)" -gemsetname="$(echo "$gemset" | cut -d '@' -f 2)" -user="$(cat "$__object/parameter/user")" -state="$(cat "$__object/explorer/state")" -if [ -f "$__object/parameter/default" ]; then - default="$(cat "$__object/parameter/default")" -else - default="no" - echo $default > "$__object/parameter/default" -fi - -__rvm "$user" --state present -require="__rvm/$user" \ - __rvm_ruby $ruby --user "$user" --state present --default $default - diff --git a/conf/type/__rvm_ruby/manifest b/conf/type/__rvm_ruby/manifest deleted file mode 100755 index 581e98a8..00000000 --- a/conf/type/__rvm_ruby/manifest +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -# -# 2012 Evax Software -# -# 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 . -# - -if [ -f "$__object/parameter/default" ]; then - default="$(cat "$__object/parameter/default")" -else - default="no" - echo "$default" > "$__object/parameter/default" -fi - -ruby="$__object_id" -user="$(cat "$__object/parameter/user")" -state="$(cat "$__object/explorer/state")" - -apt_ruby="build-essential openssl libreadline6 libreadline6-dev curl git-core -zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 -libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison -subversion" -apt_jruby="curl g++ openjdk-6-jre-headless" -apt_jruby_head="ant openjdk-6-jdk" -apt_ironruby="curl mono-2.0-devel" - -emerge_ruby="libiconv readline zlib openssl curl git libyaml sqlite libxslt -libtool gcc autoconf automake bison m4" -emerge_jruby="dev-java/sun-jdk dev-java/sun-jre-bin" -emerge_ironruby="dev-lang/mono" - -pacman_ruby="gcc patch curl zlib readline libxml2 libxslt git autoconf -diffutils make libtool bison subversion" -pacman_jruby="jdk jre curl" -pacman_ironruby="mono" - -yum_ruby="gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel -libffi-devel openssl-devel make bzip2 autoconf automake libtool bison -iconv-devel" -yum_jruby="java" - -os="$(cat "$__global/explorer/os")" -case "$os" in - archlinux) type="pacman" ;; - debian|ubuntu) type="apt" ;; - gentoo) type="emerge" ;; - fedora|redhat|centos) type="yum" ;; - *);; -esac -case "$ruby" in - ruby-head*) - deps_list="${type}_ruby_head" - ;; - ruby*) - deps_list="${type}_ruby" - ;; - jruby-head*) - deps_list="${type}_jruby_head" - ;; - jruby*) - deps_list="${type}_jruby" - ;; - ironruby*) - deps_list="${type}_ironruby" - ;; -esac -deps=$(eval echo \$$deps_list) -for p in $deps; do __package_${type} $p --state present; done - -__rvm "$user" --state present diff --git a/doc/dev/releasechecklist b/doc/dev/releasechecklist deleted file mode 100755 index 71f2979e..00000000 --- a/doc/dev/releasechecklist +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh -# Nico Schottelius - -files="doc/changelog lib/cdist/__init__.py" - -# Stuff to take care of when doing a release -echo "Preparing next release" - -# Ensure documentation builds cleanly -echo "Testing documentation..." -./build clean && ./build man || exit 1 - -# get version -changelog_version=$(grep '^[[:digit:]]' doc/changelog | head -n1 | sed 's/:.*//') -#git_version=$(git describe) -lib_version=$(grep "^ VERSION" lib/cdist/__init__.py | sed -e 's/.*= //' -e 's/"//g') - -# get date -date_today="$(date +%Y-%m-%d)" -date_changelog=$(grep '^[[:digit:]]' doc/changelog | head -n1 | sed 's/.*: //') - -echo "Ensure you fixed/prepared version files: $files" -echo "changelog: $changelog_version" -#echo "git: $git_version" -echo "lib: $lib_version" - -if [ "$date_today" != "$date_changelog" ]; then - echo "Messed up date, not releasing:" - echo "Changelog: $date_changelog" - exit 1 -fi - -if [ "$lib_version" != "$changelog_version" ]; then - echo "Messed up versions, not releasing" - exit 1 -else - echo "Versions are sane, continuing" -fi -echo "Press enter to continue" -read wait -version=$lib_version - -# get target branch -branch=${version%\.*} - -# add tag -printf "Enter tag description for %s> " "$version" -read tagmessage -git tag "$version" -m "$tagmessage" - -# Import into current version branch -printf "Press enter to git merge into branch \"$branch\" > " -read prompt -git checkout $branch -git merge master -git checkout master - -# Publish manpages and sourcecode -printf "Press enter to publish doc/ and code/ > " -read prompt -./build web -./build pub - -cat << notes -To be done manually... - - - freecode release - - blog entry - - linkedin entry - - mailinglist update - -notes diff --git a/doc/changelog b/docs/changelog similarity index 91% rename from doc/changelog rename to docs/changelog index e5abb6b5..9b6a391f 100644 --- a/doc/changelog +++ b/docs/changelog @@ -4,6 +4,34 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius +2.1.0pre6: + * New Example: Turn remote calls into local calls (used for unittesting) + +2.1.0pre5: 2012-11-01 + * Core: First round of tests updated to work with multiple configuration directories + +2.1.0pre4: 2012-10-31 + * Dist: PyPi: Moved cdist.py to script/cdist to avoid double import + * Core: Added support for multiple configuration directories (no documentation) + +2.1.0pre3: 2012-10-30 + * Dist: PyPi: Types and explorer included as package data + +2.1.0pre2: 2012-10-26 + * Dist: PyPi: Add conf/ directory to distribution + * Dist: Initial support for archlinux packaging + +2.1.0pre1: 2012-10-26 + * Core: Removed obsolete variable __self + * Removed type __addifnosuchline (replaced by __line) + * Removed type __removeline (replaced by __line) + * Type __directory: Parameter --parents and --recursive are now boolean + * Type __package_apt, __package_luarocks, __package_opkg, + __package_pacman, __package_pkg_freebsd, __package_pkg_openbsd, + __package_rubygem, __package_yum, __process: + Parameter state accepts only "present" and "absent" + * Dist: Initial support for pypi packaging + 2.0.15: 2012-11-02 * Core: Make variable __object_name available in type explorers (Steven Armtrong) * New Type: __qemu_img diff --git a/doc/dev/benchmark-oprofile b/docs/dev/benchmark-oprofile similarity index 100% rename from doc/dev/benchmark-oprofile rename to docs/dev/benchmark-oprofile diff --git a/doc/dev/benchmark-parallel-deploy b/docs/dev/benchmark-parallel-deploy similarity index 100% rename from doc/dev/benchmark-parallel-deploy rename to docs/dev/benchmark-parallel-deploy diff --git a/doc/dev/debug/bach25-1.6.2-373-g6fd31f8 b/docs/dev/debug/bach25-1.6.2-373-g6fd31f8 similarity index 100% rename from doc/dev/debug/bach25-1.6.2-373-g6fd31f8 rename to docs/dev/debug/bach25-1.6.2-373-g6fd31f8 diff --git a/doc/dev/debug/ikq04-1.6.2-373-g6fd31f8-dbg b/docs/dev/debug/ikq04-1.6.2-373-g6fd31f8-dbg similarity index 100% rename from doc/dev/debug/ikq04-1.6.2-373-g6fd31f8-dbg rename to docs/dev/debug/ikq04-1.6.2-373-g6fd31f8-dbg diff --git a/doc/dev/fancy-ideas b/docs/dev/fancy-ideas similarity index 100% rename from doc/dev/fancy-ideas rename to docs/dev/fancy-ideas diff --git a/doc/dev/git-post-commit-hook b/docs/dev/git-post-commit-hook similarity index 100% rename from doc/dev/git-post-commit-hook rename to docs/dev/git-post-commit-hook diff --git a/doc/dev/header b/docs/dev/header similarity index 100% rename from doc/dev/header rename to docs/dev/header diff --git a/doc/dev/lastchanges b/docs/dev/lastchanges similarity index 100% rename from doc/dev/lastchanges rename to docs/dev/lastchanges diff --git a/doc/dev/logs/2010-09-25 b/docs/dev/logs/2010-09-25 similarity index 100% rename from doc/dev/logs/2010-09-25 rename to docs/dev/logs/2010-09-25 diff --git a/doc/dev/logs/2010-11-02.steven b/docs/dev/logs/2010-11-02.steven similarity index 100% rename from doc/dev/logs/2010-11-02.steven rename to docs/dev/logs/2010-11-02.steven diff --git a/doc/dev/logs/2010-11-09 b/docs/dev/logs/2010-11-09 similarity index 100% rename from doc/dev/logs/2010-11-09 rename to docs/dev/logs/2010-11-09 diff --git a/doc/dev/logs/2010-11-21 b/docs/dev/logs/2010-11-21 similarity index 100% rename from doc/dev/logs/2010-11-21 rename to docs/dev/logs/2010-11-21 diff --git a/doc/dev/logs/2010-11-29 b/docs/dev/logs/2010-11-29 similarity index 100% rename from doc/dev/logs/2010-11-29 rename to docs/dev/logs/2010-11-29 diff --git a/doc/dev/logs/2010-12-01 b/docs/dev/logs/2010-12-01 similarity index 100% rename from doc/dev/logs/2010-12-01 rename to docs/dev/logs/2010-12-01 diff --git a/doc/dev/logs/2010-12-01.handwritten/SCAN0000.PDF b/docs/dev/logs/2010-12-01.handwritten/SCAN0000.PDF similarity index 100% rename from doc/dev/logs/2010-12-01.handwritten/SCAN0000.PDF rename to docs/dev/logs/2010-12-01.handwritten/SCAN0000.PDF diff --git a/doc/dev/logs/2010-12-01.handwritten/SCAN0001.PDF b/docs/dev/logs/2010-12-01.handwritten/SCAN0001.PDF similarity index 100% rename from doc/dev/logs/2010-12-01.handwritten/SCAN0001.PDF rename to docs/dev/logs/2010-12-01.handwritten/SCAN0001.PDF diff --git a/doc/dev/logs/2010-12-01.handwritten/SCAN0002.PDF b/docs/dev/logs/2010-12-01.handwritten/SCAN0002.PDF similarity index 100% rename from doc/dev/logs/2010-12-01.handwritten/SCAN0002.PDF rename to docs/dev/logs/2010-12-01.handwritten/SCAN0002.PDF diff --git a/doc/dev/logs/2010-12-01.handwritten/SCAN0003.PDF b/docs/dev/logs/2010-12-01.handwritten/SCAN0003.PDF similarity index 100% rename from doc/dev/logs/2010-12-01.handwritten/SCAN0003.PDF rename to docs/dev/logs/2010-12-01.handwritten/SCAN0003.PDF diff --git a/doc/dev/logs/2010-12-01.handwritten/SCAN0004.PDF b/docs/dev/logs/2010-12-01.handwritten/SCAN0004.PDF similarity index 100% rename from doc/dev/logs/2010-12-01.handwritten/SCAN0004.PDF rename to docs/dev/logs/2010-12-01.handwritten/SCAN0004.PDF diff --git a/doc/dev/logs/2011-01-17 b/docs/dev/logs/2011-01-17 similarity index 100% rename from doc/dev/logs/2011-01-17 rename to docs/dev/logs/2011-01-17 diff --git a/doc/dev/logs/2011-01-18.type-creation b/docs/dev/logs/2011-01-18.type-creation similarity index 100% rename from doc/dev/logs/2011-01-18.type-creation rename to docs/dev/logs/2011-01-18.type-creation diff --git a/doc/dev/logs/2011-01-24 b/docs/dev/logs/2011-01-24 similarity index 100% rename from doc/dev/logs/2011-01-24 rename to docs/dev/logs/2011-01-24 diff --git a/doc/dev/logs/2011-02-03 b/docs/dev/logs/2011-02-03 similarity index 100% rename from doc/dev/logs/2011-02-03 rename to docs/dev/logs/2011-02-03 diff --git a/doc/dev/logs/2011-02-04.steven b/docs/dev/logs/2011-02-04.steven similarity index 100% rename from doc/dev/logs/2011-02-04.steven rename to docs/dev/logs/2011-02-04.steven diff --git a/doc/dev/logs/2011-02-22 b/docs/dev/logs/2011-02-22 similarity index 100% rename from doc/dev/logs/2011-02-22 rename to docs/dev/logs/2011-02-22 diff --git a/doc/dev/logs/2011-02-24 b/docs/dev/logs/2011-02-24 similarity index 100% rename from doc/dev/logs/2011-02-24 rename to docs/dev/logs/2011-02-24 diff --git a/doc/dev/logs/2011-02-27 b/docs/dev/logs/2011-02-27 similarity index 100% rename from doc/dev/logs/2011-02-27 rename to docs/dev/logs/2011-02-27 diff --git a/doc/dev/logs/2011-03-03 b/docs/dev/logs/2011-03-03 similarity index 100% rename from doc/dev/logs/2011-03-03 rename to docs/dev/logs/2011-03-03 diff --git a/doc/dev/logs/2011-03-07 b/docs/dev/logs/2011-03-07 similarity index 100% rename from doc/dev/logs/2011-03-07 rename to docs/dev/logs/2011-03-07 diff --git a/doc/dev/logs/2011-03-09 b/docs/dev/logs/2011-03-09 similarity index 100% rename from doc/dev/logs/2011-03-09 rename to docs/dev/logs/2011-03-09 diff --git a/doc/dev/logs/2011-03-15 b/docs/dev/logs/2011-03-15 similarity index 100% rename from doc/dev/logs/2011-03-15 rename to docs/dev/logs/2011-03-15 diff --git a/doc/dev/logs/2011-03-15.file_directory_link b/docs/dev/logs/2011-03-15.file_directory_link similarity index 100% rename from doc/dev/logs/2011-03-15.file_directory_link rename to docs/dev/logs/2011-03-15.file_directory_link diff --git a/doc/dev/logs/2011-03-23.autorequire b/docs/dev/logs/2011-03-23.autorequire similarity index 100% rename from doc/dev/logs/2011-03-23.autorequire rename to docs/dev/logs/2011-03-23.autorequire diff --git a/doc/dev/logs/2011-03-23.manifest_use_explorer b/docs/dev/logs/2011-03-23.manifest_use_explorer similarity index 100% rename from doc/dev/logs/2011-03-23.manifest_use_explorer rename to docs/dev/logs/2011-03-23.manifest_use_explorer diff --git a/doc/dev/logs/2011-03-27.pgrep b/docs/dev/logs/2011-03-27.pgrep similarity index 100% rename from doc/dev/logs/2011-03-27.pgrep rename to docs/dev/logs/2011-03-27.pgrep diff --git a/doc/dev/logs/2011-03-28.execution-order b/docs/dev/logs/2011-03-28.execution-order similarity index 100% rename from doc/dev/logs/2011-03-28.execution-order rename to docs/dev/logs/2011-03-28.execution-order diff --git a/doc/dev/logs/2011-04-02.yum b/docs/dev/logs/2011-04-02.yum similarity index 100% rename from doc/dev/logs/2011-04-02.yum rename to docs/dev/logs/2011-04-02.yum diff --git a/doc/dev/logs/2011-04-04.openbsd b/docs/dev/logs/2011-04-04.openbsd similarity index 100% rename from doc/dev/logs/2011-04-04.openbsd rename to docs/dev/logs/2011-04-04.openbsd diff --git a/doc/dev/logs/2011-04-19 b/docs/dev/logs/2011-04-19 similarity index 100% rename from doc/dev/logs/2011-04-19 rename to docs/dev/logs/2011-04-19 diff --git a/doc/dev/logs/2011-04-20.slashdot-articles b/docs/dev/logs/2011-04-20.slashdot-articles similarity index 100% rename from doc/dev/logs/2011-04-20.slashdot-articles rename to docs/dev/logs/2011-04-20.slashdot-articles diff --git a/doc/dev/logs/2011-04-21.benchmark-eth b/docs/dev/logs/2011-04-21.benchmark-eth similarity index 100% rename from doc/dev/logs/2011-04-21.benchmark-eth rename to docs/dev/logs/2011-04-21.benchmark-eth diff --git a/doc/dev/logs/2011-04-21.benchmark-from-home.with-stdout b/docs/dev/logs/2011-04-21.benchmark-from-home.with-stdout similarity index 100% rename from doc/dev/logs/2011-04-21.benchmark-from-home.with-stdout rename to docs/dev/logs/2011-04-21.benchmark-from-home.with-stdout diff --git a/doc/dev/logs/2011-04-27 b/docs/dev/logs/2011-04-27 similarity index 100% rename from doc/dev/logs/2011-04-27 rename to docs/dev/logs/2011-04-27 diff --git a/doc/dev/logs/2011-04-27.benchmark b/docs/dev/logs/2011-04-27.benchmark similarity index 100% rename from doc/dev/logs/2011-04-27.benchmark rename to docs/dev/logs/2011-04-27.benchmark diff --git a/doc/dev/logs/2011-04-27.benchmark.dash b/docs/dev/logs/2011-04-27.benchmark.dash similarity index 100% rename from doc/dev/logs/2011-04-27.benchmark.dash rename to docs/dev/logs/2011-04-27.benchmark.dash diff --git a/doc/dev/logs/2011-04-27.debug-timing b/docs/dev/logs/2011-04-27.debug-timing similarity index 100% rename from doc/dev/logs/2011-04-27.debug-timing rename to docs/dev/logs/2011-04-27.debug-timing diff --git a/doc/dev/logs/2011-05-09 b/docs/dev/logs/2011-05-09 similarity index 100% rename from doc/dev/logs/2011-05-09 rename to docs/dev/logs/2011-05-09 diff --git a/doc/dev/logs/2011-05-10 b/docs/dev/logs/2011-05-10 similarity index 100% rename from doc/dev/logs/2011-05-10 rename to docs/dev/logs/2011-05-10 diff --git a/doc/dev/logs/2011-05-10.benchmark b/docs/dev/logs/2011-05-10.benchmark similarity index 100% rename from doc/dev/logs/2011-05-10.benchmark rename to docs/dev/logs/2011-05-10.benchmark diff --git a/doc/dev/logs/2011-05-12 b/docs/dev/logs/2011-05-12 similarity index 100% rename from doc/dev/logs/2011-05-12 rename to docs/dev/logs/2011-05-12 diff --git a/doc/dev/logs/2011-06-13.installation-via-cdist b/docs/dev/logs/2011-06-13.installation-via-cdist similarity index 100% rename from doc/dev/logs/2011-06-13.installation-via-cdist rename to docs/dev/logs/2011-06-13.installation-via-cdist diff --git a/doc/dev/logs/2011-06-14.library_for_user b/docs/dev/logs/2011-06-14.library_for_user similarity index 100% rename from doc/dev/logs/2011-06-14.library_for_user rename to docs/dev/logs/2011-06-14.library_for_user diff --git a/doc/dev/logs/2011-06-24.cinst_preos b/docs/dev/logs/2011-06-24.cinst_preos similarity index 100% rename from doc/dev/logs/2011-06-24.cinst_preos rename to docs/dev/logs/2011-06-24.cinst_preos diff --git a/doc/dev/logs/2011-06-25.trigger-graphic b/docs/dev/logs/2011-06-25.trigger-graphic similarity index 100% rename from doc/dev/logs/2011-06-25.trigger-graphic rename to docs/dev/logs/2011-06-25.trigger-graphic diff --git a/doc/dev/logs/2011-07-01.type-gencode b/docs/dev/logs/2011-07-01.type-gencode similarity index 100% rename from doc/dev/logs/2011-07-01.type-gencode rename to docs/dev/logs/2011-07-01.type-gencode diff --git a/doc/dev/logs/2011-07-01.type-global-explorers b/docs/dev/logs/2011-07-01.type-global-explorers similarity index 100% rename from doc/dev/logs/2011-07-01.type-global-explorers rename to docs/dev/logs/2011-07-01.type-global-explorers diff --git a/doc/dev/logs/2011-09-08.obsolete_debugging b/docs/dev/logs/2011-09-08.obsolete_debugging similarity index 100% rename from doc/dev/logs/2011-09-08.obsolete_debugging rename to docs/dev/logs/2011-09-08.obsolete_debugging diff --git a/doc/dev/logs/2011-09-12 b/docs/dev/logs/2011-09-12 similarity index 100% rename from doc/dev/logs/2011-09-12 rename to docs/dev/logs/2011-09-12 diff --git a/doc/dev/logs/2011-09-12.benchmark-home b/docs/dev/logs/2011-09-12.benchmark-home similarity index 100% rename from doc/dev/logs/2011-09-12.benchmark-home rename to docs/dev/logs/2011-09-12.benchmark-home diff --git a/doc/dev/logs/2011-09-13 b/docs/dev/logs/2011-09-13 similarity index 100% rename from doc/dev/logs/2011-09-13 rename to docs/dev/logs/2011-09-13 diff --git a/doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket b/docs/dev/logs/2011-09-16.benchmark-r815-no-control-socket similarity index 100% rename from doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket rename to docs/dev/logs/2011-09-16.benchmark-r815-no-control-socket diff --git a/doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode b/docs/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode similarity index 100% rename from doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode rename to docs/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode diff --git a/doc/dev/logs/2011-10-04 b/docs/dev/logs/2011-10-04 similarity index 100% rename from doc/dev/logs/2011-10-04 rename to docs/dev/logs/2011-10-04 diff --git a/doc/dev/logs/2011-10-05 b/docs/dev/logs/2011-10-05 similarity index 100% rename from doc/dev/logs/2011-10-05 rename to docs/dev/logs/2011-10-05 diff --git a/doc/dev/logs/2011-10-06 b/docs/dev/logs/2011-10-06 similarity index 100% rename from doc/dev/logs/2011-10-06 rename to docs/dev/logs/2011-10-06 diff --git a/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot b/docs/dev/logs/2011-10-06.ssh_scp_sudo_chroot similarity index 100% rename from doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot rename to docs/dev/logs/2011-10-06.ssh_scp_sudo_chroot diff --git a/doc/dev/logs/2011-10-11.emulator-output b/docs/dev/logs/2011-10-11.emulator-output similarity index 100% rename from doc/dev/logs/2011-10-11.emulator-output rename to docs/dev/logs/2011-10-11.emulator-output diff --git a/doc/dev/logs/2011-10-12 b/docs/dev/logs/2011-10-12 similarity index 100% rename from doc/dev/logs/2011-10-12 rename to docs/dev/logs/2011-10-12 diff --git a/doc/dev/logs/2011-10-13.output b/docs/dev/logs/2011-10-13.output similarity index 100% rename from doc/dev/logs/2011-10-13.output rename to docs/dev/logs/2011-10-13.output diff --git a/doc/dev/logs/2011-10-14.error-output b/docs/dev/logs/2011-10-14.error-output similarity index 100% rename from doc/dev/logs/2011-10-14.error-output rename to docs/dev/logs/2011-10-14.error-output diff --git a/doc/dev/logs/2011-10-15.prefix-output-missing b/docs/dev/logs/2011-10-15.prefix-output-missing similarity index 100% rename from doc/dev/logs/2011-10-15.prefix-output-missing rename to docs/dev/logs/2011-10-15.prefix-output-missing diff --git a/doc/dev/logs/2011-10-15.ugly-output-on-breaking-explorer b/docs/dev/logs/2011-10-15.ugly-output-on-breaking-explorer similarity index 100% rename from doc/dev/logs/2011-10-15.ugly-output-on-breaking-explorer rename to docs/dev/logs/2011-10-15.ugly-output-on-breaking-explorer diff --git a/doc/dev/logs/2011-10-16.keyboardirqoutputs b/docs/dev/logs/2011-10-16.keyboardirqoutputs similarity index 100% rename from doc/dev/logs/2011-10-16.keyboardirqoutputs rename to docs/dev/logs/2011-10-16.keyboardirqoutputs diff --git a/doc/dev/logs/2011-10-18.requirement-object b/docs/dev/logs/2011-10-18.requirement-object similarity index 100% rename from doc/dev/logs/2011-10-18.requirement-object rename to docs/dev/logs/2011-10-18.requirement-object diff --git a/doc/dev/logs/2011-10-18.traceback-gencode b/docs/dev/logs/2011-10-18.traceback-gencode similarity index 100% rename from doc/dev/logs/2011-10-18.traceback-gencode rename to docs/dev/logs/2011-10-18.traceback-gencode diff --git a/doc/dev/logs/2011-11-15.startup-yannick b/docs/dev/logs/2011-11-15.startup-yannick similarity index 100% rename from doc/dev/logs/2011-11-15.startup-yannick rename to docs/dev/logs/2011-11-15.startup-yannick diff --git a/doc/dev/logs/2012-01-06.python3-in-distros b/docs/dev/logs/2012-01-06.python3-in-distros similarity index 100% rename from doc/dev/logs/2012-01-06.python3-in-distros rename to docs/dev/logs/2012-01-06.python3-in-distros diff --git a/doc/dev/logs/2012-01-07.urls b/docs/dev/logs/2012-01-07.urls similarity index 100% rename from doc/dev/logs/2012-01-07.urls rename to docs/dev/logs/2012-01-07.urls diff --git a/doc/dev/logs/2012-01-18.urls b/docs/dev/logs/2012-01-18.urls similarity index 100% rename from doc/dev/logs/2012-01-18.urls rename to docs/dev/logs/2012-01-18.urls diff --git a/doc/dev/logs/2012-02-08.explorer-depends-on-another-type b/docs/dev/logs/2012-02-08.explorer-depends-on-another-type similarity index 100% rename from doc/dev/logs/2012-02-08.explorer-depends-on-another-type rename to docs/dev/logs/2012-02-08.explorer-depends-on-another-type diff --git a/doc/dev/logs/2012-02-10.object_id-and-slashes b/docs/dev/logs/2012-02-10.object_id-and-slashes similarity index 100% rename from doc/dev/logs/2012-02-10.object_id-and-slashes rename to docs/dev/logs/2012-02-10.object_id-and-slashes diff --git a/doc/dev/logs/2012-02-13.dependencies b/docs/dev/logs/2012-02-13.dependencies similarity index 100% rename from doc/dev/logs/2012-02-13.dependencies rename to docs/dev/logs/2012-02-13.dependencies diff --git a/doc/dev/logs/2012-02-15.steven b/docs/dev/logs/2012-02-15.steven similarity index 100% rename from doc/dev/logs/2012-02-15.steven rename to docs/dev/logs/2012-02-15.steven diff --git a/doc/dev/logs/2012-02-17.keyboardirq b/docs/dev/logs/2012-02-17.keyboardirq similarity index 100% rename from doc/dev/logs/2012-02-17.keyboardirq rename to docs/dev/logs/2012-02-17.keyboardirq diff --git a/doc/dev/logs/2012-02-20.debug-jake-deps b/docs/dev/logs/2012-02-20.debug-jake-deps similarity index 100% rename from doc/dev/logs/2012-02-20.debug-jake-deps rename to docs/dev/logs/2012-02-20.debug-jake-deps diff --git a/doc/dev/logs/2012-02-20.error-does-not-contain-host b/docs/dev/logs/2012-02-20.error-does-not-contain-host similarity index 100% rename from doc/dev/logs/2012-02-20.error-does-not-contain-host rename to docs/dev/logs/2012-02-20.error-does-not-contain-host diff --git a/doc/dev/logs/2012-05-24.makedirs.py-python3.1 b/docs/dev/logs/2012-05-24.makedirs.py-python3.1 similarity index 100% rename from doc/dev/logs/2012-05-24.makedirs.py-python3.1 rename to docs/dev/logs/2012-05-24.makedirs.py-python3.1 diff --git a/doc/dev/logs/2012-05-30.ifconfig-outputs b/docs/dev/logs/2012-05-30.ifconfig-outputs similarity index 100% rename from doc/dev/logs/2012-05-30.ifconfig-outputs rename to docs/dev/logs/2012-05-30.ifconfig-outputs diff --git a/doc/dev/logs/2012-05-31.csh-compatibilty b/docs/dev/logs/2012-05-31.csh-compatibilty similarity index 100% rename from doc/dev/logs/2012-05-31.csh-compatibilty rename to docs/dev/logs/2012-05-31.csh-compatibilty diff --git a/doc/dev/logs/2012-06-06.wikipedia b/docs/dev/logs/2012-06-06.wikipedia similarity index 100% rename from doc/dev/logs/2012-06-06.wikipedia rename to docs/dev/logs/2012-06-06.wikipedia diff --git a/doc/dev/logs/2012-06-15.explorer-dep-problem b/docs/dev/logs/2012-06-15.explorer-dep-problem similarity index 100% rename from doc/dev/logs/2012-06-15.explorer-dep-problem rename to docs/dev/logs/2012-06-15.explorer-dep-problem diff --git a/doc/dev/logs/2012-10-17.conflicting-types-problem b/docs/dev/logs/2012-10-17.conflicting-types-problem similarity index 100% rename from doc/dev/logs/2012-10-17.conflicting-types-problem rename to docs/dev/logs/2012-10-17.conflicting-types-problem diff --git a/doc/dev/logs/2012-10-25.version-split b/docs/dev/logs/2012-10-25.version-split similarity index 100% rename from doc/dev/logs/2012-10-25.version-split rename to docs/dev/logs/2012-10-25.version-split diff --git a/docs/dev/logs/2012-10-29.installed_paths b/docs/dev/logs/2012-10-29.installed_paths new file mode 100644 index 00000000..3587390e --- /dev/null +++ b/docs/dev/logs/2012-10-29.installed_paths @@ -0,0 +1,34 @@ + +Installed paths: (read first) + os.path.dirname(cdist.__file__) + + /conf/explorer + /conf/type + +User paths: (read after, overwrite)? + + $HOME/.cdist + + /explorer + /type + + /manifest + + /cache + +Additional paths: + + CDIST_EXPLORER_EXTRA_PATH=... + CDIST_TYPE_EXTRA_PATH=... + + or + + -c dir -c dir2 -c ... => + add types and explorer from those directories + last one wins? + because they can only be appended to existing "$PATH" + +Open questions: + + - How to tell types to use global explorer? + - How to tell types to find other types? diff --git a/docs/dev/logs/2012-10-30.path-for-types-and-global-explorer-implementation b/docs/dev/logs/2012-10-30.path-for-types-and-global-explorer-implementation new file mode 100644 index 00000000..8a683a40 --- /dev/null +++ b/docs/dev/logs/2012-10-30.path-for-types-and-global-explorer-implementation @@ -0,0 +1,8 @@ +- Allow list of base directories, which may contain explorer/ or type/ subdirectories + - can use the existing -c parameter, only allow it to be specified multiple times +- for each directory, link the given explorer and types to a temporary conf/ directory + similar to bin/ +- last one wins strategy + - what is expected by the user + + diff --git a/docs/dev/logs/2012-11-02.migration_to_2.1 b/docs/dev/logs/2012-11-02.migration_to_2.1 new file mode 100644 index 00000000..2ef8df22 --- /dev/null +++ b/docs/dev/logs/2012-11-02.migration_to_2.1 @@ -0,0 +1,40 @@ +create a new branch to ensure nothing breaks + + % git checkout -b 2.1_merge + +fetch latest upstream changes (change origin if you use another +remote name for upstream cdist) + + % git fetch -v origin + +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. + +As the types have a new location, **cdist/conf/** now, you have to move +your own types there as well: + + % git mv conf/type/* cdist/conf/ + +The manifest location also changed, so move this one as well: + + % git mv conf/manifest/* cdist/conf/manifest/ + +Use **git status** to review the changes and ensure they +are in the git database: + + % git commit -m "Move types and manifests for 2.1 migration" + +This should be everything necessary for a 2.1 migration. Test the result +by running cdist on one of your staging hosts: + + % ./bin/cdist config -v staging-host + + +You can now cleanup the empty conf/ directory: + + % rmdir conf/* && rmdir conf diff --git a/doc/dev/logs/README b/docs/dev/logs/README similarity index 100% rename from doc/dev/logs/README rename to docs/dev/logs/README diff --git a/doc/dev/logs/linklist b/docs/dev/logs/linklist similarity index 100% rename from doc/dev/logs/linklist rename to docs/dev/logs/linklist diff --git a/doc/dev/logs/times b/docs/dev/logs/times similarity index 100% rename from doc/dev/logs/times rename to docs/dev/logs/times diff --git a/doc/dev/show_all_exported_variables b/docs/dev/show_all_exported_variables similarity index 100% rename from doc/dev/show_all_exported_variables rename to docs/dev/show_all_exported_variables diff --git a/doc/dev/sync-to-testhost b/docs/dev/sync-to-testhost similarity index 100% rename from doc/dev/sync-to-testhost rename to docs/dev/sync-to-testhost diff --git a/doc/dev/todo/3.0 b/docs/dev/todo/3.0 similarity index 100% rename from doc/dev/todo/3.0 rename to docs/dev/todo/3.0 diff --git a/doc/dev/todo/TAKEME b/docs/dev/todo/TAKEME similarity index 100% rename from doc/dev/todo/TAKEME rename to docs/dev/todo/TAKEME diff --git a/doc/dev/todo/niconext b/docs/dev/todo/niconext similarity index 100% rename from doc/dev/todo/niconext rename to docs/dev/todo/niconext diff --git a/doc/dev/todo/performance-ideas b/docs/dev/todo/performance-ideas similarity index 100% rename from doc/dev/todo/performance-ideas rename to docs/dev/todo/performance-ideas diff --git a/doc/dev/todo/steven b/docs/dev/todo/steven similarity index 100% rename from doc/dev/todo/steven rename to docs/dev/todo/steven diff --git a/doc/dev/todo/tests b/docs/dev/todo/tests similarity index 100% rename from doc/dev/todo/tests rename to docs/dev/todo/tests diff --git a/doc/gfx/cdist-automated-inverted.png b/docs/gfx/cdist-automated-inverted.png similarity index 100% rename from doc/gfx/cdist-automated-inverted.png rename to docs/gfx/cdist-automated-inverted.png diff --git a/doc/gfx/cdist-automated.png b/docs/gfx/cdist-automated.png similarity index 100% rename from doc/gfx/cdist-automated.png rename to docs/gfx/cdist-automated.png diff --git a/doc/gfx/cdist-automated.text b/docs/gfx/cdist-automated.text similarity index 100% rename from doc/gfx/cdist-automated.text rename to docs/gfx/cdist-automated.text diff --git a/doc/gfx/cdist-logo-cm.png b/docs/gfx/cdist-logo-cm.png similarity index 100% rename from doc/gfx/cdist-logo-cm.png rename to docs/gfx/cdist-logo-cm.png diff --git a/doc/gfx/cdist-logo-inverted.png b/docs/gfx/cdist-logo-inverted.png similarity index 100% rename from doc/gfx/cdist-logo-inverted.png rename to docs/gfx/cdist-logo-inverted.png diff --git a/doc/gfx/cdist-logo.png b/docs/gfx/cdist-logo.png similarity index 100% rename from doc/gfx/cdist-logo.png rename to docs/gfx/cdist-logo.png diff --git a/doc/gfx/cdist-logo.text b/docs/gfx/cdist-logo.text similarity index 100% rename from doc/gfx/cdist-logo.text rename to docs/gfx/cdist-logo.text diff --git a/doc/gfx/font-used b/docs/gfx/font-used similarity index 100% rename from doc/gfx/font-used rename to docs/gfx/font-used diff --git a/doc/man/cdist-reference.text.sh b/docs/man/cdist-reference.text.sh similarity index 97% rename from doc/man/cdist-reference.text.sh rename to docs/man/cdist-reference.text.sh index 3f4f7c98..8e3f49a2 100755 --- a/doc/man/cdist-reference.text.sh +++ b/docs/man/cdist-reference.text.sh @@ -49,7 +49,7 @@ The following global explorers are available: eof ( - cd ../../conf/explorer + cd ../../cdist/conf/explorer for explorer in *; do echo "- $explorer" done @@ -184,9 +184,6 @@ __object_id:: the filesystem database and ensured by the core). Note: Double slashes ("//") will not be fixed and result in an error. -__self:: - DEPRECATED: Same as __object_name, do not use anymore, use __object_name instead. - Will be removed in cdist 2.1. __object_name:: The full qualified name of the current object. Available for: type manifest, type explorer, type gencode diff --git a/doc/man/man1/cdist.text b/docs/man/man1/cdist.text similarity index 100% rename from doc/man/man1/cdist.text rename to docs/man/man1/cdist.text diff --git a/doc/man/man7/cdist-best-practice.text b/docs/man/man7/cdist-best-practice.text similarity index 100% rename from doc/man/man7/cdist-best-practice.text rename to docs/man/man7/cdist-best-practice.text diff --git a/doc/man/man7/cdist-bootstrap.text b/docs/man/man7/cdist-bootstrap.text similarity index 100% rename from doc/man/man7/cdist-bootstrap.text rename to docs/man/man7/cdist-bootstrap.text diff --git a/doc/man/man7/cdist-explorer.text b/docs/man/man7/cdist-explorer.text similarity index 100% rename from doc/man/man7/cdist-explorer.text rename to docs/man/man7/cdist-explorer.text diff --git a/doc/man/man7/cdist-hacker.text b/docs/man/man7/cdist-hacker.text similarity index 100% rename from doc/man/man7/cdist-hacker.text rename to docs/man/man7/cdist-hacker.text diff --git a/doc/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text similarity index 100% rename from doc/man/man7/cdist-manifest.text rename to docs/man/man7/cdist-manifest.text diff --git a/doc/man/man7/cdist-quickstart.text b/docs/man/man7/cdist-quickstart.text similarity index 100% rename from doc/man/man7/cdist-quickstart.text rename to docs/man/man7/cdist-quickstart.text diff --git a/doc/man/man7/cdist-remote-exec-copy.text b/docs/man/man7/cdist-remote-exec-copy.text similarity index 98% rename from doc/man/man7/cdist-remote-exec-copy.text rename to docs/man/man7/cdist-remote-exec-copy.text index d789b12d..298891d6 100644 --- a/doc/man/man7/cdist-remote-exec-copy.text +++ b/docs/man/man7/cdist-remote-exec-copy.text @@ -31,7 +31,7 @@ remains as simple as possible. EXAMPLES --------------- +-------- See cdist/other/examples/remote/ for some example implementations. diff --git a/doc/man/man7/cdist-stages.text b/docs/man/man7/cdist-stages.text similarity index 100% rename from doc/man/man7/cdist-stages.text rename to docs/man/man7/cdist-stages.text diff --git a/doc/man/man7/cdist-tutorial.text b/docs/man/man7/cdist-tutorial.text similarity index 100% rename from doc/man/man7/cdist-tutorial.text rename to docs/man/man7/cdist-tutorial.text diff --git a/doc/man/man7/cdist-type.text b/docs/man/man7/cdist-type.text similarity index 100% rename from doc/man/man7/cdist-type.text rename to docs/man/man7/cdist-type.text diff --git a/doc/speeches/.gitignore b/docs/speeches/.gitignore similarity index 100% rename from doc/speeches/.gitignore rename to docs/speeches/.gitignore diff --git a/doc/speeches/2011-03-18_hacker_erwachen.tex b/docs/speeches/2011-03-18_hacker_erwachen.tex similarity index 100% rename from doc/speeches/2011-03-18_hacker_erwachen.tex rename to docs/speeches/2011-03-18_hacker_erwachen.tex diff --git a/doc/speeches/2011-04-27_sans.tex b/docs/speeches/2011-04-27_sans.tex similarity index 100% rename from doc/speeches/2011-04-27_sans.tex rename to docs/speeches/2011-04-27_sans.tex diff --git a/doc/speeches/2011-05-20_cosin.tex b/docs/speeches/2011-05-20_cosin.tex similarity index 100% rename from doc/speeches/2011-05-20_cosin.tex rename to docs/speeches/2011-05-20_cosin.tex diff --git a/doc/video/cdist-installation-in-less-than-60-seconds.mp4 b/docs/video/cdist-installation-in-less-than-60-seconds.mp4 similarity index 100% rename from doc/video/cdist-installation-in-less-than-60-seconds.mp4 rename to docs/video/cdist-installation-in-less-than-60-seconds.mp4 diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__file b/lib/cdist/test/emulator/fixtures/conf/type/__file deleted file mode 120000 index c57c4134..00000000 --- a/lib/cdist/test/emulator/fixtures/conf/type/__file +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../conf/type/__file \ No newline at end of file diff --git a/lib/cdist/version.py b/lib/cdist/version.py deleted file mode 120000 index 153cf043..00000000 --- a/lib/cdist/version.py +++ /dev/null @@ -1 +0,0 @@ -version_dynamic.py \ No newline at end of file diff --git a/other/examples/remote/local/README b/other/examples/remote/local/README new file mode 100644 index 00000000..cfd350f9 --- /dev/null +++ b/other/examples/remote/local/README @@ -0,0 +1,3 @@ +This effectively turns remote calling into local calling. + +Probably most useful for the unittesting. diff --git a/conf/type/__removeline/gencode-remote b/other/examples/remote/local/copy similarity index 71% rename from conf/type/__removeline/gencode-remote rename to other/examples/remote/local/copy index 3ec466b9..475155da 100755 --- a/conf/type/__removeline/gencode-remote +++ b/other/examples/remote/local/copy @@ -1,6 +1,6 @@ #!/bin/sh # -# 2010-2011 Daniel Roth (dani-cdist@d-roth.li) +# 2012 Nico Schottelius (nico-cdist schottelius.org) # # This file is part of cdist. # @@ -19,13 +19,10 @@ # # -if [ -f "$__object/parameter/file" ]; then - file=$(cat "$__object/parameter/file") -else - file="/$__object_id" -fi +recursive=$1; shift +src=$1; shift +dst=$1; shift -line=$(cat "$__object/parameter/line") -echo "ex -c \"/${line}/d|w|q\" \"${file}\" <. # # +# same as cdist default +# +# Usage: +# cdist config --remote-exec "/path/to/this/script" target_host +# -import os -import subprocess - -here = os.path.dirname(os.path.realpath(__file__)) -VERSION = subprocess.check_output('cd "%s" && git describe' % here, - shell=True).decode('utf-8') +target_host=$1; shift +# echo "Executing $@ (for $target_host)" +/bin/sh -c "$@" diff --git a/scripts/cdist b/scripts/cdist new file mode 100755 index 00000000..00ebbf18 --- /dev/null +++ b/scripts/cdist @@ -0,0 +1,241 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 2010-2012 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +def commandline(): + """Parse command line""" + import argparse + + import cdist.banner + import cdist.config + import cdist.install + + # 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) + + # 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") + + # Banner + parser['banner'] = parser['sub'].add_parser('banner', + parents=[parser['loglevel']]) + parser['banner'].set_defaults(func=cdist.banner.banner) + + # Config and install (common stuff) + parser['configinstall'] = argparse.ArgumentParser(add_help=False) + parser['configinstall'].add_argument('host', nargs='+', + help='one or more hosts to operate on') + parser['configinstall'].add_argument('-c', '--conf-dir', + help='Add configuration directory (can be repeated, last one wins)', + action='append') + parser['configinstall'].add_argument('-i', '--initial-manifest', + help='Path to a cdist manifest or \'-\' to read from stdin.', + dest='manifest', required=False) + parser['configinstall'].add_argument('-p', '--parallel', + help='Operate on multiple hosts in parallel', + action='store_true', dest='parallel') + parser['configinstall'].add_argument('-s', '--sequential', + help='Operate on multiple hosts sequentially (default)', + action='store_false', dest='parallel') + + parser['configinstall'].add_argument('--remote-copy', + help='Command to use for remote copy (should behave like scp)', + action='store', dest='remote_copy', + default="scp -o User=root -q") + parser['configinstall'].add_argument('--remote-exec', + help='Command to use for remote execution (should behave like ssh)', + action='store', dest='remote_exec', + default="ssh -o User=root -q") + + # Config + parser['config'] = parser['sub'].add_parser('config', + parents=[parser['loglevel'], parser['configinstall']]) + parser['config'].set_defaults(func=config) + + # Install + # 20120525/sar: commented until it actually does something + #parser['install'] = parser['sub'].add_parser('install', + # parents=[parser['loglevel'], parser['configinstall']]) + #parser['install'].set_defaults(func=install) + + for p in parser: + parser[p].epilog = "Get cdist at http://www.nico.schottelius.org/software/cdist/" + + args = parser['main'].parse_args(sys.argv[1:]) + + # Loglevels are handled globally in here and debug wins over verbose + if args.verbose: + logging.root.setLevel(logging.INFO) + if args.debug: + logging.root.setLevel(logging.DEBUG) + + log.debug(args) + args.func(args) + +def config(args): + configinstall(args, mode=cdist.config.Config) + +def install(args): + configinstall(args, mode=cdist.install.Install) + +def configinstall(args, mode): + """Configure or install remote system""" + import multiprocessing + import time + + 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.') + 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) + + args.manifest = initial_manifest_temp_path + import atexit + atexit.register(lambda: os.remove(initial_manifest_temp_path)) + + process = {} + failed_hosts = [] + time_start = time.time() + + for host in args.host: + if args.parallel: + log.debug("Creating child process for %s", host) + process[host] = multiprocessing.Process(target=configinstall_onehost, args=(host, args, mode, True)) + process[host].start() + else: + try: + configinstall_onehost(host, args, mode, 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", len(args.host), + (time_end - time_start)) + + if len(failed_hosts) > 0: + raise cdist.Error("Failed to deploy to the following hosts: " + + " ".join(failed_hosts)) + +def configinstall_onehost(host, args, mode, parallel): + """Configure or install ONE remote system""" + + try: + import cdist.context + + context = cdist.context.Context( + target_host=host, + remote_copy=args.remote_copy, + remote_exec=args.remote_exec, + initial_manifest=args.manifest, + add_conf_dirs=args.conf_dir, + exec_path=sys.argv[0], + debug=args.debug) + + c = mode(context) + c.deploy_and_cleanup() + context.cleanup() + + except cdist.Error as e: + # We are running in our own process here, need to sys.exit! + if parallel: + log.error(e) + sys.exit(1) + else: + raise + + except KeyboardInterrupt: + # Ignore in parallel mode, we are existing anyway + if parallel: + sys.exit(0) + # Pass back to controlling code in sequential mode + else: + raise + +def emulator(): + """Prepare and run emulator""" + import cdist.emulator + emulator = cdist.emulator.Emulator(sys.argv) + return emulator.run() + +if __name__ == "__main__": + # Sys is needed for sys.exit() + import sys + + cdistpythonversion = '3.2' + if sys.version < cdistpythonversion: + print('Cdist requires Python >= ' + cdistpythonversion + + ' on the source host.', file=sys.stderr) + sys.exit(1) + + + exit_code = 0 + + try: + import logging + import os + import re + import cdist + + log = logging.getLogger("cdist") + logging.basicConfig(format='%(levelname)s: %(message)s') + + if re.match("__", os.path.basename(sys.argv[0])): + emulator() + else: + commandline() + + except KeyboardInterrupt: + pass + + except cdist.Error as e: + log.error(e) + exit_code = 1 + + # Determine exit code by return value of function + + sys.exit(exit_code) diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..25fc4820 --- /dev/null +++ b/setup.py @@ -0,0 +1,55 @@ +from distutils.core import setup +import cdist +import os + +def data_finder(data_dir): + entries = [] + for name in os.listdir(data_dir): + entry = os.path.join(data_dir, name) + if os.path.isdir(entry): + entries.extend(data_finder(entry)) + else: + entries.append(entry) + + return entries + +cur = os.getcwd() +os.chdir("cdist") +package_data = data_finder("conf") +os.chdir(cur) + +setup( + 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 = [ + "Development Status :: 6 - Mature", + "Environment :: Console", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX", + "Operating System :: POSIX :: BSD", + "Operating System :: POSIX :: Linux", + "Operating System :: Unix", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Topic :: System :: Boot", + "Topic :: System :: Installation/Setup", + "Topic :: System :: Operating System", + "Topic :: System :: Software Distribution", + "Topic :: Utilities" + ], + 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 + cfengine, bcfg2, chef and puppet. + ''' +)