From 4a9456787cec785dfb5e728e8f1251f4490cb5c0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 24 Jun 2011 15:02:20 +0200 Subject: [PATCH 0001/1024] +log cinst preos Signed-off-by: Steven Armstrong --- doc/dev/logs/2011-06-24.cinst_preos | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 doc/dev/logs/2011-06-24.cinst_preos diff --git a/doc/dev/logs/2011-06-24.cinst_preos b/doc/dev/logs/2011-06-24.cinst_preos new file mode 100644 index 00000000..c366c963 --- /dev/null +++ b/doc/dev/logs/2011-06-24.cinst_preos @@ -0,0 +1,10 @@ +- new executable cinst-deploy-to +- types used by cinst are marked as such ('cinst-only') +- cdist-deploy-to and cinst-deploy-to read the same manifest +- cdist ignores types marked as 'cinst-only' +- cinst ignores types not marked as 'cinst-only' + +- update $__explorer/os to recognize preos + +- cinst types only do something if $__explorer/os == 'preos' + From bf0acc2e3128f6236816c9966ab0ccb145a70963 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 24 Jun 2011 15:07:29 +0200 Subject: [PATCH 0002/1024] +correction Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-06-24.cinst_preos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/dev/logs/2011-06-24.cinst_preos b/doc/dev/logs/2011-06-24.cinst_preos index c366c963..309c3778 100644 --- a/doc/dev/logs/2011-06-24.cinst_preos +++ b/doc/dev/logs/2011-06-24.cinst_preos @@ -6,5 +6,5 @@ - update $__explorer/os to recognize preos -- cinst types only do something if $__explorer/os == 'preos' +- cinst types will ONLY BE CALLED if $__explorer/os == 'preos' From 51da953e4903ea9b870bd6e9e99367b061d2b1fa Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 24 Jun 2011 15:25:11 +0200 Subject: [PATCH 0003/1024] detect pre-os in explorer Signed-off-by: Nico Schottelius --- conf/explorer/os | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/conf/explorer/os b/conf/explorer/os index 6684ff78..e922c067 100755 --- a/conf/explorer/os +++ b/conf/explorer/os @@ -65,6 +65,11 @@ if [ -f /etc/SuSE-release ]; then exit 0 fi +if [ -f /etc/cdist-preos ]; then + echo preos + exit 0 +fi + uname_s="$(uname -s)" # Assume there is no tr on the client -> do lower case ourselves From 27966c058bb5e07ce96787916c09724bfdfed3b2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 24 Jun 2011 15:38:34 +0200 Subject: [PATCH 0004/1024] +ideas for types Signed-off-by: Steven Armstrong --- doc/dev/logs/2011-06-24.cinst_preos | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/dev/logs/2011-06-24.cinst_preos b/doc/dev/logs/2011-06-24.cinst_preos index 309c3778..892ee5f7 100644 --- a/doc/dev/logs/2011-06-24.cinst_preos +++ b/doc/dev/logs/2011-06-24.cinst_preos @@ -8,3 +8,13 @@ - cinst types will ONLY BE CALLED if $__explorer/os == 'preos' +-------------------------------------------------------------------------------- +cinst types: +__partition_msdos /dev/sda1 --type 83 --size 100M --bootable +__partition_msdos /dev/sda2 --type 82 --size 512M +__fs_jfs /dev/sda1 --args "-c -q" +__fstab_entry /dev/sda1 --type jfs --mountpoint / --options noatime --freq 0 --passno 0 +__fstab_entry /dev/sda2 --type swap + + + From 0d6171c69bbfd6af35fdc3c2affb1a721f54e2f6 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 12 Jul 2011 14:15:39 +0200 Subject: [PATCH 0005/1024] start work on cinst partitioning Signed-off-by: Steven Armstrong --- .../__cinst_partition_msdos/gencode-remote | 20 ++++++ conf/type/__cinst_partition_msdos/man.text | 63 +++++++++++++++++++ conf/type/__cinst_partition_msdos/manifest | 25 ++++++++ .../parameter/optional | 3 + .../parameter/required | 1 + 5 files changed, 112 insertions(+) create mode 100755 conf/type/__cinst_partition_msdos/gencode-remote create mode 100644 conf/type/__cinst_partition_msdos/man.text create mode 100755 conf/type/__cinst_partition_msdos/manifest create mode 100644 conf/type/__cinst_partition_msdos/parameter/optional create mode 100644 conf/type/__cinst_partition_msdos/parameter/required diff --git a/conf/type/__cinst_partition_msdos/gencode-remote b/conf/type/__cinst_partition_msdos/gencode-remote new file mode 100755 index 00000000..211bc1db --- /dev/null +++ b/conf/type/__cinst_partition_msdos/gencode-remote @@ -0,0 +1,20 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + diff --git a/conf/type/__cinst_partition_msdos/man.text b/conf/type/__cinst_partition_msdos/man.text new file mode 100644 index 00000000..2203c2d3 --- /dev/null +++ b/conf/type/__cinst_partition_msdos/man.text @@ -0,0 +1,63 @@ +cdist-type__cinst_partition_msdos(7) +==================================== +Steven Armstrong + + +NAME +---- +cdist-type__cinst_partition_msdos - creates msdos partitions + + +DESCRIPTION +----------- +This cdist type allows you to create msdos paritions. + + +REQUIRED PARAMETERS +------------------- +type:: + the partition type used in fdisk (such as 82 or 83) or "extended" + + +OPTIONAL PARAMETERS +------------------- +device:: + defaults to object_id +bootable:: + mark partition as bootable, true or false +size:: + the size of the partition (such as 32MB or 15GB, whole numbers + only), '+' for remaining space, or 'n%' for percentage of remaining + (these should only be used after all specific partition sizes are + specified), leave blank if type is "extended". + Defaults to +. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# 128MB linux, bootable +__cinst_partition_msdos /dev/sda1 --type 83 --size 128M --bootable true +# 512MB swap +__cinst_partition_msdos /dev/sda2 --type 82 --size 512M +# extended +__cinst_partition_msdos /dev/sda3 --type extended +# 10GB, linux +__cinst_partition_msdos /dev/sda5 --type 82 --size 10G +# rest of disk, linux +__cinst_partition_msdos /dev/sda6 --type 82 --size + +# same thing as +__cinst_partition_msdos /dev/sda6 --type 82 +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2011 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__cinst_partition_msdos/manifest b/conf/type/__cinst_partition_msdos/manifest new file mode 100755 index 00000000..e5b04c02 --- /dev/null +++ b/conf/type/__cinst_partition_msdos/manifest @@ -0,0 +1,25 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +type + +device +bootable +size diff --git a/conf/type/__cinst_partition_msdos/parameter/optional b/conf/type/__cinst_partition_msdos/parameter/optional new file mode 100644 index 00000000..612fe769 --- /dev/null +++ b/conf/type/__cinst_partition_msdos/parameter/optional @@ -0,0 +1,3 @@ +device +bootable +size diff --git a/conf/type/__cinst_partition_msdos/parameter/required b/conf/type/__cinst_partition_msdos/parameter/required new file mode 100644 index 00000000..aa80e646 --- /dev/null +++ b/conf/type/__cinst_partition_msdos/parameter/required @@ -0,0 +1 @@ +type From c85aec7b1355857b30752c7b7a86332daf5de299 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 26 Jul 2011 17:22:59 +0200 Subject: [PATCH 0006/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index a3d74661..abe98cb4 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -48,6 +48,7 @@ CORE pink # empty file wood # empty file +- allow cdist to run without $PATH setup: ./bin/cdist-deploy-to TYPES ------ From 8da1c44081eacde29463709653a3d09e7d61a0a0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 26 Jul 2011 17:28:47 +0200 Subject: [PATCH 0007/1024] import speech from cosin Signed-off-by: Nico Schottelius --- doc/speeches/2011-05-20_cosin.tex | 242 ++++++++++++++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 doc/speeches/2011-05-20_cosin.tex diff --git a/doc/speeches/2011-05-20_cosin.tex b/doc/speeches/2011-05-20_cosin.tex new file mode 100644 index 00000000..f60a660a --- /dev/null +++ b/doc/speeches/2011-05-20_cosin.tex @@ -0,0 +1,242 @@ +% first presentation about cmtp +\pdfminorversion=4 +%\documentclass[ucs]{beamer} +\documentclass{beamer} +%\documentclass[utf8]{beamer} +\usepackage[utf8]{inputenc} +\usepackage{german} +\usepackage{graphicx} +\usepackage{beamerthemesplit} +\setbeamercovered{dynamic} +\usetheme{Malmoe} +\usecolortheme{crane} + +\title{cdist - nutzbare Konfigurationsverwaltung} +\subtitle{Cosin 2011} + +\author{Nico -telmich- Schottelius} + +\date{25. Juni 2011} + +\begin{document} +\frame{\titlepage} + +%\section[Outline]{} +\frame{\tableofcontents} + +\section{Einleitung} +\frame +{ + \frametitle{Was ist das Problem?} + \begin{itemize} + \item Einmal konfigurieren = toll + \item Zweimal konfigurieren = naja, ... + \item Neue Sachen machen mehr Spass als alte wiederholen + \item Viele Rechner = viel Mühe? + \end{itemize} +} + +\frame +{ + \frametitle{Das ist nicht neu...} + \begin{itemize} + \item cfengine + \item Puppet + \item bcfg2 + \item chef + \item ... + \end{itemize} +} + +\frame +{ + \frametitle{Warum cdist?} + \begin{itemize} + \item Klein + \item Unix + \item Leicht zu bedienen + \item ... zu erweitern + \item Shell + \item Weil es Spaß macht! + \end{itemize} +} + +\section{Installieren} +\frame +{ + \frametitle{Vorraussetzungen} + \begin{itemize} + \item sshd + \item root login via sshd + \item Besser: ssh-pubkey konfiguriert (PermitRootLogin without-password) + \item git + \item Asciidoc für dia manpages + \end{itemize} +} + +\frame +{ + \frametitle{Installation} + \begin{center} + git clone git://git.schottelius.org/cdist + \end{center} +} + +\begin{frame}[fragile] + \frametitle{Erstellen der Manpages} + + \begin{verbatim} + # Braucht asciidoc / a2x + ./build.sh man + \end{verbatim} +\end{frame} + +\section{Nutzen} +\begin{frame}[fragile] + \frametitle{Vorbereitung PATH und MANPATH} + + \begin{verbatim} + cd cdist + eval `./bin/cdist-env` + echo $PATH + echo $MANPATH + \end{verbatim} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Nun los} + \begin{verbatim} + # Fangen wir bei uns an + cdist-deploy-to localhost + \end{verbatim} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Der Einstiegspunkt} + \begin{small} + \begin{verbatim} + cat << eof > conf/manifest/init + __file /etc/cdist-configured + + case "$__target_host" in + localhost) + __link /tmp/cdist-testfile \ + --source /etc/cdist-configured \ + --type symbolic + __addifnosuchline /tmp/cdist-welcome \ + --line "Welcome to cdist" + ;; + esac + eof + # Muss ausführbar sein + chmod u+x conf/manifest/init + + \end{verbatim} + \end{small} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Nun los} + \begin{verbatim} + # Nun läuft es! + cdist-deploy-to localhost + \end{verbatim} +\end{frame} + +\frame +{ + \frametitle{Funktionalität zusammenfassen} + \begin{itemize}[<+->] + \item "`Typen"' (types) + \item conf/type/* + \item \_\_ vor jedem Namen (Shell-Umgebung) + \item z.B. Netzseite, Mailserver, Wiki, ... + \end{itemize} +} + +\begin{frame}[fragile] + \frametitle{Ein neuer Typ} + \begin{small} + \begin{verbatim} + % mkdir conf/type/__my_mailserver + % cat << eof > conf/type/__my_mailserver/manifest + # Dieser Typ konfiguriert meinen Mailserver + require="__package/nullmailer" \ + __file /etc/nullmailer/remotes \ + --source "$__type/files/remotes" + + # Reihenfolge spielt keine Rolle + __package nullmailer --state installed + eof + \end{verbatim} + \end{small} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Ein neuer Typ (2)} + \begin{small} + \begin{verbatim} + # Wichtig: Wird ausgeführt + % chmod u+x conf/type/__my_mailserver/manifest + + # Darf nur einmal verwendet werden pro Rechner + % touch conf/type/__my_mailserver/singleton + + # Nullmailer Konfiguration + % mkdir conf/type/__my_mailserver/files + % echo my.fancy.smart.host > \ + conf/type/__my_mailserver/files/remotes + \end{verbatim} + \end{small} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Neuen Typ nutzen} + \begin{small} + \begin{verbatim} + % $EDITOR conf/manifest/init + + case "$__target_host" in + localhost) + ... + __my_mailserver + ... + ;; + \end{verbatim} + \end{small} +\end{frame} + +\section{Aktualisieren} +\begin{frame}[fragile] + \frametitle{Versionen} + \begin{itemize}[<+->] + \item x.y: Stabile Version + \item master: Entwicklung + \end{itemize} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Stabile Version auswählen} + \begin{center} + git checkout -b 1.7 origin/1.7 + \end{center} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Aktualisieren} + \begin{center} + git pull + \end{center} +\end{frame} + +\frame +{ + \frametitle{Ende} + \begin{block}{Das war's} + Viel Spaß - Mehr Infos gibt's auf http://www.nico.schottelius.org/software/cdist/\\ + und http://l.schottelius.org/pipermail/cdist + \end{block} +} + + +\end{document} From 4d48da8e96d115a27618f65f0484beeb755d7110 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 26 Jul 2011 19:26:44 +0200 Subject: [PATCH 0008/1024] import __package_zypper into contrib Signed-off-by: Nico Schottelius --- contrib/__package_zypper/README | 5 ++ contrib/__package_zypper/explorer/pkg_version | 30 +++++++++++ contrib/__package_zypper/gencode-remote | 51 ++++++++++++++++++ contrib/__package_zypper/man.text | 52 +++++++++++++++++++ contrib/__package_zypper/parameter/optional | 1 + contrib/__package_zypper/parameter/required | 1 + 6 files changed, 140 insertions(+) create mode 100644 contrib/__package_zypper/README create mode 100755 contrib/__package_zypper/explorer/pkg_version create mode 100755 contrib/__package_zypper/gencode-remote create mode 100644 contrib/__package_zypper/man.text create mode 100644 contrib/__package_zypper/parameter/optional create mode 100644 contrib/__package_zypper/parameter/required diff --git a/contrib/__package_zypper/README b/contrib/__package_zypper/README new file mode 100644 index 00000000..1e073e3f --- /dev/null +++ b/contrib/__package_zypper/README @@ -0,0 +1,5 @@ +This type was not accepted, because cleanups are needed and the +manpage does not build. + +If you read this and want this code available in the cdist core, +just fix it and submit a git url :-) diff --git a/contrib/__package_zypper/explorer/pkg_version b/contrib/__package_zypper/explorer/pkg_version new file mode 100755 index 00000000..0e078f68 --- /dev/null +++ b/contrib/__package_zypper/explorer/pkg_version @@ -0,0 +1,30 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Retrieve the status of a package - parsed dpkg output +# + +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name="$__object_id" +fi + +rpm -q --whatprovides "$name" 2>/dev/null || true diff --git a/contrib/__package_zypper/gencode-remote b/contrib/__package_zypper/gencode-remote new file mode 100755 index 00000000..2d1112d3 --- /dev/null +++ b/contrib/__package_zypper/gencode-remote @@ -0,0 +1,51 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Manage packages with yum (mostly Fedora) +# + +if [ -f "$__object/parameter/name" ]; then + name="$__object/parameter/name" +else + name="$__object_id" +fi + +state="$(cat "$__object/parameter/state")" + +opts="-n -q" + +not_installed="^no package provides" + +case "$state" in + installed) + if grep -q "$not_installed" "$__object/explorer/pkg_version"; then + echo zypper $opts install \"$name\" + fi + ;; + removed) + if ! grep -q "$not_installed" "$__object/explorer/pkg_version"; then + echo zypper $opts remove \"$name\" + fi + ;; + *) + echo "Unknown state: $state" >&2 + exit 1 + ;; +esac diff --git a/contrib/__package_zypper/man.text b/contrib/__package_zypper/man.text new file mode 100644 index 00000000..3a4f1026 --- /dev/null +++ b/contrib/__package_zypper/man.text @@ -0,0 +1,52 @@ +cdist-type__package_zypper(7) +========================== +Franky Van Liedekerke + + +NAME +---- +cdist-type__package_zypper - Manage packages with zypper + + +DESCRIPTION +----------- +zypper is usually used on the Suse distribution to manage packages. + + +REQUIRED PARAMETERS +------------------- +state:: + Either "installed" or "removed". + + +OPTIONAL PARAMETERS +------------------- +name:: + If supplied, use the name and not the object id as the package name. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Ensure zsh in installed +__package_zypper zsh --state installed + +# If you don't want to follow pythonX packages, but always use python +__package_zypper python --state installed --name python2 + +# Remove obsolete package +__package_zypper puppet --state removed +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- cdist-type__package(7) + + +COPYING +------- +Copyright \(C) 2011 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/contrib/__package_zypper/parameter/optional b/contrib/__package_zypper/parameter/optional new file mode 100644 index 00000000..f121bdbf --- /dev/null +++ b/contrib/__package_zypper/parameter/optional @@ -0,0 +1 @@ +name diff --git a/contrib/__package_zypper/parameter/required b/contrib/__package_zypper/parameter/required new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/contrib/__package_zypper/parameter/required @@ -0,0 +1 @@ +state From 4b288f754cdb7f9da28127dc68169f42ecc4e6fb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 26 Jul 2011 20:01:42 +0200 Subject: [PATCH 0009/1024] ++quotes Signed-off-by: Nico Schottelius --- build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index b1d27817..eded032e 100755 --- a/build.sh +++ b/build.sh @@ -88,9 +88,9 @@ case "$1" in speeches) cd "$SPEECHESDIR" for speech in *tex; do - pdflatex $speech - pdflatex $speech - pdflatex $speech + pdflatex "$speech" + pdflatex "$speech" + pdflatex "$speech" done ;; From b264e4a4d3c1638bb4c32a809ecadf40552f7920 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 26 Jul 2011 20:26:13 +0200 Subject: [PATCH 0010/1024] prepare 1.7.1 release Signed-off-by: Nico Schottelius --- README | 4 ++-- doc/changelog | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index 635d381d..295b9152 100644 --- a/README +++ b/README @@ -109,8 +109,8 @@ how to use cdist. There are at least the following branches available: - * master: the development branch - * 1.7: Bugfixes, cleanups, new type and explorer rename + * Development: master + * Current Stable: 1.7 (Bugfixes, cleanups, new type and explorer rename) Old versions: diff --git a/doc/changelog b/doc/changelog index a603573b..82ae4b95 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,4 +1,4 @@ -1.7.1: +1.7.1: 2011-07-26 * Documentation: Add explorers to reference * Documentation: Typo cleanup (Derek Brost) * Type __key_value: Bugfix (Steven Armstrong) From 84b8c7cdb0f32a14d3b204507da594cb0add7d8b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 26 Jul 2011 21:25:12 +0200 Subject: [PATCH 0011/1024] add new cool fancy awk script to display contents of last release (awk is cool) Signed-off-by: Nico Schottelius --- doc/dev/lastchanges | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 doc/dev/lastchanges diff --git a/doc/dev/lastchanges b/doc/dev/lastchanges new file mode 100755 index 00000000..8679372a --- /dev/null +++ b/doc/dev/lastchanges @@ -0,0 +1,24 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Show the lastest changes from this (upcoming) release +# + +awk '/^$/ { exit } { print $0 } END { print "-----" }' < "${0%/*}/../changelog" From f44bc29789709b4d019d98c04136a5324cb2f8d0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 26 Jul 2011 21:55:14 +0200 Subject: [PATCH 0012/1024] import example configuration from nicos private config Signed-off-by: Nico Schottelius --- .../conf/type/__nico_afs/files/afs/CellServDB | 2 + .../conf/type/__nico_afs/files/afs/ThisCell | 1 + .../conf/type/__nico_afs/files/krb5/krb5.conf | 28 +++++++++++ .../conf/type/__nico_afs/files/ssh/JAS.pub | 1 + .../type/__nico_afs/files/ssh/bugblue.pub | 1 + .../type/__nico_afs/files/ssh/docsteel.pub | 1 + .../type/__nico_afs/files/ssh/downhill.pub | 1 + .../type/__nico_afs/files/ssh/sur5r@samsa.pub | 1 + .../nico/conf/type/__nico_afs/manifest | 45 ++++++++++++++++++ .../nico/conf/type/__nico_afs/singleton | 0 .../conf/type/__nico_desktop/files/hostname | 1 + .../type/__nico_desktop/files/slim-preseed | 4 ++ .../nico/conf/type/__nico_desktop/manifest | 47 +++++++++++++++++++ .../type/__nico_desktop/parameter/required | 1 + .../nico/conf/type/__nico_desktop/singleton | 0 .../conf/type/__nico_mpd/files/slim-preseed | 4 ++ .../nico/conf/type/__nico_mpd/manifest | 24 ++++++++++ .../conf/type/__nico_mpd/parameter/required | 1 + .../nico/conf/type/__nico_mpd/singleton | 0 .../type/__nico_network/files/interfaces-eth0 | 6 +++ .../__nico_network/files/interfaces-wlan0 | 11 +++++ .../nico/conf/type/__nico_network/manifest | 43 +++++++++++++++++ .../type/__nico_network/parameter/required | 1 + .../nico/conf/type/__nico_network/singleton | 0 .../type/__nico_nfs_client/files/slim-preseed | 4 ++ .../nico/conf/type/__nico_nfs_client/manifest | 47 +++++++++++++++++++ .../conf/type/__nico_nfs_client/singleton | 0 .../nico/conf/type/__nico_notebook/manifest | 38 +++++++++++++++ .../nico/conf/type/__nico_notebook/singleton | 0 .../nico/conf/type/__nico_packages/manifest | 33 +++++++++++++ .../nico/conf/type/__nico_packages/singleton | 0 .../conf/type/__nico_sudo/files/sudo-nico | 13 +++++ .../nico/conf/type/__nico_sudo/manifest | 27 +++++++++++ .../conf/type/__nico_sudo/parameter/gencode | 31 ++++++++++++ .../conf/type/__nico_sudo/parameter/manifest | 31 ++++++++++++ .../conf/type/__nico_sudo/parameter/optional | 0 .../conf/type/__nico_sudo/parameter/required | 0 .../nico/conf/type/__nico_sudo/singleton | 0 .../conf/type/__nico_tee/files/99-apt-nico | 2 + .../nico/conf/type/__nico_tee/files/hostname | 1 + .../nico/conf/type/__nico_tee/manifest | 28 +++++++++++ .../nico/conf/type/__nico_tee/singleton | 0 .../__package_zypper/README | 0 .../__package_zypper/explorer/pkg_version | 0 .../__package_zypper/gencode-remote | 0 .../__package_zypper/man.text | 0 .../__package_zypper/parameter/optional | 0 .../__package_zypper/parameter/required | 0 48 files changed, 479 insertions(+) create mode 100644 contrib/examples/nico/conf/type/__nico_afs/files/afs/CellServDB create mode 100644 contrib/examples/nico/conf/type/__nico_afs/files/afs/ThisCell create mode 100644 contrib/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf create mode 100644 contrib/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub create mode 100644 contrib/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub create mode 100644 contrib/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub create mode 100644 contrib/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub create mode 100644 contrib/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub create mode 100755 contrib/examples/nico/conf/type/__nico_afs/manifest create mode 100644 contrib/examples/nico/conf/type/__nico_afs/singleton create mode 100644 contrib/examples/nico/conf/type/__nico_desktop/files/hostname create mode 100644 contrib/examples/nico/conf/type/__nico_desktop/files/slim-preseed create mode 100755 contrib/examples/nico/conf/type/__nico_desktop/manifest create mode 100644 contrib/examples/nico/conf/type/__nico_desktop/parameter/required create mode 100644 contrib/examples/nico/conf/type/__nico_desktop/singleton create mode 100644 contrib/examples/nico/conf/type/__nico_mpd/files/slim-preseed create mode 100644 contrib/examples/nico/conf/type/__nico_mpd/manifest create mode 100644 contrib/examples/nico/conf/type/__nico_mpd/parameter/required create mode 100644 contrib/examples/nico/conf/type/__nico_mpd/singleton create mode 100644 contrib/examples/nico/conf/type/__nico_network/files/interfaces-eth0 create mode 100644 contrib/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 create mode 100755 contrib/examples/nico/conf/type/__nico_network/manifest create mode 100644 contrib/examples/nico/conf/type/__nico_network/parameter/required create mode 100644 contrib/examples/nico/conf/type/__nico_network/singleton create mode 100644 contrib/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed create mode 100755 contrib/examples/nico/conf/type/__nico_nfs_client/manifest create mode 100644 contrib/examples/nico/conf/type/__nico_nfs_client/singleton create mode 100755 contrib/examples/nico/conf/type/__nico_notebook/manifest create mode 100644 contrib/examples/nico/conf/type/__nico_notebook/singleton create mode 100755 contrib/examples/nico/conf/type/__nico_packages/manifest create mode 100644 contrib/examples/nico/conf/type/__nico_packages/singleton create mode 100644 contrib/examples/nico/conf/type/__nico_sudo/files/sudo-nico create mode 100755 contrib/examples/nico/conf/type/__nico_sudo/manifest create mode 100644 contrib/examples/nico/conf/type/__nico_sudo/parameter/gencode create mode 100644 contrib/examples/nico/conf/type/__nico_sudo/parameter/manifest create mode 100644 contrib/examples/nico/conf/type/__nico_sudo/parameter/optional create mode 100644 contrib/examples/nico/conf/type/__nico_sudo/parameter/required create mode 100644 contrib/examples/nico/conf/type/__nico_sudo/singleton create mode 100644 contrib/examples/nico/conf/type/__nico_tee/files/99-apt-nico create mode 100644 contrib/examples/nico/conf/type/__nico_tee/files/hostname create mode 100755 contrib/examples/nico/conf/type/__nico_tee/manifest create mode 100644 contrib/examples/nico/conf/type/__nico_tee/singleton rename contrib/{ => types_pending_inclusion}/__package_zypper/README (100%) rename contrib/{ => types_pending_inclusion}/__package_zypper/explorer/pkg_version (100%) rename contrib/{ => types_pending_inclusion}/__package_zypper/gencode-remote (100%) rename contrib/{ => types_pending_inclusion}/__package_zypper/man.text (100%) rename contrib/{ => types_pending_inclusion}/__package_zypper/parameter/optional (100%) rename contrib/{ => types_pending_inclusion}/__package_zypper/parameter/required (100%) diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/afs/CellServDB b/contrib/examples/nico/conf/type/__nico_afs/files/afs/CellServDB new file mode 100644 index 00000000..dbd238d7 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/afs/CellServDB @@ -0,0 +1,2 @@ +>eof +129.132.186.89 # sgv-afs-sur5r diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/afs/ThisCell b/contrib/examples/nico/conf/type/__nico_afs/files/afs/ThisCell new file mode 100644 index 00000000..37fb719b --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/afs/ThisCell @@ -0,0 +1 @@ +eof diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf b/contrib/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf new file mode 100644 index 00000000..3b8259cb --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf @@ -0,0 +1,28 @@ +[libdefaults] + default_realm = EOF + +# The following krb5.conf variables are only for MIT Kerberos. + krb4_config = /etc/krb.conf + krb4_realms = /etc/krb.realms + kdc_timesync = 1 + ccache_type = 4 + forwardable = true + proxiable = true + allow_weak_crypto = true + +[realms] + EOF = { + kdc = sgv-afs-sur5r.ethz.ch + admin_server = sgv-afs-sur5r.ethz.ch + } + + +[login] + krb4_convert = true + krb4_get_tickets = false + +[logging] + default = FILE:/var/log/krb5.log + kdc = FILE:/var/log/krb5kdc/kdc.log + admin_server = FILE:/var/log/krb5kdc/kadmin.log + diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub new file mode 100644 index 00000000..222410d5 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/Gbl64LT3VD5hsVtk1w670S2gue1OaW9XLg/Vk/iBqsYYrLGZh+TXJsAsXOSF1sZH6QSdNlpzTPsno9KFCTQTNlYe0IrWPGRrFGw1or3M6OugJrMeSiMYQ5nhH6HMjhzCFHH8Xh4Yku8fgi3ejPpySW8umx7nBL7ndiEJ9Y+lixNWMirEPLpz9YufFm9u8GX6bPrmjIBz6EhfxaqJ2N/N6gQB+4PmNopzqWHm+n4LToA9N8qwetSfhgEg7DVaD9SrJNjNTGSgii6CritT9sF8ZBq5CZG58DTyrxCndhhHte5OCGMb5ENgO4OBHA0MrD56unHrdAZCCosa9rI+pIll abr@cltHome03 diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub new file mode 100644 index 00000000..cccbe02f --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA17fnWJMTAuIvWcdnsasdfEkBabeXEhYaR03Qc/KBpS+iToSeUzlc5SeXoAczqSMsC0uYpDnhll9q3aAN82Xo06RI2ytd7TeXvFcVwzvXB+sNUsvtyPZ5Uyx7d2WTI87bm169KhGTJCaww8p+qa2UhkjOOaXZwMGjkHlvZ3WSZr5mLar9O3r4PG8SIqoFF0m+tcc2fcWIK3df3jWIk8g6j/jTaoIa18qsK/rtO90Ql20FMQJOZTKGKjHIOx2FLnXY5WKrXmXyyffgFpqi1rUAkCkjCKnm65fDjecn6FplzSUuZo/IB2GnHGNQVnNkU/18/G8KQKu9clkMxuUl8DYJBQ== bugblue@jabber.eof.name diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub new file mode 100644 index 00000000..4b40d089 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1xfKoN8D3I0uGvc66E2cpnutdgALbSVIIWy0SBGV1ZLA4CehAL5BpMO0EI1TfH4LGgpjg+CnLXOSMd+bnvWjPTxGUbGcmK45UYCyn1LzSAfVKi9Mr06wbvQj0h5w1zEAwDqt63SHGjGOHO4TeCSrPxEROPMbZ1mP1ECsb4f+3WLWE5icbzOb/QMx2zNDd29rVvFJiJMOg4AiIs7pl/T7Qxg2yN6YlDIXSXLiE2i98O26kBNWRgAFcTNBqoUs5AkZ2F4LPUGbyuLpV+wtlpYcQXOUTLoRlKw+ovBQH3L6ae9n6+rFTIEEAS08C0MOzQPC3QjmfRMC8mxVkn22XnpHbQ== default diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub new file mode 100644 index 00000000..bde07c29 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub @@ -0,0 +1 @@ +ssh-dss AAAAB3NzaC1kc3MAAAIBAMiYvUWD0Yq3vm2Dp6xJCGvRGcGIyiT8+07FQJvAWUAzudyhA9r+h58gm4uCUJTV5W33Npf70Id5LSxyZJA7LcdTXTuMxhVfERURcT/GgtxCrs+aMguitNvf7QVuiKBrvuBmBPMV/6k8UEwf/7eCQRjoXE4jxEYKUT9SW8X94wuH0HUqOqBRD2F21uMrmLgDkb12RK/9yFRV3c7waOSQU/QtO+VFwPvBNDqUTqBL0LOJJif449vMxboOZ1noS94K0Lyfz9yOGEwBYck11c2UzH4KXbv8qNpYgtuCmDjZFM2J8dnhWJgkmThZtmyfnNFbHlW0HZItVvkqLZMPDlCIqR77J9OC4lawjrX2FFKhAzcrJuw7WXr2PcFKQUh/TiypcM5f6zuU3fs2+8ZYQdwvU6j/QNW4A/zqud7v/hjAMYCVe0EIWf2Qt0SS/nFLh7dZRGV21nK9Vq0zDncVPTgDl7/L62TYieO/j/1X3HjEp2JbR+mjBWsfKM7WYZDP16xiQzBuhr0vItnKMyN9V4AbDthjqesezKuXIhv0jP1z40MppM9mr40FJpgRSY3hyt3cZQKoO2vVJevnJMuufLheocAxo037f2PUpmSiJDOF1dLywmS2Gqk4GgzNN40IPrOcz0umtKjMAtXeU6MeapfmmEbwk+2zOo75gUt6SWU8UiFhAAAAFQC/Fm0V7OYGdazrUNuyn7mcPknZhQAAAgBzO496WPYnn7/H336kdMOUoue4Kgr9shpgjyyTJ8K9UsFwm+IEh9iS0QKPgGnj54AY1FpspfrbCmRI0tma+pj2QlnRRwIGcHd7eh2nCOmr+DSD/36VmoRPvGZaJDSTVotN+qgyjddNhCGx0417fqHXSKypbASphBqyvcKwkpk8S7o5nkMeOhufeCNdTHYsenKha4W+p8srGBsIZBISNeaGAsESIK4LuaShuolciTXtT7Nsqo123EXmjdHrT7DHQuwKI+jJpvHcz/UrissLs1JD+lFLOE07lkHPDc4KKK6IDUjm/DzsVTlTWdrcn8wUZ7fhUTt7e8UDNHs6bMlnhtVkXEsHS3sbYRsbF9179jufUumXKLKkjLzpTZwni8D6GxnjUn51hQ9Ifb9UOlSlkRq+cqOU+TRQd5aQSdiXy5Ymao719MHBrAhH1aLbi9pk4VO3GGFNy/w54ZY2LRIXZsGMBgFTXzHyzqv1ejeQtOuQZw9xOzt9IZU3WuMKVGGR9D61rsgxbGI1aWGaDlyhMSL9LYyqkmEqVqnAyydAVmhpSxhoXjbDrwE/IRdjJwjlK/6NxUck9g7Ekc9pHrow0OmqH9k6SCd2npXBUybTXPYqwHUjY/KccJsW0Ia2OECGN6KgNWdSfFeAGJBrv2ct78laSyNgIguM+0MNOZQSr6QfSQAAAgEAqkHqwfmEtrlc7hKtvenEf4Dkgt6H33U7MJILNOo9qrn/StDeuuO1snbO2wbd8weJop7gnp29zJGRKYcs/p2T3YjOd9R6aRGLOlT+jEZjP1RMPeuT7W4UFajP34SezYc1MAMeT9wkABEBQyj6s+4CvC2tKJWoirziAvkSPfkYdOc3u9I1LuXHu21tP+Lky3K9KylsbnHDG6vw05GH3HbeXIa6LtxAkXiPp/+r0dABO5NzglHS36uaD4mbQGh2dIzWPm4j8mLrjg911R8XnLPdTgT2EB9mvXksLjWEEq7qzTSdacFG0127O+i4Be3h1+5wG5HM8ST1n5hTOX8tTywF3DJL5HbLNHdDQo/YlT6l/wk6HbnYdcZHviVHi6va3/lFTdhoTEPz5sgDYQp5/0vobiMyIRHSZwzcYmswHumpf6Wql/phff8xigJBDAbGdFgx1Jk2OoOVGNWEchZuzlXyfgQpatnzBcR9CAAJvAfQLPqcHb8jGyBINuoNY/0OsAbsQDDzSjOLkBEBVgBTVZbykcik2n7kBQFeNj8zAUeLQCnQcEGIGY7OkPoxaAHBGKh4+e5Wymz0fryKTJ9io78qLHTmc6xs/ep4UwlO4Ee/e9p7cGb2pOl98jGFCWUklqyzeksBTOQcfKZBPV5dYap4m6nrw59XYpVbV9yPRJ/yMhE= downhill@downhill.homelinux.net diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub new file mode 100644 index 00000000..a1fcba83 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAABAEApDTX05FmMS1ArryWL6MmgcQeRFRU6E4Rgg+cPTeBuHCtBnnUoCUw7lhD2OICHIzQnfyMQasJOHH/4PnsrAxyO1Lm4KtK3zsdSdA5auunxAy0n7PZwaRKDTXCgpfXvi7ZAlzA+Mq/OjqtltfqdJgToYKxWoehwmltlwibuU1fke2v85VcTbCQRAttc6+0Y+3fToyTWecZM+X0uCsz1B5s07CLrMddo3lPVAlhYStSCbHflsM6C+NQAbxlsjkVFavii7WDYMYOd5FU0jIJt2Fy6u7Lx0ubY6hgGsP+mDOCCaRGA0JdjvWctBruj227CLswtAnYIFxvPi82R/okfx2X4YPtbqUPyLaUbr0G93g+raJEr/uXbour+wRd0TewOLq4VstwOsDfj9pm0wMFyIbsY2y97k6UZc0TE5pu3USGyW9/ainy5zD4TK4Al8lMkDHil6eItlud66KDZ4p5n5gzwuBj+ZOpOcBD5ZqLqDKst3YlHx6EuA1ddObBTrfy/nGphYYhWl1rbJ9+XOhSD8f/LIr5mjLEpSta6rHS/3dpLpSRGIy8ReG0RLbfay/fS74Iw0rEGOe/XgrfNDT0VwsgJMNV81sReepk27DaFD/vES/iPAymbbId8e8IQ7kDbhV0yK0yTkCZ5capqa9HXcut0SFRVJYGxzGT+ji5o/DcyAcaQHK9IW5i89sp04aVtZO+KZZDd2GmcDy+v9+fmBsSx2AFsoOQSXX31jJVdAXNw8idTNb88/3XDZIIEl+1KJ8Pv4UFXBW72RArpOxOrsDZYQjtaLQ4ZjTP3h823ZrBh4W3osb1znS7x4MmWBLPkmLCS0zmN8nbqhKi5EsTmSheCjCzySGShkyeqSGRIRGFk5PUsgh7hYvE+f7BhWD6x8MHbuUp9y0ODQonp022Dc4WzTc6Aa023MSNRuwV373tOqPYveuoPXDTS6vzV3IjXfv9a844HIkUTZbErxkavGBN5TEMgrALJkc8LS6M6Zg8odou8N2vWoNaKPn/DC5+H+FxJ2PSrK93hfzRMgvFvPSFzzDnixUFJClSqxf1Wvx9OW2pUuePAXBlcuFhAAnWV6w7fkmII8+qGk3m438dt2Sq6owmItzqIeJ6bohMsb9ejxeDyfk9DAQwmjS7S+BY47bYgAfsesZNRnlbeffp4rP0MAx4KoUXoNzb8tl1Jljulq58C0e5+EzRILqOYLM7WytY3+giqxN4zQJsqDp3mgSUaZ5SEHnA8JVi77MvABSoVclrEaujSLVEkxTBOiR252SFUWp3lWbxpGzBjd7gX4JAiytJql5xr+o4+nCy2O2laE6c2xS7en6SVEgC7jWflCsbDfvy9U+w1qOxa0j9fXE9Rw== sur5r@samsa diff --git a/contrib/examples/nico/conf/type/__nico_afs/manifest b/contrib/examples/nico/conf/type/__nico_afs/manifest new file mode 100755 index 00000000..7b4cc493 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/manifest @@ -0,0 +1,45 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + + +__directory /root/.ssh --mode 0700 + +__file /root/.ssh/authorized_keys --mode 0600 + +cd "$__type/files/ssh" +for key in *; do + require="__directory/root/.ssh" \ + __addifnosuchline ssh-$key --file /root/.ssh/authorized_keys \ + --line "$(cat "$key")" +done + +for pkg in openafs-client openafs-krb5 krb5-user; do + __package $pkg --state installed +done + +# Kerberos Config +__file /etc/krb5.conf --source "$__type/files/krb5/krb5.conf" + +# AFS config +cd "$__type/files/afs" +for afsconf in *; do + __file /etc/openafs/$afsconf --source "$__type/files/afs/$afsconf" +done diff --git a/contrib/examples/nico/conf/type/__nico_afs/singleton b/contrib/examples/nico/conf/type/__nico_afs/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_desktop/files/hostname b/contrib/examples/nico/conf/type/__nico_desktop/files/hostname new file mode 100644 index 00000000..a4df6242 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_desktop/files/hostname @@ -0,0 +1 @@ +scheibe diff --git a/contrib/examples/nico/conf/type/__nico_desktop/files/slim-preseed b/contrib/examples/nico/conf/type/__nico_desktop/files/slim-preseed new file mode 100644 index 00000000..01448d74 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_desktop/files/slim-preseed @@ -0,0 +1,4 @@ +# Use slim, not gdm, if both are available +# Setup for slim, but value is available for gdm as well: +# gdm shared/default-x-display-manager select slim +slim shared/default-x-display-manager select slim diff --git a/contrib/examples/nico/conf/type/__nico_desktop/manifest b/contrib/examples/nico/conf/type/__nico_desktop/manifest new file mode 100755 index 00000000..7fbbe70f --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_desktop/manifest @@ -0,0 +1,47 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +# +# Ensure hostname is setup +# +__file /etc/hostname --source "$__object/parameter/hostname" + +# All Linux distros have those +for pkg in dvdbackup mplayer x11vnc xfmpc; do + __package $pkg --state installed +done + +case "$(cat "$__global/explorer/os")" in + debian|ubuntu) + require="__package/zsh" __user lyni --uid 1000 --shell /bin/zsh + + for pkg in chromium-browser xfce4 xtightvncviewer; do + __package $pkg --state installed + done + + # Make slim default desktop on Debian/Ubuntu + __debconf_set_selections slim --file "$__type/files/slim-preseed" + require="__debconf_set_selections/slim" __package_apt slim --state installed + ;; +esac + +# Including gaming fun - not within examples, too big for core inclusion :-p +# __nico_dosbox diff --git a/contrib/examples/nico/conf/type/__nico_desktop/parameter/required b/contrib/examples/nico/conf/type/__nico_desktop/parameter/required new file mode 100644 index 00000000..ecd88aee --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_desktop/parameter/required @@ -0,0 +1 @@ +hostname diff --git a/contrib/examples/nico/conf/type/__nico_desktop/singleton b/contrib/examples/nico/conf/type/__nico_desktop/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_mpd/files/slim-preseed b/contrib/examples/nico/conf/type/__nico_mpd/files/slim-preseed new file mode 100644 index 00000000..01448d74 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_mpd/files/slim-preseed @@ -0,0 +1,4 @@ +# Use slim, not gdm, if both are available +# Setup for slim, but value is available for gdm as well: +# gdm shared/default-x-display-manager select slim +slim shared/default-x-display-manager select slim diff --git a/contrib/examples/nico/conf/type/__nico_mpd/manifest b/contrib/examples/nico/conf/type/__nico_mpd/manifest new file mode 100644 index 00000000..d339bdf3 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_mpd/manifest @@ -0,0 +1,24 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +__package mpd --state installed + +require="__package/mpd" __file /etc/mpd.conf --source "$__type/files/mpd.conf" diff --git a/contrib/examples/nico/conf/type/__nico_mpd/parameter/required b/contrib/examples/nico/conf/type/__nico_mpd/parameter/required new file mode 100644 index 00000000..ecd88aee --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_mpd/parameter/required @@ -0,0 +1 @@ +hostname diff --git a/contrib/examples/nico/conf/type/__nico_mpd/singleton b/contrib/examples/nico/conf/type/__nico_mpd/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_network/files/interfaces-eth0 b/contrib/examples/nico/conf/type/__nico_network/files/interfaces-eth0 new file mode 100644 index 00000000..2a92eade --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_network/files/interfaces-eth0 @@ -0,0 +1,6 @@ +# generated by cdist +auto lo eth0 + +iface lo inet loopback + +iface eth0 inet dhcp diff --git a/contrib/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 b/contrib/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 new file mode 100644 index 00000000..49508eb2 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 @@ -0,0 +1,11 @@ +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +# The loopback network interface +auto lo +iface lo inet loopback + +auto wlan0 +iface wlan0 inet dhcp + wpa-ssid undef + wpa-psk rotrussland diff --git a/contrib/examples/nico/conf/type/__nico_network/manifest b/contrib/examples/nico/conf/type/__nico_network/manifest new file mode 100755 index 00000000..012c47f7 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_network/manifest @@ -0,0 +1,43 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +case "$(cat "$__global/explorer/os")" in + debian|ubuntu) + + interface="$(cat $__object/parameter/interface)" + + # + # Only Debian and alike supported currently + # + destination=/etc/network/interfaces + case "$interface" in + eth0|wlan0) + source="$__type/files/interfaces-${interface}" + ;; + *) + echo "Unknown interface: $interface" >&2 + exit 1 + ;; + esac + + __file "$destination" --source "$source" + ;; +esac diff --git a/contrib/examples/nico/conf/type/__nico_network/parameter/required b/contrib/examples/nico/conf/type/__nico_network/parameter/required new file mode 100644 index 00000000..b529896a --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_network/parameter/required @@ -0,0 +1 @@ +interface diff --git a/contrib/examples/nico/conf/type/__nico_network/singleton b/contrib/examples/nico/conf/type/__nico_network/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed b/contrib/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed new file mode 100644 index 00000000..01448d74 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed @@ -0,0 +1,4 @@ +# Use slim, not gdm, if both are available +# Setup for slim, but value is available for gdm as well: +# gdm shared/default-x-display-manager select slim +slim shared/default-x-display-manager select slim diff --git a/contrib/examples/nico/conf/type/__nico_nfs_client/manifest b/contrib/examples/nico/conf/type/__nico_nfs_client/manifest new file mode 100755 index 00000000..ed1a872b --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_nfs_client/manifest @@ -0,0 +1,47 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +__directory /home/services + +for nfsshare in audio video; do + dir="/home/services/$nfsshare" + __addifnosuchline nfs-$nfsshare --file /etc/fstab \ + --line "192.168.42.1:$dir $dir nfs defaults 0 0" + require="__directory/home/services" __directory $dir +done + +__directory /home/services/eingehend +for nfsshare in bibliothek buch spiegel; do + dir="/home/services/eingehend/$nfsshare" + __addifnosuchline nfs-$nfsshare --file /etc/fstab \ + --line "192.168.42.1:$dir $dir nfs defaults,noauto 0 0" + require="__directory/home/services" __directory $dir +done + +case "$(cat "$__global/explorer/os")" in + debian|ubuntu) + __package nfs-common --state installed + ;; + + fedora|archlinux) + __package nfs-utils --state installed + ;; +esac diff --git a/contrib/examples/nico/conf/type/__nico_nfs_client/singleton b/contrib/examples/nico/conf/type/__nico_nfs_client/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_notebook/manifest b/contrib/examples/nico/conf/type/__nico_notebook/manifest new file mode 100755 index 00000000..7b010230 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_notebook/manifest @@ -0,0 +1,38 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +require="__package/zsh" __user nico --uid 1000 --shell /bin/zsh + +# +# Backup HD +# +for hd in usbhd eth-usbhd; do + dir="/home/services/$hd" + __addifnosuchline hd-$hd --file /etc/fstab \ + --line "/dev/mapper/$hd $dir auto defaults,noauto 0 0" + __directory $dir +done + +# +# Standard everywhere packages +# +__nico_packages +__motd diff --git a/contrib/examples/nico/conf/type/__nico_notebook/singleton b/contrib/examples/nico/conf/type/__nico_notebook/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_packages/manifest b/contrib/examples/nico/conf/type/__nico_packages/manifest new file mode 100755 index 00000000..a1e663f7 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_packages/manifest @@ -0,0 +1,33 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +for pkg in atop screen vim wget zsh; do + __package "$pkg" --state installed +done + +case "$(cat "$__global/explorer/os")" in + fedora) + __package nc --state installed + ;; + *) + __package netcat --state installed + ;; +esac diff --git a/contrib/examples/nico/conf/type/__nico_packages/singleton b/contrib/examples/nico/conf/type/__nico_packages/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_sudo/files/sudo-nico b/contrib/examples/nico/conf/type/__nico_sudo/files/sudo-nico new file mode 100644 index 00000000..d904c319 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_sudo/files/sudo-nico @@ -0,0 +1,13 @@ +# +# Cdist managed file +# + +# Personal one: nico, shared one: lyni +User_Alias NICO = nico, lyni + +Defaults timestamp_timeout=5 +Defaults !tty_tickets + +# Give out permissions +NICO ALL=(ALL) ALL +NICO ALL=(ALL) NOPASSWD: /usr/sbin/pm-suspend diff --git a/contrib/examples/nico/conf/type/__nico_sudo/manifest b/contrib/examples/nico/conf/type/__nico_sudo/manifest new file mode 100755 index 00000000..59315313 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_sudo/manifest @@ -0,0 +1,27 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +destination=/etc/sudoers.d/nico +source="$__type/files/sudo-nico" + +require="__package/sudo" __file "$destination" --source "$source" --mode 0440 + +__package sudo --state installed diff --git a/contrib/examples/nico/conf/type/__nico_sudo/parameter/gencode b/contrib/examples/nico/conf/type/__nico_sudo/parameter/gencode new file mode 100644 index 00000000..74792abf --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_sudo/parameter/gencode @@ -0,0 +1,31 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# USEFUL DESCRIPTION +# + +# +# This file should generate code on stdout, which will be collected by cdist +# and run on the target. +# +# To tell cdist to make use of it, you need to make it executable (chmod +x) +# +# + diff --git a/contrib/examples/nico/conf/type/__nico_sudo/parameter/manifest b/contrib/examples/nico/conf/type/__nico_sudo/parameter/manifest new file mode 100644 index 00000000..c696eda6 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_sudo/parameter/manifest @@ -0,0 +1,31 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# USEFUL DESCRIPTION +# + +# +# This is the manifest, which can be used to create other objects like this: +# __file /path/to/destination --source /from/where/ +# +# To tell cdist to make use of it, you need to make it executable (chmod +x) +# +# + diff --git a/contrib/examples/nico/conf/type/__nico_sudo/parameter/optional b/contrib/examples/nico/conf/type/__nico_sudo/parameter/optional new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_sudo/parameter/required b/contrib/examples/nico/conf/type/__nico_sudo/parameter/required new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_sudo/singleton b/contrib/examples/nico/conf/type/__nico_sudo/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_tee/files/99-apt-nico b/contrib/examples/nico/conf/type/__nico_tee/files/99-apt-nico new file mode 100644 index 00000000..8d6d7c82 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_tee/files/99-apt-nico @@ -0,0 +1,2 @@ +APT::Periodic::Update-Package-Lists "1"; +APT::Periodic::Unattended-Upgrade "1"; diff --git a/contrib/examples/nico/conf/type/__nico_tee/files/hostname b/contrib/examples/nico/conf/type/__nico_tee/files/hostname new file mode 100644 index 00000000..a4df6242 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_tee/files/hostname @@ -0,0 +1 @@ +scheibe diff --git a/contrib/examples/nico/conf/type/__nico_tee/manifest b/contrib/examples/nico/conf/type/__nico_tee/manifest new file mode 100755 index 00000000..4c614027 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_tee/manifest @@ -0,0 +1,28 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + + + +__package unattended-upgrades --state installed + +__file /etc/apt/apt.conf.d/99-apt-nico \ + --source "$__type/files/99-apt-nico" \ + --mode 0644 diff --git a/contrib/examples/nico/conf/type/__nico_tee/singleton b/contrib/examples/nico/conf/type/__nico_tee/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/__package_zypper/README b/contrib/types_pending_inclusion/__package_zypper/README similarity index 100% rename from contrib/__package_zypper/README rename to contrib/types_pending_inclusion/__package_zypper/README diff --git a/contrib/__package_zypper/explorer/pkg_version b/contrib/types_pending_inclusion/__package_zypper/explorer/pkg_version similarity index 100% rename from contrib/__package_zypper/explorer/pkg_version rename to contrib/types_pending_inclusion/__package_zypper/explorer/pkg_version diff --git a/contrib/__package_zypper/gencode-remote b/contrib/types_pending_inclusion/__package_zypper/gencode-remote similarity index 100% rename from contrib/__package_zypper/gencode-remote rename to contrib/types_pending_inclusion/__package_zypper/gencode-remote diff --git a/contrib/__package_zypper/man.text b/contrib/types_pending_inclusion/__package_zypper/man.text similarity index 100% rename from contrib/__package_zypper/man.text rename to contrib/types_pending_inclusion/__package_zypper/man.text diff --git a/contrib/__package_zypper/parameter/optional b/contrib/types_pending_inclusion/__package_zypper/parameter/optional similarity index 100% rename from contrib/__package_zypper/parameter/optional rename to contrib/types_pending_inclusion/__package_zypper/parameter/optional diff --git a/contrib/__package_zypper/parameter/required b/contrib/types_pending_inclusion/__package_zypper/parameter/required similarity index 100% rename from contrib/__package_zypper/parameter/required rename to contrib/types_pending_inclusion/__package_zypper/parameter/required From df9bdef75e1554a87f3639d832e572bec4e7a21f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 26 Jul 2011 21:56:19 +0200 Subject: [PATCH 0013/1024] shortcuts for public Signed-off-by: Nico Schottelius --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index eded032e..a6897d49 100755 --- a/build.sh +++ b/build.sh @@ -108,7 +108,7 @@ case "$1" in cd ${WEBDIR} && make pub ;; - pub) + p|pu|pub) git push --mirror git push --mirror github ;; From dc820cf31e35c7790d28b28c5047d4780769f1af Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 28 Jul 2011 10:54:39 +0200 Subject: [PATCH 0014/1024] also filter stderr and add hostname as prefix Signed-off-by: Nico Schottelius --- bin/cdist-mass-deploy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cdist-mass-deploy b/bin/cdist-mass-deploy index 5ebfa1c2..c2b6d6a5 100755 --- a/bin/cdist-mass-deploy +++ b/bin/cdist-mass-deploy @@ -42,13 +42,13 @@ fi i=0 while [ $# -gt 0 ]; do if [ "$parallel" ]; then - cdist-deploy-to "$1" | filter "$1" & + cdist-deploy-to "$1" 2>&1 | filter "$1" & # Record pid and host for use later i=$((i+1)) eval pid_$i=$! eval host_$i=\$1 else - cdist-deploy-to "$1" | filter "$1" + cdist-deploy-to "$1" 2>&1 | filter "$1" fi shift done From e97854238122a6dfd2db77a96569eb32154d2471 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 2 Aug 2011 15:20:32 +0200 Subject: [PATCH 0015/1024] safer quoting Signed-off-by: Steven Armstrong --- conf/type/__user/gencode-remote | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/type/__user/gencode-remote b/conf/type/__user/gencode-remote index 31c93655..c4f9123a 100755 --- a/conf/type/__user/gencode-remote +++ b/conf/type/__user/gencode-remote @@ -55,7 +55,7 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then current_value="$(awk -F: '{ print $ENVIRON["field"] }' < "$file")" if [ "$new_value" != "$current_value" ]; then - set -- "$@" "--$property" \"$new_value\" + set -- "$@" "--$property" \'$new_value\' fi done @@ -67,7 +67,7 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then else for property in $(ls .); do new_value="$(cat "$property")" - set -- "$@" "--$property" \"$new_value\" + set -- "$@" "--$property" \'$new_value\' done echo useradd "$@" "$name" From 22025217d92d23d6084c11262820948c18b4f187 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 9 Aug 2011 09:01:51 +0200 Subject: [PATCH 0016/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 5ba529ad..28762ef4 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1 +1,26 @@ Catch broken instances in cdist-mass-deploy -p and report broken deployements at the end! + + +-------------------------------------------------------------------------------- +Bug with requirements when indirect requires is scheduled late: + +__package/collectd: Generating local code +__package/collectd: Generating remote code +__package/collectd: Transferring object +__package/collectd: Checking code-local +__package/collectd: Checking code-remote +__file/etc/collectd/collectd.conf: Generating local code +__file/etc/collectd/collectd.conf: Generating remote code +__file/etc/collectd/collectd.conf: Transferring object +__file/etc/collectd/collectd.conf: Checking code-local +__file/etc/collectd/collectd.conf: Executing code-local +scp: /etc/collectd/collectd.conf: No such file or directory +__file/etc/collectd/collectd.conf: Error: /tmp/cdist.PYKFWmj9QknE/out/object/__file/etc/collectd/collectd.conf/.cdist/code-local exited non-zero +__file/etc/collectd/collectd.conf: Warning: Faulty code: +# +# The following code was generated by /home/users/nico/oeffentlich/rechner/projekte/cdist-nutzung/conf/type/__file/gencode-local +# + +scp /home/users/nico/oeffentlich/rechner/projekte/cdist-nutzung/conf/type/__ethz_collectd/files/collectd.conf.client root@shrek08:/etc/collectd/collectd.conf +__file/etc/collectd/collectd.conf: Error: Aborting due to non-zero exit code. + From bbe0d4a5db592d8fe2568314244d59250aed8f69 Mon Sep 17 00:00:00 2001 From: nuex Date: Wed, 17 Aug 2011 09:21:00 -0400 Subject: [PATCH 0017/1024] __package_rubygem --- .../__package_rubygem/explorer/pkg_status | 30 +++++++++++ conf/type/__package_rubygem/gencode-remote | 51 +++++++++++++++++++ conf/type/__package_rubygem/man.text | 49 ++++++++++++++++++ .../type/__package_rubygem/parameter/optional | 2 + .../type/__package_rubygem/parameter/required | 1 + 5 files changed, 133 insertions(+) create mode 100755 conf/type/__package_rubygem/explorer/pkg_status create mode 100755 conf/type/__package_rubygem/gencode-remote create mode 100644 conf/type/__package_rubygem/man.text create mode 100644 conf/type/__package_rubygem/parameter/optional create mode 100644 conf/type/__package_rubygem/parameter/required diff --git a/conf/type/__package_rubygem/explorer/pkg_status b/conf/type/__package_rubygem/explorer/pkg_status new file mode 100755 index 00000000..97620892 --- /dev/null +++ b/conf/type/__package_rubygem/explorer/pkg_status @@ -0,0 +1,30 @@ +#!/bin/sh +# +# 2011 Chase Allen James (nx-cdist@nu-ex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# Retrieve the status of a rubygem +# + +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name="$__object_id" +fi + +# Except gem failing, if package is not known / installed +gem list -i "$name" 2>/dev/null || exit 0 diff --git a/conf/type/__package_rubygem/gencode-remote b/conf/type/__package_rubygem/gencode-remote new file mode 100755 index 00000000..dfc08781 --- /dev/null +++ b/conf/type/__package_rubygem/gencode-remote @@ -0,0 +1,51 @@ +#!/bin/sh +# +# 2011 Chase Allen James +# +# 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 . +# +# +# Manage Rubygem packages +# + + +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name="$__object_id" +fi + +state="$(cat "$__object/parameter/state")" +is_installed="$(grep "true" "$__object/explorer/pkg_status" || true)" + +case "$state" in + installed) + # Install only if non-existent + if [ -z "$is_installed" ]; then + echo gem install \"$name\" --no-ri --no-rdoc + fi + ;; + removed) + # Remove only if existent + if [ -n "$is_installed" ]; then + echo gem uninstall \"$name\" + fi + ;; + *) + echo "Unknown state: $state" >&2 + exit 1 + ;; +esac diff --git a/conf/type/__package_rubygem/man.text b/conf/type/__package_rubygem/man.text new file mode 100644 index 00000000..00adc8c1 --- /dev/null +++ b/conf/type/__package_rubygem/man.text @@ -0,0 +1,49 @@ +cdist-type__package_rubygem(7) +============================= +Chase Allen James > + + +NAME +---- +cdist-type__package_rubygem - Manage rubygem packages + + +DESCRIPTION +----------- +Rubygems is the default package management system for the Ruby programming language. + + +REQUIRED PARAMETERS +------------------- +state:: + Either "installed" or "removed". + + +OPTIONAL PARAMETERS +------------------- +name:: + If supplied, use the name and not the object id as the package name. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Ensure sinatra is installed +__package_rubygem sinatra --state installed + +# Remove package +__package_rubygem rails --state removed +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- cdist-type__package(7) + + +COPYING +------- +Copyright \(C) 2011 Chase Allen James. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__package_rubygem/parameter/optional b/conf/type/__package_rubygem/parameter/optional new file mode 100644 index 00000000..a52167d3 --- /dev/null +++ b/conf/type/__package_rubygem/parameter/optional @@ -0,0 +1,2 @@ +name +version diff --git a/conf/type/__package_rubygem/parameter/required b/conf/type/__package_rubygem/parameter/required new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/conf/type/__package_rubygem/parameter/required @@ -0,0 +1 @@ +state From b7deafc26d477e6318b27885081a7cba2637842e Mon Sep 17 00:00:00 2001 From: nuex Date: Wed, 17 Aug 2011 09:27:36 -0400 Subject: [PATCH 0018/1024] fix author email in gencode-remote --- conf/type/__package_rubygem/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__package_rubygem/gencode-remote b/conf/type/__package_rubygem/gencode-remote index dfc08781..daaba524 100755 --- a/conf/type/__package_rubygem/gencode-remote +++ b/conf/type/__package_rubygem/gencode-remote @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Chase Allen James +# 2011 Chase Allen James # # This file is part of cdist. # From b82f2b0f23ba942f9607eacc4a08ca7feaf26354 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 20 Aug 2011 23:00:31 +0200 Subject: [PATCH 0019/1024] fixup manpage for cdist-type__package_rubygem Signed-off-by: Nico Schottelius --- conf/type/__package_rubygem/man.text | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/type/__package_rubygem/man.text b/conf/type/__package_rubygem/man.text index 00adc8c1..c6248ee3 100644 --- a/conf/type/__package_rubygem/man.text +++ b/conf/type/__package_rubygem/man.text @@ -1,6 +1,6 @@ cdist-type__package_rubygem(7) -============================= -Chase Allen James > +============================== +Chase Allen James NAME From 298784b12bef0600dd4df77a769b6039ea29bedd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 20 Aug 2011 23:02:53 +0200 Subject: [PATCH 0020/1024] __package_rubygem: remove optional parameter version, it is not used Signed-off-by: Nico Schottelius --- conf/type/__package_rubygem/parameter/optional | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/type/__package_rubygem/parameter/optional b/conf/type/__package_rubygem/parameter/optional index a52167d3..f121bdbf 100644 --- a/conf/type/__package_rubygem/parameter/optional +++ b/conf/type/__package_rubygem/parameter/optional @@ -1,2 +1 @@ name -version From 96b164979b7c57dd92514fa5bb4d4e715c8a2f4a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 21 Aug 2011 15:14:33 +0200 Subject: [PATCH 0021/1024] changes for the next version Signed-off-by: Nico Schottelius --- doc/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/changelog b/doc/changelog index 82ae4b95..7e98277a 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,3 +1,6 @@ +next: + * New Type: __package_rubygem (Chase Allen James) + 1.7.1: 2011-07-26 * Documentation: Add explorers to reference * Documentation: Typo cleanup (Derek Brost) From 98fba8f6bd86214f907341fd22808fe12b921959 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 31 Aug 2011 17:02:00 +0200 Subject: [PATCH 0022/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index abe98cb4..5ded4298 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -49,6 +49,7 @@ CORE wood # empty file - allow cdist to run without $PATH setup: ./bin/cdist-deploy-to +- use absent/present for state by default TYPES ------ From 1b84a2851146c78fe1c122afc216ec0f8d7b4a07 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 00:41:37 +0200 Subject: [PATCH 0023/1024] add cdist Signed-off-by: Nico Schottelius --- bin/cdist | 438 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 438 insertions(+) create mode 100644 bin/cdist diff --git a/bin/cdist b/bin/cdist new file mode 100644 index 00000000..a70a11f8 --- /dev/null +++ b/bin/cdist @@ -0,0 +1,438 @@ +#!python3 +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +__cdist_version="1.7.0" + +# Fail if something bogus is going on +set -u + +################################################################################ +# cconf standard vars prefixed with cdist + +__cdist_pwd="$(pwd -P)" +__cdist_mydir="${0%/*}"; +__cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)" +__cdist_myname=${0##*/}; +__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" + +################################################################################ +# Names / Constants +# +# Most values can be overriden from outside, so you can +# customise paths as you like (for distributors, geeks and hackers) +# + +: ${__cdist_name_bin:=bin} +: ${__cdist_name_cache:=cache} +: ${__cdist_name_code:=code} +: ${__cdist_name_conf_dir:=conf} +: ${__cdist_name_dot_cdist:=.cdist} +: ${__cdist_name_explorer:=explorer} +: ${__cdist_name_gencode:=gencode} +: ${__cdist_name_gencode_local:=local} +: ${__cdist_name_gencode_remote:=remote} +: ${__cdist_name_global:=global} +: ${__cdist_name_host:=host} +: ${__cdist_name_init:=init} +: ${__cdist_name_manifest:=manifest} +: ${__cdist_name_object:=object} +: ${__cdist_name_object_finished:=done} +: ${__cdist_name_object_prepared:=prepared} +: ${__cdist_name_object_id:=object_id} +: ${__cdist_name_object_source:=source} +: ${__cdist_name_objects_created:=.objects_created} +: ${__cdist_name_out_dir:=out} +: ${__cdist_name_parameter:=parameter} +: ${__cdist_name_parameter_required:=required} +: ${__cdist_name_parameter_optional:=optional} +: ${__cdist_name_require:=require} +: ${__cdist_name_self:=self} +: ${__cdist_name_singleton:=singleton} +: ${__cdist_name_target_host:=target_host} +: ${__cdist_name_target_user:=target_user} +: ${__cdist_name_type:=type} +: ${__cdist_name_type_bin:=type_bin} +: ${__cdist_name_type_explorer:=type_explorer} +: ${__cdist_name_type_explorer_pushed:=.explorer_pushed} + +# Used for IDs: Allow everything not starting with - and . +: ${__cdist_sane_regexp:=[^-\.].*} + +# Default remote user +: ${__cdist_remote_user:=root} + + +################################################################################ +# Exported variable names (usable for non core +# +: ${__cdist_name_var_explorer:=__$__cdist_name_explorer} +: ${__cdist_name_var_type_explorer:=__$__cdist_name_type_explorer} +: ${__cdist_name_var_global:=__$__cdist_name_global} +: ${__cdist_name_var_manifest:=__$__cdist_name_manifest} +: ${__cdist_name_var_target_host:=__$__cdist_name_target_host} +: ${__cdist_name_var_target_user:=__$__cdist_name_target_user} +: ${__cdist_name_var_object:=__$__cdist_name_object} +: ${__cdist_name_var_object_id:=__$__cdist_name_object_id} +: ${__cdist_name_var_self:=__$__cdist_name_self} +: ${__cdist_name_var_type:=__$__cdist_name_type} + + +################################################################################ +# Tempfiles +# +: ${__cdist_tmp_base_dir=/tmp} +__cdist_tmp_dir=$(mktemp -d "$__cdist_tmp_base_dir/cdist.XXXXXXXXXXXX") +__cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX") + +################################################################################ +# Local Base +# +: ${__cdist_local_base_dir:=$__cdist_tmp_dir} + +# Cache may *NOT* be below __cdist_local_base_dir! +: ${__cdist_local_base_cache_dir:=$__cdist_abs_mydir/../$__cdist_name_cache} + +: ${__cdist_conf_dir:="$(cd "$__cdist_abs_mydir/../conf" && pwd -P)"} + +: ${__cdist_explorer_dir:=$__cdist_conf_dir/$__cdist_name_explorer} +: ${__cdist_manifest_dir:=$__cdist_conf_dir/$__cdist_name_manifest} +: ${__cdist_manifest_init:=$__cdist_manifest_dir/$__cdist_name_init} +: ${__cdist_type_dir:=$__cdist_conf_dir/$__cdist_name_type} + +################################################################################ +# Local output +# +: ${__cdist_out_dir:=$__cdist_local_base_dir/$__cdist_name_out_dir} +: ${__cdist_out_explorer_dir:=$__cdist_out_dir/$__cdist_name_explorer} +: ${__cdist_out_object_dir:=$__cdist_out_dir/$__cdist_name_object} +: ${__cdist_out_type_dir:=$__cdist_out_dir/$__cdist_name_type} +: ${__cdist_out_type_bin_dir:=$__cdist_out_dir/$__cdist_name_type_bin} + +: ${__cdist_objects_created:=$__cdist_out_object_dir/$__cdist_name_objects_created} + +################################################################################ +# Remote base +# +: ${__cdist_remote_base_dir:=/var/lib/cdist} +: ${__cdist_remote_bin_dir:=$__cdist_remote_base_dir/$__cdist_name_bin} +: ${__cdist_remote_conf_dir:=$__cdist_remote_base_dir/$__cdist_name_conf_dir} + +: ${__cdist_remote_explorer_dir:=$__cdist_remote_conf_dir/$__cdist_name_explorer} +: ${__cdist_remote_type_dir:=$__cdist_remote_conf_dir/$__cdist_name_type} + +################################################################################ +# Remote output +# +: ${__cdist_remote_out_dir:=$__cdist_remote_base_dir/$__cdist_name_out_dir} +: ${__cdist_remote_out_explorer_dir:=$__cdist_remote_out_dir/$__cdist_name_explorer} +: ${__cdist_remote_out_object_dir:=$__cdist_remote_out_dir/$__cdist_name_object} + + +################################################################################ +# Internal functions +# +__cdist_echo() +{ + __cdist_echo_type="$1"; shift + + set +u + if [ "$__cdist_object_self" ]; then + __cdist_echo_prefix="${__cdist_object_self}:" + else + __cdist_echo_prefix="core: " + fi + set -u + + case "$__cdist_echo_type" in + debug) + set +u + if [ "$__cdist_debug" ]; then + echo $__cdist_echo_prefix "Debug: $@" + fi + set -u + ;; + info) + echo $__cdist_echo_prefix "$@" + ;; + warn) + echo $__cdist_echo_prefix "Warning: $@" + ;; + error) + echo $__cdist_echo_prefix "Error: $@" >&2 + ;; + *) + echo "CORE BUG, who created the broken commit in $0?" >&2 + exit 23 + ;; + esac +} + +__cdist_exec_fail_on_error() +{ + set +e + sh -e "$@" + if [ "$?" -ne 0 ]; then + __cdist_echo error "$1 exited non-zero" + __cdist_echo warn "Faulty code:" + cat "$1" + __cdist_exit_err "Aborting due to non-zero exit code." + fi +} + +__cdist_exit_err() +{ + __cdist_echo error "$@" + exit 1 +} + +__cdist_usage() +{ + __cdist_exit_err "$__cdist_myname: $@" +} + +__cdist_init_deploy() +{ + __cdist_echo info "Creating clean directory structure " + + # Ensure there is no old stuff, neither local nor remote + rm -rf "$__cdist_local_base_dir" + ssh "${__cdist_remote_user}@$1" "rm -rf ${__cdist_remote_base_dir}" + + # Init base + mkdir -p "$__cdist_local_base_dir" + ssh "${__cdist_remote_user}@$1" "mkdir -p ${__cdist_remote_base_dir}" + + # Link configuration source directory - consistent with remote + ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir" +} + +################################################################################ +# Cache +# +__cdist_cache_dir() +{ + cd "${__cdist_local_base_cache_dir}" && pwd -P +} + +__cdist_host_cache_dir() +{ + echo "$(__cdist_cache_dir)/$1" +} + +################################################################################ +# Object +# + +__cdist_object_code() +{ + echo "$(__cdist_object_dir "$1")/${__cdist_name_code}-$2" +} + +__cdist_object_prepared() +{ + echo "$(__cdist_object_dir "$1")/${__cdist_name_object_prepared}" +} + +__cdist_object_finished() +{ + echo "$(__cdist_object_dir "$1")/${__cdist_name_object_finished}" +} + +__cdist_object_dir() +{ + echo "$(__cdist_object_base_dir "$1")/${__cdist_name_dot_cdist}" +} + +__cdist_object_base_dir() +{ + echo "${__cdist_out_object_dir}/$1" +} + + +__cdist_object_id_from_object() +{ + echo "${1#*/}" +} + +# Find objects, remove ./ and /MARKER +__cdist_object_list() +{ + local basedir="$1"; shift + + # Use subshell to prevent changing cwd in program + ( + cd "${basedir}" + + find . -name "$__cdist_name_dot_cdist" | \ + sed -e 's;^./;;' -e "s;/${__cdist_name_dot_cdist}\$;;" + ) +} + +__cdist_object_parameter_dir() +{ + echo "$(__cdist_object_dir "$1")/${__cdist_name_parameter}" +} + +__cdist_object_require() +{ + echo "$(__cdist_object_dir "$1")/${__cdist_name_require}" +} + +__cdist_object_source_name() +{ + echo "$1/${__cdist_name_object_source}" +} + +__cdist_object_source() +{ + cat "$(__cdist_object_source_name "$1")" +} + +__cdist_object_source_add() +{ + echo "$__cdist_manifest" >> "$(__cdist_object_source_name "$1")" +} + +__cdist_object_type_explorer_dir() +{ + echo "$(__cdist_object_dir "$1")/${__cdist_name_explorer}" +} + +################################################################################ +# Remote +# + +__cdist_remote_object_base_dir() +{ + echo "${__cdist_remote_out_object_dir}/$1" +} + +__cdist_remote_object_dir() +{ + echo "$(__cdist_remote_object_base_dir "$1")/${__cdist_name_dot_cdist}" +} + +__cdist_remote_object_parameter_dir() +{ + echo "$(__cdist_remote_object_dir "$1")/${__cdist_name_parameter}" +} + +__cdist_remote_object_type_explorer_dir() +{ + echo "$(__cdist_remote_object_dir "$1")/${__cdist_name_explorer}" +} + + +__cdist_remote_type_explorer_dir() +{ + echo "${__cdist_remote_type_dir}/$1/${__cdist_name_explorer}" +} + + +################################################################################ +# Traps +# +__cdist_tmp_removal() +{ + rm -rf "${__cdist_tmp_dir}" +} + +# Does not work in children, will be called again in every script! +# Use only in interactive "front end" scripts +__cdist_kill_on_interrupt() +{ + __cdist_tmp_removal + kill 0 + exit 1 +} + +# Remove tempfiles at normal exit +trap __cdist_tmp_removal EXIT + + +################################################################################ +# Type +# +__cdist_type_dir() +{ + echo "${__cdist_type_dir}/$1" +} + +__cdist_type_explorer_dir() +{ + echo "${__cdist_type_dir}/$1/${__cdist_name_explorer}" +} + +__cdist_type_from_object() +{ + echo "${1%%/*}" +} + +__cdist_type_has_explorer() +{ + # We only create output, if there's at least one explorer + # and can thus be used as a boolean ;-) + if [ -d "$(__cdist_type_explorer_dir "$1")" ]; then + ls -1 "$(__cdist_type_explorer_dir "$1")" + fi +} + +__cdist_type_explorer_pushed() +{ + [ -f "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" ] \ + && grep -q "$1" "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" +} + +__cdist_type_explorer_pushed_add() +{ + [ -d "$__cdist_out_type_dir" ] || mkdir "$__cdist_out_type_dir" + echo "$1" >> "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" +} + +__cdist_type_gencode() +{ + echo "${__cdist_type_dir}/$1/${__cdist_name_gencode}-$2" +} + +__cdist_type_manifest() +{ + echo "${__cdist_type_dir}/$1/${__cdist_name_manifest}" +} + +__cdist_type_parameter_dir() +{ + echo "$(__cdist_type_dir "$1")/${__cdist_name_parameter}" +} + +__cdist_type_parameter_optional() +{ + echo "$(__cdist_type_parameter_dir "$1")/$__cdist_name_parameter_optional" +} + +__cdist_type_parameter_required() +{ + echo "$(__cdist_type_parameter_dir "$1")/$__cdist_name_parameter_required" +} + +__cdist_type_singleton() +{ + echo "${__cdist_type_dir}/$1/${__cdist_name_singleton}" +} From d359f69f4bd907e88103aa41217724707a9c0325 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 00:49:29 +0200 Subject: [PATCH 0024/1024] +minimal __cdist_echo Signed-off-by: Nico Schottelius --- core/__cdist_cache | 34 ++++++++++++ core/__cdist_dir | 46 ++++++++++++++++ core/__cdist_dir_listing | 30 +++++++++++ core/__cdist_echo | 56 +++++++++++++++++++ core/__cdist_exit_err | 28 ++++++++++ core/__cdist_explorer_run | 79 +++++++++++++++++++++++++++ core/__cdist_explorer_run_global | 32 +++++++++++ core/__cdist_init_deploy | 40 ++++++++++++++ core/__cdist_is_executable | 44 +++++++++++++++ core/__cdist_kill_on_interrupt | 31 +++++++++++ core/__cdist_manifest_run | 53 ++++++++++++++++++ core/__cdist_manifest_run_init | 32 +++++++++++ core/__cdist_object_all | 60 +++++++++++++++++++++ core/__cdist_object_code_run | 54 +++++++++++++++++++ core/__cdist_object_explorer_run | 89 +++++++++++++++++++++++++++++++ core/__cdist_object_gencode | 66 +++++++++++++++++++++++ core/__cdist_object_gencode_run | 36 +++++++++++++ core/__cdist_object_list | 36 +++++++++++++ core/__cdist_object_manifest_run | 59 ++++++++++++++++++++ core/__cdist_object_prepare | 47 ++++++++++++++++ core/__cdist_object_run | 74 +++++++++++++++++++++++++ core/__cdist_run | 27 ++++++++++ core/__cdist_run_remote | 32 +++++++++++ core/__cdist_run_shell | 34 ++++++++++++ core/__cdist_tmp_removal | 27 ++++++++++ core/__cdist_type_build_emulation | 49 +++++++++++++++++ core/__cdist_usage | 27 ++++++++++ 27 files changed, 1222 insertions(+) create mode 100755 core/__cdist_cache create mode 100755 core/__cdist_dir create mode 100755 core/__cdist_dir_listing create mode 100755 core/__cdist_echo create mode 100755 core/__cdist_exit_err create mode 100755 core/__cdist_explorer_run create mode 100755 core/__cdist_explorer_run_global create mode 100755 core/__cdist_init_deploy create mode 100755 core/__cdist_is_executable create mode 100644 core/__cdist_kill_on_interrupt create mode 100755 core/__cdist_manifest_run create mode 100755 core/__cdist_manifest_run_init create mode 100755 core/__cdist_object_all create mode 100755 core/__cdist_object_code_run create mode 100755 core/__cdist_object_explorer_run create mode 100755 core/__cdist_object_gencode create mode 100755 core/__cdist_object_gencode_run create mode 100755 core/__cdist_object_list create mode 100755 core/__cdist_object_manifest_run create mode 100755 core/__cdist_object_prepare create mode 100755 core/__cdist_object_run create mode 100755 core/__cdist_run create mode 100755 core/__cdist_run_remote create mode 100755 core/__cdist_run_shell create mode 100755 core/__cdist_tmp_removal create mode 100755 core/__cdist_type_build_emulation create mode 100755 core/__cdist_usage diff --git a/core/__cdist_cache b/core/__cdist_cache new file mode 100755 index 00000000..95764d3d --- /dev/null +++ b/core/__cdist_cache @@ -0,0 +1,34 @@ +#!/bin/sh +# +# 2010 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 . +# +# +# Save the configuration tree into the local cache +# + +__cdist_cache() +{ + # Create base to move into + mkdir -p "${__cdist_local_base_cache_dir}" + + __cdist_echo info \ + "Caching to $(__cdist_host_cache_dir "$__cdist_target_host")" + rm -rf "$(__cdist_host_cache_dir "$__cdist_target_host")" + mv "$__cdist_local_base_dir" \ + "$(__cdist_host_cache_dir "$__cdist_target_host")" +} diff --git a/core/__cdist_dir b/core/__cdist_dir new file mode 100755 index 00000000..32ee0075 --- /dev/null +++ b/core/__cdist_dir @@ -0,0 +1,46 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Push a directory to a target, both sides have the same name (i.e. explorers) +# or +# Pull a directory from a target, both sides have the same name (i.e. explorers) +# + +__cdist_dir() +{ + [ $# -eq 3 ] || __cdist_usage " " + + # ${3%/*} will be the destination directory, so no subdirectories + # of the same name are created, if the directory is already existing + + if [ "$1" = "push" ]; then + # FIXME: add error handling with __cdist_run_remote_... or so + ssh "${__cdist_remote_user}@${__cdist_target_host}" \ + "mkdir -p \"$3\"" + scp -qr "$2" \ + "${__cdist_remote_user}@${__cdist_target_host}:${3%/*}" + elif [ "$1" = "pull" ]; then + mkdir -p "$3" + scp -qr "${__cdist_remote_user}@${__cdist_target_host}:$2" \ + "${3%/*}" + else + __cdist_exit_err "Unknown action $1" + fi +} diff --git a/core/__cdist_dir_listing b/core/__cdist_dir_listing new file mode 100755 index 00000000..f4aa2320 --- /dev/null +++ b/core/__cdist_dir_listing @@ -0,0 +1,30 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# List files in a directory, if it exists +# +# We only create output, if there's at least one entry +# and can thus be used as a boolean ;-) +# + +__cdist_dir_listing() +{ + [ -d "$1" ] && ls -1 "$1" +} diff --git a/core/__cdist_echo b/core/__cdist_echo new file mode 100755 index 00000000..a89d1821 --- /dev/null +++ b/core/__cdist_echo @@ -0,0 +1,56 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# echo / syslog alike function +# + +__cdist_echo() +{ + __cdist_echo_type="$1"; shift + + set +u + if [ "$__cdist_object_self" ]; then + __cdist_echo_prefix="${__cdist_object_self}:" + else + __cdist_echo_prefix="core: " + fi + set -u + + case "$__cdist_echo_type" in + debug) + if [ "$__cdist_debug" = 1 ]; then + echo $__cdist_echo_prefix "DEBUG: $@" + fi + ;; + info) + echo $__cdist_echo_prefix "$@" + ;; + warn) + echo $__cdist_echo_prefix "Warning: $@" + ;; + error) + echo $__cdist_echo_prefix "Error: $@" >&2 + ;; + *) + echo "CORE BUG, who created the broken commit in $0?" >&2 + exit 23 + ;; + esac +} diff --git a/core/__cdist_exit_err b/core/__cdist_exit_err new file mode 100755 index 00000000..303dbf20 --- /dev/null +++ b/core/__cdist_exit_err @@ -0,0 +1,28 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Print error and exit (perror() alike) +# + +__cdist_exit_err() +{ + __cdist_echo error "$@" + exit 1 +} diff --git a/core/__cdist_explorer_run b/core/__cdist_explorer_run new file mode 100755 index 00000000..9e58fa09 --- /dev/null +++ b/core/__cdist_explorer_run @@ -0,0 +1,79 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Run explorers - FIXME: this function is ugly +# + +__cdist_explorer_run() +{ + [ $# -eq 5 ] || __cdist_usage " " + + # Ensure there is at least one explorer + num="$(ls -1 "$__cdist_explorer_dir" | wc -l)" + if [ "$num" -lt 1 ]; then + __cdist_exit_err "${__cdist_explorer_dir}: Contains no explorers" + fi + + # Check whether to setup variable for type explorer + case "$1" in + global) + ;; + type) + # FIXME: think about how and where this gets setup! + "$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\"" + ;; + esac + + # Transfer explorers + __cdist_dir push "$2" "$3" + + # Create output directory + __cdist_run_remote mkdir -p "$4" + + # Execute all explorers - FIXME: isolate cd call? + cd "$2"; + # FIXME: cleanup double variable, no need when in directory + for __cdist_explorer_run_explorer in *; do + __cdist_explorer_explorer_name="${__cdist_explorer_run_explorer##*/}" + + if [ -f "$__cdist_explorer_run_explorer" ]; then + if [ ! -x "$__cdist_explorer_run_explorer" ]; then + __cdist_exit_err "Explorer \"$__cdist_explorer_run_explorer\" exists, but is not executable." + fi + + else + if [ -e "$__cdist_explorer_run_explorer" ]; then + __cdist_exit_err "Explorer \"$__cdist_explorer_run_explorer\" exists, but is not a file." + fi + fi + + # FIXME: no need for remote out dir probably? + # or should we leave it and continue using __cdist_dir pull? + __cdist_run_remote \ + "export $__cdist_name_var_explorer=\"$__cdist_remote_explorer_dir\";" \ + "export $__cdist_name_var_global=\"$__cdist_remote_out_dir\";" \ + "$3/$__cdist_explorer_run_explorer" ">" \ + "$4/$__cdist_explorer_run_explorer" || \ + __cdist_exit_err "Explorer $__cdist_explorer_run_explorer failed." + done + + # Transfer results back + __cdist_dir pull "$4" "$5" +} diff --git a/core/__cdist_explorer_run_global b/core/__cdist_explorer_run_global new file mode 100755 index 00000000..27359713 --- /dev/null +++ b/core/__cdist_explorer_run_global @@ -0,0 +1,32 @@ +#!/bin/sh +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Copy & run the global explorers, i.e. not bound to types +# + +__cdist_explorer_run_global() +{ + __cdist_echo info "Running global explorers " + + # run the global explorers remotely + __cdist_explorer_run global \ + "$__cdist_explorer_dir" "$__cdist_remote_explorer_dir" \ + "$__cdist_remote_out_explorer_dir" "$__cdist_out_explorer_dir" +} diff --git a/core/__cdist_init_deploy b/core/__cdist_init_deploy new file mode 100755 index 00000000..4ac3168c --- /dev/null +++ b/core/__cdist_init_deploy @@ -0,0 +1,40 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Prepare deployment +# + +__cdist_init_deploy() +{ + __cdist_echo info "Creating clean directory structure " + + # Ensure there is no old stuff, neither local nor remote + rm -rf "$__cdist_local_base_dir" + ssh "${__cdist_remote_user}@${__cdist_target_host}" \ + "rm -rf ${__cdist_remote_base_dir}" + + # Init base + mkdir -p "$__cdist_local_base_dir" + ssh "${__cdist_remote_user}@${__cdist_target_host}" \ + "mkdir -p ${__cdist_remote_base_dir}" + + # Link configuration source directory - consistent with remote + ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir" +} diff --git a/core/__cdist_is_executable b/core/__cdist_is_executable new file mode 100755 index 00000000..a7a6d174 --- /dev/null +++ b/core/__cdist_is_executable @@ -0,0 +1,44 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Test whether something is executable (that should be executable) or +# is missing +# + +__cdist_is_executable() +{ + [ $# -eq 1 ] || __cdist_exit_err "" + + if [ -e "$1" ]; then + if [ -f "$1" ]; then + if [ -x "$1" ]; then + # Exists and is a correct executable + true + else + __cdist_exit_err "$1 exists, but is not executable." + fi + else + __cdist_exit_err "$1 exists, but is not a file." + fi + else + # Does not exist + false + fi +} diff --git a/core/__cdist_kill_on_interrupt b/core/__cdist_kill_on_interrupt new file mode 100644 index 00000000..7cb711fa --- /dev/null +++ b/core/__cdist_kill_on_interrupt @@ -0,0 +1,31 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Run the given command for each created object. +# + +# Does not work in children, will be called again in every script! +# Use only in interactive "front end" scripts +__cdist_kill_on_interrupt() +{ + __cdist_tmp_removal + kill 0 + exit 1 +} diff --git a/core/__cdist_manifest_run b/core/__cdist_manifest_run new file mode 100755 index 00000000..cf85d646 --- /dev/null +++ b/core/__cdist_manifest_run @@ -0,0 +1,53 @@ +#!/bin/sh +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Let's build a cconfig tree from a configuration +# And save it into the cache tree +# + +__cdist_manifest_run() +{ + [ $# -eq 1 ] || __cdist_usage "" + + __cdist_manifest="$1"; shift + + ################################################################################ + # Export information for cdist-type-emulator or manifest + # + + # Config dir should not get reset - FIXME: why did I do this? + export __cdist_conf_dir + + # Used to record the source in the object + export __cdist_manifest + + # Export information for manifests - __cdist_out_dir comes from cdist-config + export $__cdist_name_var_global="$__cdist_out_dir" + + ################################################################################ + # The actual run + # + + # Ensure binaries are existing - FIXME: move error handling into __cdist_type_build_emulation + __cdist_type_build_emulation \ + || __cdist_exit_err "Failed to build type emulation binaries" + + __cdist_run_shell "${__cdist_manifest}" +} diff --git a/core/__cdist_manifest_run_init b/core/__cdist_manifest_run_init new file mode 100755 index 00000000..e8fa63de --- /dev/null +++ b/core/__cdist_manifest_run_init @@ -0,0 +1,32 @@ +#!/bin/sh +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Let's build a cconfig tree from a configuration +# And save it into the cache tree +# + +__cdist_manifest_run_init() +{ + # FIXME: probably do not export but always set explicitly? + export $__cdist_name_var_manifest="$__cdist_manifest_dir" + + __cdist_echo info "Running initial manifest for $__cdist_target_host " + __cdist_manifest_run "$__cdist_manifest_init" +} diff --git a/core/__cdist_object_all b/core/__cdist_object_all new file mode 100755 index 00000000..965d08f6 --- /dev/null +++ b/core/__cdist_object_all @@ -0,0 +1,60 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Run the given command for each created object. +# + +__cdist_object_all() +{ + [ $# -eq 1 ] || __cdist_usage "" + + __cdist_object_all_object_all_command="$1"; shift + + __cdist_object_all_object_all_objects="$__cdist_tmp_dir/objects" + + # Ensure object dir exists, so marker can be created + mkdir -p "${__cdist_out_object_dir}" + + # FIXME: : - why do we use a file? + # core/__cdist_object_manifest_run: touch "$__cdist_objects_created" + + # Loop until we do not create new objects anymore + # which is equal to all objects have been run + touch "$__cdist_objects_created" + while [ -f "$__cdist_objects_created" ]; do + # Assume we're done after this run + rm "$__cdist_objects_created" + + # Get listing of objects + __cdist_object_list "$__cdist_out_object_dir" > \ + "$__cdist_object_all_object_all_objects" + + # NEED TO CREATE ARRAY, SSH DESTROYS WHILE READ LOOP + while read __cdist_object_all_object; do + set -- "$@" "$__cdist_object_all_object" + done < "$__cdist_object_all_object_all_objects" + + while [ $# -gt 0 ]; do + __cdist_object_all_object="$1"; shift + $__cdist_object_all_object_all_command "$__cdist_object_all_object" + done + done +} diff --git a/core/__cdist_object_code_run b/core/__cdist_object_code_run new file mode 100755 index 00000000..8af67ab8 --- /dev/null +++ b/core/__cdist_object_code_run @@ -0,0 +1,54 @@ +#!/bin/sh +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Exec the code for the given object locally and remote +# + +__cdist_object_code_run() +{ + [ $# -eq 1 ] || __cdist_exit_err "" + + + if [ ! -d "$(__cdist_object_dir "$1")" ]; then + __cdist_exit_err "Object undefined" + fi + + # Code local + export __cdist_out_object_dir="$__cdist_out_object_dir" + __cdist_echo debug "Trying to run local code" + if __cdist_is_executable \ + "$(__cdist_object_code "$1" "${__cdist_name_gencode_local}")"; then + __cdist_run_shell \ + "$(__cdist_object_code "$1" "${__cdist_name_gencode_local}")" + else + __cdist_echo debug "Local code: none" + fi + + # Code remote + __cdist_echo debug "Trying to run remote code" + if __cdist_is_executable \ + "$(__cdist_object_code "$1" "${__cdist_name_gencode_remote}")"; then + + __cdist_run_remote $(__cdist_remote_object_code "$1") + else + __cdist_echo debug "Remote code: none" + fi +} diff --git a/core/__cdist_object_explorer_run b/core/__cdist_object_explorer_run new file mode 100755 index 00000000..da59d6c3 --- /dev/null +++ b/core/__cdist_object_explorer_run @@ -0,0 +1,89 @@ +#!/bin/sh +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Run the explorers for the given object on the target host. +# + +# FIXME: many cleanups needed before going production! + +__cdist_object_explorer_run() +{ + __cdist_object_self="$1"; shift + + __cdist_object_id="$(__cdist_object_id_from_object "$__cdist_object_self")" + __cdist_type="$(__cdist_type_from_object "$__cdist_object_self")" + + # Check if type of object has >= 1 explorer + __cdist_has_explorer="$(__cdist_dir_listing "$(__cdist_type_explorer_dir "$__cdist_type")" | wc -l)" + # Run the type explorers for the current object if any + if [ "$__cdist_has_explorer" -ge 1 ]; then + if ! __cdist_type_explorer_pushed "$__cdist_type"; then + # FIXME: variables! + src_dir="$(__cdist_type_explorer_dir "$__cdist_type")" + dst_dir="$(__cdist_remote_type_explorer_dir "$__cdist_type")" + __cdist_echo info "Transfering explorers for $__cdist_type " + __cdist_dir push "$src_dir" "$dst_dir" + __cdist_type_explorer_pushed_add "$__cdist_type" + fi + + __cdist_echo info "Running explorers" + # Copy object parameters + __cdist_dir push \ + "$(__cdist_object_parameter_dir "$__cdist_object_self")" \ + "$(__cdist_remote_object_parameter_dir "$__cdist_object_self")" + + # Execute explorers + # FIXME: STOPPED: + # - remove cdist-remote-explorer-run + # - problem: new variables / need to run explorer directly? + # -> or put logic into __cdist_explorer_run + # -> think about having _one_ wrapper script for remote to execute + # shell functions + + # Create remote output directory + __cdist_run_remote mkdir -p "$(__cdist_remote_object_type_explorer_dir "$__cdist_object_self")" + + cd "$(__cdist_type_explorer_dir "$__cdist_type")" + + + for __cdist_object_explorer_run_explorer in *; do + __cdist_run_remote \ + "$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\"" \ + "$__cdist_name_var_object_id=\"$__cdist_object_id\"" \ + "$__cdist_name_var_self=\"$__cdist_object_self\"" \ + "$(__cdist_remote_type_explorer_dir "$__cdist_type")/$__cdist_object_explorer_run_explorer" \ + ">" "$(__cdist_remote_object_type_explorer_dir "$__cdist_object_self")/$__cdist_object_explorer_run_explorer" + done + +# __cdist_run_remote \ +# "$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\"" \ +# "$__cdist_name_var_object_id=\"$__cdist_object_id\"" \ +# "$__cdist_name_var_self=\"$__cdist_object_self\"" \ +# cdist-remote-explorer-run \ +# "$__cdist_name_var_type_explorer" \ +# "$(__cdist_remote_type_explorer_dir "$__cdist_type")" \ +# "$(__cdist_remote_object_type_explorer_dir "$__cdist_object_self")" + + # Copy back results + __cdist_dir pull "$(__cdist_remote_object_type_explorer_dir "$__cdist_object_self")" \ + "$(__cdist_object_type_explorer_dir "$__cdist_object_self")" + fi +} diff --git a/core/__cdist_object_gencode b/core/__cdist_object_gencode new file mode 100755 index 00000000..08ef8b7d --- /dev/null +++ b/core/__cdist_object_gencode @@ -0,0 +1,66 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Generate code from one object (object must be relative path!) +# WARNING: OUTPUT ON STDOUT, ERRORS NEED TO BE ON STDERR! +# + +# FIXME: check variable names: +# either prefix or use global or use functions directly +# functions looks good, they are cheap anyway! + +__cdist_object_gencode() +{ + [ $# -eq 2 ] || __cdist_usage "" "" + + __cdist_object_self="$1"; shift + __cdist_gencode_type="$1"; shift + + __cdist_type="$(__cdist_type_from_object "$__cdist_object_self")" + __cdist_type_gencode="$(__cdist_type_gencode "$__cdist_type" "$__cdist_gencode_type")" + __cdist_code_output="$(__cdist_object_code "$__cdist_object_self" "$__cdist_gencode_type")" + + # export variables for the gencode script + export __object_id="$(__cdist_object_id_from_object "$__cdist_object_self")" + export __object="$(__cdist_object_dir "$__cdist_object_self")" + export __global="$__cdist_out_dir" + + if [ -x "$__cdist_type_gencode" ]; then + __cdist_run_shell "$__cdist_type_gencode" > "$__cdist_tmp_file" + else + if [ -e "$__cdist_type_gencode" ]; then + __cdist_exit_err "$__cdist_type_gencode exists, but is not executable" + fi + + # Ensure it's empty, if there is no gencode + : > "$__cdist_tmp_file" + fi + + # Only create code, if gencode created output + if [ "$(wc -l < "$__cdist_tmp_file")" -gt 0 ]; then + cat - "$__cdist_tmp_file" << eof > "$__cdist_code_output" +# +# The following code was generated by $__cdist_type_gencode +# + +eof + chmod u+x "${__cdist_code_output}" + fi +} diff --git a/core/__cdist_object_gencode_run b/core/__cdist_object_gencode_run new file mode 100755 index 00000000..308f5f33 --- /dev/null +++ b/core/__cdist_object_gencode_run @@ -0,0 +1,36 @@ +#!/bin/sh +# +# 2010 Nico Schottelius (nico-cdist at schottelius.org) +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# For the given object create the code to be executed on the target. +# + +__cdist_object_gencode_run() +{ + __cdist_object_gencode_run_object="$1"; shift + + __cdist_echo info "Generating local code " + __cdist_object_gencode "$__cdist_object_gencode_run_object" \ + "${__cdist_name_gencode_local}" + + __cdist_echo info "Generating remote code " + __cdist_object_gencode "$__cdist_object_gencode_run_object" \ + "${__cdist_name_gencode_remote}" +} diff --git a/core/__cdist_object_list b/core/__cdist_object_list new file mode 100755 index 00000000..f2785c30 --- /dev/null +++ b/core/__cdist_object_list @@ -0,0 +1,36 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Print error and exit (perror() alike) +# + +__cdist_object_list() +{ + # FIXME: no local in posix + local basedir="$1"; shift + + # Use subshell to prevent changing cwd in program + ( + cd "${basedir}" + + find . -name "$__cdist_name_dot_cdist" | \ + sed -e 's;^./;;' -e "s;/${__cdist_name_dot_cdist}\$;;" + ) +} diff --git a/core/__cdist_object_manifest_run b/core/__cdist_object_manifest_run new file mode 100755 index 00000000..efc85539 --- /dev/null +++ b/core/__cdist_object_manifest_run @@ -0,0 +1,59 @@ +#!/bin/sh +# +# 2010 Nico Schottelius (nico-cdist at schottelius.org) +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Run the manifest for the given object. +# + + +__cdist_object_manifest_run() +{ + [ $# -eq 1 ] || __cdist_usage "" + + __cdist_object_self="$1"; shift + + # FIXME: rename to __cdist_object_dir (everywhere!) + __cdist_cur_object_dir="$(__cdist_object_dir "$__cdist_object_self")" + __cdist_object_id="$(__cdist_object_id_from_object "$__cdist_object_self")" + + __cdist_echo info "Checking manifest " + + __cdist_type="$(__cdist_type_from_object "$__cdist_object_self")" + __cdist_manifest="$(__cdist_type_manifest "$__cdist_type")" + + if [ -f "$__cdist_manifest" ]; then + if [ -x "$__cdist_manifest" ]; then + # Make __cdist_manifest available for cdist-type-emulator + export __cdist_manifest + + __cdist_echo info "Executing manifest " + export $__cdist_name_var_object="$__cdist_cur_object_dir" + export $__cdist_name_var_object_id="$__cdist_object_id" + export $__cdist_name_var_type="$(__cdist_type_dir "$__cdist_type")" + + __cdist_manifest_run "$__cdist_manifest" + + # Tell cdist-object-run-all that there may be new objects + touch "$__cdist_objects_created" + else + __cdist_exit_err "${__cdist_manifest} needs to be executable." + fi + fi +} diff --git a/core/__cdist_object_prepare b/core/__cdist_object_prepare new file mode 100755 index 00000000..24039be0 --- /dev/null +++ b/core/__cdist_object_prepare @@ -0,0 +1,47 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# For the given object: +# - run type explorers +# - run type manifest +# + +__cdist_object_prepare() +{ + [ $# -eq 1 ] || __cdist_usage "" + + __cdist_object_self="$1"; shift + __cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")" + [ -d "$__cdist_object_dir" ] || __cdist_exit_err "Object undefined" + + # Export to non-core for use in manifest and gencode scripts + export $__cdist_name_var_self=$__cdist_object_self + + __cdist_object_prepared="$(__cdist_object_prepared "$__cdist_object_self")" + if [ ! -f "$__cdist_object_prepared" ]; then + __cdist_echo info "Preparing object" + __cdist_object_explorer_run "$__cdist_object_self" + __cdist_object_manifest_run "$__cdist_object_self" + + # Mark this object as prepared + touch "$__cdist_object_prepared" + fi +} diff --git a/core/__cdist_object_run b/core/__cdist_object_run new file mode 100755 index 00000000..d2c7df6e --- /dev/null +++ b/core/__cdist_object_run @@ -0,0 +1,74 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# For the given object: +# - run type explorers +# - run type manifest +# - generate code +# - copy object to target +# - execute code on target +# + +__cdist_object_run() +{ + [ $# -eq 1 ] || __cdist_usage "" + + __cdist_object_self="$1"; shift + __cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")" + [ -d "$__cdist_object_dir" ] || __cdist_exit_err "Object undefined" + + # Export to non-core for use in manifest and gencode scripts + export $__cdist_name_var_self=$__cdist_object_self + + # FIXME: BUG: should be named differently! + # FIXME: BUG: I can be called recursively! -> variables are probably already set / overwritten! + __cdist_object_finished="$(__cdist_object_finished "$__cdist_object_self")" + if [ ! -f "$__cdist_object_finished" ]; then + # Resolve dependencies, if any + __cdist_object_require="$(__cdist_object_require "$__cdist_object_self")" + if [ -f "$__cdist_object_require" ]; then + # NEED TO CREATE ARRAY, SSH DESTROYS WHILE READ LOOP + while read __cdist_requirement; do + set -- "$@" "$__cdist_requirement" + done < "$__cdist_object_require" + + while [ $# -gt 0 ]; do + __cdist_requirement="$1"; shift + __cdist_echo info "Resolving requirement $__cdist_requirement" + # FIXME: BUG: at this point, the other __cdist_object_run may have + # overwritten all our variables! + __cdist_object_run "$__cdist_requirement" + done + fi + + __cdist_echo debug "Before gencode" + __cdist_object_gencode_run "$__cdist_object_self" + __cdist_echo debug "Before push" + __cdist_dir push "$(__cdist_object_dir "$__cdist_object_self")" \ + "$(__cdist_remote_object_dir "$__cdist_object_self")" + __cdist_echo debug "Before run" + __cdist_object_code_run "$__cdist_object_self" + __cdist_echo debug "Object run done" + + # Mark this object as done + touch "$__cdist_object_finished" + fi +} diff --git a/core/__cdist_run b/core/__cdist_run new file mode 100755 index 00000000..8febe550 --- /dev/null +++ b/core/__cdist_run @@ -0,0 +1,27 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Exit if an error occurs running something +# + +__cdist_run() +{ + "$@" || __cdist_echo error "$1 exited non-zero, aborting." +} diff --git a/core/__cdist_run_remote b/core/__cdist_run_remote new file mode 100755 index 00000000..17074049 --- /dev/null +++ b/core/__cdist_run_remote @@ -0,0 +1,32 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Run a cdist binary on the remote side +# + +__cdist_run_remote() +{ + [ $# -ge 1 ] || __cdist_usage " [opts]" + + ssh "${__cdist_remote_user}@${__cdist_target_host}" \ + "export PATH=\"${__cdist_remote_bin_dir}:\$PATH\";" \ + "export __cdist_out_object_dir=\"$__cdist_remote_out_object_dir\";" \ + "$@" +} diff --git a/core/__cdist_run_shell b/core/__cdist_run_shell new file mode 100755 index 00000000..b6e0a57d --- /dev/null +++ b/core/__cdist_run_shell @@ -0,0 +1,34 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Exit if an error occurs when running a shell script +# + +__cdist_run_shell() +{ + # Prepend our path, so all cdist tools come before other tools + PATH="${__cdist_out_type_bin_dir}:$PATH" sh -e "$@" + if [ "$?" -ne 0 ]; then + __cdist_echo error "$1 exited non-zero" + __cdist_echo warn "Faulty code:" + cat "$1" + __cdist_exit_err "Aborting due to non-zero exit code." + fi +} diff --git a/core/__cdist_tmp_removal b/core/__cdist_tmp_removal new file mode 100755 index 00000000..74d74936 --- /dev/null +++ b/core/__cdist_tmp_removal @@ -0,0 +1,27 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Remove tmp dir +# + +__cdist_tmp_removal() +{ + rm -rf "${__cdist_tmp_dir}" +} diff --git a/core/__cdist_type_build_emulation b/core/__cdist_type_build_emulation new file mode 100755 index 00000000..3c7270ca --- /dev/null +++ b/core/__cdist_type_build_emulation @@ -0,0 +1,49 @@ +#!/bin/sh +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# Build pseudo binaries for type emulation +# + +__cdist_type_build_emulation() +{ + [ $# -eq 0 ] || __cdist_usage "No arguments" + + [ -f "${__cdist_out_type_bin_dir}/.marker" ] && return 0 + + __cdist_type_emulator="$__cdist_abs_mydir/cdist-type-emulator" + + if [ ! -d "${__cdist_type_dir}" ]; then + __cdist_exit_err "$__cdist_type_dir must exist and contain available types" + fi + + # Get Types + ( + cd "${__cdist_type_dir}" + ls -1 > "${__cdist_tmp_file}" + ) + + # Create binaries + mkdir -p "${__cdist_out_type_bin_dir}" + while read __cdist_type_build_emulation_type; do + ln -sf "${__cdist_type_emulator}" \ + "${__cdist_out_type_bin_dir}/${__cdist_type_build_emulation_type}" + done < "${__cdist_tmp_file}" + + touch "${__cdist_out_type_bin_dir}/.marker" +} diff --git a/core/__cdist_usage b/core/__cdist_usage new file mode 100755 index 00000000..9dfa30e4 --- /dev/null +++ b/core/__cdist_usage @@ -0,0 +1,27 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Print error and exit (perror() alike) +# + +__cdist_usage() +{ + __cdist_exit_err "$__cdist_myname: $@" +} From 34bb39193707b4f8a6e84db36bcc38801fa3f954 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 01:01:25 +0200 Subject: [PATCH 0025/1024] +header Signed-off-by: Nico Schottelius --- bin/cdist | 425 ++---------------------------------------------------- 1 file changed, 13 insertions(+), 412 deletions(-) mode change 100644 => 100755 bin/cdist diff --git a/bin/cdist b/bin/cdist old mode 100644 new mode 100755 index a70a11f8..31d7411b --- a/bin/cdist +++ b/bin/cdist @@ -1,4 +1,4 @@ -#!python3 +#!/usr/bin/env python3 # # 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) # @@ -19,420 +19,21 @@ # # -__cdist_version="1.7.0" +import sys # argv -# Fail if something bogus is going on -set -u +__cdist_version="2.0.0" -################################################################################ -# cconf standard vars prefixed with cdist +def cdist_echo(type, *args): + """Ignore type for now, support later""" + print(*args) -__cdist_pwd="$(pwd -P)" -__cdist_mydir="${0%/*}"; -__cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)" -__cdist_myname=${0##*/}; -__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" +def cdist_deploy_to(hostname): + """Mimic the old deploy to: Deploy to one host""" + cdist_echo("info", "Deploying to host", hostname) -################################################################################ -# Names / Constants -# -# Most values can be overriden from outside, so you can -# customise paths as you like (for distributors, geeks and hackers) -# -: ${__cdist_name_bin:=bin} -: ${__cdist_name_cache:=cache} -: ${__cdist_name_code:=code} -: ${__cdist_name_conf_dir:=conf} -: ${__cdist_name_dot_cdist:=.cdist} -: ${__cdist_name_explorer:=explorer} -: ${__cdist_name_gencode:=gencode} -: ${__cdist_name_gencode_local:=local} -: ${__cdist_name_gencode_remote:=remote} -: ${__cdist_name_global:=global} -: ${__cdist_name_host:=host} -: ${__cdist_name_init:=init} -: ${__cdist_name_manifest:=manifest} -: ${__cdist_name_object:=object} -: ${__cdist_name_object_finished:=done} -: ${__cdist_name_object_prepared:=prepared} -: ${__cdist_name_object_id:=object_id} -: ${__cdist_name_object_source:=source} -: ${__cdist_name_objects_created:=.objects_created} -: ${__cdist_name_out_dir:=out} -: ${__cdist_name_parameter:=parameter} -: ${__cdist_name_parameter_required:=required} -: ${__cdist_name_parameter_optional:=optional} -: ${__cdist_name_require:=require} -: ${__cdist_name_self:=self} -: ${__cdist_name_singleton:=singleton} -: ${__cdist_name_target_host:=target_host} -: ${__cdist_name_target_user:=target_user} -: ${__cdist_name_type:=type} -: ${__cdist_name_type_bin:=type_bin} -: ${__cdist_name_type_explorer:=type_explorer} -: ${__cdist_name_type_explorer_pushed:=.explorer_pushed} +if __name__ == "__main__": + hostname=sys.argv[1] + cdist_echo("info", "cdist", __cdist_version, ": Configuring host", hostname) + cdist_deploy_to(hostname) -# Used for IDs: Allow everything not starting with - and . -: ${__cdist_sane_regexp:=[^-\.].*} - -# Default remote user -: ${__cdist_remote_user:=root} - - -################################################################################ -# Exported variable names (usable for non core -# -: ${__cdist_name_var_explorer:=__$__cdist_name_explorer} -: ${__cdist_name_var_type_explorer:=__$__cdist_name_type_explorer} -: ${__cdist_name_var_global:=__$__cdist_name_global} -: ${__cdist_name_var_manifest:=__$__cdist_name_manifest} -: ${__cdist_name_var_target_host:=__$__cdist_name_target_host} -: ${__cdist_name_var_target_user:=__$__cdist_name_target_user} -: ${__cdist_name_var_object:=__$__cdist_name_object} -: ${__cdist_name_var_object_id:=__$__cdist_name_object_id} -: ${__cdist_name_var_self:=__$__cdist_name_self} -: ${__cdist_name_var_type:=__$__cdist_name_type} - - -################################################################################ -# Tempfiles -# -: ${__cdist_tmp_base_dir=/tmp} -__cdist_tmp_dir=$(mktemp -d "$__cdist_tmp_base_dir/cdist.XXXXXXXXXXXX") -__cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX") - -################################################################################ -# Local Base -# -: ${__cdist_local_base_dir:=$__cdist_tmp_dir} - -# Cache may *NOT* be below __cdist_local_base_dir! -: ${__cdist_local_base_cache_dir:=$__cdist_abs_mydir/../$__cdist_name_cache} - -: ${__cdist_conf_dir:="$(cd "$__cdist_abs_mydir/../conf" && pwd -P)"} - -: ${__cdist_explorer_dir:=$__cdist_conf_dir/$__cdist_name_explorer} -: ${__cdist_manifest_dir:=$__cdist_conf_dir/$__cdist_name_manifest} -: ${__cdist_manifest_init:=$__cdist_manifest_dir/$__cdist_name_init} -: ${__cdist_type_dir:=$__cdist_conf_dir/$__cdist_name_type} - -################################################################################ -# Local output -# -: ${__cdist_out_dir:=$__cdist_local_base_dir/$__cdist_name_out_dir} -: ${__cdist_out_explorer_dir:=$__cdist_out_dir/$__cdist_name_explorer} -: ${__cdist_out_object_dir:=$__cdist_out_dir/$__cdist_name_object} -: ${__cdist_out_type_dir:=$__cdist_out_dir/$__cdist_name_type} -: ${__cdist_out_type_bin_dir:=$__cdist_out_dir/$__cdist_name_type_bin} - -: ${__cdist_objects_created:=$__cdist_out_object_dir/$__cdist_name_objects_created} - -################################################################################ -# Remote base -# -: ${__cdist_remote_base_dir:=/var/lib/cdist} -: ${__cdist_remote_bin_dir:=$__cdist_remote_base_dir/$__cdist_name_bin} -: ${__cdist_remote_conf_dir:=$__cdist_remote_base_dir/$__cdist_name_conf_dir} - -: ${__cdist_remote_explorer_dir:=$__cdist_remote_conf_dir/$__cdist_name_explorer} -: ${__cdist_remote_type_dir:=$__cdist_remote_conf_dir/$__cdist_name_type} - -################################################################################ -# Remote output -# -: ${__cdist_remote_out_dir:=$__cdist_remote_base_dir/$__cdist_name_out_dir} -: ${__cdist_remote_out_explorer_dir:=$__cdist_remote_out_dir/$__cdist_name_explorer} -: ${__cdist_remote_out_object_dir:=$__cdist_remote_out_dir/$__cdist_name_object} - - -################################################################################ -# Internal functions -# -__cdist_echo() -{ - __cdist_echo_type="$1"; shift - - set +u - if [ "$__cdist_object_self" ]; then - __cdist_echo_prefix="${__cdist_object_self}:" - else - __cdist_echo_prefix="core: " - fi - set -u - - case "$__cdist_echo_type" in - debug) - set +u - if [ "$__cdist_debug" ]; then - echo $__cdist_echo_prefix "Debug: $@" - fi - set -u - ;; - info) - echo $__cdist_echo_prefix "$@" - ;; - warn) - echo $__cdist_echo_prefix "Warning: $@" - ;; - error) - echo $__cdist_echo_prefix "Error: $@" >&2 - ;; - *) - echo "CORE BUG, who created the broken commit in $0?" >&2 - exit 23 - ;; - esac -} - -__cdist_exec_fail_on_error() -{ - set +e - sh -e "$@" - if [ "$?" -ne 0 ]; then - __cdist_echo error "$1 exited non-zero" - __cdist_echo warn "Faulty code:" - cat "$1" - __cdist_exit_err "Aborting due to non-zero exit code." - fi -} - -__cdist_exit_err() -{ - __cdist_echo error "$@" - exit 1 -} - -__cdist_usage() -{ - __cdist_exit_err "$__cdist_myname: $@" -} - -__cdist_init_deploy() -{ - __cdist_echo info "Creating clean directory structure " - - # Ensure there is no old stuff, neither local nor remote - rm -rf "$__cdist_local_base_dir" - ssh "${__cdist_remote_user}@$1" "rm -rf ${__cdist_remote_base_dir}" - - # Init base - mkdir -p "$__cdist_local_base_dir" - ssh "${__cdist_remote_user}@$1" "mkdir -p ${__cdist_remote_base_dir}" - - # Link configuration source directory - consistent with remote - ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir" -} - -################################################################################ -# Cache -# -__cdist_cache_dir() -{ - cd "${__cdist_local_base_cache_dir}" && pwd -P -} - -__cdist_host_cache_dir() -{ - echo "$(__cdist_cache_dir)/$1" -} - -################################################################################ -# Object -# - -__cdist_object_code() -{ - echo "$(__cdist_object_dir "$1")/${__cdist_name_code}-$2" -} - -__cdist_object_prepared() -{ - echo "$(__cdist_object_dir "$1")/${__cdist_name_object_prepared}" -} - -__cdist_object_finished() -{ - echo "$(__cdist_object_dir "$1")/${__cdist_name_object_finished}" -} - -__cdist_object_dir() -{ - echo "$(__cdist_object_base_dir "$1")/${__cdist_name_dot_cdist}" -} - -__cdist_object_base_dir() -{ - echo "${__cdist_out_object_dir}/$1" -} - - -__cdist_object_id_from_object() -{ - echo "${1#*/}" -} - -# Find objects, remove ./ and /MARKER -__cdist_object_list() -{ - local basedir="$1"; shift - - # Use subshell to prevent changing cwd in program - ( - cd "${basedir}" - - find . -name "$__cdist_name_dot_cdist" | \ - sed -e 's;^./;;' -e "s;/${__cdist_name_dot_cdist}\$;;" - ) -} - -__cdist_object_parameter_dir() -{ - echo "$(__cdist_object_dir "$1")/${__cdist_name_parameter}" -} - -__cdist_object_require() -{ - echo "$(__cdist_object_dir "$1")/${__cdist_name_require}" -} - -__cdist_object_source_name() -{ - echo "$1/${__cdist_name_object_source}" -} - -__cdist_object_source() -{ - cat "$(__cdist_object_source_name "$1")" -} - -__cdist_object_source_add() -{ - echo "$__cdist_manifest" >> "$(__cdist_object_source_name "$1")" -} - -__cdist_object_type_explorer_dir() -{ - echo "$(__cdist_object_dir "$1")/${__cdist_name_explorer}" -} - -################################################################################ -# Remote -# - -__cdist_remote_object_base_dir() -{ - echo "${__cdist_remote_out_object_dir}/$1" -} - -__cdist_remote_object_dir() -{ - echo "$(__cdist_remote_object_base_dir "$1")/${__cdist_name_dot_cdist}" -} - -__cdist_remote_object_parameter_dir() -{ - echo "$(__cdist_remote_object_dir "$1")/${__cdist_name_parameter}" -} - -__cdist_remote_object_type_explorer_dir() -{ - echo "$(__cdist_remote_object_dir "$1")/${__cdist_name_explorer}" -} - - -__cdist_remote_type_explorer_dir() -{ - echo "${__cdist_remote_type_dir}/$1/${__cdist_name_explorer}" -} - - -################################################################################ -# Traps -# -__cdist_tmp_removal() -{ - rm -rf "${__cdist_tmp_dir}" -} - -# Does not work in children, will be called again in every script! -# Use only in interactive "front end" scripts -__cdist_kill_on_interrupt() -{ - __cdist_tmp_removal - kill 0 - exit 1 -} - -# Remove tempfiles at normal exit -trap __cdist_tmp_removal EXIT - - -################################################################################ -# Type -# -__cdist_type_dir() -{ - echo "${__cdist_type_dir}/$1" -} - -__cdist_type_explorer_dir() -{ - echo "${__cdist_type_dir}/$1/${__cdist_name_explorer}" -} - -__cdist_type_from_object() -{ - echo "${1%%/*}" -} - -__cdist_type_has_explorer() -{ - # We only create output, if there's at least one explorer - # and can thus be used as a boolean ;-) - if [ -d "$(__cdist_type_explorer_dir "$1")" ]; then - ls -1 "$(__cdist_type_explorer_dir "$1")" - fi -} - -__cdist_type_explorer_pushed() -{ - [ -f "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" ] \ - && grep -q "$1" "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" -} - -__cdist_type_explorer_pushed_add() -{ - [ -d "$__cdist_out_type_dir" ] || mkdir "$__cdist_out_type_dir" - echo "$1" >> "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" -} - -__cdist_type_gencode() -{ - echo "${__cdist_type_dir}/$1/${__cdist_name_gencode}-$2" -} - -__cdist_type_manifest() -{ - echo "${__cdist_type_dir}/$1/${__cdist_name_manifest}" -} - -__cdist_type_parameter_dir() -{ - echo "$(__cdist_type_dir "$1")/${__cdist_name_parameter}" -} - -__cdist_type_parameter_optional() -{ - echo "$(__cdist_type_parameter_dir "$1")/$__cdist_name_parameter_optional" -} - -__cdist_type_parameter_required() -{ - echo "$(__cdist_type_parameter_dir "$1")/$__cdist_name_parameter_required" -} - -__cdist_type_singleton() -{ - echo "${__cdist_type_dir}/$1/${__cdist_name_singleton}" -} From 4f7fa6b8924ec1dc8651382a8d35fe532075f39e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 01:10:37 +0200 Subject: [PATCH 0026/1024] +/- todo Signed-off-by: Nico Schottelius --- core/__cdist_init_deploy | 40 ---------------------------------------- doc/dev/todo/niconext | 28 ++-------------------------- 2 files changed, 2 insertions(+), 66 deletions(-) delete mode 100755 core/__cdist_init_deploy diff --git a/core/__cdist_init_deploy b/core/__cdist_init_deploy deleted file mode 100755 index 4ac3168c..00000000 --- a/core/__cdist_init_deploy +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Prepare deployment -# - -__cdist_init_deploy() -{ - __cdist_echo info "Creating clean directory structure " - - # Ensure there is no old stuff, neither local nor remote - rm -rf "$__cdist_local_base_dir" - ssh "${__cdist_remote_user}@${__cdist_target_host}" \ - "rm -rf ${__cdist_remote_base_dir}" - - # Init base - mkdir -p "$__cdist_local_base_dir" - ssh "${__cdist_remote_user}@${__cdist_target_host}" \ - "mkdir -p ${__cdist_remote_base_dir}" - - # Link configuration source directory - consistent with remote - ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir" -} diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 28762ef4..a59f909f 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,26 +1,2 @@ -Catch broken instances in cdist-mass-deploy -p and report broken deployements at the end! - - --------------------------------------------------------------------------------- -Bug with requirements when indirect requires is scheduled late: - -__package/collectd: Generating local code -__package/collectd: Generating remote code -__package/collectd: Transferring object -__package/collectd: Checking code-local -__package/collectd: Checking code-remote -__file/etc/collectd/collectd.conf: Generating local code -__file/etc/collectd/collectd.conf: Generating remote code -__file/etc/collectd/collectd.conf: Transferring object -__file/etc/collectd/collectd.conf: Checking code-local -__file/etc/collectd/collectd.conf: Executing code-local -scp: /etc/collectd/collectd.conf: No such file or directory -__file/etc/collectd/collectd.conf: Error: /tmp/cdist.PYKFWmj9QknE/out/object/__file/etc/collectd/collectd.conf/.cdist/code-local exited non-zero -__file/etc/collectd/collectd.conf: Warning: Faulty code: -# -# The following code was generated by /home/users/nico/oeffentlich/rechner/projekte/cdist-nutzung/conf/type/__file/gencode-local -# - -scp /home/users/nico/oeffentlich/rechner/projekte/cdist-nutzung/conf/type/__ethz_collectd/files/collectd.conf.client root@shrek08:/etc/collectd/collectd.conf -__file/etc/collectd/collectd.conf: Error: Aborting due to non-zero exit code. - +- rewrite in python? +- support non-ssh access? From 9711a5612d359919ff0a254042c4fec4ba17f1ca Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 01:21:15 +0200 Subject: [PATCH 0027/1024] partly implement run_or_fail, init_deploy Signed-off-by: Nico Schottelius --- bin/cdist | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index 31d7411b..233e6fee 100755 --- a/bin/cdist +++ b/bin/cdist @@ -20,20 +20,51 @@ # import sys # argv +import subprocess # execute stuff __cdist_version="2.0.0" -def cdist_echo(type, *args): +def logger(type, *args): """Ignore type for now, support later""" print(*args) +def exit_error(*args): + logger(*args) + sys.exit(1) + + +def run_or_fail(*args): + try: + subprocess.check_call(*args) + except CalledProcessError: + exit_error("Command failed:", *args) + + def cdist_deploy_to(hostname): """Mimic the old deploy to: Deploy to one host""" - cdist_echo("info", "Deploying to host", hostname) + logger("info", "Deploying to host", hostname) + + +def init_deploy(): + logger("info", "Creating clean directory structure") + + # Ensure there is no old stuff, neither local nor remote + run_or_fail(["echo rm -rf", "$__cdist_local_base_dir"]) + +# ssh "${__cdist_remote_user}@${__cdist_target_host}" \ +# "rm -rf ${__cdist_remote_base_dir}" +# +# # Init base +# mkdir -p "$__cdist_local_base_dir" +# ssh "${__cdist_remote_user}@${__cdist_target_host}" \ +# "mkdir -p ${__cdist_remote_base_dir}" +# +# # Link configuraion source directory - consistent with remote +# ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir" if __name__ == "__main__": hostname=sys.argv[1] - cdist_echo("info", "cdist", __cdist_version, ": Configuring host", hostname) + logger("info", "cdist", __cdist_version, ": Configuring host", hostname) cdist_deploy_to(hostname) From a90751dcff360e6ba2ceb5902ba90f43bdc6686e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 01:36:22 +0200 Subject: [PATCH 0028/1024] begin to implmenent remote execution Signed-off-by: Nico Schottelius --- bin/cdist | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 233e6fee..d680eaa6 100755 --- a/bin/cdist +++ b/bin/cdist @@ -34,25 +34,34 @@ def exit_error(*args): def run_or_fail(*args): + newargs = ["echo"] + newargs.extend(*args) + try: - subprocess.check_call(*args) + subprocess.check_call(newargs) except CalledProcessError: - exit_error("Command failed:", *args) + exit_error("Command failed:", newargs) + +def remote_run_or_fail(hostname, *args): + newargs = ["ssh", hostname] + newargs.extend(*args) + + run_or_fail(newargs) def cdist_deploy_to(hostname): """Mimic the old deploy to: Deploy to one host""" logger("info", "Deploying to host", hostname) + init_deploy(hostname) -def init_deploy(): +def init_deploy(hostname): logger("info", "Creating clean directory structure") # Ensure there is no old stuff, neither local nor remote - run_or_fail(["echo rm -rf", "$__cdist_local_base_dir"]) + run_or_fail(["echo", "rm -rf", "$__cdist_local_base_dir"]) -# ssh "${__cdist_remote_user}@${__cdist_target_host}" \ -# "rm -rf ${__cdist_remote_base_dir}" + remote_run_or_fail(hostname, ["rm -rf", "${__cdist_remote_base_dir}"]) # # # Init base # mkdir -p "$__cdist_local_base_dir" From 89964b32dd70c587f2b94ef9a4e027680ffb1274 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 01:41:54 +0200 Subject: [PATCH 0029/1024] in theory, init_deploy is done Signed-off-by: Nico Schottelius --- bin/cdist | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bin/cdist b/bin/cdist index d680eaa6..2ff2e011 100755 --- a/bin/cdist +++ b/bin/cdist @@ -59,17 +59,16 @@ def init_deploy(hostname): logger("info", "Creating clean directory structure") # Ensure there is no old stuff, neither local nor remote - run_or_fail(["echo", "rm -rf", "$__cdist_local_base_dir"]) + run_or_fail(["rm -rf", "$__cdist_local_base_dir"]) remote_run_or_fail(hostname, ["rm -rf", "${__cdist_remote_base_dir}"]) -# -# # Init base -# mkdir -p "$__cdist_local_base_dir" -# ssh "${__cdist_remote_user}@${__cdist_target_host}" \ -# "mkdir -p ${__cdist_remote_base_dir}" -# -# # Link configuraion source directory - consistent with remote -# ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir" + + # Create base directories + run_or_fail(["mkdir -p", "$__cdist_local_base_dir"]) + remote_run_or_fail(hostname,["mkdir -p", "${__cdist_remote_base_dir}"]) + + # Link configuraion source directory - consistent with remote + run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) if __name__ == "__main__": From ffd7f4b251bb4a61239b6a5afa274a6d5061e70c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 01:48:23 +0200 Subject: [PATCH 0030/1024] --todo Signed-off-by: Nico Schottelius --- bin/cdist-deploy-to | 7 ------- 1 file changed, 7 deletions(-) diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index bf5614bc..84181bbd 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -43,13 +43,6 @@ __cdist_echo info "cdist $__cdist_version: Configuring $__cdist_target_host " # See cdist-stages(7) # -# Prepare local and remote directories -__cdist_init_deploy "$__cdist_target_host" - -# Transfer cdist executables -__cdist_echo info "Transferring cdist binaries to the target host " -cdist-dir push "$__cdist_target_host" \ - "${__cdist_abs_mydir}" "${__cdist_remote_bin_dir}" cdist-explorer-run-global "$__cdist_target_host" cdist-manifest-run-init "$__cdist_target_host" cdist-object-all "$__cdist_target_host" cdist-object-prepare From c2873a8fa0b132003d1cd14b5bc53a6537360c71 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 02:12:48 +0200 Subject: [PATCH 0031/1024] ipmlement base_directory Signed-off-by: Nico Schottelius --- bin/cdist | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bin/cdist b/bin/cdist index 2ff2e011..440ec459 100755 --- a/bin/cdist +++ b/bin/cdist @@ -21,6 +21,7 @@ import sys # argv import subprocess # execute stuff +import os __cdist_version="2.0.0" @@ -54,6 +55,20 @@ def cdist_deploy_to(hostname): logger("info", "Deploying to host", hostname) init_deploy(hostname) +def base_directory(): + """Returns the directory in which all cdist stuff is based in""" + os.chdir(os.path.join(os.path.dirname(__file__), os.pardir)) + return os.getcwd() + +def global_explorer_directory(): + """Returns path to directory containing the global explorers""" + +def list_global_explorers(): + """Return list of available explorers""" + os.listdir(path=global_explorer_directory()) + +def explore(hostname, type=''): + """Run explorers""" def init_deploy(hostname): logger("info", "Creating clean directory structure") @@ -75,4 +90,5 @@ if __name__ == "__main__": hostname=sys.argv[1] logger("info", "cdist", __cdist_version, ": Configuring host", hostname) cdist_deploy_to(hostname) + print(base_directory()) From 11750515e1bc1bbc821082bac1c901c4eac66ec6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 02:16:13 +0200 Subject: [PATCH 0032/1024] finish global_explorer_directory() Signed-off-by: Nico Schottelius --- bin/cdist | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 440ec459..2246f943 100755 --- a/bin/cdist +++ b/bin/cdist @@ -60,8 +60,13 @@ def base_directory(): os.chdir(os.path.join(os.path.dirname(__file__), os.pardir)) return os.getcwd() +def conf_directory(): + """Returns path to main configuration directory""" + return os.path.join(base_directory(), "conf") + def global_explorer_directory(): """Returns path to directory containing the global explorers""" + return os.path.join(conf_directory(), "explorer") def list_global_explorers(): """Return list of available explorers""" @@ -90,5 +95,5 @@ if __name__ == "__main__": hostname=sys.argv[1] logger("info", "cdist", __cdist_version, ": Configuring host", hostname) cdist_deploy_to(hostname) - print(base_directory()) + print(global_explorer_directory()) From 09c58e2327281d91354460012e94f8ab455a8ed0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 02:39:24 +0200 Subject: [PATCH 0033/1024] exit, if there are no global explorers Signed-off-by: Nico Schottelius --- bin/cdist | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/bin/cdist b/bin/cdist index 2246f943..1019726a 100755 --- a/bin/cdist +++ b/bin/cdist @@ -30,7 +30,7 @@ def logger(type, *args): print(*args) def exit_error(*args): - logger(*args) + logger("error", *args) sys.exit(1) @@ -50,13 +50,9 @@ def remote_run_or_fail(hostname, *args): run_or_fail(newargs) -def cdist_deploy_to(hostname): - """Mimic the old deploy to: Deploy to one host""" - logger("info", "Deploying to host", hostname) - init_deploy(hostname) - def base_directory(): """Returns the directory in which all cdist stuff is based in""" + print("Going to", __file__, os.path.join(os.path.dirname(__file__), os.pardir)) os.chdir(os.path.join(os.path.dirname(__file__), os.pardir)) return os.getcwd() @@ -70,10 +66,14 @@ def global_explorer_directory(): def list_global_explorers(): """Return list of available explorers""" - os.listdir(path=global_explorer_directory()) + return os.listdir(global_explorer_directory()) -def explore(hostname, type=''): - """Run explorers""" +def global_explore(hostname): + """Run global explorers""" + explorer = list_global_explorers() + if(len(explorer) == 0): + exit_error("No explorers found in", global_explorer_directory()) + def init_deploy(hostname): logger("info", "Creating clean directory structure") @@ -90,10 +90,16 @@ def init_deploy(hostname): # Link configuraion source directory - consistent with remote run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) +def cdist_deploy_to(hostname): + """Mimic the old deploy to: Deploy to one host""" + logger("info", "Deploying to host", hostname) + init_deploy(hostname) + global_explore(hostname) + if __name__ == "__main__": hostname=sys.argv[1] logger("info", "cdist", __cdist_version, ": Configuring host", hostname) cdist_deploy_to(hostname) - print(global_explorer_directory()) + print(list_global_explorers()) From 6e3c228a6f2c1b4603e29bf682608015cefab266 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 02:46:09 +0200 Subject: [PATCH 0034/1024] transfer_dir() added Signed-off-by: Nico Schottelius --- bin/cdist | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 1019726a..767d2fe9 100755 --- a/bin/cdist +++ b/bin/cdist @@ -36,6 +36,7 @@ def exit_error(*args): def run_or_fail(*args): newargs = ["echo"] + newargs = [] newargs.extend(*args) try: @@ -49,6 +50,8 @@ def remote_run_or_fail(hostname, *args): run_or_fail(newargs) +def transfer_dir(hostname, source, destination): + run_or_fail(["scp", "-r", source, hostname + ":" + destination]) def base_directory(): """Returns the directory in which all cdist stuff is based in""" @@ -64,16 +67,22 @@ def global_explorer_directory(): """Returns path to directory containing the global explorers""" return os.path.join(conf_directory(), "explorer") +def remote_global_explorer_directory(): + """Returns path to directory containing the global explorers""" + return os.path.join(conf_directory(), "explorer") + def list_global_explorers(): """Return list of available explorers""" return os.listdir(global_explorer_directory()) +def transfer_global_explorers(hostname): + transfer_dir(hostname, global_explorer_directory(), remote_global_explorer_directory()) + def global_explore(hostname): """Run global explorers""" explorer = list_global_explorers() if(len(explorer) == 0): exit_error("No explorers found in", global_explorer_directory()) - def init_deploy(hostname): logger("info", "Creating clean directory structure") From 94fc5b3c911de461e7437518433257e3073e431c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 02:51:45 +0200 Subject: [PATCH 0035/1024] add remove_remote_dir() Signed-off-by: Nico Schottelius --- bin/cdist | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/cdist b/bin/cdist index 767d2fe9..94154974 100755 --- a/bin/cdist +++ b/bin/cdist @@ -50,7 +50,11 @@ def remote_run_or_fail(hostname, *args): run_or_fail(newargs) +def remove_remote_dir(hostname, destination): + remote_run_or_fail(hostname, ["rm", "-rf", destination]) + def transfer_dir(hostname, source, destination): + remove_remote_dir(hostname, destination) run_or_fail(["scp", "-r", source, hostname + ":" + destination]) def base_directory(): From 78a5bbf6e89fad6850f2f1d435c081918ee8dd35 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 02:52:38 +0200 Subject: [PATCH 0036/1024] remove the currently broken init() Signed-off-by: Nico Schottelius --- bin/cdist | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/cdist b/bin/cdist index 94154974..fb09e8b2 100755 --- a/bin/cdist +++ b/bin/cdist @@ -92,16 +92,16 @@ def init_deploy(hostname): logger("info", "Creating clean directory structure") # Ensure there is no old stuff, neither local nor remote - run_or_fail(["rm -rf", "$__cdist_local_base_dir"]) - - remote_run_or_fail(hostname, ["rm -rf", "${__cdist_remote_base_dir}"]) - - # Create base directories - run_or_fail(["mkdir -p", "$__cdist_local_base_dir"]) - remote_run_or_fail(hostname,["mkdir -p", "${__cdist_remote_base_dir}"]) - - # Link configuraion source directory - consistent with remote - run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) +# run_or_fail(["rm -rf", "$__cdist_local_base_dir"]) +# +# remote_run_or_fail(hostname, ["rm -rf", "${__cdist_remote_base_dir}"]) +# +# # Create base directories +# run_or_fail(["mkdir -p", "$__cdist_local_base_dir"]) +# remote_run_or_fail(hostname,["mkdir -p", "${__cdist_remote_base_dir}"]) +# +# # Link configuraion source directory - consistent with remote +# run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) def cdist_deploy_to(hostname): """Mimic the old deploy to: Deploy to one host""" From d0eeafd228fae25e1e8662311b7573022ab06be5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 02:56:02 +0200 Subject: [PATCH 0037/1024] also add some bugs Signed-off-by: Nico Schottelius --- bin/cdist | 11 +++++++++-- doc/dev/todo/niconext | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index fb09e8b2..5cabf17b 100755 --- a/bin/cdist +++ b/bin/cdist @@ -63,17 +63,24 @@ def base_directory(): os.chdir(os.path.join(os.path.dirname(__file__), os.pardir)) return os.getcwd() +def remote_base_directory(): + return "/var/lib/cdist" + def conf_directory(): """Returns path to main configuration directory""" return os.path.join(base_directory(), "conf") +def remote_conf_directory(): + """Returns path to remote main configuration directory""" + return os.path.join(remote_base_directory(), "conf") + def global_explorer_directory(): """Returns path to directory containing the global explorers""" return os.path.join(conf_directory(), "explorer") def remote_global_explorer_directory(): - """Returns path to directory containing the global explorers""" - return os.path.join(conf_directory(), "explorer") + """Returns path to the remote directory containing the global explorers""" + return os.path.join(remote_conf_directory(), "explorer") def list_global_explorers(): """Return list of available explorers""" diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index a59f909f..fce4033e 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,2 +1,4 @@ - rewrite in python? - support non-ssh access? + +- Bug: os.path.join() may be wrong for the remote side! From ef925714d5fc4aed09981d2c6de1a2088a24c881 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 02:57:47 +0200 Subject: [PATCH 0038/1024] transfer explorer Signed-off-by: Nico Schottelius --- bin/cdist | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 5cabf17b..7d28d112 100755 --- a/bin/cdist +++ b/bin/cdist @@ -45,7 +45,7 @@ def run_or_fail(*args): exit_error("Command failed:", newargs) def remote_run_or_fail(hostname, *args): - newargs = ["ssh", hostname] + newargs = ["ssh", "root@" + hostname] newargs.extend(*args) run_or_fail(newargs) @@ -55,7 +55,7 @@ def remove_remote_dir(hostname, destination): def transfer_dir(hostname, source, destination): remove_remote_dir(hostname, destination) - run_or_fail(["scp", "-r", source, hostname + ":" + destination]) + run_or_fail(["scp", "-r", source, "root@" + hostname + ":" + destination]) def base_directory(): """Returns the directory in which all cdist stuff is based in""" @@ -95,6 +95,8 @@ def global_explore(hostname): if(len(explorer) == 0): exit_error("No explorers found in", global_explorer_directory()) + transfer_global_explorers(hostname) + def init_deploy(hostname): logger("info", "Creating clean directory structure") From 85df71c9fa511b583076d500df25ab6cf384dc81 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 03:23:18 +0200 Subject: [PATCH 0039/1024] executing explorers works Signed-off-by: Nico Schottelius --- bin/cdist | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/bin/cdist b/bin/cdist index 7d28d112..d2a0abd9 100755 --- a/bin/cdist +++ b/bin/cdist @@ -30,14 +30,15 @@ def logger(type, *args): print(*args) def exit_error(*args): - logger("error", *args) + logger("error", args) sys.exit(1) def run_or_fail(*args): - newargs = ["echo"] + # newargs = ["echo"] newargs = [] newargs.extend(*args) + print(newargs) try: subprocess.check_call(newargs) @@ -45,9 +46,9 @@ def run_or_fail(*args): exit_error("Command failed:", newargs) def remote_run_or_fail(hostname, *args): + """Run something on the remote side and fail is something breaks""" newargs = ["ssh", "root@" + hostname] newargs.extend(*args) - run_or_fail(newargs) def remove_remote_dir(hostname, destination): @@ -82,6 +83,10 @@ def remote_global_explorer_directory(): """Returns path to the remote directory containing the global explorers""" return os.path.join(remote_conf_directory(), "explorer") +def remote_global_explorer_path(explorer): + """Returns path to the remote explorer""" + return os.path.join(remote_global_explorer_directory(), explorer) + def list_global_explorers(): """Return list of available explorers""" return os.listdir(global_explorer_directory()) @@ -91,11 +96,14 @@ def transfer_global_explorers(hostname): def global_explore(hostname): """Run global explorers""" - explorer = list_global_explorers() - if(len(explorer) == 0): + explorers = list_global_explorers() + if(len(explorers) == 0): exit_error("No explorers found in", global_explorer_directory()) transfer_global_explorers(hostname) + for explorer in explorers: + remote_run_or_fail(hostname, [remote_global_explorer_path(explorer)]) + def init_deploy(hostname): logger("info", "Creating clean directory structure") From 9036f8c4cce9edb5b353928855bdd995248cdb16 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 03:24:27 +0200 Subject: [PATCH 0040/1024] executing explorers works Signed-off-by: Nico Schottelius --- bin/cdist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/cdist b/bin/cdist index d2a0abd9..339349a3 100755 --- a/bin/cdist +++ b/bin/cdist @@ -103,6 +103,8 @@ def global_explore(hostname): transfer_global_explorers(hostname) for explorer in explorers: remote_run_or_fail(hostname, [remote_global_explorer_path(explorer)]) + + remote_run_or_fail(hostname, [remote_global_explorer_path("moo")]) def init_deploy(hostname): From ff2d5629d65a3bafe90df40718fd6ab393055527 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 03:28:06 +0200 Subject: [PATCH 0041/1024] submit string on failed error Signed-off-by: Nico Schottelius --- bin/cdist | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/cdist b/bin/cdist index 339349a3..ab913541 100755 --- a/bin/cdist +++ b/bin/cdist @@ -30,7 +30,7 @@ def logger(type, *args): print(*args) def exit_error(*args): - logger("error", args) + logger("error", *args) sys.exit(1) @@ -42,8 +42,8 @@ def run_or_fail(*args): try: subprocess.check_call(newargs) - except CalledProcessError: - exit_error("Command failed:", newargs) + except subprocess.CalledProcessError: + exit_error("Command failed:", " ".join(newargs)) def remote_run_or_fail(hostname, *args): """Run something on the remote side and fail is something breaks""" @@ -104,8 +104,6 @@ def global_explore(hostname): for explorer in explorers: remote_run_or_fail(hostname, [remote_global_explorer_path(explorer)]) - remote_run_or_fail(hostname, [remote_global_explorer_path("moo")]) - def init_deploy(hostname): logger("info", "Creating clean directory structure") From 7a7413f1f48c9509bdd4e390f3d86017bf010ab7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 03:31:58 +0200 Subject: [PATCH 0042/1024] pause Signed-off-by: Nico Schottelius --- bin/cdist | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/cdist b/bin/cdist index ab913541..59d99040 100755 --- a/bin/cdist +++ b/bin/cdist @@ -75,6 +75,11 @@ def remote_conf_directory(): """Returns path to remote main configuration directory""" return os.path.join(remote_base_directory(), "conf") +def out_dir(): + FIXME: stopped - probably need static temp know! + """Local directory containing output""" + return os.path.join(base_directory(), "conf") + def global_explorer_directory(): """Returns path to directory containing the global explorers""" return os.path.join(conf_directory(), "explorer") From 572401e4f8010574df45423ccb1c21f056b719b9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 03:56:59 +0200 Subject: [PATCH 0043/1024] commit broken stuff Signed-off-by: Nico Schottelius --- bin/cdist | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index 59d99040..e1d62391 100755 --- a/bin/cdist +++ b/bin/cdist @@ -22,8 +22,22 @@ import sys # argv import subprocess # execute stuff import os +import tempfile +import shutil -__cdist_version="2.0.0" + +class Cdist: + """Cdist main class to hold arbitrary data""" + version="2.0.0" + + def __init__(self): + self.tempdir = tempfile.mkdtemp() + print(self.tempdir) + + def __del__(self): + print("Zerstoeren") + print(self.tempdir) + shutil.rmtree(self.tempdir) def logger(type, *args): """Ignore type for now, support later""" @@ -76,7 +90,7 @@ def remote_conf_directory(): return os.path.join(remote_base_directory(), "conf") def out_dir(): - FIXME: stopped - probably need static temp know! + # FIXME: stopped - probably need static temp know! """Local directory containing output""" return os.path.join(base_directory(), "conf") @@ -134,7 +148,9 @@ def cdist_deploy_to(hostname): if __name__ == "__main__": hostname=sys.argv[1] - logger("info", "cdist", __cdist_version, ": Configuring host", hostname) +# logger("info", "cdist", cdist_version, ": Configuring host", hostname) cdist_deploy_to(hostname) print(list_global_explorers()) + c = Cdist() + From e8a6d89e3c253897dd46863348a44eb606ad97cd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 04:22:21 +0200 Subject: [PATCH 0044/1024] wrap into a class Signed-off-by: Nico Schottelius --- bin/cdist | 187 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 98 insertions(+), 89 deletions(-) diff --git a/bin/cdist b/bin/cdist index e1d62391..53728648 100755 --- a/bin/cdist +++ b/bin/cdist @@ -30,127 +30,136 @@ class Cdist: """Cdist main class to hold arbitrary data""" version="2.0.0" - def __init__(self): + def __init__(self, hostname): self.tempdir = tempfile.mkdtemp() + self.hostname = hostname + print(self.hostname) print(self.tempdir) - def __del__(self): - print("Zerstoeren") + def cleanup(self): + # Do not use in __del__: + # http://docs.python.org/reference/datamodel.html#customization + # "other globals referenced by the __del__() method may already have been deleted + # or in the process of being torn down (e.g. the import machinery shutting down)" + # print(self.tempdir) shutil.rmtree(self.tempdir) -def logger(type, *args): - """Ignore type for now, support later""" - print(*args) + def out_dir(self): + # FIXME: stopped - probably need static temp know! + """Local directory containing output""" + return os.path.join(base_directory(), "conf") -def exit_error(*args): - logger("error", *args) - sys.exit(1) - + def logger(self,type, *args): + """Ignore type for now, support later""" + print(*args) -def run_or_fail(*args): - # newargs = ["echo"] - newargs = [] - newargs.extend(*args) - print(newargs) + def exit_error(self,*args): + self.logger("error", *args) + sys.exit(1) + - try: - subprocess.check_call(newargs) - except subprocess.CalledProcessError: - exit_error("Command failed:", " ".join(newargs)) + def run_or_fail(self,*args): + # newargs = ["echo"] + newargs = [] + newargs.extend(*args) + print(newargs) -def remote_run_or_fail(hostname, *args): - """Run something on the remote side and fail is something breaks""" - newargs = ["ssh", "root@" + hostname] - newargs.extend(*args) - run_or_fail(newargs) + try: + subprocess.check_call(newargs) + except subprocess.CalledProcessError: + self.exit_error("Command failed:", " ".join(newargs)) -def remove_remote_dir(hostname, destination): - remote_run_or_fail(hostname, ["rm", "-rf", destination]) + def remote_run_or_fail(self, *args): + """Run something on the remote side and fail is something breaks""" + newargs = ["ssh", "root@" + self.hostname] + newargs.extend(*args) + print(newargs, "bbbbb", self.hostname) + self.run_or_fail(newargs) -def transfer_dir(hostname, source, destination): - remove_remote_dir(hostname, destination) - run_or_fail(["scp", "-r", source, "root@" + hostname + ":" + destination]) + def remove_remote_dir(self, destination): + self.remote_run_or_fail(["rm", "-rf", destination]) -def base_directory(): - """Returns the directory in which all cdist stuff is based in""" - print("Going to", __file__, os.path.join(os.path.dirname(__file__), os.pardir)) - os.chdir(os.path.join(os.path.dirname(__file__), os.pardir)) - return os.getcwd() + def transfer_dir(self, source, destination): + self.remove_remote_dir(destination) + self.run_or_fail(["scp", "-qr", source, "root@" + self.hostname + ":" + destination]) -def remote_base_directory(): - return "/var/lib/cdist" + def base_directory(self): + """Returns the directory in which all cdist stuff is based in""" + print("Going to", __file__, os.path.join(os.path.dirname(__file__), os.pardir)) + os.chdir(os.path.join(os.path.dirname(__file__), os.pardir)) + return os.getcwd() -def conf_directory(): - """Returns path to main configuration directory""" - return os.path.join(base_directory(), "conf") + def remote_base_directory(self): + return "/var/lib/cdist" -def remote_conf_directory(): - """Returns path to remote main configuration directory""" - return os.path.join(remote_base_directory(), "conf") + def conf_directory(self): + """Returns path to main configuration directory""" + return os.path.join(self.base_directory(), "conf") -def out_dir(): - # FIXME: stopped - probably need static temp know! - """Local directory containing output""" - return os.path.join(base_directory(), "conf") + def remote_conf_directory(self): + """Returns path to remote main configuration directory""" + return os.path.join(self.remote_base_directory(), "conf") -def global_explorer_directory(): - """Returns path to directory containing the global explorers""" - return os.path.join(conf_directory(), "explorer") + def global_explorer_directory(self): + """Returns path to directory containing the global explorers""" + return os.path.join(self.conf_directory(), "explorer") -def remote_global_explorer_directory(): - """Returns path to the remote directory containing the global explorers""" - return os.path.join(remote_conf_directory(), "explorer") + def remote_global_explorer_directory(self): + """Returns path to the remote directory containing the global explorers""" + return os.path.join(self.remote_conf_directory(), "explorer") -def remote_global_explorer_path(explorer): - """Returns path to the remote explorer""" - return os.path.join(remote_global_explorer_directory(), explorer) + def remote_global_explorer_path(self,explorer): + """Returns path to the remote explorer""" + return os.path.join(self.remote_global_explorer_directory(), explorer) -def list_global_explorers(): - """Return list of available explorers""" - return os.listdir(global_explorer_directory()) + def list_global_explorers(self): + """Return list of available explorers""" + return os.listdir(self.global_explorer_directory()) -def transfer_global_explorers(hostname): - transfer_dir(hostname, global_explorer_directory(), remote_global_explorer_directory()) + def transfer_global_explorers(self): + self.transfer_dir(self.global_explorer_directory(), self.remote_global_explorer_directory()) -def global_explore(hostname): - """Run global explorers""" - explorers = list_global_explorers() - if(len(explorers) == 0): - exit_error("No explorers found in", global_explorer_directory()) + def global_explore(self): + """Run global explorers""" + explorers = self.list_global_explorers() + if(len(explorers) == 0): + self.exit_error("No explorers found in", self.global_explorer_directory()) - transfer_global_explorers(hostname) - for explorer in explorers: - remote_run_or_fail(hostname, [remote_global_explorer_path(explorer)]) + self.transfer_global_explorers() + for explorer in explorers: + self.remote_run_or_fail([self.remote_global_explorer_path(explorer)]) -def init_deploy(hostname): - logger("info", "Creating clean directory structure") + def init_deploy(self): + self.logger("info", "Creating clean directory structure") - # Ensure there is no old stuff, neither local nor remote -# run_or_fail(["rm -rf", "$__cdist_local_base_dir"]) -# -# remote_run_or_fail(hostname, ["rm -rf", "${__cdist_remote_base_dir}"]) -# -# # Create base directories -# run_or_fail(["mkdir -p", "$__cdist_local_base_dir"]) -# remote_run_or_fail(hostname,["mkdir -p", "${__cdist_remote_base_dir}"]) -# -# # Link configuraion source directory - consistent with remote -# run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) + # Ensure there is no old stuff, neither local nor remote + # run_or_fail(["rm -rf", "$__cdist_local_base_dir"]) + # + # remote_run_or_fail(hostname, ["rm -rf", "${__cdist_remote_base_dir}"]) + # + # # Create base directories + # run_or_fail(["mkdir -p", "$__cdist_local_base_dir"]) + # remote_run_or_fail(hostname,["mkdir -p", "${__cdist_remote_base_dir}"]) + # + # # Link configuraion source directory - consistent with remote + # run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) -def cdist_deploy_to(hostname): - """Mimic the old deploy to: Deploy to one host""" - logger("info", "Deploying to host", hostname) - init_deploy(hostname) - global_explore(hostname) + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + self.logger("info", "Deploying to host", self.hostname) + self.init_deploy() + self.global_explore() if __name__ == "__main__": hostname=sys.argv[1] # logger("info", "cdist", cdist_version, ": Configuring host", hostname) - cdist_deploy_to(hostname) - print(list_global_explorers()) - c = Cdist() + for host in sys.argv[1:]: + c = Cdist(host) + c.deploy_to() + print(c.list_global_explorers()) + c.cleanup() From 0dc6af251219e267791ec6d4f08667c38084f991 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 04:22:40 +0200 Subject: [PATCH 0045/1024] wrap into a class Signed-off-by: Nico Schottelius --- bin/cdist | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 53728648..6770c181 100755 --- a/bin/cdist +++ b/bin/cdist @@ -74,7 +74,6 @@ class Cdist: """Run something on the remote side and fail is something breaks""" newargs = ["ssh", "root@" + self.hostname] newargs.extend(*args) - print(newargs, "bbbbb", self.hostname) self.run_or_fail(newargs) def remove_remote_dir(self, destination): From e8360df96b6bb9ae4641046e862d1a414ebfc03c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 09:47:30 +0200 Subject: [PATCH 0046/1024] allow passing arguments to Popen() Signed-off-by: Nico Schottelius --- bin/cdist | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index 6770c181..39a0b80b 100755 --- a/bin/cdist +++ b/bin/cdist @@ -59,22 +59,22 @@ class Cdist: sys.exit(1) - def run_or_fail(self,*args): + def run_or_fail(self,*args, **kargs): # newargs = ["echo"] newargs = [] newargs.extend(*args) print(newargs) try: - subprocess.check_call(newargs) + subprocess.check_call(newargs, **kargs) except subprocess.CalledProcessError: self.exit_error("Command failed:", " ".join(newargs)) - def remote_run_or_fail(self, *args): + def remote_run_or_fail(self, *args, **kargs): """Run something on the remote side and fail is something breaks""" newargs = ["ssh", "root@" + self.hostname] newargs.extend(*args) - self.run_or_fail(newargs) + self.run_or_fail(newargs, **kargs) def remove_remote_dir(self, destination): self.remote_run_or_fail(["rm", "-rf", destination]) From 4c1939829e26ae8ba73f48793409daec8c5d0c3f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 11:08:44 +0200 Subject: [PATCH 0047/1024] import logging, begin to put constant stuff in module Signed-off-by: Nico Schottelius --- bin/cdist | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/bin/cdist b/bin/cdist index 39a0b80b..162bf1aa 100755 --- a/bin/cdist +++ b/bin/cdist @@ -19,22 +19,36 @@ # # -import sys # argv +import sys import subprocess # execute stuff import os import tempfile import shutil +import logging +BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + +logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s') + class Cdist: """Cdist main class to hold arbitrary data""" version="2.0.0" def __init__(self, hostname): - self.tempdir = tempfile.mkdtemp() self.hostname = hostname - print(self.hostname) - print(self.tempdir) + + # Setup directory paths + self.temp_dir = tempfile.mkdtemp() + + self.out_dir = os.path.join(self.temp_dir, "out") + os.mkdir(self.out_dir) + + self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") + os.mkdir(self.global_explorer_out_dir) + + # Given paths from installation + self.conf_dir = os.path.join(self.base_dir, "conf") def cleanup(self): # Do not use in __del__: @@ -45,11 +59,6 @@ class Cdist: print(self.tempdir) shutil.rmtree(self.tempdir) - def out_dir(self): - # FIXME: stopped - probably need static temp know! - """Local directory containing output""" - return os.path.join(base_directory(), "conf") - def logger(self,type, *args): """Ignore type for now, support later""" print(*args) @@ -83,18 +92,9 @@ class Cdist: self.remove_remote_dir(destination) self.run_or_fail(["scp", "-qr", source, "root@" + self.hostname + ":" + destination]) - def base_directory(self): - """Returns the directory in which all cdist stuff is based in""" - print("Going to", __file__, os.path.join(os.path.dirname(__file__), os.pardir)) - os.chdir(os.path.join(os.path.dirname(__file__), os.pardir)) - return os.getcwd() - def remote_base_directory(self): return "/var/lib/cdist" - def conf_directory(self): - """Returns path to main configuration directory""" - return os.path.join(self.base_directory(), "conf") def remote_conf_directory(self): """Returns path to remote main configuration directory""" @@ -112,6 +112,10 @@ class Cdist: """Returns path to the remote explorer""" return os.path.join(self.remote_global_explorer_directory(), explorer) + def global_explorer_output_path(self, explorer): + """Returns path of the output for a global explorer""" + return os.path.join(self.global_explorer_out_dir, explorer) + def list_global_explorers(self): """Return list of available explorers""" return os.listdir(self.global_explorer_directory()) @@ -127,7 +131,10 @@ class Cdist: self.transfer_global_explorers() for explorer in explorers: - self.remote_run_or_fail([self.remote_global_explorer_path(explorer)]) + output = self.global_explorer_output_path(explorer) + output_fd = open(output, mode='w') + self.remote_run_or_fail([self.remote_global_explorer_path(explorer)], stdout=output_fd) + output_fd.close() def init_deploy(self): From 7d3c67c178a1996eb7a6633040c9a30668f56fda Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 11:44:04 +0200 Subject: [PATCH 0048/1024] make it work again :-) Signed-off-by: Nico Schottelius --- bin/cdist | 81 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/bin/cdist b/bin/cdist index 162bf1aa..c160b945 100755 --- a/bin/cdist +++ b/bin/cdist @@ -27,9 +27,37 @@ import shutil import logging +# Given paths from installation BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) +CONF_DIR = os.path.join(BASE_DIR, "conf") +GLOBAL_EXPLORER_DIR = os.path.join(CONF_DIR, "explorer") +REMOTE_BASE_DIR = "/var/lib/cdist" +REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") +REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") + + +#class Context(object): +# +# def __init__(self, target_host): +# self.target_host = target_host +# +# # class variable +# user_selber_shuld_wenn_aendert = 'bla' +# +# # read only, aber statisch +# @property +# def remote_base_directory(self): +# return "/var/lib/cdist" +# @property.setter +# +# @property +# def special_foo(self): +# return 'foo/{0}'.format(self.target_host) +# + logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s') +log = logging.getLogger() class Cdist: """Cdist main class to hold arbitrary data""" @@ -38,35 +66,27 @@ class Cdist: def __init__(self, hostname): self.hostname = hostname + # log.info("foobar") + # Setup directory paths self.temp_dir = tempfile.mkdtemp() - self.out_dir = os.path.join(self.temp_dir, "out") os.mkdir(self.out_dir) - self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") os.mkdir(self.global_explorer_out_dir) - # Given paths from installation - self.conf_dir = os.path.join(self.base_dir, "conf") - def cleanup(self): # Do not use in __del__: # http://docs.python.org/reference/datamodel.html#customization # "other globals referenced by the __del__() method may already have been deleted # or in the process of being torn down (e.g. the import machinery shutting down)" # - print(self.tempdir) - shutil.rmtree(self.tempdir) - - def logger(self,type, *args): - """Ignore type for now, support later""" - print(*args) + print(self.temp_dir) + shutil.rmtree(self.temp_dir) def exit_error(self,*args): - self.logger("error", *args) + log.error(args) sys.exit(1) - def run_or_fail(self,*args, **kargs): # newargs = ["echo"] @@ -92,42 +112,26 @@ class Cdist: self.remove_remote_dir(destination) self.run_or_fail(["scp", "-qr", source, "root@" + self.hostname + ":" + destination]) - def remote_base_directory(self): - return "/var/lib/cdist" - - - def remote_conf_directory(self): - """Returns path to remote main configuration directory""" - return os.path.join(self.remote_base_directory(), "conf") - - def global_explorer_directory(self): - """Returns path to directory containing the global explorers""" - return os.path.join(self.conf_directory(), "explorer") - - def remote_global_explorer_directory(self): - """Returns path to the remote directory containing the global explorers""" - return os.path.join(self.remote_conf_directory(), "explorer") - - def remote_global_explorer_path(self,explorer): - """Returns path to the remote explorer""" - return os.path.join(self.remote_global_explorer_directory(), explorer) - def global_explorer_output_path(self, explorer): """Returns path of the output for a global explorer""" return os.path.join(self.global_explorer_out_dir, explorer) + def remote_global_explorer_path(self, explorer): + """Returns path to the remote explorer""" + return os.path.join(REMOTE_GLOBAL_EXPLORER_DIR, explorer) + def list_global_explorers(self): """Return list of available explorers""" - return os.listdir(self.global_explorer_directory()) + return os.listdir(GLOBAL_EXPLORER_DIR) def transfer_global_explorers(self): - self.transfer_dir(self.global_explorer_directory(), self.remote_global_explorer_directory()) + self.transfer_dir(GLOBAL_EXPLORER_DIR, REMOTE_GLOBAL_EXPLORER_DIR) def global_explore(self): """Run global explorers""" explorers = self.list_global_explorers() if(len(explorers) == 0): - self.exit_error("No explorers found in", self.global_explorer_directory()) + self.exit_error("No explorers found in", GLOBAL_EXPLORER_DIR) self.transfer_global_explorers() for explorer in explorers: @@ -138,7 +142,7 @@ class Cdist: def init_deploy(self): - self.logger("info", "Creating clean directory structure") + log.info("Creating clean directory structure") # Ensure there is no old stuff, neither local nor remote # run_or_fail(["rm -rf", "$__cdist_local_base_dir"]) @@ -154,14 +158,13 @@ class Cdist: def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" - self.logger("info", "Deploying to host", self.hostname) + log.info("Deploying to host", self.hostname) self.init_deploy() self.global_explore() if __name__ == "__main__": hostname=sys.argv[1] -# logger("info", "cdist", cdist_version, ": Configuring host", hostname) for host in sys.argv[1:]: c = Cdist(host) From 8fa576152ee2666c24e6d53dd697a40d78940980 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 11:44:58 +0200 Subject: [PATCH 0049/1024] make it work again :-) Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index c160b945..1e2fe11e 100755 --- a/bin/cdist +++ b/bin/cdist @@ -158,7 +158,7 @@ class Cdist: def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to host", self.hostname) + log.info("Deploying to host" + self.hostname) self.init_deploy() self.global_explore() From 506e0e6c81d340f424cf589b16d7e8672a5d824f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 11:45:58 +0200 Subject: [PATCH 0050/1024] +better logging Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 1e2fe11e..56991d68 100755 --- a/bin/cdist +++ b/bin/cdist @@ -158,7 +158,7 @@ class Cdist: def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to host" + self.hostname) + log.info("Deploying to host " + self.hostname) self.init_deploy() self.global_explore() From 908d9d06f9737a37a1558313836c65b3a172fce2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 11:50:30 +0200 Subject: [PATCH 0051/1024] prepend __explorer on global explorer run Signed-off-by: Nico Schottelius --- bin/cdist | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 56991d68..d6421161 100755 --- a/bin/cdist +++ b/bin/cdist @@ -81,8 +81,8 @@ class Cdist: # "other globals referenced by the __del__() method may already have been deleted # or in the process of being torn down (e.g. the import machinery shutting down)" # - print(self.temp_dir) - shutil.rmtree(self.temp_dir) + print("I should cleanup " + self.temp_dir) + # shutil.rmtree(self.temp_dir) def exit_error(self,*args): log.error(args) @@ -137,7 +137,11 @@ class Cdist: for explorer in explorers: output = self.global_explorer_output_path(explorer) output_fd = open(output, mode='w') - self.remote_run_or_fail([self.remote_global_explorer_path(explorer)], stdout=output_fd) + cmd = [] + cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append(self.remote_global_explorer_path(explorer)) + + self.remote_run_or_fail(cmd, stdout=output_fd) output_fd.close() @@ -145,12 +149,9 @@ class Cdist: log.info("Creating clean directory structure") # Ensure there is no old stuff, neither local nor remote - # run_or_fail(["rm -rf", "$__cdist_local_base_dir"]) - # # remote_run_or_fail(hostname, ["rm -rf", "${__cdist_remote_base_dir}"]) # # # Create base directories - # run_or_fail(["mkdir -p", "$__cdist_local_base_dir"]) # remote_run_or_fail(hostname,["mkdir -p", "${__cdist_remote_base_dir}"]) # # # Link configuraion source directory - consistent with remote From ddff3e8b571fd907e423ea8888c482eb1f4c05f6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 11:55:29 +0200 Subject: [PATCH 0052/1024] support changing the initial manifest Signed-off-by: Nico Schottelius --- bin/cdist | 14 +++++++++++++- bin/cdist-deploy-to | 1 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index d6421161..766a2acf 100755 --- a/bin/cdist +++ b/bin/cdist @@ -31,6 +31,8 @@ import logging BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) CONF_DIR = os.path.join(BASE_DIR, "conf") GLOBAL_EXPLORER_DIR = os.path.join(CONF_DIR, "explorer") +MANIFEST_DIR = os.path.join(CONF_DIR, "manifest") + REMOTE_BASE_DIR = "/var/lib/cdist" REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") @@ -63,7 +65,7 @@ class Cdist: """Cdist main class to hold arbitrary data""" version="2.0.0" - def __init__(self, hostname): + def __init__(self, hostname, initial_manifest=False): self.hostname = hostname # log.info("foobar") @@ -75,6 +77,12 @@ class Cdist: self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") os.mkdir(self.global_explorer_out_dir) + # Mostly static, but can be overwritten on user demand + if initial_manifest: + self.initial_manifest = initial_manifest + else: + self.initial_manifest = os.path.join(MANIFEST_DIR, "init") + def cleanup(self): # Do not use in __del__: # http://docs.python.org/reference/datamodel.html#customization @@ -157,11 +165,15 @@ class Cdist: # # Link configuraion source directory - consistent with remote # run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) + def initial_manifes(self): + """Run the initial manifest""" + def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" log.info("Deploying to host " + self.hostname) self.init_deploy() self.global_explore() + self.initial_manifest() if __name__ == "__main__": diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index 84181bbd..79f42931 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -43,7 +43,6 @@ __cdist_echo info "cdist $__cdist_version: Configuring $__cdist_target_host " # See cdist-stages(7) # -cdist-explorer-run-global "$__cdist_target_host" cdist-manifest-run-init "$__cdist_target_host" cdist-object-all "$__cdist_target_host" cdist-object-prepare cdist-object-all "$__cdist_target_host" cdist-object-run From 9533e579b390c171f8147211d63866935b2d683b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 14:04:30 +0200 Subject: [PATCH 0053/1024] finish run of initial manifest, finish shell_run_or_debug_fail() Signed-off-by: Nico Schottelius --- bin/cdist | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index 766a2acf..594b5eea 100755 --- a/bin/cdist +++ b/bin/cdist @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +# -*- coding: utf-8 -*- # # 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) # @@ -96,11 +97,23 @@ class Cdist: log.error(args) sys.exit(1) - def run_or_fail(self,*args, **kargs): + def shell_run_or_debug_fail(self, script, *args, **kargs): + kargs['shell'] = True + log.debug("Shell exec: " + " ".join(*args)) + + try: + subprocess.check_call(*args, **kargs) + except subprocess.CalledProcessError: + # FIXME: print out shell script! + script_fd = open(script) + log.error("Code that raised the error:\n" + script_fd.read()) + script_fd.close() + self.exit_error("Non-Zero exit code exit of " + " ".join(*args)) + + def run_or_fail(self, *args, **kargs): # newargs = ["echo"] newargs = [] newargs.extend(*args) - print(newargs) try: subprocess.check_call(newargs, **kargs) @@ -165,15 +178,18 @@ class Cdist: # # Link configuraion source directory - consistent with remote # run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) - def initial_manifes(self): + def run_initial_manifest(self): """Run the initial manifest""" + log.info("Running the initial manifest") + self.shell_run_or_debug_fail(self.initial_manifest, [self.initial_manifest]) + def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" log.info("Deploying to host " + self.hostname) self.init_deploy() self.global_explore() - self.initial_manifest() + self.run_initial_manifest() if __name__ == "__main__": From c5d960438cc111c5476b0261628b0ffcb1d25dbd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 14:05:20 +0200 Subject: [PATCH 0054/1024] import parser from steven Signed-off-by: Nico Schottelius --- bin/cdist | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/bin/cdist b/bin/cdist index 594b5eea..72e95e29 100755 --- a/bin/cdist +++ b/bin/cdist @@ -201,3 +201,41 @@ if __name__ == "__main__": print(c.list_global_explorers()) c.cleanup() + +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import logging +# TODO: configure logging based on config and/or user given arguments +logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') +log = logging.getLogger() + +import argparse +import sys + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Some helpfull blabla') + parser.add_argument('host', nargs='+', help='one or more hosts to operate on') + parser.add_argument('-i', '--initial-manifest', + help='path to a cdist manifest or - to read from stdin', + dest='manifest', required=True) + parser.add_argument('-p', '--parallel', + help='operate on multiple hosts in parallel', + action='store_true', dest='parallel') + parser.add_argument('-s', '--sequential', + help='operate on multiple hosts sequentially', + action='store_false', dest='parallel') + parser.add_argument('-d', '--debug', help='set log level to debug', + action='store_true') + + args = parser.parse_args(sys.argv[1:]) + if args.debug: + logging.root.setLevel(logging.DEBUG) + log.debug('Look ma, now whe\'re showing debug messages') + + try: + print(args) + #import cdist + #sys.exit(cdist.main(args)) + except KeyboardInterrupt: + sys.exit(0) From 979174a5685ae810327f98b04a8cf522c504f15c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 14:11:31 +0200 Subject: [PATCH 0055/1024] integrate parser Signed-off-by: Nico Schottelius --- bin/cdist | 86 +++++++++++++++++++++++-------------------------------- 1 file changed, 36 insertions(+), 50 deletions(-) diff --git a/bin/cdist b/bin/cdist index 72e95e29..a9b400ca 100755 --- a/bin/cdist +++ b/bin/cdist @@ -20,13 +20,13 @@ # # -import sys -import subprocess # execute stuff -import os -import tempfile -import shutil +import argparse import logging - +import os +import subprocess +import shutil +import sys +import tempfile # Given paths from installation BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) @@ -37,6 +37,7 @@ MANIFEST_DIR = os.path.join(CONF_DIR, "manifest") REMOTE_BASE_DIR = "/var/lib/cdist" REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") +VERSION = "2.0.0" #class Context(object): @@ -64,7 +65,6 @@ log = logging.getLogger() class Cdist: """Cdist main class to hold arbitrary data""" - version="2.0.0" def __init__(self, hostname, initial_manifest=False): self.hostname = hostname @@ -195,47 +195,33 @@ class Cdist: if __name__ == "__main__": hostname=sys.argv[1] - for host in sys.argv[1:]: - c = Cdist(host) - c.deploy_to() - print(c.list_global_explorers()) - c.cleanup() + parser = argparse.ArgumentParser(description='cdist ' + VERSION) + parser.add_argument('host', nargs='+', help='one or more hosts to operate on') + parser.add_argument('-d', '--debug', help='set log level to debug', + action='store_true') + parser.add_argument('-i', '--initial-manifest', + help='path to a cdist manifest or - to read from stdin', + dest='manifest', required=True) + parser.add_argument('-p', '--parallel', + help='operate on multiple hosts in parallel', + action='store_true', dest='parallel') + parser.add_argument('-s', '--sequential', + help='operate on multiple hosts sequentially', + action='store_false', dest='parallel') + + args = parser.parse_args(sys.argv[1:]) + if args.debug: + logging.root.setLevel(logging.DEBUG) + + try: + print(args) + import cdist + sys.exit(cdist.main(args)) - -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -import logging -# TODO: configure logging based on config and/or user given arguments -logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') -log = logging.getLogger() - -import argparse -import sys - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Some helpfull blabla') - parser.add_argument('host', nargs='+', help='one or more hosts to operate on') - parser.add_argument('-i', '--initial-manifest', - help='path to a cdist manifest or - to read from stdin', - dest='manifest', required=True) - parser.add_argument('-p', '--parallel', - help='operate on multiple hosts in parallel', - action='store_true', dest='parallel') - parser.add_argument('-s', '--sequential', - help='operate on multiple hosts sequentially', - action='store_false', dest='parallel') - parser.add_argument('-d', '--debug', help='set log level to debug', - action='store_true') - - args = parser.parse_args(sys.argv[1:]) - if args.debug: - logging.root.setLevel(logging.DEBUG) - log.debug('Look ma, now whe\'re showing debug messages') - - try: - print(args) - #import cdist - #sys.exit(cdist.main(args)) - except KeyboardInterrupt: - sys.exit(0) + for host in sys.argv[1:]: + c = Cdist(host) + c.deploy_to() + print(c.list_global_explorers()) + c.cleanup() + except KeyboardInterrupt: + sys.exit(0) From 1d367d5f581e246793e44016ec1df0836b822e6e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 14:17:44 +0200 Subject: [PATCH 0056/1024] make cdist localhost work again Signed-off-by: Nico Schottelius --- bin/cdist | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/cdist b/bin/cdist index a9b400ca..58ddcb3f 100755 --- a/bin/cdist +++ b/bin/cdist @@ -201,7 +201,7 @@ if __name__ == "__main__": action='store_true') parser.add_argument('-i', '--initial-manifest', help='path to a cdist manifest or - to read from stdin', - dest='manifest', required=True) + dest='manifest', required=False) parser.add_argument('-p', '--parallel', help='operate on multiple hosts in parallel', action='store_true', dest='parallel') @@ -214,11 +214,9 @@ if __name__ == "__main__": logging.root.setLevel(logging.DEBUG) try: - print(args) - import cdist - sys.exit(cdist.main(args)) + log.debug(args) - for host in sys.argv[1:]: + for host in args.host: c = Cdist(host) c.deploy_to() print(c.list_global_explorers()) From c8ce7e98ec2da0bfad43272adab71a2b43df2303 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 14:45:54 +0200 Subject: [PATCH 0057/1024] use -e to shell Signed-off-by: Nico Schottelius --- bin/cdist | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 58ddcb3f..a5902472 100755 --- a/bin/cdist +++ b/bin/cdist @@ -101,6 +101,10 @@ class Cdist: kargs['shell'] = True log.debug("Shell exec: " + " ".join(*args)) + # Fail if the script fails + args[0].insert(0,"-e") + print(args) + try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: @@ -219,7 +223,6 @@ if __name__ == "__main__": for host in args.host: c = Cdist(host) c.deploy_to() - print(c.list_global_explorers()) c.cleanup() except KeyboardInterrupt: sys.exit(0) From 1a96f886567f676f0ea149d73fc7ef9546496b55 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 14:50:45 +0200 Subject: [PATCH 0058/1024] name variable target_host for consistency and easy handling Signed-off-by: Nico Schottelius --- bin/cdist | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bin/cdist b/bin/cdist index a5902472..323d2a96 100755 --- a/bin/cdist +++ b/bin/cdist @@ -66,8 +66,8 @@ log = logging.getLogger() class Cdist: """Cdist main class to hold arbitrary data""" - def __init__(self, hostname, initial_manifest=False): - self.hostname = hostname + def __init__(self, target_host, initial_manifest=False): + self.target_host = target_host # log.info("foobar") @@ -126,7 +126,7 @@ class Cdist: def remote_run_or_fail(self, *args, **kargs): """Run something on the remote side and fail is something breaks""" - newargs = ["ssh", "root@" + self.hostname] + newargs = ["ssh", "root@" + self.target_host] newargs.extend(*args) self.run_or_fail(newargs, **kargs) @@ -135,7 +135,7 @@ class Cdist: def transfer_dir(self, source, destination): self.remove_remote_dir(destination) - self.run_or_fail(["scp", "-qr", source, "root@" + self.hostname + ":" + destination]) + self.run_or_fail(["scp", "-qr", source, "root@" + self.target_host + ":" + destination]) def global_explorer_output_path(self, explorer): """Returns path of the output for a global explorer""" @@ -185,20 +185,23 @@ class Cdist: def run_initial_manifest(self): """Run the initial manifest""" log.info("Running the initial manifest") - self.shell_run_or_debug_fail(self.initial_manifest, [self.initial_manifest]) + env = os.environ.copy() + env['__target_host'] = self.target_host + + self.shell_run_or_debug_fail(self.initial_manifest, + [self.initial_manifest], + env=env) def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to host " + self.hostname) + log.info("Deploying to host " + self.target_host) self.init_deploy() self.global_explore() self.run_initial_manifest() if __name__ == "__main__": - hostname=sys.argv[1] - parser = argparse.ArgumentParser(description='cdist ' + VERSION) parser.add_argument('host', nargs='+', help='one or more hosts to operate on') parser.add_argument('-d', '--debug', help='set log level to debug', From 4fd8a16e6cd618ed61c9e312d5e3827bb4d15b2f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 14:52:42 +0200 Subject: [PATCH 0059/1024] use *args not args :-) Signed-off-by: Nico Schottelius --- bin/cdist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 323d2a96..7059f73b 100755 --- a/bin/cdist +++ b/bin/cdist @@ -93,8 +93,8 @@ class Cdist: print("I should cleanup " + self.temp_dir) # shutil.rmtree(self.temp_dir) - def exit_error(self,*args): - log.error(args) + def exit_error(self, *args): + log.error(*args) sys.exit(1) def shell_run_or_debug_fail(self, script, *args, **kargs): From 2c2a234c74ce1a5641d3683f6ef947627585b007 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 15:13:05 +0200 Subject: [PATCH 0060/1024] use sh -e instead of shipped shell=true (see included comment) Signed-off-by: Nico Schottelius --- bin/cdist | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/bin/cdist b/bin/cdist index 7059f73b..1216edab 100755 --- a/bin/cdist +++ b/bin/cdist @@ -98,13 +98,12 @@ class Cdist: sys.exit(1) def shell_run_or_debug_fail(self, script, *args, **kargs): - kargs['shell'] = True + # Manually execute /bin/sh, because sh -e does what we want + # and sh -c -e does not exit if /bin/false called + args[0].insert(0,"/bin/sh") + args[0].insert(1,"-e") log.debug("Shell exec: " + " ".join(*args)) - # Fail if the script fails - args[0].insert(0,"-e") - print(args) - try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: @@ -115,14 +114,12 @@ class Cdist: self.exit_error("Non-Zero exit code exit of " + " ".join(*args)) def run_or_fail(self, *args, **kargs): - # newargs = ["echo"] - newargs = [] - newargs.extend(*args) + log.debug("Exec: " + " ".join(*args)) try: - subprocess.check_call(newargs, **kargs) + subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: - self.exit_error("Command failed:", " ".join(newargs)) + self.exit_error("Command failed:", " ".join(*args)) def remote_run_or_fail(self, *args, **kargs): """Run something on the remote side and fail is something breaks""" From 97f7513f6eae5796fc9046530fe528d3e083dd6d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 15:14:28 +0200 Subject: [PATCH 0061/1024] -old fixme Signed-off-by: Nico Schottelius --- bin/cdist | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 1216edab..857e127d 100755 --- a/bin/cdist +++ b/bin/cdist @@ -107,7 +107,6 @@ class Cdist: try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: - # FIXME: print out shell script! script_fd = open(script) log.error("Code that raised the error:\n" + script_fd.read()) script_fd.close() From d6db6d0c7e22b45e970299bcfcbb641dfdcc774a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 15:20:25 +0200 Subject: [PATCH 0062/1024] begin move of cdist-type-emulator to lib/ and submit initial_manifest to cdist Signed-off-by: Nico Schottelius --- bin/cdist | 3 ++- {bin => lib}/cdist-type-emulator | 0 2 files changed, 2 insertions(+), 1 deletion(-) rename {bin => lib}/cdist-type-emulator (100%) diff --git a/bin/cdist b/bin/cdist index 857e127d..6e13188d 100755 --- a/bin/cdist +++ b/bin/cdist @@ -32,6 +32,7 @@ import tempfile BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) CONF_DIR = os.path.join(BASE_DIR, "conf") GLOBAL_EXPLORER_DIR = os.path.join(CONF_DIR, "explorer") +LIB_DIR = os.path.join(BASE_DIR, "lib") MANIFEST_DIR = os.path.join(CONF_DIR, "manifest") REMOTE_BASE_DIR = "/var/lib/cdist" @@ -220,7 +221,7 @@ if __name__ == "__main__": log.debug(args) for host in args.host: - c = Cdist(host) + c = Cdist(host, initial_manifest=args.manifest) c.deploy_to() c.cleanup() except KeyboardInterrupt: diff --git a/bin/cdist-type-emulator b/lib/cdist-type-emulator similarity index 100% rename from bin/cdist-type-emulator rename to lib/cdist-type-emulator From 9ce26e5817907105c20ab9503933578717d14352 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 15:35:29 +0200 Subject: [PATCH 0063/1024] include cdist-type-emulator into path again Signed-off-by: Nico Schottelius --- bin/cdist | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bin/cdist b/bin/cdist index 6e13188d..0cc4ac7f 100755 --- a/bin/cdist +++ b/bin/cdist @@ -34,6 +34,7 @@ CONF_DIR = os.path.join(BASE_DIR, "conf") GLOBAL_EXPLORER_DIR = os.path.join(CONF_DIR, "explorer") LIB_DIR = os.path.join(BASE_DIR, "lib") MANIFEST_DIR = os.path.join(CONF_DIR, "manifest") +TYPE_DIR = os.path.join(CONF_DIR, "type") REMOTE_BASE_DIR = "/var/lib/cdist" REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") @@ -64,6 +65,10 @@ VERSION = "2.0.0" logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s') log = logging.getLogger() +# List types +def list_types(): + return os.listdir(TYPE_DIR) + class Cdist: """Cdist main class to hold arbitrary data""" @@ -74,11 +79,18 @@ class Cdist: # Setup directory paths self.temp_dir = tempfile.mkdtemp() + self.out_dir = os.path.join(self.temp_dir, "out") os.mkdir(self.out_dir) + self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") os.mkdir(self.global_explorer_out_dir) + # Setup binary directory + contents + self.bin_dir = os.path.join(self.out_dir, "bin") + os.mkdir(self.bin_dir) + self.link_type_to_emulator() + # Mostly static, but can be overwritten on user demand if initial_manifest: self.initial_manifest = initial_manifest @@ -149,6 +161,14 @@ class Cdist: def transfer_global_explorers(self): self.transfer_dir(GLOBAL_EXPLORER_DIR, REMOTE_GLOBAL_EXPLORER_DIR) + def link_type_to_emulator(self): + """Link type names to cdist-type-emulator""" + for type in list_types(): + source = os.path.join(LIB_DIR, "cdist-type-emulator") + destination = os.path.join(self.bin_dir, type) + log.debug("Linking %s to %s", source, destination) + os.symlink(source, destination) + def global_explore(self): """Run global explorers""" explorers = self.list_global_explorers() @@ -184,6 +204,7 @@ class Cdist: log.info("Running the initial manifest") env = os.environ.copy() env['__target_host'] = self.target_host + env['PATH'] = self.bin_dir + ":" + env['PATH'] self.shell_run_or_debug_fail(self.initial_manifest, [self.initial_manifest], From bf0f2b8f12949bfcd988f95533987f23d54d9695 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 15:39:21 +0200 Subject: [PATCH 0064/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index fce4033e..972525aa 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,4 +1,5 @@ - rewrite in python? + - also do with cdist-type-emulator, which had quirks applied from outside to run - support non-ssh access? - Bug: os.path.join() may be wrong for the remote side! From dbbbf822fe55f714c115fa4e610b62361dfd614e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 15:52:34 +0200 Subject: [PATCH 0065/1024] make cdist-type-emulator work Signed-off-by: Nico Schottelius --- bin/cdist | 15 ++++++++++++--- bin/cdist-deploy-to | 1 - 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index 0cc4ac7f..57df474d 100755 --- a/bin/cdist +++ b/bin/cdist @@ -169,7 +169,7 @@ class Cdist: log.debug("Linking %s to %s", source, destination) os.symlink(source, destination) - def global_explore(self): + def run_global_explores(self): """Run global explorers""" explorers = self.list_global_explorers() if(len(explorers) == 0): @@ -186,6 +186,7 @@ class Cdist: self.remote_run_or_fail(cmd, stdout=output_fd) output_fd.close() + # def run_type_explorer(self): def init_deploy(self): log.info("Creating clean directory structure") @@ -203,9 +204,17 @@ class Cdist: """Run the initial manifest""" log.info("Running the initial manifest") env = os.environ.copy() - env['__target_host'] = self.target_host env['PATH'] = self.bin_dir + ":" + env['PATH'] + env['__target_host'] = self.target_host + env['__global'] = self.out_dir + + # Legacy stuff to make cdist-type-emulator work + env['__cdist_conf_dir'] = CONF_DIR + env['__cdist_core_dir'] = os.path.join(BASE_DIR, "core") + env['__cdist_local_base_dir'] = self.temp_dir + env['__cdist_manifest'] = self.initial_manifest + self.shell_run_or_debug_fail(self.initial_manifest, [self.initial_manifest], env=env) @@ -215,7 +224,7 @@ class Cdist: """Mimic the old deploy to: Deploy to one host""" log.info("Deploying to host " + self.target_host) self.init_deploy() - self.global_explore() + self.run_global_explores() self.run_initial_manifest() diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index 79f42931..96650f90 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -43,7 +43,6 @@ __cdist_echo info "cdist $__cdist_version: Configuring $__cdist_target_host " # See cdist-stages(7) # -cdist-manifest-run-init "$__cdist_target_host" cdist-object-all "$__cdist_target_host" cdist-object-prepare cdist-object-all "$__cdist_target_host" cdist-object-run cdist-cache "$__cdist_target_host" From 0f36ddd649d5646e2955ff219524a31f1707f61e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 15:54:10 +0200 Subject: [PATCH 0066/1024] support object dir Signed-off-by: Nico Schottelius --- bin/cdist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/cdist b/bin/cdist index 57df474d..d7e2f697 100755 --- a/bin/cdist +++ b/bin/cdist @@ -86,6 +86,8 @@ class Cdist: self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") os.mkdir(self.global_explorer_out_dir) + self.object_dir = os.path.join(self.out_dir, "object") + # Setup binary directory + contents self.bin_dir = os.path.join(self.out_dir, "bin") os.mkdir(self.bin_dir) From 03e2db83cd1234e55ca2b4801f31e3094e3516b8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 17:01:22 +0200 Subject: [PATCH 0067/1024] implement list of objects Signed-off-by: Nico Schottelius --- bin/cdist | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/bin/cdist b/bin/cdist index d7e2f697..8655dcad 100755 --- a/bin/cdist +++ b/bin/cdist @@ -160,6 +160,44 @@ class Cdist: """Return list of available explorers""" return os.listdir(GLOBAL_EXPLORER_DIR) + def list_object_paths(self, starting_point = False): + """Return list of paths of existing objects""" + object_paths = [] + + if not starting_point: + starting_point = self.object_dir + + for content in os.listdir(starting_point): + full_path = os.path.join(starting_point, content) + print(full_path) + if os.path.isdir(full_path): + log.debug("Recursing for %s", full_path) + object_paths.extend(self.list_object_paths(starting_point = full_path)) + + # Directory contains .cdist -> is an object + if content == ".cdist": + log.debug("Adding Object Path %s", starting_point) + object_paths.append(starting_point) + + return object_paths + + def list_objects(self, starting_point = False): + """Return list of existing objects""" + + if not starting_point: + starting_point = self.object_dir + + object_paths = self.list_object_paths(starting_point) + objects = [] + log.debug("Paths recieved: %s", object_paths) + log.debug("And te starting point: %s", starting_point) + + for path in object_paths: + objects.append(os.path.relpath(path, starting_point)) + + return objects + + def transfer_global_explorers(self): self.transfer_dir(GLOBAL_EXPLORER_DIR, REMOTE_GLOBAL_EXPLORER_DIR) From 4d765a702406de7b351174421e6679cb6507cdd3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 17:45:07 +0200 Subject: [PATCH 0068/1024] begin type explorer transfer Signed-off-by: Nico Schottelius --- bin/cdist | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index 8655dcad..4e62bd64 100755 --- a/bin/cdist +++ b/bin/cdist @@ -38,7 +38,10 @@ TYPE_DIR = os.path.join(CONF_DIR, "type") REMOTE_BASE_DIR = "/var/lib/cdist" REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") +REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") + +DOT_CDIST = ".cdist" VERSION = "2.0.0" @@ -93,6 +96,9 @@ class Cdist: os.mkdir(self.bin_dir) self.link_type_to_emulator() + # List of type explorers transferred + self.type_explorers_transferred = {} + # Mostly static, but can be overwritten on user demand if initial_manifest: self.initial_manifest = initial_manifest @@ -175,12 +181,15 @@ class Cdist: object_paths.extend(self.list_object_paths(starting_point = full_path)) # Directory contains .cdist -> is an object - if content == ".cdist": + if content == DOT_CDIST: log.debug("Adding Object Path %s", starting_point) object_paths.append(starting_point) return object_paths + def get_type_from_object(cdist_object): + return cdist_object.split(os.sep)[0] + def list_objects(self, starting_point = False): """Return list of existing objects""" @@ -197,10 +206,20 @@ class Cdist: return objects - def transfer_global_explorers(self): self.transfer_dir(GLOBAL_EXPLORER_DIR, REMOTE_GLOBAL_EXPLORER_DIR) + def transfer_type_explorers(self, type): + """Transfer explorers of a type, but only once""" + if self.type_explorers_transferred[type] == 1 + return + else + self.type_explorers_transferred[type] = 1 + + src = os.path.join(TYPE_DIR, type) + dst = os.path.join(REMOTE_TYPE_DIR, type, "explorer") + self.transfer_dir(src, dst) + def link_type_to_emulator(self): """Link type names to cdist-type-emulator""" for type in list_types(): @@ -226,7 +245,11 @@ class Cdist: self.remote_run_or_fail(cmd, stdout=output_fd) output_fd.close() - # def run_type_explorer(self): + def run_type_explorer(self, object): + """Run type specific explorers for objects""" + # Based on bin/cdist-object-explorer-run + + # Transfering explorers for this type def init_deploy(self): log.info("Creating clean directory structure") From 97ac276433bd15722d3ada5891d47d00ddb90856 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 17:52:15 +0200 Subject: [PATCH 0069/1024] implement transfer of type explorers Signed-off-by: Nico Schottelius --- bin/cdist | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index 4e62bd64..56327fb4 100755 --- a/bin/cdist +++ b/bin/cdist @@ -211,15 +211,20 @@ class Cdist: def transfer_type_explorers(self, type): """Transfer explorers of a type, but only once""" - if self.type_explorers_transferred[type] == 1 + if type in self.type_explorers_transferred: return - else - self.type_explorers_transferred[type] = 1 src = os.path.join(TYPE_DIR, type) - dst = os.path.join(REMOTE_TYPE_DIR, type, "explorer") + base = os.path.join(REMOTE_TYPE_DIR, type) + dst = os.path.join(base, "explorer") + + # Ensure the path path exists + self.remote_run_or_fail(["mkdir", "-p", base]) self.transfer_dir(src, dst) + # Do not retransfer + self.type_explorers_transferred[type] = 1 + def link_type_to_emulator(self): """Link type names to cdist-type-emulator""" for type in list_types(): From f31f33418ff646f9107e72c33dc87c1b4d51644e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 18:03:19 +0200 Subject: [PATCH 0070/1024] begin to actually prepare the object/type explorers Signed-off-by: Nico Schottelius --- bin/cdist | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 56327fb4..0a7011b4 100755 --- a/bin/cdist +++ b/bin/cdist @@ -187,7 +187,7 @@ class Cdist: return object_paths - def get_type_from_object(cdist_object): + def get_type_from_object(self, cdist_object): return cdist_object.split(os.sep)[0] def list_objects(self, starting_point = False): @@ -250,11 +250,13 @@ class Cdist: self.remote_run_or_fail(cmd, stdout=output_fd) output_fd.close() - def run_type_explorer(self, object): + def run_type_explorer(self, cdist_object): """Run type specific explorers for objects""" # Based on bin/cdist-object-explorer-run # Transfering explorers for this type + type = self.get_type_from_object(cdist_object) + self.transfer_type_explorers(type) def init_deploy(self): log.info("Creating clean directory structure") @@ -294,6 +296,11 @@ class Cdist: self.init_deploy() self.run_global_explores() self.run_initial_manifest() + + objects = self.list_objects() + + for cdist_object in objects: + self.run_type_explorer(cdist_object) if __name__ == "__main__": From ab0cd9430fc270f0f99d21e16c5360173db9b914 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 22:40:12 +0200 Subject: [PATCH 0071/1024] add support for the banner :-) Signed-off-by: Nico Schottelius --- bin/cdist | 61 ++++++++++++++++++++++++--- conf/type/__directory/explorer/exists | 30 ------------- 2 files changed, 56 insertions(+), 35 deletions(-) delete mode 100755 conf/type/__directory/explorer/exists diff --git a/bin/cdist b/bin/cdist index 0a7011b4..ad87b38c 100755 --- a/bin/cdist +++ b/bin/cdist @@ -28,6 +28,21 @@ import shutil import sys import tempfile +BANNER = """ + .. . .x+=:. s + dF @88> z` ^% :8 + '88bu. %8P . . -# -# -# Check whether file exists or not -# - -destination="/$__object_id" - -if [ -e "$destination" ]; then - echo yes -else - echo no -fi From 7e8362eeedd24f7df7c983d4e698dfdccb162f76 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 22:44:25 +0200 Subject: [PATCH 0072/1024] allow zero hosts to be specified, fixup exit_error Signed-off-by: Nico Schottelius --- bin/cdist | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index ad87b38c..8f556b1e 100755 --- a/bin/cdist +++ b/bin/cdist @@ -160,7 +160,7 @@ class Cdist: try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: - self.exit_error("Command failed:", " ".join(*args)) + self.exit_error("Command failed: " + " ".join(*args)) def remote_run_or_fail(self, *args, **kargs): """Run something on the remote side and fail is something breaks""" @@ -349,20 +349,20 @@ class Cdist: if __name__ == "__main__": parser = argparse.ArgumentParser(description='cdist ' + VERSION) - parser.add_argument('host', nargs='+', help='one or more hosts to operate on') + parser.add_argument('host', nargs='*', help='one or more hosts to operate on') parser.add_argument('-b', '--banner', help='Show cdist banner', action='store_true', dest='banner') - parser.add_argument('-d', '--debug', help='set log level to debug', + parser.add_argument('-d', '--debug', help='Set log level to debug', action='store_true') parser.add_argument('-i', '--initial-manifest', - help='path to a cdist manifest or - to read from stdin', + help='Path to a cdist manifest or - to read from stdin', dest='manifest', required=False) parser.add_argument('-p', '--parallel', - help='operate on multiple hosts in parallel', + help='Operate on multiple hosts in parallel', action='store_true', dest='parallel') parser.add_argument('-s', '--sequential', - help='operate on multiple hosts sequentially', + help='Operate on multiple hosts sequentially', action='store_false', dest='parallel') args = parser.parse_args(sys.argv[1:]) From cbdb5cd05d0ea4a98d54cc83d6b03f4be136cbc7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 8 Sep 2011 23:01:11 +0200 Subject: [PATCH 0073/1024] fixup type explorer run Signed-off-by: Nico Schottelius --- bin/cdist | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/bin/cdist b/bin/cdist index 8f556b1e..3f57de40 100755 --- a/bin/cdist +++ b/bin/cdist @@ -189,7 +189,13 @@ class Cdist: def list_type_explorers(self, type): """Return list of available explorers for a specific type""" - return os.listdir(type_explorer_dir(type)) + dir = self.type_explorer_dir(type) + if os.path.isdir(dir): + list = os.listdir(dir) + else: + list = [] + + return list def list_object_paths(self, starting_point = False): """Return list of paths of existing objects""" @@ -234,7 +240,7 @@ class Cdist: """Return directory that holds the explorers of a type""" return os.path.join(TYPE_DIR, type, "explorer") - def remote_type_explorer_dir(type): + def remote_type_explorer_dir(self, type): """Return remote directory that holds the explorers of a type""" return os.path.join(REMOTE_TYPE_DIR, type, "explorer") @@ -246,17 +252,20 @@ class Cdist: if type in self.type_explorers_transferred: log.debug("Skipping retransfer for %s", type) return + else: + # Do not retransfer + self.type_explorers_transferred[type] = 1 src = self.type_explorer_dir(type) remote_base = os.path.join(REMOTE_TYPE_DIR, type) - dst = self.type_explorer_dir(type) + dst = self.remote_type_explorer_dir(type) - # Ensure the path path exists - self.remote_run_or_fail(["mkdir", "-p", remote_base]) - self.transfer_dir(src, dst) + # Only continue, if there is at least the directory + if os.path.isdir(src): + # Ensure that the path exists + self.remote_run_or_fail(["mkdir", "-p", remote_base]) + self.transfer_dir(src, dst) - # Do not retransfer - self.type_explorers_transferred[type] = 1 def link_type_to_emulator(self): """Link type names to cdist-type-emulator""" @@ -293,12 +302,12 @@ class Cdist: cmd = [] cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append("__type_explorer=" + remote_type_explorer_dir(type)) + cmd.append("__type_explorer=" + self.remote_type_explorer_dir(type)) - explorers = list_type_explorers(type) + explorers = self.list_type_explorers(type) for explorer in explorers: remote_cmd = cmd - remote_cmd.append(os.path.join(remote_type_explorer_dir(type), explorer)) + remote_cmd.append(os.path.join(self.remote_type_explorer_dir(type), explorer)) self.remote_run_or_fail(remote_cmd) From 8889e4a5b0b0e14ecfc6752edc000bcb917fb618 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 9 Sep 2011 08:06:16 +0200 Subject: [PATCH 0074/1024] prepare saving output of type explorers Signed-off-by: Nico Schottelius --- bin/cdist | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 3f57de40..b35b8c17 100755 --- a/bin/cdist +++ b/bin/cdist @@ -309,7 +309,12 @@ class Cdist: remote_cmd = cmd remote_cmd.append(os.path.join(self.remote_type_explorer_dir(type), explorer)) - self.remote_run_or_fail(remote_cmd) + output = self.type_explorer_output_path(cdist_object) + output_fd = open(output, mode='w') + + self.remote_run_or_fail(remote_cmd, stdout=output_fd) + + output_fd.close() def init_deploy(self): log.info("Creating clean directory structure") From 894c39cd210ea0d312cd07aaf3f01d6e99ca0144 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 9 Sep 2011 12:18:25 +0200 Subject: [PATCH 0075/1024] store results of type explorer Signed-off-by: Nico Schottelius --- bin/cdist | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index b35b8c17..e2e53c9d 100755 --- a/bin/cdist +++ b/bin/cdist @@ -179,6 +179,14 @@ class Cdist: """Returns path of the output for a global explorer""" return os.path.join(self.global_explorer_out_dir, explorer) + def type_explorer_output_dir(self, cdist_object): + """Returns and creates dir of the output for a type explorer""" + dir = os.path.join(self.object_full_path(cdist_object), DOT_CDIST, "explorer") + if not os.path.isdir(dir): + os.mkdir(dir) + + return dir + def remote_global_explorer_path(self, explorer): """Returns path to the remote explorer""" return os.path.join(REMOTE_GLOBAL_EXPLORER_DIR, explorer) @@ -219,8 +227,13 @@ class Cdist: return object_paths def get_type_from_object(self, cdist_object): + """Returns the first part (i.e. type) of an object""" return cdist_object.split(os.sep)[0] + def object_full_path(self, cdist_object): + """Returns the full path to the object (""" + return os.path.join(self.object_dir, cdist_object) + def list_objects(self, starting_point = False): """Return list of existing objects""" @@ -304,12 +317,15 @@ class Cdist: cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) cmd.append("__type_explorer=" + self.remote_type_explorer_dir(type)) + # FIXME: need to transfer object before as well! + cmd.append("__object=" + self.remote_type_explorer_dir(type)) + explorers = self.list_type_explorers(type) for explorer in explorers: remote_cmd = cmd remote_cmd.append(os.path.join(self.remote_type_explorer_dir(type), explorer)) - output = self.type_explorer_output_path(cdist_object) + output = os.path.join(self.type_explorer_output_dir(cdist_object), explorer) output_fd = open(output, mode='w') self.remote_run_or_fail(remote_cmd, stdout=output_fd) From b2d1d1bee703e177a952e80660782cf06df5e782 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 9 Sep 2011 14:21:16 +0200 Subject: [PATCH 0076/1024] begin to modify tuple (bad idea) Signed-off-by: Nico Schottelius --- bin/cdist | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/bin/cdist b/bin/cdist index e2e53c9d..0772c703 100755 --- a/bin/cdist +++ b/bin/cdist @@ -157,19 +157,29 @@ class Cdist: def run_or_fail(self, *args, **kargs): log.debug("Exec: " + " ".join(*args)) + if "remote" in kargs: + log.debug("Remote found") + if kargs["remote"]: + # Replace the list found in the tuple at position 0 + cmd = ["ssh", "root@" + self.target_host] + cmd.extend(args[0]) + args[0] = cmd + print(newargs) + + del kargs["remote"] + + log.debug(newargs) try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: - self.exit_error("Command failed: " + " ".join(*args)) + self.exit_error("Command failed: " + " ".join(*newargs)) - def remote_run_or_fail(self, *args, **kargs): - """Run something on the remote side and fail is something breaks""" - newargs = ["ssh", "root@" + self.target_host] - newargs.extend(*args) - self.run_or_fail(newargs, **kargs) +# def remote_run_or_fail(self, *args, **kargs): +# """Run something on the remote side and fail is something breaks""" +# self.run_or_fail(newargs, **kargs) def remove_remote_dir(self, destination): - self.remote_run_or_fail(["rm", "-rf", destination]) + self.run_or_fail(["rm", "-rf", destination], remote=True) def transfer_dir(self, source, destination): self.remove_remote_dir(destination) From c1ad93bccc6cf93b3a5129914624ec3350ca9b14 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 9 Sep 2011 14:27:54 +0200 Subject: [PATCH 0077/1024] extend run_or_fail to include remote exec Signed-off-by: Nico Schottelius --- bin/cdist | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/bin/cdist b/bin/cdist index 0772c703..5227dc06 100755 --- a/bin/cdist +++ b/bin/cdist @@ -155,20 +155,14 @@ class Cdist: self.exit_error("Non-Zero exit code exit of " + " ".join(*args)) def run_or_fail(self, *args, **kargs): - log.debug("Exec: " + " ".join(*args)) - if "remote" in kargs: log.debug("Remote found") if kargs["remote"]: - # Replace the list found in the tuple at position 0 - cmd = ["ssh", "root@" + self.target_host] - cmd.extend(args[0]) - args[0] = cmd - print(newargs) + args[0][:0] = ["ssh", "root@" + self.target_host] del kargs["remote"] - log.debug(newargs) + log.debug("Exec: " + " ".join(*args)) try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: From 20aafe62f578bf51512507d53d9f385e1b94dba7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 9 Sep 2011 14:30:53 +0200 Subject: [PATCH 0078/1024] make use of remote=True flag Signed-off-by: Nico Schottelius --- bin/cdist | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/bin/cdist b/bin/cdist index 5227dc06..68424cfd 100755 --- a/bin/cdist +++ b/bin/cdist @@ -168,10 +168,6 @@ class Cdist: except subprocess.CalledProcessError: self.exit_error("Command failed: " + " ".join(*newargs)) -# def remote_run_or_fail(self, *args, **kargs): -# """Run something on the remote side and fail is something breaks""" -# self.run_or_fail(newargs, **kargs) - def remove_remote_dir(self, destination): self.run_or_fail(["rm", "-rf", destination], remote=True) @@ -280,7 +276,7 @@ class Cdist: # Only continue, if there is at least the directory if os.path.isdir(src): # Ensure that the path exists - self.remote_run_or_fail(["mkdir", "-p", remote_base]) + self.run_or_fail(["mkdir", "-p", remote_base], remote=True) self.transfer_dir(src, dst) @@ -306,7 +302,7 @@ class Cdist: cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) cmd.append(self.remote_global_explorer_path(explorer)) - self.remote_run_or_fail(cmd, stdout=output_fd) + self.run_or_fail(cmd, stdout=output_fd, remote=True) output_fd.close() def run_type_explorer(self, cdist_object): @@ -332,7 +328,7 @@ class Cdist: output = os.path.join(self.type_explorer_output_dir(cdist_object), explorer) output_fd = open(output, mode='w') - self.remote_run_or_fail(remote_cmd, stdout=output_fd) + self.run_or_fail(remote_cmd, stdout=output_fd, remote=True) output_fd.close() From f21ce6a0db1f778fba8c3726155fa7562c3a4635 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 9 Sep 2011 14:51:25 +0200 Subject: [PATCH 0079/1024] commit broken code Signed-off-by: Nico Schottelius --- bin/cdist | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/bin/cdist b/bin/cdist index 68424cfd..a0189fbe 100755 --- a/bin/cdist +++ b/bin/cdist @@ -98,6 +98,7 @@ class Cdist: def __init__(self, target_host, initial_manifest=False): self.target_host = target_host + self.remote_prefix = ["ssh", "root@" + self.target_host] # log.info("foobar") @@ -139,26 +140,47 @@ class Cdist: log.error(*args) sys.exit(1) + def remote_cat(filename): + cmd = self.remote_prefix + cmd.append("cat") + cmd.append(filename) + try: + subprocess.call(cmd) + except subprocess.CalledProcessError: + log.error("Remote cat failed") + def shell_run_or_debug_fail(self, script, *args, **kargs): # Manually execute /bin/sh, because sh -e does what we want # and sh -c -e does not exit if /bin/false called - args[0].insert(0,"/bin/sh") - args[0].insert(1,"-e") - log.debug("Shell exec: " + " ".join(*args)) + args[0][:0] = [ "/bin/sh", "-e" ] + if "remote" in kargs: + log.debug("Remote found") + if kargs["remote"]: + args[0][:0] = self.remote_prefix + remote = true + + del kargs["remote"] + + log.debug("Shell exec: " + " ".join(*args)) try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: - script_fd = open(script) - log.error("Code that raised the error:\n" + script_fd.read()) - script_fd.close() + log.error("Code that raised the error:\n") + if remote: + remote_cat(script) + else: + script_fd = open(script) + print(script_fd.read()) + script_fd.close() + self.exit_error("Non-Zero exit code exit of " + " ".join(*args)) def run_or_fail(self, *args, **kargs): if "remote" in kargs: log.debug("Remote found") if kargs["remote"]: - args[0][:0] = ["ssh", "root@" + self.target_host] + args[0][:0] = self.remote_prefix del kargs["remote"] @@ -166,7 +188,7 @@ class Cdist: try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: - self.exit_error("Command failed: " + " ".join(*newargs)) + self.exit_error("Command failed: " + " ".join(*args)) def remove_remote_dir(self, destination): self.run_or_fail(["rm", "-rf", destination], remote=True) @@ -322,6 +344,7 @@ class Cdist: explorers = self.list_type_explorers(type) for explorer in explorers: + # THIS IS A BUG, because remote_cmd is NOT a copy remote_cmd = cmd remote_cmd.append(os.path.join(self.remote_type_explorer_dir(type), explorer)) From 2c15069d96e0e35cffc7e4523f7ddf85d7d87212 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 9 Sep 2011 14:56:51 +0200 Subject: [PATCH 0080/1024] make remote_cmd a new list Signed-off-by: Nico Schottelius --- bin/cdist | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index a0189fbe..70df214c 100755 --- a/bin/cdist +++ b/bin/cdist @@ -344,9 +344,7 @@ class Cdist: explorers = self.list_type_explorers(type) for explorer in explorers: - # THIS IS A BUG, because remote_cmd is NOT a copy - remote_cmd = cmd - remote_cmd.append(os.path.join(self.remote_type_explorer_dir(type), explorer)) + remote_cmd = cmd + os.path.join(self.remote_type_explorer_dir(type), explorer) output = os.path.join(self.type_explorer_output_dir(cdist_object), explorer) output_fd = open(output, mode='w') From 6d5a53b7ad9368c2ee3bc704a7068fad5b52ee9c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 9 Sep 2011 15:00:09 +0200 Subject: [PATCH 0081/1024] fixup list bug by creating a new one Signed-off-by: Nico Schottelius --- bin/cdist | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 70df214c..80d9f525 100755 --- a/bin/cdist +++ b/bin/cdist @@ -155,7 +155,6 @@ class Cdist: args[0][:0] = [ "/bin/sh", "-e" ] if "remote" in kargs: - log.debug("Remote found") if kargs["remote"]: args[0][:0] = self.remote_prefix remote = true @@ -178,7 +177,6 @@ class Cdist: def run_or_fail(self, *args, **kargs): if "remote" in kargs: - log.debug("Remote found") if kargs["remote"]: args[0][:0] = self.remote_prefix @@ -344,13 +342,10 @@ class Cdist: explorers = self.list_type_explorers(type) for explorer in explorers: - remote_cmd = cmd + os.path.join(self.remote_type_explorer_dir(type), explorer) - + remote_cmd = cmd + [os.path.join(self.remote_type_explorer_dir(type), explorer)] output = os.path.join(self.type_explorer_output_dir(cdist_object), explorer) output_fd = open(output, mode='w') - self.run_or_fail(remote_cmd, stdout=output_fd, remote=True) - output_fd.close() def init_deploy(self): From 722339f3e1164b0aac1d2e54904a2f2a510d5548 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 9 Sep 2011 15:16:47 +0200 Subject: [PATCH 0082/1024] support getting paths of objects and their parameters Signed-off-by: Nico Schottelius --- bin/cdist | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 80d9f525..302e21be 100755 --- a/bin/cdist +++ b/bin/cdist @@ -53,6 +53,7 @@ TYPE_DIR = os.path.join(CONF_DIR, "type") REMOTE_BASE_DIR = "/var/lib/cdist" REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") +REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") @@ -100,8 +101,6 @@ class Cdist: self.target_host = target_host self.remote_prefix = ["ssh", "root@" + self.target_host] - # log.info("foobar") - # Setup directory paths self.temp_dir = tempfile.mkdtemp() @@ -192,6 +191,7 @@ class Cdist: self.run_or_fail(["rm", "-rf", destination], remote=True) def transfer_dir(self, source, destination): + """Transfer directory and previously delete the remote destination""" self.remove_remote_dir(destination) self.run_or_fail(["scp", "-qr", source, "root@" + self.target_host + ":" + destination]) @@ -201,7 +201,7 @@ class Cdist: def type_explorer_output_dir(self, cdist_object): """Returns and creates dir of the output for a type explorer""" - dir = os.path.join(self.object_full_path(cdist_object), DOT_CDIST, "explorer") + dir = os.path.join(self.object_dir(cdist_object), "explorer") if not os.path.isdir(dir): os.mkdir(dir) @@ -250,9 +250,21 @@ class Cdist: """Returns the first part (i.e. type) of an object""" return cdist_object.split(os.sep)[0] - def object_full_path(self, cdist_object): - """Returns the full path to the object (""" - return os.path.join(self.object_dir, cdist_object) + def object_dir(self, cdist_object): + """Returns the full path to the object (including .cdist)""" + return os.path.join(self.object_dir, cdist_object, DOT_CDIST) + + def remote_object_dir(self, cdist_object): + """Returns the remote full path to the object (including .cdist)""" + return os.path.join(REMOTE_OBJECT_DIR, cdist_object, DOT_CDIST) + + def object_parameter_dir(self, cdist_object): + """Returns the dir to the object parameter""" + return os.path.join(object_dir(cdist_object), "parameter") + + def remote_object_parameter_dir(self, cdist_object): + """Returns the remote dir to the object parameter""" + return os.path.join(remote_object_dir(cdist_object), "parameter") def list_objects(self, starting_point = False): """Return list of existing objects""" @@ -277,6 +289,9 @@ class Cdist: """Return remote directory that holds the explorers of a type""" return os.path.join(REMOTE_TYPE_DIR, type, "explorer") + def transfer_object_parameter(self, cdist_object): + self.transfer_dir(object_dir(cdist_object), ) + def transfer_global_explorers(self): self.transfer_dir(GLOBAL_EXPLORER_DIR, REMOTE_GLOBAL_EXPLORER_DIR) From db2562303ade41004fe9849074410caa18840376 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 9 Sep 2011 15:28:38 +0200 Subject: [PATCH 0083/1024] in theory transfer the object parameters Signed-off-by: Nico Schottelius --- bin/cdist | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/bin/cdist b/bin/cdist index 302e21be..b2f10ba1 100755 --- a/bin/cdist +++ b/bin/cdist @@ -110,7 +110,7 @@ class Cdist: self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") os.mkdir(self.global_explorer_out_dir) - self.object_dir = os.path.join(self.out_dir, "object") + self.object_base_dir = os.path.join(self.out_dir, "object") # Setup binary directory + contents self.bin_dir = os.path.join(self.out_dir, "bin") @@ -230,7 +230,7 @@ class Cdist: object_paths = [] if not starting_point: - starting_point = self.object_dir + starting_point = self.object_base_dir for content in os.listdir(starting_point): full_path = os.path.join(starting_point, content) @@ -252,7 +252,7 @@ class Cdist: def object_dir(self, cdist_object): """Returns the full path to the object (including .cdist)""" - return os.path.join(self.object_dir, cdist_object, DOT_CDIST) + return os.path.join(self.object_base_dir, cdist_object, DOT_CDIST) def remote_object_dir(self, cdist_object): """Returns the remote full path to the object (including .cdist)""" @@ -260,17 +260,17 @@ class Cdist: def object_parameter_dir(self, cdist_object): """Returns the dir to the object parameter""" - return os.path.join(object_dir(cdist_object), "parameter") + return os.path.join(self.object_dir(cdist_object), "parameter") def remote_object_parameter_dir(self, cdist_object): """Returns the remote dir to the object parameter""" - return os.path.join(remote_object_dir(cdist_object), "parameter") + return os.path.join(self.remote_object_dir(cdist_object), "parameter") def list_objects(self, starting_point = False): """Return list of existing objects""" if not starting_point: - starting_point = self.object_dir + starting_point = self.object_base_dir object_paths = self.list_object_paths(starting_point) objects = [] @@ -290,9 +290,12 @@ class Cdist: return os.path.join(REMOTE_TYPE_DIR, type, "explorer") def transfer_object_parameter(self, cdist_object): - self.transfer_dir(object_dir(cdist_object), ) + """Transfer the object parameter to the remote destination""" + self.transfer_dir(self.object_parameter_dir(cdist_object), + self.remote_object_parameter_dir(cdist_object)) def transfer_global_explorers(self): + """Transfer the global explorers""" self.transfer_dir(GLOBAL_EXPLORER_DIR, REMOTE_GLOBAL_EXPLORER_DIR) def transfer_type_explorers(self, type): @@ -352,8 +355,9 @@ class Cdist: cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) cmd.append("__type_explorer=" + self.remote_type_explorer_dir(type)) - # FIXME: need to transfer object before as well! - cmd.append("__object=" + self.remote_type_explorer_dir(type)) + # Need to transfer at least the parameters for objects to be useful + self.transfer_object_parameter(cdist_object) + cmd.append("__object=" + self.remote_object_dir(cdist_object)) explorers = self.list_type_explorers(type) for explorer in explorers: From 14ac0e3ad166cc90a947d88e2b120f3746cd67b5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 9 Sep 2011 20:53:09 +0200 Subject: [PATCH 0084/1024] introduce remote_mkdir() Signed-off-by: Nico Schottelius --- bin/cdist | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index b2f10ba1..30af2827 100755 --- a/bin/cdist +++ b/bin/cdist @@ -139,6 +139,10 @@ class Cdist: log.error(*args) sys.exit(1) + def remote_mkdir(directory): + """Create directory on remote side""" + self.run_or_fail(["mkdir", "-p", directory], remote=True) + def remote_cat(filename): cmd = self.remote_prefix cmd.append("cat") @@ -234,14 +238,11 @@ class Cdist: for content in os.listdir(starting_point): full_path = os.path.join(starting_point, content) - print(full_path) if os.path.isdir(full_path): - log.debug("Recursing for %s", full_path) object_paths.extend(self.list_object_paths(starting_point = full_path)) # Directory contains .cdist -> is an object if content == DOT_CDIST: - log.debug("Adding Object Path %s", starting_point) object_paths.append(starting_point) return object_paths @@ -314,7 +315,7 @@ class Cdist: # Only continue, if there is at least the directory if os.path.isdir(src): # Ensure that the path exists - self.run_or_fail(["mkdir", "-p", remote_base], remote=True) + self.remote_mkdir(remote_base) self.transfer_dir(src, dst) From 99268591c2e3eddbc49bb95f5b2fa31b7f8bd42f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 9 Sep 2011 20:54:17 +0200 Subject: [PATCH 0085/1024] make more use of run_or_fail Signed-off-by: Nico Schottelius --- bin/cdist | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/bin/cdist b/bin/cdist index 30af2827..72b7a752 100755 --- a/bin/cdist +++ b/bin/cdist @@ -139,18 +139,13 @@ class Cdist: log.error(*args) sys.exit(1) - def remote_mkdir(directory): + def remote_mkdir(self, directory): """Create directory on remote side""" self.run_or_fail(["mkdir", "-p", directory], remote=True) def remote_cat(filename): - cmd = self.remote_prefix - cmd.append("cat") - cmd.append(filename) - try: - subprocess.call(cmd) - except subprocess.CalledProcessError: - log.error("Remote cat failed") + """Use cat on the remote side for output""" + self.run_or_fail(["cat", filename], remote=True) def shell_run_or_debug_fail(self, script, *args, **kargs): # Manually execute /bin/sh, because sh -e does what we want From 232618a675fc90accea25646171a9db30b54a2b9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 00:01:16 +0200 Subject: [PATCH 0086/1024] make manifest run more generic Signed-off-by: Nico Schottelius --- bin/cdist | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index 72b7a752..4f9e95de 100755 --- a/bin/cdist +++ b/bin/cdist @@ -287,6 +287,10 @@ class Cdist: def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" + # Create base path before using mkdir -p + self.remote_mkdir(self.remote_object_parameter_dir(cdist_object)) + + # Synchronise parameter dir afterwards self.transfer_dir(self.object_parameter_dir(cdist_object), self.remote_object_parameter_dir(cdist_object)) @@ -375,8 +379,13 @@ class Cdist: # # Link configuraion source directory - consistent with remote # run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) + # def run_object_manifest(self, cdist_object): def run_initial_manifest(self): """Run the initial manifest""" + self.run_manifest(self.initial_manifest) + + def run_manifest(self, manifest, extra_env=None): + """Run a manifest""" log.info("Running the initial manifest") env = os.environ.copy() env['PATH'] = self.bin_dir + ":" + env['PATH'] @@ -390,9 +399,11 @@ class Cdist: env['__cdist_local_base_dir'] = self.temp_dir env['__cdist_manifest'] = self.initial_manifest - self.shell_run_or_debug_fail(self.initial_manifest, - [self.initial_manifest], - env=env) + # Other environment stuff + if extra_env: + env.update(extra_env) + + self.shell_run_or_debug_fail(manifest, [manifest], env=env) def deploy_to(self): From 8dff399c9654b8983e2997f483253e162c839eb3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 00:09:57 +0200 Subject: [PATCH 0087/1024] reloop until no new objects are created anyomer Signed-off-by: Nico Schottelius --- bin/cdist | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index 4f9e95de..505bb012 100755 --- a/bin/cdist +++ b/bin/cdist @@ -379,11 +379,14 @@ class Cdist: # # Link configuraion source directory - consistent with remote # run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) - # def run_object_manifest(self, cdist_object): def run_initial_manifest(self): """Run the initial manifest""" self.run_manifest(self.initial_manifest) + def run_type_manifest(self, cdist_object): + """Run manifest for a specific object""" + self.run_manifest(self.initial_manifest) + def run_manifest(self, manifest, extra_env=None): """Run a manifest""" log.info("Running the initial manifest") @@ -413,10 +416,18 @@ class Cdist: self.run_global_explores() self.run_initial_manifest() + old_objects = [] objects = self.list_objects() - for cdist_object in objects: - self.run_type_explorer(cdist_object) + # Continue process until no new objects are created anymore + while not old_objects == objects: + old_objects = objects.copy() + for cdist_object in objects: + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + + objects = self.list_objects() + if __name__ == "__main__": From 13e3e27679443d558ddaa9846603c4da390cfb5e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 00:29:51 +0200 Subject: [PATCH 0088/1024] changes for next Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 7e98277a..6d25f234 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,5 +1,6 @@ next: * New Type: __package_rubygem (Chase Allen James) + * __self replaced by __object_fq (or so) 1.7.1: 2011-07-26 * Documentation: Add explorers to reference From 7eb418c3ab6db117db2de036226d05da3033b1cd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 00:40:45 +0200 Subject: [PATCH 0089/1024] correct env for the various stages Signed-off-by: Nico Schottelius --- bin/cdist | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/bin/cdist b/bin/cdist index 505bb012..af19a676 100755 --- a/bin/cdist +++ b/bin/cdist @@ -246,6 +246,10 @@ class Cdist: """Returns the first part (i.e. type) of an object""" return cdist_object.split(os.sep)[0] + def get_object_id_from_object(self, cdist_object): + """Returns everything but the first part (i.e. object_id) of an object""" + return os.sep.join(cdist_object.split(os.sep)[1:]) + def object_dir(self, cdist_object): """Returns the full path to the object (including .cdist)""" return os.path.join(self.object_base_dir, cdist_object, DOT_CDIST) @@ -281,6 +285,10 @@ class Cdist: """Return directory that holds the explorers of a type""" return os.path.join(TYPE_DIR, type, "explorer") + def type_manifest_path(self, type): + """Return path to manifest of type""" + return os.path.join(TYPE_DIR, type, "manifest") + def remote_type_explorer_dir(self, type): """Return remote directory that holds the explorers of a type""" return os.path.join(REMOTE_TYPE_DIR, type, "explorer") @@ -352,6 +360,7 @@ class Cdist: self.transfer_type_explorers(type) cmd = [] + # FIXME: __global::__object_id::__self:: cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) cmd.append("__type_explorer=" + self.remote_type_explorer_dir(type)) @@ -381,15 +390,27 @@ class Cdist: def run_initial_manifest(self): """Run the initial manifest""" - self.run_manifest(self.initial_manifest) + # FIXME: add support for __manifest:: + env = { "__manifest" : MANIFEST_DIR } + self.run_manifest(self.initial_manifest, extra_env=env) def run_type_manifest(self, cdist_object): """Run manifest for a specific object""" - self.run_manifest(self.initial_manifest) + type = self.get_type_from_object(cdist_object) + manifest = self.type_manifest_path(type) + + # FIXME: add more sensible checks for manifest + if os.path.exists(manifest): + env = { "__object" : self.object_dir(cdist_object), + "__object_id": self.get_object_id_from_object(cdist_object), + "__object_fq": cdist_object, + "__type": type + } + self.run_manifest(self.initial_manifest, extra_env=env) def run_manifest(self, manifest, extra_env=None): """Run a manifest""" - log.info("Running the initial manifest") + log.info("Running manifest %s", manifest) env = os.environ.copy() env['PATH'] = self.bin_dir + ":" + env['PATH'] @@ -420,8 +441,10 @@ class Cdist: objects = self.list_objects() # Continue process until no new objects are created anymore - while not old_objects == objects: - old_objects = objects.copy() + while old_objects != objects: + log.debug("Prepare stage") + old_objects = list(objects) + # FIXME: do not rerun existing objects! for cdist_object in objects: self.run_type_explorer(cdist_object) self.run_type_manifest(cdist_object) From 4e2e731374a55827e4670885b6c4bf6948c3a9d5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 00:43:28 +0200 Subject: [PATCH 0090/1024] execute the correct manifest for objects Signed-off-by: Nico Schottelius --- bin/cdist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index af19a676..ff114325 100755 --- a/bin/cdist +++ b/bin/cdist @@ -406,11 +406,11 @@ class Cdist: "__object_fq": cdist_object, "__type": type } - self.run_manifest(self.initial_manifest, extra_env=env) + self.run_manifest(manifest, extra_env=env) def run_manifest(self, manifest, extra_env=None): """Run a manifest""" - log.info("Running manifest %s", manifest) + log.info("Running manifest %s, env=%s", manifest, extra_env) env = os.environ.copy() env['PATH'] = self.bin_dir + ":" + env['PATH'] From bc6201102eb0b1d09f4328959b38f3608b7048ba Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 00:44:15 +0200 Subject: [PATCH 0091/1024] todo-- Signed-off-by: Nico Schottelius --- bin/cdist-deploy-to | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index 96650f90..86e15800 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -43,7 +43,6 @@ __cdist_echo info "cdist $__cdist_version: Configuring $__cdist_target_host " # See cdist-stages(7) # -cdist-object-all "$__cdist_target_host" cdist-object-prepare cdist-object-all "$__cdist_target_host" cdist-object-run cdist-cache "$__cdist_target_host" From f5c2ae3049c48bb056fdc9570648f36a892045d1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 00:48:24 +0200 Subject: [PATCH 0092/1024] begin cleanup Signed-off-by: Nico Schottelius --- bin/cdist-cache | 39 -------------------------- bin/cdist-dir | 51 ---------------------------------- bin/cdist-run-remote | 33 ---------------------- bin/cdist-type-build-emulation | 43 ---------------------------- 4 files changed, 166 deletions(-) delete mode 100755 bin/cdist-cache delete mode 100755 bin/cdist-dir delete mode 100755 bin/cdist-run-remote delete mode 100755 bin/cdist-type-build-emulation diff --git a/bin/cdist-cache b/bin/cdist-cache deleted file mode 100755 index ee27ffb4..00000000 --- a/bin/cdist-cache +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# -# 2010 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 . -# -# -# Let's build a cconfig tree from a configuration -# And save it into the cache tree -# - -. cdist-config -[ $# -eq 1 ] || __cdist_usage "" -set -u - -__cdist_target_host="$1"; shift - -# Create base to move into -mkdir -p "${__cdist_local_base_cache_dir}" - -# Now determine absolute path -__cdist_ddir="$(__cdist_host_cache_dir "$__cdist_target_host")" - -__cdist_echo info "Saving cache to $__cdist_ddir " -rm -rf "$__cdist_ddir" -mv "$__cdist_local_base_dir" "$__cdist_ddir" diff --git a/bin/cdist-dir b/bin/cdist-dir deleted file mode 100755 index 0d30e14a..00000000 --- a/bin/cdist-dir +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Push a directory to a target, both sides have the same name (i.e. explorers) -# or -# Pull a directory from a target, both sides have the same name (i.e. explorers) -# - - -. cdist-config -[ $# -eq 4 ] || __cdist_usage " " -set -ue - -__cdist_action="$1"; shift -__cdist_target_host="$1"; shift -__cdist_src_dir="$1"; shift -__cdist_dst_dir="$1"; shift - -# This will be the destination directory, so no subdirectories -# of the same name are created, if the directory is already existing -__cdist_top_dir="${__cdist_dst_dir%/*}" - -if [ "$__cdist_action" = "push" ]; then - ssh "${__cdist_remote_user}@${__cdist_target_host}" \ - "mkdir -p \"${__cdist_dst_dir}\"" - scp -qr "$__cdist_src_dir" \ - "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_top_dir}" -elif [ "$__cdist_action" = "pull" ]; then - mkdir -p "${__cdist_dst_dir}" - scp -qr "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_src_dir}" \ - "${__cdist_top_dir}" -else - __cdist_exit_err "Unknown action $__cdist_action" -fi diff --git a/bin/cdist-run-remote b/bin/cdist-run-remote deleted file mode 100755 index 4a4452a2..00000000 --- a/bin/cdist-run-remote +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Run a cdist binary on the remote side -# - -. cdist-config -[ $# -ge 2 ] || __cdist_usage " [opts]" -set -ue - -__cdist_target_host="$1"; shift - -ssh "${__cdist_remote_user}@${__cdist_target_host}" \ - "export PATH=\"${__cdist_remote_bin_dir}:\$PATH\";" \ - "export __cdist_out_object_dir=\"$__cdist_remote_out_object_dir\";" \ - "$@" diff --git a/bin/cdist-type-build-emulation b/bin/cdist-type-build-emulation deleted file mode 100755 index 51c2f5b4..00000000 --- a/bin/cdist-type-build-emulation +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# Build pseudo binaries for type emulation -# - -. cdist-config -[ $# -eq 1 ] || __cdist_usage "" -set -eu - -__cdist_output_dir="$1"; shift - -__cdist_type_emulator="$__cdist_abs_mydir/cdist-type-emulator" - -if [ ! -d "${__cdist_type_dir}" ]; then - __cdist_exit_err "$__cdist_type_dir must exist and contain available types" -fi - -# Get Types -cd "${__cdist_type_dir}" -ls -1 > "${__cdist_tmp_file}" - -# Create binaries -mkdir -p "${__cdist_output_dir}" -while read type; do - ln -sf "${__cdist_type_emulator}" "${__cdist_output_dir}/${type}" -done < "${__cdist_tmp_file}" From 74c280911bb1e3bca234d72236df9a584feb29c9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 00:53:10 +0200 Subject: [PATCH 0093/1024] begin run_object_gencode() and import missing FIXME bits deploy_to() Signed-off-by: Nico Schottelius --- bin/cdist | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/bin/cdist b/bin/cdist index ff114325..46422ce5 100755 --- a/bin/cdist +++ b/bin/cdist @@ -429,6 +429,23 @@ class Cdist: self.shell_run_or_debug_fail(manifest, [manifest], env=env) + def run_object_gencode(self, cdist_object): + """Run the gencode scripts for the object""" + log.info("Running manifest %s, env=%s", manifest, extra_env) + env = os.environ.copy() + + env['__target_host'] = self.target_host + env['__global'] = self.out_dir + + # FIXME: if -local, -remote... + + + # Other environment stuff + if extra_env: + env.update(extra_env) + + self.shell_run_or_debug_fail(manifest, [manifest], env=env) + def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" @@ -451,6 +468,17 @@ class Cdist: objects = self.list_objects() + # Now do the final steps over the existing objects + for cdist_object in objects: + # FIXME: Check requirements and execute those before + + # FIXME: to be implemented + # cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object_self" + # cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self" + + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + if __name__ == "__main__": From 99887fe20f3ca74d604172f83ec7a5c2498863e9 Mon Sep 17 00:00:00 2001 From: Andrew Schleifer Date: Fri, 9 Sep 2011 23:24:32 -0500 Subject: [PATCH 0094/1024] fix typo --- bin/cdist-quickstart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist-quickstart b/bin/cdist-quickstart index 4d89180c..e146f1a8 100755 --- a/bin/cdist-quickstart +++ b/bin/cdist-quickstart @@ -249,7 +249,7 @@ fi manifestinit="conf/manifest/init" cat << eof -I'll know setup $manifestinit, containing the following code: +I'll now setup $manifestinit, containing the following code: -------------------------------------------------------------------------------- # Every machine becomes a marker, so sysadmins know that automatic From 4a5100692ab2374fafcc7744ca3b21b855b2da5d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 10:12:01 +0200 Subject: [PATCH 0095/1024] add helper methods to get paths from code/gencode Signed-off-by: Nico Schottelius --- bin/cdist | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/bin/cdist b/bin/cdist index 46422ce5..9eaf39fe 100755 --- a/bin/cdist +++ b/bin/cdist @@ -266,6 +266,11 @@ class Cdist: """Returns the remote dir to the object parameter""" return os.path.join(self.remote_object_dir(cdist_object), "parameter") + def object_code_paths(self, cdist_object): + """Return paths to code scripts of object""" + return [os.path.join(object_dir(cdist_object), "code-local"), + os.path.join(object_dir(cdist_object), "code-remote")] + def list_objects(self, starting_point = False): """Return list of existing objects""" @@ -285,6 +290,11 @@ class Cdist: """Return directory that holds the explorers of a type""" return os.path.join(TYPE_DIR, type, "explorer") + def type_gencode_paths(self, type): + """Return paths to gencode scripts of type""" + return [os.path.join(TYPE_DIR, type, "gencode-local"), + os.path.join(TYPE_DIR, type, "gencode-remote")] + def type_manifest_path(self, type): """Return path to manifest of type""" return os.path.join(TYPE_DIR, type, "manifest") @@ -390,7 +400,6 @@ class Cdist: def run_initial_manifest(self): """Run the initial manifest""" - # FIXME: add support for __manifest:: env = { "__manifest" : MANIFEST_DIR } self.run_manifest(self.initial_manifest, extra_env=env) @@ -446,6 +455,26 @@ class Cdist: self.shell_run_or_debug_fail(manifest, [manifest], env=env) + def object_run(self, cdist_object, mode): + """Run gencode or code for an object""" + # FIXME: Check requirements and execute those before + requirements = list_object_requirements(cdist_object) + + for requirement in requirements: + object_run(requirement, mode=mode) + + # Find and run all available gencode scripts + if mode == "gencode": + base_path = object_dir + if mode == "code": + + # FIXME: to be implemented + # cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object_self" + # cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self" + + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" @@ -470,14 +499,9 @@ class Cdist: # Now do the final steps over the existing objects for cdist_object in objects: - # FIXME: Check requirements and execute those before + object_run(cdist_object, mode="gencode") + object_run(cdist_object, mode="code") - # FIXME: to be implemented - # cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object_self" - # cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self" - - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) From c516d8359eb5780a5b9b0f4d4c51208ef684f03c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 13:19:32 +0200 Subject: [PATCH 0096/1024] support __object_* in run_type_explorer() Signed-off-by: Nico Schottelius --- bin/cdist | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/cdist b/bin/cdist index 9eaf39fe..b3397fb8 100755 --- a/bin/cdist +++ b/bin/cdist @@ -370,9 +370,11 @@ class Cdist: self.transfer_type_explorers(type) cmd = [] - # FIXME: __global::__object_id::__self:: - cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) cmd.append("__type_explorer=" + self.remote_type_explorer_dir(type)) + cmd.append("__global =" + self.out_dir) + cmd.append("__object_id=" + self.get_object_id_from_object(cdist_object)) + cmd.append("__object_fq=" + cdist_object) # Need to transfer at least the parameters for objects to be useful self.transfer_object_parameter(cdist_object) @@ -465,15 +467,20 @@ class Cdist: # Find and run all available gencode scripts if mode == "gencode": - base_path = object_dir + paths = self.type_gencode_paths(self.get_type_from_object(cdist_object)) if mode == "code": + paths = self.object_code_paths(cdist_object) # FIXME: to be implemented # cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object_self" # cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self" - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) + for bin in paths: + if os.path.isfile(bin): + if mode == "gencode": + self.shell_run_or_debug_fail(manifest, [manifest], env=env) + if mode == "code": + self.run_or_fail(manifest, [manifest], env=env) def deploy_to(self): From beafb55e12b7df60f021183b38d0d4f001ec082a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 14:44:21 +0200 Subject: [PATCH 0097/1024] __global not available for type explorer (should it be?) Signed-off-by: Nico Schottelius --- doc/man/cdist-reference.text.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 90efc0f8..9ef7e9c2 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -164,7 +164,7 @@ __manifest:: Available for: initial manifest __global:: Directory that contains generic output like explorer. - Available for: initial manifest, type manifest, type explorer, type codegen + Available for: initial manifest, type manifest, type codegen __object:: Directory that contains the current object. Available for: type manifest, type explorer, type codegen From 636995f44ef76deaec2ef531f6d9ef86cb0f0119 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 14:45:59 +0200 Subject: [PATCH 0098/1024] add some meat to object_run() Signed-off-by: Nico Schottelius --- bin/cdist | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/bin/cdist b/bin/cdist index b3397fb8..a13abcf4 100755 --- a/bin/cdist +++ b/bin/cdist @@ -372,13 +372,12 @@ class Cdist: cmd = [] cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) cmd.append("__type_explorer=" + self.remote_type_explorer_dir(type)) - cmd.append("__global =" + self.out_dir) + cmd.append("__object=" + self.remote_object_dir(cdist_object)) cmd.append("__object_id=" + self.get_object_id_from_object(cdist_object)) cmd.append("__object_fq=" + cdist_object) # Need to transfer at least the parameters for objects to be useful self.transfer_object_parameter(cdist_object) - cmd.append("__object=" + self.remote_object_dir(cdist_object)) explorers = self.list_type_explorers(type) for explorer in explorers: @@ -459,28 +458,29 @@ class Cdist: def object_run(self, cdist_object, mode): """Run gencode or code for an object""" - # FIXME: Check requirements and execute those before - requirements = list_object_requirements(cdist_object) + # FIXME: Check requirements and execute those before + requirements = self.list_object_requirements(cdist_object) - for requirement in requirements: - object_run(requirement, mode=mode) + for requirement in requirements: + self.object_run(requirement, mode=mode) - # Find and run all available gencode scripts - if mode == "gencode": - paths = self.type_gencode_paths(self.get_type_from_object(cdist_object)) - if mode == "code": - paths = self.object_code_paths(cdist_object) + # Find and run all available gencode scripts + if mode == "gencode": + paths = self.type_gencode_paths(self.get_type_from_object(cdist_object)) + if mode == "code": + paths = self.object_code_paths(cdist_object) - # FIXME: to be implemented - # cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object_self" - # cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self" + # FIXME: to be implemented + # cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object_self" + # cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self" - for bin in paths: - if os.path.isfile(bin): - if mode == "gencode": - self.shell_run_or_debug_fail(manifest, [manifest], env=env) - if mode == "code": - self.run_or_fail(manifest, [manifest], env=env) + for bin in paths: + FIXME + if os.path.isfile(bin): + if mode == "gencode": + self.shell_run_or_debug_fail(manifest, [manifest], env=env) + if mode == "code": + self.run_or_fail(manifest, [manifest], env=env) def deploy_to(self): @@ -506,11 +506,8 @@ class Cdist: # Now do the final steps over the existing objects for cdist_object in objects: - object_run(cdist_object, mode="gencode") - object_run(cdist_object, mode="code") - - - + self.object_run(cdist_object, mode="gencode") + self.object_run(cdist_object, mode="code") if __name__ == "__main__": parser = argparse.ArgumentParser(description='cdist ' + VERSION) From 5a765bfc761d9fda4f026376f470f8309af5786e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 15:09:09 +0200 Subject: [PATCH 0099/1024] codegen vs. gencode Signed-off-by: Nico Schottelius --- doc/man/cdist-reference.text.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 9ef7e9c2..a823891b 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -164,19 +164,19 @@ __manifest:: Available for: initial manifest __global:: Directory that contains generic output like explorer. - Available for: initial manifest, type manifest, type codegen + Available for: initial manifest, type manifest, type gencode __object:: Directory that contains the current object. - Available for: type manifest, type explorer, type codegen + Available for: type manifest, type explorer, type gencode __object_id:: The type unique object id. - Available for: type manifest, type explorer, type codegen + Available for: type manifest, type explorer, type gencode __self:: The full qualified name of the current object. - Available for: type manifest, type explorer, type codegen + Available for: type manifest, type explorer, type gencode __target_host:: The host we are deploying to. - Available for: initial manifest, type manifest, type codegen + Available for: initial manifest, type manifest, type gencode __target_user:: User to use for authentication on remote host. Currently static in core. From ca58841696d969db8c62c6eafd0840a895cca520 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 15:36:21 +0200 Subject: [PATCH 0100/1024] Broken code - it's too hot DEBUG: Shell exec: /bin/sh -e /home/users/nico/p/cdist/conf/type/__directory/gencode-remote Traceback (most recent call last): File "/home/users/nico/p/cdist/bin/cdist", line 557, in c.deploy_to() File "/home/users/nico/p/cdist/bin/cdist", line 523, in deploy_to self.object_run(cdist_object, mode="gencode") File "/home/users/nico/p/cdist/bin/cdist", line 491, in object_run self.shell_run_or_debug_fail(bin, [bin], env=env) File "/home/users/nico/p/cdist/bin/cdist", line 164, in shell_run_or_debug_fail subprocess.check_call(*args, **kargs) File "/usr/lib/python3.2/subprocess.py", line 480, in check_call retcode = call(*popenargs, **kwargs) File "/usr/lib/python3.2/subprocess.py", line 467, in call return Popen(*popenargs, **kwargs).wait() File "/usr/lib/python3.2/subprocess.py", line 741, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.2/subprocess.py", line 1174, in _execute_child for k, v in env.items()] File "/usr/lib/python3.2/subprocess.py", line 1174, in for k, v in env.items()] File "/usr/lib/python3.2/os.py", line 581, in fsencode raise TypeError("expect bytes or str, not %s" % type(filename).__name__) TypeError: expect bytes or str, not tuple Signed-off-by: Nico Schottelius --- bin/cdist | 58 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/bin/cdist b/bin/cdist index a13abcf4..b9c071b5 100755 --- a/bin/cdist +++ b/bin/cdist @@ -268,8 +268,8 @@ class Cdist: def object_code_paths(self, cdist_object): """Return paths to code scripts of object""" - return [os.path.join(object_dir(cdist_object), "code-local"), - os.path.join(object_dir(cdist_object), "code-remote")] + return [os.path.join(self.object_dir(cdist_object), "code-local"), + os.path.join(self.object_dir(cdist_object), "code-remote")] def list_objects(self, starting_point = False): """Return list of existing objects""" @@ -279,7 +279,6 @@ class Cdist: object_paths = self.list_object_paths(starting_point) objects = [] - log.debug("Paths recieved: %s", object_paths) for path in object_paths: objects.append(os.path.relpath(path, starting_point)) @@ -439,22 +438,23 @@ class Cdist: self.shell_run_or_debug_fail(manifest, [manifest], env=env) - def run_object_gencode(self, cdist_object): - """Run the gencode scripts for the object""" - log.info("Running manifest %s, env=%s", manifest, extra_env) - env = os.environ.copy() + def list_object_requirements(self, cdist_object): + """Return list of requirements for specific object""" + file=os.path.join(self.object_dir(cdist_object), "require") - env['__target_host'] = self.target_host - env['__global'] = self.out_dir + if os.path.isfile(file): + file_fd = open(file, "r") + requirements = file_fd.readlines() + file_fd.close() - # FIXME: if -local, -remote... - + # Remove \n from all lines + requirements = map(lambda s: s.strip(), requirements) - # Other environment stuff - if extra_env: - env.update(extra_env) + log.debug(requirements) + else: + requirements = [] - self.shell_run_or_debug_fail(manifest, [manifest], env=env) + return requirements def object_run(self, cdist_object, mode): """Run gencode or code for an object""" @@ -470,18 +470,32 @@ class Cdist: if mode == "code": paths = self.object_code_paths(cdist_object) - # FIXME: to be implemented - # cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object_self" - # cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self" + # + # Setup env Variable: + # + env = os.environ.copy() + env['__target_host'] = self.target_host + env['__global'] = self.out_dir + env["__object"] = self.object_dir(cdist_object), + env["__object_id"] = self.get_object_id_from_object(cdist_object), + env["__object_fq"] = cdist_object for bin in paths: - FIXME + log.debug("object/bin: %s", bin) if os.path.isfile(bin): + # FIXME: to be implemented + # cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object_self" if mode == "gencode": - self.shell_run_or_debug_fail(manifest, [manifest], env=env) + # __global::__object::__object_id::__self::__target_host:: + # + self.shell_run_or_debug_fail(bin, [bin], env=env) if mode == "code": - self.run_or_fail(manifest, [manifest], env=env) - + # FIXME: to be implemented + # cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self" + log.debug("ERROR NOT IMPLEMENTED") + sys.exit(3) + # FIXME: transfer code and add remote path! + self.run_or_fail([bin], remote=True) def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" From 151022ffd1ef322b2e7fbeb4057630ab42d08f17 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 10 Sep 2011 23:46:17 +0200 Subject: [PATCH 0101/1024] support file transfer and begin support for non root logins Signed-off-by: Nico Schottelius --- bin/cdist | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index b9c071b5..f34812d9 100755 --- a/bin/cdist +++ b/bin/cdist @@ -97,7 +97,7 @@ def banner(): class Cdist: """Cdist main class to hold arbitrary data""" - def __init__(self, target_host, initial_manifest=False): + def __init__(self, target_host, initial_manifest=False, remote_user="root"): self.target_host = target_host self.remote_prefix = ["ssh", "root@" + self.target_host] @@ -120,6 +120,8 @@ class Cdist: # List of type explorers transferred self.type_explorers_transferred = {} + self.remote_user = remote_user + # Mostly static, but can be overwritten on user demand if initial_manifest: self.initial_manifest = initial_manifest @@ -192,7 +194,17 @@ class Cdist: def transfer_dir(self, source, destination): """Transfer directory and previously delete the remote destination""" self.remove_remote_dir(destination) - self.run_or_fail(["scp", "-qr", source, "root@" + self.target_host + ":" + destination]) + self.run_or_fail(["scp", "-qr", source, + self.remote_user + "@" + + self.target_host + ":" + + destination]) + + def transfer_file(self, source, destination): + """Transfer file""" + self.run_or_fail(["scp", "-q", source, + self.remote_user + "@" + + self.target_host + ":" + + destination]) def global_explorer_output_path(self, explorer): """Returns path of the output for a global explorer""" @@ -311,6 +323,16 @@ class Cdist: self.transfer_dir(self.object_parameter_dir(cdist_object), self.remote_object_parameter_dir(cdist_object)) + def transfer_object_code(self, cdist_object): + FIXME + """Transfer the object code to the remote destination""" + # Create base path before using mkdir -p + self.remote_mkdir(self.remote_object_parameter_dir(cdist_object)) + + # Synchronise parameter dir afterwards + self.transfer_dir(self.object_parameter_dir(cdist_object), + self.remote_object_parameter_dir(cdist_object)) + def transfer_global_explorers(self): """Transfer the global explorers""" self.transfer_dir(GLOBAL_EXPLORER_DIR, REMOTE_GLOBAL_EXPLORER_DIR) From c147c74e1ed465e15e916b0af73cdb30d69a17c2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 13:11:45 +0200 Subject: [PATCH 0102/1024] begin to redo object_run() Signed-off-by: Nico Schottelius --- bin/cdist | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index f34812d9..eb1e9112 100755 --- a/bin/cdist +++ b/bin/cdist @@ -330,7 +330,7 @@ class Cdist: self.remote_mkdir(self.remote_object_parameter_dir(cdist_object)) # Synchronise parameter dir afterwards - self.transfer_dir(self.object_parameter_dir(cdist_object), + self.transfer_file(self.object_code_path(cdist_object), self.remote_object_parameter_dir(cdist_object)) def transfer_global_explorers(self): @@ -512,6 +512,9 @@ class Cdist: # self.shell_run_or_debug_fail(bin, [bin], env=env) if mode == "code": + local_dir = object_dir(cdist_object) + remote_dir = remote_object_dir(cdist_object) + # FIXME: to be implemented # cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self" log.debug("ERROR NOT IMPLEMENTED") From c9c808a732e66210d2780fbfc533eec263bf660e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 13:55:40 +0200 Subject: [PATCH 0103/1024] cleanp Signed-off-by: Nico Schottelius --- bin/cdist | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/bin/cdist b/bin/cdist index eb1e9112..7c2de358 100755 --- a/bin/cdist +++ b/bin/cdist @@ -152,6 +152,7 @@ class Cdist: def shell_run_or_debug_fail(self, script, *args, **kargs): # Manually execute /bin/sh, because sh -e does what we want # and sh -c -e does not exit if /bin/false called + print(args) args[0][:0] = [ "/bin/sh", "-e" ] if "remote" in kargs: @@ -161,6 +162,8 @@ class Cdist: del kargs["remote"] + print(args) + print(*args) log.debug("Shell exec: " + " ".join(*args)) try: subprocess.check_call(*args, **kargs) @@ -472,7 +475,7 @@ class Cdist: # Remove \n from all lines requirements = map(lambda s: s.strip(), requirements) - log.debug(requirements) + log.debug("Requirements for %s: %s", cdist_object, requirements) else: requirements = [] @@ -480,18 +483,13 @@ class Cdist: def object_run(self, cdist_object, mode): """Run gencode or code for an object""" - # FIXME: Check requirements and execute those before + log.debug("Running %s from %s", mode, cdist_object) requirements = self.list_object_requirements(cdist_object) for requirement in requirements: + log.debug("Object %s requires %s", cdist_object, requirement) self.object_run(requirement, mode=mode) - # Find and run all available gencode scripts - if mode == "gencode": - paths = self.type_gencode_paths(self.get_type_from_object(cdist_object)) - if mode == "code": - paths = self.object_code_paths(cdist_object) - # # Setup env Variable: # @@ -502,26 +500,26 @@ class Cdist: env["__object_id"] = self.get_object_id_from_object(cdist_object), env["__object_fq"] = cdist_object - for bin in paths: - log.debug("object/bin: %s", bin) - if os.path.isfile(bin): - # FIXME: to be implemented - # cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object_self" - if mode == "gencode": - # __global::__object::__object_id::__self::__target_host:: - # + if mode == "gencode": + paths = self.type_gencode_paths(self.get_type_from_object(cdist_object)) + for bin in paths: + if os.path.isfile(bin): + print(bin) self.shell_run_or_debug_fail(bin, [bin], env=env) - if mode == "code": - local_dir = object_dir(cdist_object) - remote_dir = remote_object_dir(cdist_object) - # FIXME: to be implemented - # cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self" - log.debug("ERROR NOT IMPLEMENTED") - sys.exit(3) - # FIXME: transfer code and add remote path! - self.run_or_fail([bin], remote=True) + if mode == "code": +# paths = self.object_code_paths(cdist_object) + local_dir = self.object_dir(cdist_object) + remote_dir = self.remote_object_dir(cdist_object) + bin = os.path.join(local_dir, "code-local") + if os.path.isfile(bin): + self.run_or_fail([bin], remote=False) + + if os.path.isfile(os.path.join(local_dir, "code-remote")): + remote_code = os.path.join(remote_dir, "code-remote") + self.run_or_fail([remote_code], remote=True) + def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" log.info("Deploying to host " + self.target_host) @@ -542,9 +540,11 @@ class Cdist: self.run_type_manifest(cdist_object) objects = self.list_objects() - + + log.debug("Actual run objects") # Now do the final steps over the existing objects for cdist_object in objects: + log.debug("Run object: %s", cdist_object) self.object_run(cdist_object, mode="gencode") self.object_run(cdist_object, mode="code") From 5702706adf5badf120fc60d742164034ce934a76 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 14:11:54 +0200 Subject: [PATCH 0104/1024] fix not so obvious tuple/str error (trailing comma from c&p) Signed-off-by: Nico Schottelius --- bin/cdist | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 7c2de358..7e6f6ddf 100755 --- a/bin/cdist +++ b/bin/cdist @@ -152,7 +152,6 @@ class Cdist: def shell_run_or_debug_fail(self, script, *args, **kargs): # Manually execute /bin/sh, because sh -e does what we want # and sh -c -e does not exit if /bin/false called - print(args) args[0][:0] = [ "/bin/sh", "-e" ] if "remote" in kargs: @@ -162,9 +161,8 @@ class Cdist: del kargs["remote"] - print(args) - print(*args) - log.debug("Shell exec: " + " ".join(*args)) + log.debug("Shell exec cmd: %s", args) + log.debug("Shell exec env: %s", kargs['env']) try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: @@ -496,8 +494,8 @@ class Cdist: env = os.environ.copy() env['__target_host'] = self.target_host env['__global'] = self.out_dir - env["__object"] = self.object_dir(cdist_object), - env["__object_id"] = self.get_object_id_from_object(cdist_object), + env["__object"] = self.object_dir(cdist_object) + env["__object_id"] = self.get_object_id_from_object(cdist_object) env["__object_fq"] = cdist_object if mode == "gencode": From c78ce344e73578eeba144b7a6eff6419df2e4e0e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 14:30:05 +0200 Subject: [PATCH 0105/1024] remove debug by default, switch to infolevel and verify -d works Signed-off-by: Nico Schottelius --- bin/cdist | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/cdist b/bin/cdist index 7e6f6ddf..157b8d13 100755 --- a/bin/cdist +++ b/bin/cdist @@ -81,7 +81,7 @@ VERSION = "2.0.0" # -logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s') +logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') log = logging.getLogger() # List types @@ -406,6 +406,9 @@ class Cdist: remote_cmd = cmd + [os.path.join(self.remote_type_explorer_dir(type), explorer)] output = os.path.join(self.type_explorer_output_dir(cdist_object), explorer) output_fd = open(output, mode='w') + log.debug("%s exploring %s using %s storing to %s", + cdist_object, explorer, remote_cmd, output) + self.run_or_fail(remote_cmd, stdout=output_fd, remote=True) output_fd.close() @@ -431,18 +434,19 @@ class Cdist: type = self.get_type_from_object(cdist_object) manifest = self.type_manifest_path(type) + log.debug("%s: Running %s", cdist_object, manifest) # FIXME: add more sensible checks for manifest if os.path.exists(manifest): - env = { "__object" : self.object_dir(cdist_object), + env = { "__object" : self.object_dir(cdist_object), "__object_id": self.get_object_id_from_object(cdist_object), "__object_fq": cdist_object, - "__type": type + "__type": type } self.run_manifest(manifest, extra_env=env) def run_manifest(self, manifest, extra_env=None): """Run a manifest""" - log.info("Running manifest %s, env=%s", manifest, extra_env) + log.debug("Running manifest %s, env=%s", manifest, extra_env) env = os.environ.copy() env['PATH'] = self.bin_dir + ":" + env['PATH'] @@ -502,7 +506,6 @@ class Cdist: paths = self.type_gencode_paths(self.get_type_from_object(cdist_object)) for bin in paths: if os.path.isfile(bin): - print(bin) self.shell_run_or_debug_fail(bin, [bin], env=env) if mode == "code": @@ -546,6 +549,8 @@ class Cdist: self.object_run(cdist_object, mode="gencode") self.object_run(cdist_object, mode="code") + log.info("Finished run of %s", self.target_host) + if __name__ == "__main__": parser = argparse.ArgumentParser(description='cdist ' + VERSION) parser.add_argument('host', nargs='*', help='one or more hosts to operate on') From 6bd823995fff95414060ef4eca841f74733ecff4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 17:20:07 +0200 Subject: [PATCH 0106/1024] restore mistakenly deleted file Signed-off-by: Nico Schottelius --- conf/type/__directory/explorer/exists | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 conf/type/__directory/explorer/exists diff --git a/conf/type/__directory/explorer/exists b/conf/type/__directory/explorer/exists new file mode 100755 index 00000000..f8b85671 --- /dev/null +++ b/conf/type/__directory/explorer/exists @@ -0,0 +1,30 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Check whether file exists or not +# + +destination="/$__object_id" + +if [ -e "$destination" ]; then + echo yes +else + echo no +fi From 30a52cab0fe45d932d822ea7a28b6dfbfe5ef98a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 20:17:20 +0200 Subject: [PATCH 0107/1024] begin to save code and make it executable Signed-off-by: Nico Schottelius --- bin/cdist | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index 157b8d13..e76ecfc7 100755 --- a/bin/cdist +++ b/bin/cdist @@ -25,6 +25,7 @@ import logging import os import subprocess import shutil +import stat import sys import tempfile @@ -93,7 +94,6 @@ def banner(): print(BANNER) - class Cdist: """Cdist main class to hold arbitrary data""" @@ -235,6 +235,8 @@ class Cdist: else: list = [] + log.debug("Explorers for %s in %s: %s", type, dir, list) + return list def list_object_paths(self, starting_point = False): @@ -341,7 +343,7 @@ class Cdist: def transfer_type_explorers(self, type): """Transfer explorers of a type, but only once""" if type in self.type_explorers_transferred: - log.debug("Skipping retransfer for %s", type) + log.debug("Skipping retransfer for explorers of %s", type) return else: # Do not retransfer @@ -506,7 +508,19 @@ class Cdist: paths = self.type_gencode_paths(self.get_type_from_object(cdist_object)) for bin in paths: if os.path.isfile(bin): - self.shell_run_or_debug_fail(bin, [bin], env=env) + # omit "gen" from gencode and + outfile=os.path.join(self.object_dir(cdist_object), + os.path.basename(bin)[3:]) + + outfile_fd = open(outfile, "w") + self.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) + + a = outfile_fd + b = stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR + print(type(a), type(b)) + + os.fchmod(outfile_fd, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + outfile_fd.close() if mode == "code": # paths = self.object_code_paths(cdist_object) From 4e4d648593305836944dfa10811054df7ae7427e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 20:18:30 +0200 Subject: [PATCH 0108/1024] fchmod() does not work on object returned by open(), so use chmod Signed-off-by: Nico Schottelius --- bin/cdist | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index e76ecfc7..09cb9d45 100755 --- a/bin/cdist +++ b/bin/cdist @@ -514,14 +514,10 @@ class Cdist: outfile_fd = open(outfile, "w") self.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) - - a = outfile_fd - b = stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR - print(type(a), type(b)) - - os.fchmod(outfile_fd, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) outfile_fd.close() + os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + if mode == "code": # paths = self.object_code_paths(cdist_object) local_dir = self.object_dir(cdist_object) From 34ae8c292689780db3c18047bcd9d9493cf4f9be Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 20:41:39 +0200 Subject: [PATCH 0109/1024] make code execution happen in the end Signed-off-by: Nico Schottelius --- bin/cdist | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index 09cb9d45..1fd3e116 100755 --- a/bin/cdist +++ b/bin/cdist @@ -516,7 +516,13 @@ class Cdist: self.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) outfile_fd.close() - os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + status = os.stat(outfile) + + # Remove output if empty, else make it executable + if status.st_size == 0: + os.unlink(outfile) + else: + os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) if mode == "code": # paths = self.object_code_paths(cdist_object) @@ -527,9 +533,12 @@ class Cdist: if os.path.isfile(bin): self.run_or_fail([bin], remote=False) - if os.path.isfile(os.path.join(local_dir, "code-remote")): - remote_code = os.path.join(remote_dir, "code-remote") - self.run_or_fail([remote_code], remote=True) + + local_remote_code = os.path.join(local_dir, "code-remote") + remote_remote_code = os.path.join(remote_dir, "code-remote") + if os.path.isfile(local_remote_code): + self.transfer_file(local_remote_code, remote_remote_code) + self.run_or_fail([remote_remote_code], remote=True) def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" From e56bbfea9ac0aba51f28200848d6bfa48ed28b49 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 20:45:54 +0200 Subject: [PATCH 0110/1024] less verbose output in default case Signed-off-by: Nico Schottelius --- bin/cdist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 1fd3e116..4267b3fa 100755 --- a/bin/cdist +++ b/bin/cdist @@ -415,7 +415,7 @@ class Cdist: output_fd.close() def init_deploy(self): - log.info("Creating clean directory structure") + log.debug("Creating clean directory structure") # Ensure there is no old stuff, neither local nor remote # remote_run_or_fail(hostname, ["rm -rf", "${__cdist_remote_base_dir}"]) @@ -542,7 +542,7 @@ class Cdist: def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to host " + self.target_host) + log.info("Deploying to " + self.target_host) self.init_deploy() self.run_global_explores() self.run_initial_manifest() From f9f874deed99b3ed7fe3488dc65d29f67e33e620 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 20:49:46 +0200 Subject: [PATCH 0111/1024] new features in 2.0.0 Signed-off-by: Nico Schottelius --- doc/changelog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index 6d25f234..50409cac 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,6 +1,7 @@ -next: +2.0.0: * New Type: __package_rubygem (Chase Allen James) * __self replaced by __object_fq (or so) + * Rewrote cdist in Python 1.7.1: 2011-07-26 * Documentation: Add explorers to reference From eb2512d4a2f176742102e8fd4750ade1e02f215d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 21:15:58 +0200 Subject: [PATCH 0112/1024] add timing information and setup remote = false by default Signed-off-by: Nico Schottelius --- bin/cdist | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 4267b3fa..1e6fc45b 100755 --- a/bin/cdist +++ b/bin/cdist @@ -21,6 +21,7 @@ # import argparse +import datetime import logging import os import subprocess @@ -154,6 +155,7 @@ class Cdist: # and sh -c -e does not exit if /bin/false called args[0][:0] = [ "/bin/sh", "-e" ] + remote = false if "remote" in kargs: if kargs["remote"]: args[0][:0] = self.remote_prefix @@ -543,6 +545,7 @@ class Cdist: def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" log.info("Deploying to " + self.target_host) + time_start = datetime.datetime.now() self.init_deploy() self.run_global_explores() self.run_initial_manifest() @@ -568,7 +571,11 @@ class Cdist: self.object_run(cdist_object, mode="gencode") self.object_run(cdist_object, mode="code") - log.info("Finished run of %s", self.target_host) + time_end = datetime.datetime.now() + duration = time_end - time_start + log.info("Finished run of %s in %s seconds", + self.target_host, + duration.total_seconds()) if __name__ == "__main__": parser = argparse.ArgumentParser(description='cdist ' + VERSION) From be2efbbb0db75fc0a437e4c81b79f355a4ce9b35 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 21:16:42 +0200 Subject: [PATCH 0113/1024] give me a big F Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 1e6fc45b..9f713ee3 100755 --- a/bin/cdist +++ b/bin/cdist @@ -155,7 +155,7 @@ class Cdist: # and sh -c -e does not exit if /bin/false called args[0][:0] = [ "/bin/sh", "-e" ] - remote = false + remote = False if "remote" in kargs: if kargs["remote"]: args[0][:0] = self.remote_prefix From b214fe54ddbd141c5d4a18d43c27ff4ea8a073b9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 21:22:51 +0200 Subject: [PATCH 0114/1024] add old benchmarks Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-04-27.benchmark | 56 ++++++++++++++++++++++++++ doc/dev/logs/2011-04-27.benchmark.dash | 9 +++++ 2 files changed, 65 insertions(+) create mode 100644 doc/dev/logs/2011-04-27.benchmark create mode 100644 doc/dev/logs/2011-04-27.benchmark.dash diff --git a/doc/dev/logs/2011-04-27.benchmark b/doc/dev/logs/2011-04-27.benchmark new file mode 100644 index 00000000..6f1f1e21 --- /dev/null +++ b/doc/dev/logs/2011-04-27.benchmark @@ -0,0 +1,56 @@ +% x200 +data = [ 1 104; 2 129; 6 249 ; 25 1267 ] + +% x201, 4.2.2.4 dns, eth +data = [ 1 143; 2 159; 3 198; 4 244; 5 299; 6 350; 7 435; 8 429 ]; + +% x201, von zuhause aus +data2 = [ 226 242 275 296 306 357 403 400 409 685 617 672 ] +plot(0:size(data)(2)-1, data) + + +hold off; +plot(data(:,1), data(:,2)) +% per host time: +data(:,2)' ./ data(:,1)' +hold on; +plot(data(:,1), data(:,2)' ./ data(:,1)') + + +Testing on + Intel(R) Core(TM)2 Duo CPU P8400 @ 2.26GHz + 4 GiB RAM + Intel Gbit Nic + +- 169 objects, all done (i.e. rerun) +- runs are cpu bound + +1 host: + +core: cdist 1.6.2: Successfully finished run +Run: 104s (1 minutes) + +2 hosts: + +[13:48] kr:cdist-nutzung% mytime cdist-mass-deploy -p ikq03.ethz.ch ikq04.ethz.ch +Run: 129s (2 minutes) + +6 hosts: (7 specified, but ikq01.ethz.ch is dead) +cdist-mass-deploy -p ikq01.ethz.ch ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch ikq05.ethz.ch ikq06.ethz.ch ikq07.ethz.ch +Run: 294s (4 minutes) + +25 hosts + +[13:58] kr:cdist-nutzung% mytime cdist-mass-deploy -p $(sed 's/^root@//' ~/.dsh/group/ikr) + +Run: 723s (12 minutes) + + +25 hosts without proxy command now: + +Run: 1267s (21 minutes) +Run: 1212s (20 minutes) + + +[14:11] kr:cdist-nutzung% mytime cdist-mass-deploy -p $(sed 's/^root@//' ~/.dsh/group/ikr) + diff --git a/doc/dev/logs/2011-04-27.benchmark.dash b/doc/dev/logs/2011-04-27.benchmark.dash new file mode 100644 index 00000000..635062e8 --- /dev/null +++ b/doc/dev/logs/2011-04-27.benchmark.dash @@ -0,0 +1,9 @@ +Run: 78s (1 minutes) +[13:25] kr:cdist-nutzung% mytime cdist-deploy-to ikq02.ethz.ch + +% mit dash, eth, x201, Mit Apr 27 13:41:49 CEST 2011 +data = [ 0 73 77 89 107 130 151 180 197 228 251 260 199 295 335 276 ] +plot(0:size(data2)(2)-1, data2) + + + From 5429022d617b9f0a989f2eda454527761b8e6165 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 21:23:10 +0200 Subject: [PATCH 0115/1024] add old debug Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-09-08 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/dev/logs/2011-09-08 diff --git a/doc/dev/logs/2011-09-08 b/doc/dev/logs/2011-09-08 new file mode 100644 index 00000000..42413285 --- /dev/null +++ b/doc/dev/logs/2011-09-08 @@ -0,0 +1,4 @@ +Debugging cdist: + +[0:13] kr:cdist-nutzung% ./local/update-local-core && __cdist_debug=1 __cdist_local_base_dir=/tmp/cdist cdist-deploy-to ikq04.ethz.ch + From c5d88435f13e46a0b8066ce9cf904fafa7696050 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 21:24:23 +0200 Subject: [PATCH 0116/1024] add python link Signed-off-by: Nico Schottelius --- bin/cdist-code-run | 50 ----------------------- bin/cdist-deploy-to | 49 ----------------------- bin/cdist-env | 33 --------------- bin/cdist-explorer-run-global | 43 -------------------- bin/cdist-manifest-run | 56 -------------------------- bin/cdist-manifest-run-init | 34 ---------------- bin/cdist-mass-deploy | 75 ----------------------------------- bin/cdist-object-all | 56 -------------------------- bin/cdist-object-code-run | 38 ------------------ bin/cdist-object-explorer-run | 67 ------------------------------- bin/cdist-object-gencode | 62 ----------------------------- bin/cdist-object-gencode-run | 38 ------------------ bin/cdist-object-manifest-run | 58 --------------------------- bin/cdist-object-prepare | 47 ---------------------- bin/cdist-object-push | 35 ---------------- bin/cdist-object-run | 65 ------------------------------ bin/cdist-remote-explorer-run | 68 ------------------------------- bin/cdist.py | 1 + 18 files changed, 1 insertion(+), 874 deletions(-) delete mode 100755 bin/cdist-code-run delete mode 100755 bin/cdist-deploy-to delete mode 100755 bin/cdist-env delete mode 100755 bin/cdist-explorer-run-global delete mode 100755 bin/cdist-manifest-run delete mode 100755 bin/cdist-manifest-run-init delete mode 100755 bin/cdist-mass-deploy delete mode 100755 bin/cdist-object-all delete mode 100755 bin/cdist-object-code-run delete mode 100755 bin/cdist-object-explorer-run delete mode 100755 bin/cdist-object-gencode delete mode 100755 bin/cdist-object-gencode-run delete mode 100755 bin/cdist-object-manifest-run delete mode 100755 bin/cdist-object-prepare delete mode 100755 bin/cdist-object-push delete mode 100755 bin/cdist-object-run delete mode 100755 bin/cdist-remote-explorer-run create mode 120000 bin/cdist.py diff --git a/bin/cdist-code-run b/bin/cdist-code-run deleted file mode 100755 index 3d7499bf..00000000 --- a/bin/cdist-code-run +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# This binary is executed on the remote side to execute code -# - -. cdist-config -[ $# -eq 2 ] || __cdist_usage " " -set -ue - -__cdist_object_self="$1"; shift -__cdist_code_type="$1"; shift - -if [ ! -d "$(__cdist_object_dir "$__cdist_object_self")" ]; then - __cdist_exit_err "Object undefined" -fi - -__cdist_code="$(__cdist_object_code "$__cdist_object_self" "${__cdist_code_type}")" - -__cdist_echo info "Checking code-${__cdist_code_type}" - -if [ -e "$__cdist_code" ]; then - if [ -f "$__cdist_code" ]; then - if [ -x "$__cdist_code" ]; then - __cdist_echo info "Executing code-${__cdist_code_type}" - __cdist_exec_fail_on_error "$__cdist_code" - else - __cdist_exit_err "$__cdist_code exists, but is not executable." - fi - else - __cdist_exit_err "$__cdist_code exists, but is not a file." - fi -fi diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to deleted file mode 100755 index 86e15800..00000000 --- a/bin/cdist-deploy-to +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Deploy configuration to a host -# - -. cdist-config -[ $# -eq 1 ] || __cdist_usage "" -set -eu - -# Kill children on interrupt - only in interactive scripts -trap __cdist_kill_on_interrupt INT TERM - -__cdist_target_host="$1" - -# Make target host available for non-core -export $__cdist_name_var_target_host="$__cdist_target_host" -export $__cdist_name_var_target_user="$__cdist_remote_user" - -# Export variables for core, which others do not reset -export __cdist_local_base_dir - -__cdist_echo info "cdist $__cdist_version: Configuring $__cdist_target_host " - -################################################################################ -# See cdist-stages(7) -# - -cdist-object-all "$__cdist_target_host" cdist-object-run -cdist-cache "$__cdist_target_host" - -__cdist_echo info "cdist $__cdist_version: Successfully finished run" diff --git a/bin/cdist-env b/bin/cdist-env deleted file mode 100755 index 2aac5e6b..00000000 --- a/bin/cdist-env +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Setup environment for use with cdist - must be standalone! -# - -export PATH="$(cd "${0%/*}" && pwd -P):$PATH" -export MANPATH="$(cd "${0%/*}/../doc/man" && pwd -P):$MANPATH" - -if [ "$(echo ${SHELL##*/} | grep 'csh$')" ]; then - echo setenv PATH $PATH \; - echo setenv MANPATH $MANPATH -else - echo export PATH=$PATH - echo export MANPATH=$MANPATH -fi diff --git a/bin/cdist-explorer-run-global b/bin/cdist-explorer-run-global deleted file mode 100755 index b0c024f2..00000000 --- a/bin/cdist-explorer-run-global +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Copy & run the global explorers, i.e. not bound to types -# - -. cdist-config -[ $# -eq 1 ] || __cdist_usage "" -set -ue - -__cdist_target_host="$1"; shift - -__cdist_echo info "Running global explorers " - -# copy the explorers -cdist-dir push "$__cdist_target_host" \ - "${__cdist_explorer_dir}" "${__cdist_remote_explorer_dir}" - -# run the initial explorers remotely -cdist-run-remote "${__cdist_target_host}" cdist-remote-explorer-run \ - "$__cdist_name_var_explorer" "$__cdist_remote_explorer_dir" \ - "$__cdist_remote_out_explorer_dir" - -# retrieve the results -cdist-dir pull "$__cdist_target_host" \ - "${__cdist_remote_out_explorer_dir}" "${__cdist_out_explorer_dir}" diff --git a/bin/cdist-manifest-run b/bin/cdist-manifest-run deleted file mode 100755 index d4ea18bb..00000000 --- a/bin/cdist-manifest-run +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# -# 2010 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 . -# -# -# Let's build a cconfig tree from a configuration -# And save it into the cache tree -# - -. cdist-config -[ $# -eq 2 ] || __cdist_usage " " -set -u - -__cdist_target_host="$1"; shift -__cdist_manifest="$1"; shift - -################################################################################ -# Export information for cdist-type-emulator or manifest -# - -# Config dir should not get reset - FIXME: why did I do this? -export __cdist_conf_dir - -# Used to record the source in the object -export __cdist_manifest - -# Export information for manifests - __cdist_out_dir comes from cdist-config -export __global="$__cdist_out_dir" - -################################################################################ -# The actual run -# - -# Ensure binaries exist and are up-to-date -cdist-type-build-emulation "${__cdist_out_type_bin_dir}" \ - || __cdist_exit_err "Failed to build type emulation binaries" - -# prepend our path, so all cdist tools come before other tools -export PATH="${__cdist_out_type_bin_dir}:$PATH" - -__cdist_exec_fail_on_error "${__cdist_manifest}" diff --git a/bin/cdist-manifest-run-init b/bin/cdist-manifest-run-init deleted file mode 100755 index 28acc623..00000000 --- a/bin/cdist-manifest-run-init +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Let's build a cconfig tree from a configuration -# And save it into the cache tree -# - -. cdist-config -[ $# -eq 1 ] || __cdist_usage "" -set -e - -__cdist_target_host="$1"; shift - -eval export $__cdist_name_var_manifest=\"\$__cdist_manifest_dir\" - -__cdist_echo info "Running initial manifest for $__cdist_target_host " -cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest_init" diff --git a/bin/cdist-mass-deploy b/bin/cdist-mass-deploy deleted file mode 100755 index c2b6d6a5..00000000 --- a/bin/cdist-mass-deploy +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Deploy configuration to many hosts -# - -. cdist-config -[ $# -ge 1 ] || __cdist_usage "[-p] [target host ]" -set -u - -# Kill children on interrupt - only in interactive scripts -trap __cdist_kill_on_interrupt INT TERM - -filter() -{ - awk -v host=$1 '{ print "[" host "] " $0 }' -} - -parallel="" -if [ "$1" = "-p" ]; then - parallel=yes - shift -fi - -i=0 -while [ $# -gt 0 ]; do - if [ "$parallel" ]; then - cdist-deploy-to "$1" 2>&1 | filter "$1" & - # Record pid and host for use later - i=$((i+1)) - eval pid_$i=$! - eval host_$i=\$1 - else - cdist-deploy-to "$1" 2>&1 | filter "$1" - fi - shift -done - -e=0 -if [ "$parallel" ]; then - __cdist_echo info "Waiting for cdist-deploy-to jobs to finish" - while [ "$i" -gt 0 ]; do - eval pid=\$pid_$i - wait "$pid" - if [ $? -ne 0 ]; then - e=$((e+1)) - eval e_host_$e=\$host_$i - fi - i=$((i-1)) - done -fi - -# Display all failed hosts after all runs are done, so the sysadmin gets them -while [ "$e" -gt 0 ]; do - eval host=\$host_$e - __cdist_echo error "Configuration of host $host failed." - e=$((e-1)) -done diff --git a/bin/cdist-object-all b/bin/cdist-object-all deleted file mode 100755 index 391c9cc7..00000000 --- a/bin/cdist-object-all +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Run the given command for each created object. -# - -. cdist-config -[ $# -eq 2 ] || __cdist_usage " " -set -eu - -__cdist_target_host="$1"; shift -__cdist_command="$1"; shift - -__cdist_objects="$__cdist_tmp_dir/objects" - -# Ensure object dir exists, so marker can be created -mkdir -p "${__cdist_out_object_dir}" - -# Loop until we do not create new objects anymore -# which is equal to all objects have been run -touch "$__cdist_objects_created" -while [ -f "$__cdist_objects_created" ]; do - # Assume we're done after this run - rm "$__cdist_objects_created" - - # Get listing of objects - __cdist_object_list "$__cdist_out_object_dir" > "$__cdist_objects" - - # NEED TO CREATE ARRAY, SSH DESTROYS WHILE READ LOOP - while read __cdist_object; do - set -- "$@" "$__cdist_object" - done < "$__cdist_objects" - - while [ $# -gt 0 ]; do - __cdist_object="$1"; shift - $__cdist_command "$__cdist_target_host" "$__cdist_object" - done -done diff --git a/bin/cdist-object-code-run b/bin/cdist-object-code-run deleted file mode 100755 index fa63aaba..00000000 --- a/bin/cdist-object-code-run +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Exec the code for the given object locally and remote -# - -. cdist-config -[ $# -eq 2 ] || __cdist_usage " " -set -e - -__cdist_target_host="$1"; shift -__cdist_object="$1"; shift - -# Code local -export __cdist_out_object_dir="$__cdist_out_object_dir" -cdist-code-run "$__cdist_object" "${__cdist_name_gencode_local}" - -# Code remote -cdist-run-remote "$__cdist_target_host" \ - "cdist-code-run" "$__cdist_object" "${__cdist_name_gencode_remote}" diff --git a/bin/cdist-object-explorer-run b/bin/cdist-object-explorer-run deleted file mode 100755 index b65c5cc1..00000000 --- a/bin/cdist-object-explorer-run +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Run the explorers for the given object on the target host. -# - -. cdist-config -[ $# -eq 2 ] || __cdist_usage " " -set -eu - -__cdist_target_host="$1"; shift -__cdist_object_self="$1"; shift - -__cdist_object_id="$(__cdist_object_id_from_object "$__cdist_object_self")" -__cdist_type="$(__cdist_type_from_object "$__cdist_object_self")" - -# Check if type of object has >= 1 explorer -__cdist_has_explorer="$(__cdist_type_has_explorer "$__cdist_type")" -# Run the type explorers for the current object if any -if [ "$__cdist_has_explorer" ]; then - if ! __cdist_type_explorer_pushed "$__cdist_type"; then - src_dir="$(__cdist_type_explorer_dir "$__cdist_type")" - dst_dir="$(__cdist_remote_type_explorer_dir "$__cdist_type")" - __cdist_echo info "Transfering explorers for $__cdist_type " - cdist-dir push "$__cdist_target_host" "$src_dir" "$dst_dir" - __cdist_type_explorer_pushed_add "$__cdist_type" - fi - - __cdist_echo info "Running explorers" - # Copy object parameters - cdist-dir push "$__cdist_target_host" \ - "$(__cdist_object_parameter_dir "$__cdist_object_self")" \ - "$(__cdist_remote_object_parameter_dir "$__cdist_object_self")" - - # Execute explorers - cdist-run-remote "$__cdist_target_host" \ - "$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\"" \ - "$__cdist_name_var_object_id=\"$__cdist_object_id\"" \ - "$__cdist_name_var_self=\"$__cdist_object_self\"" \ - cdist-remote-explorer-run \ - "$__cdist_name_var_type_explorer" \ - "$(__cdist_remote_type_explorer_dir "$__cdist_type")" \ - "$(__cdist_remote_object_type_explorer_dir "$__cdist_object_self")" - - # Copy back results - cdist-dir pull "$__cdist_target_host" \ - "$(__cdist_remote_object_type_explorer_dir "$__cdist_object_self")" \ - "$(__cdist_object_type_explorer_dir "$__cdist_object_self")" -fi diff --git a/bin/cdist-object-gencode b/bin/cdist-object-gencode deleted file mode 100755 index e21568a3..00000000 --- a/bin/cdist-object-gencode +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Generate code from one object (object must be relative path!) -# WARNING: OUTPUT ON STDOUT, ERRORS NEED TO BE ON STDERR! -# - -. cdist-config -[ $# -eq 3 ] || __cdist_usage "" "" "" -set -eu - -__cdist_target_host="$1"; shift -__cdist_object_self="$1"; shift -__cdist_gencode_type="$1"; shift - -__cdist_type="$(__cdist_type_from_object "$__cdist_object_self")" -__cdist_type_gencode="$(__cdist_type_gencode "$__cdist_type" "$__cdist_gencode_type")" -__cdist_code_output="$(__cdist_object_code "$__cdist_object_self" "$__cdist_gencode_type")" - -# export variables for the gencode script -export __object_id="$(__cdist_object_id_from_object "$__cdist_object_self")" -export __object="$(__cdist_object_dir "$__cdist_object_self")" -export __global="$__cdist_out_dir" - -if [ -x "$__cdist_type_gencode" ]; then - __cdist_exec_fail_on_error "$__cdist_type_gencode" > "$__cdist_tmp_file" -else - if [ -e "$__cdist_type_gencode" ]; then - __cdist_exit_err "$__cdist_type_gencode exists, but is not executable" - fi - - # Ensure it's empty, if there is no gencode - : > "$__cdist_tmp_file" -fi - -# Only create code, if gencode created output -if [ "$(wc -l < "$__cdist_tmp_file")" -gt 0 ]; then - cat - "$__cdist_tmp_file" << eof > "$__cdist_code_output" -# -# The following code was generated by $__cdist_type_gencode -# - -eof - chmod u+x "${__cdist_code_output}" -fi diff --git a/bin/cdist-object-gencode-run b/bin/cdist-object-gencode-run deleted file mode 100755 index 254ac1e4..00000000 --- a/bin/cdist-object-gencode-run +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# 2010 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# For the given object create the code to be executed on the target. -# - -. cdist-config -[ $# -eq 2 ] || __cdist_usage " " -set -eu - -__cdist_target_host="$1"; shift -__cdist_object_self="$1"; shift - -__cdist_echo info "Generating local code " -cdist-object-gencode "$__cdist_target_host" "$__cdist_object_self" \ - "${__cdist_name_gencode_local}" - -__cdist_echo info "Generating remote code " -cdist-object-gencode "$__cdist_target_host" "$__cdist_object_self" \ - "${__cdist_name_gencode_remote}" diff --git a/bin/cdist-object-manifest-run b/bin/cdist-object-manifest-run deleted file mode 100755 index 34d4f867..00000000 --- a/bin/cdist-object-manifest-run +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# -# 2010 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Run the manifest for the given object. -# - -. cdist-config -[ $# -eq 2 ] || __cdist_usage " " -set -eu - -__cdist_target_host="$1"; shift -__cdist_object_self="$1"; shift - -# FIXME: rename to __cdist_object_dir (everywhere!) -__cdist_cur_object_dir="$(__cdist_object_dir "$__cdist_object_self")" -__cdist_object_id="$(__cdist_object_id_from_object "$__cdist_object_self")" - -__cdist_echo info "Checking manifest " - -__cdist_type="$(__cdist_type_from_object "$__cdist_object_self")" -__cdist_manifest="$(__cdist_type_manifest "$__cdist_type")" - -if [ -f "$__cdist_manifest" ]; then - if [ -x "$__cdist_manifest" ]; then - # Make __cdist_manifest available for cdist-type-emulator - export __cdist_manifest - - __cdist_echo info "Executing manifest " - export $__cdist_name_var_object="$__cdist_cur_object_dir" - export $__cdist_name_var_object_id="$__cdist_object_id" - export $__cdist_name_var_type="$(__cdist_type_dir "$__cdist_type")" - - cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest" - - # Tell cdist-object-run-all that there may be new objects - touch "$__cdist_objects_created" - else - __cdist_exit_err "${__cdist_manifest} needs to be executable." - fi -fi diff --git a/bin/cdist-object-prepare b/bin/cdist-object-prepare deleted file mode 100755 index d21d8a63..00000000 --- a/bin/cdist-object-prepare +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# For the given object: -# - run type explorers -# - run type manifest -# - -. cdist-config -[ $# -eq 2 ] || __cdist_usage " " -set -eu - -__cdist_target_host="$1"; shift -__cdist_object_self="$1"; shift -__cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")" -[ -d "$__cdist_object_dir" ] || __cdist_exit_err "Object undefined" - -# Export to non-core for use in manifest and gencode scripts -export $__cdist_name_var_self=$__cdist_object_self - -__cdist_object_prepared="$(__cdist_object_prepared "$__cdist_object_self")" -if [ ! -f "$__cdist_object_prepared" ]; then - __cdist_echo info "Preparing object" - cdist-object-explorer-run "$__cdist_target_host" "$__cdist_object_self" - cdist-object-manifest-run "$__cdist_target_host" "$__cdist_object_self" - - # Mark this object as prepared - touch "$__cdist_object_prepared" -fi diff --git a/bin/cdist-object-push b/bin/cdist-object-push deleted file mode 100755 index 62b00cb2..00000000 --- a/bin/cdist-object-push +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# -# 2010 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Transfer the given object to the target host. -# - -. cdist-config -[ $# -eq 2 ] || __cdist_usage " " -set -eu - -__cdist_target_host="$1"; shift -__cdist_object_self="$1"; shift - -__cdist_echo info "Transferring object" -cdist-dir push "$__cdist_target_host" \ - "$(__cdist_object_dir "$__cdist_object_self")" \ - "$(__cdist_remote_object_dir "$__cdist_object_self")" diff --git a/bin/cdist-object-run b/bin/cdist-object-run deleted file mode 100755 index 4f40e7c1..00000000 --- a/bin/cdist-object-run +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# For the given object: -# - run type explorers -# - run type manifest -# - generate code -# - copy object to target -# - execute code on target -# - -. cdist-config -[ $# -eq 2 ] || __cdist_usage " " -set -eu - -__cdist_target_host="$1"; shift -__cdist_object_self="$1"; shift -__cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")" -[ -d "$__cdist_object_dir" ] || __cdist_exit_err "Object undefined" - -# Export to non-core for use in manifest and gencode scripts -export $__cdist_name_var_self=$__cdist_object_self - -__cdist_object_finished="$(__cdist_object_finished "$__cdist_object_self")" -if [ ! -f "$__cdist_object_finished" ]; then - # Resolve dependencies, if any - __cdist_object_require="$(__cdist_object_require "$__cdist_object_self")" - if [ -f "$__cdist_object_require" ]; then - # NEED TO CREATE ARRAY, SSH DESTROYS WHILE READ LOOP - while read __cdist_requirement; do - set -- "$@" "$__cdist_requirement" - done < "$__cdist_object_require" - - while [ $# -gt 0 ]; do - __cdist_requirement="$1"; shift - __cdist_echo info "Resolving requirement $__cdist_requirement" - cdist-object-run "$__cdist_target_host" "$__cdist_requirement" - done - fi - - cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object_self" - cdist-object-push "$__cdist_target_host" "$__cdist_object_self" - cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self" - - # Mark this object as done - touch "$__cdist_object_finished" -fi diff --git a/bin/cdist-remote-explorer-run b/bin/cdist-remote-explorer-run deleted file mode 100755 index d95913ba..00000000 --- a/bin/cdist-remote-explorer-run +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# This binary is executed on the remote side to execute explorers -# -# It supports different variables names to be used, so __explorers -# and __type_explorers can be submitted :-) -# - -. cdist-config -[ $# -eq 3 ] || __cdist_usage " " -set -ue - -# Variable that defines the home of the explorers -__cdist_variable_name="$1"; shift - -# Find explorers here -__cdist_explorer_dir="$1"; shift - -# Write output here -__cdist_my_out_dir="$1"; shift - -# Setup environment -export $__cdist_variable_name="$__cdist_explorer_dir" -export __global="$__cdist_remote_out_dir" - -mkdir -p "$__cdist_my_out_dir" - -# Ensure there is at least one explorer -num="$(ls -1 "$__cdist_explorer_dir" | wc -l)" -if [ "$num" -lt 1 ]; then - __cdist_exit_err "${__cdist_explorer_dir}: Contains no explorers" -fi - -# Execute all explorers -for explorer in "$__cdist_explorer_dir/"*; do - explorer_name="${explorer##*/}" - - if [ -f "$explorer" ]; then - if [ ! -x "$explorer" ]; then - __cdist_exit_err "Explorer \"$explorer\" exists, but is not executable." - fi - - # Execute explorers and save results in remote destination directory - "$explorer" > "${__cdist_my_out_dir}/$explorer_name" - else - if [ -e "$explorer" ]; then - __cdist_exit_err "Explorer \"$explorer\" exists, but is not a file." - fi - fi -done diff --git a/bin/cdist.py b/bin/cdist.py new file mode 120000 index 00000000..9a039b33 --- /dev/null +++ b/bin/cdist.py @@ -0,0 +1 @@ +cdist \ No newline at end of file From 264a76ca2f0eb41c234be3882287c5c7676b20f6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 21:29:05 +0200 Subject: [PATCH 0117/1024] more stuff to ignore Signed-off-by: Nico Schottelius --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 10d98990..d606aec7 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ doc/man/man*/docbook-xsl.css # Ignore cache for version control cache/ + +# Python +bin/__pycache__/ From c0ab4cdd8de653e36ff8c77dd1eb072325435382 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 21:34:24 +0200 Subject: [PATCH 0118/1024] remove now obsolete core directory Signed-off-by: Nico Schottelius --- core/__cdist_cache | 34 ------------ core/__cdist_dir | 46 ---------------- core/__cdist_dir_listing | 30 ----------- core/__cdist_echo | 56 ------------------- core/__cdist_exit_err | 28 ---------- core/__cdist_explorer_run | 79 --------------------------- core/__cdist_explorer_run_global | 32 ----------- core/__cdist_is_executable | 44 --------------- core/__cdist_kill_on_interrupt | 31 ----------- core/__cdist_manifest_run | 53 ------------------ core/__cdist_manifest_run_init | 32 ----------- core/__cdist_object_all | 60 --------------------- core/__cdist_object_code_run | 54 ------------------- core/__cdist_object_explorer_run | 89 ------------------------------- core/__cdist_object_gencode | 66 ----------------------- core/__cdist_object_gencode_run | 36 ------------- core/__cdist_object_list | 36 ------------- core/__cdist_object_manifest_run | 59 -------------------- core/__cdist_object_prepare | 47 ---------------- core/__cdist_object_run | 74 ------------------------- core/__cdist_run | 27 ---------- core/__cdist_run_remote | 32 ----------- core/__cdist_run_shell | 34 ------------ core/__cdist_tmp_removal | 27 ---------- core/__cdist_type_build_emulation | 49 ----------------- core/__cdist_usage | 27 ---------- 26 files changed, 1182 deletions(-) delete mode 100755 core/__cdist_cache delete mode 100755 core/__cdist_dir delete mode 100755 core/__cdist_dir_listing delete mode 100755 core/__cdist_echo delete mode 100755 core/__cdist_exit_err delete mode 100755 core/__cdist_explorer_run delete mode 100755 core/__cdist_explorer_run_global delete mode 100755 core/__cdist_is_executable delete mode 100644 core/__cdist_kill_on_interrupt delete mode 100755 core/__cdist_manifest_run delete mode 100755 core/__cdist_manifest_run_init delete mode 100755 core/__cdist_object_all delete mode 100755 core/__cdist_object_code_run delete mode 100755 core/__cdist_object_explorer_run delete mode 100755 core/__cdist_object_gencode delete mode 100755 core/__cdist_object_gencode_run delete mode 100755 core/__cdist_object_list delete mode 100755 core/__cdist_object_manifest_run delete mode 100755 core/__cdist_object_prepare delete mode 100755 core/__cdist_object_run delete mode 100755 core/__cdist_run delete mode 100755 core/__cdist_run_remote delete mode 100755 core/__cdist_run_shell delete mode 100755 core/__cdist_tmp_removal delete mode 100755 core/__cdist_type_build_emulation delete mode 100755 core/__cdist_usage diff --git a/core/__cdist_cache b/core/__cdist_cache deleted file mode 100755 index 95764d3d..00000000 --- a/core/__cdist_cache +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# -# 2010 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 . -# -# -# Save the configuration tree into the local cache -# - -__cdist_cache() -{ - # Create base to move into - mkdir -p "${__cdist_local_base_cache_dir}" - - __cdist_echo info \ - "Caching to $(__cdist_host_cache_dir "$__cdist_target_host")" - rm -rf "$(__cdist_host_cache_dir "$__cdist_target_host")" - mv "$__cdist_local_base_dir" \ - "$(__cdist_host_cache_dir "$__cdist_target_host")" -} diff --git a/core/__cdist_dir b/core/__cdist_dir deleted file mode 100755 index 32ee0075..00000000 --- a/core/__cdist_dir +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Push a directory to a target, both sides have the same name (i.e. explorers) -# or -# Pull a directory from a target, both sides have the same name (i.e. explorers) -# - -__cdist_dir() -{ - [ $# -eq 3 ] || __cdist_usage " " - - # ${3%/*} will be the destination directory, so no subdirectories - # of the same name are created, if the directory is already existing - - if [ "$1" = "push" ]; then - # FIXME: add error handling with __cdist_run_remote_... or so - ssh "${__cdist_remote_user}@${__cdist_target_host}" \ - "mkdir -p \"$3\"" - scp -qr "$2" \ - "${__cdist_remote_user}@${__cdist_target_host}:${3%/*}" - elif [ "$1" = "pull" ]; then - mkdir -p "$3" - scp -qr "${__cdist_remote_user}@${__cdist_target_host}:$2" \ - "${3%/*}" - else - __cdist_exit_err "Unknown action $1" - fi -} diff --git a/core/__cdist_dir_listing b/core/__cdist_dir_listing deleted file mode 100755 index f4aa2320..00000000 --- a/core/__cdist_dir_listing +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# List files in a directory, if it exists -# -# We only create output, if there's at least one entry -# and can thus be used as a boolean ;-) -# - -__cdist_dir_listing() -{ - [ -d "$1" ] && ls -1 "$1" -} diff --git a/core/__cdist_echo b/core/__cdist_echo deleted file mode 100755 index a89d1821..00000000 --- a/core/__cdist_echo +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# echo / syslog alike function -# - -__cdist_echo() -{ - __cdist_echo_type="$1"; shift - - set +u - if [ "$__cdist_object_self" ]; then - __cdist_echo_prefix="${__cdist_object_self}:" - else - __cdist_echo_prefix="core: " - fi - set -u - - case "$__cdist_echo_type" in - debug) - if [ "$__cdist_debug" = 1 ]; then - echo $__cdist_echo_prefix "DEBUG: $@" - fi - ;; - info) - echo $__cdist_echo_prefix "$@" - ;; - warn) - echo $__cdist_echo_prefix "Warning: $@" - ;; - error) - echo $__cdist_echo_prefix "Error: $@" >&2 - ;; - *) - echo "CORE BUG, who created the broken commit in $0?" >&2 - exit 23 - ;; - esac -} diff --git a/core/__cdist_exit_err b/core/__cdist_exit_err deleted file mode 100755 index 303dbf20..00000000 --- a/core/__cdist_exit_err +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Print error and exit (perror() alike) -# - -__cdist_exit_err() -{ - __cdist_echo error "$@" - exit 1 -} diff --git a/core/__cdist_explorer_run b/core/__cdist_explorer_run deleted file mode 100755 index 9e58fa09..00000000 --- a/core/__cdist_explorer_run +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Run explorers - FIXME: this function is ugly -# - -__cdist_explorer_run() -{ - [ $# -eq 5 ] || __cdist_usage " " - - # Ensure there is at least one explorer - num="$(ls -1 "$__cdist_explorer_dir" | wc -l)" - if [ "$num" -lt 1 ]; then - __cdist_exit_err "${__cdist_explorer_dir}: Contains no explorers" - fi - - # Check whether to setup variable for type explorer - case "$1" in - global) - ;; - type) - # FIXME: think about how and where this gets setup! - "$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\"" - ;; - esac - - # Transfer explorers - __cdist_dir push "$2" "$3" - - # Create output directory - __cdist_run_remote mkdir -p "$4" - - # Execute all explorers - FIXME: isolate cd call? - cd "$2"; - # FIXME: cleanup double variable, no need when in directory - for __cdist_explorer_run_explorer in *; do - __cdist_explorer_explorer_name="${__cdist_explorer_run_explorer##*/}" - - if [ -f "$__cdist_explorer_run_explorer" ]; then - if [ ! -x "$__cdist_explorer_run_explorer" ]; then - __cdist_exit_err "Explorer \"$__cdist_explorer_run_explorer\" exists, but is not executable." - fi - - else - if [ -e "$__cdist_explorer_run_explorer" ]; then - __cdist_exit_err "Explorer \"$__cdist_explorer_run_explorer\" exists, but is not a file." - fi - fi - - # FIXME: no need for remote out dir probably? - # or should we leave it and continue using __cdist_dir pull? - __cdist_run_remote \ - "export $__cdist_name_var_explorer=\"$__cdist_remote_explorer_dir\";" \ - "export $__cdist_name_var_global=\"$__cdist_remote_out_dir\";" \ - "$3/$__cdist_explorer_run_explorer" ">" \ - "$4/$__cdist_explorer_run_explorer" || \ - __cdist_exit_err "Explorer $__cdist_explorer_run_explorer failed." - done - - # Transfer results back - __cdist_dir pull "$4" "$5" -} diff --git a/core/__cdist_explorer_run_global b/core/__cdist_explorer_run_global deleted file mode 100755 index 27359713..00000000 --- a/core/__cdist_explorer_run_global +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Copy & run the global explorers, i.e. not bound to types -# - -__cdist_explorer_run_global() -{ - __cdist_echo info "Running global explorers " - - # run the global explorers remotely - __cdist_explorer_run global \ - "$__cdist_explorer_dir" "$__cdist_remote_explorer_dir" \ - "$__cdist_remote_out_explorer_dir" "$__cdist_out_explorer_dir" -} diff --git a/core/__cdist_is_executable b/core/__cdist_is_executable deleted file mode 100755 index a7a6d174..00000000 --- a/core/__cdist_is_executable +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Test whether something is executable (that should be executable) or -# is missing -# - -__cdist_is_executable() -{ - [ $# -eq 1 ] || __cdist_exit_err "" - - if [ -e "$1" ]; then - if [ -f "$1" ]; then - if [ -x "$1" ]; then - # Exists and is a correct executable - true - else - __cdist_exit_err "$1 exists, but is not executable." - fi - else - __cdist_exit_err "$1 exists, but is not a file." - fi - else - # Does not exist - false - fi -} diff --git a/core/__cdist_kill_on_interrupt b/core/__cdist_kill_on_interrupt deleted file mode 100644 index 7cb711fa..00000000 --- a/core/__cdist_kill_on_interrupt +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Run the given command for each created object. -# - -# Does not work in children, will be called again in every script! -# Use only in interactive "front end" scripts -__cdist_kill_on_interrupt() -{ - __cdist_tmp_removal - kill 0 - exit 1 -} diff --git a/core/__cdist_manifest_run b/core/__cdist_manifest_run deleted file mode 100755 index cf85d646..00000000 --- a/core/__cdist_manifest_run +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Let's build a cconfig tree from a configuration -# And save it into the cache tree -# - -__cdist_manifest_run() -{ - [ $# -eq 1 ] || __cdist_usage "" - - __cdist_manifest="$1"; shift - - ################################################################################ - # Export information for cdist-type-emulator or manifest - # - - # Config dir should not get reset - FIXME: why did I do this? - export __cdist_conf_dir - - # Used to record the source in the object - export __cdist_manifest - - # Export information for manifests - __cdist_out_dir comes from cdist-config - export $__cdist_name_var_global="$__cdist_out_dir" - - ################################################################################ - # The actual run - # - - # Ensure binaries are existing - FIXME: move error handling into __cdist_type_build_emulation - __cdist_type_build_emulation \ - || __cdist_exit_err "Failed to build type emulation binaries" - - __cdist_run_shell "${__cdist_manifest}" -} diff --git a/core/__cdist_manifest_run_init b/core/__cdist_manifest_run_init deleted file mode 100755 index e8fa63de..00000000 --- a/core/__cdist_manifest_run_init +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Let's build a cconfig tree from a configuration -# And save it into the cache tree -# - -__cdist_manifest_run_init() -{ - # FIXME: probably do not export but always set explicitly? - export $__cdist_name_var_manifest="$__cdist_manifest_dir" - - __cdist_echo info "Running initial manifest for $__cdist_target_host " - __cdist_manifest_run "$__cdist_manifest_init" -} diff --git a/core/__cdist_object_all b/core/__cdist_object_all deleted file mode 100755 index 965d08f6..00000000 --- a/core/__cdist_object_all +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Run the given command for each created object. -# - -__cdist_object_all() -{ - [ $# -eq 1 ] || __cdist_usage "" - - __cdist_object_all_object_all_command="$1"; shift - - __cdist_object_all_object_all_objects="$__cdist_tmp_dir/objects" - - # Ensure object dir exists, so marker can be created - mkdir -p "${__cdist_out_object_dir}" - - # FIXME: : - why do we use a file? - # core/__cdist_object_manifest_run: touch "$__cdist_objects_created" - - # Loop until we do not create new objects anymore - # which is equal to all objects have been run - touch "$__cdist_objects_created" - while [ -f "$__cdist_objects_created" ]; do - # Assume we're done after this run - rm "$__cdist_objects_created" - - # Get listing of objects - __cdist_object_list "$__cdist_out_object_dir" > \ - "$__cdist_object_all_object_all_objects" - - # NEED TO CREATE ARRAY, SSH DESTROYS WHILE READ LOOP - while read __cdist_object_all_object; do - set -- "$@" "$__cdist_object_all_object" - done < "$__cdist_object_all_object_all_objects" - - while [ $# -gt 0 ]; do - __cdist_object_all_object="$1"; shift - $__cdist_object_all_object_all_command "$__cdist_object_all_object" - done - done -} diff --git a/core/__cdist_object_code_run b/core/__cdist_object_code_run deleted file mode 100755 index 8af67ab8..00000000 --- a/core/__cdist_object_code_run +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Exec the code for the given object locally and remote -# - -__cdist_object_code_run() -{ - [ $# -eq 1 ] || __cdist_exit_err "" - - - if [ ! -d "$(__cdist_object_dir "$1")" ]; then - __cdist_exit_err "Object undefined" - fi - - # Code local - export __cdist_out_object_dir="$__cdist_out_object_dir" - __cdist_echo debug "Trying to run local code" - if __cdist_is_executable \ - "$(__cdist_object_code "$1" "${__cdist_name_gencode_local}")"; then - __cdist_run_shell \ - "$(__cdist_object_code "$1" "${__cdist_name_gencode_local}")" - else - __cdist_echo debug "Local code: none" - fi - - # Code remote - __cdist_echo debug "Trying to run remote code" - if __cdist_is_executable \ - "$(__cdist_object_code "$1" "${__cdist_name_gencode_remote}")"; then - - __cdist_run_remote $(__cdist_remote_object_code "$1") - else - __cdist_echo debug "Remote code: none" - fi -} diff --git a/core/__cdist_object_explorer_run b/core/__cdist_object_explorer_run deleted file mode 100755 index da59d6c3..00000000 --- a/core/__cdist_object_explorer_run +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Run the explorers for the given object on the target host. -# - -# FIXME: many cleanups needed before going production! - -__cdist_object_explorer_run() -{ - __cdist_object_self="$1"; shift - - __cdist_object_id="$(__cdist_object_id_from_object "$__cdist_object_self")" - __cdist_type="$(__cdist_type_from_object "$__cdist_object_self")" - - # Check if type of object has >= 1 explorer - __cdist_has_explorer="$(__cdist_dir_listing "$(__cdist_type_explorer_dir "$__cdist_type")" | wc -l)" - # Run the type explorers for the current object if any - if [ "$__cdist_has_explorer" -ge 1 ]; then - if ! __cdist_type_explorer_pushed "$__cdist_type"; then - # FIXME: variables! - src_dir="$(__cdist_type_explorer_dir "$__cdist_type")" - dst_dir="$(__cdist_remote_type_explorer_dir "$__cdist_type")" - __cdist_echo info "Transfering explorers for $__cdist_type " - __cdist_dir push "$src_dir" "$dst_dir" - __cdist_type_explorer_pushed_add "$__cdist_type" - fi - - __cdist_echo info "Running explorers" - # Copy object parameters - __cdist_dir push \ - "$(__cdist_object_parameter_dir "$__cdist_object_self")" \ - "$(__cdist_remote_object_parameter_dir "$__cdist_object_self")" - - # Execute explorers - # FIXME: STOPPED: - # - remove cdist-remote-explorer-run - # - problem: new variables / need to run explorer directly? - # -> or put logic into __cdist_explorer_run - # -> think about having _one_ wrapper script for remote to execute - # shell functions - - # Create remote output directory - __cdist_run_remote mkdir -p "$(__cdist_remote_object_type_explorer_dir "$__cdist_object_self")" - - cd "$(__cdist_type_explorer_dir "$__cdist_type")" - - - for __cdist_object_explorer_run_explorer in *; do - __cdist_run_remote \ - "$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\"" \ - "$__cdist_name_var_object_id=\"$__cdist_object_id\"" \ - "$__cdist_name_var_self=\"$__cdist_object_self\"" \ - "$(__cdist_remote_type_explorer_dir "$__cdist_type")/$__cdist_object_explorer_run_explorer" \ - ">" "$(__cdist_remote_object_type_explorer_dir "$__cdist_object_self")/$__cdist_object_explorer_run_explorer" - done - -# __cdist_run_remote \ -# "$__cdist_name_var_object=\"$(__cdist_remote_object_dir "$__cdist_object_self")\"" \ -# "$__cdist_name_var_object_id=\"$__cdist_object_id\"" \ -# "$__cdist_name_var_self=\"$__cdist_object_self\"" \ -# cdist-remote-explorer-run \ -# "$__cdist_name_var_type_explorer" \ -# "$(__cdist_remote_type_explorer_dir "$__cdist_type")" \ -# "$(__cdist_remote_object_type_explorer_dir "$__cdist_object_self")" - - # Copy back results - __cdist_dir pull "$(__cdist_remote_object_type_explorer_dir "$__cdist_object_self")" \ - "$(__cdist_object_type_explorer_dir "$__cdist_object_self")" - fi -} diff --git a/core/__cdist_object_gencode b/core/__cdist_object_gencode deleted file mode 100755 index 08ef8b7d..00000000 --- a/core/__cdist_object_gencode +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Generate code from one object (object must be relative path!) -# WARNING: OUTPUT ON STDOUT, ERRORS NEED TO BE ON STDERR! -# - -# FIXME: check variable names: -# either prefix or use global or use functions directly -# functions looks good, they are cheap anyway! - -__cdist_object_gencode() -{ - [ $# -eq 2 ] || __cdist_usage "" "" - - __cdist_object_self="$1"; shift - __cdist_gencode_type="$1"; shift - - __cdist_type="$(__cdist_type_from_object "$__cdist_object_self")" - __cdist_type_gencode="$(__cdist_type_gencode "$__cdist_type" "$__cdist_gencode_type")" - __cdist_code_output="$(__cdist_object_code "$__cdist_object_self" "$__cdist_gencode_type")" - - # export variables for the gencode script - export __object_id="$(__cdist_object_id_from_object "$__cdist_object_self")" - export __object="$(__cdist_object_dir "$__cdist_object_self")" - export __global="$__cdist_out_dir" - - if [ -x "$__cdist_type_gencode" ]; then - __cdist_run_shell "$__cdist_type_gencode" > "$__cdist_tmp_file" - else - if [ -e "$__cdist_type_gencode" ]; then - __cdist_exit_err "$__cdist_type_gencode exists, but is not executable" - fi - - # Ensure it's empty, if there is no gencode - : > "$__cdist_tmp_file" - fi - - # Only create code, if gencode created output - if [ "$(wc -l < "$__cdist_tmp_file")" -gt 0 ]; then - cat - "$__cdist_tmp_file" << eof > "$__cdist_code_output" -# -# The following code was generated by $__cdist_type_gencode -# - -eof - chmod u+x "${__cdist_code_output}" - fi -} diff --git a/core/__cdist_object_gencode_run b/core/__cdist_object_gencode_run deleted file mode 100755 index 308f5f33..00000000 --- a/core/__cdist_object_gencode_run +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# -# 2010 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# For the given object create the code to be executed on the target. -# - -__cdist_object_gencode_run() -{ - __cdist_object_gencode_run_object="$1"; shift - - __cdist_echo info "Generating local code " - __cdist_object_gencode "$__cdist_object_gencode_run_object" \ - "${__cdist_name_gencode_local}" - - __cdist_echo info "Generating remote code " - __cdist_object_gencode "$__cdist_object_gencode_run_object" \ - "${__cdist_name_gencode_remote}" -} diff --git a/core/__cdist_object_list b/core/__cdist_object_list deleted file mode 100755 index f2785c30..00000000 --- a/core/__cdist_object_list +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Print error and exit (perror() alike) -# - -__cdist_object_list() -{ - # FIXME: no local in posix - local basedir="$1"; shift - - # Use subshell to prevent changing cwd in program - ( - cd "${basedir}" - - find . -name "$__cdist_name_dot_cdist" | \ - sed -e 's;^./;;' -e "s;/${__cdist_name_dot_cdist}\$;;" - ) -} diff --git a/core/__cdist_object_manifest_run b/core/__cdist_object_manifest_run deleted file mode 100755 index efc85539..00000000 --- a/core/__cdist_object_manifest_run +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh -# -# 2010 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Run the manifest for the given object. -# - - -__cdist_object_manifest_run() -{ - [ $# -eq 1 ] || __cdist_usage "" - - __cdist_object_self="$1"; shift - - # FIXME: rename to __cdist_object_dir (everywhere!) - __cdist_cur_object_dir="$(__cdist_object_dir "$__cdist_object_self")" - __cdist_object_id="$(__cdist_object_id_from_object "$__cdist_object_self")" - - __cdist_echo info "Checking manifest " - - __cdist_type="$(__cdist_type_from_object "$__cdist_object_self")" - __cdist_manifest="$(__cdist_type_manifest "$__cdist_type")" - - if [ -f "$__cdist_manifest" ]; then - if [ -x "$__cdist_manifest" ]; then - # Make __cdist_manifest available for cdist-type-emulator - export __cdist_manifest - - __cdist_echo info "Executing manifest " - export $__cdist_name_var_object="$__cdist_cur_object_dir" - export $__cdist_name_var_object_id="$__cdist_object_id" - export $__cdist_name_var_type="$(__cdist_type_dir "$__cdist_type")" - - __cdist_manifest_run "$__cdist_manifest" - - # Tell cdist-object-run-all that there may be new objects - touch "$__cdist_objects_created" - else - __cdist_exit_err "${__cdist_manifest} needs to be executable." - fi - fi -} diff --git a/core/__cdist_object_prepare b/core/__cdist_object_prepare deleted file mode 100755 index 24039be0..00000000 --- a/core/__cdist_object_prepare +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# For the given object: -# - run type explorers -# - run type manifest -# - -__cdist_object_prepare() -{ - [ $# -eq 1 ] || __cdist_usage "" - - __cdist_object_self="$1"; shift - __cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")" - [ -d "$__cdist_object_dir" ] || __cdist_exit_err "Object undefined" - - # Export to non-core for use in manifest and gencode scripts - export $__cdist_name_var_self=$__cdist_object_self - - __cdist_object_prepared="$(__cdist_object_prepared "$__cdist_object_self")" - if [ ! -f "$__cdist_object_prepared" ]; then - __cdist_echo info "Preparing object" - __cdist_object_explorer_run "$__cdist_object_self" - __cdist_object_manifest_run "$__cdist_object_self" - - # Mark this object as prepared - touch "$__cdist_object_prepared" - fi -} diff --git a/core/__cdist_object_run b/core/__cdist_object_run deleted file mode 100755 index d2c7df6e..00000000 --- a/core/__cdist_object_run +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# For the given object: -# - run type explorers -# - run type manifest -# - generate code -# - copy object to target -# - execute code on target -# - -__cdist_object_run() -{ - [ $# -eq 1 ] || __cdist_usage "" - - __cdist_object_self="$1"; shift - __cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")" - [ -d "$__cdist_object_dir" ] || __cdist_exit_err "Object undefined" - - # Export to non-core for use in manifest and gencode scripts - export $__cdist_name_var_self=$__cdist_object_self - - # FIXME: BUG: should be named differently! - # FIXME: BUG: I can be called recursively! -> variables are probably already set / overwritten! - __cdist_object_finished="$(__cdist_object_finished "$__cdist_object_self")" - if [ ! -f "$__cdist_object_finished" ]; then - # Resolve dependencies, if any - __cdist_object_require="$(__cdist_object_require "$__cdist_object_self")" - if [ -f "$__cdist_object_require" ]; then - # NEED TO CREATE ARRAY, SSH DESTROYS WHILE READ LOOP - while read __cdist_requirement; do - set -- "$@" "$__cdist_requirement" - done < "$__cdist_object_require" - - while [ $# -gt 0 ]; do - __cdist_requirement="$1"; shift - __cdist_echo info "Resolving requirement $__cdist_requirement" - # FIXME: BUG: at this point, the other __cdist_object_run may have - # overwritten all our variables! - __cdist_object_run "$__cdist_requirement" - done - fi - - __cdist_echo debug "Before gencode" - __cdist_object_gencode_run "$__cdist_object_self" - __cdist_echo debug "Before push" - __cdist_dir push "$(__cdist_object_dir "$__cdist_object_self")" \ - "$(__cdist_remote_object_dir "$__cdist_object_self")" - __cdist_echo debug "Before run" - __cdist_object_code_run "$__cdist_object_self" - __cdist_echo debug "Object run done" - - # Mark this object as done - touch "$__cdist_object_finished" - fi -} diff --git a/core/__cdist_run b/core/__cdist_run deleted file mode 100755 index 8febe550..00000000 --- a/core/__cdist_run +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Exit if an error occurs running something -# - -__cdist_run() -{ - "$@" || __cdist_echo error "$1 exited non-zero, aborting." -} diff --git a/core/__cdist_run_remote b/core/__cdist_run_remote deleted file mode 100755 index 17074049..00000000 --- a/core/__cdist_run_remote +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Run a cdist binary on the remote side -# - -__cdist_run_remote() -{ - [ $# -ge 1 ] || __cdist_usage " [opts]" - - ssh "${__cdist_remote_user}@${__cdist_target_host}" \ - "export PATH=\"${__cdist_remote_bin_dir}:\$PATH\";" \ - "export __cdist_out_object_dir=\"$__cdist_remote_out_object_dir\";" \ - "$@" -} diff --git a/core/__cdist_run_shell b/core/__cdist_run_shell deleted file mode 100755 index b6e0a57d..00000000 --- a/core/__cdist_run_shell +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Exit if an error occurs when running a shell script -# - -__cdist_run_shell() -{ - # Prepend our path, so all cdist tools come before other tools - PATH="${__cdist_out_type_bin_dir}:$PATH" sh -e "$@" - if [ "$?" -ne 0 ]; then - __cdist_echo error "$1 exited non-zero" - __cdist_echo warn "Faulty code:" - cat "$1" - __cdist_exit_err "Aborting due to non-zero exit code." - fi -} diff --git a/core/__cdist_tmp_removal b/core/__cdist_tmp_removal deleted file mode 100755 index 74d74936..00000000 --- a/core/__cdist_tmp_removal +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Remove tmp dir -# - -__cdist_tmp_removal() -{ - rm -rf "${__cdist_tmp_dir}" -} diff --git a/core/__cdist_type_build_emulation b/core/__cdist_type_build_emulation deleted file mode 100755 index 3c7270ca..00000000 --- a/core/__cdist_type_build_emulation +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# Build pseudo binaries for type emulation -# - -__cdist_type_build_emulation() -{ - [ $# -eq 0 ] || __cdist_usage "No arguments" - - [ -f "${__cdist_out_type_bin_dir}/.marker" ] && return 0 - - __cdist_type_emulator="$__cdist_abs_mydir/cdist-type-emulator" - - if [ ! -d "${__cdist_type_dir}" ]; then - __cdist_exit_err "$__cdist_type_dir must exist and contain available types" - fi - - # Get Types - ( - cd "${__cdist_type_dir}" - ls -1 > "${__cdist_tmp_file}" - ) - - # Create binaries - mkdir -p "${__cdist_out_type_bin_dir}" - while read __cdist_type_build_emulation_type; do - ln -sf "${__cdist_type_emulator}" \ - "${__cdist_out_type_bin_dir}/${__cdist_type_build_emulation_type}" - done < "${__cdist_tmp_file}" - - touch "${__cdist_out_type_bin_dir}/.marker" -} diff --git a/core/__cdist_usage b/core/__cdist_usage deleted file mode 100755 index 9dfa30e4..00000000 --- a/core/__cdist_usage +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Print error and exit (perror() alike) -# - -__cdist_usage() -{ - __cdist_exit_err "$__cdist_myname: $@" -} From 47c5ebcf3f34de77f35904c90b96c2f1f44eb733 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 21:37:40 +0200 Subject: [PATCH 0119/1024] remove parallel and sequential args, until they are working Signed-off-by: Nico Schottelius --- bin/cdist | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 9f713ee3..a04575a8 100755 --- a/bin/cdist +++ b/bin/cdist @@ -588,12 +588,12 @@ if __name__ == "__main__": parser.add_argument('-i', '--initial-manifest', help='Path to a cdist manifest or - to read from stdin', dest='manifest', required=False) - parser.add_argument('-p', '--parallel', - help='Operate on multiple hosts in parallel', - action='store_true', dest='parallel') - parser.add_argument('-s', '--sequential', - help='Operate on multiple hosts sequentially', - action='store_false', dest='parallel') +# parser.add_argument('-p', '--parallel', +# help='Operate on multiple hosts in parallel', +# action='store_true', dest='parallel') +# parser.add_argument('-s', '--sequential', +# help='Operate on multiple hosts sequentially', +# action='store_false', dest='parallel') args = parser.parse_args(sys.argv[1:]) if args.debug: From 326f2644c7a9d7471a73b55403c97b620f28b570 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 21:41:56 +0200 Subject: [PATCH 0120/1024] introduce type_dir() and use it :-) Signed-off-by: Nico Schottelius --- bin/cdist | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index a04575a8..5b2b8d88 100755 --- a/bin/cdist +++ b/bin/cdist @@ -302,9 +302,13 @@ class Cdist: return objects + def type_dir(self, type): + """Return directory the type""" + return os.path.join(TYPE_DIR, type) + def type_explorer_dir(self, type): """Return directory that holds the explorers of a type""" - return os.path.join(TYPE_DIR, type, "explorer") + return os.path.join(self.type_dir(type), "explorer") def type_gencode_paths(self, type): """Return paths to gencode scripts of type""" @@ -444,7 +448,7 @@ class Cdist: env = { "__object" : self.object_dir(cdist_object), "__object_id": self.get_object_id_from_object(cdist_object), "__object_fq": cdist_object, - "__type": type + "__type": self.type_dir(type) } self.run_manifest(manifest, extra_env=env) From 0d1f121e2153b92aa6166279d10a2765e9999c8f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 22:21:46 +0200 Subject: [PATCH 0121/1024] do not fail without objects Signed-off-by: Nico Schottelius --- bin/cdist | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/bin/cdist b/bin/cdist index 5b2b8d88..7a4d3186 100755 --- a/bin/cdist +++ b/bin/cdist @@ -121,6 +121,9 @@ class Cdist: # List of type explorers transferred self.type_explorers_transferred = {} + # objects + self.objects_prepared = [] + self.remote_user = remote_user # Mostly static, but can be overwritten on user demand @@ -241,13 +244,10 @@ class Cdist: return list - def list_object_paths(self, starting_point = False): + def list_object_paths(self, starting_point): """Return list of paths of existing objects""" object_paths = [] - if not starting_point: - starting_point = self.object_base_dir - for content in os.listdir(starting_point): full_path = os.path.join(starting_point, content) if os.path.isdir(full_path): @@ -288,17 +288,15 @@ class Cdist: return [os.path.join(self.object_dir(cdist_object), "code-local"), os.path.join(self.object_dir(cdist_object), "code-remote")] - def list_objects(self, starting_point = False): + def list_objects(self): """Return list of existing objects""" - if not starting_point: - starting_point = self.object_base_dir - - object_paths = self.list_object_paths(starting_point) objects = [] + if os.path.isdir(self.object_base_dir): + object_paths = self.list_object_paths(self.object_base_dir) - for path in object_paths: - objects.append(os.path.relpath(path, starting_point)) + for path in object_paths: + objects.append(os.path.relpath(path, self.object_base_dir)) return objects @@ -561,10 +559,14 @@ class Cdist: while old_objects != objects: log.debug("Prepare stage") old_objects = list(objects) - # FIXME: do not rerun existing objects! for cdist_object in objects: - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) + if cdist_object in self.objects_prepared: + log.debug("Skipping rerun of object %s", cdist_object) + continue + else: + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + self.objects_prepared.append(cdist_object) objects = self.list_objects() From db658328d219b524b493bb5810c79ca27fbaf163 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 23:11:27 +0200 Subject: [PATCH 0122/1024] add sh -e header to code to avoid OSError: [Errno 8] Exec format error Signed-off-by: Nico Schottelius --- bin/cdist | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 7a4d3186..bb6e38fa 100755 --- a/bin/cdist +++ b/bin/cdist @@ -59,6 +59,7 @@ REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") +CODE_HEADER = "#!/bin/sh -e" DOT_CDIST = ".cdist" VERSION = "2.0.0" @@ -517,15 +518,18 @@ class Cdist: os.path.basename(bin)[3:]) outfile_fd = open(outfile, "w") + outfile_fd.write(CODE_HEADER) + self.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) outfile_fd.close() status = os.stat(outfile) # Remove output if empty, else make it executable - if status.st_size == 0: + if status.st_size == len(CODE_HEADER): os.unlink(outfile) else: + # Add header and make executable os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) if mode == "code": From 9a0b57c4b5266a39bcbbf9e44e9efa3ddcfa8ad2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 23:41:46 +0200 Subject: [PATCH 0123/1024] update todos Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 36 +++++++----------------------------- doc/dev/todo/niconext | 5 +---- 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 5ded4298..e67469ce 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -5,26 +5,13 @@ Feel free to pick one! CORE ---- -- Inconsistent error messages if object is not existing! - -> always use "Object undefined" -- Add echo function / beautify output - __cdist_echo [level] [messages...] - level := syslog alike: - debug, notice, err - Include object_self prefixing, if given! -- Think about moving cdist-type-build-emulation out of cdist-manifest-run to - cdist-deploy-to: more dependency of cdist-manifest-run, but a lot of - less cycles consumed - -- cdist-object-gencode: remove code if output empty? - - also take care of that in cdist-code-run! -- Remove cdist-object-push, covers only one line and is used only once: - [20:22] kr:bin% grep cdist-object-push * - cdist-object-run: cdist-object-push "$__cdist_target_host" "$__cdist_object" - [20:22] kr:bin% - - probably remove or improve cdist-type-template -- add $__tmp? +- allow cdist to run without $PATH setup: ./bin/cdist-deploy-to +- support non-ssh access? + +USER INTERFACE +-------------- +- add support $__tmp? - for use in manifest, code, etc.? - for creating temporary files, etc. @@ -36,20 +23,11 @@ CORE -> for current host -> add function to cdist-config, import from cdist-cache -- check all all internal variables are prefixed with __cdist - Define / document "this is what should be on host X" and have it parsable by different (shinken) tool -> given after manifest run already! -- Allow types to have parameters without values (boolean flags). - e.g. __chair fancychair --pink --wood - would result in: - $__object/parameter/ - pink # empty file - wood # empty file - -- allow cdist to run without $PATH setup: ./bin/cdist-deploy-to -- use absent/present for state by default +- use absent/present for state by default? TYPES ------ diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 972525aa..a4c23e8b 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,5 +1,2 @@ -- rewrite in python? - - also do with cdist-type-emulator, which had quirks applied from outside to run -- support non-ssh access? - - Bug: os.path.join() may be wrong for the remote side! + -> does not matter for now! From 2490b983ba5e7b76504de5fc6bae3a5e542c8974 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 23:42:53 +0200 Subject: [PATCH 0124/1024] ++todo Signed-off-by: Nico Schottelius --- bin/cdist | 7 +++++-- doc/dev/todo/TAKEME | 2 -- doc/dev/todo/niconext | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index bb6e38fa..6da7d04c 100755 --- a/bin/cdist +++ b/bin/cdist @@ -99,7 +99,7 @@ def banner(): class Cdist: """Cdist main class to hold arbitrary data""" - def __init__(self, target_host, initial_manifest=False, remote_user="root"): + def __init__(self, target_host, initial_manifest=False, remote_user="root", home=None): self.target_host = target_host self.remote_prefix = ["ssh", "root@" + self.target_host] @@ -593,6 +593,9 @@ if __name__ == "__main__": parser.add_argument('-b', '--banner', help='Show cdist banner', action='store_true', dest='banner') + parser.add_argument('-c', '--cdist-home', + help='Change cdist home (default: .. from bin directory)', + action='store_true', dest='cdist_home') parser.add_argument('-d', '--debug', help='Set log level to debug', action='store_true') parser.add_argument('-i', '--initial-manifest', @@ -617,7 +620,7 @@ if __name__ == "__main__": log.debug(args) for host in args.host: - c = Cdist(host, initial_manifest=args.manifest) + c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home) c.deploy_to() c.cleanup() except KeyboardInterrupt: diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index e67469ce..5439a1b9 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -44,5 +44,3 @@ DOCUMENTATION - asciidoc interprets __, which we use for variables names -> seek through docs and replace with \_\_! - reference explorers in cdist-reference! -- compare running times: - one, 5, 10, 50, 100, 1000 hosts => how does cdist scale? diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index a4c23e8b..f8535c07 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,2 +1,6 @@ +- Remove all FIXME entries +- Write cdist-manpage +- Remove obsolete manpages +- Support different home instead of ../ - Bug: os.path.join() may be wrong for the remote side! -> does not matter for now! From 1598e18c28b30643d4191fbcbfefa913ef48bdb6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 23:54:18 +0200 Subject: [PATCH 0125/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index f8535c07..3968b0ef 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -4,3 +4,7 @@ - Support different home instead of ../ - Bug: os.path.join() may be wrong for the remote side! -> does not matter for now! + +- Rewrite cdist-type-emulator + - Remove legacy code in cdist + - Remove cdist-config From 1cc7600c9c10125e8b415368b155c4054bf6b1cf Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Sep 2011 23:54:34 +0200 Subject: [PATCH 0126/1024] begin to make home configurable Signed-off-by: Nico Schottelius --- bin/cdist | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/bin/cdist b/bin/cdist index 6da7d04c..3361d5da 100755 --- a/bin/cdist +++ b/bin/cdist @@ -46,13 +46,6 @@ BANNER = """ """ # Given paths from installation -BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) -CONF_DIR = os.path.join(BASE_DIR, "conf") -GLOBAL_EXPLORER_DIR = os.path.join(CONF_DIR, "explorer") -LIB_DIR = os.path.join(BASE_DIR, "lib") -MANIFEST_DIR = os.path.join(CONF_DIR, "manifest") -TYPE_DIR = os.path.join(CONF_DIR, "type") - REMOTE_BASE_DIR = "/var/lib/cdist" REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") @@ -87,10 +80,6 @@ VERSION = "2.0.0" logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') log = logging.getLogger() -# List types -def list_types(): - return os.listdir(TYPE_DIR) - def banner(): """Guess what :-)""" print(BANNER) @@ -106,6 +95,17 @@ class Cdist: # Setup directory paths self.temp_dir = tempfile.mkdtemp() + + if home: + self.base_dir = home + else: + self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + self.conf_dir = os.path.join(self.base_dir, "conf") + self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") + self.lib_dir = os.path.join(self.base_dir, "lib") + self.manifest_dir = os.path.join(self.conf_dir, "manifest") + self.type_base_dir = os.path.join(self.conf_dir, "type") + self.out_dir = os.path.join(self.temp_dir, "out") os.mkdir(self.out_dir) @@ -131,7 +131,7 @@ class Cdist: if initial_manifest: self.initial_manifest = initial_manifest else: - self.initial_manifest = os.path.join(MANIFEST_DIR, "init") + self.initial_manifest = os.path.join(self.manifest_dir, "init") def cleanup(self): # Do not use in __del__: @@ -231,7 +231,7 @@ class Cdist: def list_global_explorers(self): """Return list of available explorers""" - return os.listdir(GLOBAL_EXPLORER_DIR) + return os.listdir(self.global_explorer_dir) def list_type_explorers(self, type): """Return list of available explorers for a specific type""" @@ -245,6 +245,9 @@ class Cdist: return list + def list_types(self): + return os.listdir(self.type_base_dir) + def list_object_paths(self, starting_point): """Return list of paths of existing objects""" object_paths = [] @@ -303,7 +306,7 @@ class Cdist: def type_dir(self, type): """Return directory the type""" - return os.path.join(TYPE_DIR, type) + return os.path.join(self.type_base_dir, type) def type_explorer_dir(self, type): """Return directory that holds the explorers of a type""" @@ -311,12 +314,12 @@ class Cdist: def type_gencode_paths(self, type): """Return paths to gencode scripts of type""" - return [os.path.join(TYPE_DIR, type, "gencode-local"), - os.path.join(TYPE_DIR, type, "gencode-remote")] + return [os.path.join(self.type_base_dir, type, "gencode-local"), + os.path.join(self.type_base_dir, type, "gencode-remote")] def type_manifest_path(self, type): """Return path to manifest of type""" - return os.path.join(TYPE_DIR, type, "manifest") + return os.path.join(self.type_base_dir, type, "manifest") def remote_type_explorer_dir(self, type): """Return remote directory that holds the explorers of a type""" @@ -343,7 +346,7 @@ class Cdist: def transfer_global_explorers(self): """Transfer the global explorers""" - self.transfer_dir(GLOBAL_EXPLORER_DIR, REMOTE_GLOBAL_EXPLORER_DIR) + self.transfer_dir(self.global_explorer_dir, REMOTE_GLOBAL_EXPLORER_DIR) def transfer_type_explorers(self, type): """Transfer explorers of a type, but only once""" @@ -367,8 +370,8 @@ class Cdist: def link_type_to_emulator(self): """Link type names to cdist-type-emulator""" - for type in list_types(): - source = os.path.join(LIB_DIR, "cdist-type-emulator") + for type in self.list_types(): + source = os.path.join(self.lib_dir, "cdist-type-emulator") destination = os.path.join(self.bin_dir, type) log.debug("Linking %s to %s", source, destination) os.symlink(source, destination) @@ -377,7 +380,7 @@ class Cdist: """Run global explorers""" explorers = self.list_global_explorers() if(len(explorers) == 0): - self.exit_error("No explorers found in", GLOBAL_EXPLORER_DIR) + self.exit_error("No explorers found in", self.global_explorer_dir) self.transfer_global_explorers() for explorer in explorers: @@ -433,7 +436,7 @@ class Cdist: def run_initial_manifest(self): """Run the initial manifest""" - env = { "__manifest" : MANIFEST_DIR } + env = { "__manifest" : self.manifest_dir } self.run_manifest(self.initial_manifest, extra_env=env) def run_type_manifest(self, cdist_object): @@ -461,8 +464,8 @@ class Cdist: env['__global'] = self.out_dir # Legacy stuff to make cdist-type-emulator work - env['__cdist_conf_dir'] = CONF_DIR - env['__cdist_core_dir'] = os.path.join(BASE_DIR, "core") + env['__cdist_conf_dir'] = self.conf_dir + env['__cdist_core_dir'] = os.path.join(self.base_dir, "core") env['__cdist_local_base_dir'] = self.temp_dir env['__cdist_manifest'] = self.initial_manifest From 5260f230e503dbf72122802d700b484c44afce48 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 00:06:59 +0200 Subject: [PATCH 0127/1024] support -V, --version Signed-off-by: Nico Schottelius --- bin/cdist | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/cdist b/bin/cdist index 3361d5da..7a702c41 100755 --- a/bin/cdist +++ b/bin/cdist @@ -100,6 +100,7 @@ class Cdist: self.base_dir = home else: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + self.conf_dir = os.path.join(self.base_dir, "conf") self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") self.lib_dir = os.path.join(self.base_dir, "lib") @@ -611,10 +612,16 @@ if __name__ == "__main__": # help='Operate on multiple hosts sequentially', # action='store_false', dest='parallel') + parser.add_argument('-V', '--version', help='Show version', + action='version', version='%(prog)s ' + VERSION) + args = parser.parse_args(sys.argv[1:]) if args.debug: logging.root.setLevel(logging.DEBUG) + print(args) + sys.exit(1) + if args.banner: banner() sys.exit(0) From 8f34f8659bfc971620de62ba32e846c28823ce9b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 00:08:30 +0200 Subject: [PATCH 0128/1024] support -V, --version Signed-off-by: Nico Schottelius --- bin/cdist | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/cdist b/bin/cdist index 7a702c41..5656ce62 100755 --- a/bin/cdist +++ b/bin/cdist @@ -614,6 +614,7 @@ if __name__ == "__main__": parser.add_argument('-V', '--version', help='Show version', action='version', version='%(prog)s ' + VERSION) + arser.add_argument('--foo', nargs=2) args = parser.parse_args(sys.argv[1:]) if args.debug: From c5355ca10478810e246dfc8615dc777a370d99cd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 00:16:18 +0200 Subject: [PATCH 0129/1024] fixup -c option Signed-off-by: Nico Schottelius --- bin/cdist | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bin/cdist b/bin/cdist index 5656ce62..dca36b5f 100755 --- a/bin/cdist +++ b/bin/cdist @@ -599,7 +599,7 @@ if __name__ == "__main__": action='store_true', dest='banner') parser.add_argument('-c', '--cdist-home', help='Change cdist home (default: .. from bin directory)', - action='store_true', dest='cdist_home') + action='store') parser.add_argument('-d', '--debug', help='Set log level to debug', action='store_true') parser.add_argument('-i', '--initial-manifest', @@ -614,22 +614,17 @@ if __name__ == "__main__": parser.add_argument('-V', '--version', help='Show version', action='version', version='%(prog)s ' + VERSION) - arser.add_argument('--foo', nargs=2) args = parser.parse_args(sys.argv[1:]) + log.debug(args) if args.debug: logging.root.setLevel(logging.DEBUG) - print(args) - sys.exit(1) - if args.banner: banner() sys.exit(0) try: - log.debug(args) - for host in args.host: c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home) c.deploy_to() From 1a790edbf6cbeff0a7517eaeb38312637145d164 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 00:20:06 +0200 Subject: [PATCH 0130/1024] remove context class until we need it Signed-off-by: Nico Schottelius --- bin/cdist | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/bin/cdist b/bin/cdist index dca36b5f..5eb678be 100755 --- a/bin/cdist +++ b/bin/cdist @@ -56,27 +56,6 @@ CODE_HEADER = "#!/bin/sh -e" DOT_CDIST = ".cdist" VERSION = "2.0.0" - -#class Context(object): -# -# def __init__(self, target_host): -# self.target_host = target_host -# -# # class variable -# user_selber_shuld_wenn_aendert = 'bla' -# -# # read only, aber statisch -# @property -# def remote_base_directory(self): -# return "/var/lib/cdist" -# @property.setter -# -# @property -# def special_foo(self): -# return 'foo/{0}'.format(self.target_host) -# - - logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') log = logging.getLogger() From 3cf203a668d8a2642033113d659d74f71dab9255 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 00:30:07 +0200 Subject: [PATCH 0131/1024] begin to remove obsolete documentation Signed-off-by: Nico Schottelius --- doc/man/man1/cdist-cache.text | 31 -------------- doc/man/man1/cdist-code-run.text | 34 ---------------- doc/man/man1/cdist-deploy-to.text | 43 -------------------- doc/man/man1/cdist-dir.text | 38 ----------------- doc/man/man1/cdist-explorer-run-global.text | 31 -------------- doc/man/man1/cdist-manifest-run-init.text | 32 --------------- doc/man/man1/cdist-manifest-run.text | 31 -------------- doc/man/man1/cdist-mass-deploy.text | 41 ------------------- doc/man/man1/cdist-object-all.text | 31 -------------- doc/man/man1/cdist-object-code-run.text | 32 --------------- doc/man/man1/cdist-object-explorer-run.text | 31 -------------- doc/man/man1/cdist-object-gencode-run.text | 32 --------------- doc/man/man1/cdist-object-gencode.text | 33 --------------- doc/man/man1/cdist-object-manifest-run.text | 31 -------------- doc/man/man1/cdist-object-prepare.text | 35 ---------------- doc/man/man1/cdist-object-push.text | 31 -------------- doc/man/man1/cdist-object-run.text | 36 ---------------- doc/man/man1/cdist-remote-explorer-run.text | 33 --------------- doc/man/man1/cdist-run-remote.text | 33 --------------- doc/man/man1/cdist-type-build-emulation.text | 33 --------------- 20 files changed, 672 deletions(-) delete mode 100644 doc/man/man1/cdist-cache.text delete mode 100644 doc/man/man1/cdist-code-run.text delete mode 100644 doc/man/man1/cdist-deploy-to.text delete mode 100644 doc/man/man1/cdist-dir.text delete mode 100644 doc/man/man1/cdist-explorer-run-global.text delete mode 100644 doc/man/man1/cdist-manifest-run-init.text delete mode 100644 doc/man/man1/cdist-manifest-run.text delete mode 100644 doc/man/man1/cdist-mass-deploy.text delete mode 100644 doc/man/man1/cdist-object-all.text delete mode 100644 doc/man/man1/cdist-object-code-run.text delete mode 100644 doc/man/man1/cdist-object-explorer-run.text delete mode 100644 doc/man/man1/cdist-object-gencode-run.text delete mode 100644 doc/man/man1/cdist-object-gencode.text delete mode 100644 doc/man/man1/cdist-object-manifest-run.text delete mode 100644 doc/man/man1/cdist-object-prepare.text delete mode 100644 doc/man/man1/cdist-object-push.text delete mode 100644 doc/man/man1/cdist-object-run.text delete mode 100644 doc/man/man1/cdist-remote-explorer-run.text delete mode 100644 doc/man/man1/cdist-run-remote.text delete mode 100644 doc/man/man1/cdist-type-build-emulation.text diff --git a/doc/man/man1/cdist-cache.text b/doc/man/man1/cdist-cache.text deleted file mode 100644 index 54619199..00000000 --- a/doc/man/man1/cdist-cache.text +++ /dev/null @@ -1,31 +0,0 @@ -cdist-cache(1) -============== -Nico Schottelius - - -NAME ----- -cdist-cache - Cache output of last run - - -SYNOPSIS --------- -cdist-cache TARGET_HOST - - -DESCRIPTION ------------ -cdist-cache moves away the objects created during last run so the -next run can use the previous information and compare them with -the current status. - - -SEE ALSO --------- -cdist(7) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-code-run.text b/doc/man/man1/cdist-code-run.text deleted file mode 100644 index e5d8c976..00000000 --- a/doc/man/man1/cdist-code-run.text +++ /dev/null @@ -1,34 +0,0 @@ -cdist-code-run(1) -================= -Nico Schottelius - - -NAME ----- -cdist-code-run - Run explorer remotely - - -SYNOPSIS --------- -cdist-code-run OBJECT_DIR OBJECT TYPE - - -DESCRIPTION ------------ -cdist-code-run executes generated code from a given OBJECT. -The OBJECT must be located below OBJECT_DIR. -TYPE must be either local or remote and determines which -code part is to be executed. - - -SEE ALSO --------- -- cdist(7) -- cdist-object-gencode(1) -- cdist-object-gencode-all(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-deploy-to.text b/doc/man/man1/cdist-deploy-to.text deleted file mode 100644 index f42a0509..00000000 --- a/doc/man/man1/cdist-deploy-to.text +++ /dev/null @@ -1,43 +0,0 @@ -cdist-deploy-to(1) -================== -Nico Schottelius - - -NAME ----- -cdist-deploy-to - Deploy configuration to host - - -SYNOPSIS --------- -cdist-deploy-to HOSTNAME - - -DESCRIPTION ------------ -Deploy configurations to the specified host, as configured in the initial -manifest. This script triggers the execution of several other scripts, in so -called stages. It is intented to run either from the command line or from cron. - - -ENVIRONMENT ------------ -If the environment variable **__cdist_conf_dir** is not set, the -configuration is read from /conf. The local output directory can -be changed by the variable **__cdist_local_base_dir**. All environment -variables are handled by cdist-config. - - -SEE ALSO --------- -- cdist(7) -- cdist-config(1) -- cdist-mass-deploy(1) -- cdist-reference(7) -- cdist-stages(7) - - -COPYING -------- -Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-dir.text b/doc/man/man1/cdist-dir.text deleted file mode 100644 index 223bc779..00000000 --- a/doc/man/man1/cdist-dir.text +++ /dev/null @@ -1,38 +0,0 @@ -cdist-dir(1) -============ -Nico Schottelius - - -NAME ----- -cdist-dir - Poor man's directory synchronisation - - -SYNOPSIS --------- -cdist-dir TARGET_HOST SRC_DIR DST_DIR - - -DESCRIPTION ------------ -cdist-dir either pushes a local directory to the target host -or pulls a remote directory from a target host to the local host. - -In the push case SRC_DIR is local, in the pull case remote. -In the push case DST_DIR is remote, in the pull case local. - -cdist-dir does not cleanup DST_DIR and thus it may contain old -stuff if used multiple times. - -cdist-dir does not rely on rsync or other high level tools, because -it cannot expect its existence on the local or target host. - -SEE ALSO --------- -cdist(7) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-explorer-run-global.text b/doc/man/man1/cdist-explorer-run-global.text deleted file mode 100644 index f4b32dfb..00000000 --- a/doc/man/man1/cdist-explorer-run-global.text +++ /dev/null @@ -1,31 +0,0 @@ -cdist-explorer-run-global(1) -============================ -Nico Schottelius - - -NAME ----- -cdist-explorer-run-global - Run the global explorers - - -SYNOPSIS --------- -cdist-explorer-run-global HOSTNAME - - -DESCRIPTION ------------ -Transfer the global explorers to HOSTNAME, execute them and transfer -back the results. - - -SEE ALSO --------- -- cdist(7) -- cdist-deploy-to(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-manifest-run-init.text b/doc/man/man1/cdist-manifest-run-init.text deleted file mode 100644 index 3a3265dc..00000000 --- a/doc/man/man1/cdist-manifest-run-init.text +++ /dev/null @@ -1,32 +0,0 @@ -cdist-manifest-run-init(1) -========================== -Nico Schottelius - - -NAME ----- -cdist-manifest-run-init - Run the initial manifest - - -SYNOPSIS --------- -cdist-manifest-run-init HOSTNAME - - -DESCRIPTION ------------ -cdist-manifest-run-init executes the initial manifest, which creates -the first objects. - - -SEE ALSO --------- -- cdist(7) -- cdist-deploy-to(1) -- cdist-manifest-run-all(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-manifest-run.text b/doc/man/man1/cdist-manifest-run.text deleted file mode 100644 index 8cd6b513..00000000 --- a/doc/man/man1/cdist-manifest-run.text +++ /dev/null @@ -1,31 +0,0 @@ -cdist-manifest-run(1) -===================== -Nico Schottelius - - -NAME ----- -cdist-manifest-run - Run a given manifest - - -SYNOPSIS --------- -cdist-manifest-run HOSTNAME MANIFEST - - -DESCRIPTION ------------ -cdist-manifest-run executes the given MANIFEST. - - -SEE ALSO --------- -- cdist(7) -- cdist-deploy-to(1) -- cdist-manifest-run-init(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-mass-deploy.text b/doc/man/man1/cdist-mass-deploy.text deleted file mode 100644 index ac495b21..00000000 --- a/doc/man/man1/cdist-mass-deploy.text +++ /dev/null @@ -1,41 +0,0 @@ -cdist-mass-deploy(1) -==================== -Nico Schottelius - - -NAME ----- -cdist-mass-deploy - Deploy configuration to many hosts - - -SYNOPSIS --------- -cdist-mass-deploy [-p] HOSTNAME [HOSTNAME ...] - - -DESCRIPTION ------------ -cdist-mass-deploy is essentially a wrapper around cdist-deploy-to to -be able to deploy to many hosts on one command line. - - -EXAMPLES --------- -Deploy in parallel to all hosts specfied in the dsh group configuration ikr, -which is prefixed by "root@": - --------------------------------------------------------------------------------- -cdist-mass-deploy -p $(cat ~/.dsh/group/ikr | sed 's/^root@//') --------------------------------------------------------------------------------- - - -SEE ALSO --------- -- cdist(7) -- cdist-deploy-to(1) - - -COPYING -------- -Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-object-all.text b/doc/man/man1/cdist-object-all.text deleted file mode 100644 index 06d45268..00000000 --- a/doc/man/man1/cdist-object-all.text +++ /dev/null @@ -1,31 +0,0 @@ -cdist-object-all(1) -=================== -Steven Armstrong - - -NAME ----- -cdist-object-all - Run the given command on all objects - - -SYNOPSIS --------- -cdist-object-all HOSTNAME COMMAND - - -DESCRIPTION ------------ -Iterates over all defined objects and executes the given command on each -of them. - - -SEE ALSO --------- -- cdist(7) -- cdist-type(1) - - -COPYING -------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-object-code-run.text b/doc/man/man1/cdist-object-code-run.text deleted file mode 100644 index f8bae6a4..00000000 --- a/doc/man/man1/cdist-object-code-run.text +++ /dev/null @@ -1,32 +0,0 @@ -cdist-object-code-run(1) -======================== -Nico Schottelius - - -NAME ----- -cdist-object-code-run - Execute the generated code for a object - - -SYNOPSIS --------- -cdist-object-code-run HOSTNAME OBJECT - - -DESCRIPTION ------------ -Execute the local and remote code for the given object. - - -SEE ALSO --------- -- cdist(7) -- cdist-object-run(1) -- cdist-code-run(1) -- cdist-run-remote(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-object-explorer-run.text b/doc/man/man1/cdist-object-explorer-run.text deleted file mode 100644 index a791681e..00000000 --- a/doc/man/man1/cdist-object-explorer-run.text +++ /dev/null @@ -1,31 +0,0 @@ -cdist-object-explorer-run(1) -============================ -Nico Schottelius - - -NAME ----- -cdist-object-explorer-run - Run type explorers for a object - - -SYNOPSIS --------- -cdist-object-explorer-run HOSTNAME OBJECT - - -DESCRIPTION ------------ -Runs the explorers for the given object on the target host. - - -SEE ALSO --------- -- cdist(7) -- cdist-deploy-to(1) -- cdist-remote-explorer-run(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-object-gencode-run.text b/doc/man/man1/cdist-object-gencode-run.text deleted file mode 100644 index 7705815c..00000000 --- a/doc/man/man1/cdist-object-gencode-run.text +++ /dev/null @@ -1,32 +0,0 @@ -cdist-object-gencode-run(1) -=========================== -Nico Schottelius - - -NAME ----- -cdist-object-gencode-run - Generate code for a object - - -SYNOPSIS --------- -cdist-object-gencode-run HOSTNAME OBJECT - - -DESCRIPTION ------------ -For the given object, generate the code for local and remote execution. - - -SEE ALSO --------- -- cdist(7) -- cdist-code-run(1) -- cdist-object-run(1) -- cdist-object-gencode(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-object-gencode.text b/doc/man/man1/cdist-object-gencode.text deleted file mode 100644 index 83f4b4c1..00000000 --- a/doc/man/man1/cdist-object-gencode.text +++ /dev/null @@ -1,33 +0,0 @@ -cdist-object-gencode(1) -======================= -Nico Schottelius - - -NAME ----- -cdist-object-gencode - Generate code for a given object - - -SYNOPSIS --------- -cdist-object-gencode HOSTNAME OBJECT - - -DESCRIPTION ------------ -For the given object, run the gencode executable. The output of this -executable on stdout will be used by cdist-object-gencode-all(1). - - -SEE ALSO --------- -- cdist(7) -- cdist-code-run(1) -- cdist-deploy-to(1) -- cdist-object-gencode-all(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-object-manifest-run.text b/doc/man/man1/cdist-object-manifest-run.text deleted file mode 100644 index a6f12f78..00000000 --- a/doc/man/man1/cdist-object-manifest-run.text +++ /dev/null @@ -1,31 +0,0 @@ -cdist-object-manifest-run(1) -============================ -Nico Schottelius - - -NAME ----- -cdist-object-manifest-run - Run an objects manifest - - -SYNOPSIS --------- -cdist-object-manifest-run HOSTNAME OBJECT - - -DESCRIPTION ------------ -Run the manifest for the given object. - - -SEE ALSO --------- -- cdist(7) -- cdist-deploy-to(1) -- cdist-manifest-run(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-object-prepare.text b/doc/man/man1/cdist-object-prepare.text deleted file mode 100644 index c91a7b2e..00000000 --- a/doc/man/man1/cdist-object-prepare.text +++ /dev/null @@ -1,35 +0,0 @@ -cdist-object-prepare(1) -======================= -Steven Armstrong - - -NAME ----- -cdist-object-prepare - Prepare an object - - -SYNOPSIS --------- -cdist-object-prepare HOSTNAME OBJECT - - -DESCRIPTION ------------ -Prepare the given object by running it through stage 3 (object information -retrieval) and stage 4 (run the object manifest). -See related man pages for details. - - -SEE ALSO --------- -- cdist(7) -- cdist-stages(7) -- cdist-object-explorer-run(1) -- cdist-object-manifest-run(1) -- cdist-type(1) - - -COPYING -------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is granted -under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-object-push.text b/doc/man/man1/cdist-object-push.text deleted file mode 100644 index 4c960eaa..00000000 --- a/doc/man/man1/cdist-object-push.text +++ /dev/null @@ -1,31 +0,0 @@ -cdist-object-push(1) -==================== -Nico Schottelius - - -NAME ----- -cdist-object-push - Transfer a object to the target host - - -SYNOPSIS --------- -cdist-object-push HOSTNAME OBJECT - - -DESCRIPTION ------------ -Transfers the given object to the target host. - - -SEE ALSO --------- -- cdist(7) -- cdist-object-run(1) -- cdist-type(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-object-run.text b/doc/man/man1/cdist-object-run.text deleted file mode 100644 index fc85a05f..00000000 --- a/doc/man/man1/cdist-object-run.text +++ /dev/null @@ -1,36 +0,0 @@ -cdist-object-run(1) -=================== -Steven Armstrong - - -NAME ----- -cdist-object-run - Run an object - - -SYNOPSIS --------- -cdist-object-run HOSTNAME OBJECT - - -DESCRIPTION ------------ -Applies the given object on the target host by running it through stage 5 -(code generation) and stage 6 (code execution). -See related man pages for details. - - -SEE ALSO --------- -- cdist(7) -- cdist-stages(7) -- cdist-object-gencode-run(1) -- cdist-object-push(1) -- cdist-object-code-run(1) -- cdist-type(1) - - -COPYING -------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-remote-explorer-run.text b/doc/man/man1/cdist-remote-explorer-run.text deleted file mode 100644 index 64951e2c..00000000 --- a/doc/man/man1/cdist-remote-explorer-run.text +++ /dev/null @@ -1,33 +0,0 @@ -cdist-remote-explorer-run(1) -============================ -Nico Schottelius - - -NAME ----- -cdist-remote-explorer-run - Run explorer remotely - - -SYNOPSIS --------- -cdist-remote-explorer-run VARIABLE_NAME EXPLORER_DIR OUT_DIR - - -DESCRIPTION ------------ -cdist-remote-explorer-run is executed on the target. -It sets up the variable VARIABLE_NAME to point to the given -EXPLORER_DIR and runs all explorer found in EXPLORER_DIR. -The output of every run explorer is saved into OUT_DIR. - - -SEE ALSO --------- -- cdist(7) -- cdist-explorer-run-global(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-run-remote.text b/doc/man/man1/cdist-run-remote.text deleted file mode 100644 index ee7a6337..00000000 --- a/doc/man/man1/cdist-run-remote.text +++ /dev/null @@ -1,33 +0,0 @@ -cdist-run-remote(1) -=================== -Nico Schottelius - - -NAME ----- -cdist-run-remote - Execute something on the target - - -SYNOPSIS --------- -cdist-run-remote HOSTNAME EXECUTABLE [ARGUMENTS FOR EXECUTABLE] - - -DESCRIPTION ------------ -cdist-run-remote runs the given executable on the remote host. -It ensures PATH is setup correctly on the target side. - - -SEE ALSO --------- -- cdist(7) -- cdist-object-code-run(1) -- cdist-deploy-to(1) -- cdist-remote-code-run-all(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-type-build-emulation.text b/doc/man/man1/cdist-type-build-emulation.text deleted file mode 100644 index 81c56e7c..00000000 --- a/doc/man/man1/cdist-type-build-emulation.text +++ /dev/null @@ -1,33 +0,0 @@ -cdist-type-build-emulation(1) -============================= -Nico Schottelius - - -NAME ----- -cdist-type-build-emulation - Build executables for types - - -SYNOPSIS --------- -cdist-type-build-emulation OUT_DIR - - -DESCRIPTION ------------ -cdist-type-build-emulation creates a link to cdist-type-emulator -for every TYPE. These links are placed in a OUT_DIR, which -is prepended into $PATH. This way the user can use TYPE in the -manifests like any other executable. - - -SEE ALSO --------- -- cdist(7) -- cdist-type-emulator(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). From 4aff17610619bf7f8c8d53319f30bc4daab31d22 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 00:30:45 +0200 Subject: [PATCH 0132/1024] flush and also append \n to header Signed-off-by: Nico Schottelius --- bin/cdist | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 5eb678be..0e85a79c 100755 --- a/bin/cdist +++ b/bin/cdist @@ -52,7 +52,7 @@ REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") -CODE_HEADER = "#!/bin/sh -e" +CODE_HEADER = "#!/bin/sh -e\n" DOT_CDIST = ".cdist" VERSION = "2.0.0" @@ -501,7 +501,10 @@ class Cdist: os.path.basename(bin)[3:]) outfile_fd = open(outfile, "w") + + # Need to flush to ensure our write is done before stdout write outfile_fd.write(CODE_HEADER) + outfile_fd.flush() self.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) outfile_fd.close() From e07328f569fbea0130442a71a22b976317306bf2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 01:14:35 +0200 Subject: [PATCH 0133/1024] initial support for parallel running Signed-off-by: Nico Schottelius --- bin/cdist | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/bin/cdist b/bin/cdist index 0e85a79c..c50775f8 100755 --- a/bin/cdist +++ b/bin/cdist @@ -23,6 +23,7 @@ import argparse import datetime import logging +import multiprocessing import os import subprocess import shutil @@ -573,6 +574,15 @@ class Cdist: self.target_host, duration.total_seconds()) + def deploy_and_cleanup(self): + """Do what is most often done: deploy & cleanup""" + self.deploy_to() + self.cleanup() + + +def foo(): + print("test") + if __name__ == "__main__": parser = argparse.ArgumentParser(description='cdist ' + VERSION) parser.add_argument('host', nargs='*', help='one or more hosts to operate on') @@ -587,13 +597,12 @@ if __name__ == "__main__": parser.add_argument('-i', '--initial-manifest', help='Path to a cdist manifest or - to read from stdin', dest='manifest', required=False) -# parser.add_argument('-p', '--parallel', -# help='Operate on multiple hosts in parallel', -# action='store_true', dest='parallel') -# parser.add_argument('-s', '--sequential', -# help='Operate on multiple hosts sequentially', -# action='store_false', dest='parallel') - + parser.add_argument('-p', '--parallel', + help='Operate on multiple hosts in parallel', + action='store_true', dest='parallel') + parser.add_argument('-s', '--sequential', + help='Operate on multiple hosts sequentially', + action='store_false', dest='parallel') parser.add_argument('-V', '--version', help='Show version', action='version', version='%(prog)s ' + VERSION) @@ -606,10 +615,26 @@ if __name__ == "__main__": banner() sys.exit(0) + process = {} + time_start = datetime.datetime.now() try: for host in args.host: c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home) - c.deploy_to() - c.cleanup() + if args.parallel: + log.info("Starting child process for %s", host) + process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) + process[host].start() + log.debug("After process for %s", host) + else: + c.deploy_and_cleanup() + + if args.parallel: + for p in process.keys(): + log.debug("Joining %s", p) + process[p].join() + + time_end = datetime.datetime.now() + log.info("Total processing time: %s", (time_end - time_start).total_seconds()) + except KeyboardInterrupt: sys.exit(0) From 5ba6e0bb142edf0f0fc54c9eedcf0a4a933f2355 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 01:38:51 +0200 Subject: [PATCH 0134/1024] more hints on parallel running Signed-off-by: Nico Schottelius --- bin/cdist | 3 ++- doc/dev/todo/niconext | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index c50775f8..f8500ca7 100755 --- a/bin/cdist +++ b/bin/cdist @@ -618,10 +618,11 @@ if __name__ == "__main__": process = {} time_start = datetime.datetime.now() try: + log.info("Deploying to %s hosts", len(args.host)) for host in args.host: c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home) if args.parallel: - log.info("Starting child process for %s", host) + log.debug("Starting child process for %s", host) process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) process[host].start() log.debug("After process for %s", host) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 3968b0ef..2321bf03 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,4 +1,6 @@ - Remove all FIXME entries +- Support parallel execution + - and maximum number of parallel runs (-p X) - Write cdist-manpage - Remove obsolete manpages - Support different home instead of ../ From 25190e86a37f47bd889948e6bb0d13bfc80f4d69 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 01:39:56 +0200 Subject: [PATCH 0135/1024] todo for 2.0.0 Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 2321bf03..2b1bb703 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,8 +1,13 @@ -- Remove all FIXME entries +For 2.0.0: + + - Write cdist-manpage + - Remove all FIXME entries + - Remove obsolete manpages + +-------------------------------------------------------------------------------- + - Support parallel execution - and maximum number of parallel runs (-p X) -- Write cdist-manpage -- Remove obsolete manpages - Support different home instead of ../ - Bug: os.path.join() may be wrong for the remote side! -> does not matter for now! From 7de51e8d45c43d43ab3f97aec53016562ae47d87 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 10:52:04 +0200 Subject: [PATCH 0136/1024] print help in case no hosts are given Signed-off-by: Nico Schottelius --- bin/cdist | 11 ++++++++--- doc/dev/todo/niconext | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index f8500ca7..628cbca4 100755 --- a/bin/cdist +++ b/bin/cdist @@ -616,9 +616,13 @@ if __name__ == "__main__": sys.exit(0) process = {} - time_start = datetime.datetime.now() try: - log.info("Deploying to %s hosts", len(args.host)) + if len(args.host) == 0: + parser.print_help() + sys.exit(1) + + time_start = datetime.datetime.now() + for host in args.host: c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home) if args.parallel: @@ -635,7 +639,8 @@ if __name__ == "__main__": process[p].join() time_end = datetime.datetime.now() - log.info("Total processing time: %s", (time_end - time_start).total_seconds()) + log.info("Total processing time for %s host(s): %s", len(args.host), + (time_end - time_start).total_seconds()) except KeyboardInterrupt: sys.exit(0) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 2b1bb703..ef861cec 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -8,6 +8,7 @@ For 2.0.0: - Support parallel execution - and maximum number of parallel runs (-p X) + - error handling / report failed hosts - Support different home instead of ../ - Bug: os.path.join() may be wrong for the remote side! -> does not matter for now! From 1742936dc9a6fc8a4273bc3f3b7a8e98a1faec64 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 10:58:10 +0200 Subject: [PATCH 0137/1024] add initial version of manpage for cdist Signed-off-by: Nico Schottelius --- doc/man/man1/cdist.text | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 doc/man/man1/cdist.text diff --git a/doc/man/man1/cdist.text b/doc/man/man1/cdist.text new file mode 100644 index 00000000..368d9097 --- /dev/null +++ b/doc/man/man1/cdist.text @@ -0,0 +1,63 @@ +cdist(1) +======== +Nico Schottelius + + +NAME +---- +cdist - Configuration management + + +SYNOPSIS +-------- +cdist [-h] [-b] [-c CDIST_HOME] [-d] [-i MANIFEST] [-p] [-s] [-V] [host [host ...]] + + +DESCRIPTION +----------- +cdist is the frontend executable to the cdist configuration management. + + +OPTIONS +------- +-h, --help:: + Show the help screen + +-d, --debug:: + Enable debug output + +-p, --parallel:: + Parallelise backup processes + +-V, --version:: + Show version and exit + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Configure ikq05.ethz.ch with debug enabled +cdist -d ikq05.ethz.ch + +__motd +-------------------------------------------------------------------------------- + +In both cases, cdist-type-emulator is called instead of a real type. +In the first case, the object id "/tmp/linetest" is recorded and the +parameter "line" stored with the content "test". + +In the second case, __motd must be decleared as a singleton, as the +object id is missing. + + +SEE ALSO +-------- +- cdist(7) +- cdist-type-build-emulation(1) + + +COPYING +------- +Copyright \(C) 2011 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). From b470a47b15a4b5f77e7a73514f972aedb05f8e8c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 11:18:18 +0200 Subject: [PATCH 0138/1024] add working cdist manpage Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- doc/man/man1/cdist.text | 30 +++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/bin/cdist b/bin/cdist index 628cbca4..7fb73e65 100755 --- a/bin/cdist +++ b/bin/cdist @@ -601,7 +601,7 @@ if __name__ == "__main__": help='Operate on multiple hosts in parallel', action='store_true', dest='parallel') parser.add_argument('-s', '--sequential', - help='Operate on multiple hosts sequentially', + help='Operate on multiple hosts sequentially (default)', action='store_false', dest='parallel') parser.add_argument('-V', '--version', help='Show version', action='version', version='%(prog)s ' + VERSION) diff --git a/doc/man/man1/cdist.text b/doc/man/man1/cdist.text index 368d9097..f45d4495 100644 --- a/doc/man/man1/cdist.text +++ b/doc/man/man1/cdist.text @@ -23,11 +23,24 @@ OPTIONS -h, --help:: Show the help screen +-b, --banner:: + Show cdist banner + +-c CDIST_HOME, --cdist-home CDIST_HOME:: + Instead of using the parent of the bin directory as cdist home, + use the specified directory + -d, --debug:: Enable debug output +-i MANIFEST, --initial-manifest MANIFEST:: + Path to a cdist manifest or - to read from stdin + -p, --parallel:: - Parallelise backup processes + Operate on multiple hosts in parallel + +-s, --sequential:: + Operate on multiple hosts sequentially -V, --version:: Show version and exit @@ -40,16 +53,15 @@ EXAMPLES # Configure ikq05.ethz.ch with debug enabled cdist -d ikq05.ethz.ch -__motd +# Configure hosts in parallel and use a different home directory +cdist -c ~/p/cdist-nutzung -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch + +# Does not need a comment, plain works +cdist --banner +cdist --help +cdist --version -------------------------------------------------------------------------------- -In both cases, cdist-type-emulator is called instead of a real type. -In the first case, the object id "/tmp/linetest" is recorded and the -parameter "line" stored with the content "test". - -In the second case, __motd must be decleared as a singleton, as the -object id is missing. - SEE ALSO -------- From 4e95535b7c9912729b50a97156e27399f046843b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 11:27:20 +0200 Subject: [PATCH 0139/1024] definitely cleanup remote directory first, so we see more bugs :-) Signed-off-by: Nico Schottelius --- bin/cdist | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 7fb73e65..98e92c9a 100755 --- a/bin/cdist +++ b/bin/cdist @@ -327,6 +327,7 @@ class Cdist: def transfer_global_explorers(self): """Transfer the global explorers""" + self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) self.transfer_dir(self.global_explorer_dir, REMOTE_GLOBAL_EXPLORER_DIR) def transfer_type_explorers(self, type): @@ -406,12 +407,9 @@ class Cdist: def init_deploy(self): log.debug("Creating clean directory structure") - # Ensure there is no old stuff, neither local nor remote - # remote_run_or_fail(hostname, ["rm -rf", "${__cdist_remote_base_dir}"]) - # - # # Create base directories - # remote_run_or_fail(hostname,["mkdir -p", "${__cdist_remote_base_dir}"]) - # + self.remove_remote_dir(REMOTE_BASE_DIR) + self.remote_mkdir(REMOTE_BASE_DIR) + # # Link configuraion source directory - consistent with remote # run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) From 8b37daf5ff291d0857f9ebb7e3388c532179ea07 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 11:27:30 +0200 Subject: [PATCH 0140/1024] --todo for 2.0.0 Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index ef861cec..22f9f7b7 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,6 +1,5 @@ For 2.0.0: - - Write cdist-manpage - Remove all FIXME entries - Remove obsolete manpages From a09a618c781327b36aa7303a7acdff4f3c488a58 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 11:37:20 +0200 Subject: [PATCH 0141/1024] prepare cdist-type-emulator transformation Signed-off-by: Nico Schottelius --- bin/cdist | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/bin/cdist b/bin/cdist index 98e92c9a..dc6a5a5f 100755 --- a/bin/cdist +++ b/bin/cdist @@ -65,6 +65,34 @@ def banner(): print(BANNER) +class TypeEmulator: + + def type_emulator(): + type = basename(sys.argv[0]) + + type_is_singleton(type) + + # Check object id + + # Prevent double slash if id begins with / + + # Record parameter: opt_file="${opt#--}" + # [ $# -ge 1 ] || __cdist_usage "Missing value for $opt" + # echo "${value}" > "${__cdist_parameter_dir}/${opt_file}" + + # Record requirements + # echo $requirement >> "$(__cdist_object_require "$__cdist_object_self")" + + # Ensure required parameters are given + # Ensure that only optional or required parameters are given + # [ "$is_valid" ] || __cdist_usage "Unknown parameter $parameter" + + # Merge object (creating twice with the same parameter + requirements == allowed) + + # diff -ru "${__cdist_new_object_dir}/${__cdist_name_parameter} + # # Add "I was here message" + # _cdist_object_source_add "${__cdist_object_dir}" + class Cdist: """Cdist main class to hold arbitrary data""" From 99b3b0789bbc7385a2882dbcba52514d6baa4782 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 00:02:04 +0200 Subject: [PATCH 0142/1024] remove tmpdir, keep it only if debug is enabled Signed-off-by: Nico Schottelius --- bin/cdist | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bin/cdist b/bin/cdist index dc6a5a5f..e20a9f49 100755 --- a/bin/cdist +++ b/bin/cdist @@ -66,8 +66,12 @@ def banner(): class TypeEmulator: + def __init__(self, name): + self.name = name + self.type = os.path.basename(name) - def type_emulator(): + + def type_emulator(self): type = basename(sys.argv[0]) type_is_singleton(type) @@ -96,13 +100,16 @@ class TypeEmulator: class Cdist: """Cdist main class to hold arbitrary data""" - def __init__(self, target_host, initial_manifest=False, remote_user="root", home=None): + def __init__(self, target_host, + initial_manifest=False, remote_user="root", + home=None, debug=False): self.target_host = target_host self.remote_prefix = ["ssh", "root@" + self.target_host] # Setup directory paths self.temp_dir = tempfile.mkdtemp() + self.debug = debug if home: self.base_dir = home @@ -148,8 +155,10 @@ class Cdist: # "other globals referenced by the __del__() method may already have been deleted # or in the process of being torn down (e.g. the import machinery shutting down)" # - print("I should cleanup " + self.temp_dir) - # shutil.rmtree(self.temp_dir) + if self.debug: + log.debug("Skipping removal of " + self.temp_dir) + else: + shutil.rmtree(self.temp_dir) def exit_error(self, *args): log.error(*args) @@ -650,7 +659,7 @@ if __name__ == "__main__": time_start = datetime.datetime.now() for host in args.host: - c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home) + c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) if args.parallel: log.debug("Starting child process for %s", host) process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) From 4e3fec1e9e6acb8874ca7aee5573f91555c3a796 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 16:10:03 +0200 Subject: [PATCH 0143/1024] add hint to pythons octal mode Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index e20a9f49..f50bb1fb 100755 --- a/bin/cdist +++ b/bin/cdist @@ -551,7 +551,7 @@ class Cdist: if status.st_size == len(CODE_HEADER): os.unlink(outfile) else: - # Add header and make executable + # Add header and make executable - identically to 0o700 os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) if mode == "code": From a43474cd68ba1256db5389d7f8c7301c9527f29d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 16:10:46 +0200 Subject: [PATCH 0144/1024] add logfiles Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-09-12 | 67 +++++++++++++++++++++++++++++++++++++++++ doc/dev/logs/2011-09-13 | 3 ++ 2 files changed, 70 insertions(+) create mode 100644 doc/dev/logs/2011-09-12 create mode 100644 doc/dev/logs/2011-09-13 diff --git a/doc/dev/logs/2011-09-12 b/doc/dev/logs/2011-09-12 new file mode 100644 index 00000000..391b836f --- /dev/null +++ b/doc/dev/logs/2011-09-12 @@ -0,0 +1,67 @@ +Benchmark from home/X201 (2 cores, 4 threads): + + ikq (1): 72.192397 + ikq (2): INFO: Total processing time for 2 hosts: 74.1845 + ikq* (6): INFO: Total processing time: 117.572312 + ikq* + ikr3 (9): INFO: Total processing time: 120.307662 + ikq* + ikr (14): INFO: Total processing time: 139.769807 + ikq* + ikr (18): INFO: Total processing time: 186.354398 + ikq* + ikr (22): INFO: Total processing time: 225.793533 + ikq* + ikr (26): INFO: Total processing time: 237.06687 + ikq* + ikr (31): INFO: Total processing time: 276.912414 + + +ikr07.ethz.ch ikr09.ethz.ch ikr10.ethz.ch ikr11.ethz.ch +ikr13.ethz.ch ikr14.ethz.ch ikr15.ethz.ch ikr16.ethz.ch +ikr17.ethz.ch ikr19.ethz.ch ikr20.ethz.ch ikr21.ethz.ch +ikr23.ethz.ch ikr24.ethz.ch ikr25.ethz.ch ikr26.ethz.ch +ikr27.ethz.ch ikr28.ethz.ch ikr29.ethz.ch ikr30.ethz.ch +ikr31.ethz.ch + +cdist -c ~/p/cdist-nutzung -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch ikq05.ethz.ch ikq06.ethz.ch ikq07.ethz.ch ikr01.ethz.ch ikr02.ethz.ch ikr03.ethz.ch ikr05.ethz.ch ikr07.ethz.ch ikr09.ethz.ch ikr10.ethz.ch ikr11.ethz.ch ikr13.ethz.ch ikr14.ethz.ch ikr15.ethz.ch ikr16.ethz.ch ikr17.ethz.ch ikr19.ethz.ch ikr20.ethz.ch ikr21.ethz.ch + + +-------------------------------------------------------------------------------- +INFO: Total processing time for 1 hosts: 72.166661 +INFO: Total processing time for 2 hosts: 76.633228 +INFO: Total processing time for 3 host(s): 77.199817 +INFO: Total processing time for 4 host(s): 94.045175 +INFO: Total processing time for 5 host(s): 103.226354 +INFO: Total processing time for 6 host(s): 107.76097 +INFO: Total processing time for 7 host(s): 101.571705 +INFO: Total processing time for 8 host(s): 107.600093 +INFO: Total processing time for 9 host(s): 116.500371 +INFO: Total processing time for 10 host(s): 119.445805 +INFO: Total processing time for 11 host(s): 123.944385 +INFO: Total processing time for 12 host(s): 130.499098 +INFO: Total processing time for 13 host(s): 137.250861 +INFO: Total processing time for 14 host(s): 154.9841 +INFO: Total processing time for 15 host(s): 139.659637 +INFO: Total processing time for 16 host(s): 142.70005 +INFO: Total processing time for 17 host(s): 148.541452 +INFO: Total processing time for 18 host(s): 159.360809 +INFO: Total processing time for 19 host(s): 171.907864 +INFO: Total processing time for 20 host(s): 178.76695 +INFO: Total processing time for 21 host(s): 183.856671 +INFO: Total processing time for 22 host(s): 194.504221 +INFO: Total processing time for 23 host(s): 207.314842 +INFO: Total processing time for 24 host(s): 215.846502 +INFO: Total processing time for 25 host(s): 217.223581 +INFO: Total processing time for 26 host(s): 238.591705 +INFO: Total processing time for 27 host(s): 238.478493 +INFO: Total processing time for 28 host(s): 246.058718 +INFO: Total processing time for 29 host(s): 264.208372 +INFO: Total processing time for 30 host(s): 265.560685 +INFO: Total processing time for 31 host(s): 282.264488 + +-------------------------------------------------------------------------------- +Use: + grep "^INFO: Total processing time" doc/dev/logs/2011-09-12 | sed 's/.*: //' + octave + times = [ /* paste here ] + plot(times) + # keep the graph + hold on + # Scale linearly with the single host value + plot((1:31)*times(1)) + diff --git a/doc/dev/logs/2011-09-13 b/doc/dev/logs/2011-09-13 new file mode 100644 index 00000000..b55a2d4e --- /dev/null +++ b/doc/dev/logs/2011-09-13 @@ -0,0 +1,3 @@ +Name for installer: + installer (flag) + $__installer (variable) - gesetzt oder nicht From a5b56f0c4111d28a1614db9d01ea321725694b19 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 16:19:43 +0200 Subject: [PATCH 0145/1024] remove useless function Signed-off-by: Nico Schottelius --- bin/cdist | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/bin/cdist b/bin/cdist index f50bb1fb..fda94888 100755 --- a/bin/cdist +++ b/bin/cdist @@ -352,16 +352,6 @@ class Cdist: self.transfer_dir(self.object_parameter_dir(cdist_object), self.remote_object_parameter_dir(cdist_object)) - def transfer_object_code(self, cdist_object): - FIXME - """Transfer the object code to the remote destination""" - # Create base path before using mkdir -p - self.remote_mkdir(self.remote_object_parameter_dir(cdist_object)) - - # Synchronise parameter dir afterwards - self.transfer_file(self.object_code_path(cdist_object), - self.remote_object_parameter_dir(cdist_object)) - def transfer_global_explorers(self): """Transfer the global explorers""" self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) @@ -555,7 +545,6 @@ class Cdist: os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) if mode == "code": -# paths = self.object_code_paths(cdist_object) local_dir = self.object_dir(cdist_object) remote_dir = self.remote_object_dir(cdist_object) From 59afce35b53419a20aac42d73d7f563fd71e8e85 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 16:25:39 +0200 Subject: [PATCH 0146/1024] do not do more checks on the manifest, current ones are good Signed-off-by: Nico Schottelius --- bin/cdist | 1 - doc/dev/todo/niconext | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index fda94888..873fbb1a 100755 --- a/bin/cdist +++ b/bin/cdist @@ -451,7 +451,6 @@ class Cdist: manifest = self.type_manifest_path(type) log.debug("%s: Running %s", cdist_object, manifest) - # FIXME: add more sensible checks for manifest if os.path.exists(manifest): env = { "__object" : self.object_dir(cdist_object), "__object_id": self.get_object_id_from_object(cdist_object), diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 22f9f7b7..738cd692 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -2,6 +2,8 @@ For 2.0.0: - Remove all FIXME entries - Remove obsolete manpages + - support subcommands! + deploy? config? -------------------------------------------------------------------------------- @@ -15,3 +17,4 @@ For 2.0.0: - Rewrite cdist-type-emulator - Remove legacy code in cdist - Remove cdist-config + From f4faff6b33a05fb2887d521651e705208e928431 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 16:29:33 +0200 Subject: [PATCH 0147/1024] --todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 738cd692..b1b77a27 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,7 +1,5 @@ For 2.0.0: - - Remove all FIXME entries - - Remove obsolete manpages - support subcommands! deploy? config? @@ -17,4 +15,6 @@ For 2.0.0: - Rewrite cdist-type-emulator - Remove legacy code in cdist - Remove cdist-config + - Remove man1/cdist-type-emulator.text +- Replace bin/cdist-type-template From 5cbe34ee336ee51c5666b774654afcd706f61579 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 17:40:28 +0200 Subject: [PATCH 0148/1024] begin to implement subcommand handling Signed-off-by: Nico Schottelius --- bin/cdist | 98 ++++++++++++++++++++++++++----------------- doc/dev/todo/niconext | 3 +- 2 files changed, 61 insertions(+), 40 deletions(-) diff --git a/bin/cdist b/bin/cdist index 873fbb1a..99bc775f 100755 --- a/bin/cdist +++ b/bin/cdist @@ -60,10 +60,6 @@ VERSION = "2.0.0" logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') log = logging.getLogger() -def banner(): - """Guess what :-)""" - print(BANNER) - class TypeEmulator: def __init__(self, name): @@ -602,42 +598,13 @@ class Cdist: self.deploy_to() self.cleanup() +def banner(*args): + """Guess what :-)""" + print(BANNER) + sys.exit(0) -def foo(): - print("test") - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description='cdist ' + VERSION) - parser.add_argument('host', nargs='*', help='one or more hosts to operate on') - parser.add_argument('-b', '--banner', - help='Show cdist banner', - action='store_true', dest='banner') - parser.add_argument('-c', '--cdist-home', - help='Change cdist home (default: .. from bin directory)', - action='store') - parser.add_argument('-d', '--debug', help='Set log level to debug', - action='store_true') - parser.add_argument('-i', '--initial-manifest', - help='Path to a cdist manifest or - to read from stdin', - dest='manifest', required=False) - parser.add_argument('-p', '--parallel', - help='Operate on multiple hosts in parallel', - action='store_true', dest='parallel') - parser.add_argument('-s', '--sequential', - help='Operate on multiple hosts sequentially (default)', - action='store_false', dest='parallel') - parser.add_argument('-V', '--version', help='Show version', - action='version', version='%(prog)s ' + VERSION) - - args = parser.parse_args(sys.argv[1:]) - log.debug(args) - if args.debug: - logging.root.setLevel(logging.DEBUG) - - if args.banner: - banner() - sys.exit(0) - +def config(*args, **kargs): + """Configure remote system""" process = {} try: if len(args.host) == 0: @@ -667,3 +634,56 @@ if __name__ == "__main__": except KeyboardInterrupt: sys.exit(0) + +if __name__ == "__main__": + # Construct parser others can reuse + parser = {} + # Options _all_ parsers have in common + parser['most'] = argparse.ArgumentParser(add_help=False) + parser['most'].add_argument('-d', '--debug', + help='Set log level to debug', + action='store_true') + parser['most'].add_argument('-V', '--version', + help='Show version', + action='version', + version='%(prog)s ' + VERSION) + + # Main subcommand parser + parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION) + parser['sub'] = parser['main'].add_subparsers() + + + parser['banner'] = parser['sub'].add_parser('banner') +# parser['banner'].add_argument('all', nargs='*', +# help='Show cdist banner') + parser['banner'].set_defaults(func=banner) + + parser['config'] = parser['sub'].add_parser('config', + aliases=['deploy'], + parents=[parser['most']]) + parser['config'].add_argument('host', nargs='*', + help='one or more hosts to operate on') + parser['config'].add_argument('-c', '--cdist-home', + help='Change cdist home (default: .. from bin directory)', + action='store') + parser['config'].add_argument('-i', '--initial-manifest', + help='Path to a cdist manifest or - to read from stdin', + dest='manifest', required=False) + parser['config'].add_argument('-p', '--parallel', + help='Operate on multiple hosts in parallel', + action='store_true', dest='parallel') + parser['config'].add_argument('-s', '--sequential', + help='Operate on multiple hosts sequentially (default)', + action='store_false', dest='parallel') + parser['config'].set_defaults(func=config) + + + args = parser['main'].parse_args(sys.argv[1:]) + + # Most subcommands to have --debug, so handle it here + if 'debug' in args: + if args.debug: + logging.root.setLevel(logging.DEBUG) + log.debug(args) + + args.func(args) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index b1b77a27..6b87b8fe 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,7 +1,8 @@ For 2.0.0: - support subcommands! - deploy? config? + config (deploy) + install (provision) -------------------------------------------------------------------------------- From df7f27f94b881f5e5b4dbc03f0393c74434dc148 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 17:42:43 +0200 Subject: [PATCH 0149/1024] catch keyboard interrupt for all subcommands Signed-off-by: Nico Schottelius --- bin/cdist | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/bin/cdist b/bin/cdist index 99bc775f..fad85dca 100755 --- a/bin/cdist +++ b/bin/cdist @@ -603,10 +603,10 @@ def banner(*args): print(BANNER) sys.exit(0) -def config(*args, **kargs): +def config(*args): """Configure remote system""" + print(*args) process = {} - try: if len(args.host) == 0: parser.print_help() sys.exit(1) @@ -632,8 +632,6 @@ def config(*args, **kargs): log.info("Total processing time for %s host(s): %s", len(args.host), (time_end - time_start).total_seconds()) - except KeyboardInterrupt: - sys.exit(0) if __name__ == "__main__": # Construct parser others can reuse @@ -652,10 +650,7 @@ if __name__ == "__main__": parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION) parser['sub'] = parser['main'].add_subparsers() - parser['banner'] = parser['sub'].add_parser('banner') -# parser['banner'].add_argument('all', nargs='*', -# help='Show cdist banner') parser['banner'].set_defaults(func=banner) parser['config'] = parser['sub'].add_parser('config', @@ -677,7 +672,6 @@ if __name__ == "__main__": action='store_false', dest='parallel') parser['config'].set_defaults(func=config) - args = parser['main'].parse_args(sys.argv[1:]) # Most subcommands to have --debug, so handle it here @@ -686,4 +680,7 @@ if __name__ == "__main__": logging.root.setLevel(logging.DEBUG) log.debug(args) - args.func(args) + try: + args.func(args) + except KeyboardInterrupt: + sys.exit(0) From 8d1b4236d4b822a8cf2774020cedf5434769a9b9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 17:59:11 +0200 Subject: [PATCH 0150/1024] fixup most arguments for config Signed-off-by: Nico Schottelius --- bin/cdist | 55 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/bin/cdist b/bin/cdist index fad85dca..339ecfa8 100755 --- a/bin/cdist +++ b/bin/cdist @@ -598,46 +598,48 @@ class Cdist: self.deploy_to() self.cleanup() -def banner(*args): +def banner(args): """Guess what :-)""" print(BANNER) sys.exit(0) -def config(*args): +def config(args): """Configure remote system""" - print(*args) + print(args) process = {} - if len(args.host) == 0: - parser.print_help() - sys.exit(1) - time_start = datetime.datetime.now() + if len(args.host) == 0: + parser.print_help() + sys.exit(1) - for host in args.host: - c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) - if args.parallel: - log.debug("Starting child process for %s", host) - process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) - process[host].start() - log.debug("After process for %s", host) - else: - c.deploy_and_cleanup() + time_start = datetime.datetime.now() + for host in args.host: + c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) if args.parallel: - for p in process.keys(): - log.debug("Joining %s", p) - process[p].join() + log.debug("Starting child process for %s", host) + process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) + process[host].start() + log.debug("After process for %s", host) + else: + c.deploy_and_cleanup() - time_end = datetime.datetime.now() - log.info("Total processing time for %s host(s): %s", len(args.host), - (time_end - time_start).total_seconds()) + if args.parallel: + for p in process.keys(): + log.debug("Joining %s", p) + process[p].join() + + time_end = datetime.datetime.now() + log.info("Total processing time for %s host(s): %s", len(args.host), + (time_end - time_start).total_seconds()) if __name__ == "__main__": # Construct parser others can reuse parser = {} # Options _all_ parsers have in common - parser['most'] = argparse.ArgumentParser(add_help=False) + parser['most'] = argparse.ArgumentParser(add_help=False, + epilog="Get cdist at http://www.nico.schottelius.org/software/cdist/") parser['most'].add_argument('-d', '--debug', help='Set log level to debug', action='store_true') @@ -645,9 +647,12 @@ if __name__ == "__main__": help='Show version', action='version', version='%(prog)s ' + VERSION) + #version='%(prog)s ' + VERSION) + # Main subcommand parser - parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION) + parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION, + parents=[parser['most']]) parser['sub'] = parser['main'].add_subparsers() parser['banner'] = parser['sub'].add_parser('banner') @@ -656,7 +661,7 @@ if __name__ == "__main__": parser['config'] = parser['sub'].add_parser('config', aliases=['deploy'], parents=[parser['most']]) - parser['config'].add_argument('host', nargs='*', + parser['config'].add_argument('host', nargs='+', help='one or more hosts to operate on') parser['config'].add_argument('-c', '--cdist-home', help='Change cdist home (default: .. from bin directory)', From 4d065443da3e9f676ff8b0973b2073243d664d76 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 18:00:41 +0200 Subject: [PATCH 0151/1024] remove alias deploy for config, does not make things better Signed-off-by: Nico Schottelius --- bin/cdist | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 339ecfa8..7e3e9a1c 100755 --- a/bin/cdist +++ b/bin/cdist @@ -659,7 +659,6 @@ if __name__ == "__main__": parser['banner'].set_defaults(func=banner) parser['config'] = parser['sub'].add_parser('config', - aliases=['deploy'], parents=[parser['most']]) parser['config'].add_argument('host', nargs='+', help='one or more hosts to operate on') From 581562aae96890c027fe367478ea429ff0b122d9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 18:05:15 +0200 Subject: [PATCH 0152/1024] cleanups Signed-off-by: Nico Schottelius --- bin/cdist | 22 +++++++--------------- doc/dev/todo/niconext | 10 ++-------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/bin/cdist b/bin/cdist index 7e3e9a1c..42838093 100755 --- a/bin/cdist +++ b/bin/cdist @@ -428,14 +428,12 @@ class Cdist: output_fd.close() def init_deploy(self): + """Ensure the base directories are cleaned up""" log.debug("Creating clean directory structure") self.remove_remote_dir(REMOTE_BASE_DIR) self.remote_mkdir(REMOTE_BASE_DIR) - # # Link configuraion source directory - consistent with remote - # run_or_fail(["ln -sf", "$__cdist_conf_dir", "$__cdist_local_base_dir/$__cdist_name_conf_dir"]) - def run_initial_manifest(self): """Run the initial manifest""" env = { "__manifest" : self.manifest_dir } @@ -605,7 +603,6 @@ def banner(args): def config(args): """Configure remote system""" - print(args) process = {} if len(args.host) == 0: @@ -633,7 +630,6 @@ def config(args): log.info("Total processing time for %s host(s): %s", len(args.host), (time_end - time_start).total_seconds()) - if __name__ == "__main__": # Construct parser others can reuse parser = {} @@ -641,14 +637,10 @@ if __name__ == "__main__": parser['most'] = argparse.ArgumentParser(add_help=False, epilog="Get cdist at http://www.nico.schottelius.org/software/cdist/") parser['most'].add_argument('-d', '--debug', - help='Set log level to debug', - action='store_true') + help='Set log level to debug', action='store_true') parser['most'].add_argument('-V', '--version', - help='Show version', - action='version', - version='%(prog)s ' + VERSION) - #version='%(prog)s ' + VERSION) - + help='Show version', action='version', + version='%(prog)s ' + VERSION) # Main subcommand parser parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION, @@ -659,14 +651,14 @@ if __name__ == "__main__": parser['banner'].set_defaults(func=banner) parser['config'] = parser['sub'].add_parser('config', - parents=[parser['most']]) + parents=[parser['most']]) parser['config'].add_argument('host', nargs='+', help='one or more hosts to operate on') parser['config'].add_argument('-c', '--cdist-home', help='Change cdist home (default: .. from bin directory)', action='store') parser['config'].add_argument('-i', '--initial-manifest', - help='Path to a cdist manifest or - to read from stdin', + help='Path to a cdist manifest', dest='manifest', required=False) parser['config'].add_argument('-p', '--parallel', help='Operate on multiple hosts in parallel', @@ -678,7 +670,7 @@ if __name__ == "__main__": args = parser['main'].parse_args(sys.argv[1:]) - # Most subcommands to have --debug, so handle it here + # Most subcommands have --debug, so handle it here if 'debug' in args: if args.debug: logging.root.setLevel(logging.DEBUG) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 6b87b8fe..63f9b629 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,11 +1,3 @@ -For 2.0.0: - - - support subcommands! - config (deploy) - install (provision) - --------------------------------------------------------------------------------- - - Support parallel execution - and maximum number of parallel runs (-p X) - error handling / report failed hosts @@ -19,3 +11,5 @@ For 2.0.0: - Remove man1/cdist-type-emulator.text - Replace bin/cdist-type-template + +- Allow manifest to be read from stdin From 780fd5625e2efdfa86bbafe766186143bcb9ce76 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 18:15:04 +0200 Subject: [PATCH 0153/1024] re-implement correct caching Signed-off-by: Nico Schottelius --- bin/cdist | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index 42838093..530618f1 100755 --- a/bin/cdist +++ b/bin/cdist @@ -113,6 +113,8 @@ class Cdist: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) self.conf_dir = os.path.join(self.base_dir, "conf") + self.cache_base_dir = os.path.join(self.base_dir, "cache") + self.cache_dir = os.path.join(self.cache_base_dir, self.target_host) self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") self.lib_dir = os.path.join(self.base_dir, "lib") self.manifest_dir = os.path.join(self.conf_dir, "manifest") @@ -151,10 +153,11 @@ class Cdist: # "other globals referenced by the __del__() method may already have been deleted # or in the process of being torn down (e.g. the import machinery shutting down)" # - if self.debug: - log.debug("Skipping removal of " + self.temp_dir) - else: - shutil.rmtree(self.temp_dir) + log.debug("Saving" + self.temp_dir + "to " + self.cache_dir) + # Remove previous cache + if os.path.exists(self.cache_dir): + shutil.rmtree(self.cache_dir) + os.rename(self.temp_dir, self.cache_dir) def exit_error(self, *args): log.error(*args) From 7e9d2342197d3b8f6564a27aed61cc7aa505df1a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 18:18:12 +0200 Subject: [PATCH 0154/1024] remove obsolete length check Signed-off-by: Nico Schottelius --- bin/cdist | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index 530618f1..a468e2fc 100755 --- a/bin/cdist +++ b/bin/cdist @@ -608,10 +608,6 @@ def config(args): """Configure remote system""" process = {} - if len(args.host) == 0: - parser.print_help() - sys.exit(1) - time_start = datetime.datetime.now() for host in args.host: From e1421280d4700f505f320e126abc4de8bafab347 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 18:18:56 +0200 Subject: [PATCH 0155/1024] remove debug Signed-off-by: Nico Schottelius --- bin/cdist | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index a468e2fc..ad5584af 100755 --- a/bin/cdist +++ b/bin/cdist @@ -613,10 +613,9 @@ def config(args): for host in args.host: c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) if args.parallel: - log.debug("Starting child process for %s", host) + log.debug("Creating child process for %s", host) process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) process[host].start() - log.debug("After process for %s", host) else: c.deploy_and_cleanup() From 9f6a3933c7eb535f751f85ad64d013615976e441 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 18:24:24 +0200 Subject: [PATCH 0156/1024] remove obsolete HACKERS_README, we are stable now Signed-off-by: Nico Schottelius --- HACKERS_README | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100755 HACKERS_README diff --git a/HACKERS_README b/HACKERS_README deleted file mode 100755 index ad3fe3fd..00000000 --- a/HACKERS_README +++ /dev/null @@ -1,40 +0,0 @@ -cat << eof - -Hey hackers, - -this README is for you, for those who want to dig into cdist, hack it or try -to get a deeper understanding. Please read doc/man/man7/cdist-hacker.text. - -I hope you have a lot of fun with cdist, because it was also a lot of fun to -develop it! - - -- Nico, 20110324 - -## Running cdist when developing - -This file is suitable for execution and saving the objects and -explorers from cdist. I usually do it like this: - - % ./HACKERS_README - -################################################################################ -eof - -set -x -# Tell the user what we do, so this script makes sense during execution - -# prepare use (only from top level directory) -export PATH="$(pwd -P)/bin:$PATH" -export __cdist_conf_dir="$(pwd -P)/conf" - -# Allow user to supply hostname -target="${1:-localhost}" - -# And use hostname as basedir (dangerous, but hackers know what they do) -export __cdist_local_base_dir="/tmp/$target" - -# Run the real script -cdist-deploy-to "$target" - -# Display results -find "${__cdist_local_base_dir}" From 90bdf0433672456653d2d3425b5c0689bb52135b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 21:30:17 +0200 Subject: [PATCH 0157/1024] add epilog to parsers, make it look beautiful Signed-off-by: Nico Schottelius --- bin/cdist | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bin/cdist b/bin/cdist index ad5584af..5333cb3a 100755 --- a/bin/cdist +++ b/bin/cdist @@ -632,20 +632,20 @@ if __name__ == "__main__": # Construct parser others can reuse parser = {} # Options _all_ parsers have in common - parser['most'] = argparse.ArgumentParser(add_help=False, - epilog="Get cdist at http://www.nico.schottelius.org/software/cdist/") + parser['most'] = argparse.ArgumentParser(add_help=False) parser['most'].add_argument('-d', '--debug', help='Set log level to debug', action='store_true') - parser['most'].add_argument('-V', '--version', - help='Show version', action='version', - version='%(prog)s ' + VERSION) # Main subcommand parser - parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION, - parents=[parser['most']]) + parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION) + + parser['main'].add_argument('-V', '--version', + help='Show version', action='version', + version='%(prog)s ' + VERSION) parser['sub'] = parser['main'].add_subparsers() - parser['banner'] = parser['sub'].add_parser('banner') + parser['banner'] = parser['sub'].add_parser('banner', + add_help=False) parser['banner'].set_defaults(func=banner) parser['config'] = parser['sub'].add_parser('config', @@ -666,6 +666,9 @@ if __name__ == "__main__": action='store_false', dest='parallel') parser['config'].set_defaults(func=config) + 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:]) # Most subcommands have --debug, so handle it here From 9b18b3d79e93b2b0aef84e102c0f39962b7e9801 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 21:35:57 +0200 Subject: [PATCH 0158/1024] update manpage and support commands title Signed-off-by: Nico Schottelius --- bin/cdist | 5 +++-- doc/man/man1/cdist.text | 38 ++++++++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/bin/cdist b/bin/cdist index 5333cb3a..21a35c22 100755 --- a/bin/cdist +++ b/bin/cdist @@ -638,16 +638,17 @@ if __name__ == "__main__": # Main subcommand parser parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION) - parser['main'].add_argument('-V', '--version', help='Show version', action='version', version='%(prog)s ' + VERSION) - parser['sub'] = parser['main'].add_subparsers() + parser['sub'] = parser['main'].add_subparsers(title="Commands") + # Banner parser['banner'] = parser['sub'].add_parser('banner', add_help=False) parser['banner'].set_defaults(func=banner) + # Config parser['config'] = parser['sub'].add_parser('config', parents=[parser['most']]) parser['config'].add_argument('host', nargs='+', diff --git a/doc/man/man1/cdist.text b/doc/man/man1/cdist.text index f45d4495..7f585953 100644 --- a/doc/man/man1/cdist.text +++ b/doc/man/man1/cdist.text @@ -10,22 +10,34 @@ cdist - Configuration management SYNOPSIS -------- -cdist [-h] [-b] [-c CDIST_HOME] [-d] [-i MANIFEST] [-p] [-s] [-V] [host [host ...]] +cdist [-V|--version] +cdist banner +cdist config [-h] [-d] [-V] [-c CDIST_HOME] [-i MANIFEST] [-p] [-s] host [host ...] + DESCRIPTION ----------- cdist is the frontend executable to the cdist configuration management. +cdist supports different as explained below. The options to the main +program are: + +-V, --version:: + Show version and exit -OPTIONS +BANNER ------- +Displays the cdist banner. + + +CONFIG +------ +Configure a system + -h, --help:: Show the help screen --b, --banner:: - Show cdist banner - -c CDIST_HOME, --cdist-home CDIST_HOME:: Instead of using the parent of the bin directory as cdist home, use the specified directory @@ -42,23 +54,25 @@ OPTIONS -s, --sequential:: Operate on multiple hosts sequentially --V, --version:: - Show version and exit - EXAMPLES -------- -------------------------------------------------------------------------------- # Configure ikq05.ethz.ch with debug enabled -cdist -d ikq05.ethz.ch +cdist config -d ikq05.ethz.ch # Configure hosts in parallel and use a different home directory -cdist -c ~/p/cdist-nutzung -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch +cdist config -c ~/p/cdist-nutzung \ + -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch -# Does not need a comment, plain works -cdist --banner +# Display banner +cdist banner + +# Show help cdist --help + +# Show Version cdist --version -------------------------------------------------------------------------------- From c8b238df064df105f032237d52738c4a8936ceb5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 22:07:21 +0200 Subject: [PATCH 0159/1024] update cdist homepage Signed-off-by: Nico Schottelius --- README | 11 +++++++---- doc/dev/todo/niconext | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README b/README index 295b9152..521d70a2 100644 --- a/README +++ b/README @@ -38,13 +38,13 @@ Design | Define target state, do not focus on methods or scripts Design | Push architecture: Instantly apply your changes Small core | cdist's core is very small - less code, less bugs Fast development | Focus on straightforwardness of type creation is a main development objective +Modern Programming Language | cdist is written in Python Requirements, Scalability | No central server needed, cdist operates in push mode and can be run from any computer Requirements, Scalability, Upgrade | cdist only needs to be updated on the master, not on the target hosts Requirements, Security | Uses well-know [SSH](http://www.openssh.com/) as transport protocol Requirements, Simplicity | Requires only shell and SSH server on the target UNIX | Reuse of existing tools like cat, find, mv, ... UNIX, familar environment, documentation | Is available as manpages and HTML -UNIX, simplicity, familar environment | cdist is written in POSIX shell UNIX, simplicity, familar environment | cdist is configured in POSIX shell """]] @@ -76,6 +76,7 @@ cdist was tested or is know to run on at least ### Server * A posix like shell + * Python (>= 3.2 required) * SSH-Client ### Client ("target host") @@ -110,10 +111,11 @@ how to use cdist. There are at least the following branches available: * Development: master - * Current Stable: 1.7 (Bugfixes, cleanups, new type and explorer rename) + * 2.0: Python rewrite Old versions: + * 1.7: Bugfixes, cleanups, new type and explorer rename * 1.6: New types, cleaned up \_\_package* types, internal cleanup * 1.5: Focus on object orientation instead of global stage orientation * 1.4: Support for redefiniton of objects (if equal) @@ -129,13 +131,12 @@ may vanish at any point. To select a specific branch use git checkout -b origin/ # Stay on a specific version - version=1.7 + version=2.0 git checkout -b $version origin/$version ### Mirrors * git://github.com/telmich/cdist.git ([github](https://github.com/telmich/cdist)) - * git://git.sans.ethz.ch/cdist ([sans](http://git.sans.ethz.ch/?p=cdist;a=summary)) ## Update @@ -151,6 +152,8 @@ If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break. The master branch on the other hand is the development branch and may not be working, break your setup or eat the tree in your garden. +### Upgrading from 1.7 to 2.0 + ### Upgrading from 1.6 to 1.7 * If you used the global explorer **hardware_type**, you need to change diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 63f9b629..accef050 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -13,3 +13,5 @@ - Replace bin/cdist-type-template - Allow manifest to be read from stdin +- Create new video for cdist 2.0.0 + http://www.youtube.com/watch?v=PRMjzy48eTI From 2f30ebf1f0c7da3284071e17ab0ee123036bd882 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 22:11:51 +0200 Subject: [PATCH 0160/1024] more todo, yeah! Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index accef050..beae3cb2 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -9,6 +9,7 @@ - Remove legacy code in cdist - Remove cdist-config - Remove man1/cdist-type-emulator.text + - Remove the PATH=... part from the README - Replace bin/cdist-type-template From 24cbc1b717442000e1831281b1c0e932b2981b46 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 22:23:28 +0200 Subject: [PATCH 0161/1024] changes for 2.0 Signed-off-by: Nico Schottelius --- README | 5 +++++ doc/man/cdist-reference.text.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README b/README index 521d70a2..3808faac 100644 --- a/README +++ b/README @@ -154,6 +154,11 @@ working, break your setup or eat the tree in your garden. ### Upgrading from 1.7 to 2.0 +* Ensure python (>= 3.2) is installed on the server +* Use "cdist config host" instead of "cdist-deploy-to host" +* Use "cdist config -p host1 host2" instead of "cdist-mass-deploy" +* Use **\_\_object_fq** instead of **\_\_self** in manifests + ### Upgrading from 1.6 to 1.7 * If you used the global explorer **hardware_type**, you need to change diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index a823891b..218b0f57 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -171,7 +171,7 @@ __object:: __object_id:: The type unique object id. Available for: type manifest, type explorer, type gencode -__self:: +__object_fq:: The full qualified name of the current object. Available for: type manifest, type explorer, type gencode __target_host:: From 159ace1ea2bee34919c6806e7dc1aeaf73713df4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 22:40:10 +0200 Subject: [PATCH 0162/1024] more important changes for 2.0 Signed-off-by: Nico Schottelius --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 3808faac..3e00b497 100644 --- a/README +++ b/README @@ -157,6 +157,7 @@ working, break your setup or eat the tree in your garden. * Ensure python (>= 3.2) is installed on the server * Use "cdist config host" instead of "cdist-deploy-to host" * Use "cdist config -p host1 host2" instead of "cdist-mass-deploy" +* Use "cdist banner" for fun * Use **\_\_object_fq** instead of **\_\_self** in manifests ### Upgrading from 1.6 to 1.7 From fece6ddd6aaee0a0fdc82fee6fa7f195537b4f9d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 22:42:47 +0200 Subject: [PATCH 0163/1024] create subdirs man1 and man7 on the web Signed-off-by: Nico Schottelius --- build.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index a6897d49..8ebfa168 100755 --- a/build.sh +++ b/build.sh @@ -96,10 +96,14 @@ case "$1" in web) cp README ${WEBDIR}/${WEBPAGE} - rm -rf ${WEBDIR}/${WEBBASE}/man && mkdir ${WEBDIR}/${WEBBASE}/man + rm -rf ${WEBDIR}/${WEBBASE}/man + mkdir ${WEBDIR}/${WEBBASE}/man/man1 + mkdir ${WEBDIR}/${WEBBASE}/man/man7 + rm -rf ${WEBDIR}/${WEBBASE}/speeches && mkdir ${WEBDIR}/${WEBBASE}/speeches - cp ${MAN1DSTDIR}/*.html ${MAN7DSTDIR}/*.html ${WEBDIR}/${WEBBASE}/man + cp ${MAN1DSTDIR}/*.html ${WEBDIR}/${WEBBASE}/man/man1 + cp ${MAN7DSTDIR}/*.html ${WEBDIR}/${WEBBASE}/man/man7 cp ${SPEECHESDIR}/*.pdf ${WEBDIR}/${WEBBASE}/speeches git describe > ${WEBDIR}/${WEBBASE}/man/VERSION From a0058a181827d1122c76fef71efa1449950b49d0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 22:46:15 +0200 Subject: [PATCH 0164/1024] really create the directories Signed-off-by: Nico Schottelius --- build.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 8ebfa168..bef4393b 100755 --- a/build.sh +++ b/build.sh @@ -97,8 +97,7 @@ case "$1" in web) cp README ${WEBDIR}/${WEBPAGE} rm -rf ${WEBDIR}/${WEBBASE}/man - mkdir ${WEBDIR}/${WEBBASE}/man/man1 - mkdir ${WEBDIR}/${WEBBASE}/man/man7 + mkdir -p ${WEBDIR}/${WEBBASE}/man/man1 ${WEBDIR}/${WEBBASE}/man/man7 rm -rf ${WEBDIR}/${WEBBASE}/speeches && mkdir ${WEBDIR}/${WEBBASE}/speeches From 2e96ba793a1fe85cd10b7ae4a6ac694c47e1e4d7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 22:48:14 +0200 Subject: [PATCH 0165/1024] reformat cdist manpage Signed-off-by: Nico Schottelius --- doc/man/man1/cdist.text | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/man/man1/cdist.text b/doc/man/man1/cdist.text index 7f585953..104163af 100644 --- a/doc/man/man1/cdist.text +++ b/doc/man/man1/cdist.text @@ -10,8 +10,10 @@ cdist - Configuration management SYNOPSIS -------- -cdist [-V|--version] +cdist [-h] [-V] + cdist banner + cdist config [-h] [-d] [-V] [-c CDIST_HOME] [-i MANIFEST] [-p] [-s] host [host ...] @@ -22,6 +24,9 @@ cdist is the frontend executable to the cdist configuration management. cdist supports different as explained below. The options to the main program are: +-h, --help:: + Show the help screen + -V, --version:: Show version and exit From 41099a35960f0f97c4b8f5e7bbb7da8b8f77b20d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 13 Sep 2011 22:49:42 +0200 Subject: [PATCH 0166/1024] update references Signed-off-by: Nico Schottelius --- doc/man/man1/cdist.text | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/man/man1/cdist.text b/doc/man/man1/cdist.text index 104163af..5a45b8c1 100644 --- a/doc/man/man1/cdist.text +++ b/doc/man/man1/cdist.text @@ -85,7 +85,8 @@ cdist --version SEE ALSO -------- - cdist(7) -- cdist-type-build-emulation(1) +- cdist-type-emulator(1) +- cdist-reference(7) COPYING From 9b3a95e244c4624cdd1c1268a47cf73a842f5a98 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 14 Sep 2011 01:49:00 +0200 Subject: [PATCH 0167/1024] ++logs +beginning of benchmark Signed-off-by: Nico Schottelius --- doc/dev/benchmark-parallel-deploy | 12 ++++++ ...11-09-08 => 2011-09-08.obsolete_debugging} | 0 doc/dev/logs/2011-09-12 | 43 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100755 doc/dev/benchmark-parallel-deploy rename doc/dev/logs/{2011-09-08 => 2011-09-08.obsolete_debugging} (100%) diff --git a/doc/dev/benchmark-parallel-deploy b/doc/dev/benchmark-parallel-deploy new file mode 100755 index 00000000..82d2240c --- /dev/null +++ b/doc/dev/benchmark-parallel-deploy @@ -0,0 +1,12 @@ +#!/bin/sh + +outfile="$1"; shift + +( + for host in "$@"; do + hosts="$hosts $host" + cdist config -c ~/p/cdist-nutzung -p $hosts + done +) | tee "$outfile" +echo "----------" +grep 'INFO: Total processing time for' "$outfile" | sed 's/.*: //' diff --git a/doc/dev/logs/2011-09-08 b/doc/dev/logs/2011-09-08.obsolete_debugging similarity index 100% rename from doc/dev/logs/2011-09-08 rename to doc/dev/logs/2011-09-08.obsolete_debugging diff --git a/doc/dev/logs/2011-09-12 b/doc/dev/logs/2011-09-12 index 391b836f..1ace466f 100644 --- a/doc/dev/logs/2011-09-12 +++ b/doc/dev/logs/2011-09-12 @@ -65,3 +65,46 @@ Use: # Scale linearly with the single host value plot((1:31)*times(1)) +-------------------------------------------------------------------------------- +code: + +octave +time = [ +72.166661 +76.633228 +77.199817 +94.045175 +103.226354 +107.76097 +101.571705 +107.600093 +116.500371 +119.445805 +123.944385 +130.499098 +137.250861 +154.9841 +139.659637 +142.70005 +148.541452 +159.360809 +171.907864 +178.76695 +183.856671 +194.504221 +207.314842 +215.846502 +217.223581 +238.591705 +238.478493 +246.058718 +264.208372 +265.560685 +282.264488 +] +plot(times, "-;cdist;", times(1)*[1:length(times)]', "-;linear;") +title("Configuration duration (cdist-2.0.0-rc4)") +ylabel("Number of hosts") +xlabel("Time in seconds") +print('cdist-2.0.0-rc4.png', '-dpng') + From 03e312dcb7de0da7a24a185150fd0870bc07e054 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 14 Sep 2011 01:50:18 +0200 Subject: [PATCH 0168/1024] use shutil.move() instead of os.rename() to avoid OSError: [Errno 18] Invalid cross-device link Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 21a35c22..92161908 100755 --- a/bin/cdist +++ b/bin/cdist @@ -157,7 +157,7 @@ class Cdist: # Remove previous cache if os.path.exists(self.cache_dir): shutil.rmtree(self.cache_dir) - os.rename(self.temp_dir, self.cache_dir) + shutil.move(self.temp_dir, self.cache_dir) def exit_error(self, *args): log.error(*args) From b76c4a5105d21cc76caa9d4ecf3980e1afe6bfc5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 14 Sep 2011 08:45:55 +0200 Subject: [PATCH 0169/1024] make shell exec error and normal error look the same for easier grepping in logfiles Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- doc/dev/benchmark-parallel-deploy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 92161908..f7ad2f72 100755 --- a/bin/cdist +++ b/bin/cdist @@ -197,7 +197,7 @@ class Cdist: print(script_fd.read()) script_fd.close() - self.exit_error("Non-Zero exit code exit of " + " ".join(*args)) + self.exit_error("Command failed (shell): " + " ".join(*args)) def run_or_fail(self, *args, **kargs): if "remote" in kargs: diff --git a/doc/dev/benchmark-parallel-deploy b/doc/dev/benchmark-parallel-deploy index 82d2240c..0e7c4a2f 100755 --- a/doc/dev/benchmark-parallel-deploy +++ b/doc/dev/benchmark-parallel-deploy @@ -5,7 +5,7 @@ outfile="$1"; shift ( for host in "$@"; do hosts="$hosts $host" - cdist config -c ~/p/cdist-nutzung -p $hosts + cdist config -c ~/p/cdist-nutzung -p $hosts 2>&1 done ) | tee "$outfile" echo "----------" From 1f9ae130779903302d3bf56929c25a515f75b279 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 12:09:22 +0200 Subject: [PATCH 0170/1024] only the core is python, not the manifests Signed-off-by: Nico Schottelius --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 3e00b497..5e60a093 100644 --- a/README +++ b/README @@ -111,7 +111,7 @@ how to use cdist. There are at least the following branches available: * Development: master - * 2.0: Python rewrite + * 2.0: Python rewrite of cdist core Old versions: From b6738aaf60054beecdca9105250c80d51ebfb338 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 16 Sep 2011 12:19:09 +0200 Subject: [PATCH 0171/1024] rename __cinst_partition_msdos __partition_msdos Signed-off-by: Steven Armstrong --- .../gencode-remote | 0 .../man.text | 27 ++++++++++--------- .../manifest | 0 .../parameter/optional | 0 .../parameter/required | 0 5 files changed, 14 insertions(+), 13 deletions(-) rename conf/type/{__cinst_partition_msdos => __partition_msdos}/gencode-remote (100%) rename conf/type/{__cinst_partition_msdos => __partition_msdos}/man.text (59%) rename conf/type/{__cinst_partition_msdos => __partition_msdos}/manifest (100%) rename conf/type/{__cinst_partition_msdos => __partition_msdos}/parameter/optional (100%) rename conf/type/{__cinst_partition_msdos => __partition_msdos}/parameter/required (100%) diff --git a/conf/type/__cinst_partition_msdos/gencode-remote b/conf/type/__partition_msdos/gencode-remote similarity index 100% rename from conf/type/__cinst_partition_msdos/gencode-remote rename to conf/type/__partition_msdos/gencode-remote diff --git a/conf/type/__cinst_partition_msdos/man.text b/conf/type/__partition_msdos/man.text similarity index 59% rename from conf/type/__cinst_partition_msdos/man.text rename to conf/type/__partition_msdos/man.text index 2203c2d3..611451ed 100644 --- a/conf/type/__cinst_partition_msdos/man.text +++ b/conf/type/__partition_msdos/man.text @@ -1,11 +1,11 @@ -cdist-type__cinst_partition_msdos(7) -==================================== +cdist-type__partition_msdos(7) +============================== Steven Armstrong NAME ---- -cdist-type__cinst_partition_msdos - creates msdos partitions +cdist-type__partition_msdos - creates msdos partitions DESCRIPTION @@ -24,13 +24,12 @@ OPTIONAL PARAMETERS device:: defaults to object_id bootable:: - mark partition as bootable, true or false + mark partition as bootable, true or false, defaults to false size:: - the size of the partition (such as 32MB or 15GB, whole numbers + the size of the partition (such as 32M or 15G, whole numbers only), '+' for remaining space, or 'n%' for percentage of remaining (these should only be used after all specific partition sizes are - specified), leave blank if type is "extended". - Defaults to +. + specified). Defaults to +. EXAMPLES @@ -38,17 +37,19 @@ EXAMPLES -------------------------------------------------------------------------------- # 128MB linux, bootable -__cinst_partition_msdos /dev/sda1 --type 83 --size 128M --bootable true +__partition_msdos /dev/sda1 --type 83 --size 128M --bootable true # 512MB swap -__cinst_partition_msdos /dev/sda2 --type 82 --size 512M +__partition_msdos /dev/sda2 --type 82 --size 512M # extended -__cinst_partition_msdos /dev/sda3 --type extended +__partition_msdos /dev/sda3 --type extended --size 100G # 10GB, linux -__cinst_partition_msdos /dev/sda5 --type 82 --size 10G +__partition_msdos /dev/sda5 --type 83 --size 10G +# 50% of free space, linux +__partition_msdos /dev/sda6 --type 83 --size 50% # rest of disk, linux -__cinst_partition_msdos /dev/sda6 --type 82 --size + +__partition_msdos /dev/sda7 --type 83 --size + # same thing as -__cinst_partition_msdos /dev/sda6 --type 82 +__partition_msdos /dev/sda7 --type 83 -------------------------------------------------------------------------------- diff --git a/conf/type/__cinst_partition_msdos/manifest b/conf/type/__partition_msdos/manifest similarity index 100% rename from conf/type/__cinst_partition_msdos/manifest rename to conf/type/__partition_msdos/manifest diff --git a/conf/type/__cinst_partition_msdos/parameter/optional b/conf/type/__partition_msdos/parameter/optional similarity index 100% rename from conf/type/__cinst_partition_msdos/parameter/optional rename to conf/type/__partition_msdos/parameter/optional diff --git a/conf/type/__cinst_partition_msdos/parameter/required b/conf/type/__partition_msdos/parameter/required similarity index 100% rename from conf/type/__cinst_partition_msdos/parameter/required rename to conf/type/__partition_msdos/parameter/required From 88c1be4b1b0caa38e4d9b6fc72b2c30d62cc96f4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 13:00:02 +0200 Subject: [PATCH 0172/1024] add benchmark results Signed-off-by: Nico Schottelius --- ...011-09-16.benchmark-r815-no-control-socket | 63 + ...benchmark-r815-no-control-socket.dmidecode | 1373 +++++++++++++++++ 2 files changed, 1436 insertions(+) create mode 100644 doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket create mode 100644 doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode diff --git a/doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket b/doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket new file mode 100644 index 00000000..315ebf75 --- /dev/null +++ b/doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket @@ -0,0 +1,63 @@ +48 core +model name : AMD Opteron(tm) Processor 6174 +128 GB RAM +Dell PowerEdge R815 + +root@sgs-r815-01:~/cdist-nutzung# grep "Total processing time for" deploy-all-benchmark-noikr13 +INFO: Total processing time for 1 host(s): 257.641541 +INFO: Total processing time for 2 host(s): 257.025783 +INFO: Total processing time for 3 host(s): 258.933088 +INFO: Total processing time for 4 host(s): 259.253074 +INFO: Total processing time for 5 host(s): 260.331896 +INFO: Total processing time for 6 host(s): 262.051349 +INFO: Total processing time for 7 host(s): 323.820878 +INFO: Total processing time for 8 host(s): 329.081856 +INFO: Total processing time for 9 host(s): 333.346278 +INFO: Total processing time for 10 host(s): 334.832419 +INFO: Total processing time for 11 host(s): 330.572375 +INFO: Total processing time for 12 host(s): 331.726628 +INFO: Total processing time for 13 host(s): 331.740591 +INFO: Total processing time for 14 host(s): 331.237139 +INFO: Total processing time for 15 host(s): 331.718861 +INFO: Total processing time for 16 host(s): 332.374645 +INFO: Total processing time for 17 host(s): 331.510445 +INFO: Total processing time for 18 host(s): 332.030743 +INFO: Total processing time for 19 host(s): 332.193198 +INFO: Total processing time for 20 host(s): 333.933765 +INFO: Total processing time for 21 host(s): 335.292953 +INFO: Total processing time for 22 host(s): 337.253608 +INFO: Total processing time for 23 host(s): 337.831493 +INFO: Total processing time for 24 host(s): 339.024737 +INFO: Total processing time for 25 host(s): 343.515044 +INFO: Total processing time for 26 host(s): 339.759678 +INFO: Total processing time for 27 host(s): 339.378998 +INFO: Total processing time for 28 host(s): 339.640378 +INFO: Total processing time for 29 host(s): 340.885614 +INFO: Total processing time for 30 host(s): 341.836923 +INFO: Total processing time for 31 host(s): 343.825758 +INFO: Total processing time for 32 host(s): 344.176089 +INFO: Total processing time for 33 host(s): 345.408518 +INFO: Total processing time for 34 host(s): 347.15322 +INFO: Total processing time for 35 host(s): 351.330649 +INFO: Total processing time for 36 host(s): 347.640758 +INFO: Total processing time for 37 host(s): 347.381126 +INFO: Total processing time for 38 host(s): 347.053406 +INFO: Total processing time for 39 host(s): 347.453166 +INFO: Total processing time for 40 host(s): 347.84804 +INFO: Total processing time for 41 host(s): 349.035272 +INFO: Total processing time for 42 host(s): 349.41507 +INFO: Total processing time for 43 host(s): 351.208072 +INFO: Total processing time for 44 host(s): 351.788401 +INFO: Total processing time for 45 host(s): 351.730259 +INFO: Total processing time for 46 host(s): 515.693497 +INFO: Total processing time for 47 host(s): 352.702677 +INFO: Total processing time for 48 host(s): 353.418003 +INFO: Total processing time for 49 host(s): 355.07111 +INFO: Total processing time for 50 host(s): 354.622388 +INFO: Total processing time for 51 host(s): 355.192521 +INFO: Total processing time for 52 host(s): 355.283238 +INFO: Total processing time for 53 host(s): 358.112329 +INFO: Total processing time for 54 host(s): 357.717426 +INFO: Total processing time for 55 host(s): 357.748707 +INFO: Total processing time for 56 host(s): 358.902118 +INFO: Total processing time for 57 host(s): 367.817594 diff --git a/doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode b/doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode new file mode 100644 index 00000000..f96db8b3 --- /dev/null +++ b/doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode @@ -0,0 +1,1373 @@ +# dmidecode 2.9 +SMBIOS 2.6 present. +101 structures occupying 5955 bytes. +Table at 0xDF79C000. + +Handle 0xDA00, DMI type 218, 11 bytes +OEM-specific Type + Header and Data: + DA 0B 00 DA B0 00 17 00 0E 20 00 + +Handle 0x0000, DMI type 0, 24 bytes +BIOS Information + Vendor: Dell Inc. + Version: 1.0.0 + Release Date: 04/08/2010 + Address: 0xF0000 + Runtime Size: 64 kB + ROM Size: 4096 kB + Characteristics: + ISA is supported + PCI is supported + PNP is supported + BIOS is upgradeable + BIOS shadowing is allowed + Boot from CD is supported + Selectable boot is supported + EDD is supported + Japanese floppy for Toshiba 1.2 MB is supported (int 13h) + 5.25"/360 KB floppy services are supported (int 13h) + 5.25"/1.2 MB floppy services are supported (int 13h) + 3.5"/720 KB floppy services are supported (int 13h) + 8042 keyboard services are supported (int 9h) + Serial services are supported (int 14h) + CGA/mono video services are supported (int 10h) + ACPI is supported + USB legacy is supported + BIOS boot specification is supported + Function key-initiated network boot is supported + Targeted content distribution is supported + BIOS Revision: 1.0 + +Handle 0x0100, DMI type 1, 27 bytes +System Information + Manufacturer: Dell Inc. + Product Name: PowerEdge R815 + Version: Not Specified + Serial Number: HYGTS4J + UUID: 44454C4C-5900-1047-8054-C8C04F53344A + Wake-up Type: Power Switch + SKU Number: Not Specified + Family: Not Specified + +Handle 0x0200, DMI type 2, 9 bytes +Base Board Information + Manufacturer: Dell Inc. + Product Name: 06JC9T + Version: A00 + Serial Number: ..CN7475104Q0184. + +Handle 0x0300, DMI type 3, 21 bytes +Chassis Information + Manufacturer: Dell Inc. + Type: Rack Mount Chassis + Lock: Present + Version: Not Specified + Serial Number: HYGTS4J + Asset Tag: Not Specified + Boot-up State: Safe + Power Supply State: Safe + Thermal State: Safe + Security Status: Unknown + OEM Information: 0x00000000 + Height: 2 U + Number Of Power Cords: Unspecified + Contained Elements: 0 + +Handle 0x0400, DMI type 4, 40 bytes +Processor Information + Socket Designation: CPU1 + Type: Central Processor + Family: + Manufacturer: AMD + ID: 91 0F 10 00 FF FB 8B 17 + Version: AMD Opteron(tm) Processor 6174 + Voltage: 1.1 V + External Clock: 3200 MHz + Max Speed: 3600 MHz + Current Speed: 2200 MHz + Status: Populated, Enabled + Upgrade: + L1 Cache Handle: 0x0700 + L2 Cache Handle: 0x0701 + L3 Cache Handle: 0x0702 + Serial Number: Not Specified + Asset Tag: Not Specified + Part Number: Not Specified + Core Count: 12 + Core Enabled: 12 + Thread Count: 12 + Characteristics: + 64-bit capable + +Handle 0x0401, DMI type 4, 40 bytes +Processor Information + Socket Designation: CPU2 + Type: Central Processor + Family: + Manufacturer: AMD + ID: 91 0F 10 00 FF FB 8B 17 + Version: AMD Opteron(tm) Processor 6174 + Voltage: 1.1 V + External Clock: 3200 MHz + Max Speed: 3600 MHz + Current Speed: 2200 MHz + Status: Populated, Idle + Upgrade: + L1 Cache Handle: 0x0703 + L2 Cache Handle: 0x0704 + L3 Cache Handle: 0x0705 + Serial Number: Not Specified + Asset Tag: Not Specified + Part Number: Not Specified + Core Count: 12 + Core Enabled: 12 + Thread Count: 12 + Characteristics: + 64-bit capable + +Handle 0x0402, DMI type 4, 40 bytes +Processor Information + Socket Designation: CPU3 + Type: Central Processor + Family: + Manufacturer: AMD + ID: 91 0F 10 00 FF FB 8B 17 + Version: AMD Opteron(tm) Processor 6174 + Voltage: 1.1 V + External Clock: 3200 MHz + Max Speed: 3600 MHz + Current Speed: 2200 MHz + Status: Populated, Idle + Upgrade: + L1 Cache Handle: 0x0706 + L2 Cache Handle: 0x0707 + L3 Cache Handle: 0x0708 + Serial Number: Not Specified + Asset Tag: Not Specified + Part Number: Not Specified + Core Count: 12 + Core Enabled: 12 + Thread Count: 12 + Characteristics: + 64-bit capable + +Handle 0x0403, DMI type 4, 40 bytes +Processor Information + Socket Designation: CPU4 + Type: Central Processor + Family: + Manufacturer: AMD + ID: 91 0F 10 00 FF FB 8B 17 + Version: AMD Opteron(tm) Processor 6174 + Voltage: 1.1 V + External Clock: 3200 MHz + Max Speed: 3600 MHz + Current Speed: 2200 MHz + Status: Populated, Idle + Upgrade: + L1 Cache Handle: 0x0709 + L2 Cache Handle: 0x070A + L3 Cache Handle: 0x070B + Serial Number: Not Specified + Asset Tag: Not Specified + Part Number: Not Specified + Core Count: 12 + Core Enabled: 12 + Thread Count: 12 + Characteristics: + 64-bit capable + +Handle 0x0700, DMI type 7, 19 bytes +Cache Information + Socket Designation: Not Specified + Configuration: Enabled, Not Socketed, Level 1 + Operational Mode: Write Back + Location: Internal + Installed Size: 768 KB + Maximum Size: 768 KB + Supported SRAM Types: + Unknown + Installed SRAM Type: Unknown + Speed: Unknown + Error Correction Type: Multi-bit ECC + System Type: Unified + Associativity: 2-way Set-associative + +Handle 0x0701, DMI type 7, 19 bytes +Cache Information + Socket Designation: Not Specified + Configuration: Enabled, Not Socketed, Level 2 + Operational Mode: Write Back + Location: Internal + Installed Size: 6144 KB + Maximum Size: 6144 KB + Supported SRAM Types: + Unknown + Installed SRAM Type: Unknown + Speed: Unknown + Error Correction Type: Multi-bit ECC + System Type: Unified + Associativity: 16-way Set-associative + +Handle 0x0702, DMI type 7, 19 bytes +Cache Information + Socket Designation: Not Specified + Configuration: Enabled, Not Socketed, Level 3 + Operational Mode: Write Back + Location: Internal + Installed Size: 10240 KB + Maximum Size: 10240 KB + Supported SRAM Types: + Unknown + Installed SRAM Type: Unknown + Speed: Unknown + Error Correction Type: Multi-bit ECC + System Type: Unified + Associativity: Other + +Handle 0x0703, DMI type 7, 19 bytes +Cache Information + Socket Designation: Not Specified + Configuration: Enabled, Not Socketed, Level 1 + Operational Mode: Write Back + Location: Internal + Installed Size: 768 KB + Maximum Size: 768 KB + Supported SRAM Types: + Unknown + Installed SRAM Type: Unknown + Speed: Unknown + Error Correction Type: Multi-bit ECC + System Type: Unified + Associativity: 2-way Set-associative + +Handle 0x0704, DMI type 7, 19 bytes +Cache Information + Socket Designation: Not Specified + Configuration: Enabled, Not Socketed, Level 2 + Operational Mode: Write Back + Location: Internal + Installed Size: 6144 KB + Maximum Size: 6144 KB + Supported SRAM Types: + Unknown + Installed SRAM Type: Unknown + Speed: Unknown + Error Correction Type: Multi-bit ECC + System Type: Unified + Associativity: 16-way Set-associative + +Handle 0x0705, DMI type 7, 19 bytes +Cache Information + Socket Designation: Not Specified + Configuration: Enabled, Not Socketed, Level 3 + Operational Mode: Write Back + Location: Internal + Installed Size: 10240 KB + Maximum Size: 10240 KB + Supported SRAM Types: + Unknown + Installed SRAM Type: Unknown + Speed: Unknown + Error Correction Type: Multi-bit ECC + System Type: Unified + Associativity: Other + +Handle 0x0706, DMI type 7, 19 bytes +Cache Information + Socket Designation: Not Specified + Configuration: Enabled, Not Socketed, Level 1 + Operational Mode: Write Back + Location: Internal + Installed Size: 768 KB + Maximum Size: 768 KB + Supported SRAM Types: + Unknown + Installed SRAM Type: Unknown + Speed: Unknown + Error Correction Type: Multi-bit ECC + System Type: Unified + Associativity: 2-way Set-associative + +Handle 0x0707, DMI type 7, 19 bytes +Cache Information + Socket Designation: Not Specified + Configuration: Enabled, Not Socketed, Level 2 + Operational Mode: Write Back + Location: Internal + Installed Size: 6144 KB + Maximum Size: 6144 KB + Supported SRAM Types: + Unknown + Installed SRAM Type: Unknown + Speed: Unknown + Error Correction Type: Multi-bit ECC + System Type: Unified + Associativity: 16-way Set-associative + +Handle 0x0708, DMI type 7, 19 bytes +Cache Information + Socket Designation: Not Specified + Configuration: Enabled, Not Socketed, Level 3 + Operational Mode: Write Back + Location: Internal + Installed Size: 10240 KB + Maximum Size: 10240 KB + Supported SRAM Types: + Unknown + Installed SRAM Type: Unknown + Speed: Unknown + Error Correction Type: Multi-bit ECC + System Type: Unified + Associativity: Other + +Handle 0x0709, DMI type 7, 19 bytes +Cache Information + Socket Designation: Not Specified + Configuration: Enabled, Not Socketed, Level 1 + Operational Mode: Write Back + Location: Internal + Installed Size: 768 KB + Maximum Size: 768 KB + Supported SRAM Types: + Unknown + Installed SRAM Type: Unknown + Speed: Unknown + Error Correction Type: Multi-bit ECC + System Type: Unified + Associativity: 2-way Set-associative + +Handle 0x070A, DMI type 7, 19 bytes +Cache Information + Socket Designation: Not Specified + Configuration: Enabled, Not Socketed, Level 2 + Operational Mode: Write Back + Location: Internal + Installed Size: 6144 KB + Maximum Size: 6144 KB + Supported SRAM Types: + Unknown + Installed SRAM Type: Unknown + Speed: Unknown + Error Correction Type: Multi-bit ECC + System Type: Unified + Associativity: 16-way Set-associative + +Handle 0x070B, DMI type 7, 19 bytes +Cache Information + Socket Designation: Not Specified + Configuration: Enabled, Not Socketed, Level 3 + Operational Mode: Write Back + Location: Internal + Installed Size: 10240 KB + Maximum Size: 10240 KB + Supported SRAM Types: + Unknown + Installed SRAM Type: Unknown + Speed: Unknown + Error Correction Type: Multi-bit ECC + System Type: Unified + Associativity: Other + +Handle 0x0800, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: DB-15 female + Port Type: Video Port + +Handle 0x0801, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: DB-15 female + Port Type: Video Port + +Handle 0x0802, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: Access Bus (USB) + Port Type: USB + +Handle 0x0803, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: Access Bus (USB) + Port Type: USB + +Handle 0x0804, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: Access Bus (USB) + Port Type: USB + +Handle 0x0805, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: Access Bus (USB) + Port Type: USB + +Handle 0x0806, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: Access Bus (USB) + Port Type: USB + +Handle 0x0807, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: Access Bus (USB) + Port Type: USB + +Handle 0x0808, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: INT_USB + Internal Connector Type: Access Bus (USB) + External Reference Designator: Not Specified + External Connector Type: None + Port Type: USB + +Handle 0x0809, DMI type 126, 9 bytes +Inactive + +Handle 0x080A, DMI type 126, 9 bytes +Inactive + +Handle 0x080B, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: RJ-45 + Port Type: Network Port + +Handle 0x080C, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: RJ-45 + Port Type: Network Port + +Handle 0x080D, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: RJ-45 + Port Type: Network Port + +Handle 0x080E, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: RJ-45 + Port Type: Network Port + +Handle 0x080F, DMI type 8, 9 bytes +Port Connector Information + Internal Reference Designator: Not Specified + Internal Connector Type: None + External Reference Designator: Not Specified + External Connector Type: DB-9 male + Port Type: Serial Port 16550A Compatible + +Handle 0x0900, DMI type 9, 17 bytes +System Slot Information + Designation: PCI1 + Type: x8 + Current Usage: Available + Length: Long + Characteristics: + 3.3 V is provided + PME signal is supported + +Handle 0x0901, DMI type 9, 17 bytes +System Slot Information + Designation: PCI2 + Type: x4 + Current Usage: Available + Length: Short + Characteristics: + 3.3 V is provided + PME signal is supported + +Handle 0x0902, DMI type 9, 17 bytes +System Slot Information + Designation: PCI3 + Type: x8 + Current Usage: Available + Length: Short + Characteristics: + 3.3 V is provided + PME signal is supported + +Handle 0x0903, DMI type 9, 17 bytes +System Slot Information + Designation: PCI4 + Type: x8 + Current Usage: Available + Length: Short + Characteristics: + 3.3 V is provided + PME signal is supported + +Handle 0x0904, DMI type 9, 17 bytes +System Slot Information + Designation: PCI5 + Type: x8 + Current Usage: Available + Length: Long + Characteristics: + 3.3 V is provided + PME signal is supported + +Handle 0x0905, DMI type 9, 17 bytes +System Slot Information + Designation: PCI6 + Type: x8 + Current Usage: Available + Length: Long + Characteristics: + 3.3 V is provided + PME signal is supported + +Handle 0x0A00, DMI type 10, 16 bytes +On Board Device 1 Information + Type: Video + Status: Enabled + Description: Embedded Matrox G200 Video +On Board Device 2 Information + Type: Ethernet + Status: Enabled + Description: Embedded Broadcom 5709C NIC 1 +On Board Device 3 Information + Type: Ethernet + Status: Enabled + Description: Embedded Broadcom 5709C NIC 2 +On Board Device 4 Information + Type: Ethernet + Status: Enabled + Description: Embedded Broadcom 5709C NIC 3 +On Board Device 5 Information + Type: Ethernet + Status: Enabled + Description: Embedded Broadcom 5709C NIC 4 +On Board Device 6 Information + Type: SAS Controller + Status: Enabled + Description: Integrated SAS Controller + +Handle 0x0B00, DMI type 11, 5 bytes +OEM Strings + String 1: Dell System + String 2: 5[0000] + +Handle 0x7E00, DMI type 126, 154 bytes +Inactive + +Handle 0x0C00, DMI type 12, 5 bytes +System Configuration Options + Option 1: NVRAM_CLR: Clear user settable NVRAM areas and set defaults + Option 2: PWRD_EN: Close to enable password + +Handle 0x0D00, DMI type 13, 22 bytes +BIOS Language Information + Installable Languages: 1 + en|US|iso8859-1 + Currently Installed Language: en|US|iso8859-1 + +Handle 0x1000, DMI type 16, 15 bytes +Physical Memory Array + Location: System Board Or Motherboard + Use: System Memory + Error Correction Type: Multi-bit ECC + Maximum Capacity: 256 GB + Error Information Handle: Not Provided + Number Of Devices: 32 + +Handle 0x1100, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 1 + Locator: DIMM_A1 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBE6 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1101, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 1 + Locator: DIMM_A2 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBC6 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1102, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 2 + Locator: DIMM_A3 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBFF + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1103, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 2 + Locator: DIMM_A4 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFC05 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1104, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 3 + Locator: DIMM_A5 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBB0 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1105, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 3 + Locator: DIMM_A6 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBED + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1106, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 4 + Locator: DIMM_A7 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFC06 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1107, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 4 + Locator: DIMM_A8 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBF7 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1108, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 5 + Locator: DIMM_B1 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFB92 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1109, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 5 + Locator: DIMM_B2 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBF4 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x110A, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 6 + Locator: DIMM_B3 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBC7 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x110B, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 6 + Locator: DIMM_B4 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFC26 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x110C, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 7 + Locator: DIMM_B5 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBE4 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x110D, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 7 + Locator: DIMM_B6 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBA4 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x110E, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 8 + Locator: DIMM_B7 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBB6 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x110F, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 8 + Locator: DIMM_B8 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFB0D + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1110, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 9 + Locator: DIMM_C1 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFC37 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1111, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 9 + Locator: DIMM_C2 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFC23 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1112, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 10 + Locator: DIMM_C3 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFB0E + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1113, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 10 + Locator: DIMM_C4 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFB04 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1114, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 11 + Locator: DIMM_C5 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBF6 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1115, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 11 + Locator: DIMM_C6 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFC21 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1116, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 12 + Locator: DIMM_C7 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFC28 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1117, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 12 + Locator: DIMM_C8 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBAC + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1118, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 13 + Locator: DIMM_D1 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBCD + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1119, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 13 + Locator: DIMM_D2 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBBD + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x111A, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 14 + Locator: DIMM_D3 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFAD0 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x111B, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 14 + Locator: DIMM_D4 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBBC + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x111C, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 15 + Locator: DIMM_D5 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFB2A + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x111D, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 15 + Locator: DIMM_D6 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBEB + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x111E, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 16 + Locator: DIMM_D7 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFADB + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x111F, DMI type 17, 28 bytes +Memory Device + Array Handle: 0x1000 + Error Information Handle: Not Provided + Total Width: 72 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: DIMM + Set: 16 + Locator: DIMM_D8 + Bank Locator: Not Specified + Type: + Type Detail: Synchronous + Speed: 1333 MHz (0.8 ns) + Manufacturer: 80CE80B380CE + Serial Number: 851CFBC9 + Asset Tag: 02101861 + Part Number: M393B5170EH1-CH9 + +Handle 0x1300, DMI type 19, 15 bytes +Memory Array Mapped Address + Starting Address: 0x00000000000 + Ending Address: 0x000DFFFFFFF + Range Size: 3584 MB + Physical Array Handle: 0x1000 + Partition Width: 0 + +Handle 0x1301, DMI type 19, 15 bytes +Memory Array Mapped Address + Starting Address: 0x00100000000 + Ending Address: 0x0201FFFFFFF + Range Size: 127488 MB + Physical Array Handle: 0x1000 + Partition Width: 0 + +Handle 0x2000, DMI type 32, 11 bytes +System Boot Information + Status: No errors detected + +Handle 0x2600, DMI type 38, 18 bytes +IPMI Device Information + Interface Type: KCS (Keyboard Control Style) + Specification Version: 2.0 + I2C Slave Address: 0x10 + NV Storage Device: Not Present + Base Address: 0x0000000000000CA8 (I/O) + Register Spacing: 32-bit Boundaries + +Handle 0x2900, DMI type 41, 11 bytes +Unknown Type + Header and Data: + 29 0B 00 29 01 85 01 00 00 01 00 + Strings: + Embedded NIC 1 + +Handle 0x2901, DMI type 41, 11 bytes +Unknown Type + Header and Data: + 29 0B 01 29 01 85 02 00 00 01 01 + Strings: + Embedded NIC 2 + +Handle 0x2902, DMI type 41, 11 bytes +Unknown Type + Header and Data: + 29 0B 02 29 01 85 03 00 00 02 00 + Strings: + Embedded NIC 3 + +Handle 0x2903, DMI type 41, 11 bytes +Unknown Type + Header and Data: + 29 0B 03 29 01 85 04 00 00 02 01 + Strings: + Embedded NIC 4 + +Handle 0x2904, DMI type 41, 11 bytes +Unknown Type + Header and Data: + 29 0B 04 29 01 8A 04 00 00 05 00 + Strings: + Integrated SAS + +Handle 0x2905, DMI type 126, 11 bytes +Inactive + +Handle 0x2906, DMI type 41, 11 bytes +Unknown Type + Header and Data: + 29 0B 06 29 01 83 04 00 00 0A 18 + Strings: + Embedded Video + +Handle 0xD000, DMI type 208, 16 bytes +OEM-specific Type + Header and Data: + D0 10 00 D0 02 00 FE 00 44 04 00 00 01 01 00 00 + +Handle 0xD200, DMI type 210, 12 bytes +OEM-specific Type + Header and Data: + D2 0C 00 D2 F8 03 04 03 06 80 04 05 + +Handle 0xD400, DMI type 212, 127 bytes +OEM-specific Type + Header and Data: + D4 7F 00 D4 70 00 71 00 00 10 2D 2E 42 00 11 FE + 01 43 00 11 FE 00 70 01 11 9F 20 6F 01 11 9F 00 + 00 00 11 9F 20 00 00 11 9F 00 31 40 11 FB 00 32 + 40 11 FB 04 9D 00 11 FD 02 9E 00 11 FD 00 9F 00 + 26 FE 01 A0 00 26 FE 00 28 40 26 DF 20 29 40 26 + DF 00 38 02 27 BF 40 39 02 27 BF 00 F1 01 27 FC + 01 F2 01 27 FC 02 F3 01 27 FC 03 F5 01 27 F3 04 + F6 01 27 F3 08 F7 01 27 F3 0C FF FF 00 00 00 + +Handle 0xD401, DMI type 212, 252 bytes +OEM-specific Type + Header and Data: + D4 FC 01 D4 70 00 71 00 03 40 5A 6D 5C 00 78 BF + 40 5D 00 78 BF 00 6C 01 57 FC 00 6B 01 57 FC 01 + 6A 01 57 FC 02 12 02 57 EF 00 11 02 57 EF 10 00 + 00 5B FB 04 00 00 5B FB 00 77 01 54 FC 00 78 01 + 54 FC 01 79 01 54 FC 02 7A 01 54 FC 03 33 40 54 + CF 00 34 40 54 CF 10 35 40 54 CF 20 36 40 54 CF + 30 1A 40 54 FB 04 1B 40 54 FB 00 1C 40 54 F7 08 + 1D 40 54 F7 00 43 40 58 DF 20 42 40 58 DF 00 24 + 40 58 BF 40 25 40 58 BF 00 6E 00 58 FC 01 2D 00 + 58 FC 02 DA 01 58 FC 03 22 40 58 EF 10 23 40 58 + EF 00 BB 00 58 F3 04 BC 00 58 F3 08 DB 01 58 F3 + 0C 2D 02 55 FE 01 2E 02 55 FE 00 D8 00 55 7F 80 + D9 00 55 7F 00 54 02 56 DF 00 57 02 56 DF 20 4D + 02 56 BF 00 4E 02 56 BF 40 2D 01 56 7F 80 2E 01 + 56 7F 00 00 C0 5C 00 0A 03 C0 67 00 05 83 00 76 + 00 00 84 00 77 00 00 FF FF 00 00 00 + +Handle 0xD402, DMI type 212, 177 bytes +OEM-specific Type + Header and Data: + D4 B1 02 D4 72 00 73 00 00 C0 DD DE D3 00 80 00 + 02 D4 00 82 00 02 D5 00 84 00 02 D6 00 86 00 02 + 4A 01 C6 BF 40 4B 01 C6 BF 00 00 90 AC 00 00 01 + 90 AD 00 00 00 00 C9 EB 14 00 00 C9 EF 10 DA 00 + C9 FB 04 00 00 C9 EB 00 00 00 C9 7F 00 00 00 C9 + 7F 80 CA 00 C9 FC 00 CB 00 C9 FC 01 00 00 C9 FC + 02 DE 00 E3 FE 01 26 40 C2 FE 01 27 40 C2 FE 00 + 17 01 CA FE 00 18 01 CA FE 01 00 00 CA FD 00 00 + 00 CA FD 02 35 01 CB FC 00 37 01 CB FC 01 02 40 + C6 DF 00 01 40 C6 DF 20 FC 01 C5 BF 00 FD 01 C5 + BF 40 00 00 C5 7F 80 00 00 C5 7F 00 FF FF 00 00 + 00 + +Handle 0xD403, DMI type 212, 132 bytes +OEM-specific Type + Header and Data: + D4 84 03 D4 72 00 73 00 00 C0 DD DE 32 02 C0 07 + 10 31 02 C0 07 20 6F 02 C0 07 30 70 02 C0 07 40 + 71 02 C0 07 50 72 02 C0 07 60 6E 02 C0 07 00 00 + 00 C6 FE 00 00 00 C6 FE 01 40 01 C7 EF 10 41 01 + C7 EF 00 C4 01 D0 FE 00 C5 01 D0 FE 01 73 01 D0 + BF 40 74 01 D0 BF 00 AB 02 D0 DF 20 AC 02 D0 DF + 00 A9 02 D0 EF 10 AA 02 D0 EF 00 6A 02 DB FE 00 + 6B 02 DB FE 01 7B 02 DB FD 00 7C 02 DB FD 02 FF + FF 00 00 00 + +Handle 0xD800, DMI type 216, 9 bytes +OEM-specific Type + Header and Data: + D8 09 00 D8 01 02 01 00 00 + Strings: + MATROX + VGA/VBE BIOS, Version V3.8WO + +Handle 0xDE00, DMI type 222, 16 bytes +OEM-specific Type + Header and Data: + DE 10 00 DE 01 08 FF FF 00 00 00 00 00 00 00 01 + +Handle 0x7F00, DMI type 127, 4 bytes +End Of Table + From 7c566309246bba675f17f82378cd596f53ecd5cc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 13:13:56 +0200 Subject: [PATCH 0173/1024] prepare installation routine Signed-off-by: Nico Schottelius --- bin/cdist | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/bin/cdist b/bin/cdist index f7ad2f72..49985c01 100755 --- a/bin/cdist +++ b/bin/cdist @@ -604,6 +604,10 @@ def banner(args): print(BANNER) sys.exit(0) +def install(args): + """Install remote system""" + process = {} + def config(args): """Configure remote system""" process = {} @@ -648,25 +652,33 @@ if __name__ == "__main__": add_help=False) parser['banner'].set_defaults(func=banner) - # Config - parser['config'] = parser['sub'].add_parser('config', - parents=[parser['most']]) - parser['config'].add_argument('host', nargs='+', + # 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['config'].add_argument('-c', '--cdist-home', + parser['configinstall'].add_argument('-c', '--cdist-home', help='Change cdist home (default: .. from bin directory)', action='store') - parser['config'].add_argument('-i', '--initial-manifest', + parser['configinstall'].add_argument('-i', '--initial-manifest', help='Path to a cdist manifest', dest='manifest', required=False) - parser['config'].add_argument('-p', '--parallel', + parser['configinstall'].add_argument('-p', '--parallel', help='Operate on multiple hosts in parallel', action='store_true', dest='parallel') - parser['config'].add_argument('-s', '--sequential', + parser['configinstall'].add_argument('-s', '--sequential', help='Operate on multiple hosts sequentially (default)', action='store_false', dest='parallel') + + # Config + parser['config'] = parser['sub'].add_parser('config', + parents=[parser['most'], parser['configinstall']]) parser['config'].set_defaults(func=config) + # Install + parser['install'] = parser['sub'].add_parser('install', + parents=[parser['most'], 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/" From b2546fb236c1608a3d01840992d5330a0959b35f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 13:24:40 +0200 Subject: [PATCH 0174/1024] split deploy to into two stages Signed-off-by: Nico Schottelius --- bin/cdist | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 49985c01..a4570a34 100755 --- a/bin/cdist +++ b/bin/cdist @@ -555,10 +555,8 @@ class Cdist: self.transfer_file(local_remote_code, remote_remote_code) self.run_or_fail([remote_remote_code], remote=True) - def deploy_to(self): - """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.target_host) - time_start = datetime.datetime.now() + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" self.init_deploy() self.run_global_explores() self.run_initial_manifest() @@ -580,14 +578,24 @@ class Cdist: self.objects_prepared.append(cdist_object) objects = self.list_objects() - + + def stage_run(self): + """The final (and real) step of deployment""" log.debug("Actual run objects") # Now do the final steps over the existing objects - for cdist_object in objects: + for cdist_object in self.list_objects(): log.debug("Run object: %s", cdist_object) self.object_run(cdist_object, mode="gencode") self.object_run(cdist_object, mode="code") + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + log.info("Deploying to " + self.target_host) + time_start = datetime.datetime.now() + + self.stage_prepare() + self.stage_run() + time_end = datetime.datetime.now() duration = time_end - time_start log.info("Finished run of %s in %s seconds", From 182074bb9d2908cdd16b2ce8d70fd4797843058a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 13:34:10 +0200 Subject: [PATCH 0175/1024] remove unused type template (to be reimported, if someone has a use for it) Signed-off-by: Nico Schottelius --- bin/cdist-type-template | 83 --------------------------- doc/man/man1/cdist-type-template.text | 30 ---------- 2 files changed, 113 deletions(-) delete mode 100755 bin/cdist-type-template delete mode 100644 doc/man/man1/cdist-type-template.text diff --git a/bin/cdist-type-template b/bin/cdist-type-template deleted file mode 100755 index 6d8a3f15..00000000 --- a/bin/cdist-type-template +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Create a new type from scratch -# - -. cdist-config -[ $# -eq 1 ] || __cdist_usage "" -set -eu - -__cdist_type="$1"; shift -__cdist_my_type_dir="$(__cdist_type_dir "$__cdist_type")" - -if [ -d "$__cdist_my_type_dir" ]; then - __cdist_usage "Type $__cdist_type already exists" -fi - -echo "Creating type $__cdist_type in $__cdist_my_type_dir ..." -# Base -mkdir -p "$__cdist_my_type_dir" - -# Parameter -mkdir -p "$(__cdist_type_parameter_dir "$__cdist_type")" -touch "$(__cdist_type_parameter_dir "$__cdist_type")/${__cdist_name_parameter_required}" -touch "$(__cdist_type_parameter_dir "$__cdist_type")/${__cdist_name_parameter_optional}" - -# Manifest -cat "$__cdist_abs_mydir/../doc/dev/header" - << eof > "$__cdist_my_type_dir/${__cdist_name_manifest}" - -# -# This is the manifest, which can be used to create other objects like this: -# __file /path/to/destination --source /from/where/ -# -# To tell cdist to make use of it, you need to make it executable (chmod +x) -# -# - -eof - -# Gencode remote -cat "$__cdist_abs_mydir/../doc/dev/header" - << eof > "$(__cdist_type_dir "$__cdist_type")/${__cdist_name_gencode}-${__cdist_name_gencode_remote}" - -# -# This file should generate code on stdout, which will be collected by cdist -# and run on the target. -# -# To tell cdist to make use of it, you need to make it executable (chmod +x) -# -# - -eof - -cat "$__cdist_abs_mydir/../doc/dev/header" - << eof > "$(__cdist_type_dir "$__cdist_type")/${__cdist_name_gencode}-${__cdist_name_gencode_local}" - -# -# This file should generate code on stdout, which will be collected by cdist -# and run on the same machine cdist-deploy-to is executed. -# -# To tell cdist to make use of it, you need to make it executable (chmod +x) -# -# - -eof - -# Explorer -mkdir -p "$__cdist_my_type_dir/${__cdist_name_explorer}" diff --git a/doc/man/man1/cdist-type-template.text b/doc/man/man1/cdist-type-template.text deleted file mode 100644 index bbd31409..00000000 --- a/doc/man/man1/cdist-type-template.text +++ /dev/null @@ -1,30 +0,0 @@ -cdist-type-template(1) -====================== -Nico Schottelius - - -NAME ----- -cdist-type-template - Create a new type - - -SYNOPSIS --------- -cdist-type-template NAME - - -DESCRIPTION ------------ -cdist-type-template creates a new type and adds the usual files to it. -It is thought to be helpful when writing new types. - - -SEE ALSO --------- -cdist(7) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). From d0abfbf01b31ba1573783d0c6f78241a2ac4268a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 14:17:45 +0200 Subject: [PATCH 0176/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index beae3cb2..deab8801 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,9 +1,20 @@ +- Initial install support + - setup $__install = "" for + manifest(s) + + - run standard manifest (?) + - creates initial objects + - only those having the installer flag? + - requires changegs to cdist-type-emulator! + - Goto Rewrite cdist-type-emulator + + - run all other manifests + - creates all objects + - what about type explorer? + - Support parallel execution - and maximum number of parallel runs (-p X) - error handling / report failed hosts -- Support different home instead of ../ -- Bug: os.path.join() may be wrong for the remote side! - -> does not matter for now! - Rewrite cdist-type-emulator - Remove legacy code in cdist @@ -11,8 +22,6 @@ - Remove man1/cdist-type-emulator.text - Remove the PATH=... part from the README -- Replace bin/cdist-type-template - - Allow manifest to be read from stdin - Create new video for cdist 2.0.0 http://www.youtube.com/watch?v=PRMjzy48eTI From 76f3792885ed008523fa044b7657465552f6edf3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 14:47:50 +0200 Subject: [PATCH 0177/1024] prepare argv[0] parsing for emulator use Signed-off-by: Nico Schottelius --- bin/cdist | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index a4570a34..327d86be 100755 --- a/bin/cdist +++ b/bin/cdist @@ -25,6 +25,7 @@ import datetime import logging import multiprocessing import os +import re import subprocess import shutil import stat @@ -55,12 +56,12 @@ REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") CODE_HEADER = "#!/bin/sh -e\n" DOT_CDIST = ".cdist" +TYPE_PREFIX = "__" VERSION = "2.0.0" logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') log = logging.getLogger() - class TypeEmulator: def __init__(self, name): self.name = name @@ -612,10 +613,6 @@ def banner(args): print(BANNER) sys.exit(0) -def install(args): - """Install remote system""" - process = {} - def config(args): """Configure remote system""" process = {} @@ -640,7 +637,16 @@ def config(args): log.info("Total processing time for %s host(s): %s", len(args.host), (time_end - time_start).total_seconds()) -if __name__ == "__main__": +def install(args): + """Install remote system""" + process = {} + +def emulator(): + """Emulate type commands (i.e. __file and co)""" + process = {} + +def commandline(): + """Parse command line""" # Construct parser others can reuse parser = {} # Options _all_ parsers have in common @@ -702,3 +708,9 @@ if __name__ == "__main__": args.func(args) except KeyboardInterrupt: sys.exit(0) + +if __name__ == "__main__": + if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): + emulator() + else: + commandline() From 4956c015c15d7284c00a0e8962e79001d396f25f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 14:50:43 +0200 Subject: [PATCH 0178/1024] make __type available for type gencode Signed-off-by: Nico Schottelius --- bin/cdist | 1 + doc/man/cdist-reference.text.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 327d86be..40b8dd5e 100755 --- a/bin/cdist +++ b/bin/cdist @@ -514,6 +514,7 @@ class Cdist: env["__object"] = self.object_dir(cdist_object) env["__object_id"] = self.get_object_id_from_object(cdist_object) env["__object_fq"] = cdist_object + env["__type"] = self.type_dir(get_type_from_object(cdist_object)) if mode == "gencode": paths = self.type_gencode_paths(self.get_type_from_object(cdist_object)) diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 218b0f57..e38f157d 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -182,7 +182,7 @@ __target_user:: Currently static in core. __type:: Path to the current type. - Available for: type manifest + Available for: type manifest, type gencode __type_explorer:: Directory that contains the type explorers. Available for: type explorer From dadc3ffe941dd115bc4a77ec68e07279041cce5f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 15:01:33 +0200 Subject: [PATCH 0179/1024] self.... Signed-off-by: Nico Schottelius --- bin/cdist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 40b8dd5e..05eb8c00 100755 --- a/bin/cdist +++ b/bin/cdist @@ -514,7 +514,7 @@ class Cdist: env["__object"] = self.object_dir(cdist_object) env["__object_id"] = self.get_object_id_from_object(cdist_object) env["__object_fq"] = cdist_object - env["__type"] = self.type_dir(get_type_from_object(cdist_object)) + env["__type"] = self.type_dir(self.get_type_from_object(cdist_object)) if mode == "gencode": paths = self.type_gencode_paths(self.get_type_from_object(cdist_object)) @@ -644,7 +644,7 @@ def install(args): def emulator(): """Emulate type commands (i.e. __file and co)""" - process = {} + type = os.path.basename(sys.argv[0]) def commandline(): """Parse command line""" From eb3982b059f70ef3460c3ab796cae3a89469923b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 15:10:24 +0200 Subject: [PATCH 0180/1024] introduce more generic type_attribute_path() and replace type_manifest_path() Signed-off-by: Nico Schottelius --- bin/cdist | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index 05eb8c00..3708e6a6 100755 --- a/bin/cdist +++ b/bin/cdist @@ -335,9 +335,9 @@ class Cdist: return [os.path.join(self.type_base_dir, type, "gencode-local"), os.path.join(self.type_base_dir, type, "gencode-remote")] - def type_manifest_path(self, type): - """Return path to manifest of type""" - return os.path.join(self.type_base_dir, type, "manifest") + def type_attribute_path(self, type, attribute): + """Return path of an attribute of a type""" + return os.path.join(self.type_base_dir, type, attribute) def remote_type_explorer_dir(self, type): """Return remote directory that holds the explorers of a type""" @@ -446,7 +446,7 @@ class Cdist: def run_type_manifest(self, cdist_object): """Run manifest for a specific object""" type = self.get_type_from_object(cdist_object) - manifest = self.type_manifest_path(type) + manifest = self.type_attribute_path(type, "manifest") log.debug("%s: Running %s", cdist_object, manifest) if os.path.exists(manifest): From d979bdc5149fee855edfafb7a26445ceec73f5d9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 15:12:12 +0200 Subject: [PATCH 0181/1024] also replace self.type_explorer_dir Signed-off-by: Nico Schottelius --- bin/cdist | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 3708e6a6..2e094fcf 100755 --- a/bin/cdist +++ b/bin/cdist @@ -253,7 +253,7 @@ class Cdist: def list_type_explorers(self, type): """Return list of available explorers for a specific type""" - dir = self.type_explorer_dir(type) + dir = self.type_attribute_path(type, "explorer") if os.path.isdir(dir): list = os.listdir(dir) else: @@ -326,10 +326,6 @@ class Cdist: """Return directory the type""" return os.path.join(self.type_base_dir, type) - def type_explorer_dir(self, type): - """Return directory that holds the explorers of a type""" - return os.path.join(self.type_dir(type), "explorer") - def type_gencode_paths(self, type): """Return paths to gencode scripts of type""" return [os.path.join(self.type_base_dir, type, "gencode-local"), @@ -366,7 +362,7 @@ class Cdist: # Do not retransfer self.type_explorers_transferred[type] = 1 - src = self.type_explorer_dir(type) + src = self.type_attribute_path(type, attribute) remote_base = os.path.join(REMOTE_TYPE_DIR, type) dst = self.remote_type_explorer_dir(type) From 40d494ace28023ba7c42a6bdef5baef2abab79c5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 15:20:59 +0200 Subject: [PATCH 0182/1024] and now replace the new cool function type_attribute_path() with easy type_dir Signed-off-by: Nico Schottelius --- bin/cdist | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/bin/cdist b/bin/cdist index 2e094fcf..39452352 100755 --- a/bin/cdist +++ b/bin/cdist @@ -253,7 +253,7 @@ class Cdist: def list_type_explorers(self, type): """Return list of available explorers for a specific type""" - dir = self.type_attribute_path(type, "explorer") + dir = self.type_dir(type, "explorer") if os.path.isdir(dir): list = os.listdir(dir) else: @@ -322,18 +322,9 @@ class Cdist: return objects - def type_dir(self, type): + def type_dir(self, type, *args): """Return directory the type""" - return os.path.join(self.type_base_dir, type) - - def type_gencode_paths(self, type): - """Return paths to gencode scripts of type""" - return [os.path.join(self.type_base_dir, type, "gencode-local"), - os.path.join(self.type_base_dir, type, "gencode-remote")] - - def type_attribute_path(self, type, attribute): - """Return path of an attribute of a type""" - return os.path.join(self.type_base_dir, type, attribute) + return os.path.join(self.type_base_dir, type, *args) def remote_type_explorer_dir(self, type): """Return remote directory that holds the explorers of a type""" @@ -362,7 +353,7 @@ class Cdist: # Do not retransfer self.type_explorers_transferred[type] = 1 - src = self.type_attribute_path(type, attribute) + src = self.type_dir(type, "explorer") remote_base = os.path.join(REMOTE_TYPE_DIR, type) dst = self.remote_type_explorer_dir(type) @@ -442,7 +433,7 @@ class Cdist: def run_type_manifest(self, cdist_object): """Run manifest for a specific object""" type = self.get_type_from_object(cdist_object) - manifest = self.type_attribute_path(type, "manifest") + manifest = self.type_dir(type, "manifest") log.debug("%s: Running %s", cdist_object, manifest) if os.path.exists(manifest): @@ -496,6 +487,7 @@ class Cdist: """Run gencode or code for an object""" log.debug("Running %s from %s", mode, cdist_object) requirements = self.list_object_requirements(cdist_object) + type = self.get_type_from_object(cdist_object) for requirement in requirements: log.debug("Object %s requires %s", cdist_object, requirement) @@ -510,10 +502,13 @@ class Cdist: env["__object"] = self.object_dir(cdist_object) env["__object_id"] = self.get_object_id_from_object(cdist_object) env["__object_fq"] = cdist_object - env["__type"] = self.type_dir(self.get_type_from_object(cdist_object)) + env["__type"] = self.type_dir(type) if mode == "gencode": - paths = self.type_gencode_paths(self.get_type_from_object(cdist_object)) + paths = [ + self.type_dir(type, "gencode-local"), + self.type_dir(type, "gencode-remote") + ] for bin in paths: if os.path.isfile(bin): # omit "gen" from gencode and From 1b0d85dcbe0ceac565c17109c4f9fa2f813f72a4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 15:29:56 +0200 Subject: [PATCH 0183/1024] link type emulator to ourself Signed-off-by: Nico Schottelius --- bin/cdist | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 39452352..e28a14c4 100755 --- a/bin/cdist +++ b/bin/cdist @@ -367,7 +367,7 @@ class Cdist: def link_type_to_emulator(self): """Link type names to cdist-type-emulator""" for type in self.list_types(): - source = os.path.join(self.lib_dir, "cdist-type-emulator") + source = sys.argv[0] destination = os.path.join(self.bin_dir, type) log.debug("Linking %s to %s", source, destination) os.symlink(source, destination) @@ -637,6 +637,18 @@ def emulator(): """Emulate type commands (i.e. __file and co)""" type = os.path.basename(sys.argv[0]) + + parser = argparse.ArgumentParser(add_help=False) + + print("Oh, noe") + sys.exit(1) + + # Setup optional parameters + # Setup required parameters + # Setup positional parameter, if not singleton + + + def commandline(): """Parse command line""" # Construct parser others can reuse From f720ce92435b126f65241d1497d1f53a8244494f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 15:46:02 +0200 Subject: [PATCH 0184/1024] ++todo Signed-off-by: Nico Schottelius --- bin/cdist | 14 +++++++++----- doc/dev/todo/niconext | 8 ++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/bin/cdist b/bin/cdist index e28a14c4..ee5b72c1 100755 --- a/bin/cdist +++ b/bin/cdist @@ -454,11 +454,13 @@ class Cdist: env['__global'] = self.out_dir # Legacy stuff to make cdist-type-emulator work - env['__cdist_conf_dir'] = self.conf_dir env['__cdist_core_dir'] = os.path.join(self.base_dir, "core") env['__cdist_local_base_dir'] = self.temp_dir env['__cdist_manifest'] = self.initial_manifest + # Submit information to new type emulator + env['__cdist_type_base_dir'] = self.type_base_dir + # Other environment stuff if extra_env: env.update(extra_env) @@ -636,17 +638,19 @@ def install(args): def emulator(): """Emulate type commands (i.e. __file and co)""" type = os.path.basename(sys.argv[0]) - + type_dir = os.environ['__cdist_type_base_dir'] parser = argparse.ArgumentParser(add_help=False) - print("Oh, noe") - sys.exit(1) - # Setup optional parameters + if os.path.isfile(os.path.join(type_dir, "parameter", "optional"): + __cdist_type_base_dir # Setup required parameters # Setup positional parameter, if not singleton + print("Oh, noe") + sys.exit(1) + def commandline(): diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index deab8801..3ec5ae96 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -22,6 +22,14 @@ - Remove man1/cdist-type-emulator.text - Remove the PATH=... part from the README + - basename(argv0) == type + - how to get to type dir? + - dependent on -c to cdist! + - submit via internal env! + - need to build parameter parser + - need to read file + - refactor list_object_requirements + - Allow manifest to be read from stdin - Create new video for cdist 2.0.0 http://www.youtube.com/watch?v=PRMjzy48eTI From 75510d88c925f4fbae3f931195bc3a354b2e633f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 16:08:25 +0200 Subject: [PATCH 0185/1024] first new type emulator parameter support in cdist Signed-off-by: Nico Schottelius --- bin/cdist | 55 +++++++++++++++++++++++++------------------ doc/dev/todo/niconext | 5 ++-- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/bin/cdist b/bin/cdist index ee5b72c1..34c89d86 100755 --- a/bin/cdist +++ b/bin/cdist @@ -62,6 +62,21 @@ VERSION = "2.0.0" logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') log = logging.getLogger() + +def file_to_list(filename): + """Return list from \n seperated file""" + if os.path.isfile(filename): + file_fd = open(filename, "r") + lines = file_fd.readlines() + file_fd.close() + + # Remove \n from all lines + lines = map(lambda s: s.strip(), lines) + else: + lines = [] + + return lines + class TypeEmulator: def __init__(self, name): self.name = name @@ -467,28 +482,11 @@ class Cdist: self.shell_run_or_debug_fail(manifest, [manifest], env=env) - def list_object_requirements(self, cdist_object): - """Return list of requirements for specific object""" - file=os.path.join(self.object_dir(cdist_object), "require") - - if os.path.isfile(file): - file_fd = open(file, "r") - requirements = file_fd.readlines() - file_fd.close() - - # Remove \n from all lines - requirements = map(lambda s: s.strip(), requirements) - - log.debug("Requirements for %s: %s", cdist_object, requirements) - else: - requirements = [] - - return requirements - def object_run(self, cdist_object, mode): """Run gencode or code for an object""" log.debug("Running %s from %s", mode, cdist_object) - requirements = self.list_object_requirements(cdist_object) + file=os.path.join(self.object_dir(cdist_object), "require") + requirements = file_to_list(file) type = self.get_type_from_object(cdist_object) for requirement in requirements: @@ -638,21 +636,32 @@ def install(args): def emulator(): """Emulate type commands (i.e. __file and co)""" type = os.path.basename(sys.argv[0]) - type_dir = os.environ['__cdist_type_base_dir'] + type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type) + param_dir = os.path.join(type_dir, "parameter") parser = argparse.ArgumentParser(add_help=False) # Setup optional parameters - if os.path.isfile(os.path.join(type_dir, "parameter", "optional"): - __cdist_type_base_dir + for parameter in file_to_list(os.path.join(param_dir, "optional")): + argument = "--" + parameter + print("Adding" + argument) + parser.add_argument(argument, action='store', required=False) + # Setup required parameters + for parameter in file_to_list(os.path.join(param_dir, "required")): + argument = "--" + parameter + print("Adding" + argument) + parser.add_argument(argument, action='store', required=True) + # Setup positional parameter, if not singleton + # And finally verify parameter + args = parser.parse_args(sys.argv[1:]) + print("Oh, noe") sys.exit(1) - def commandline(): """Parse command line""" # Construct parser others can reuse diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 3ec5ae96..83b18dd9 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -27,8 +27,9 @@ - dependent on -c to cdist! - submit via internal env! - need to build parameter parser - - need to read file - - refactor list_object_requirements + + Test: + __cdist_type_base_dir=$(pwd -P)/conf/type __file - Allow manifest to be read from stdin - Create new video for cdist 2.0.0 From b4a431a03b5a406c8d1ff374dce60256c403e4f2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 17:08:39 +0200 Subject: [PATCH 0186/1024] more todo for soon Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 83b18dd9..c9fd6c0d 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,6 +1,6 @@ - Initial install support - - setup $__install = "" for - manifest(s) + - setup $__install = "yes" for + manifest(s), gencode-* - run standard manifest (?) - creates initial objects @@ -11,6 +11,8 @@ - run all other manifests - creates all objects - what about type explorer? + - do not run, create empty output (types should be able + to handle this!) - Support parallel execution - and maximum number of parallel runs (-p X) From 6485299a7cd2a9cbdfa10d6e52b23bd8f7d22536 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 17:08:59 +0200 Subject: [PATCH 0187/1024] prepare source records, cleanup Signed-off-by: Nico Schottelius --- bin/cdist | 57 ++++++++++++++++++++----------------------------------- 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/bin/cdist b/bin/cdist index 34c89d86..032b078d 100755 --- a/bin/cdist +++ b/bin/cdist @@ -77,37 +77,6 @@ def file_to_list(filename): return lines -class TypeEmulator: - def __init__(self, name): - self.name = name - self.type = os.path.basename(name) - - - def type_emulator(self): - type = basename(sys.argv[0]) - - type_is_singleton(type) - - # Check object id - - # Prevent double slash if id begins with / - - # Record parameter: opt_file="${opt#--}" - # [ $# -ge 1 ] || __cdist_usage "Missing value for $opt" - # echo "${value}" > "${__cdist_parameter_dir}/${opt_file}" - - # Record requirements - # echo $requirement >> "$(__cdist_object_require "$__cdist_object_self")" - - # Ensure required parameters are given - # Ensure that only optional or required parameters are given - # [ "$is_valid" ] || __cdist_usage "Unknown parameter $parameter" - - # Merge object (creating twice with the same parameter + requirements == allowed) - - # diff -ru "${__cdist_new_object_dir}/${__cdist_name_parameter} - # # Add "I was here message" - # _cdist_object_source_add "${__cdist_object_dir}" class Cdist: """Cdist main class to hold arbitrary data""" @@ -471,9 +440,9 @@ class Cdist: # Legacy stuff to make cdist-type-emulator work env['__cdist_core_dir'] = os.path.join(self.base_dir, "core") env['__cdist_local_base_dir'] = self.temp_dir - env['__cdist_manifest'] = self.initial_manifest # Submit information to new type emulator + env['__cdist_manifest'] = manifest env['__cdist_type_base_dir'] = self.type_base_dir # Other environment stuff @@ -644,22 +613,38 @@ def emulator(): # Setup optional parameters for parameter in file_to_list(os.path.join(param_dir, "optional")): argument = "--" + parameter - print("Adding" + argument) parser.add_argument(argument, action='store', required=False) # Setup required parameters for parameter in file_to_list(os.path.join(param_dir, "required")): argument = "--" + parameter - print("Adding" + argument) parser.add_argument(argument, action='store', required=True) # Setup positional parameter, if not singleton + if not os.path.isfile(os.path.join(type_dir, "singleton")): + parser.add_argument("object_id", nargs=1) + else: + print("singleton") + # And finally verify parameter args = parser.parse_args(sys.argv[1:]) - print("Oh, noe") - sys.exit(1) + # Record parameter + # wh + print(args) + + # Record requirements + if "__require" in os.environ: + requirements = os.environ['__require'] + + # Merge / mv object into tree + + # Record / Append source + source = os.environ['__cdist_manifest'] + # write to .source? + + # sys.exit(1) def commandline(): From 5cefeb25fc89cb25eb40853ba898fc46978bf0b8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 18:26:18 +0200 Subject: [PATCH 0188/1024] +/- todo, improve argument handling Signed-off-by: Nico Schottelius --- bin/cdist | 14 ++++++++++++-- doc/dev/todo/niconext | 26 +++++++++++--------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/bin/cdist b/bin/cdist index 032b078d..8d5e9342 100755 --- a/bin/cdist +++ b/bin/cdist @@ -434,6 +434,7 @@ class Cdist: env = os.environ.copy() env['PATH'] = self.bin_dir + ":" + env['PATH'] + # Information required in every manifest env['__target_host'] = self.target_host env['__global'] = self.out_dir @@ -630,10 +631,19 @@ def emulator(): # And finally verify parameter args = parser.parse_args(sys.argv[1:]) - # Record parameter - # wh + object_id = args.object_id + + del args.object_id print(args) + # Record parameter + params = vars(args) + for param in params: + value = getattr(args, param) + if value: + print("Writing " + param + " = " + value) + + # Record requirements if "__require" in os.environ: requirements = os.environ['__require'] diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index c9fd6c0d..bd30c08d 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,3 +1,14 @@ +- Rewrite cdist-type-emulator + - Remove legacy code in cdist + - Remove cdist-config + - Remove man1/cdist-type-emulator.text + - Remove the PATH=... part from the README + + - how to access output dir? + + Test: + __cdist_type_base_dir=$(pwd -P)/conf/type __file + - Initial install support - setup $__install = "yes" for manifest(s), gencode-* @@ -18,21 +29,6 @@ - and maximum number of parallel runs (-p X) - error handling / report failed hosts -- Rewrite cdist-type-emulator - - Remove legacy code in cdist - - Remove cdist-config - - Remove man1/cdist-type-emulator.text - - Remove the PATH=... part from the README - - - basename(argv0) == type - - how to get to type dir? - - dependent on -c to cdist! - - submit via internal env! - - need to build parameter parser - - Test: - __cdist_type_base_dir=$(pwd -P)/conf/type __file - - Allow manifest to be read from stdin - Create new video for cdist 2.0.0 http://www.youtube.com/watch?v=PRMjzy48eTI From 8838d5df11ce3febbeb6d55b993804c236294683 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 19:06:43 +0200 Subject: [PATCH 0189/1024] begin writing params Signed-off-by: Nico Schottelius --- bin/cdist | 22 +++++++++++++++++----- doc/dev/todo/niconext | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/bin/cdist b/bin/cdist index 8d5e9342..ad8add02 100755 --- a/bin/cdist +++ b/bin/cdist @@ -608,6 +608,7 @@ def emulator(): type = os.path.basename(sys.argv[0]) type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type) param_dir = os.path.join(type_dir, "parameter") + global_dir = os.environ['__global'] parser = argparse.ArgumentParser(add_help=False) @@ -625,23 +626,34 @@ def emulator(): if not os.path.isfile(os.path.join(type_dir, "singleton")): parser.add_argument("object_id", nargs=1) - else: - print("singleton") # And finally verify parameter args = parser.parse_args(sys.argv[1:]) - object_id = args.object_id + # Setup object_id + if os.path.isfile(os.path.join(type_dir, "singleton")): + object_id = "singleton" + else: + object_id = args.object_id + del args.object_id - del args.object_id print(args) + print(object_id) + param_out_dir = os.path.join(global_dir, type, + object_id, DOT_CDIST, "parameter") + # Record parameter params = vars(args) for param in params: value = getattr(args, param) if value: - print("Writing " + param + " = " + value) + file = os.path.join(param_out_dir, param) + print(file + "<-" + param + " = " + value) + param_fd = open(file) + param_fd.writelines(value) + param_fd.close() + # Record requirements diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index bd30c08d..a74862f4 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -24,6 +24,7 @@ - what about type explorer? - do not run, create empty output (types should be able to handle this!) + via __global/ - Support parallel execution - and maximum number of parallel runs (-p X) From 31e9937098ebbcd9dd0b8535bb68c94bbb56b0eb Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Sat, 17 Sep 2011 06:53:18 +0200 Subject: [PATCH 0190/1024] finish new type for partition definition Signed-off-by: Steven Armstrong --- conf/type/__partition_msdos/gencode-remote | 20 ---------------- conf/type/__partition_msdos/man.text | 2 +- conf/type/__partition_msdos/manifest | 24 +++++++++++++++---- .../type/__partition_msdos/parameter/optional | 2 +- 4 files changed, 22 insertions(+), 26 deletions(-) delete mode 100755 conf/type/__partition_msdos/gencode-remote diff --git a/conf/type/__partition_msdos/gencode-remote b/conf/type/__partition_msdos/gencode-remote deleted file mode 100755 index 211bc1db..00000000 --- a/conf/type/__partition_msdos/gencode-remote +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# - diff --git a/conf/type/__partition_msdos/man.text b/conf/type/__partition_msdos/man.text index 611451ed..c9ef0cf1 100644 --- a/conf/type/__partition_msdos/man.text +++ b/conf/type/__partition_msdos/man.text @@ -21,7 +21,7 @@ type:: OPTIONAL PARAMETERS ------------------- -device:: +partition:: defaults to object_id bootable:: mark partition as bootable, true or false, defaults to false diff --git a/conf/type/__partition_msdos/manifest b/conf/type/__partition_msdos/manifest index e5b04c02..0d73c405 100755 --- a/conf/type/__partition_msdos/manifest +++ b/conf/type/__partition_msdos/manifest @@ -18,8 +18,24 @@ # along with cdist. If not, see . # -type +# set defaults +if [ -f "$__object/parameter/partition" ]; then + partition="(cat "$__object/parameter/partition")" +else + partition="/$__object_id" + echo "$partition" > "$__object/parameter/partition" +fi +device="$(echo "$partition" | sed 's/[0-9]//g')" +echo "$device" > "$__object/parameter/device" +minor="$(echo "$partition" | sed 's/[^0-9]//g')" +echo "$minor" > "$__object/parameter/minor" -device -bootable -size +if [ ! -f "$__object/parameter/bootable" ]; then + echo "false" > "$__object/parameter/bootable" +fi +if [ ! -f "$__object/parameter/size" ]; then + echo "+" > "$__object/parameter/size" +fi + +# pull in the type that actually does something with the above parameters +require="$__self" __partition_msdos_apply diff --git a/conf/type/__partition_msdos/parameter/optional b/conf/type/__partition_msdos/parameter/optional index 612fe769..b2b0a4c2 100644 --- a/conf/type/__partition_msdos/parameter/optional +++ b/conf/type/__partition_msdos/parameter/optional @@ -1,3 +1,3 @@ -device +partition bootable size From 9d3fa5d4c7468142aca958a684c1425f663e2dc6 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Sat, 17 Sep 2011 08:55:24 +0200 Subject: [PATCH 0191/1024] new type __partition_msdos_apply Signed-off-by: Steven Armstrong --- .../explorer/partitions | 3 + .../type/__partition_msdos_apply/files/lib.sh | 58 +++++++++++ .../__partition_msdos_apply/gencode-remote | 99 +++++++++++++++++++ conf/type/__partition_msdos_apply/man.text | 42 ++++++++ conf/type/__partition_msdos_apply/singleton | 0 5 files changed, 202 insertions(+) create mode 100755 conf/type/__partition_msdos_apply/explorer/partitions create mode 100644 conf/type/__partition_msdos_apply/files/lib.sh create mode 100755 conf/type/__partition_msdos_apply/gencode-remote create mode 100644 conf/type/__partition_msdos_apply/man.text create mode 100644 conf/type/__partition_msdos_apply/singleton diff --git a/conf/type/__partition_msdos_apply/explorer/partitions b/conf/type/__partition_msdos_apply/explorer/partitions new file mode 100755 index 00000000..6be61af4 --- /dev/null +++ b/conf/type/__partition_msdos_apply/explorer/partitions @@ -0,0 +1,3 @@ +#!/bin/sh + +cat /proc/partitions diff --git a/conf/type/__partition_msdos_apply/files/lib.sh b/conf/type/__partition_msdos_apply/files/lib.sh new file mode 100644 index 00000000..944533a6 --- /dev/null +++ b/conf/type/__partition_msdos_apply/files/lib.sh @@ -0,0 +1,58 @@ +die() { + echo "[__partition_msdos_apply] $@" >&2 + exit 1 +} +debug() { + echo "[__partition_msdos_apply] $@" >&2 +} + +fdisk_command() { + local device=$1 + local cmd=$2 + + debug fdisk_command "running fdisk command '${cmd}' on device ${device}" + #echo -en "${cmd}\nw\n" | fdisk -c -u "$device" + return $? +} + +create_disklabel() { + local device=$1 + + debug create_disklabel "creating new msdos disklabel" + fdisk_command ${device} "o" + return $? +} + +create_partition() { + local device=$1 + local minor=$2 + local size=$3 + local type=$4 + local primary_count=$5 + + if [ "$type" = "extended" -o "$type" = "5" ]; then + # Extended partition + primary_extended="e\n" + first_minor="${minor}\n" + [ "${minor}" = "4" ] && first_minor="" + type_minor="${minor}\n" + [ "${minor}" = "1" ] && type_minor="" + type="5" + elif [ "${minor}" -lt "5" ]; then + primary_extended="p\n" + first_minor="${minor}\n" + [ "${minor}" = "4" ] && first_minor="" + type_minor="${minor}\n" + [ "${minor}" = "1" ] && type_minor="" + else + # Logical partitions + first_minor="${minor}\n" + type_minor="${minor}\n" + primary_extended="l\n" + [ "$primary_count" > "3" ] && primary_extended="" + fi + [ -n "${size}" ] && size="+${size}M" + fdisk_command ${device} "n\n${primary_extended}${first_minor}\n${size}\nt\n${type_minor}${type}\n" + return $? +} + diff --git a/conf/type/__partition_msdos_apply/gencode-remote b/conf/type/__partition_msdos_apply/gencode-remote new file mode 100755 index 00000000..faa712e7 --- /dev/null +++ b/conf/type/__partition_msdos_apply/gencode-remote @@ -0,0 +1,99 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +die() { + echo "[__partition_msdos_apply] $@" >&2 + exit 1 +} +debug() { + echo "[__partition_msdos_apply] $@" >&2 +} + +# Convert a size specifier 1G 100M or 50% into the corresponding numeric MB. +size_to_mb() { + local size=$1 + local available_size="$2" + + local number_suffix="$(echo ${size} | sed -e 's:\.[0-9]\+::' -e 's:\([0-9]\+\)\([MmGg%]\)[Bb]\?:\1|\2:')" + local number="$(echo ${number_suffix} | cut -d '|' -f1)" + local suffix="$(echo ${number_suffix} | cut -d '|' -f2)" + + case "$suffix" in + M|m) + size="$number" + ;; + G|g) + size="$(( $number * 1024 ))" + ;; + %) + size="$(( $available_size * $number / 100 ))" + ;; + *) + size="-1" + esac + echo "$size" +} + +# include function library for use on target +cat "$__type/files/lib.sh" + +partitions="$__object/explorer/partitions" +objects=$(find "$__global/object/__partition_msdos" -path "*.cdist") +current_device="" +available_size= +primary_count=0 +for object in $objects; do + device="$(cat "$object/parameter/device")" + if [ "$current_device" != "$device" ]; + echo "create_disklabel $device" + current_device="$device" + device_name=$(echo ${device} | sed -e 's:^/dev/::;s:/:\\/:g') + available_size=$(( $(awk "/${device_name}\$/ { print $3; }" "$partitions") / 1024)) + # make sure we don't go past the end of the drive + available_size=$((device_size - 2)) + primary_count=0 + fi + + type="$(cat "$object/parameter/type")" + partition="$(cat "$object/parameter/partition")" + minor="$(cat "$object/parameter/minor")" + + if [ "${minor}" -lt "5" ]; then + primary_count=$(( $primary_count + 1 )) + fi + bootable="$(cat "$object/parameter/bootable")" + size="$(cat "$object/parameter/size")" + if [ "$size" = "+" ]; then + # use rest of device + partition_size="" + available_size=0 + else + partition_size=$(size_to_mb "$size" "$available_size") + available_size="$(( $available_size - $partition_size ))" + fi + + [ "$partition_size" = "-1" ] && die "could not translate size '$size' to a usable value" + debug "primary_count=$primary_count" + debug "available_size=$available_size" + debug "current_device=$current_device" + + echo "create_partition $device $minor $partition_size $type $primary_count" +done + diff --git a/conf/type/__partition_msdos_apply/man.text b/conf/type/__partition_msdos_apply/man.text new file mode 100644 index 00000000..4d4f127c --- /dev/null +++ b/conf/type/__partition_msdos_apply/man.text @@ -0,0 +1,42 @@ +cdist-type__partition_msdos_apply(7) +==================================== +Steven Armstrong + + +NAME +---- +cdist-type__partition_msdos_apply + + +DESCRIPTION +----------- +Create the partitions defined with __partition_msdos + + +REQUIRED PARAMETERS +------------------- +None + + +OPTIONAL PARAMETERS +------------------- +None. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +__partition_msdos_apply +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- cdist-type__partition_msdos_apply(7) + +COPYING +------- +Copyright \(C) 2011 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__partition_msdos_apply/singleton b/conf/type/__partition_msdos_apply/singleton new file mode 100644 index 00000000..e69de29b From 16d86dcf04712d2d1fe7f4e7fe123190e6c7f198 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Sat, 17 Sep 2011 09:26:09 +0200 Subject: [PATCH 0192/1024] +debug, -type, -bug Signed-off-by: Steven Armstrong --- .../__partition_msdos_apply/gencode-remote | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/conf/type/__partition_msdos_apply/gencode-remote b/conf/type/__partition_msdos_apply/gencode-remote index faa712e7..d352abdb 100755 --- a/conf/type/__partition_msdos_apply/gencode-remote +++ b/conf/type/__partition_msdos_apply/gencode-remote @@ -61,14 +61,17 @@ available_size= primary_count=0 for object in $objects; do device="$(cat "$object/parameter/device")" - if [ "$current_device" != "$device" ]; + if [ "$current_device" != "$device" ]; then echo "create_disklabel $device" current_device="$device" device_name=$(echo ${device} | sed -e 's:^/dev/::;s:/:\\/:g') - available_size=$(( $(awk "/${device_name}\$/ { print $3; }" "$partitions") / 1024)) + available_size=$(( $(awk "/${device_name}\$/ { print \$3; }" "$partitions") / 1024)) # make sure we don't go past the end of the drive - available_size=$((device_size - 2)) + available_size=$((available_size - 2)) primary_count=0 + debug "----- $device" + debug "current_device=$current_device" + debug "available_size=$available_size" fi type="$(cat "$object/parameter/type")" @@ -90,9 +93,17 @@ for object in $objects; do fi [ "$partition_size" = "-1" ] && die "could not translate size '$size' to a usable value" + debug "----- $partition" debug "primary_count=$primary_count" - debug "available_size=$available_size" debug "current_device=$current_device" + debug "device=$device" + debug "type=$type" + debug "partition=$partition" + debug "minor=$minor" + debug "bootable=$bootable" + debug "size=$size" + debug "partition_size=$partition_size" + debug "available_size=$available_size" echo "create_partition $device $minor $partition_size $type $primary_count" done From a3086ae79580f8633c986e133cccb8d01a3ab142 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Sat, 17 Sep 2011 09:27:19 +0200 Subject: [PATCH 0193/1024] make it actually write the partition Signed-off-by: Steven Armstrong --- conf/type/__partition_msdos_apply/files/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__partition_msdos_apply/files/lib.sh b/conf/type/__partition_msdos_apply/files/lib.sh index 944533a6..0e9705d9 100644 --- a/conf/type/__partition_msdos_apply/files/lib.sh +++ b/conf/type/__partition_msdos_apply/files/lib.sh @@ -11,7 +11,7 @@ fdisk_command() { local cmd=$2 debug fdisk_command "running fdisk command '${cmd}' on device ${device}" - #echo -en "${cmd}\nw\n" | fdisk -c -u "$device" + echo -en "${cmd}\nw\n" | fdisk -c -u "$device" return $? } From a9bcec7fbe9f4ca7ad901cfc3e14dc6a640640cc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 18 Sep 2011 20:50:07 +0200 Subject: [PATCH 0194/1024] also catch OSError from subprocess Signed-off-by: Nico Schottelius --- bin/cdist | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/cdist b/bin/cdist index f7ad2f72..fce96099 100755 --- a/bin/cdist +++ b/bin/cdist @@ -198,6 +198,8 @@ class Cdist: script_fd.close() self.exit_error("Command failed (shell): " + " ".join(*args)) + except OSError as error: + self.exit_error(" ".join(*args) + ": " + error.args[1]) def run_or_fail(self, *args, **kargs): if "remote" in kargs: @@ -211,6 +213,9 @@ class Cdist: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: self.exit_error("Command failed: " + " ".join(*args)) + except OSError as error: + self.exit_error(" ".join(*args) + ": " + error.args[1]) + def remove_remote_dir(self, destination): self.run_or_fail(["rm", "-rf", destination], remote=True) From 606c47906708731f8b351ff5249e71d185d7d4b6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 18 Sep 2011 20:57:13 +0200 Subject: [PATCH 0195/1024] changes for 2.0.1 Signed-off-by: Nico Schottelius --- doc/changelog | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/changelog b/doc/changelog index 50409cac..cc6aa78b 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,6 +1,9 @@ -2.0.0: +2.0.1: + * Bugfix cdist: Always print source of error in case of exec errors + +2.0.0: 2011-09-16 * New Type: __package_rubygem (Chase Allen James) - * __self replaced by __object_fq (or so) + * __self replaced by __object_fq * Rewrote cdist in Python 1.7.1: 2011-07-26 From e0030947e4b3bd6e01264919b27a81dc79a79be7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 18 Sep 2011 21:04:23 +0200 Subject: [PATCH 0196/1024] document TMP variable Signed-off-by: Nico Schottelius --- doc/man/man1/cdist.text | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/man/man1/cdist.text b/doc/man/man1/cdist.text index 5a45b8c1..c43e4e1c 100644 --- a/doc/man/man1/cdist.text +++ b/doc/man/man1/cdist.text @@ -82,6 +82,14 @@ cdist --version -------------------------------------------------------------------------------- +ENVIRONMENT +----------- +TMP:: + Setup the base directory for the temporary directory. + See http://docs.python.org/py3k/library/tempfile.html for + more information. This is rather useful, if the standard + directory used does not allow executables. + SEE ALSO -------- - cdist(7) From 9de1d9ce2017e27776fe817a8a55952b769586ea Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Sep 2011 00:24:17 +0200 Subject: [PATCH 0197/1024] write parameters to object Signed-off-by: Nico Schottelius --- bin/cdist | 46 +++++++++++++++++++++++++++---------------- doc/dev/todo/niconext | 2 ++ 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/bin/cdist b/bin/cdist index 9094a5f8..1d130eca 100755 --- a/bin/cdist +++ b/bin/cdist @@ -77,6 +77,9 @@ def file_to_list(filename): return lines +def exit_error(*args): + log.error(*args) + sys.exit(1) class Cdist: """Cdist main class to hold arbitrary data""" @@ -144,10 +147,6 @@ class Cdist: shutil.rmtree(self.cache_dir) shutil.move(self.temp_dir, self.cache_dir) - def exit_error(self, *args): - log.error(*args) - sys.exit(1) - def remote_mkdir(self, directory): """Create directory on remote side""" self.run_or_fail(["mkdir", "-p", directory], remote=True) @@ -182,9 +181,9 @@ class Cdist: print(script_fd.read()) script_fd.close() - self.exit_error("Command failed (shell): " + " ".join(*args)) + exit_error("Command failed (shell): " + " ".join(*args)) except OSError as error: - self.exit_error(" ".join(*args) + ": " + error.args[1]) + exit_error(" ".join(*args) + ": " + error.args[1]) def run_or_fail(self, *args, **kargs): if "remote" in kargs: @@ -197,9 +196,9 @@ class Cdist: try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: - self.exit_error("Command failed: " + " ".join(*args)) + exit_error("Command failed: " + " ".join(*args)) except OSError as error: - self.exit_error(" ".join(*args) + ": " + error.args[1]) + exit_error(" ".join(*args) + ": " + error.args[1]) def remove_remote_dir(self, destination): @@ -365,7 +364,7 @@ class Cdist: """Run global explorers""" explorers = self.list_global_explorers() if(len(explorers) == 0): - self.exit_error("No explorers found in", self.global_explorer_dir) + exit_error("No explorers found in", self.global_explorer_dir) self.transfer_global_explorers() for explorer in explorers: @@ -639,14 +638,23 @@ def emulator(): if os.path.isfile(os.path.join(type_dir, "singleton")): object_id = "singleton" else: - object_id = args.object_id + object_id = args.object_id[0] del args.object_id - print(args) + # FIXME: / hardcoded - better portable solution available? + if object_id[0] == '/': + object_id = object_id[1:] - print(object_id) - param_out_dir = os.path.join(global_dir, type, - object_id, DOT_CDIST, "parameter") + log.debug(args) + + object_dir = os.path.join(global_dir, type, + object_id, DOT_CDIST) + param_out_dir = os.path.join(object_dir, "parameter") + + try: + os.makedirs(param_out_dir, exist_ok=True) + except OSError as error: + exit_error(param_out_dir + ": " + error.args[1]) # Record parameter params = vars(args) @@ -654,16 +662,19 @@ def emulator(): value = getattr(args, param) if value: file = os.path.join(param_out_dir, param) - print(file + "<-" + param + " = " + value) - param_fd = open(file) + log.debug(file + "<-" + param + " = " + value) + param_fd = open(file, "w") param_fd.writelines(value) param_fd.close() - # Record requirements if "__require" in os.environ: requirements = os.environ['__require'] + print(object_id + ":Writing requirements: " + requirements) + require_fd = open(os.path.join(object_dir, "require"), "a") + require_fd.writelines(requirements.split(" ")) + require_fd.close() # Merge / mv object into tree @@ -672,6 +683,7 @@ def emulator(): # write to .source? # sys.exit(1) + print("Finished " + type + "/" + object_id + repr(params)) def commandline(): diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index a74862f4..231489e9 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -33,3 +33,5 @@ - Allow manifest to be read from stdin - Create new video for cdist 2.0.0 http://www.youtube.com/watch?v=PRMjzy48eTI + +- Setup __debug, if -d is given, so other tools can reuse it From b7b48414e1b3a2684dc731208bc0924671f01a4b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Sep 2011 00:32:33 +0200 Subject: [PATCH 0198/1024] use subdirectory, record source Signed-off-by: Nico Schottelius --- bin/cdist | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index 1d130eca..84ebd5f2 100755 --- a/bin/cdist +++ b/bin/cdist @@ -647,7 +647,7 @@ def emulator(): log.debug(args) - object_dir = os.path.join(global_dir, type, + object_dir = os.path.join(global_dir, "object", type, object_id, DOT_CDIST) param_out_dir = os.path.join(object_dir, "parameter") @@ -676,11 +676,13 @@ def emulator(): require_fd.writelines(requirements.split(" ")) require_fd.close() - # Merge / mv object into tree + # FIXME: Merge / mv object into tree # Record / Append source source = os.environ['__cdist_manifest'] - # write to .source? + source_fd = open(os.path.join(object_dir, "source"), "a") + source_fd.writelines(source) + source_fd.close() # sys.exit(1) print("Finished " + type + "/" + object_id + repr(params)) From 4e8f99b01daa49daa80a10da1546beeda799d23f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Sep 2011 00:36:35 +0200 Subject: [PATCH 0199/1024] almost completly implemented type emulator in python Signed-off-by: Nico Schottelius --- bin/cdist | 1 + lib/cdist-type-emulator | 182 ---------------------------------------- 2 files changed, 1 insertion(+), 182 deletions(-) delete mode 100755 lib/cdist-type-emulator diff --git a/bin/cdist b/bin/cdist index 84ebd5f2..57c889f1 100755 --- a/bin/cdist +++ b/bin/cdist @@ -645,6 +645,7 @@ def emulator(): if object_id[0] == '/': object_id = object_id[1:] + # FIXME: verify object id log.debug(args) object_dir = os.path.join(global_dir, "object", type, diff --git a/lib/cdist-type-emulator b/lib/cdist-type-emulator deleted file mode 100755 index 8ff190ad..00000000 --- a/lib/cdist-type-emulator +++ /dev/null @@ -1,182 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Wrapper script that generates cconfig from arguments -# -# This script will be called everytime the manifest decides to create -# a new type -# - -. cdist-config -set -u - -################################################################################ -# Prepare object and type -# - -__cdist_type="$__cdist_myname" - -# Find out whether type is a singleton or regular type -if [ -f "$(__cdist_type_singleton "$__cdist_type")" ]; then - __cdist_object_id="$__cdist_name_singleton" -else - [ $# -ge 1 ] || __cdist_usage " " - __cdist_object_id="$1"; shift -fi - -# Verify object id -__cdist_object_id_sane=$(echo "$__cdist_object_id" | grep "^${__cdist_sane_regexp}\$") -if [ -z "$__cdist_object_id_sane" ]; then - __cdist_usage "Insane object id, ${__cdist_object_id}." -fi - -# Prevent double slash if id begins with / -if [ "$(echo $__cdist_object_id | grep "^/")" ]; then - __cdist_object_self="${__cdist_type}${__cdist_object_id}" -else - __cdist_object_self="${__cdist_type}/${__cdist_object_id}" -fi -################################################################################ -# Internal quirks -# - -# Append id for error messages -__cdist_myname="$__cdist_myname ($__cdist_object_id)" - -################################################################################ -# Create object in tmpdir first -# - -# Save original destination -__cdist_out_object_dir_orig="$__cdist_out_object_dir" - -# Store to tmp now -__cdist_out_object_dir="$__cdist_tmp_dir" - -__cdist_new_object_dir="$(__cdist_object_dir "$__cdist_object_self")" - -# Initialise object -mkdir -p "${__cdist_new_object_dir}" - -# Record parameter -__cdist_parameter_dir="$(__cdist_object_parameter_dir "$__cdist_object_self")" -mkdir -p "${__cdist_parameter_dir}" - -while [ $# -gt 0 ]; do - opt="$1"; shift - - echo "$opt" | grep -q "^--${__cdist_sane_regexp}\$" || \ - __cdist_usage "Provide sane options" - - opt_file="${opt#--}" - - [ $# -ge 1 ] || __cdist_usage "Missing value for $opt" - - value="$1"; shift - - echo "${value}" > "${__cdist_parameter_dir}/${opt_file}" -done - -# Record requirements -# it's fine, if it's not set -set +u -for requirement in $require; do - echo $requirement >> "$(__cdist_object_require "$__cdist_object_self")" - __cdist_echo info "Recording requirement $requirement" -done -set -u - -################################################################################ -# Check newly created object -# - -# -# Ensure required parameters are given -# -if [ -f "$(__cdist_type_parameter_required "$__cdist_type")" ]; then - while read required; do - if [ ! -f "${__cdist_parameter_dir}/${required}" ]; then - __cdist_usage "Missing required parameter $required" - fi - done < "$(__cdist_type_parameter_required "$__cdist_type")" -fi - -# -# Ensure that only optional or required parameters are given -# - -if [ -f "$(__cdist_type_parameter_optional "$__cdist_type")" ]; then - cat "$(__cdist_type_parameter_optional "$__cdist_type")" > \ - "$__cdist_tmp_file" -fi - -if [ -f "$(__cdist_type_parameter_required "$__cdist_type")" ]; then - cat "$(__cdist_type_parameter_required "$__cdist_type")" >> \ - "$__cdist_tmp_file" -fi - -cd "$__cdist_parameter_dir" -for parameter in $(ls -1); do - is_valid=$(grep "^$parameter\$" "$__cdist_tmp_file") - - [ "$is_valid" ] || __cdist_usage "Unknown parameter $parameter" -done - -################################################################################ -# Merge object -# -# Restore original destination -__cdist_out_object_dir="$__cdist_out_object_dir_orig" - -__cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")" - -# -# If the object already exists and is exactly the same, merge it. Otherwise fail. -# -if [ -e "${__cdist_object_dir}" ]; then - # Allow diff to fail - set +e - diff -ru "${__cdist_new_object_dir}/${__cdist_name_parameter}" \ - "${__cdist_object_dir}/${__cdist_name_parameter}" \ - > "$__cdist_tmp_file"; ret=$? - set -e - - if [ "$ret" != 0 ]; then - # Go to standard error - exec >&2 - echo "${__cdist_object_self} already exists differently." - echo "Recorded source(s):" - __cdist_object_source "${__cdist_object_dir}" - echo "Differences:" - cat "$__cdist_tmp_file" - __cdist_exit_err "Aborting due to object conflict." - fi -else - # - # Move object into tree: - # Create full path minus .cdist and move .cdist - # - __cdist_new_object_base_dir="$(__cdist_object_base_dir "$__cdist_object_self")" - mkdir -p "$__cdist_new_object_base_dir" - mv "$__cdist_new_object_dir" "$__cdist_new_object_base_dir" -fi - -# Add "I was here message" -__cdist_object_source_add "${__cdist_object_dir}" From ce16725567b8733fa59a15d6e1745af8e1632c81 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Sep 2011 00:37:39 +0200 Subject: [PATCH 0200/1024] todo for 2.0.1 Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 231489e9..84745512 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,3 +1,5 @@ +2.0.1: + - Rewrite cdist-type-emulator - Remove legacy code in cdist - Remove cdist-config @@ -9,6 +11,10 @@ Test: __cdist_type_base_dir=$(pwd -P)/conf/type __file +- Fix / rewrite cdist-quickstart + +-------------------------------------------------------------------------------- + - Initial install support - setup $__install = "yes" for manifest(s), gencode-* From de2a216ee668b8815ebb731bc0f544a3b988bf49 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Sep 2011 00:39:43 +0200 Subject: [PATCH 0201/1024] cleanup bin/, move quickstart to mandir Signed-off-by: Nico Schottelius --- bin/cdist-config | 438 ------------------ .../man/man7/cdist-quickstart.text | 0 2 files changed, 438 deletions(-) delete mode 100644 bin/cdist-config rename bin/cdist-quickstart => doc/man/man7/cdist-quickstart.text (100%) diff --git a/bin/cdist-config b/bin/cdist-config deleted file mode 100644 index f7fb5ac0..00000000 --- a/bin/cdist-config +++ /dev/null @@ -1,438 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -__cdist_version="1.7.0" - -# Fail if something bogus is going on -set -u - -################################################################################ -# cconf standard vars prefixed with cdist - -__cdist_pwd="$(pwd -P)" -__cdist_mydir="${0%/*}"; -__cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)" -__cdist_myname=${0##*/}; -__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" - -################################################################################ -# Names / Constants -# -# Most values can be overriden from outside, so you can -# customise paths as you like (for distributors, geeks and hackers) -# - -: ${__cdist_name_bin:=bin} -: ${__cdist_name_cache:=cache} -: ${__cdist_name_code:=code} -: ${__cdist_name_conf_dir:=conf} -: ${__cdist_name_dot_cdist:=.cdist} -: ${__cdist_name_explorer:=explorer} -: ${__cdist_name_gencode:=gencode} -: ${__cdist_name_gencode_local:=local} -: ${__cdist_name_gencode_remote:=remote} -: ${__cdist_name_global:=global} -: ${__cdist_name_host:=host} -: ${__cdist_name_init:=init} -: ${__cdist_name_manifest:=manifest} -: ${__cdist_name_object:=object} -: ${__cdist_name_object_finished:=done} -: ${__cdist_name_object_prepared:=prepared} -: ${__cdist_name_object_id:=object_id} -: ${__cdist_name_object_source:=source} -: ${__cdist_name_objects_created:=.objects_created} -: ${__cdist_name_out_dir:=out} -: ${__cdist_name_parameter:=parameter} -: ${__cdist_name_parameter_required:=required} -: ${__cdist_name_parameter_optional:=optional} -: ${__cdist_name_require:=require} -: ${__cdist_name_self:=self} -: ${__cdist_name_singleton:=singleton} -: ${__cdist_name_target_host:=target_host} -: ${__cdist_name_target_user:=target_user} -: ${__cdist_name_type:=type} -: ${__cdist_name_type_bin:=type_bin} -: ${__cdist_name_type_explorer:=type_explorer} -: ${__cdist_name_type_explorer_pushed:=.explorer_pushed} - -# Used for IDs: Allow everything not starting with - and . -: ${__cdist_sane_regexp:=[^-\.].*} - -# Default remote user -: ${__cdist_remote_user:=root} - - -################################################################################ -# Exported variable names (usable for non core -# -: ${__cdist_name_var_explorer:=__$__cdist_name_explorer} -: ${__cdist_name_var_type_explorer:=__$__cdist_name_type_explorer} -: ${__cdist_name_var_global:=__$__cdist_name_global} -: ${__cdist_name_var_manifest:=__$__cdist_name_manifest} -: ${__cdist_name_var_target_host:=__$__cdist_name_target_host} -: ${__cdist_name_var_target_user:=__$__cdist_name_target_user} -: ${__cdist_name_var_object:=__$__cdist_name_object} -: ${__cdist_name_var_object_id:=__$__cdist_name_object_id} -: ${__cdist_name_var_self:=__$__cdist_name_self} -: ${__cdist_name_var_type:=__$__cdist_name_type} - - -################################################################################ -# Tempfiles -# -: ${__cdist_tmp_base_dir=/tmp} -__cdist_tmp_dir=$(mktemp -d "$__cdist_tmp_base_dir/cdist.XXXXXXXXXXXX") -__cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX") - -################################################################################ -# Local Base -# -: ${__cdist_local_base_dir:=$__cdist_tmp_dir} - -# Cache may *NOT* be below __cdist_local_base_dir! -: ${__cdist_local_base_cache_dir:=$__cdist_abs_mydir/../$__cdist_name_cache} - -: ${__cdist_conf_dir:="$(cd "$__cdist_abs_mydir/../conf" && pwd -P)"} - -: ${__cdist_explorer_dir:=$__cdist_conf_dir/$__cdist_name_explorer} -: ${__cdist_manifest_dir:=$__cdist_conf_dir/$__cdist_name_manifest} -: ${__cdist_manifest_init:=$__cdist_manifest_dir/$__cdist_name_init} -: ${__cdist_type_dir:=$__cdist_conf_dir/$__cdist_name_type} - -################################################################################ -# Local output -# -: ${__cdist_out_dir:=$__cdist_local_base_dir/$__cdist_name_out_dir} -: ${__cdist_out_explorer_dir:=$__cdist_out_dir/$__cdist_name_explorer} -: ${__cdist_out_object_dir:=$__cdist_out_dir/$__cdist_name_object} -: ${__cdist_out_type_dir:=$__cdist_out_dir/$__cdist_name_type} -: ${__cdist_out_type_bin_dir:=$__cdist_out_dir/$__cdist_name_type_bin} - -: ${__cdist_objects_created:=$__cdist_out_object_dir/$__cdist_name_objects_created} - -################################################################################ -# Remote base -# -: ${__cdist_remote_base_dir:=/var/lib/cdist} -: ${__cdist_remote_bin_dir:=$__cdist_remote_base_dir/$__cdist_name_bin} -: ${__cdist_remote_conf_dir:=$__cdist_remote_base_dir/$__cdist_name_conf_dir} - -: ${__cdist_remote_explorer_dir:=$__cdist_remote_conf_dir/$__cdist_name_explorer} -: ${__cdist_remote_type_dir:=$__cdist_remote_conf_dir/$__cdist_name_type} - -################################################################################ -# Remote output -# -: ${__cdist_remote_out_dir:=$__cdist_remote_base_dir/$__cdist_name_out_dir} -: ${__cdist_remote_out_explorer_dir:=$__cdist_remote_out_dir/$__cdist_name_explorer} -: ${__cdist_remote_out_object_dir:=$__cdist_remote_out_dir/$__cdist_name_object} - - -################################################################################ -# Internal functions -# -__cdist_echo() -{ - __cdist_echo_type="$1"; shift - - set +u - if [ "$__cdist_object_self" ]; then - __cdist_echo_prefix="${__cdist_object_self}:" - else - __cdist_echo_prefix="core: " - fi - set -u - - case "$__cdist_echo_type" in - debug) - set +u - if [ "$__cdist_debug" ]; then - echo $__cdist_echo_prefix "Debug: $@" - fi - set -u - ;; - info) - echo $__cdist_echo_prefix "$@" - ;; - warn) - echo $__cdist_echo_prefix "Warning: $@" - ;; - error) - echo $__cdist_echo_prefix "Error: $@" >&2 - ;; - *) - echo "CORE BUG, who created the broken commit in $0?" >&2 - exit 23 - ;; - esac -} - -__cdist_exec_fail_on_error() -{ - set +e - sh -e "$@" - if [ "$?" -ne 0 ]; then - __cdist_echo error "$1 exited non-zero" - __cdist_echo warn "Faulty code:" - cat "$1" - __cdist_exit_err "Aborting due to non-zero exit code." - fi -} - -__cdist_exit_err() -{ - __cdist_echo error "$@" - exit 1 -} - -__cdist_usage() -{ - __cdist_exit_err "$__cdist_myname: $@" -} - -__cdist_init_deploy() -{ - __cdist_echo info "Creating clean directory structure " - - # Ensure there is no old stuff, neither local nor remote - rm -rf "$__cdist_local_base_dir" - ssh "${__cdist_remote_user}@$1" "rm -rf ${__cdist_remote_base_dir}" - - # Init base - mkdir -p "$__cdist_local_base_dir" - ssh "${__cdist_remote_user}@$1" "mkdir -p ${__cdist_remote_base_dir}" - - # Link configuration source directory - consistent with remote - ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir" -} - -################################################################################ -# Cache -# -__cdist_cache_dir() -{ - cd "${__cdist_local_base_cache_dir}" && pwd -P -} - -__cdist_host_cache_dir() -{ - echo "$(__cdist_cache_dir)/$1" -} - -################################################################################ -# Object -# - -__cdist_object_code() -{ - echo "$(__cdist_object_dir "$1")/${__cdist_name_code}-$2" -} - -__cdist_object_prepared() -{ - echo "$(__cdist_object_dir "$1")/${__cdist_name_object_prepared}" -} - -__cdist_object_finished() -{ - echo "$(__cdist_object_dir "$1")/${__cdist_name_object_finished}" -} - -__cdist_object_dir() -{ - echo "$(__cdist_object_base_dir "$1")/${__cdist_name_dot_cdist}" -} - -__cdist_object_base_dir() -{ - echo "${__cdist_out_object_dir}/$1" -} - - -__cdist_object_id_from_object() -{ - echo "${1#*/}" -} - -# Find objects, remove ./ and /MARKER -__cdist_object_list() -{ - local basedir="$1"; shift - - # Use subshell to prevent changing cwd in program - ( - cd "${basedir}" - - find . -name "$__cdist_name_dot_cdist" | \ - sed -e 's;^./;;' -e "s;/${__cdist_name_dot_cdist}\$;;" - ) -} - -__cdist_object_parameter_dir() -{ - echo "$(__cdist_object_dir "$1")/${__cdist_name_parameter}" -} - -__cdist_object_require() -{ - echo "$(__cdist_object_dir "$1")/${__cdist_name_require}" -} - -__cdist_object_source_name() -{ - echo "$1/${__cdist_name_object_source}" -} - -__cdist_object_source() -{ - cat "$(__cdist_object_source_name "$1")" -} - -__cdist_object_source_add() -{ - echo "$__cdist_manifest" >> "$(__cdist_object_source_name "$1")" -} - -__cdist_object_type_explorer_dir() -{ - echo "$(__cdist_object_dir "$1")/${__cdist_name_explorer}" -} - -################################################################################ -# Remote -# - -__cdist_remote_object_base_dir() -{ - echo "${__cdist_remote_out_object_dir}/$1" -} - -__cdist_remote_object_dir() -{ - echo "$(__cdist_remote_object_base_dir "$1")/${__cdist_name_dot_cdist}" -} - -__cdist_remote_object_parameter_dir() -{ - echo "$(__cdist_remote_object_dir "$1")/${__cdist_name_parameter}" -} - -__cdist_remote_object_type_explorer_dir() -{ - echo "$(__cdist_remote_object_dir "$1")/${__cdist_name_explorer}" -} - - -__cdist_remote_type_explorer_dir() -{ - echo "${__cdist_remote_type_dir}/$1/${__cdist_name_explorer}" -} - - -################################################################################ -# Traps -# -__cdist_tmp_removal() -{ - rm -rf "${__cdist_tmp_dir}" -} - -# Does not work in children, will be called again in every script! -# Use only in interactive "front end" scripts -__cdist_kill_on_interrupt() -{ - __cdist_tmp_removal - kill 0 - exit 1 -} - -# Remove tempfiles at normal exit -trap __cdist_tmp_removal EXIT - - -################################################################################ -# Type -# -__cdist_type_dir() -{ - echo "${__cdist_type_dir}/$1" -} - -__cdist_type_explorer_dir() -{ - echo "${__cdist_type_dir}/$1/${__cdist_name_explorer}" -} - -__cdist_type_from_object() -{ - echo "${1%%/*}" -} - -__cdist_type_has_explorer() -{ - # We only create output, if there's at least one explorer - # and can thus be used as a boolean ;-) - if [ -d "$(__cdist_type_explorer_dir "$1")" ]; then - ls -1 "$(__cdist_type_explorer_dir "$1")" - fi -} - -__cdist_type_explorer_pushed() -{ - [ -f "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" ] \ - && grep -q "$1" "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" -} - -__cdist_type_explorer_pushed_add() -{ - [ -d "$__cdist_out_type_dir" ] || mkdir "$__cdist_out_type_dir" - echo "$1" >> "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" -} - -__cdist_type_gencode() -{ - echo "${__cdist_type_dir}/$1/${__cdist_name_gencode}-$2" -} - -__cdist_type_manifest() -{ - echo "${__cdist_type_dir}/$1/${__cdist_name_manifest}" -} - -__cdist_type_parameter_dir() -{ - echo "$(__cdist_type_dir "$1")/${__cdist_name_parameter}" -} - -__cdist_type_parameter_optional() -{ - echo "$(__cdist_type_parameter_dir "$1")/$__cdist_name_parameter_optional" -} - -__cdist_type_parameter_required() -{ - echo "$(__cdist_type_parameter_dir "$1")/$__cdist_name_parameter_required" -} - -__cdist_type_singleton() -{ - echo "${__cdist_type_dir}/$1/${__cdist_name_singleton}" -} diff --git a/bin/cdist-quickstart b/doc/man/man7/cdist-quickstart.text similarity index 100% rename from bin/cdist-quickstart rename to doc/man/man7/cdist-quickstart.text From 9e99d420b688200df9abf742a2d36444b86c13d5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Sep 2011 00:52:09 +0200 Subject: [PATCH 0202/1024] in theory implement double definition strategy in new type emulator Signed-off-by: Nico Schottelius --- bin/cdist | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/bin/cdist b/bin/cdist index 57c889f1..adb8bd78 100755 --- a/bin/cdist +++ b/bin/cdist @@ -613,6 +613,7 @@ def emulator(): type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type) param_dir = os.path.join(type_dir, "parameter") global_dir = os.environ['__global'] + object_source = os.environ['__cdist_manifest'] parser = argparse.ArgumentParser(add_help=False) @@ -652,10 +653,20 @@ def emulator(): object_id, DOT_CDIST) param_out_dir = os.path.join(object_dir, "parameter") - try: - os.makedirs(param_out_dir, exist_ok=True) - except OSError as error: - exit_error(param_out_dir + ": " + error.args[1]) + object_source_file = os.path.join(object_dir, "source") + + if os.path.exists(param_out_dir): + object_exists = True + old_object_source_fd = open(object_source_file, "r") + old_object_source = old_object_source_fd.readlines() + old_object_source_fd.close() + + else: + object_exists = False + try: + os.makedirs(param_out_dir, exist_ok=True) + except OSError as error: + exit_error(param_out_dir + ": " + error.args[1]) # Record parameter params = vars(args) @@ -664,10 +675,26 @@ def emulator(): if value: file = os.path.join(param_out_dir, param) log.debug(file + "<-" + param + " = " + value) - param_fd = open(file, "w") - param_fd.writelines(value) - param_fd.close() + # Already exists, verify all parameter are the same + if object_exists: + if not os.path.isfile(file): + print("New parameter + " + param + "specified, aborting") + print("Source = " + old_object_source + "new =" + object_source) + sys.exit(1) + else: + param_fd = open(file, "r") + param_old = param_fd.realines() + param_fd.close() + + if(param_old != param): + print("Parameter differs: " + param_old + "vs," + param) + print("Source = " + old_object_source + "new =" + object_source) + sys.exit(1) + else: + param_fd = open(file, "w") + param_fd.writelines(value) + param_fd.close() # Record requirements if "__require" in os.environ: @@ -677,12 +704,9 @@ def emulator(): require_fd.writelines(requirements.split(" ")) require_fd.close() - # FIXME: Merge / mv object into tree - # Record / Append source - source = os.environ['__cdist_manifest'] source_fd = open(os.path.join(object_dir, "source"), "a") - source_fd.writelines(source) + source_fd.writelines(object_source) source_fd.close() # sys.exit(1) From f8c49708cf7cb24dc3e1afbce8ff103999b5ef71 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Sep 2011 00:53:06 +0200 Subject: [PATCH 0203/1024] contrib is not contrib but other stuff this also help tab expansion Signed-off-by: Nico Schottelius --- .../examples/nico/conf/type/__nico_afs/files/afs/CellServDB | 0 .../examples/nico/conf/type/__nico_afs/files/afs/ThisCell | 0 .../examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf | 0 .../examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub | 0 .../examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub | 0 .../examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub | 0 .../examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub | 0 .../examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub | 0 {contrib => other}/examples/nico/conf/type/__nico_afs/manifest | 0 {contrib => other}/examples/nico/conf/type/__nico_afs/singleton | 0 .../examples/nico/conf/type/__nico_desktop/files/hostname | 0 .../examples/nico/conf/type/__nico_desktop/files/slim-preseed | 0 .../examples/nico/conf/type/__nico_desktop/manifest | 0 .../examples/nico/conf/type/__nico_desktop/parameter/required | 0 .../examples/nico/conf/type/__nico_desktop/singleton | 0 .../examples/nico/conf/type/__nico_mpd/files/slim-preseed | 0 {contrib => other}/examples/nico/conf/type/__nico_mpd/manifest | 0 .../examples/nico/conf/type/__nico_mpd/parameter/required | 0 {contrib => other}/examples/nico/conf/type/__nico_mpd/singleton | 0 .../examples/nico/conf/type/__nico_network/files/interfaces-eth0 | 0 .../examples/nico/conf/type/__nico_network/files/interfaces-wlan0 | 0 .../examples/nico/conf/type/__nico_network/manifest | 0 .../examples/nico/conf/type/__nico_network/parameter/required | 0 .../examples/nico/conf/type/__nico_network/singleton | 0 .../examples/nico/conf/type/__nico_nfs_client/files/slim-preseed | 0 .../examples/nico/conf/type/__nico_nfs_client/manifest | 0 .../examples/nico/conf/type/__nico_nfs_client/singleton | 0 .../examples/nico/conf/type/__nico_notebook/manifest | 0 .../examples/nico/conf/type/__nico_notebook/singleton | 0 .../examples/nico/conf/type/__nico_packages/manifest | 0 .../examples/nico/conf/type/__nico_packages/singleton | 0 .../examples/nico/conf/type/__nico_sudo/files/sudo-nico | 0 {contrib => other}/examples/nico/conf/type/__nico_sudo/manifest | 0 .../examples/nico/conf/type/__nico_sudo/parameter/gencode | 0 .../examples/nico/conf/type/__nico_sudo/parameter/manifest | 0 .../examples/nico/conf/type/__nico_sudo/parameter/optional | 0 .../examples/nico/conf/type/__nico_sudo/parameter/required | 0 {contrib => other}/examples/nico/conf/type/__nico_sudo/singleton | 0 .../examples/nico/conf/type/__nico_tee/files/99-apt-nico | 0 .../examples/nico/conf/type/__nico_tee/files/hostname | 0 {contrib => other}/examples/nico/conf/type/__nico_tee/manifest | 0 {contrib => other}/examples/nico/conf/type/__nico_tee/singleton | 0 .../types_pending_inclusion/__package_zypper/README | 0 .../types_pending_inclusion/__package_zypper/explorer/pkg_version | 0 .../types_pending_inclusion/__package_zypper/gencode-remote | 0 .../types_pending_inclusion/__package_zypper/man.text | 0 .../types_pending_inclusion/__package_zypper/parameter/optional | 0 .../types_pending_inclusion/__package_zypper/parameter/required | 0 48 files changed, 0 insertions(+), 0 deletions(-) rename {contrib => other}/examples/nico/conf/type/__nico_afs/files/afs/CellServDB (100%) rename {contrib => other}/examples/nico/conf/type/__nico_afs/files/afs/ThisCell (100%) rename {contrib => other}/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf (100%) rename {contrib => other}/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub (100%) rename {contrib => other}/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub (100%) rename {contrib => other}/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub (100%) rename {contrib => other}/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub (100%) rename {contrib => other}/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub (100%) rename {contrib => other}/examples/nico/conf/type/__nico_afs/manifest (100%) rename {contrib => other}/examples/nico/conf/type/__nico_afs/singleton (100%) rename {contrib => other}/examples/nico/conf/type/__nico_desktop/files/hostname (100%) rename {contrib => other}/examples/nico/conf/type/__nico_desktop/files/slim-preseed (100%) rename {contrib => other}/examples/nico/conf/type/__nico_desktop/manifest (100%) rename {contrib => other}/examples/nico/conf/type/__nico_desktop/parameter/required (100%) rename {contrib => other}/examples/nico/conf/type/__nico_desktop/singleton (100%) rename {contrib => other}/examples/nico/conf/type/__nico_mpd/files/slim-preseed (100%) rename {contrib => other}/examples/nico/conf/type/__nico_mpd/manifest (100%) rename {contrib => other}/examples/nico/conf/type/__nico_mpd/parameter/required (100%) rename {contrib => other}/examples/nico/conf/type/__nico_mpd/singleton (100%) rename {contrib => other}/examples/nico/conf/type/__nico_network/files/interfaces-eth0 (100%) rename {contrib => other}/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 (100%) rename {contrib => other}/examples/nico/conf/type/__nico_network/manifest (100%) rename {contrib => other}/examples/nico/conf/type/__nico_network/parameter/required (100%) rename {contrib => other}/examples/nico/conf/type/__nico_network/singleton (100%) rename {contrib => other}/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed (100%) rename {contrib => other}/examples/nico/conf/type/__nico_nfs_client/manifest (100%) rename {contrib => other}/examples/nico/conf/type/__nico_nfs_client/singleton (100%) rename {contrib => other}/examples/nico/conf/type/__nico_notebook/manifest (100%) rename {contrib => other}/examples/nico/conf/type/__nico_notebook/singleton (100%) rename {contrib => other}/examples/nico/conf/type/__nico_packages/manifest (100%) rename {contrib => other}/examples/nico/conf/type/__nico_packages/singleton (100%) rename {contrib => other}/examples/nico/conf/type/__nico_sudo/files/sudo-nico (100%) rename {contrib => other}/examples/nico/conf/type/__nico_sudo/manifest (100%) rename {contrib => other}/examples/nico/conf/type/__nico_sudo/parameter/gencode (100%) rename {contrib => other}/examples/nico/conf/type/__nico_sudo/parameter/manifest (100%) rename {contrib => other}/examples/nico/conf/type/__nico_sudo/parameter/optional (100%) rename {contrib => other}/examples/nico/conf/type/__nico_sudo/parameter/required (100%) rename {contrib => other}/examples/nico/conf/type/__nico_sudo/singleton (100%) rename {contrib => other}/examples/nico/conf/type/__nico_tee/files/99-apt-nico (100%) rename {contrib => other}/examples/nico/conf/type/__nico_tee/files/hostname (100%) rename {contrib => other}/examples/nico/conf/type/__nico_tee/manifest (100%) rename {contrib => other}/examples/nico/conf/type/__nico_tee/singleton (100%) rename {contrib => other}/types_pending_inclusion/__package_zypper/README (100%) rename {contrib => other}/types_pending_inclusion/__package_zypper/explorer/pkg_version (100%) rename {contrib => other}/types_pending_inclusion/__package_zypper/gencode-remote (100%) rename {contrib => other}/types_pending_inclusion/__package_zypper/man.text (100%) rename {contrib => other}/types_pending_inclusion/__package_zypper/parameter/optional (100%) rename {contrib => other}/types_pending_inclusion/__package_zypper/parameter/required (100%) diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/afs/CellServDB b/other/examples/nico/conf/type/__nico_afs/files/afs/CellServDB similarity index 100% rename from contrib/examples/nico/conf/type/__nico_afs/files/afs/CellServDB rename to other/examples/nico/conf/type/__nico_afs/files/afs/CellServDB diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/afs/ThisCell b/other/examples/nico/conf/type/__nico_afs/files/afs/ThisCell similarity index 100% rename from contrib/examples/nico/conf/type/__nico_afs/files/afs/ThisCell rename to other/examples/nico/conf/type/__nico_afs/files/afs/ThisCell diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf b/other/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf similarity index 100% rename from contrib/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf rename to other/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub b/other/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub similarity index 100% rename from contrib/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub rename to other/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub b/other/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub similarity index 100% rename from contrib/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub rename to other/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub b/other/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub similarity index 100% rename from contrib/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub rename to other/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub b/other/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub similarity index 100% rename from contrib/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub rename to other/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub b/other/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub similarity index 100% rename from contrib/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub rename to other/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub diff --git a/contrib/examples/nico/conf/type/__nico_afs/manifest b/other/examples/nico/conf/type/__nico_afs/manifest similarity index 100% rename from contrib/examples/nico/conf/type/__nico_afs/manifest rename to other/examples/nico/conf/type/__nico_afs/manifest diff --git a/contrib/examples/nico/conf/type/__nico_afs/singleton b/other/examples/nico/conf/type/__nico_afs/singleton similarity index 100% rename from contrib/examples/nico/conf/type/__nico_afs/singleton rename to other/examples/nico/conf/type/__nico_afs/singleton diff --git a/contrib/examples/nico/conf/type/__nico_desktop/files/hostname b/other/examples/nico/conf/type/__nico_desktop/files/hostname similarity index 100% rename from contrib/examples/nico/conf/type/__nico_desktop/files/hostname rename to other/examples/nico/conf/type/__nico_desktop/files/hostname diff --git a/contrib/examples/nico/conf/type/__nico_desktop/files/slim-preseed b/other/examples/nico/conf/type/__nico_desktop/files/slim-preseed similarity index 100% rename from contrib/examples/nico/conf/type/__nico_desktop/files/slim-preseed rename to other/examples/nico/conf/type/__nico_desktop/files/slim-preseed diff --git a/contrib/examples/nico/conf/type/__nico_desktop/manifest b/other/examples/nico/conf/type/__nico_desktop/manifest similarity index 100% rename from contrib/examples/nico/conf/type/__nico_desktop/manifest rename to other/examples/nico/conf/type/__nico_desktop/manifest diff --git a/contrib/examples/nico/conf/type/__nico_desktop/parameter/required b/other/examples/nico/conf/type/__nico_desktop/parameter/required similarity index 100% rename from contrib/examples/nico/conf/type/__nico_desktop/parameter/required rename to other/examples/nico/conf/type/__nico_desktop/parameter/required diff --git a/contrib/examples/nico/conf/type/__nico_desktop/singleton b/other/examples/nico/conf/type/__nico_desktop/singleton similarity index 100% rename from contrib/examples/nico/conf/type/__nico_desktop/singleton rename to other/examples/nico/conf/type/__nico_desktop/singleton diff --git a/contrib/examples/nico/conf/type/__nico_mpd/files/slim-preseed b/other/examples/nico/conf/type/__nico_mpd/files/slim-preseed similarity index 100% rename from contrib/examples/nico/conf/type/__nico_mpd/files/slim-preseed rename to other/examples/nico/conf/type/__nico_mpd/files/slim-preseed diff --git a/contrib/examples/nico/conf/type/__nico_mpd/manifest b/other/examples/nico/conf/type/__nico_mpd/manifest similarity index 100% rename from contrib/examples/nico/conf/type/__nico_mpd/manifest rename to other/examples/nico/conf/type/__nico_mpd/manifest diff --git a/contrib/examples/nico/conf/type/__nico_mpd/parameter/required b/other/examples/nico/conf/type/__nico_mpd/parameter/required similarity index 100% rename from contrib/examples/nico/conf/type/__nico_mpd/parameter/required rename to other/examples/nico/conf/type/__nico_mpd/parameter/required diff --git a/contrib/examples/nico/conf/type/__nico_mpd/singleton b/other/examples/nico/conf/type/__nico_mpd/singleton similarity index 100% rename from contrib/examples/nico/conf/type/__nico_mpd/singleton rename to other/examples/nico/conf/type/__nico_mpd/singleton diff --git a/contrib/examples/nico/conf/type/__nico_network/files/interfaces-eth0 b/other/examples/nico/conf/type/__nico_network/files/interfaces-eth0 similarity index 100% rename from contrib/examples/nico/conf/type/__nico_network/files/interfaces-eth0 rename to other/examples/nico/conf/type/__nico_network/files/interfaces-eth0 diff --git a/contrib/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 b/other/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 similarity index 100% rename from contrib/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 rename to other/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 diff --git a/contrib/examples/nico/conf/type/__nico_network/manifest b/other/examples/nico/conf/type/__nico_network/manifest similarity index 100% rename from contrib/examples/nico/conf/type/__nico_network/manifest rename to other/examples/nico/conf/type/__nico_network/manifest diff --git a/contrib/examples/nico/conf/type/__nico_network/parameter/required b/other/examples/nico/conf/type/__nico_network/parameter/required similarity index 100% rename from contrib/examples/nico/conf/type/__nico_network/parameter/required rename to other/examples/nico/conf/type/__nico_network/parameter/required diff --git a/contrib/examples/nico/conf/type/__nico_network/singleton b/other/examples/nico/conf/type/__nico_network/singleton similarity index 100% rename from contrib/examples/nico/conf/type/__nico_network/singleton rename to other/examples/nico/conf/type/__nico_network/singleton diff --git a/contrib/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed b/other/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed similarity index 100% rename from contrib/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed rename to other/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed diff --git a/contrib/examples/nico/conf/type/__nico_nfs_client/manifest b/other/examples/nico/conf/type/__nico_nfs_client/manifest similarity index 100% rename from contrib/examples/nico/conf/type/__nico_nfs_client/manifest rename to other/examples/nico/conf/type/__nico_nfs_client/manifest diff --git a/contrib/examples/nico/conf/type/__nico_nfs_client/singleton b/other/examples/nico/conf/type/__nico_nfs_client/singleton similarity index 100% rename from contrib/examples/nico/conf/type/__nico_nfs_client/singleton rename to other/examples/nico/conf/type/__nico_nfs_client/singleton diff --git a/contrib/examples/nico/conf/type/__nico_notebook/manifest b/other/examples/nico/conf/type/__nico_notebook/manifest similarity index 100% rename from contrib/examples/nico/conf/type/__nico_notebook/manifest rename to other/examples/nico/conf/type/__nico_notebook/manifest diff --git a/contrib/examples/nico/conf/type/__nico_notebook/singleton b/other/examples/nico/conf/type/__nico_notebook/singleton similarity index 100% rename from contrib/examples/nico/conf/type/__nico_notebook/singleton rename to other/examples/nico/conf/type/__nico_notebook/singleton diff --git a/contrib/examples/nico/conf/type/__nico_packages/manifest b/other/examples/nico/conf/type/__nico_packages/manifest similarity index 100% rename from contrib/examples/nico/conf/type/__nico_packages/manifest rename to other/examples/nico/conf/type/__nico_packages/manifest diff --git a/contrib/examples/nico/conf/type/__nico_packages/singleton b/other/examples/nico/conf/type/__nico_packages/singleton similarity index 100% rename from contrib/examples/nico/conf/type/__nico_packages/singleton rename to other/examples/nico/conf/type/__nico_packages/singleton diff --git a/contrib/examples/nico/conf/type/__nico_sudo/files/sudo-nico b/other/examples/nico/conf/type/__nico_sudo/files/sudo-nico similarity index 100% rename from contrib/examples/nico/conf/type/__nico_sudo/files/sudo-nico rename to other/examples/nico/conf/type/__nico_sudo/files/sudo-nico diff --git a/contrib/examples/nico/conf/type/__nico_sudo/manifest b/other/examples/nico/conf/type/__nico_sudo/manifest similarity index 100% rename from contrib/examples/nico/conf/type/__nico_sudo/manifest rename to other/examples/nico/conf/type/__nico_sudo/manifest diff --git a/contrib/examples/nico/conf/type/__nico_sudo/parameter/gencode b/other/examples/nico/conf/type/__nico_sudo/parameter/gencode similarity index 100% rename from contrib/examples/nico/conf/type/__nico_sudo/parameter/gencode rename to other/examples/nico/conf/type/__nico_sudo/parameter/gencode diff --git a/contrib/examples/nico/conf/type/__nico_sudo/parameter/manifest b/other/examples/nico/conf/type/__nico_sudo/parameter/manifest similarity index 100% rename from contrib/examples/nico/conf/type/__nico_sudo/parameter/manifest rename to other/examples/nico/conf/type/__nico_sudo/parameter/manifest diff --git a/contrib/examples/nico/conf/type/__nico_sudo/parameter/optional b/other/examples/nico/conf/type/__nico_sudo/parameter/optional similarity index 100% rename from contrib/examples/nico/conf/type/__nico_sudo/parameter/optional rename to other/examples/nico/conf/type/__nico_sudo/parameter/optional diff --git a/contrib/examples/nico/conf/type/__nico_sudo/parameter/required b/other/examples/nico/conf/type/__nico_sudo/parameter/required similarity index 100% rename from contrib/examples/nico/conf/type/__nico_sudo/parameter/required rename to other/examples/nico/conf/type/__nico_sudo/parameter/required diff --git a/contrib/examples/nico/conf/type/__nico_sudo/singleton b/other/examples/nico/conf/type/__nico_sudo/singleton similarity index 100% rename from contrib/examples/nico/conf/type/__nico_sudo/singleton rename to other/examples/nico/conf/type/__nico_sudo/singleton diff --git a/contrib/examples/nico/conf/type/__nico_tee/files/99-apt-nico b/other/examples/nico/conf/type/__nico_tee/files/99-apt-nico similarity index 100% rename from contrib/examples/nico/conf/type/__nico_tee/files/99-apt-nico rename to other/examples/nico/conf/type/__nico_tee/files/99-apt-nico diff --git a/contrib/examples/nico/conf/type/__nico_tee/files/hostname b/other/examples/nico/conf/type/__nico_tee/files/hostname similarity index 100% rename from contrib/examples/nico/conf/type/__nico_tee/files/hostname rename to other/examples/nico/conf/type/__nico_tee/files/hostname diff --git a/contrib/examples/nico/conf/type/__nico_tee/manifest b/other/examples/nico/conf/type/__nico_tee/manifest similarity index 100% rename from contrib/examples/nico/conf/type/__nico_tee/manifest rename to other/examples/nico/conf/type/__nico_tee/manifest diff --git a/contrib/examples/nico/conf/type/__nico_tee/singleton b/other/examples/nico/conf/type/__nico_tee/singleton similarity index 100% rename from contrib/examples/nico/conf/type/__nico_tee/singleton rename to other/examples/nico/conf/type/__nico_tee/singleton diff --git a/contrib/types_pending_inclusion/__package_zypper/README b/other/types_pending_inclusion/__package_zypper/README similarity index 100% rename from contrib/types_pending_inclusion/__package_zypper/README rename to other/types_pending_inclusion/__package_zypper/README diff --git a/contrib/types_pending_inclusion/__package_zypper/explorer/pkg_version b/other/types_pending_inclusion/__package_zypper/explorer/pkg_version similarity index 100% rename from contrib/types_pending_inclusion/__package_zypper/explorer/pkg_version rename to other/types_pending_inclusion/__package_zypper/explorer/pkg_version diff --git a/contrib/types_pending_inclusion/__package_zypper/gencode-remote b/other/types_pending_inclusion/__package_zypper/gencode-remote similarity index 100% rename from contrib/types_pending_inclusion/__package_zypper/gencode-remote rename to other/types_pending_inclusion/__package_zypper/gencode-remote diff --git a/contrib/types_pending_inclusion/__package_zypper/man.text b/other/types_pending_inclusion/__package_zypper/man.text similarity index 100% rename from contrib/types_pending_inclusion/__package_zypper/man.text rename to other/types_pending_inclusion/__package_zypper/man.text diff --git a/contrib/types_pending_inclusion/__package_zypper/parameter/optional b/other/types_pending_inclusion/__package_zypper/parameter/optional similarity index 100% rename from contrib/types_pending_inclusion/__package_zypper/parameter/optional rename to other/types_pending_inclusion/__package_zypper/parameter/optional diff --git a/contrib/types_pending_inclusion/__package_zypper/parameter/required b/other/types_pending_inclusion/__package_zypper/parameter/required similarity index 100% rename from contrib/types_pending_inclusion/__package_zypper/parameter/required rename to other/types_pending_inclusion/__package_zypper/parameter/required From 1745f0bbc36a8f6da4c11afda63c6a3747e092ae Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Sep 2011 08:31:14 +0200 Subject: [PATCH 0204/1024] also document TMPDIR and TEMP Signed-off-by: Nico Schottelius --- doc/man/man1/cdist.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/man/man1/cdist.text b/doc/man/man1/cdist.text index c43e4e1c..03948036 100644 --- a/doc/man/man1/cdist.text +++ b/doc/man/man1/cdist.text @@ -84,7 +84,7 @@ cdist --version ENVIRONMENT ----------- -TMP:: +TMPDIR, TEMP, TMP:: Setup the base directory for the temporary directory. See http://docs.python.org/py3k/library/tempfile.html for more information. This is rather useful, if the standard From 2a5ee06b0e68537d8489300b652715430e58df9d Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 19 Sep 2011 14:04:52 +0200 Subject: [PATCH 0205/1024] no need to redefine again and again inside loop Signed-off-by: Steven Armstrong --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index adb8bd78..6726295a 100755 --- a/bin/cdist +++ b/bin/cdist @@ -354,8 +354,8 @@ class Cdist: def link_type_to_emulator(self): """Link type names to cdist-type-emulator""" + source = sys.argv[0] for type in self.list_types(): - source = sys.argv[0] destination = os.path.join(self.bin_dir, type) log.debug("Linking %s to %s", source, destination) os.symlink(source, destination) From 1c1ebac90c22ade5a35310b92955230665984fdd Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 19 Sep 2011 14:05:31 +0200 Subject: [PATCH 0206/1024] dont break if sys.argv[0] is a relative path Signed-off-by: Steven Armstrong --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 6726295a..a5383524 100755 --- a/bin/cdist +++ b/bin/cdist @@ -354,7 +354,7 @@ class Cdist: def link_type_to_emulator(self): """Link type names to cdist-type-emulator""" - source = sys.argv[0] + source = os.path.abspath(sys.argv[0]) for type in self.list_types(): destination = os.path.join(self.bin_dir, type) log.debug("Linking %s to %s", source, destination) From de7123df792a0bba7ad0b92460c0a06a40578775 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Sep 2011 14:38:52 +0200 Subject: [PATCH 0207/1024] always catch KeyboardInterrupt Signed-off-by: Nico Schottelius --- bin/cdist | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/cdist b/bin/cdist index a5383524..5ce947ef 100755 --- a/bin/cdist +++ b/bin/cdist @@ -772,13 +772,13 @@ def commandline(): logging.root.setLevel(logging.DEBUG) log.debug(args) - try: - args.func(args) - except KeyboardInterrupt: - sys.exit(0) + args.func(args) if __name__ == "__main__": - if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): - emulator() - else: - commandline() + try: + if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): + emulator() + else: + commandline() + except KeyboardInterrupt: + sys.exit(0) From 20bb4d044b6162bc11cd035829f64e6562f644a5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 20 Sep 2011 13:29:08 +0200 Subject: [PATCH 0208/1024] --typo: .realines( vs. readlines( Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 5ce947ef..1f44ba2d 100755 --- a/bin/cdist +++ b/bin/cdist @@ -684,7 +684,7 @@ def emulator(): sys.exit(1) else: param_fd = open(file, "r") - param_old = param_fd.realines() + param_old = param_fd.readlines() param_fd.close() if(param_old != param): From e3849b917c29cf6a86241a1fb2b1403e28b5def5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 20 Sep 2011 14:34:19 +0200 Subject: [PATCH 0209/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 84745512..9e9ca0e7 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -13,6 +13,10 @@ - Fix / rewrite cdist-quickstart +- write tutorial!!!!!!!!! + - like ccollect! + - include ssh control master! + -------------------------------------------------------------------------------- - Initial install support From 143a3a62dda6c7e08c0f3a66dc359507d634744b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 20 Sep 2011 14:40:20 +0200 Subject: [PATCH 0210/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 9e9ca0e7..44829060 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -16,6 +16,7 @@ - write tutorial!!!!!!!!! - like ccollect! - include ssh control master! + - add local/ hint (and add to git) -------------------------------------------------------------------------------- From 12e6e9288e85fc16f84ccbd3eac73e7cd08ca3e3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 20 Sep 2011 14:45:19 +0200 Subject: [PATCH 0211/1024] ++tutorial Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 44829060..91dbc72f 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -17,6 +17,9 @@ - like ccollect! - include ssh control master! - add local/ hint (and add to git) + - add hint for ssh StrictHostKeyChecking no + - and that ssh will wait for answer of prompt + - nasty if used in parallel mode (scroll up!) -------------------------------------------------------------------------------- From 462ed49a74e2d8c512b85163d2cd2fafda4f4a09 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 22 Sep 2011 18:43:36 +0200 Subject: [PATCH 0212/1024] BUGFIX: TypeError: Can't convert 'list' object to str implicitly (in emulator) Signed-off-by: Nico Schottelius --- bin/cdist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 1f44ba2d..9a745251 100755 --- a/bin/cdist +++ b/bin/cdist @@ -688,8 +688,8 @@ def emulator(): param_fd.close() if(param_old != param): - print("Parameter differs: " + param_old + "vs," + param) - print("Source = " + old_object_source + "new =" + object_source) + print("Parameter " + param + " differs: " + " ".join(param_old) + " vs. " + param) + print("Sources: " + " ".join(old_object_source) + " and " + object_source) sys.exit(1) else: param_fd = open(file, "w") From 7a09266abf391a98c3a9f836af4176e6d99c62a9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 13:49:02 +0200 Subject: [PATCH 0213/1024] allow users to check whether an object changed Signed-off-by: Nico Schottelius --- bin/cdist | 6 +++++- doc/changelog | 4 +++- doc/man/cdist-reference.text.sh | 10 ++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 9a745251..e085a226 100755 --- a/bin/cdist +++ b/bin/cdist @@ -485,7 +485,7 @@ class Cdist: ] for bin in paths: if os.path.isfile(bin): - # omit "gen" from gencode and + # omit "gen" from gencode and use it for output base outfile=os.path.join(self.object_dir(cdist_object), os.path.basename(bin)[3:]) @@ -507,6 +507,10 @@ class Cdist: # Add header and make executable - identically to 0o700 os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + # Mark object as changed + open(os.path.join(self.object_dir(cdist_object), "changed"), "w").close() + + if mode == "code": local_dir = self.object_dir(cdist_object) remote_dir = self.remote_object_dir(cdist_object) diff --git a/doc/changelog b/doc/changelog index cc6aa78b..d69011ee 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,5 +1,7 @@ 2.0.1: - * Bugfix cdist: Always print source of error in case of exec errors + * Bugfix core: Always print source of error in case of exec errors + * Bugfix core: Various smaller bugs in string concatenation + * Feature: Add marker "changed" to changed objects 2.0.0: 2011-09-16 * New Type: __package_rubygem (Chase Allen James) diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index e38f157d..c205bdcc 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -154,6 +154,16 @@ done cat << eof +OBJECTS +------- +For object to object communication and tests, the following paths are +usable within a object directory: + +changed:: + This empty file exists in an object directory, if the object has + code to be excuted (either remote or local) + + ENVIRONMENT VARIABLES --------------------- __explorer:: From ca3644b73a4ceb9ac0c156ca07d1b2b49851675d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 13:50:49 +0200 Subject: [PATCH 0214/1024] ++version Signed-off-by: Nico Schottelius --- doc/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index d69011ee..b1149eb1 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,4 +1,4 @@ -2.0.1: +2.0.1: 2011-09-23 * Bugfix core: Always print source of error in case of exec errors * Bugfix core: Various smaller bugs in string concatenation * Feature: Add marker "changed" to changed objects From 412778206c15d929f26c567b36bb85557818cef1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 14:21:33 +0200 Subject: [PATCH 0215/1024] and increment version Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index e085a226..30db1ec9 100755 --- a/bin/cdist +++ b/bin/cdist @@ -57,7 +57,7 @@ REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") CODE_HEADER = "#!/bin/sh -e\n" DOT_CDIST = ".cdist" TYPE_PREFIX = "__" -VERSION = "2.0.0" +VERSION = "2.0.1" logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') log = logging.getLogger() From 199245e6ce100718c47a40839930dd55ca1c9d21 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 14:54:39 +0200 Subject: [PATCH 0216/1024] ignore more pycache stuff Signed-off-by: Nico Schottelius --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d606aec7..259e3be3 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,4 @@ doc/man/man*/docbook-xsl.css cache/ # Python -bin/__pycache__/ +*/__pycache__/ From b8ff4c9609d61033deab83b4e3be082cde7b45fe Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 14:55:00 +0200 Subject: [PATCH 0217/1024] begin split into smaller files Signed-off-by: Nico Schottelius --- bin/cdist | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/cdist b/bin/cdist index 30db1ec9..fe3c17fd 100755 --- a/bin/cdist +++ b/bin/cdist @@ -62,6 +62,10 @@ VERSION = "2.0.1" logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') log = logging.getLogger() +# Begin to split into parts +sys.path.insert(0, + os.path.abspath(os.path.join(os.path.dirname(__file__), + '../lib/python'))) def file_to_list(filename): """Return list from \n seperated file""" From 211212e079fb1582658b4448e0c1ac2c0efdf0d1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 16:01:24 +0200 Subject: [PATCH 0218/1024] test template Signed-off-by: Nico Schottelius --- test/cdist.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/cdist.py diff --git a/test/cdist.py b/test/cdist.py new file mode 100644 index 00000000..3ccc69bc --- /dev/null +++ b/test/cdist.py @@ -0,0 +1,12 @@ +import cdist +import unittest + + +class CdistGeneric(unittest.TestCase): + + def test_initial_manifest(self): + self.assertEqual(numeral, result) + + +if __name__ == '__main__': + unittest.main() From 721119a34f5bf7a3267eb906e11a6ef7c009e200 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 23 Sep 2011 16:18:55 +0200 Subject: [PATCH 0219/1024] quote arguments Signed-off-by: Steven Armstrong --- conf/type/__partition_msdos_apply/files/lib.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/conf/type/__partition_msdos_apply/files/lib.sh b/conf/type/__partition_msdos_apply/files/lib.sh index 0e9705d9..e24c1cb7 100644 --- a/conf/type/__partition_msdos_apply/files/lib.sh +++ b/conf/type/__partition_msdos_apply/files/lib.sh @@ -7,8 +7,8 @@ debug() { } fdisk_command() { - local device=$1 - local cmd=$2 + local device="$1" + local cmd="$2" debug fdisk_command "running fdisk command '${cmd}' on device ${device}" echo -en "${cmd}\nw\n" | fdisk -c -u "$device" @@ -24,11 +24,11 @@ create_disklabel() { } create_partition() { - local device=$1 - local minor=$2 - local size=$3 - local type=$4 - local primary_count=$5 + local device="$1" + local minor="$2" + local size="$3" + local type="$4" + local primary_count="$5" if [ "$type" = "extended" -o "$type" = "5" ]; then # Extended partition From ef97849676d0a8ce8909ac138c2887b1e6b069ed Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 23 Sep 2011 16:20:26 +0200 Subject: [PATCH 0220/1024] distinguish between disk size and extended partition size Signed-off-by: Steven Armstrong --- .../__partition_msdos_apply/gencode-remote | 46 +++++++++++++++---- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/conf/type/__partition_msdos_apply/gencode-remote b/conf/type/__partition_msdos_apply/gencode-remote index d352abdb..1d5c33cb 100755 --- a/conf/type/__partition_msdos_apply/gencode-remote +++ b/conf/type/__partition_msdos_apply/gencode-remote @@ -23,7 +23,8 @@ die() { exit 1 } debug() { - echo "[__partition_msdos_apply] $@" >&2 + #echo "[__partition_msdos_apply] $@" >&2 + : } # Convert a size specifier 1G 100M or 50% into the corresponding numeric MB. @@ -57,32 +58,43 @@ cat "$__type/files/lib.sh" partitions="$__object/explorer/partitions" objects=$(find "$__global/object/__partition_msdos" -path "*.cdist") current_device="" +available_device_size= +available_extended_size= available_size= primary_count=0 for object in $objects; do device="$(cat "$object/parameter/device")" if [ "$current_device" != "$device" ]; then - echo "create_disklabel $device" + echo "create_disklabel \"$device\" || die 'Failed to create disklabel for $device'" current_device="$device" device_name=$(echo ${device} | sed -e 's:^/dev/::;s:/:\\/:g') - available_size=$(( $(awk "/${device_name}\$/ { print \$3; }" "$partitions") / 1024)) + available_device_size=$(( $(awk "/${device_name}\$/ { print \$3; }" "$partitions") / 1024)) # make sure we don't go past the end of the drive - available_size=$((available_size - 2)) + available_device_size=$((available_device_size - 2)) + available_extended_size=0 primary_count=0 debug "----- $device" debug "current_device=$current_device" - debug "available_size=$available_size" + debug "available_device_size=$available_device_size" fi type="$(cat "$object/parameter/type")" partition="$(cat "$object/parameter/partition")" minor="$(cat "$object/parameter/minor")" - if [ "${minor}" -lt "5" ]; then - primary_count=$(( $primary_count + 1 )) - fi bootable="$(cat "$object/parameter/bootable")" size="$(cat "$object/parameter/size")" + + + if [ "${minor}" -lt "5" ]; then + # Primary partitions + primary_count=$(( $primary_count + 1 )) + available_size=$available_device_size + else + # Logical partitions + available_size=$available_extended_size + fi + if [ "$size" = "+" ]; then # use rest of device partition_size="" @@ -92,6 +104,18 @@ for object in $objects; do available_size="$(( $available_size - $partition_size ))" fi + if [ "${minor}" -lt "5" ]; then + # Primary partitions + available_device_size=$available_size + if [ "$type" = "extended" -o "$type" = "5" ]; then + # Extended partition + available_extended_size=$partition_size + fi + else + # Logical paritions + available_extended_size=$available_size + fi + [ "$partition_size" = "-1" ] && die "could not translate size '$size' to a usable value" debug "----- $partition" debug "primary_count=$primary_count" @@ -104,7 +128,11 @@ for object in $objects; do debug "size=$size" debug "partition_size=$partition_size" debug "available_size=$available_size" + debug "available_device_size=$available_device_size" + debug "available_extended_size=$available_extended_size" + debug "----------" - echo "create_partition $device $minor $partition_size $type $primary_count" + echo "create_partition '$device' '$minor' '$partition_size' '$type' '$primary_count' \ + || die 'Failed to create partition: $partition'" done From ad5c33b7467e8224997183d48994b3b0de0ac9c4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 16:38:47 +0200 Subject: [PATCH 0221/1024] %s/\( \)/\1 /g + fix logo Signed-off-by: Nico Schottelius --- bin/cdist | 1348 ++++++++++++++++++++++++++--------------------------- 1 file changed, 674 insertions(+), 674 deletions(-) diff --git a/bin/cdist b/bin/cdist index fe3c17fd..2100bd4d 100755 --- a/bin/cdist +++ b/bin/cdist @@ -48,745 +48,745 @@ BANNER = """ """ # Given paths from installation -REMOTE_BASE_DIR = "/var/lib/cdist" -REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") -REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") -REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") +REMOTE_BASE_DIR = "/var/lib/cdist" +REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") +REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") +REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") -CODE_HEADER = "#!/bin/sh -e\n" -DOT_CDIST = ".cdist" -TYPE_PREFIX = "__" -VERSION = "2.0.1" +CODE_HEADER = "#!/bin/sh -e\n" +DOT_CDIST = ".cdist" +TYPE_PREFIX = "__" +VERSION = "2.0.1" logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') log = logging.getLogger() # Begin to split into parts sys.path.insert(0, - os.path.abspath(os.path.join(os.path.dirname(__file__), - '../lib/python'))) + os.path.abspath(os.path.join(os.path.dirname(__file__), + '../lib/python'))) def file_to_list(filename): - """Return list from \n seperated file""" - if os.path.isfile(filename): - file_fd = open(filename, "r") - lines = file_fd.readlines() - file_fd.close() + """Return list from \n seperated file""" + if os.path.isfile(filename): + file_fd = open(filename, "r") + lines = file_fd.readlines() + file_fd.close() - # Remove \n from all lines - lines = map(lambda s: s.strip(), lines) - else: - lines = [] + # Remove \n from all lines + lines = map(lambda s: s.strip(), lines) + else: + lines = [] - return lines + return lines def exit_error(*args): - log.error(*args) - sys.exit(1) + log.error(*args) + sys.exit(1) class Cdist: - """Cdist main class to hold arbitrary data""" - - def __init__(self, target_host, - initial_manifest=False, remote_user="root", - home=None, debug=False): - self.target_host = target_host - self.remote_prefix = ["ssh", "root@" + self.target_host] - - # Setup directory paths - self.temp_dir = tempfile.mkdtemp() - - self.debug = debug - - if home: - self.base_dir = home - else: - self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) - - self.conf_dir = os.path.join(self.base_dir, "conf") - self.cache_base_dir = os.path.join(self.base_dir, "cache") - self.cache_dir = os.path.join(self.cache_base_dir, self.target_host) - self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") - self.lib_dir = os.path.join(self.base_dir, "lib") - self.manifest_dir = os.path.join(self.conf_dir, "manifest") - self.type_base_dir = os.path.join(self.conf_dir, "type") - - self.out_dir = os.path.join(self.temp_dir, "out") - os.mkdir(self.out_dir) - - self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") - os.mkdir(self.global_explorer_out_dir) - - self.object_base_dir = os.path.join(self.out_dir, "object") - - # Setup binary directory + contents - self.bin_dir = os.path.join(self.out_dir, "bin") - os.mkdir(self.bin_dir) - self.link_type_to_emulator() - - # List of type explorers transferred - self.type_explorers_transferred = {} - - # objects - self.objects_prepared = [] - - self.remote_user = remote_user - - # Mostly static, but can be overwritten on user demand - if initial_manifest: - self.initial_manifest = initial_manifest - else: - self.initial_manifest = os.path.join(self.manifest_dir, "init") - - def cleanup(self): - # Do not use in __del__: - # http://docs.python.org/reference/datamodel.html#customization - # "other globals referenced by the __del__() method may already have been deleted - # or in the process of being torn down (e.g. the import machinery shutting down)" - # - log.debug("Saving" + self.temp_dir + "to " + self.cache_dir) - # Remove previous cache - if os.path.exists(self.cache_dir): - shutil.rmtree(self.cache_dir) - shutil.move(self.temp_dir, self.cache_dir) - - def remote_mkdir(self, directory): - """Create directory on remote side""" - self.run_or_fail(["mkdir", "-p", directory], remote=True) - - def remote_cat(filename): - """Use cat on the remote side for output""" - self.run_or_fail(["cat", filename], remote=True) - - def shell_run_or_debug_fail(self, script, *args, **kargs): - # Manually execute /bin/sh, because sh -e does what we want - # and sh -c -e does not exit if /bin/false called - args[0][:0] = [ "/bin/sh", "-e" ] - - remote = False - if "remote" in kargs: - if kargs["remote"]: - args[0][:0] = self.remote_prefix - remote = true - - del kargs["remote"] - - log.debug("Shell exec cmd: %s", args) - log.debug("Shell exec env: %s", kargs['env']) - try: - subprocess.check_call(*args, **kargs) - except subprocess.CalledProcessError: - log.error("Code that raised the error:\n") - if remote: - remote_cat(script) - else: - script_fd = open(script) - print(script_fd.read()) - script_fd.close() - - exit_error("Command failed (shell): " + " ".join(*args)) - except OSError as error: - exit_error(" ".join(*args) + ": " + error.args[1]) - - def run_or_fail(self, *args, **kargs): - if "remote" in kargs: - if kargs["remote"]: - args[0][:0] = self.remote_prefix - - del kargs["remote"] - - log.debug("Exec: " + " ".join(*args)) - try: - subprocess.check_call(*args, **kargs) - except subprocess.CalledProcessError: - exit_error("Command failed: " + " ".join(*args)) - except OSError as error: - exit_error(" ".join(*args) + ": " + error.args[1]) - - - def remove_remote_dir(self, destination): - self.run_or_fail(["rm", "-rf", destination], remote=True) - - def transfer_dir(self, source, destination): - """Transfer directory and previously delete the remote destination""" - self.remove_remote_dir(destination) - self.run_or_fail(["scp", "-qr", source, - self.remote_user + "@" + - self.target_host + ":" + - destination]) - - def transfer_file(self, source, destination): - """Transfer file""" - self.run_or_fail(["scp", "-q", source, - self.remote_user + "@" + - self.target_host + ":" + - destination]) - - def global_explorer_output_path(self, explorer): - """Returns path of the output for a global explorer""" - return os.path.join(self.global_explorer_out_dir, explorer) - - def type_explorer_output_dir(self, cdist_object): - """Returns and creates dir of the output for a type explorer""" - dir = os.path.join(self.object_dir(cdist_object), "explorer") - if not os.path.isdir(dir): - os.mkdir(dir) - - return dir - - def remote_global_explorer_path(self, explorer): - """Returns path to the remote explorer""" - return os.path.join(REMOTE_GLOBAL_EXPLORER_DIR, explorer) - - def list_global_explorers(self): - """Return list of available explorers""" - return os.listdir(self.global_explorer_dir) - - def list_type_explorers(self, type): - """Return list of available explorers for a specific type""" - dir = self.type_dir(type, "explorer") - if os.path.isdir(dir): - list = os.listdir(dir) - else: - list = [] - - log.debug("Explorers for %s in %s: %s", type, dir, list) - - return list - - def list_types(self): - return os.listdir(self.type_base_dir) - - def list_object_paths(self, starting_point): - """Return list of paths of existing objects""" - object_paths = [] - - for content in os.listdir(starting_point): - full_path = os.path.join(starting_point, content) - if os.path.isdir(full_path): - object_paths.extend(self.list_object_paths(starting_point = full_path)) - - # Directory contains .cdist -> is an object - if content == DOT_CDIST: - object_paths.append(starting_point) - - return object_paths - - def get_type_from_object(self, cdist_object): - """Returns the first part (i.e. type) of an object""" - return cdist_object.split(os.sep)[0] - - def get_object_id_from_object(self, cdist_object): - """Returns everything but the first part (i.e. object_id) of an object""" - return os.sep.join(cdist_object.split(os.sep)[1:]) - - def object_dir(self, cdist_object): - """Returns the full path to the object (including .cdist)""" - return os.path.join(self.object_base_dir, cdist_object, DOT_CDIST) - - def remote_object_dir(self, cdist_object): - """Returns the remote full path to the object (including .cdist)""" - return os.path.join(REMOTE_OBJECT_DIR, cdist_object, DOT_CDIST) - - def object_parameter_dir(self, cdist_object): - """Returns the dir to the object parameter""" - return os.path.join(self.object_dir(cdist_object), "parameter") - - def remote_object_parameter_dir(self, cdist_object): - """Returns the remote dir to the object parameter""" - return os.path.join(self.remote_object_dir(cdist_object), "parameter") - - def object_code_paths(self, cdist_object): - """Return paths to code scripts of object""" - return [os.path.join(self.object_dir(cdist_object), "code-local"), - os.path.join(self.object_dir(cdist_object), "code-remote")] - - def list_objects(self): - """Return list of existing objects""" - - objects = [] - if os.path.isdir(self.object_base_dir): - object_paths = self.list_object_paths(self.object_base_dir) - - for path in object_paths: - objects.append(os.path.relpath(path, self.object_base_dir)) - - return objects - - def type_dir(self, type, *args): - """Return directory the type""" - return os.path.join(self.type_base_dir, type, *args) - - def remote_type_explorer_dir(self, type): - """Return remote directory that holds the explorers of a type""" - return os.path.join(REMOTE_TYPE_DIR, type, "explorer") - - def transfer_object_parameter(self, cdist_object): - """Transfer the object parameter to the remote destination""" - # Create base path before using mkdir -p - self.remote_mkdir(self.remote_object_parameter_dir(cdist_object)) - - # Synchronise parameter dir afterwards - self.transfer_dir(self.object_parameter_dir(cdist_object), - self.remote_object_parameter_dir(cdist_object)) - - def transfer_global_explorers(self): - """Transfer the global explorers""" - self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) - self.transfer_dir(self.global_explorer_dir, REMOTE_GLOBAL_EXPLORER_DIR) - - def transfer_type_explorers(self, type): - """Transfer explorers of a type, but only once""" - if type in self.type_explorers_transferred: - log.debug("Skipping retransfer for explorers of %s", type) - return - else: - # Do not retransfer - self.type_explorers_transferred[type] = 1 - - src = self.type_dir(type, "explorer") - remote_base = os.path.join(REMOTE_TYPE_DIR, type) - dst = self.remote_type_explorer_dir(type) - - # Only continue, if there is at least the directory - if os.path.isdir(src): - # Ensure that the path exists - self.remote_mkdir(remote_base) - self.transfer_dir(src, dst) - - - def link_type_to_emulator(self): - """Link type names to cdist-type-emulator""" - source = os.path.abspath(sys.argv[0]) - for type in self.list_types(): - destination = os.path.join(self.bin_dir, type) - log.debug("Linking %s to %s", source, destination) - os.symlink(source, destination) - - def run_global_explores(self): - """Run global explorers""" - explorers = self.list_global_explorers() - if(len(explorers) == 0): - exit_error("No explorers found in", self.global_explorer_dir) - - self.transfer_global_explorers() - for explorer in explorers: - output = self.global_explorer_output_path(explorer) - output_fd = open(output, mode='w') - cmd = [] - cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append(self.remote_global_explorer_path(explorer)) - - self.run_or_fail(cmd, stdout=output_fd, remote=True) - output_fd.close() - - def run_type_explorer(self, cdist_object): - """Run type specific explorers for objects""" - # Based on bin/cdist-object-explorer-run - - # Transfering explorers for this type - type = self.get_type_from_object(cdist_object) - self.transfer_type_explorers(type) - - cmd = [] - cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append("__type_explorer=" + self.remote_type_explorer_dir(type)) - cmd.append("__object=" + self.remote_object_dir(cdist_object)) - cmd.append("__object_id=" + self.get_object_id_from_object(cdist_object)) - cmd.append("__object_fq=" + cdist_object) - - # Need to transfer at least the parameters for objects to be useful - self.transfer_object_parameter(cdist_object) - - explorers = self.list_type_explorers(type) - for explorer in explorers: - remote_cmd = cmd + [os.path.join(self.remote_type_explorer_dir(type), explorer)] - output = os.path.join(self.type_explorer_output_dir(cdist_object), explorer) - output_fd = open(output, mode='w') - log.debug("%s exploring %s using %s storing to %s", - cdist_object, explorer, remote_cmd, output) - - self.run_or_fail(remote_cmd, stdout=output_fd, remote=True) - output_fd.close() - - def init_deploy(self): - """Ensure the base directories are cleaned up""" - log.debug("Creating clean directory structure") - - self.remove_remote_dir(REMOTE_BASE_DIR) - self.remote_mkdir(REMOTE_BASE_DIR) - - def run_initial_manifest(self): - """Run the initial manifest""" - env = { "__manifest" : self.manifest_dir } - self.run_manifest(self.initial_manifest, extra_env=env) - - def run_type_manifest(self, cdist_object): - """Run manifest for a specific object""" - type = self.get_type_from_object(cdist_object) - manifest = self.type_dir(type, "manifest") - - log.debug("%s: Running %s", cdist_object, manifest) - if os.path.exists(manifest): - env = { "__object" : self.object_dir(cdist_object), - "__object_id": self.get_object_id_from_object(cdist_object), - "__object_fq": cdist_object, - "__type": self.type_dir(type) - } - self.run_manifest(manifest, extra_env=env) - - def run_manifest(self, manifest, extra_env=None): - """Run a manifest""" - log.debug("Running manifest %s, env=%s", manifest, extra_env) - env = os.environ.copy() - env['PATH'] = self.bin_dir + ":" + env['PATH'] - - # Information required in every manifest - env['__target_host'] = self.target_host - env['__global'] = self.out_dir - - # Legacy stuff to make cdist-type-emulator work - env['__cdist_core_dir'] = os.path.join(self.base_dir, "core") - env['__cdist_local_base_dir'] = self.temp_dir - - # Submit information to new type emulator - env['__cdist_manifest'] = manifest - env['__cdist_type_base_dir'] = self.type_base_dir - - # Other environment stuff - if extra_env: - env.update(extra_env) - - self.shell_run_or_debug_fail(manifest, [manifest], env=env) - - def object_run(self, cdist_object, mode): - """Run gencode or code for an object""" - log.debug("Running %s from %s", mode, cdist_object) - file=os.path.join(self.object_dir(cdist_object), "require") - requirements = file_to_list(file) - type = self.get_type_from_object(cdist_object) - - for requirement in requirements: - log.debug("Object %s requires %s", cdist_object, requirement) - self.object_run(requirement, mode=mode) - - # - # Setup env Variable: - # - env = os.environ.copy() - env['__target_host'] = self.target_host - env['__global'] = self.out_dir - env["__object"] = self.object_dir(cdist_object) - env["__object_id"] = self.get_object_id_from_object(cdist_object) - env["__object_fq"] = cdist_object - env["__type"] = self.type_dir(type) - - if mode == "gencode": - paths = [ - self.type_dir(type, "gencode-local"), - self.type_dir(type, "gencode-remote") - ] - for bin in paths: - if os.path.isfile(bin): - # omit "gen" from gencode and use it for output base - outfile=os.path.join(self.object_dir(cdist_object), - os.path.basename(bin)[3:]) - - outfile_fd = open(outfile, "w") - - # Need to flush to ensure our write is done before stdout write - outfile_fd.write(CODE_HEADER) - outfile_fd.flush() - - self.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) - outfile_fd.close() - - status = os.stat(outfile) - - # Remove output if empty, else make it executable - if status.st_size == len(CODE_HEADER): - os.unlink(outfile) - else: - # Add header and make executable - identically to 0o700 - os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) - - # Mark object as changed - open(os.path.join(self.object_dir(cdist_object), "changed"), "w").close() - - - if mode == "code": - local_dir = self.object_dir(cdist_object) - remote_dir = self.remote_object_dir(cdist_object) - - bin = os.path.join(local_dir, "code-local") - if os.path.isfile(bin): - self.run_or_fail([bin], remote=False) - - - local_remote_code = os.path.join(local_dir, "code-remote") - remote_remote_code = os.path.join(remote_dir, "code-remote") - if os.path.isfile(local_remote_code): - self.transfer_file(local_remote_code, remote_remote_code) - self.run_or_fail([remote_remote_code], remote=True) - - def stage_prepare(self): - """Do everything for a deploy, minus the actual code stage""" - self.init_deploy() - self.run_global_explores() - self.run_initial_manifest() - - old_objects = [] - objects = self.list_objects() - - # Continue process until no new objects are created anymore - while old_objects != objects: - log.debug("Prepare stage") - old_objects = list(objects) - for cdist_object in objects: - if cdist_object in self.objects_prepared: - log.debug("Skipping rerun of object %s", cdist_object) - continue + """Cdist main class to hold arbitrary data""" + + def __init__(self, target_host, + initial_manifest=False, remote_user="root", + home=None, debug=False): + self.target_host = target_host + self.remote_prefix = ["ssh", "root@" + self.target_host] + + # Setup directory paths + self.temp_dir = tempfile.mkdtemp() + + self.debug = debug + + if home: + self.base_dir = home + else: + self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + + self.conf_dir = os.path.join(self.base_dir, "conf") + self.cache_base_dir = os.path.join(self.base_dir, "cache") + self.cache_dir = os.path.join(self.cache_base_dir, self.target_host) + self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") + self.lib_dir = os.path.join(self.base_dir, "lib") + self.manifest_dir = os.path.join(self.conf_dir, "manifest") + self.type_base_dir = os.path.join(self.conf_dir, "type") + + self.out_dir = os.path.join(self.temp_dir, "out") + os.mkdir(self.out_dir) + + self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") + os.mkdir(self.global_explorer_out_dir) + + self.object_base_dir = os.path.join(self.out_dir, "object") + + # Setup binary directory + contents + self.bin_dir = os.path.join(self.out_dir, "bin") + os.mkdir(self.bin_dir) + self.link_type_to_emulator() + + # List of type explorers transferred + self.type_explorers_transferred = {} + + # objects + self.objects_prepared = [] + + self.remote_user = remote_user + + # Mostly static, but can be overwritten on user demand + if initial_manifest: + self.initial_manifest = initial_manifest + else: + self.initial_manifest = os.path.join(self.manifest_dir, "init") + + def cleanup(self): + # Do not use in __del__: + # http://docs.python.org/reference/datamodel.html#customization + # "other globals referenced by the __del__() method may already have been deleted + # or in the process of being torn down (e.g. the import machinery shutting down)" + # + log.debug("Saving" + self.temp_dir + "to " + self.cache_dir) + # Remove previous cache + if os.path.exists(self.cache_dir): + shutil.rmtree(self.cache_dir) + shutil.move(self.temp_dir, self.cache_dir) + + def remote_mkdir(self, directory): + """Create directory on remote side""" + self.nun_or_fail(["mkdir", "-p", directory], remote=True) + + def remote_cat(filename): + """Use cat on the remote side for output""" + self.run_or_fail(["cat", filename], remote=True) + + def shell_run_or_debug_fail(self, script, *args, **kargs): + # Manually execute /bin/sh, because sh -e does what we want + # and sh -c -e does not exit if /bin/false called + args[0][:0] = [ "/bin/sh", "-e" ] + + remote = False + if "remote" in kargs: + if kargs["remote"]: + args[0][:0] = self.remote_prefix + remote = true + + del kargs["remote"] + + log.debug("Shell exec cmd: %s", args) + log.debug("Shell exec env: %s", kargs['env']) + try: + subprocess.check_call(*args, **kargs) + except subprocess.CalledProcessError: + log.error("Code that raised the error:\n") + if remote: + remote_cat(script) else: - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - self.objects_prepared.append(cdist_object) + script_fd = open(script) + print(script_fd.read()) + script_fd.close() - objects = self.list_objects() + exit_error("Command failed (shell): " + " ".join(*args)) + except OSError as error: + exit_error(" ".join(*args) + ": " + error.args[1]) - def stage_run(self): - """The final (and real) step of deployment""" - log.debug("Actual run objects") - # Now do the final steps over the existing objects - for cdist_object in self.list_objects(): - log.debug("Run object: %s", cdist_object) - self.object_run(cdist_object, mode="gencode") - self.object_run(cdist_object, mode="code") + def run_or_fail(self, *args, **kargs): + if "remote" in kargs: + if kargs["remote"]: + args[0][:0] = self.remote_prefix - def deploy_to(self): - """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.target_host) - time_start = datetime.datetime.now() + del kargs["remote"] - self.stage_prepare() - self.stage_run() + log.debug("Exec: " + " ".join(*args)) + try: + subprocess.check_call(*args, **kargs) + except subprocess.CalledProcessError: + exit_error("Command failed: " + " ".join(*args)) + except OSError as error: + exit_error(" ".join(*args) + ": " + error.args[1]) - time_end = datetime.datetime.now() - duration = time_end - time_start - log.info("Finished run of %s in %s seconds", - self.target_host, - duration.total_seconds()) - def deploy_and_cleanup(self): - """Do what is most often done: deploy & cleanup""" - self.deploy_to() - self.cleanup() + def remove_remote_dir(self, destination): + self.run_or_fail(["rm", "-rf", destination], remote=True) + + def transfer_dir(self, source, destination): + """Transfer directory and previously delete the remote destination""" + self.remove_remote_dir(destination) + self.run_or_fail(["scp", "-qr", source, + self.remote_user + "@" + + self.target_host + ":" + + destination]) + + def transfer_file(self, source, destination): + """Transfer file""" + self.run_or_fail(["scp", "-q", source, + self.remote_user + "@" + + self.target_host + ":" + + destination]) + + def global_explorer_output_path(self, explorer): + """Returns path of the output for a global explorer""" + return os.path.join(self.global_explorer_out_dir, explorer) + + def type_explorer_output_dir(self, cdist_object): + """Returns and creates dir of the output for a type explorer""" + dir = os.path.join(self.object_dir(cdist_object), "explorer") + if not os.path.isdir(dir): + os.mkdir(dir) + + return dir + + def remote_global_explorer_path(self, explorer): + """Returns path to the remote explorer""" + return os.path.join(REMOTE_GLOBAL_EXPLORER_DIR, explorer) + + def list_global_explorers(self): + """Return list of available explorers""" + return os.listdir(self.global_explorer_dir) + + def list_type_explorers(self, type): + """Return list of available explorers for a specific type""" + dir = self.type_dir(type, "explorer") + if os.path.isdir(dir): + list = os.listdir(dir) + else: + list = [] + + log.debug("Explorers for %s in %s: %s", type, dir, list) + + return list + + def list_types(self): + return os.listdir(self.type_base_dir) + + def list_object_paths(self, starting_point): + """Return list of paths of existing objects""" + object_paths = [] + + for content in os.listdir(starting_point): + full_path = os.path.join(starting_point, content) + if os.path.isdir(full_path): + object_paths.extend(self.list_object_paths(starting_point = full_path)) + + # Directory contains .cdist -> is an object + if content == DOT_CDIST: + object_paths.append(starting_point) + + return object_paths + + def get_type_from_object(self, cdist_object): + """Returns the first part (i.e. type) of an object""" + return cdist_object.split(os.sep)[0] + + def get_object_id_from_object(self, cdist_object): + """Returns everything but the first part (i.e. object_id) of an object""" + return os.sep.join(cdist_object.split(os.sep)[1:]) + + def object_dir(self, cdist_object): + """Returns the full path to the object (including .cdist)""" + return os.path.join(self.object_base_dir, cdist_object, DOT_CDIST) + + def remote_object_dir(self, cdist_object): + """Returns the remote full path to the object (including .cdist)""" + return os.path.join(REMOTE_OBJECT_DIR, cdist_object, DOT_CDIST) + + def object_parameter_dir(self, cdist_object): + """Returns the dir to the object parameter""" + return os.path.join(self.object_dir(cdist_object), "parameter") + + def remote_object_parameter_dir(self, cdist_object): + """Returns the remote dir to the object parameter""" + return os.path.join(self.remote_object_dir(cdist_object), "parameter") + + def object_code_paths(self, cdist_object): + """Return paths to code scripts of object""" + return [os.path.join(self.object_dir(cdist_object), "code-local"), + os.path.join(self.object_dir(cdist_object), "code-remote")] + + def list_objects(self): + """Return list of existing objects""" + + objects = [] + if os.path.isdir(self.object_base_dir): + object_paths = self.list_object_paths(self.object_base_dir) + + for path in object_paths: + objects.append(os.path.relpath(path, self.object_base_dir)) + + return objects + + def type_dir(self, type, *args): + """Return directory the type""" + return os.path.join(self.type_base_dir, type, *args) + + def remote_type_explorer_dir(self, type): + """Return remote directory that holds the explorers of a type""" + return os.path.join(REMOTE_TYPE_DIR, type, "explorer") + + def transfer_object_parameter(self, cdist_object): + """Transfer the object parameter to the remote destination""" + # Create base path before using mkdir -p + self.remote_mkdir(self.remote_object_parameter_dir(cdist_object)) + + # Synchronise parameter dir afterwards + self.transfer_dir(self.object_parameter_dir(cdist_object), + self.remote_object_parameter_dir(cdist_object)) + + def transfer_global_explorers(self): + """Transfer the global explorers""" + self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) + self.transfer_dir(self.global_explorer_dir, REMOTE_GLOBAL_EXPLORER_DIR) + + def transfer_type_explorers(self, type): + """Transfer explorers of a type, but only once""" + if type in self.type_explorers_transferred: + log.debug("Skipping retransfer for explorers of %s", type) + return + else: + # Do not retransfer + self.type_explorers_transferred[type] = 1 + + src = self.type_dir(type, "explorer") + remote_base = os.path.join(REMOTE_TYPE_DIR, type) + dst = self.remote_type_explorer_dir(type) + + # Only continue, if there is at least the directory + if os.path.isdir(src): + # Ensure that the path exists + self.remote_mkdir(remote_base) + self.transfer_dir(src, dst) + + + def link_type_to_emulator(self): + """Link type names to cdist-type-emulator""" + source = os.path.abspath(sys.argv[0]) + for type in self.list_types(): + destination = os.path.join(self.bin_dir, type) + log.debug("Linking %s to %s", source, destination) + os.symlink(source, destination) + + def run_global_explores(self): + """Run global explorers""" + explorers = self.list_global_explorers() + if(len(explorers) == 0): + exit_error("No explorers found in", self.global_explorer_dir) + + self.transfer_global_explorers() + for explorer in explorers: + output = self.global_explorer_output_path(explorer) + output_fd = open(output, mode='w') + cmd = [] + cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append(self.remote_global_explorer_path(explorer)) + + self.run_or_fail(cmd, stdout=output_fd, remote=True) + output_fd.close() + + def run_type_explorer(self, cdist_object): + """Run type specific explorers for objects""" + # Based on bin/cdist-object-explorer-run + + # Transfering explorers for this type + type = self.get_type_from_object(cdist_object) + self.transfer_type_explorers(type) + + cmd = [] + cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append("__type_explorer=" + self.remote_type_explorer_dir(type)) + cmd.append("__object=" + self.remote_object_dir(cdist_object)) + cmd.append("__object_id=" + self.get_object_id_from_object(cdist_object)) + cmd.append("__object_fq=" + cdist_object) + + # Need to transfer at least the parameters for objects to be useful + self.transfer_object_parameter(cdist_object) + + explorers = self.list_type_explorers(type) + for explorer in explorers: + remote_cmd = cmd + [os.path.join(self.remote_type_explorer_dir(type), explorer)] + output = os.path.join(self.type_explorer_output_dir(cdist_object), explorer) + output_fd = open(output, mode='w') + log.debug("%s exploring %s using %s storing to %s", + cdist_object, explorer, remote_cmd, output) + + self.run_or_fail(remote_cmd, stdout=output_fd, remote=True) + output_fd.close() + + def init_deploy(self): + """Ensure the base directories are cleaned up""" + log.debug("Creating clean directory structure") + + self.remove_remote_dir(REMOTE_BASE_DIR) + self.remote_mkdir(REMOTE_BASE_DIR) + + def run_initial_manifest(self): + """Run the initial manifest""" + env = { "__manifest" : self.manifest_dir } + self.run_manifest(self.initial_manifest, extra_env=env) + + def run_type_manifest(self, cdist_object): + """Run manifest for a specific object""" + type = self.get_type_from_object(cdist_object) + manifest = self.type_dir(type, "manifest") + + log.debug("%s: Running %s", cdist_object, manifest) + if os.path.exists(manifest): + env = { "__object" : self.object_dir(cdist_object), + "__object_id": self.get_object_id_from_object(cdist_object), + "__object_fq": cdist_object, + "__type": self.type_dir(type) + } + self.run_manifest(manifest, extra_env=env) + + def run_manifest(self, manifest, extra_env=None): + """Run a manifest""" + log.debug("Running manifest %s, env=%s", manifest, extra_env) + env = os.environ.copy() + env['PATH'] = self.bin_dir + ":" + env['PATH'] + + # Information required in every manifest + env['__target_host'] = self.target_host + env['__global'] = self.out_dir + + # Legacy stuff to make cdist-type-emulator work + env['__cdist_core_dir'] = os.path.join(self.base_dir, "core") + env['__cdist_local_base_dir'] = self.temp_dir + + # Submit information to new type emulator + env['__cdist_manifest'] = manifest + env['__cdist_type_base_dir'] = self.type_base_dir + + # Other environment stuff + if extra_env: + env.update(extra_env) + + self.shell_run_or_debug_fail(manifest, [manifest], env=env) + + def object_run(self, cdist_object, mode): + """Run gencode or code for an object""" + log.debug("Running %s from %s", mode, cdist_object) + file=os.path.join(self.object_dir(cdist_object), "require") + requirements = file_to_list(file) + type = self.get_type_from_object(cdist_object) + + for requirement in requirements: + log.debug("Object %s requires %s", cdist_object, requirement) + self.object_run(requirement, mode=mode) + + # + # Setup env Variable: + # + env = os.environ.copy() + env['__target_host'] = self.target_host + env['__global'] = self.out_dir + env["__object"] = self.object_dir(cdist_object) + env["__object_id"] = self.get_object_id_from_object(cdist_object) + env["__object_fq"] = cdist_object + env["__type"] = self.type_dir(type) + + if mode == "gencode": + paths = [ + self.type_dir(type, "gencode-local"), + self.type_dir(type, "gencode-remote") + ] + for bin in paths: + if os.path.isfile(bin): + # omit "gen" from gencode and use it for output base + outfile=os.path.join(self.object_dir(cdist_object), + os.path.basename(bin)[3:]) + + outfile_fd = open(outfile, "w") + + # Need to flush to ensure our write is done before stdout write + outfile_fd.write(CODE_HEADER) + outfile_fd.flush() + + self.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) + outfile_fd.close() + + status = os.stat(outfile) + + # Remove output if empty, else make it executable + if status.st_size == len(CODE_HEADER): + os.unlink(outfile) + else: + # Add header and make executable - identically to 0o700 + os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + + # Mark object as changed + open(os.path.join(self.object_dir(cdist_object), "changed"), "w").close() + + + if mode == "code": + local_dir = self.object_dir(cdist_object) + remote_dir = self.remote_object_dir(cdist_object) + + bin = os.path.join(local_dir, "code-local") + if os.path.isfile(bin): + self.run_or_fail([bin], remote=False) + + + local_remote_code = os.path.join(local_dir, "code-remote") + remote_remote_code = os.path.join(remote_dir, "code-remote") + if os.path.isfile(local_remote_code): + self.transfer_file(local_remote_code, remote_remote_code) + self.run_or_fail([remote_remote_code], remote=True) + + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" + self.init_deploy() + self.run_global_explores() + self.run_initial_manifest() + + old_objects = [] + objects = self.list_objects() + + # Continue process until no new objects are created anymore + while old_objects != objects: + log.debug("Prepare stage") + old_objects = list(objects) + for cdist_object in objects: + if cdist_object in self.objects_prepared: + log.debug("Skipping rerun of object %s", cdist_object) + continue + else: + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + self.objects_prepared.append(cdist_object) + + objects = self.list_objects() + + def stage_run(self): + """The final (and real) step of deployment""" + log.debug("Actual run objects") + # Now do the final steps over the existing objects + for cdist_object in self.list_objects(): + log.debug("Run object: %s", cdist_object) + self.object_run(cdist_object, mode="gencode") + self.object_run(cdist_object, mode="code") + + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + log.info("Deploying to " + self.target_host) + time_start = datetime.datetime.now() + + self.stage_prepare() + self.stage_run() + + time_end = datetime.datetime.now() + duration = time_end - time_start + log.info("Finished run of %s in %s seconds", + self.target_host, + duration.total_seconds()) + + def deploy_and_cleanup(self): + """Do what is most often done: deploy & cleanup""" + self.deploy_to() + self.cleanup() def banner(args): - """Guess what :-)""" - print(BANNER) - sys.exit(0) + """Guess what :-)""" + print(BANNER) + sys.exit(0) def config(args): - """Configure remote system""" - process = {} + """Configure remote system""" + process = {} - time_start = datetime.datetime.now() + time_start = datetime.datetime.now() - for host in args.host: - c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) - if args.parallel: - log.debug("Creating child process for %s", host) - process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) - process[host].start() - else: - c.deploy_and_cleanup() + for host in args.host: + c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) + if args.parallel: + log.debug("Creating child process for %s", host) + process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) + process[host].start() + else: + c.deploy_and_cleanup() - if args.parallel: - for p in process.keys(): - log.debug("Joining %s", p) - process[p].join() + if args.parallel: + for p in process.keys(): + log.debug("Joining %s", p) + process[p].join() - time_end = datetime.datetime.now() - log.info("Total processing time for %s host(s): %s", len(args.host), - (time_end - time_start).total_seconds()) + time_end = datetime.datetime.now() + log.info("Total processing time for %s host(s): %s", len(args.host), + (time_end - time_start).total_seconds()) def install(args): - """Install remote system""" - process = {} + """Install remote system""" + process = {} def emulator(): - """Emulate type commands (i.e. __file and co)""" - type = os.path.basename(sys.argv[0]) - type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type) - param_dir = os.path.join(type_dir, "parameter") - global_dir = os.environ['__global'] - object_source = os.environ['__cdist_manifest'] + """Emulate type commands (i.e. __file and co)""" + type = os.path.basename(sys.argv[0]) + type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type) + param_dir = os.path.join(type_dir, "parameter") + global_dir = os.environ['__global'] + object_source = os.environ['__cdist_manifest'] - parser = argparse.ArgumentParser(add_help=False) + parser = argparse.ArgumentParser(add_help=False) - # Setup optional parameters - for parameter in file_to_list(os.path.join(param_dir, "optional")): - argument = "--" + parameter - parser.add_argument(argument, action='store', required=False) + # Setup optional parameters + for parameter in file_to_list(os.path.join(param_dir, "optional")): + argument = "--" + parameter + parser.add_argument(argument, action='store', required=False) - # Setup required parameters - for parameter in file_to_list(os.path.join(param_dir, "required")): - argument = "--" + parameter - parser.add_argument(argument, action='store', required=True) + # Setup required parameters + for parameter in file_to_list(os.path.join(param_dir, "required")): + argument = "--" + parameter + parser.add_argument(argument, action='store', required=True) - # Setup positional parameter, if not singleton + # Setup positional parameter, if not singleton - if not os.path.isfile(os.path.join(type_dir, "singleton")): - parser.add_argument("object_id", nargs=1) + if not os.path.isfile(os.path.join(type_dir, "singleton")): + parser.add_argument("object_id", nargs=1) - # And finally verify parameter - args = parser.parse_args(sys.argv[1:]) + # And finally verify parameter + args = parser.parse_args(sys.argv[1:]) - # Setup object_id - if os.path.isfile(os.path.join(type_dir, "singleton")): - object_id = "singleton" - else: - object_id = args.object_id[0] - del args.object_id + # Setup object_id + if os.path.isfile(os.path.join(type_dir, "singleton")): + object_id = "singleton" + else: + object_id = args.object_id[0] + del args.object_id - # FIXME: / hardcoded - better portable solution available? - if object_id[0] == '/': - object_id = object_id[1:] + # FIXME: / hardcoded - better portable solution available? + if object_id[0] == '/': + object_id = object_id[1:] - # FIXME: verify object id - log.debug(args) + # FIXME: verify object id + log.debug(args) - object_dir = os.path.join(global_dir, "object", type, - object_id, DOT_CDIST) - param_out_dir = os.path.join(object_dir, "parameter") + object_dir = os.path.join(global_dir, "object", type, + object_id, DOT_CDIST) + param_out_dir = os.path.join(object_dir, "parameter") - object_source_file = os.path.join(object_dir, "source") + object_source_file = os.path.join(object_dir, "source") - if os.path.exists(param_out_dir): - object_exists = True - old_object_source_fd = open(object_source_file, "r") - old_object_source = old_object_source_fd.readlines() - old_object_source_fd.close() + if os.path.exists(param_out_dir): + object_exists = True + old_object_source_fd = open(object_source_file, "r") + old_object_source = old_object_source_fd.readlines() + old_object_source_fd.close() - else: - object_exists = False - try: - os.makedirs(param_out_dir, exist_ok=True) - except OSError as error: - exit_error(param_out_dir + ": " + error.args[1]) + else: + object_exists = False + try: + os.makedirs(param_out_dir, exist_ok=True) + except OSError as error: + exit_error(param_out_dir + ": " + error.args[1]) - # Record parameter - params = vars(args) - for param in params: - value = getattr(args, param) - if value: - file = os.path.join(param_out_dir, param) - log.debug(file + "<-" + param + " = " + value) + # Record parameter + params = vars(args) + for param in params: + value = getattr(args, param) + if value: + file = os.path.join(param_out_dir, param) + log.debug(file + "<-" + param + " = " + value) - # Already exists, verify all parameter are the same - if object_exists: - if not os.path.isfile(file): - print("New parameter + " + param + "specified, aborting") - print("Source = " + old_object_source + "new =" + object_source) - sys.exit(1) + # Already exists, verify all parameter are the same + if object_exists: + if not os.path.isfile(file): + print("New parameter + " + param + "specified, aborting") + print("Source = " + old_object_source + "new =" + object_source) + sys.exit(1) + else: + param_fd = open(file, "r") + param_old = param_fd.readlines() + param_fd.close() + + if(param_old != param): + print("Parameter " + param + " differs: " + " ".join(param_old) + " vs. " + param) + print("Sources: " + " ".join(old_object_source) + " and " + object_source) + sys.exit(1) else: - param_fd = open(file, "r") - param_old = param_fd.readlines() - param_fd.close() - - if(param_old != param): - print("Parameter " + param + " differs: " + " ".join(param_old) + " vs. " + param) - print("Sources: " + " ".join(old_object_source) + " and " + object_source) - sys.exit(1) - else: - param_fd = open(file, "w") - param_fd.writelines(value) - param_fd.close() + param_fd = open(file, "w") + param_fd.writelines(value) + param_fd.close() - # Record requirements - if "__require" in os.environ: - requirements = os.environ['__require'] - print(object_id + ":Writing requirements: " + requirements) - require_fd = open(os.path.join(object_dir, "require"), "a") - require_fd.writelines(requirements.split(" ")) - require_fd.close() + # Record requirements + if "__require" in os.environ: + requirements = os.environ['__require'] + print(object_id + ":Writing requirements: " + requirements) + require_fd = open(os.path.join(object_dir, "require"), "a") + require_fd.writelines(requirements.split(" ")) + require_fd.close() - # Record / Append source - source_fd = open(os.path.join(object_dir, "source"), "a") - source_fd.writelines(object_source) - source_fd.close() + # Record / Append source + source_fd = open(os.path.join(object_dir, "source"), "a") + source_fd.writelines(object_source) + source_fd.close() - # sys.exit(1) - print("Finished " + type + "/" + object_id + repr(params)) + # sys.exit(1) + print("Finished " + type + "/" + object_id + repr(params)) def commandline(): - """Parse command line""" - # Construct parser others can reuse - parser = {} - # Options _all_ parsers have in common - parser['most'] = argparse.ArgumentParser(add_help=False) - parser['most'].add_argument('-d', '--debug', - help='Set log level to debug', action='store_true') + """Parse command line""" + # Construct parser others can reuse + parser = {} + # Options _all_ parsers have in common + parser['most'] = argparse.ArgumentParser(add_help=False) + parser['most'].add_argument('-d', '--debug', + help='Set log level to debug', action='store_true') - # Main subcommand parser - parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION) - parser['main'].add_argument('-V', '--version', - help='Show version', action='version', - version='%(prog)s ' + VERSION) - parser['sub'] = parser['main'].add_subparsers(title="Commands") + # Main subcommand parser + parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION) + parser['main'].add_argument('-V', '--version', + help='Show version', action='version', + version='%(prog)s ' + VERSION) + parser['sub'] = parser['main'].add_subparsers(title="Commands") - # Banner - parser['banner'] = parser['sub'].add_parser('banner', - add_help=False) - parser['banner'].set_defaults(func=banner) + # Banner + parser['banner'] = parser['sub'].add_parser('banner', + add_help=False) + parser['banner'].set_defaults(func=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', - 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') + # 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', + 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') - # Config - parser['config'] = parser['sub'].add_parser('config', - parents=[parser['most'], parser['configinstall']]) - parser['config'].set_defaults(func=config) + # Config + parser['config'] = parser['sub'].add_parser('config', + parents=[parser['most'], parser['configinstall']]) + parser['config'].set_defaults(func=config) - # Install - parser['install'] = parser['sub'].add_parser('install', - parents=[parser['most'], parser['configinstall']]) - parser['install'].set_defaults(func=install) + # Install + parser['install'] = parser['sub'].add_parser('install', + parents=[parser['most'], 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/" + 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:]) + args = parser['main'].parse_args(sys.argv[1:]) - # Most subcommands have --debug, so handle it here - if 'debug' in args: - if args.debug: - logging.root.setLevel(logging.DEBUG) - log.debug(args) + # Most subcommands have --debug, so handle it here + if 'debug' in args: + if args.debug: + logging.root.setLevel(logging.DEBUG) + log.debug(args) - args.func(args) + args.func(args) if __name__ == "__main__": - try: - if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): - emulator() - else: - commandline() - except KeyboardInterrupt: - sys.exit(0) + try: + if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): + emulator() + else: + commandline() + except KeyboardInterrupt: + sys.exit(0) From f4da3b96d8a6fc97b241b43eb0c2520798507926 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 16:41:55 +0200 Subject: [PATCH 0222/1024] fix indentions Signed-off-by: Nico Schottelius --- bin/cdist | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/cdist b/bin/cdist index 2100bd4d..f3b88fdd 100755 --- a/bin/cdist +++ b/bin/cdist @@ -48,16 +48,16 @@ BANNER = """ """ # Given paths from installation -REMOTE_BASE_DIR = "/var/lib/cdist" -REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") -REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") -REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") -REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") +REMOTE_BASE_DIR = "/var/lib/cdist" +REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") +REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") +REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") +REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") CODE_HEADER = "#!/bin/sh -e\n" -DOT_CDIST = ".cdist" +DOT_CDIST = ".cdist" TYPE_PREFIX = "__" -VERSION = "2.0.1" +VERSION = "2.0.1" logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') log = logging.getLogger() @@ -104,13 +104,13 @@ class Cdist: else: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) - self.conf_dir = os.path.join(self.base_dir, "conf") - self.cache_base_dir = os.path.join(self.base_dir, "cache") - self.cache_dir = os.path.join(self.cache_base_dir, self.target_host) + self.conf_dir = os.path.join(self.base_dir, "conf") + self.cache_base_dir = os.path.join(self.base_dir, "cache") + self.cache_dir = os.path.join(self.cache_base_dir, self.target_host) self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") - self.lib_dir = os.path.join(self.base_dir, "lib") - self.manifest_dir = os.path.join(self.conf_dir, "manifest") - self.type_base_dir = os.path.join(self.conf_dir, "type") + self.lib_dir = os.path.join(self.base_dir, "lib") + self.manifest_dir = os.path.join(self.conf_dir, "manifest") + self.type_base_dir = os.path.join(self.conf_dir, "type") self.out_dir = os.path.join(self.temp_dir, "out") os.mkdir(self.out_dir) From ea9dc8d60c648448c42f765fcab265c33cd55c0a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 23 Sep 2011 16:43:25 +0200 Subject: [PATCH 0223/1024] handle errors with exceptions instead of function Signed-off-by: Steven Armstrong --- bin/cdist | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/bin/cdist b/bin/cdist index fe3c17fd..e3d63458 100755 --- a/bin/cdist +++ b/bin/cdist @@ -81,9 +81,9 @@ def file_to_list(filename): return lines -def exit_error(*args): - log.error(*args) - sys.exit(1) +class CdistError(Exception): + """Base exception class for this project""" + pass class Cdist: """Cdist main class to hold arbitrary data""" @@ -185,9 +185,9 @@ class Cdist: print(script_fd.read()) script_fd.close() - exit_error("Command failed (shell): " + " ".join(*args)) + raise CdistError("Command failed (shell): " + " ".join(*args)) except OSError as error: - exit_error(" ".join(*args) + ": " + error.args[1]) + raise CdistError(" ".join(*args) + ": " + error.args[1]) def run_or_fail(self, *args, **kargs): if "remote" in kargs: @@ -200,9 +200,9 @@ class Cdist: try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: - exit_error("Command failed: " + " ".join(*args)) + raise CdistError("Command failed: " + " ".join(*args)) except OSError as error: - exit_error(" ".join(*args) + ": " + error.args[1]) + raise CdistError(" ".join(*args) + ": " + error.args[1]) def remove_remote_dir(self, destination): @@ -368,7 +368,7 @@ class Cdist: """Run global explorers""" explorers = self.list_global_explorers() if(len(explorers) == 0): - exit_error("No explorers found in", self.global_explorer_dir) + raise CdistError("No explorers found in", self.global_explorer_dir) self.transfer_global_explorers() for explorer in explorers: @@ -674,7 +674,7 @@ def emulator(): try: os.makedirs(param_out_dir, exist_ok=True) except OSError as error: - exit_error(param_out_dir + ": " + error.args[1]) + raise CdistError(param_out_dir + ": " + error.args[1]) # Record parameter params = vars(args) @@ -790,3 +790,6 @@ if __name__ == "__main__": commandline() except KeyboardInterrupt: sys.exit(0) + except CdistError as e: + log.error(e) + sys.exit(1) From b72fab3c01804b19f00744321f8e8e854e10c290 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 17:00:48 +0200 Subject: [PATCH 0224/1024] begin split into path module Signed-off-by: Nico Schottelius --- module/cdist/__init__.py | 0 module/cdist/path.py | 11 +++++++++++ 2 files changed, 11 insertions(+) create mode 100644 module/cdist/__init__.py create mode 100644 module/cdist/path.py diff --git a/module/cdist/__init__.py b/module/cdist/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/module/cdist/path.py b/module/cdist/path.py new file mode 100644 index 00000000..37d92940 --- /dev/null +++ b/module/cdist/path.py @@ -0,0 +1,11 @@ +class Path: + """Class that handles path related configurations""" + + def __init__(self, home=None): + if home: + self.base_dir = home + else: + self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + + + print("Base:" + self.base_dir) From 3ace43ff01528717528034bb827ccc03b056b715 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 17:00:59 +0200 Subject: [PATCH 0225/1024] ignore pycache everywhere Signed-off-by: Nico Schottelius --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 259e3be3..bd4ecaaa 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,4 @@ doc/man/man*/docbook-xsl.css cache/ # Python -*/__pycache__/ +**/__pycache__/ From a2f3246758cf954e1eecf682c16992cbf9a6026d Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 23 Sep 2011 17:03:00 +0200 Subject: [PATCH 0226/1024] fix typo /nun_or_fail/run_or_fail/ Signed-off-by: Steven Armstrong --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 0aa661a3..fde7a251 100755 --- a/bin/cdist +++ b/bin/cdist @@ -153,7 +153,7 @@ class Cdist: def remote_mkdir(self, directory): """Create directory on remote side""" - self.nun_or_fail(["mkdir", "-p", directory], remote=True) + self.run_or_fail(["mkdir", "-p", directory], remote=True) def remote_cat(filename): """Use cat on the remote side for output""" From 747517f06782db10da115f3f66f2115cf7e4fa48 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 17:06:42 +0200 Subject: [PATCH 0227/1024] import path information from current cdist Signed-off-by: Nico Schottelius --- module/cdist/path.py | 56 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/module/cdist/path.py b/module/cdist/path.py index 37d92940..ee492cc5 100644 --- a/module/cdist/path.py +++ b/module/cdist/path.py @@ -1,11 +1,59 @@ class Path: """Class that handles path related configurations""" - def __init__(self, home=None): + def __init__(self, target_host, base_dir=None): + # Base and Temp Base if home: - self.base_dir = home + self.base_dir = base_dir else: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) - - print("Base:" + self.base_dir) + self.temp_dir = tempfile.mkdtemp() + + self.conf_dir = os.path.join(self.base_dir, "conf") + self.cache_base_dir = os.path.join(self.base_dir, "cache") + self.cache_dir = os.path.join(self.cache_base_dir, target_host) + self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") + self.lib_dir = os.path.join(self.base_dir, "lib") + self.manifest_dir = os.path.join(self.conf_dir, "manifest") + self.type_base_dir = os.path.join(self.conf_dir, "type") + + self.out_dir = os.path.join(self.temp_dir, "out") + os.mkdir(self.out_dir) + + self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") + os.mkdir(self.global_explorer_out_dir) + + self.object_base_dir = os.path.join(self.out_dir, "object") + + # Setup binary directory + contents + self.bin_dir = os.path.join(self.out_dir, "bin") + os.mkdir(self.bin_dir) + self.link_type_to_emulator() + + # List of type explorers transferred + self.type_explorers_transferred = {} + + # objects + self.objects_prepared = [] + + self.remote_user = remote_user + + # Mostly static, but can be overwritten on user demand + if initial_manifest: + self.initial_manifest = initial_manifest + else: + self.initial_manifest = os.path.join(self.manifest_dir, "init") + + def cleanup(self): + # Do not use in __del__: + # http://docs.python.org/reference/datamodel.html#customization + # "other globals referenced by the __del__() method may already have been deleted + # or in the process of being torn down (e.g. the import machinery shutting down)" + # + log.debug("Saving" + self.temp_dir + "to " + self.cache_dir) + # Remove previous cache + if os.path.exists(self.cache_dir): + shutil.rmtree(self.cache_dir) + shutil.move(self.temp_dir, self.cache_dir) + From 26772939ca8dce14507358f100cbfd9bdeacdb4d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 17:11:03 +0200 Subject: [PATCH 0228/1024] import whole cdist into path.py and strip down (most stuff is moved here anyway) Signed-off-by: Nico Schottelius --- module/cdist/path.py | 665 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 665 insertions(+) diff --git a/module/cdist/path.py b/module/cdist/path.py index ee492cc5..387481ca 100644 --- a/module/cdist/path.py +++ b/module/cdist/path.py @@ -1,3 +1,28 @@ +# Given paths from installation +REMOTE_BASE_DIR = "/var/lib/cdist" +REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") +REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") +REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") +REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") + +CODE_HEADER = "#!/bin/sh -e\n" +DOT_CDIST = ".cdist" +TYPE_PREFIX = "__" + +def file_to_list(filename): + """Return list from \n seperated file""" + if os.path.isfile(filename): + file_fd = open(filename, "r") + lines = file_fd.readlines() + file_fd.close() + + # Remove \n from all lines + lines = map(lambda s: s.strip(), lines) + else: + lines = [] + + return lines + class Path: """Class that handles path related configurations""" @@ -57,3 +82,643 @@ class Path: shutil.rmtree(self.cache_dir) shutil.move(self.temp_dir, self.cache_dir) + + def remote_mkdir(self, directory): + """Create directory on remote side""" + self.run_or_fail(["mkdir", "-p", directory], remote=True) + + def remote_cat(filename): + """Use cat on the remote side for output""" + self.run_or_fail(["cat", filename], remote=True) + + def shell_run_or_debug_fail(self, script, *args, **kargs): + # Manually execute /bin/sh, because sh -e does what we want + # and sh -c -e does not exit if /bin/false called + args[0][:0] = [ "/bin/sh", "-e" ] + + remote = False + if "remote" in kargs: + if kargs["remote"]: + args[0][:0] = self.remote_prefix + remote = true + + del kargs["remote"] + + log.debug("Shell exec cmd: %s", args) + log.debug("Shell exec env: %s", kargs['env']) + try: + subprocess.check_call(*args, **kargs) + except subprocess.CalledProcessError: + log.error("Code that raised the error:\n") + if remote: + remote_cat(script) + else: + script_fd = open(script) + print(script_fd.read()) + script_fd.close() + + exit_error("Command failed (shell): " + " ".join(*args)) + except OSError as error: + exit_error(" ".join(*args) + ": " + error.args[1]) + + def run_or_fail(self, *args, **kargs): + if "remote" in kargs: + if kargs["remote"]: + args[0][:0] = self.remote_prefix + + del kargs["remote"] + + log.debug("Exec: " + " ".join(*args)) + try: + subprocess.check_call(*args, **kargs) + except subprocess.CalledProcessError: + exit_error("Command failed: " + " ".join(*args)) + except OSError as error: + exit_error(" ".join(*args) + ": " + error.args[1]) + + + def remove_remote_dir(self, destination): + self.run_or_fail(["rm", "-rf", destination], remote=True) + + def transfer_dir(self, source, destination): + """Transfer directory and previously delete the remote destination""" + self.remove_remote_dir(destination) + self.run_or_fail(["scp", "-qr", source, + self.remote_user + "@" + + self.target_host + ":" + + destination]) + + def transfer_file(self, source, destination): + """Transfer file""" + self.run_or_fail(["scp", "-q", source, + self.remote_user + "@" + + self.target_host + ":" + + destination]) + + def global_explorer_output_path(self, explorer): + """Returns path of the output for a global explorer""" + return os.path.join(self.global_explorer_out_dir, explorer) + + def type_explorer_output_dir(self, cdist_object): + """Returns and creates dir of the output for a type explorer""" + dir = os.path.join(self.object_dir(cdist_object), "explorer") + if not os.path.isdir(dir): + os.mkdir(dir) + + return dir + + def remote_global_explorer_path(self, explorer): + """Returns path to the remote explorer""" + return os.path.join(REMOTE_GLOBAL_EXPLORER_DIR, explorer) + + def list_global_explorers(self): + """Return list of available explorers""" + return os.listdir(self.global_explorer_dir) + + def list_type_explorers(self, type): + """Return list of available explorers for a specific type""" + dir = self.type_dir(type, "explorer") + if os.path.isdir(dir): + list = os.listdir(dir) + else: + list = [] + + log.debug("Explorers for %s in %s: %s", type, dir, list) + + return list + + def list_types(self): + return os.listdir(self.type_base_dir) + + def list_object_paths(self, starting_point): + """Return list of paths of existing objects""" + object_paths = [] + + for content in os.listdir(starting_point): + full_path = os.path.join(starting_point, content) + if os.path.isdir(full_path): + object_paths.extend(self.list_object_paths(starting_point = full_path)) + + # Directory contains .cdist -> is an object + if content == DOT_CDIST: + object_paths.append(starting_point) + + return object_paths + + def get_type_from_object(self, cdist_object): + """Returns the first part (i.e. type) of an object""" + return cdist_object.split(os.sep)[0] + + def get_object_id_from_object(self, cdist_object): + """Returns everything but the first part (i.e. object_id) of an object""" + return os.sep.join(cdist_object.split(os.sep)[1:]) + + def object_dir(self, cdist_object): + """Returns the full path to the object (including .cdist)""" + return os.path.join(self.object_base_dir, cdist_object, DOT_CDIST) + + def remote_object_dir(self, cdist_object): + """Returns the remote full path to the object (including .cdist)""" + return os.path.join(REMOTE_OBJECT_DIR, cdist_object, DOT_CDIST) + + def object_parameter_dir(self, cdist_object): + """Returns the dir to the object parameter""" + return os.path.join(self.object_dir(cdist_object), "parameter") + + def remote_object_parameter_dir(self, cdist_object): + """Returns the remote dir to the object parameter""" + return os.path.join(self.remote_object_dir(cdist_object), "parameter") + + def object_code_paths(self, cdist_object): + """Return paths to code scripts of object""" + return [os.path.join(self.object_dir(cdist_object), "code-local"), + os.path.join(self.object_dir(cdist_object), "code-remote")] + + def list_objects(self): + """Return list of existing objects""" + + objects = [] + if os.path.isdir(self.object_base_dir): + object_paths = self.list_object_paths(self.object_base_dir) + + for path in object_paths: + objects.append(os.path.relpath(path, self.object_base_dir)) + + return objects + + def type_dir(self, type, *args): + """Return directory the type""" + return os.path.join(self.type_base_dir, type, *args) + + def remote_type_explorer_dir(self, type): + """Return remote directory that holds the explorers of a type""" + return os.path.join(REMOTE_TYPE_DIR, type, "explorer") + + def transfer_object_parameter(self, cdist_object): + """Transfer the object parameter to the remote destination""" + # Create base path before using mkdir -p + self.remote_mkdir(self.remote_object_parameter_dir(cdist_object)) + + # Synchronise parameter dir afterwards + self.transfer_dir(self.object_parameter_dir(cdist_object), + self.remote_object_parameter_dir(cdist_object)) + + def transfer_global_explorers(self): + """Transfer the global explorers""" + self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) + self.transfer_dir(self.global_explorer_dir, REMOTE_GLOBAL_EXPLORER_DIR) + + def transfer_type_explorers(self, type): + """Transfer explorers of a type, but only once""" + if type in self.type_explorers_transferred: + log.debug("Skipping retransfer for explorers of %s", type) + return + else: + # Do not retransfer + self.type_explorers_transferred[type] = 1 + + src = self.type_dir(type, "explorer") + remote_base = os.path.join(REMOTE_TYPE_DIR, type) + dst = self.remote_type_explorer_dir(type) + + # Only continue, if there is at least the directory + if os.path.isdir(src): + # Ensure that the path exists + self.remote_mkdir(remote_base) + self.transfer_dir(src, dst) + + + def link_type_to_emulator(self): + """Link type names to cdist-type-emulator""" + source = os.path.abspath(sys.argv[0]) + for type in self.list_types(): + destination = os.path.join(self.bin_dir, type) + log.debug("Linking %s to %s", source, destination) + os.symlink(source, destination) + + def run_global_explores(self): + """Run global explorers""" + explorers = self.list_global_explorers() + if(len(explorers) == 0): + exit_error("No explorers found in", self.global_explorer_dir) + + self.transfer_global_explorers() + for explorer in explorers: + output = self.global_explorer_output_path(explorer) + output_fd = open(output, mode='w') + cmd = [] + cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append(self.remote_global_explorer_path(explorer)) + + self.run_or_fail(cmd, stdout=output_fd, remote=True) + output_fd.close() + + def run_type_explorer(self, cdist_object): + """Run type specific explorers for objects""" + # Based on bin/cdist-object-explorer-run + + # Transfering explorers for this type + type = self.get_type_from_object(cdist_object) + self.transfer_type_explorers(type) + + cmd = [] + cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append("__type_explorer=" + self.remote_type_explorer_dir(type)) + cmd.append("__object=" + self.remote_object_dir(cdist_object)) + cmd.append("__object_id=" + self.get_object_id_from_object(cdist_object)) + cmd.append("__object_fq=" + cdist_object) + + # Need to transfer at least the parameters for objects to be useful + self.transfer_object_parameter(cdist_object) + + explorers = self.list_type_explorers(type) + for explorer in explorers: + remote_cmd = cmd + [os.path.join(self.remote_type_explorer_dir(type), explorer)] + output = os.path.join(self.type_explorer_output_dir(cdist_object), explorer) + output_fd = open(output, mode='w') + log.debug("%s exploring %s using %s storing to %s", + cdist_object, explorer, remote_cmd, output) + + self.run_or_fail(remote_cmd, stdout=output_fd, remote=True) + output_fd.close() + + def init_deploy(self): + """Ensure the base directories are cleaned up""" + log.debug("Creating clean directory structure") + + self.remove_remote_dir(REMOTE_BASE_DIR) + self.remote_mkdir(REMOTE_BASE_DIR) + + def run_initial_manifest(self): + """Run the initial manifest""" + env = { "__manifest" : self.manifest_dir } + self.run_manifest(self.initial_manifest, extra_env=env) + + def run_type_manifest(self, cdist_object): + """Run manifest for a specific object""" + type = self.get_type_from_object(cdist_object) + manifest = self.type_dir(type, "manifest") + + log.debug("%s: Running %s", cdist_object, manifest) + if os.path.exists(manifest): + env = { "__object" : self.object_dir(cdist_object), + "__object_id": self.get_object_id_from_object(cdist_object), + "__object_fq": cdist_object, + "__type": self.type_dir(type) + } + self.run_manifest(manifest, extra_env=env) + + def run_manifest(self, manifest, extra_env=None): + """Run a manifest""" + log.debug("Running manifest %s, env=%s", manifest, extra_env) + env = os.environ.copy() + env['PATH'] = self.bin_dir + ":" + env['PATH'] + + # Information required in every manifest + env['__target_host'] = self.target_host + env['__global'] = self.out_dir + + # Legacy stuff to make cdist-type-emulator work + env['__cdist_core_dir'] = os.path.join(self.base_dir, "core") + env['__cdist_local_base_dir'] = self.temp_dir + + # Submit information to new type emulator + env['__cdist_manifest'] = manifest + env['__cdist_type_base_dir'] = self.type_base_dir + + # Other environment stuff + if extra_env: + env.update(extra_env) + + self.shell_run_or_debug_fail(manifest, [manifest], env=env) + + def object_run(self, cdist_object, mode): + """Run gencode or code for an object""" + log.debug("Running %s from %s", mode, cdist_object) + file=os.path.join(self.object_dir(cdist_object), "require") + requirements = file_to_list(file) + type = self.get_type_from_object(cdist_object) + + for requirement in requirements: + log.debug("Object %s requires %s", cdist_object, requirement) + self.object_run(requirement, mode=mode) + + # + # Setup env Variable: + # + env = os.environ.copy() + env['__target_host'] = self.target_host + env['__global'] = self.out_dir + env["__object"] = self.object_dir(cdist_object) + env["__object_id"] = self.get_object_id_from_object(cdist_object) + env["__object_fq"] = cdist_object + env["__type"] = self.type_dir(type) + + if mode == "gencode": + paths = [ + self.type_dir(type, "gencode-local"), + self.type_dir(type, "gencode-remote") + ] + for bin in paths: + if os.path.isfile(bin): + # omit "gen" from gencode and use it for output base + outfile=os.path.join(self.object_dir(cdist_object), + os.path.basename(bin)[3:]) + + outfile_fd = open(outfile, "w") + + # Need to flush to ensure our write is done before stdout write + outfile_fd.write(CODE_HEADER) + outfile_fd.flush() + + self.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) + outfile_fd.close() + + status = os.stat(outfile) + + # Remove output if empty, else make it executable + if status.st_size == len(CODE_HEADER): + os.unlink(outfile) + else: + # Add header and make executable - identically to 0o700 + os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + + # Mark object as changed + open(os.path.join(self.object_dir(cdist_object), "changed"), "w").close() + + + if mode == "code": + local_dir = self.object_dir(cdist_object) + remote_dir = self.remote_object_dir(cdist_object) + + bin = os.path.join(local_dir, "code-local") + if os.path.isfile(bin): + self.run_or_fail([bin], remote=False) + + + local_remote_code = os.path.join(local_dir, "code-remote") + remote_remote_code = os.path.join(remote_dir, "code-remote") + if os.path.isfile(local_remote_code): + self.transfer_file(local_remote_code, remote_remote_code) + self.run_or_fail([remote_remote_code], remote=True) + + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" + self.init_deploy() + self.run_global_explores() + self.run_initial_manifest() + + old_objects = [] + objects = self.list_objects() + + # Continue process until no new objects are created anymore + while old_objects != objects: + log.debug("Prepare stage") + old_objects = list(objects) + for cdist_object in objects: + if cdist_object in self.objects_prepared: + log.debug("Skipping rerun of object %s", cdist_object) + continue + else: + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + self.objects_prepared.append(cdist_object) + + objects = self.list_objects() + + def stage_run(self): + """The final (and real) step of deployment""" + log.debug("Actual run objects") + # Now do the final steps over the existing objects + for cdist_object in self.list_objects(): + log.debug("Run object: %s", cdist_object) + self.object_run(cdist_object, mode="gencode") + self.object_run(cdist_object, mode="code") + + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + log.info("Deploying to " + self.target_host) + time_start = datetime.datetime.now() + + self.stage_prepare() + self.stage_run() + + time_end = datetime.datetime.now() + duration = time_end - time_start + log.info("Finished run of %s in %s seconds", + self.target_host, + duration.total_seconds()) + + def deploy_and_cleanup(self): + """Do what is most often done: deploy & cleanup""" + self.deploy_to() + self.cleanup() + +def banner(args): + """Guess what :-)""" + print(BANNER) + sys.exit(0) + +def config(args): + """Configure remote system""" + process = {} + + time_start = datetime.datetime.now() + + for host in args.host: + c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) + if args.parallel: + log.debug("Creating child process for %s", host) + process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) + process[host].start() + else: + c.deploy_and_cleanup() + + if args.parallel: + for p in process.keys(): + log.debug("Joining %s", p) + process[p].join() + + time_end = datetime.datetime.now() + log.info("Total processing time for %s host(s): %s", len(args.host), + (time_end - time_start).total_seconds()) + +def install(args): + """Install remote system""" + process = {} + +def emulator(): + """Emulate type commands (i.e. __file and co)""" + type = os.path.basename(sys.argv[0]) + type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type) + param_dir = os.path.join(type_dir, "parameter") + global_dir = os.environ['__global'] + object_source = os.environ['__cdist_manifest'] + + parser = argparse.ArgumentParser(add_help=False) + + # Setup optional parameters + for parameter in file_to_list(os.path.join(param_dir, "optional")): + argument = "--" + parameter + parser.add_argument(argument, action='store', required=False) + + # Setup required parameters + for parameter in file_to_list(os.path.join(param_dir, "required")): + argument = "--" + parameter + parser.add_argument(argument, action='store', required=True) + + # Setup positional parameter, if not singleton + + if not os.path.isfile(os.path.join(type_dir, "singleton")): + parser.add_argument("object_id", nargs=1) + + # And finally verify parameter + args = parser.parse_args(sys.argv[1:]) + + # Setup object_id + if os.path.isfile(os.path.join(type_dir, "singleton")): + object_id = "singleton" + else: + object_id = args.object_id[0] + del args.object_id + + # FIXME: / hardcoded - better portable solution available? + if object_id[0] == '/': + object_id = object_id[1:] + + # FIXME: verify object id + log.debug(args) + + object_dir = os.path.join(global_dir, "object", type, + object_id, DOT_CDIST) + param_out_dir = os.path.join(object_dir, "parameter") + + object_source_file = os.path.join(object_dir, "source") + + if os.path.exists(param_out_dir): + object_exists = True + old_object_source_fd = open(object_source_file, "r") + old_object_source = old_object_source_fd.readlines() + old_object_source_fd.close() + + else: + object_exists = False + try: + os.makedirs(param_out_dir, exist_ok=True) + except OSError as error: + exit_error(param_out_dir + ": " + error.args[1]) + + # Record parameter + params = vars(args) + for param in params: + value = getattr(args, param) + if value: + file = os.path.join(param_out_dir, param) + log.debug(file + "<-" + param + " = " + value) + + # Already exists, verify all parameter are the same + if object_exists: + if not os.path.isfile(file): + print("New parameter + " + param + "specified, aborting") + print("Source = " + old_object_source + "new =" + object_source) + sys.exit(1) + else: + param_fd = open(file, "r") + param_old = param_fd.readlines() + param_fd.close() + + if(param_old != param): + print("Parameter " + param + " differs: " + " ".join(param_old) + " vs. " + param) + print("Sources: " + " ".join(old_object_source) + " and " + object_source) + sys.exit(1) + else: + param_fd = open(file, "w") + param_fd.writelines(value) + param_fd.close() + + # Record requirements + if "__require" in os.environ: + requirements = os.environ['__require'] + print(object_id + ":Writing requirements: " + requirements) + require_fd = open(os.path.join(object_dir, "require"), "a") + require_fd.writelines(requirements.split(" ")) + require_fd.close() + + # Record / Append source + source_fd = open(os.path.join(object_dir, "source"), "a") + source_fd.writelines(object_source) + source_fd.close() + + # sys.exit(1) + print("Finished " + type + "/" + object_id + repr(params)) + + +def commandline(): + """Parse command line""" + # Construct parser others can reuse + parser = {} + # Options _all_ parsers have in common + parser['most'] = argparse.ArgumentParser(add_help=False) + parser['most'].add_argument('-d', '--debug', + help='Set log level to debug', action='store_true') + + # Main subcommand parser + parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION) + parser['main'].add_argument('-V', '--version', + help='Show version', action='version', + version='%(prog)s ' + VERSION) + parser['sub'] = parser['main'].add_subparsers(title="Commands") + + # Banner + parser['banner'] = parser['sub'].add_parser('banner', + add_help=False) + parser['banner'].set_defaults(func=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', + 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') + + # Config + parser['config'] = parser['sub'].add_parser('config', + parents=[parser['most'], parser['configinstall']]) + parser['config'].set_defaults(func=config) + + # Install + parser['install'] = parser['sub'].add_parser('install', + parents=[parser['most'], 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:]) + + # Most subcommands have --debug, so handle it here + if 'debug' in args: + if args.debug: + logging.root.setLevel(logging.DEBUG) + log.debug(args) + + args.func(args) + +if __name__ == "__main__": + try: + if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): + emulator() + else: + commandline() + except KeyboardInterrupt: + sys.exit(0) From 02b9b71ffeb38e26af06b7cf06dc8e9e494f08f9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 17:11:39 +0200 Subject: [PATCH 0229/1024] remove exec functions from path Signed-off-by: Nico Schottelius --- module/cdist/path.py | 46 -------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/module/cdist/path.py b/module/cdist/path.py index 387481ca..964e29b8 100644 --- a/module/cdist/path.py +++ b/module/cdist/path.py @@ -91,52 +91,6 @@ class Path: """Use cat on the remote side for output""" self.run_or_fail(["cat", filename], remote=True) - def shell_run_or_debug_fail(self, script, *args, **kargs): - # Manually execute /bin/sh, because sh -e does what we want - # and sh -c -e does not exit if /bin/false called - args[0][:0] = [ "/bin/sh", "-e" ] - - remote = False - if "remote" in kargs: - if kargs["remote"]: - args[0][:0] = self.remote_prefix - remote = true - - del kargs["remote"] - - log.debug("Shell exec cmd: %s", args) - log.debug("Shell exec env: %s", kargs['env']) - try: - subprocess.check_call(*args, **kargs) - except subprocess.CalledProcessError: - log.error("Code that raised the error:\n") - if remote: - remote_cat(script) - else: - script_fd = open(script) - print(script_fd.read()) - script_fd.close() - - exit_error("Command failed (shell): " + " ".join(*args)) - except OSError as error: - exit_error(" ".join(*args) + ": " + error.args[1]) - - def run_or_fail(self, *args, **kargs): - if "remote" in kargs: - if kargs["remote"]: - args[0][:0] = self.remote_prefix - - del kargs["remote"] - - log.debug("Exec: " + " ".join(*args)) - try: - subprocess.check_call(*args, **kargs) - except subprocess.CalledProcessError: - exit_error("Command failed: " + " ".join(*args)) - except OSError as error: - exit_error(" ".join(*args) + ": " + error.args[1]) - - def remove_remote_dir(self, destination): self.run_or_fail(["rm", "-rf", destination], remote=True) From 7bc4f74d50d0ff115e62981d17ed6b732590fa69 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 17:17:59 +0200 Subject: [PATCH 0230/1024] remove non path stuff from path Signed-off-by: Nico Schottelius --- module/cdist/path.py | 431 +------------------------------------------ 1 file changed, 4 insertions(+), 427 deletions(-) diff --git a/module/cdist/path.py b/module/cdist/path.py index 964e29b8..c72d29a8 100644 --- a/module/cdist/path.py +++ b/module/cdist/path.py @@ -23,6 +23,9 @@ def file_to_list(filename): return lines +# FIXME: self.run_or_fail needs to be elsewhere! +# Exec? + class Path: """Class that handles path related configurations""" @@ -159,6 +162,7 @@ class Path: return object_paths + # FIXME def get_type_from_object(self, cdist_object): """Returns the first part (i.e. type) of an object""" return cdist_object.split(os.sep)[0] @@ -249,430 +253,3 @@ class Path: destination = os.path.join(self.bin_dir, type) log.debug("Linking %s to %s", source, destination) os.symlink(source, destination) - - def run_global_explores(self): - """Run global explorers""" - explorers = self.list_global_explorers() - if(len(explorers) == 0): - exit_error("No explorers found in", self.global_explorer_dir) - - self.transfer_global_explorers() - for explorer in explorers: - output = self.global_explorer_output_path(explorer) - output_fd = open(output, mode='w') - cmd = [] - cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append(self.remote_global_explorer_path(explorer)) - - self.run_or_fail(cmd, stdout=output_fd, remote=True) - output_fd.close() - - def run_type_explorer(self, cdist_object): - """Run type specific explorers for objects""" - # Based on bin/cdist-object-explorer-run - - # Transfering explorers for this type - type = self.get_type_from_object(cdist_object) - self.transfer_type_explorers(type) - - cmd = [] - cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append("__type_explorer=" + self.remote_type_explorer_dir(type)) - cmd.append("__object=" + self.remote_object_dir(cdist_object)) - cmd.append("__object_id=" + self.get_object_id_from_object(cdist_object)) - cmd.append("__object_fq=" + cdist_object) - - # Need to transfer at least the parameters for objects to be useful - self.transfer_object_parameter(cdist_object) - - explorers = self.list_type_explorers(type) - for explorer in explorers: - remote_cmd = cmd + [os.path.join(self.remote_type_explorer_dir(type), explorer)] - output = os.path.join(self.type_explorer_output_dir(cdist_object), explorer) - output_fd = open(output, mode='w') - log.debug("%s exploring %s using %s storing to %s", - cdist_object, explorer, remote_cmd, output) - - self.run_or_fail(remote_cmd, stdout=output_fd, remote=True) - output_fd.close() - - def init_deploy(self): - """Ensure the base directories are cleaned up""" - log.debug("Creating clean directory structure") - - self.remove_remote_dir(REMOTE_BASE_DIR) - self.remote_mkdir(REMOTE_BASE_DIR) - - def run_initial_manifest(self): - """Run the initial manifest""" - env = { "__manifest" : self.manifest_dir } - self.run_manifest(self.initial_manifest, extra_env=env) - - def run_type_manifest(self, cdist_object): - """Run manifest for a specific object""" - type = self.get_type_from_object(cdist_object) - manifest = self.type_dir(type, "manifest") - - log.debug("%s: Running %s", cdist_object, manifest) - if os.path.exists(manifest): - env = { "__object" : self.object_dir(cdist_object), - "__object_id": self.get_object_id_from_object(cdist_object), - "__object_fq": cdist_object, - "__type": self.type_dir(type) - } - self.run_manifest(manifest, extra_env=env) - - def run_manifest(self, manifest, extra_env=None): - """Run a manifest""" - log.debug("Running manifest %s, env=%s", manifest, extra_env) - env = os.environ.copy() - env['PATH'] = self.bin_dir + ":" + env['PATH'] - - # Information required in every manifest - env['__target_host'] = self.target_host - env['__global'] = self.out_dir - - # Legacy stuff to make cdist-type-emulator work - env['__cdist_core_dir'] = os.path.join(self.base_dir, "core") - env['__cdist_local_base_dir'] = self.temp_dir - - # Submit information to new type emulator - env['__cdist_manifest'] = manifest - env['__cdist_type_base_dir'] = self.type_base_dir - - # Other environment stuff - if extra_env: - env.update(extra_env) - - self.shell_run_or_debug_fail(manifest, [manifest], env=env) - - def object_run(self, cdist_object, mode): - """Run gencode or code for an object""" - log.debug("Running %s from %s", mode, cdist_object) - file=os.path.join(self.object_dir(cdist_object), "require") - requirements = file_to_list(file) - type = self.get_type_from_object(cdist_object) - - for requirement in requirements: - log.debug("Object %s requires %s", cdist_object, requirement) - self.object_run(requirement, mode=mode) - - # - # Setup env Variable: - # - env = os.environ.copy() - env['__target_host'] = self.target_host - env['__global'] = self.out_dir - env["__object"] = self.object_dir(cdist_object) - env["__object_id"] = self.get_object_id_from_object(cdist_object) - env["__object_fq"] = cdist_object - env["__type"] = self.type_dir(type) - - if mode == "gencode": - paths = [ - self.type_dir(type, "gencode-local"), - self.type_dir(type, "gencode-remote") - ] - for bin in paths: - if os.path.isfile(bin): - # omit "gen" from gencode and use it for output base - outfile=os.path.join(self.object_dir(cdist_object), - os.path.basename(bin)[3:]) - - outfile_fd = open(outfile, "w") - - # Need to flush to ensure our write is done before stdout write - outfile_fd.write(CODE_HEADER) - outfile_fd.flush() - - self.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) - outfile_fd.close() - - status = os.stat(outfile) - - # Remove output if empty, else make it executable - if status.st_size == len(CODE_HEADER): - os.unlink(outfile) - else: - # Add header and make executable - identically to 0o700 - os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) - - # Mark object as changed - open(os.path.join(self.object_dir(cdist_object), "changed"), "w").close() - - - if mode == "code": - local_dir = self.object_dir(cdist_object) - remote_dir = self.remote_object_dir(cdist_object) - - bin = os.path.join(local_dir, "code-local") - if os.path.isfile(bin): - self.run_or_fail([bin], remote=False) - - - local_remote_code = os.path.join(local_dir, "code-remote") - remote_remote_code = os.path.join(remote_dir, "code-remote") - if os.path.isfile(local_remote_code): - self.transfer_file(local_remote_code, remote_remote_code) - self.run_or_fail([remote_remote_code], remote=True) - - def stage_prepare(self): - """Do everything for a deploy, minus the actual code stage""" - self.init_deploy() - self.run_global_explores() - self.run_initial_manifest() - - old_objects = [] - objects = self.list_objects() - - # Continue process until no new objects are created anymore - while old_objects != objects: - log.debug("Prepare stage") - old_objects = list(objects) - for cdist_object in objects: - if cdist_object in self.objects_prepared: - log.debug("Skipping rerun of object %s", cdist_object) - continue - else: - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - self.objects_prepared.append(cdist_object) - - objects = self.list_objects() - - def stage_run(self): - """The final (and real) step of deployment""" - log.debug("Actual run objects") - # Now do the final steps over the existing objects - for cdist_object in self.list_objects(): - log.debug("Run object: %s", cdist_object) - self.object_run(cdist_object, mode="gencode") - self.object_run(cdist_object, mode="code") - - def deploy_to(self): - """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.target_host) - time_start = datetime.datetime.now() - - self.stage_prepare() - self.stage_run() - - time_end = datetime.datetime.now() - duration = time_end - time_start - log.info("Finished run of %s in %s seconds", - self.target_host, - duration.total_seconds()) - - def deploy_and_cleanup(self): - """Do what is most often done: deploy & cleanup""" - self.deploy_to() - self.cleanup() - -def banner(args): - """Guess what :-)""" - print(BANNER) - sys.exit(0) - -def config(args): - """Configure remote system""" - process = {} - - time_start = datetime.datetime.now() - - for host in args.host: - c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) - if args.parallel: - log.debug("Creating child process for %s", host) - process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) - process[host].start() - else: - c.deploy_and_cleanup() - - if args.parallel: - for p in process.keys(): - log.debug("Joining %s", p) - process[p].join() - - time_end = datetime.datetime.now() - log.info("Total processing time for %s host(s): %s", len(args.host), - (time_end - time_start).total_seconds()) - -def install(args): - """Install remote system""" - process = {} - -def emulator(): - """Emulate type commands (i.e. __file and co)""" - type = os.path.basename(sys.argv[0]) - type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type) - param_dir = os.path.join(type_dir, "parameter") - global_dir = os.environ['__global'] - object_source = os.environ['__cdist_manifest'] - - parser = argparse.ArgumentParser(add_help=False) - - # Setup optional parameters - for parameter in file_to_list(os.path.join(param_dir, "optional")): - argument = "--" + parameter - parser.add_argument(argument, action='store', required=False) - - # Setup required parameters - for parameter in file_to_list(os.path.join(param_dir, "required")): - argument = "--" + parameter - parser.add_argument(argument, action='store', required=True) - - # Setup positional parameter, if not singleton - - if not os.path.isfile(os.path.join(type_dir, "singleton")): - parser.add_argument("object_id", nargs=1) - - # And finally verify parameter - args = parser.parse_args(sys.argv[1:]) - - # Setup object_id - if os.path.isfile(os.path.join(type_dir, "singleton")): - object_id = "singleton" - else: - object_id = args.object_id[0] - del args.object_id - - # FIXME: / hardcoded - better portable solution available? - if object_id[0] == '/': - object_id = object_id[1:] - - # FIXME: verify object id - log.debug(args) - - object_dir = os.path.join(global_dir, "object", type, - object_id, DOT_CDIST) - param_out_dir = os.path.join(object_dir, "parameter") - - object_source_file = os.path.join(object_dir, "source") - - if os.path.exists(param_out_dir): - object_exists = True - old_object_source_fd = open(object_source_file, "r") - old_object_source = old_object_source_fd.readlines() - old_object_source_fd.close() - - else: - object_exists = False - try: - os.makedirs(param_out_dir, exist_ok=True) - except OSError as error: - exit_error(param_out_dir + ": " + error.args[1]) - - # Record parameter - params = vars(args) - for param in params: - value = getattr(args, param) - if value: - file = os.path.join(param_out_dir, param) - log.debug(file + "<-" + param + " = " + value) - - # Already exists, verify all parameter are the same - if object_exists: - if not os.path.isfile(file): - print("New parameter + " + param + "specified, aborting") - print("Source = " + old_object_source + "new =" + object_source) - sys.exit(1) - else: - param_fd = open(file, "r") - param_old = param_fd.readlines() - param_fd.close() - - if(param_old != param): - print("Parameter " + param + " differs: " + " ".join(param_old) + " vs. " + param) - print("Sources: " + " ".join(old_object_source) + " and " + object_source) - sys.exit(1) - else: - param_fd = open(file, "w") - param_fd.writelines(value) - param_fd.close() - - # Record requirements - if "__require" in os.environ: - requirements = os.environ['__require'] - print(object_id + ":Writing requirements: " + requirements) - require_fd = open(os.path.join(object_dir, "require"), "a") - require_fd.writelines(requirements.split(" ")) - require_fd.close() - - # Record / Append source - source_fd = open(os.path.join(object_dir, "source"), "a") - source_fd.writelines(object_source) - source_fd.close() - - # sys.exit(1) - print("Finished " + type + "/" + object_id + repr(params)) - - -def commandline(): - """Parse command line""" - # Construct parser others can reuse - parser = {} - # Options _all_ parsers have in common - parser['most'] = argparse.ArgumentParser(add_help=False) - parser['most'].add_argument('-d', '--debug', - help='Set log level to debug', action='store_true') - - # Main subcommand parser - parser['main'] = argparse.ArgumentParser(description='cdist ' + VERSION) - parser['main'].add_argument('-V', '--version', - help='Show version', action='version', - version='%(prog)s ' + VERSION) - parser['sub'] = parser['main'].add_subparsers(title="Commands") - - # Banner - parser['banner'] = parser['sub'].add_parser('banner', - add_help=False) - parser['banner'].set_defaults(func=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', - 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') - - # Config - parser['config'] = parser['sub'].add_parser('config', - parents=[parser['most'], parser['configinstall']]) - parser['config'].set_defaults(func=config) - - # Install - parser['install'] = parser['sub'].add_parser('install', - parents=[parser['most'], 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:]) - - # Most subcommands have --debug, so handle it here - if 'debug' in args: - if args.debug: - logging.root.setLevel(logging.DEBUG) - log.debug(args) - - args.func(args) - -if __name__ == "__main__": - try: - if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): - emulator() - else: - commandline() - except KeyboardInterrupt: - sys.exit(0) From ceaf82f6df5494f96d31aab271a690e8bb5e13dc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 17:19:16 +0200 Subject: [PATCH 0231/1024] better comment Signed-off-by: Nico Schottelius --- module/cdist/path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/cdist/path.py b/module/cdist/path.py index c72d29a8..e18f6582 100644 --- a/module/cdist/path.py +++ b/module/cdist/path.py @@ -1,4 +1,4 @@ -# Given paths from installation +# Hardcoded paths usually not changable REMOTE_BASE_DIR = "/var/lib/cdist" REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") From 91022c3f7e7102833a4416cb45ae171f6e8d4b1e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 23 Sep 2011 17:19:45 +0200 Subject: [PATCH 0232/1024] handle ioerror if script does not exist Signed-off-by: Steven Armstrong --- bin/cdist | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index fde7a251..d9f88b48 100755 --- a/bin/cdist +++ b/bin/cdist @@ -181,9 +181,12 @@ class Cdist: if remote: remote_cat(script) else: - script_fd = open(script) - print(script_fd.read()) - script_fd.close() + try: + script_fd = open(script) + print(script_fd.read()) + script_fd.close() + except IOError as error: + raise CdistError(str(error)) raise CdistError("Command failed (shell): " + " ".join(*args)) except OSError as error: From 8e59f97800a0c9fecccbdb9517b1a8a581e5c933 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 18:55:23 +0200 Subject: [PATCH 0233/1024] begin to used cdist.path Signed-off-by: Nico Schottelius --- bin/cdist | 13 ++++++++----- {module => lib}/cdist/__init__.py | 0 {module => lib}/cdist/path.py | 0 3 files changed, 8 insertions(+), 5 deletions(-) rename {module => lib}/cdist/__init__.py (100%) rename {module => lib}/cdist/path.py (100%) diff --git a/bin/cdist b/bin/cdist index d9f88b48..69e0623f 100755 --- a/bin/cdist +++ b/bin/cdist @@ -20,6 +20,10 @@ # # +# Add our own library path +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), + '../lib/python'))) + import argparse import datetime import logging @@ -32,6 +36,8 @@ import stat import sys import tempfile +import cdist.path + BANNER = """ .. . .x+=:. s dF @88> z` ^% :8 @@ -62,11 +68,6 @@ VERSION = "2.0.1" logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') log = logging.getLogger() -# Begin to split into parts -sys.path.insert(0, - os.path.abspath(os.path.join(os.path.dirname(__file__), - '../lib/python'))) - def file_to_list(filename): """Return list from \n seperated file""" if os.path.isfile(filename): @@ -94,6 +95,8 @@ class Cdist: self.target_host = target_host self.remote_prefix = ["ssh", "root@" + self.target_host] + self.path_info = cdist.path.Path(target_host, home) + # Setup directory paths self.temp_dir = tempfile.mkdtemp() diff --git a/module/cdist/__init__.py b/lib/cdist/__init__.py similarity index 100% rename from module/cdist/__init__.py rename to lib/cdist/__init__.py diff --git a/module/cdist/path.py b/lib/cdist/path.py similarity index 100% rename from module/cdist/path.py rename to lib/cdist/path.py From 2aa9f2ab8c8cb4d1349ea6ce98a9e3df8e5b0851 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 18:56:29 +0200 Subject: [PATCH 0234/1024] test: things to do Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 5439a1b9..8be1da54 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -9,6 +9,12 @@ CORE - allow cdist to run without $PATH setup: ./bin/cdist-deploy-to - support non-ssh access? +TESTS +----- +- multiple defines of object: + - fail if different parameters + - succeed if same parameters + USER INTERFACE -------------- - add support $__tmp? From 6139fab354b52ca56e5d4ffaea281d83b020a21e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 19:10:07 +0200 Subject: [PATCH 0235/1024] import cdist.path works Signed-off-by: Nico Schottelius --- bin/cdist | 10 +++++----- lib/cdist/path.py | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 69e0623f..18e7845b 100755 --- a/bin/cdist +++ b/bin/cdist @@ -20,10 +20,6 @@ # # -# Add our own library path -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), - '../lib/python'))) - import argparse import datetime import logging @@ -36,6 +32,10 @@ import stat import sys import tempfile +# Add our own library path +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), + '../lib'))) + import cdist.path BANNER = """ @@ -95,7 +95,7 @@ class Cdist: self.target_host = target_host self.remote_prefix = ["ssh", "root@" + self.target_host] - self.path_info = cdist.path.Path(target_host, home) + self.path_info = cdist.path.Path(target_host, base_dir=home) # Setup directory paths self.temp_dir = tempfile.mkdtemp() diff --git a/lib/cdist/path.py b/lib/cdist/path.py index e18f6582..5d72a23a 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -1,3 +1,7 @@ +import os +import sys +import tempfile + # Hardcoded paths usually not changable REMOTE_BASE_DIR = "/var/lib/cdist" REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") @@ -31,7 +35,7 @@ class Path: def __init__(self, target_host, base_dir=None): # Base and Temp Base - if home: + if base_dir: self.base_dir = base_dir else: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) From 26fad6f23ce1b656618eb64e1d367cf5757cf79f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 19:13:36 +0200 Subject: [PATCH 0236/1024] correct base dir, now relative to lib Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 5d72a23a..69bc5496 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -38,7 +38,7 @@ class Path: if base_dir: self.base_dir = base_dir else: - self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) self.temp_dir = tempfile.mkdtemp() From 79173488ffd697ef89d8a387034eb3447cf3da61 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 20:08:55 +0200 Subject: [PATCH 0237/1024] cdist runs with path module loaded (unusued though) Signed-off-by: Nico Schottelius --- bin/cdist | 13 ++++++++----- lib/cdist/path.py | 31 ++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 18e7845b..f6156825 100755 --- a/bin/cdist +++ b/bin/cdist @@ -32,11 +32,6 @@ import stat import sys import tempfile -# Add our own library path -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), - '../lib'))) - -import cdist.path BANNER = """ .. . .x+=:. s @@ -788,11 +783,19 @@ def commandline(): args.func(args) + if __name__ == "__main__": try: if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): emulator() else: + # Add our own library path + sys.path.insert(0, + os.path.abspath(os.path.join(os.path.dirname(__file__), + '../lib'))) + + import cdist.path + commandline() except KeyboardInterrupt: sys.exit(0) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 69bc5496..2050a1a3 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -1,3 +1,25 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import logging import os import sys import tempfile @@ -13,6 +35,10 @@ CODE_HEADER = "#!/bin/sh -e\n" DOT_CDIST = ".cdist" TYPE_PREFIX = "__" +logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') +log = logging.getLogger() + + def file_to_list(filename): """Return list from \n seperated file""" if os.path.isfile(filename): @@ -33,7 +59,10 @@ def file_to_list(filename): class Path: """Class that handles path related configurations""" - def __init__(self, target_host, base_dir=None): + def __init__(self, target_host, + initial_manifest=False, remote_user="root", + base_dir=None, debug=False): + # Base and Temp Base if base_dir: self.base_dir = base_dir From d4406cece3dc07e8a1f7a248b32c98c92f2895cb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 20:17:17 +0200 Subject: [PATCH 0238/1024] begin to replace first function with path module Signed-off-by: Nico Schottelius --- bin/cdist | 67 +++++++------------------------------------------------ 1 file changed, 8 insertions(+), 59 deletions(-) diff --git a/bin/cdist b/bin/cdist index f6156825..137f701f 100755 --- a/bin/cdist +++ b/bin/cdist @@ -90,72 +90,21 @@ class Cdist: self.target_host = target_host self.remote_prefix = ["ssh", "root@" + self.target_host] - self.path_info = cdist.path.Path(target_host, base_dir=home) - - # Setup directory paths - self.temp_dir = tempfile.mkdtemp() + self.path = cdist.path.Path(target_host, + initial_manifest=initial_manifest, + remote_user=remote_user, + base_dir=home, + debug=debug) self.debug = debug - if home: - self.base_dir = home - else: - self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) - - self.conf_dir = os.path.join(self.base_dir, "conf") - self.cache_base_dir = os.path.join(self.base_dir, "cache") - self.cache_dir = os.path.join(self.cache_base_dir, self.target_host) - self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") - self.lib_dir = os.path.join(self.base_dir, "lib") - self.manifest_dir = os.path.join(self.conf_dir, "manifest") - self.type_base_dir = os.path.join(self.conf_dir, "type") - - self.out_dir = os.path.join(self.temp_dir, "out") - os.mkdir(self.out_dir) - - self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") - os.mkdir(self.global_explorer_out_dir) - - self.object_base_dir = os.path.join(self.out_dir, "object") - - # Setup binary directory + contents - self.bin_dir = os.path.join(self.out_dir, "bin") - os.mkdir(self.bin_dir) - self.link_type_to_emulator() - - # List of type explorers transferred - self.type_explorers_transferred = {} - # objects self.objects_prepared = [] self.remote_user = remote_user - # Mostly static, but can be overwritten on user demand - if initial_manifest: - self.initial_manifest = initial_manifest - else: - self.initial_manifest = os.path.join(self.manifest_dir, "init") - def cleanup(self): - # Do not use in __del__: - # http://docs.python.org/reference/datamodel.html#customization - # "other globals referenced by the __del__() method may already have been deleted - # or in the process of being torn down (e.g. the import machinery shutting down)" - # - log.debug("Saving" + self.temp_dir + "to " + self.cache_dir) - # Remove previous cache - if os.path.exists(self.cache_dir): - shutil.rmtree(self.cache_dir) - shutil.move(self.temp_dir, self.cache_dir) - - def remote_mkdir(self, directory): - """Create directory on remote side""" - self.run_or_fail(["mkdir", "-p", directory], remote=True) - - def remote_cat(filename): - """Use cat on the remote side for output""" - self.run_or_fail(["cat", filename], remote=True) + self.path.cleanup() def shell_run_or_debug_fail(self, script, *args, **kargs): # Manually execute /bin/sh, because sh -e does what we want @@ -415,8 +364,8 @@ class Cdist: """Ensure the base directories are cleaned up""" log.debug("Creating clean directory structure") - self.remove_remote_dir(REMOTE_BASE_DIR) - self.remote_mkdir(REMOTE_BASE_DIR) + self.path.remove_remote_dir(REMOTE_BASE_DIR) + self.path.remote_mkdir(REMOTE_BASE_DIR) def run_initial_manifest(self): """Run the initial manifest""" From e14848ec1f88e1e79aade52fa4180d4a8d33db9e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 20:21:10 +0200 Subject: [PATCH 0239/1024] remove run* from cdist and put it into lib/exec Signed-off-by: Nico Schottelius --- bin/cdist | 49 --------------------------------- lib/cdist/exec.py | 70 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 49 deletions(-) create mode 100644 lib/cdist/exec.py diff --git a/bin/cdist b/bin/cdist index 137f701f..30fec278 100755 --- a/bin/cdist +++ b/bin/cdist @@ -106,55 +106,6 @@ class Cdist: def cleanup(self): self.path.cleanup() - def shell_run_or_debug_fail(self, script, *args, **kargs): - # Manually execute /bin/sh, because sh -e does what we want - # and sh -c -e does not exit if /bin/false called - args[0][:0] = [ "/bin/sh", "-e" ] - - remote = False - if "remote" in kargs: - if kargs["remote"]: - args[0][:0] = self.remote_prefix - remote = true - - del kargs["remote"] - - log.debug("Shell exec cmd: %s", args) - log.debug("Shell exec env: %s", kargs['env']) - try: - subprocess.check_call(*args, **kargs) - except subprocess.CalledProcessError: - log.error("Code that raised the error:\n") - if remote: - remote_cat(script) - else: - try: - script_fd = open(script) - print(script_fd.read()) - script_fd.close() - except IOError as error: - raise CdistError(str(error)) - - raise CdistError("Command failed (shell): " + " ".join(*args)) - except OSError as error: - raise CdistError(" ".join(*args) + ": " + error.args[1]) - - def run_or_fail(self, *args, **kargs): - if "remote" in kargs: - if kargs["remote"]: - args[0][:0] = self.remote_prefix - - del kargs["remote"] - - log.debug("Exec: " + " ".join(*args)) - try: - subprocess.check_call(*args, **kargs) - except subprocess.CalledProcessError: - raise CdistError("Command failed: " + " ".join(*args)) - except OSError as error: - raise CdistError(" ".join(*args) + ": " + error.args[1]) - - def remove_remote_dir(self, destination): self.run_or_fail(["rm", "-rf", destination], remote=True) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py new file mode 100644 index 00000000..7a1421e0 --- /dev/null +++ b/lib/cdist/exec.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +# +# 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 . +# +# + +def shell_run_or_debug_fail(self, script, *args, **kargs): + # Manually execute /bin/sh, because sh -e does what we want + # and sh -c -e does not exit if /bin/false called + args[0][:0] = [ "/bin/sh", "-e" ] + + remote = False + if "remote" in kargs: + if kargs["remote"]: + args[0][:0] = self.remote_prefix + remote = true + + del kargs["remote"] + + log.debug("Shell exec cmd: %s", args) + log.debug("Shell exec env: %s", kargs['env']) + try: + subprocess.check_call(*args, **kargs) + except subprocess.CalledProcessError: + log.error("Code that raised the error:\n") + if remote: + remote_cat(script) + else: + try: + script_fd = open(script) + print(script_fd.read()) + script_fd.close() + except IOError as error: + raise CdistError(str(error)) + + raise CdistError("Command failed (shell): " + " ".join(*args)) + except OSError as error: + raise CdistError(" ".join(*args) + ": " + error.args[1]) + + +def run_or_fail(self, *args, **kargs): + if "remote" in kargs: + if kargs["remote"]: + args[0][:0] = self.remote_prefix + + del kargs["remote"] + + log.debug("Exec: " + " ".join(*args)) + try: + subprocess.check_call(*args, **kargs) + except subprocess.CalledProcessError: + raise CdistError("Command failed: " + " ".join(*args)) + except OSError as error: + raise CdistError(" ".join(*args) + ": " + error.args[1]) + From 3925ba1c6e0bb7276a374836ec98f4f9e2c81552 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 20:35:13 +0200 Subject: [PATCH 0240/1024] pass remote_prefix to run_or_fail/shell Signed-off-by: Nico Schottelius --- lib/cdist/exec.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index 7a1421e0..a4cf4592 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -19,7 +19,8 @@ # # -def shell_run_or_debug_fail(self, script, *args, **kargs): + +def shell_run_or_debug_fail(script, *args, **kargs): # Manually execute /bin/sh, because sh -e does what we want # and sh -c -e does not exit if /bin/false called args[0][:0] = [ "/bin/sh", "-e" ] @@ -27,10 +28,11 @@ def shell_run_or_debug_fail(self, script, *args, **kargs): remote = False if "remote" in kargs: if kargs["remote"]: - args[0][:0] = self.remote_prefix + args[0][:0] = kargs["remote_prefix"] remote = true del kargs["remote"] + del kargs["remote_prefix"] log.debug("Shell exec cmd: %s", args) log.debug("Shell exec env: %s", kargs['env']) @@ -56,9 +58,10 @@ def shell_run_or_debug_fail(self, script, *args, **kargs): def run_or_fail(self, *args, **kargs): if "remote" in kargs: if kargs["remote"]: - args[0][:0] = self.remote_prefix + args[0][:0] = kargs["remote_prefix"] del kargs["remote"] + del kargs["remote_prefix"] log.debug("Exec: " + " ".join(*args)) try: @@ -67,4 +70,3 @@ def run_or_fail(self, *args, **kargs): raise CdistError("Command failed: " + " ".join(*args)) except OSError as error: raise CdistError(" ".join(*args) + ": " + error.args[1]) - From 8af45f83b20bd8a0e48f58eb5e7e9105bc76edda Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 23 Sep 2011 20:53:09 +0200 Subject: [PATCH 0241/1024] rearange remote_user Signed-off-by: Nico Schottelius --- bin/cdist | 17 ----------------- lib/cdist/path.py | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/bin/cdist b/bin/cdist index 30fec278..67b96a09 100755 --- a/bin/cdist +++ b/bin/cdist @@ -88,7 +88,6 @@ class Cdist: initial_manifest=False, remote_user="root", home=None, debug=False): self.target_host = target_host - self.remote_prefix = ["ssh", "root@" + self.target_host] self.path = cdist.path.Path(target_host, initial_manifest=initial_manifest, @@ -98,7 +97,6 @@ class Cdist: self.debug = debug - # objects self.objects_prepared = [] self.remote_user = remote_user @@ -109,21 +107,6 @@ class Cdist: def remove_remote_dir(self, destination): self.run_or_fail(["rm", "-rf", destination], remote=True) - def transfer_dir(self, source, destination): - """Transfer directory and previously delete the remote destination""" - self.remove_remote_dir(destination) - self.run_or_fail(["scp", "-qr", source, - self.remote_user + "@" + - self.target_host + ":" + - destination]) - - def transfer_file(self, source, destination): - """Transfer file""" - self.run_or_fail(["scp", "-q", source, - self.remote_user + "@" + - self.target_host + ":" + - destination]) - def global_explorer_output_path(self, explorer): """Returns path of the output for a global explorer""" return os.path.join(self.global_explorer_out_dir, explorer) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 2050a1a3..1e9d7195 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -38,6 +38,7 @@ TYPE_PREFIX = "__" logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') log = logging.getLogger() +import cdist.exec def file_to_list(filename): """Return list from \n seperated file""" @@ -53,9 +54,6 @@ def file_to_list(filename): return lines -# FIXME: self.run_or_fail needs to be elsewhere! -# Exec? - class Path: """Class that handles path related configurations""" @@ -70,6 +68,10 @@ class Path: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) self.temp_dir = tempfile.mkdtemp() + self.target_host = target_host + + self.remote_user = remote_user + self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] self.conf_dir = os.path.join(self.base_dir, "conf") self.cache_base_dir = os.path.join(self.base_dir, "cache") @@ -98,8 +100,6 @@ class Path: # objects self.objects_prepared = [] - self.remote_user = remote_user - # Mostly static, but can be overwritten on user demand if initial_manifest: self.initial_manifest = initial_manifest @@ -121,26 +121,26 @@ class Path: def remote_mkdir(self, directory): """Create directory on remote side""" - self.run_or_fail(["mkdir", "-p", directory], remote=True) + cdist.exec.run_or_fail(["mkdir", "-p", directory], remote=True) def remote_cat(filename): """Use cat on the remote side for output""" - self.run_or_fail(["cat", filename], remote=True) + cdist.exec.run_or_fail(["cat", filename], remote=True) def remove_remote_dir(self, destination): - self.run_or_fail(["rm", "-rf", destination], remote=True) + cdist.exec.run_or_fail(["rm", "-rf", destination], remote=True) def transfer_dir(self, source, destination): """Transfer directory and previously delete the remote destination""" self.remove_remote_dir(destination) - self.run_or_fail(["scp", "-qr", source, + cdist.exec.run_or_fail(["scp", "-qr", source, self.remote_user + "@" + self.target_host + ":" + destination]) def transfer_file(self, source, destination): """Transfer file""" - self.run_or_fail(["scp", "-q", source, + cdist.exec.run_or_fail(["scp", "-q", source, self.remote_user + "@" + self.target_host + ":" + destination]) From 7b39169e3e55231eef729d83eea32be97ff49841 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 25 Sep 2011 15:25:38 +0200 Subject: [PATCH 0242/1024] ignore all python cache dirs Signed-off-by: Nico Schottelius --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d606aec7..fb9c495c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,5 +14,5 @@ doc/man/man*/docbook-xsl.css # Ignore cache for version control cache/ -# Python -bin/__pycache__/ +# Python / cache +__pycache__/ From a5bfd4119521b6758b7893945812ae2be2ad70dd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 25 Sep 2011 15:26:54 +0200 Subject: [PATCH 0243/1024] Detect owl Signed-off-by: Nico Schottelius --- conf/explorer/os | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/conf/explorer/os b/conf/explorer/os index e922c067..268dae24 100755 --- a/conf/explorer/os +++ b/conf/explorer/os @@ -65,6 +65,11 @@ if [ -f /etc/SuSE-release ]; then exit 0 fi +if uname -r | grep -s '.owl' >/dev/null 2>&1; then + echo owl + exit 0 +fi + if [ -f /etc/cdist-preos ]; then echo preos exit 0 From c10fedaf8c9f87c36e0a0bb2602de8a6ff46edec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 25 Sep 2011 21:10:18 +0200 Subject: [PATCH 0244/1024] it's not preos, but cdist-preos Signed-off-by: Nico Schottelius --- conf/explorer/os | 2 +- doc/changelog | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/conf/explorer/os b/conf/explorer/os index 268dae24..3e1582ec 100755 --- a/conf/explorer/os +++ b/conf/explorer/os @@ -71,7 +71,7 @@ if uname -r | grep -s '.owl' >/dev/null 2>&1; then fi if [ -f /etc/cdist-preos ]; then - echo preos + echo cdist-preos exit 0 fi diff --git a/doc/changelog b/doc/changelog index b1149eb1..a08efb34 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,3 +1,6 @@ +2.0.2: + * Add support for detection of OpenWall Linux (Matthias Teege) + 2.0.1: 2011-09-23 * Bugfix core: Always print source of error in case of exec errors * Bugfix core: Various smaller bugs in string concatenation From 98f4ec9f3e6334768e3f7065dfd66ef9e13c772c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 09:24:49 +0200 Subject: [PATCH 0245/1024] document asciidoc requirement Signed-off-by: Nico Schottelius --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 5e60a093..b8181757 100644 --- a/README +++ b/README @@ -78,6 +78,7 @@ cdist was tested or is know to run on at least * A posix like shell * Python (>= 3.2 required) * SSH-Client + * Asciidoc (for building the manpages) ### Client ("target host") From fd9fb13606aa54687d36f9b70965cb6a9e086829 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 09:26:58 +0200 Subject: [PATCH 0246/1024] and remove asciidoc/gmake dep from the comment Signed-off-by: Nico Schottelius --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index b8181757..daa12f70 100644 --- a/README +++ b/README @@ -99,7 +99,7 @@ To install cdist, execute the following commands: cd cdist export PATH=$PATH:$(pwd -P)/bin - # If you want the manpages (requires gmake and asciidoc to be installed) + # If you want the manpages ./build.sh man export MANPATH=$MANPATH:$(pwd -P)/doc/man From bc9bc37aab80bc85d991621da9addd016ac9d0d4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 10:17:02 +0200 Subject: [PATCH 0247/1024] use remote_prefix internally Signed-off-by: Nico Schottelius --- lib/cdist/exec.py | 26 +++++++++++++------------- lib/cdist/path.py | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index a4cf4592..aca1d689 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -19,19 +19,21 @@ # # +import logging +import subprocess + +logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') +log = logging.getLogger() + def shell_run_or_debug_fail(script, *args, **kargs): # Manually execute /bin/sh, because sh -e does what we want # and sh -c -e does not exit if /bin/false called args[0][:0] = [ "/bin/sh", "-e" ] - remote = False - if "remote" in kargs: - if kargs["remote"]: - args[0][:0] = kargs["remote_prefix"] - remote = true - - del kargs["remote"] + if "remote_prefix" in kargs: + remote = True + args[0][:0] = kargs["remote_prefix"] del kargs["remote_prefix"] log.debug("Shell exec cmd: %s", args) @@ -41,6 +43,7 @@ def shell_run_or_debug_fail(script, *args, **kargs): except subprocess.CalledProcessError: log.error("Code that raised the error:\n") if remote: + # FIXME: included in Path! remote_cat(script) else: try: @@ -55,12 +58,9 @@ def shell_run_or_debug_fail(script, *args, **kargs): raise CdistError(" ".join(*args) + ": " + error.args[1]) -def run_or_fail(self, *args, **kargs): - if "remote" in kargs: - if kargs["remote"]: - args[0][:0] = kargs["remote_prefix"] - - del kargs["remote"] +def run_or_fail(*args, **kargs): + if "remote_prefix" in kargs: + args[0][:0] = kargs["remote_prefix"] del kargs["remote_prefix"] log.debug("Exec: " + " ".join(*args)) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 1e9d7195..c2cef1a6 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -121,14 +121,14 @@ class Path: def remote_mkdir(self, directory): """Create directory on remote side""" - cdist.exec.run_or_fail(["mkdir", "-p", directory], remote=True) + cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=self.remote_prefix) def remote_cat(filename): """Use cat on the remote side for output""" - cdist.exec.run_or_fail(["cat", filename], remote=True) + cdist.exec.run_or_fail(["cat", filename], remote_prefix=self.remote_prefix) def remove_remote_dir(self, destination): - cdist.exec.run_or_fail(["rm", "-rf", destination], remote=True) + cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=self.remote_prefix) def transfer_dir(self, source, destination): """Transfer directory and previously delete the remote destination""" From 8f2e5bb8c869bd0cce84ae13ccf84756c70298cb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 10:25:51 +0200 Subject: [PATCH 0248/1024] cleanup and move error class to init Signed-off-by: Nico Schottelius --- bin/cdist | 150 +----------------------------------------- lib/cdist/__init__.py | 24 +++++++ 2 files changed, 25 insertions(+), 149 deletions(-) diff --git a/bin/cdist b/bin/cdist index 67b96a09..369fbd29 100755 --- a/bin/cdist +++ b/bin/cdist @@ -77,10 +77,6 @@ def file_to_list(filename): return lines -class CdistError(Exception): - """Base exception class for this project""" - pass - class Cdist: """Cdist main class to hold arbitrary data""" @@ -104,153 +100,9 @@ class Cdist: def cleanup(self): self.path.cleanup() - def remove_remote_dir(self, destination): - self.run_or_fail(["rm", "-rf", destination], remote=True) - - def global_explorer_output_path(self, explorer): - """Returns path of the output for a global explorer""" - return os.path.join(self.global_explorer_out_dir, explorer) - - def type_explorer_output_dir(self, cdist_object): - """Returns and creates dir of the output for a type explorer""" - dir = os.path.join(self.object_dir(cdist_object), "explorer") - if not os.path.isdir(dir): - os.mkdir(dir) - - return dir - - def remote_global_explorer_path(self, explorer): - """Returns path to the remote explorer""" - return os.path.join(REMOTE_GLOBAL_EXPLORER_DIR, explorer) - - def list_global_explorers(self): - """Return list of available explorers""" - return os.listdir(self.global_explorer_dir) - - def list_type_explorers(self, type): - """Return list of available explorers for a specific type""" - dir = self.type_dir(type, "explorer") - if os.path.isdir(dir): - list = os.listdir(dir) - else: - list = [] - - log.debug("Explorers for %s in %s: %s", type, dir, list) - - return list - - def list_types(self): - return os.listdir(self.type_base_dir) - - def list_object_paths(self, starting_point): - """Return list of paths of existing objects""" - object_paths = [] - - for content in os.listdir(starting_point): - full_path = os.path.join(starting_point, content) - if os.path.isdir(full_path): - object_paths.extend(self.list_object_paths(starting_point = full_path)) - - # Directory contains .cdist -> is an object - if content == DOT_CDIST: - object_paths.append(starting_point) - - return object_paths - - def get_type_from_object(self, cdist_object): - """Returns the first part (i.e. type) of an object""" - return cdist_object.split(os.sep)[0] - - def get_object_id_from_object(self, cdist_object): - """Returns everything but the first part (i.e. object_id) of an object""" - return os.sep.join(cdist_object.split(os.sep)[1:]) - - def object_dir(self, cdist_object): - """Returns the full path to the object (including .cdist)""" - return os.path.join(self.object_base_dir, cdist_object, DOT_CDIST) - - def remote_object_dir(self, cdist_object): - """Returns the remote full path to the object (including .cdist)""" - return os.path.join(REMOTE_OBJECT_DIR, cdist_object, DOT_CDIST) - - def object_parameter_dir(self, cdist_object): - """Returns the dir to the object parameter""" - return os.path.join(self.object_dir(cdist_object), "parameter") - - def remote_object_parameter_dir(self, cdist_object): - """Returns the remote dir to the object parameter""" - return os.path.join(self.remote_object_dir(cdist_object), "parameter") - - def object_code_paths(self, cdist_object): - """Return paths to code scripts of object""" - return [os.path.join(self.object_dir(cdist_object), "code-local"), - os.path.join(self.object_dir(cdist_object), "code-remote")] - - def list_objects(self): - """Return list of existing objects""" - - objects = [] - if os.path.isdir(self.object_base_dir): - object_paths = self.list_object_paths(self.object_base_dir) - - for path in object_paths: - objects.append(os.path.relpath(path, self.object_base_dir)) - - return objects - - def type_dir(self, type, *args): - """Return directory the type""" - return os.path.join(self.type_base_dir, type, *args) - - def remote_type_explorer_dir(self, type): - """Return remote directory that holds the explorers of a type""" - return os.path.join(REMOTE_TYPE_DIR, type, "explorer") - - def transfer_object_parameter(self, cdist_object): - """Transfer the object parameter to the remote destination""" - # Create base path before using mkdir -p - self.remote_mkdir(self.remote_object_parameter_dir(cdist_object)) - - # Synchronise parameter dir afterwards - self.transfer_dir(self.object_parameter_dir(cdist_object), - self.remote_object_parameter_dir(cdist_object)) - - def transfer_global_explorers(self): - """Transfer the global explorers""" - self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) - self.transfer_dir(self.global_explorer_dir, REMOTE_GLOBAL_EXPLORER_DIR) - - def transfer_type_explorers(self, type): - """Transfer explorers of a type, but only once""" - if type in self.type_explorers_transferred: - log.debug("Skipping retransfer for explorers of %s", type) - return - else: - # Do not retransfer - self.type_explorers_transferred[type] = 1 - - src = self.type_dir(type, "explorer") - remote_base = os.path.join(REMOTE_TYPE_DIR, type) - dst = self.remote_type_explorer_dir(type) - - # Only continue, if there is at least the directory - if os.path.isdir(src): - # Ensure that the path exists - self.remote_mkdir(remote_base) - self.transfer_dir(src, dst) - - - def link_type_to_emulator(self): - """Link type names to cdist-type-emulator""" - source = os.path.abspath(sys.argv[0]) - for type in self.list_types(): - destination = os.path.join(self.bin_dir, type) - log.debug("Linking %s to %s", source, destination) - os.symlink(source, destination) - def run_global_explores(self): """Run global explorers""" - explorers = self.list_global_explorers() + explorers = self.path.list_global_explorers() if(len(explorers) == 0): raise CdistError("No explorers found in", self.global_explorer_dir) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index e69de29b..a1afebbd 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +class Error(Exception): + """Base exception class for this project""" + pass From e6a903fd967be6cde4e7b6585aceaa42954f4049 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 10:28:57 +0200 Subject: [PATCH 0249/1024] cleanup logger stuff, remove more path stuff from cdist bin Signed-off-by: Nico Schottelius --- bin/cdist | 10 ---------- lib/cdist/exec.py | 4 +--- lib/cdist/path.py | 3 +-- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/bin/cdist b/bin/cdist index 369fbd29..ed71249c 100755 --- a/bin/cdist +++ b/bin/cdist @@ -48,16 +48,6 @@ BANNER = """ "P' "" "" """ -# Given paths from installation -REMOTE_BASE_DIR = "/var/lib/cdist" -REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") -REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") -REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") -REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") - -CODE_HEADER = "#!/bin/sh -e\n" -DOT_CDIST = ".cdist" -TYPE_PREFIX = "__" VERSION = "2.0.1" logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index aca1d689..4b61a097 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -22,9 +22,7 @@ import logging import subprocess -logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') -log = logging.getLogger() - +log = logging.getLogger(__name__) def shell_run_or_debug_fail(script, *args, **kargs): # Manually execute /bin/sh, because sh -e does what we want diff --git a/lib/cdist/path.py b/lib/cdist/path.py index c2cef1a6..401e3c46 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -35,8 +35,7 @@ CODE_HEADER = "#!/bin/sh -e\n" DOT_CDIST = ".cdist" TYPE_PREFIX = "__" -logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') -log = logging.getLogger() +log = logging.getLogger(__name__) import cdist.exec From cf920ca3e96d302e00b6827968ff1a387c574bed Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 10:53:34 +0200 Subject: [PATCH 0250/1024] prefix issues Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 91dbc72f..4e07dd96 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,16 +1,3 @@ -2.0.1: - -- Rewrite cdist-type-emulator - - Remove legacy code in cdist - - Remove cdist-config - - Remove man1/cdist-type-emulator.text - - Remove the PATH=... part from the README - - - how to access output dir? - - Test: - __cdist_type_base_dir=$(pwd -P)/conf/type __file - - Fix / rewrite cdist-quickstart - write tutorial!!!!!!!!! @@ -49,3 +36,7 @@ http://www.youtube.com/watch?v=PRMjzy48eTI - Setup __debug, if -d is given, so other tools can reuse it + (-> non core feature! + +- remote_prefix: + scp vs. ssh issue From 16d58dcac73f71352d5b77bbf5df2d78988bd68e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 11:05:18 +0200 Subject: [PATCH 0251/1024] move out banner, fail at emulator Signed-off-by: Nico Schottelius --- bin/cdist | 204 ++++++++++++++++++------------------------ bin/cdist.py | 1 - lib/cdist/__init__.py | 3 + lib/cdist/banner.py | 46 ++++++++++ lib/cdist/path.py | 8 +- 5 files changed, 140 insertions(+), 122 deletions(-) delete mode 120000 bin/cdist.py create mode 100644 lib/cdist/banner.py diff --git a/bin/cdist b/bin/cdist index ed71249c..15c3ff62 100755 --- a/bin/cdist +++ b/bin/cdist @@ -32,40 +32,7 @@ import stat import sys import tempfile - -BANNER = """ - .. . .x+=:. s - dF @88> z` ^% :8 - '88bu. %8P . . +# +# + +import logging +import sys + +log = logging.getLogger(__name__) + +BANNER = """ + .. . .x+=:. s + dF @88> z` ^% :8 + '88bu. %8P . Date: Mon, 26 Sep 2011 11:07:45 +0200 Subject: [PATCH 0252/1024] move TYPE_PREFIX back into main, as it's only needed there and should work without module Signed-off-by: Nico Schottelius --- bin/cdist | 4 +++- lib/cdist/__init__.py | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 15c3ff62..f4d67616 100755 --- a/bin/cdist +++ b/bin/cdist @@ -34,6 +34,8 @@ import tempfile log = logging.getLogger(__name__) +TYPE_PREFIX = "__" + class Cdist: """Cdist main class to hold arbitrary data""" @@ -482,7 +484,7 @@ if __name__ == "__main__": '../lib'))) import cdist - if re.match(cdist.TYPE_PREFIX, os.path.basename(sys.argv[0])): + if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): emulator() else: import cdist.banner diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index 6bcc93d2..192e5001 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -19,7 +19,6 @@ # # -TYPE_PREFIX = "__" VERSION = "2.0.2" class Error(Exception): From 4eec4d96270464d8b5275a71e9d40e6f44f54bb4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 11:09:58 +0200 Subject: [PATCH 0253/1024] only setup library path in main, not emulator Signed-off-by: Nico Schottelius --- bin/cdist | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index f4d67616..d6a6da3b 100755 --- a/bin/cdist +++ b/bin/cdist @@ -478,15 +478,14 @@ if __name__ == "__main__": try: logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') - # Import generic cdist options - sys.path.insert(0, - os.path.abspath(os.path.join(os.path.dirname(__file__), - '../lib'))) - import cdist - if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): emulator() else: + cdist_lib = os.path.abspath(os.path.join(os.path.dirname(__file__), + '../lib')) + sys.path.insert(0, cdist_lib) + + import cdist import cdist.banner import cdist.exec import cdist.path From 6d75016139cec7d14a9d937eecabd3c32f4bd885 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 11:18:36 +0200 Subject: [PATCH 0254/1024] make type emulator load again Signed-off-by: Nico Schottelius --- bin/cdist | 120 ++++---------------------------------- lib/cdist/emulator.py | 132 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+), 108 deletions(-) create mode 100755 lib/cdist/emulator.py diff --git a/bin/cdist b/bin/cdist index d6a6da3b..3b19e388 100755 --- a/bin/cdist +++ b/bin/cdist @@ -146,9 +146,16 @@ class Cdist: env['__cdist_local_base_dir'] = self.path.temp_dir # Submit information to new type emulator + + # Required for recording source env['__cdist_manifest'] = manifest + + # Required to find types env['__cdist_type_base_dir'] = self.path.type_base_dir + # Required for loading emulator :-) + env['__cdist_python_lib'] = cdist_lib + # Other environment stuff if extra_env: env.update(extra_env) @@ -306,112 +313,6 @@ def install(args): """Install remote system""" process = {} -def emulator(): - """Emulate type commands (i.e. __file and co)""" - type = os.path.basename(sys.argv[0]) - type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type) - param_dir = os.path.join(type_dir, "parameter") - global_dir = os.environ['__global'] - object_source = os.environ['__cdist_manifest'] - - parser = argparse.ArgumentParser(add_help=False) - - # Setup optional parameters - for parameter in file_to_list(os.path.join(param_dir, "optional")): - argument = "--" + parameter - parser.add_argument(argument, action='store', required=False) - - # Setup required parameters - for parameter in file_to_list(os.path.join(param_dir, "required")): - argument = "--" + parameter - parser.add_argument(argument, action='store', required=True) - - # Setup positional parameter, if not singleton - - if not os.path.isfile(os.path.join(type_dir, "singleton")): - parser.add_argument("object_id", nargs=1) - - # And finally verify parameter - args = parser.parse_args(sys.argv[1:]) - - # Setup object_id - if os.path.isfile(os.path.join(type_dir, "singleton")): - object_id = "singleton" - else: - object_id = args.object_id[0] - del args.object_id - - # FIXME: / hardcoded - better portable solution available? - if object_id[0] == '/': - object_id = object_id[1:] - - # FIXME: verify object id - log.debug(args) - - object_dir = os.path.join(global_dir, "object", type, - object_id, DOT_CDIST) - param_out_dir = os.path.join(object_dir, "parameter") - - object_source_file = os.path.join(object_dir, "source") - - if os.path.exists(param_out_dir): - object_exists = True - old_object_source_fd = open(object_source_file, "r") - old_object_source = old_object_source_fd.readlines() - old_object_source_fd.close() - - else: - object_exists = False - try: - os.makedirs(param_out_dir, exist_ok=True) - except OSError as error: - raise CdistError(param_out_dir + ": " + error.args[1]) - - # Record parameter - params = vars(args) - for param in params: - value = getattr(args, param) - if value: - file = os.path.join(param_out_dir, param) - log.debug(file + "<-" + param + " = " + value) - - # Already exists, verify all parameter are the same - if object_exists: - if not os.path.isfile(file): - print("New parameter + " + param + "specified, aborting") - print("Source = " + old_object_source + "new =" + object_source) - sys.exit(1) - else: - param_fd = open(file, "r") - param_old = param_fd.readlines() - param_fd.close() - - if(param_old != param): - print("Parameter " + param + " differs: " + " ".join(param_old) + " vs. " + param) - print("Sources: " + " ".join(old_object_source) + " and " + object_source) - sys.exit(1) - else: - param_fd = open(file, "w") - param_fd.writelines(value) - param_fd.close() - - # Record requirements - if "__require" in os.environ: - requirements = os.environ['__require'] - print(object_id + ":Writing requirements: " + requirements) - require_fd = open(os.path.join(object_dir, "require"), "a") - require_fd.writelines(requirements.split(" ")) - require_fd.close() - - # Record / Append source - source_fd = open(os.path.join(object_dir, "source"), "a") - source_fd.writelines(object_source) - source_fd.close() - - # sys.exit(1) - print("Finished " + type + "/" + object_id + repr(params)) - - def commandline(): """Parse command line""" # Construct parser others can reuse @@ -477,9 +378,12 @@ def commandline(): if __name__ == "__main__": try: logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') - + if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): - emulator() + cdist_lib = os.environ["__cdist_python_lib"] + sys.path.insert(0, cdist_lib) + import cdist.emulator + cdist.emulator.emulator(sys.argv) else: cdist_lib = os.path.abspath(os.path.join(os.path.dirname(__file__), '../lib')) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py new file mode 100755 index 00000000..0e693dbe --- /dev/null +++ b/lib/cdist/emulator.py @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- +# +# 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 . +# +# + +import argparse +import logging +import os +import sys + +log = logging.getLogger(__name__) + +def emulator(argv): + """Emulate type commands (i.e. __file and co)""" + type = os.path.basename(argv[0]) + type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type) + param_dir = os.path.join(type_dir, "parameter") + global_dir = os.environ['__global'] + object_source = os.environ['__cdist_manifest'] + + parser = argparse.ArgumentParser(add_help=False) + + # Setup optional parameters + for parameter in file_to_list(os.path.join(param_dir, "optional")): + argument = "--" + parameter + parser.add_argument(argument, action='store', required=False) + + # Setup required parameters + for parameter in file_to_list(os.path.join(param_dir, "required")): + argument = "--" + parameter + parser.add_argument(argument, action='store', required=True) + + # Setup positional parameter, if not singleton + + if not os.path.isfile(os.path.join(type_dir, "singleton")): + parser.add_argument("object_id", nargs=1) + + # And finally verify parameter + args = parser.parse_args(argv[1:]) + + # Setup object_id + if os.path.isfile(os.path.join(type_dir, "singleton")): + object_id = "singleton" + else: + object_id = args.object_id[0] + del args.object_id + + # FIXME: / hardcoded - better portable solution available? + if object_id[0] == '/': + object_id = object_id[1:] + + # FIXME: verify object id + log.debug(args) + + object_dir = os.path.join(global_dir, "object", type, + object_id, DOT_CDIST) + param_out_dir = os.path.join(object_dir, "parameter") + + object_source_file = os.path.join(object_dir, "source") + + if os.path.exists(param_out_dir): + object_exists = True + old_object_source_fd = open(object_source_file, "r") + old_object_source = old_object_source_fd.readlines() + old_object_source_fd.close() + + else: + object_exists = False + try: + os.makedirs(param_out_dir, exist_ok=True) + except OSError as error: + raise CdistError(param_out_dir + ": " + error.args[1]) + + # Record parameter + params = vars(args) + for param in params: + value = getattr(args, param) + if value: + file = os.path.join(param_out_dir, param) + log.debug(file + "<-" + param + " = " + value) + + # Already exists, verify all parameter are the same + if object_exists: + if not os.path.isfile(file): + print("New parameter + " + param + "specified, aborting") + print("Source = " + old_object_source + "new =" + object_source) + sys.exit(1) + else: + param_fd = open(file, "r") + param_old = param_fd.readlines() + param_fd.close() + + if(param_old != param): + print("Parameter " + param + " differs: " + " ".join(param_old) + " vs. " + param) + print("Sources: " + " ".join(old_object_source) + " and " + object_source) + sys.exit(1) + else: + param_fd = open(file, "w") + param_fd.writelines(value) + param_fd.close() + + # Record requirements + if "__require" in os.environ: + requirements = os.environ['__require'] + print(object_id + ":Writing requirements: " + requirements) + require_fd = open(os.path.join(object_dir, "require"), "a") + require_fd.writelines(requirements.split(" ")) + require_fd.close() + + # Record / Append source + source_fd = open(os.path.join(object_dir, "source"), "a") + source_fd.writelines(object_source) + source_fd.close() + + # sys.exit(1) + print("Finished " + type + "/" + object_id + repr(params)) From 74dc5b96cb3af00f8fb6ac3dd805f69de40d2737 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 11:21:04 +0200 Subject: [PATCH 0255/1024] type emulator begins to run Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 8 +++++--- lib/cdist/exec.py | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 0e693dbe..ecdfff25 100755 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -24,6 +24,8 @@ import logging import os import sys +import cdist.path + log = logging.getLogger(__name__) def emulator(argv): @@ -37,12 +39,12 @@ def emulator(argv): parser = argparse.ArgumentParser(add_help=False) # Setup optional parameters - for parameter in file_to_list(os.path.join(param_dir, "optional")): + for parameter in cdist.path.file_to_list(os.path.join(param_dir, "optional")): argument = "--" + parameter parser.add_argument(argument, action='store', required=False) # Setup required parameters - for parameter in file_to_list(os.path.join(param_dir, "required")): + for parameter in cdist.path.file_to_list(os.path.join(param_dir, "required")): argument = "--" + parameter parser.add_argument(argument, action='store', required=True) @@ -69,7 +71,7 @@ def emulator(argv): log.debug(args) object_dir = os.path.join(global_dir, "object", type, - object_id, DOT_CDIST) + object_id, cdist.path.DOT_CDIST) param_out_dir = os.path.join(object_dir, "parameter") object_source_file = os.path.join(object_dir, "source") diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index 4b61a097..09e4e8a4 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -29,6 +29,7 @@ def shell_run_or_debug_fail(script, *args, **kargs): # and sh -c -e does not exit if /bin/false called args[0][:0] = [ "/bin/sh", "-e" ] + remote = False if "remote_prefix" in kargs: remote = True args[0][:0] = kargs["remote_prefix"] From 0197f8da13ffdff8103a1a35c118f82ffca6968e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 11:25:22 +0200 Subject: [PATCH 0256/1024] more cleanups from refactoring Signed-off-by: Nico Schottelius --- bin/cdist | 5 +++-- lib/cdist/path.py | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/bin/cdist b/bin/cdist index 3b19e388..f511d78e 100755 --- a/bin/cdist +++ b/bin/cdist @@ -35,6 +35,7 @@ import tempfile log = logging.getLogger(__name__) TYPE_PREFIX = "__" +CODE_HEADER = "#!/bin/sh -e\n" class Cdist: """Cdist main class to hold arbitrary data""" @@ -102,7 +103,7 @@ class Cdist: log.debug("%s exploring %s using %s storing to %s", cdist_object, explorer, remote_cmd, output) - self.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) + cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) output_fd.close() def init_deploy(self): @@ -240,7 +241,7 @@ class Cdist: self.run_initial_manifest() old_objects = [] - objects = self.list_objects() + objects = self.path.list_objects() # Continue process until no new objects are created anymore while old_objects != objects: diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 16aa51ea..0fa753a8 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -21,6 +21,7 @@ import logging import os +import shutil import sys import tempfile @@ -31,7 +32,6 @@ REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") -CODE_HEADER = "#!/bin/sh -e\n" DOT_CDIST = ".cdist" log = logging.getLogger(__name__) @@ -55,9 +55,13 @@ def file_to_list(filename): class Path: """Class that handles path related configurations""" - def __init__(self, target_host, - initial_manifest=False, remote_user="root", - remote_prefix=False, base_dir=None, debug=False): + def __init__(self, + target_host, + remote_user, + remote_prefix, + initial_manifest=False, + base_dir=None, + debug=False): # Base and Temp Base if base_dir: @@ -69,10 +73,7 @@ class Path: self.target_host = target_host self.remote_user = remote_user - if remote_prefix: - self.remote_prefix = remote_prefix - else: - self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] + self.remote_prefix = remote_prefix self.conf_dir = os.path.join(self.base_dir, "conf") self.cache_base_dir = os.path.join(self.base_dir, "cache") From 35e33570d18eadd88d929a3b213a504218152a72 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 11:45:19 +0200 Subject: [PATCH 0257/1024] also move out config Signed-off-by: Nico Schottelius --- bin/cdist | 286 +------------------------------- lib/cdist/config.py | 393 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 399 insertions(+), 280 deletions(-) create mode 100755 lib/cdist/config.py diff --git a/bin/cdist b/bin/cdist index f511d78e..4dd4f971 100755 --- a/bin/cdist +++ b/bin/cdist @@ -33,283 +33,14 @@ import sys import tempfile log = logging.getLogger(__name__) +real_me = os.path.dirname(os.path.realpath(__file__)) +cdist_lib = os.path.abspath(os.path.join(real_me, '../lib')) + +sys.path.insert(0, cdist_lib) TYPE_PREFIX = "__" CODE_HEADER = "#!/bin/sh -e\n" -class Cdist: - """Cdist main class to hold arbitrary data""" - - def __init__(self, target_host, - initial_manifest=False, remote_user="root", - home=None, debug=False): - - self.target_host = target_host - self.debug = debug - self.remote_user = remote_user - self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] - - self.path = cdist.path.Path(self.target_host, - initial_manifest=initial_manifest, - remote_user=self.remote_user, - remote_prefix=self.remote_prefix, - base_dir=home, - debug=debug) - - - self.objects_prepared = [] - - def cleanup(self): - self.path.cleanup() - - def run_global_explores(self): - """Run global explorers""" - explorers = self.path.list_global_explorers() - if(len(explorers) == 0): - raise CdistError("No explorers found in", self.path.global_explorer_dir) - - self.path.transfer_global_explorers() - for explorer in explorers: - output = self.path.global_explorer_output_path(explorer) - output_fd = open(output, mode='w') - cmd = [] - cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append(self.path.remote_global_explorer_path(explorer)) - - cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=self.remote_prefix) - output_fd.close() - - def run_type_explorer(self, cdist_object): - """Run type specific explorers for objects""" - - type = self.path.get_type_from_object(cdist_object) - self.path.transfer_type_explorers(type) - - cmd = [] - cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append("__type_explorer=" + self.path.remote_type_explorer_dir(type)) - cmd.append("__object=" + self.path.remote_object_dir(cdist_object)) - cmd.append("__object_id=" + self.path.get_object_id_from_object(cdist_object)) - cmd.append("__object_fq=" + cdist_object) - - # Need to transfer at least the parameters for objects to be useful - self.path.transfer_object_parameter(cdist_object) - - explorers = self.path.list_type_explorers(type) - for explorer in explorers: - remote_cmd = cmd + [os.path.join(self.path.remote_type_explorer_dir(type), explorer)] - output = os.path.join(self.path.type_explorer_output_dir(cdist_object), explorer) - output_fd = open(output, mode='w') - log.debug("%s exploring %s using %s storing to %s", - cdist_object, explorer, remote_cmd, output) - - cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) - output_fd.close() - - def init_deploy(self): - """Ensure the base directories are cleaned up""" - log.debug("Creating clean directory structure") - - self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) - self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) - - def run_initial_manifest(self): - """Run the initial manifest""" - env = { "__manifest" : self.path.manifest_dir } - self.run_manifest(self.path.initial_manifest, extra_env=env) - - def run_type_manifest(self, cdist_object): - """Run manifest for a specific object""" - type = self.path.get_type_from_object(cdist_object) - manifest = self.path.type_dir(type, "manifest") - - log.debug("%s: Running %s", cdist_object, manifest) - if os.path.exists(manifest): - env = { "__object" : self.path.object_dir(cdist_object), - "__object_id": self.path.get_object_id_from_object(cdist_object), - "__object_fq": cdist_object, - "__type": self.path.type_dir(type) - } - self.run_manifest(manifest, extra_env=env) - - def run_manifest(self, manifest, extra_env=None): - """Run a manifest""" - log.debug("Running manifest %s, env=%s", manifest, extra_env) - env = os.environ.copy() - env['PATH'] = self.path.bin_dir + ":" + env['PATH'] - - # Information required in every manifest - env['__target_host'] = self.target_host - env['__global'] = self.path.out_dir - - # Legacy stuff to make cdist-type-emulator work - env['__cdist_core_dir'] = os.path.join(self.path.base_dir, "core") - env['__cdist_local_base_dir'] = self.path.temp_dir - - # Submit information to new type emulator - - # Required for recording source - env['__cdist_manifest'] = manifest - - # Required to find types - env['__cdist_type_base_dir'] = self.path.type_base_dir - - # Required for loading emulator :-) - env['__cdist_python_lib'] = cdist_lib - - # Other environment stuff - if extra_env: - env.update(extra_env) - - cdist.exec.shell_run_or_debug_fail(manifest, [manifest], env=env) - - def object_run(self, cdist_object, mode): - """Run gencode or code for an object""" - log.debug("Running %s from %s", mode, cdist_object) - file=os.path.join(self.path.object_dir(cdist_object), "require") - requirements = cdist.path.file_to_list(file) - type = self.path.get_type_from_object(cdist_object) - - for requirement in requirements: - log.debug("Object %s requires %s", cdist_object, requirement) - self.object_run(requirement, mode=mode) - - # - # Setup env Variable: - # - env = os.environ.copy() - env['__target_host'] = self.target_host - env['__global'] = self.path.out_dir - env["__object"] = self.path.object_dir(cdist_object) - env["__object_id"] = self.path.get_object_id_from_object(cdist_object) - env["__object_fq"] = cdist_object - env["__type"] = self.path.type_dir(type) - - if mode == "gencode": - paths = [ - self.path.type_dir(type, "gencode-local"), - self.path.type_dir(type, "gencode-remote") - ] - for bin in paths: - if os.path.isfile(bin): - # omit "gen" from gencode and use it for output base - outfile=os.path.join(self.path.object_dir(cdist_object), - os.path.basename(bin)[3:]) - - outfile_fd = open(outfile, "w") - - # Need to flush to ensure our write is done before stdout write - outfile_fd.write(CODE_HEADER) - outfile_fd.flush() - - cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) - outfile_fd.close() - - status = os.stat(outfile) - - # Remove output if empty, else make it executable - if status.st_size == len(CODE_HEADER): - os.unlink(outfile) - else: - # Add header and make executable - identically to 0o700 - os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) - - # Mark object as changed - open(os.path.join(self.path.object_dir(cdist_object), "changed"), "w").close() - - - if mode == "code": - local_dir = self.path.object_dir(cdist_object) - remote_dir = self.path.remote_object_dir(cdist_object) - - bin = os.path.join(local_dir, "code-local") - if os.path.isfile(bin): - cdist.exec.run_or_fail([bin]) - - - local_remote_code = os.path.join(local_dir, "code-remote") - remote_remote_code = os.path.join(remote_dir, "code-remote") - if os.path.isfile(local_remote_code): - self.path.transfer_file(local_remote_code, remote_remote_code) - # FIXME: remote_prefix - cdist.exec.run_or_fail([remote_remote_code], remote_prefix=self.remote_prefix) - - def stage_prepare(self): - """Do everything for a deploy, minus the actual code stage""" - self.init_deploy() - self.run_global_explores() - self.run_initial_manifest() - - old_objects = [] - objects = self.path.list_objects() - - # Continue process until no new objects are created anymore - while old_objects != objects: - log.debug("Prepare stage") - old_objects = list(objects) - for cdist_object in objects: - if cdist_object in self.objects_prepared: - log.debug("Skipping rerun of object %s", cdist_object) - continue - else: - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - self.objects_prepared.append(cdist_object) - - objects = self.path.list_objects() - - def stage_run(self): - """The final (and real) step of deployment""" - log.debug("Actual run objects") - # Now do the final steps over the existing objects - for cdist_object in self.path.list_objects(): - log.debug("Run object: %s", cdist_object) - self.object_run(cdist_object, mode="gencode") - self.object_run(cdist_object, mode="code") - - def deploy_to(self): - """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.target_host) - time_start = datetime.datetime.now() - - self.stage_prepare() - self.stage_run() - - time_end = datetime.datetime.now() - duration = time_end - time_start - log.info("Finished run of %s in %s seconds", - self.target_host, - duration.total_seconds()) - - def deploy_and_cleanup(self): - """Do what is most often done: deploy & cleanup""" - self.deploy_to() - self.cleanup() - -def config(args): - """Configure remote system""" - process = {} - - time_start = datetime.datetime.now() - - for host in args.host: - c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) - if args.parallel: - log.debug("Creating child process for %s", host) - process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) - process[host].start() - else: - c.deploy_and_cleanup() - - if args.parallel: - for p in process.keys(): - log.debug("Joining %s", p) - process[p].join() - - time_end = datetime.datetime.now() - log.info("Total processing time for %s host(s): %s", len(args.host), - (time_end - time_start).total_seconds()) - def install(args): """Install remote system""" process = {} @@ -355,7 +86,7 @@ def commandline(): # Config parser['config'] = parser['sub'].add_parser('config', parents=[parser['most'], parser['configinstall']]) - parser['config'].set_defaults(func=config) + parser['config'].set_defaults(func=cdist.config.config) # Install parser['install'] = parser['sub'].add_parser('install', @@ -381,17 +112,12 @@ if __name__ == "__main__": logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): - cdist_lib = os.environ["__cdist_python_lib"] - sys.path.insert(0, cdist_lib) import cdist.emulator cdist.emulator.emulator(sys.argv) else: - cdist_lib = os.path.abspath(os.path.join(os.path.dirname(__file__), - '../lib')) - sys.path.insert(0, cdist_lib) - import cdist import cdist.banner + import cdist.config import cdist.exec import cdist.path diff --git a/lib/cdist/config.py b/lib/cdist/config.py new file mode 100755 index 00000000..a5a2252f --- /dev/null +++ b/lib/cdist/config.py @@ -0,0 +1,393 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import datetime +import logging +import os +import stat + +log = logging.getLogger(__name__) + +import cdist.path + +CODE_HEADER = "#!/bin/sh -e\n" + +class Config: + """Cdist main class to hold arbitrary data""" + + def __init__(self, target_host, + initial_manifest=False, remote_user="root", + home=None, debug=False): + + self.target_host = target_host + self.debug = debug + self.remote_user = remote_user + self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] + + self.path = cdist.path.Path(self.target_host, + initial_manifest=initial_manifest, + remote_user=self.remote_user, + remote_prefix=self.remote_prefix, + base_dir=home, + debug=debug) + + self.objects_prepared = [] + + def cleanup(self): + self.path.cleanup() + + def run_global_explores(self): + """Run global explorers""" + explorers = self.path.list_global_explorers() + if(len(explorers) == 0): + raise CdistError("No explorers found in", self.path.global_explorer_dir) + + self.path.transfer_global_explorers() + for explorer in explorers: + output = self.path.global_explorer_output_path(explorer) + output_fd = open(output, mode='w') + cmd = [] + cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append(self.path.remote_global_explorer_path(explorer)) + + cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=self.remote_prefix) + output_fd.close() + + def run_type_explorer(self, cdist_object): + """Run type specific explorers for objects""" + + type = self.path.get_type_from_object(cdist_object) + self.path.transfer_type_explorers(type) + + cmd = [] + cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append("__type_explorer=" + self.path.remote_type_explorer_dir(type)) + cmd.append("__object=" + self.path.remote_object_dir(cdist_object)) + cmd.append("__object_id=" + self.path.get_object_id_from_object(cdist_object)) + cmd.append("__object_fq=" + cdist_object) + + # Need to transfer at least the parameters for objects to be useful + self.path.transfer_object_parameter(cdist_object) + + explorers = self.path.list_type_explorers(type) + for explorer in explorers: + remote_cmd = cmd + [os.path.join(self.path.remote_type_explorer_dir(type), explorer)] + output = os.path.join(self.path.type_explorer_output_dir(cdist_object), explorer) + output_fd = open(output, mode='w') + log.debug("%s exploring %s using %s storing to %s", + cdist_object, explorer, remote_cmd, output) + + cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) + output_fd.close() + + def init_deploy(self): + """Ensure the base directories are cleaned up""" + log.debug("Creating clean directory structure") + + self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) + self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) + + def run_initial_manifest(self): + """Run the initial manifest""" + env = { "__manifest" : self.path.manifest_dir } + self.run_manifest(self.path.initial_manifest, extra_env=env) + + def run_type_manifest(self, cdist_object): + """Run manifest for a specific object""" + type = self.path.get_type_from_object(cdist_object) + manifest = self.path.type_dir(type, "manifest") + + log.debug("%s: Running %s", cdist_object, manifest) + if os.path.exists(manifest): + env = { "__object" : self.path.object_dir(cdist_object), + "__object_id": self.path.get_object_id_from_object(cdist_object), + "__object_fq": cdist_object, + "__type": self.path.type_dir(type) + } + self.run_manifest(manifest, extra_env=env) + + def run_manifest(self, manifest, extra_env=None): + """Run a manifest""" + log.debug("Running manifest %s, env=%s", manifest, extra_env) + env = os.environ.copy() + env['PATH'] = self.path.bin_dir + ":" + env['PATH'] + + # Information required in every manifest + env['__target_host'] = self.target_host + env['__global'] = self.path.out_dir + + # Legacy stuff to make cdist-type-emulator work + env['__cdist_core_dir'] = os.path.join(self.path.base_dir, "core") + env['__cdist_local_base_dir'] = self.path.temp_dir + + # Submit information to new type emulator + + # Required for recording source + env['__cdist_manifest'] = manifest + + # Required to find types + env['__cdist_type_base_dir'] = self.path.type_base_dir + + # Other environment stuff + if extra_env: + env.update(extra_env) + + cdist.exec.shell_run_or_debug_fail(manifest, [manifest], env=env) + + def object_run(self, cdist_object, mode): + """Run gencode or code for an object""" + log.debug("Running %s from %s", mode, cdist_object) + file=os.path.join(self.path.object_dir(cdist_object), "require") + requirements = cdist.path.file_to_list(file) + type = self.path.get_type_from_object(cdist_object) + + for requirement in requirements: + log.debug("Object %s requires %s", cdist_object, requirement) + self.object_run(requirement, mode=mode) + + # + # Setup env Variable: + # + env = os.environ.copy() + env['__target_host'] = self.target_host + env['__global'] = self.path.out_dir + env["__object"] = self.path.object_dir(cdist_object) + env["__object_id"] = self.path.get_object_id_from_object(cdist_object) + env["__object_fq"] = cdist_object + env["__type"] = self.path.type_dir(type) + + if mode == "gencode": + paths = [ + self.path.type_dir(type, "gencode-local"), + self.path.type_dir(type, "gencode-remote") + ] + for bin in paths: + if os.path.isfile(bin): + # omit "gen" from gencode and use it for output base + outfile=os.path.join(self.path.object_dir(cdist_object), + os.path.basename(bin)[3:]) + + outfile_fd = open(outfile, "w") + + # Need to flush to ensure our write is done before stdout write + outfile_fd.write(CODE_HEADER) + outfile_fd.flush() + + cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) + outfile_fd.close() + + status = os.stat(outfile) + + # Remove output if empty, else make it executable + if status.st_size == len(CODE_HEADER): + os.unlink(outfile) + else: + # Add header and make executable - identically to 0o700 + os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + + # Mark object as changed + open(os.path.join(self.path.object_dir(cdist_object), "changed"), "w").close() + + + if mode == "code": + local_dir = self.path.object_dir(cdist_object) + remote_dir = self.path.remote_object_dir(cdist_object) + + bin = os.path.join(local_dir, "code-local") + if os.path.isfile(bin): + cdist.exec.run_or_fail([bin]) + + + local_remote_code = os.path.join(local_dir, "code-remote") + remote_remote_code = os.path.join(remote_dir, "code-remote") + if os.path.isfile(local_remote_code): + self.path.transfer_file(local_remote_code, remote_remote_code) + # FIXME: remote_prefix + cdist.exec.run_or_fail([remote_remote_code], remote_prefix=self.remote_prefix) + + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" + self.init_deploy() + self.run_global_explores() + self.run_initial_manifest() + + old_objects = [] + objects = self.path.list_objects() + + # Continue process until no new objects are created anymore + while old_objects != objects: + log.debug("Prepare stage") + old_objects = list(objects) + for cdist_object in objects: + if cdist_object in self.objects_prepared: + log.debug("Skipping rerun of object %s", cdist_object) + continue + else: + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + self.objects_prepared.append(cdist_object) + + objects = self.path.list_objects() + + def stage_run(self): + """The final (and real) step of deployment""" + log.debug("Actual run objects") + # Now do the final steps over the existing objects + for cdist_object in self.path.list_objects(): + log.debug("Run object: %s", cdist_object) + self.object_run(cdist_object, mode="gencode") + self.object_run(cdist_object, mode="code") + + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + log.info("Deploying to " + self.target_host) + time_start = datetime.datetime.now() + + self.stage_prepare() + self.stage_run() + + time_end = datetime.datetime.now() + duration = time_end - time_start + log.info("Finished run of %s in %s seconds", + self.target_host, + duration.total_seconds()) + + def deploy_and_cleanup(self): + """Do what is most often done: deploy & cleanup""" + self.deploy_to() + self.cleanup() + +def config(args): + """Configure remote system""" + process = {} + + time_start = datetime.datetime.now() + + for host in args.host: + c = Config(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) + if args.parallel: + log.debug("Creating child process for %s", host) + process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) + process[host].start() + else: + c.deploy_and_cleanup() + + if args.parallel: + for p in process.keys(): + log.debug("Joining %s", p) + process[p].join() + + time_end = datetime.datetime.now() + log.info("Total processing time for %s host(s): %s", len(args.host), + (time_end - time_start).total_seconds()) + +def install(args): + """Install remote system""" + process = {} + +def commandline(): + """Parse command line""" + # Construct parser others can reuse + parser = {} + # Options _all_ parsers have in common + parser['most'] = argparse.ArgumentParser(add_help=False) + parser['most'].add_argument('-d', '--debug', + help='Set log level to debug', action='store_true') + + # Main subcommand parser + parser['main'] = argparse.ArgumentParser(description='cdist ' + cdist.VERSION) + 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', + add_help=False) + 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', + 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') + + # Config + parser['config'] = parser['sub'].add_parser('config', + parents=[parser['most'], parser['configinstall']]) + parser['config'].set_defaults(func=config) + + # Install + parser['install'] = parser['sub'].add_parser('install', + parents=[parser['most'], 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:]) + + # Most subcommands have --debug, so handle it here + if 'debug' in args: + if args.debug: + logging.root.setLevel(logging.DEBUG) + log.debug(args) + + args.func(args) + + +if __name__ == "__main__": + try: + logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') + + if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): + cdist_lib = os.environ["__cdist_python_lib"] + sys.path.insert(0, cdist_lib) + import cdist.emulator + cdist.emulator.emulator(sys.argv) + else: + cdist_lib = os.path.abspath(os.path.join(os.path.dirname(__file__), + '../lib')) + sys.path.insert(0, cdist_lib) + + import cdist + import cdist.banner + import cdist.exec + import cdist.path + + commandline() + except KeyboardInterrupt: + sys.exit(0) + except cdist.Error as e: + log.error(e) + sys.exit(1) From 27b4b9cd039f30ad71f7533da79f195c82c1fbdc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 11:53:09 +0200 Subject: [PATCH 0258/1024] also move out install and cleanup library path code Signed-off-by: Nico Schottelius --- bin/cdist | 16 ++++++---------- lib/cdist/install.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 10 deletions(-) create mode 100755 lib/cdist/install.py diff --git a/bin/cdist b/bin/cdist index 4dd4f971..5e1b96bf 100755 --- a/bin/cdist +++ b/bin/cdist @@ -33,17 +33,13 @@ import sys import tempfile log = logging.getLogger(__name__) -real_me = os.path.dirname(os.path.realpath(__file__)) -cdist_lib = os.path.abspath(os.path.join(real_me, '../lib')) -sys.path.insert(0, cdist_lib) +# 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')) +) TYPE_PREFIX = "__" -CODE_HEADER = "#!/bin/sh -e\n" - -def install(args): - """Install remote system""" - process = {} def commandline(): """Parse command line""" @@ -91,7 +87,7 @@ def commandline(): # Install parser['install'] = parser['sub'].add_parser('install', parents=[parser['most'], parser['configinstall']]) - parser['install'].set_defaults(func=install) + parser['install'].set_defaults(func=cdist.install.install) for p in parser: parser[p].epilog = "Get cdist at http://www.nico.schottelius.org/software/cdist/" @@ -106,7 +102,6 @@ def commandline(): args.func(args) - if __name__ == "__main__": try: logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') @@ -119,6 +114,7 @@ if __name__ == "__main__": import cdist.banner import cdist.config import cdist.exec + import cdist.install import cdist.path commandline() diff --git a/lib/cdist/install.py b/lib/cdist/install.py new file mode 100755 index 00000000..98b388ec --- /dev/null +++ b/lib/cdist/install.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import logging + +log = logging.getLogger(__name__) + +def install(args): + """Install remote system""" + process = {} + From fc1e0d9f1fbdead1ab0c548ef17ce94f64f53f0c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 11:55:59 +0200 Subject: [PATCH 0259/1024] remove exec bits from copying Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 0 lib/cdist/emulator.py | 0 lib/cdist/install.py | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 lib/cdist/config.py mode change 100755 => 100644 lib/cdist/emulator.py mode change 100755 => 100644 lib/cdist/install.py diff --git a/lib/cdist/config.py b/lib/cdist/config.py old mode 100755 new mode 100644 diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py old mode 100755 new mode 100644 diff --git a/lib/cdist/install.py b/lib/cdist/install.py old mode 100755 new mode 100644 From 6458499d2bda5eacf2f40da3515dd103cc9031e7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 12:02:24 +0200 Subject: [PATCH 0260/1024] J) Signed-off-by: Nico Schottelius --- bin/cdist | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 5e1b96bf..f8596e67 100755 --- a/bin/cdist +++ b/bin/cdist @@ -36,8 +36,7 @@ log = logging.getLogger(__name__) # 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')) -) + os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) TYPE_PREFIX = "__" From 0cd24f1544f71c63d9e8aaab7b9425b8e53c9772 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 15:08:59 +0200 Subject: [PATCH 0261/1024] rename quickstart to tutorial Signed-off-by: Nico Schottelius --- doc/man/man7/{cdist-quickstart.text => cdist-tutorial.text} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/man/man7/{cdist-quickstart.text => cdist-tutorial.text} (100%) diff --git a/doc/man/man7/cdist-quickstart.text b/doc/man/man7/cdist-tutorial.text similarity index 100% rename from doc/man/man7/cdist-quickstart.text rename to doc/man/man7/cdist-tutorial.text From 597e1e73453318f7886c8eb6c63f0ab8e27bc011 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 15:15:36 +0200 Subject: [PATCH 0262/1024] remove obsolete cdist-deploy-stdin-to Signed-off-by: Nico Schottelius --- bin/cdist-deploy-stdin-to | 36 ------------------------- doc/man/man1/cdist-deploy-stdin-to.text | 30 --------------------- 2 files changed, 66 deletions(-) delete mode 100755 bin/cdist-deploy-stdin-to delete mode 100644 doc/man/man1/cdist-deploy-stdin-to.text diff --git a/bin/cdist-deploy-stdin-to b/bin/cdist-deploy-stdin-to deleted file mode 100755 index 391dd431..00000000 --- a/bin/cdist-deploy-stdin-to +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Use stdin as the manifest to deploy on the given host. -# - -. cdist-config -[ $# -eq 1 ] || __cdist_usage "" -set -eu - -__cdist_target_host="$1" -shift - -cat >> "$__cdist_tmp_file" - -chmod +x "$__cdist_tmp_file" - -export __cdist_manifest_init="$__cdist_tmp_file" -cdist-deploy-to "$__cdist_target_host" diff --git a/doc/man/man1/cdist-deploy-stdin-to.text b/doc/man/man1/cdist-deploy-stdin-to.text deleted file mode 100644 index 14f19478..00000000 --- a/doc/man/man1/cdist-deploy-stdin-to.text +++ /dev/null @@ -1,30 +0,0 @@ -cdist-deploy-stdin-to(1) -======================== -Steven Armstrong - - -NAME ----- -cdist-deploy-stdin-to - Deploy the configuration given on stdin to host - - -SYNOPSIS --------- -echo "__file /tmp/whatever" | cdist-deploy-stdin-to HOSTNAME - - -DESCRIPTION ------------ -Use stdin as the manifest for cdist-deploy-to. - - -SEE ALSO --------- -- cdist(7) -- cdist-deploy-to(1) - - -COPYING -------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). From 996fa75c2eff3bd0ffe4c6a10b30447a953209b1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 15:18:55 +0200 Subject: [PATCH 0263/1024] cleanup cdist imports Signed-off-by: Nico Schottelius --- bin/cdist | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index f8596e67..d21fda40 100755 --- a/bin/cdist +++ b/bin/cdist @@ -21,16 +21,10 @@ # import argparse -import datetime import logging -import multiprocessing import os import re -import subprocess -import shutil -import stat import sys -import tempfile log = logging.getLogger(__name__) From ef197eebe330bcdfb1af07806b288b88c8b6cfd7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 15:42:27 +0200 Subject: [PATCH 0264/1024] move test to top level Signed-off-by: Nico Schottelius --- test.py | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ test/cdist.py | 12 ----------- 2 files changed, 59 insertions(+), 12 deletions(-) create mode 100755 test.py delete mode 100644 test/cdist.py diff --git a/test.py b/test.py new file mode 100755 index 00000000..ad56df11 --- /dev/null +++ b/test.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 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 . +# +# + + +import os +import sys +import unittest + +sys.path.insert(0, os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib'))) + +import cdist +import cdist.config +import cdist.exec + +class Exec(unittest.TestCase): + def test_local_success(self): + try: + cdist.exec.run_or_fail(["/bin/true"]) + except cdist.Error: + failed = True + else: + failed = False + + self.assertFalse(failed) + + def test_local_fail(self): + try: + cdist.exec.run_or_fail(["/bin/false"]) + except cdist.Error: + failed = True + else: + failed = False + + self.assertTrue(failed) + + + +if __name__ == '__main__': + unittest.main() diff --git a/test/cdist.py b/test/cdist.py deleted file mode 100644 index 3ccc69bc..00000000 --- a/test/cdist.py +++ /dev/null @@ -1,12 +0,0 @@ -import cdist -import unittest - - -class CdistGeneric(unittest.TestCase): - - def test_initial_manifest(self): - self.assertEqual(numeral, result) - - -if __name__ == '__main__': - unittest.main() From 4906f604f0d1da1968c06e5e9e7cd3ca88a4c75d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 15:42:39 +0200 Subject: [PATCH 0265/1024] raise cdist errors Signed-off-by: Nico Schottelius --- lib/cdist/exec.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index 09e4e8a4..f95ba941 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -24,6 +24,8 @@ import subprocess log = logging.getLogger(__name__) +import cdist + def shell_run_or_debug_fail(script, *args, **kargs): # Manually execute /bin/sh, because sh -e does what we want # and sh -c -e does not exit if /bin/false called @@ -50,11 +52,11 @@ def shell_run_or_debug_fail(script, *args, **kargs): print(script_fd.read()) script_fd.close() except IOError as error: - raise CdistError(str(error)) + raise cdist.Error(str(error)) - raise CdistError("Command failed (shell): " + " ".join(*args)) + raise cdist.Error("Command failed (shell): " + " ".join(*args)) except OSError as error: - raise CdistError(" ".join(*args) + ": " + error.args[1]) + raise cdist.Error(" ".join(*args) + ": " + error.args[1]) def run_or_fail(*args, **kargs): @@ -66,6 +68,6 @@ def run_or_fail(*args, **kargs): try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: - raise CdistError("Command failed: " + " ".join(*args)) + raise cdist.Error("Command failed: " + " ".join(*args)) except OSError as error: - raise CdistError(" ".join(*args) + ": " + error.args[1]) + raise cdist.Error(" ".join(*args) + ": " + error.args[1]) From 7882b4a3ac11b0866819f92b50e9231d11166aed Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 16:03:53 +0200 Subject: [PATCH 0266/1024] only print env, if existent Signed-off-by: Nico Schottelius --- lib/cdist/exec.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index f95ba941..b0f98b56 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -38,7 +38,10 @@ def shell_run_or_debug_fail(script, *args, **kargs): del kargs["remote_prefix"] log.debug("Shell exec cmd: %s", args) - log.debug("Shell exec env: %s", kargs['env']) + + if 'env' in kargs: + log.debug("Shell exec env: %s", kargs['env']) + try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: From 24b8a57df51160463c501f92523303dcdf050269 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 16:04:27 +0200 Subject: [PATCH 0267/1024] write first tests for the exec module Signed-off-by: Nico Schottelius --- test.py | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/test.py b/test.py index ad56df11..b5b80dc9 100755 --- a/test.py +++ b/test.py @@ -23,6 +23,8 @@ import os import sys +import shutil +import tempfile import unittest sys.path.insert(0, os.path.abspath( @@ -33,6 +35,38 @@ import cdist.config import cdist.exec class Exec(unittest.TestCase): + def setUp(self): + """Create shell code and co.""" + + self.temp_dir = tempfile.mkdtemp() + self.shell_false = os.path.join(self.temp_dir, "shell_false") + self.shell_true = os.path.join(self.temp_dir, "shell_true") + + true_fd = open(self.shell_false, "w") + true_fd.writelines(["!/bin/sh", "/bin/true"]) + true_fd.close() + + false_fd = open(self.shell_false, "w") + false_fd.writelines(["!/bin/sh", "/bin/false"]) + false_fd.close() + + def tearDown(self): + shutil.rmtree(self.temp_dir) + + def test_local_success_shell(self): + try: + cdist.shell_run_or_debug_fail(self.shell_true, [self.shell_true]) + except cdist.Error: + failed = True + else: + failed = False + + self.assertFalse(failed) + + def test_local_fail_shell(self): + self.assertRaises(cdist.Error, cdist.exec.shell_run_or_debug_fail, + self.shell_false, [self.shell_false]) + def test_local_success(self): try: cdist.exec.run_or_fail(["/bin/true"]) @@ -44,15 +78,7 @@ class Exec(unittest.TestCase): self.assertFalse(failed) def test_local_fail(self): - try: - cdist.exec.run_or_fail(["/bin/false"]) - except cdist.Error: - failed = True - else: - failed = False - - self.assertTrue(failed) - + self.assertRaises(cdist.Error, cdist.exec.run_or_fail, ["/bin/false"]) if __name__ == '__main__': From 6e73572a9514583c32f6643ed4d21d09ab8cde74 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 16:21:56 +0200 Subject: [PATCH 0268/1024] easier check for remote_prefix Signed-off-by: Nico Schottelius --- lib/cdist/exec.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index b0f98b56..7985bdb3 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -26,16 +26,13 @@ log = logging.getLogger(__name__) import cdist -def shell_run_or_debug_fail(script, *args, **kargs): +def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): # Manually execute /bin/sh, because sh -e does what we want # and sh -c -e does not exit if /bin/false called args[0][:0] = [ "/bin/sh", "-e" ] - remote = False - if "remote_prefix" in kargs: - remote = True - args[0][:0] = kargs["remote_prefix"] - del kargs["remote_prefix"] + if remote_prefix: + args[0][:0] = remote_prefix log.debug("Shell exec cmd: %s", args) @@ -46,9 +43,9 @@ def shell_run_or_debug_fail(script, *args, **kargs): subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: log.error("Code that raised the error:\n") - if remote: - # FIXME: included in Path! - remote_cat(script) + if remote_prefix: + run_or_fail(["cat", script], remote_prefix=remote_prefix) + else: try: script_fd = open(script) @@ -62,10 +59,9 @@ def shell_run_or_debug_fail(script, *args, **kargs): raise cdist.Error(" ".join(*args) + ": " + error.args[1]) -def run_or_fail(*args, **kargs): - if "remote_prefix" in kargs: - args[0][:0] = kargs["remote_prefix"] - del kargs["remote_prefix"] +def run_or_fail(*args, remote_prefix=False, **kargs): + if remote_prefix: + args[0][:0] = remote_prefix log.debug("Exec: " + " ".join(*args)) try: From c687dbdc70951e15d0ba8e7adbd486e8c147a493 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 16:22:09 +0200 Subject: [PATCH 0269/1024] remove remote_cat, as it's only used in exec module Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 0fa753a8..277b1401 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -125,10 +125,6 @@ class Path: """Create directory on remote side""" cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=self.remote_prefix) - def remote_cat(filename): - """Use cat on the remote side for output""" - cdist.exec.run_or_fail(["cat", filename], remote_prefix=self.remote_prefix) - def remove_remote_dir(self, destination): cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=self.remote_prefix) From 5e862c9ede969ec026dbf19e2a3ea158182a8ede Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 17:33:26 +0200 Subject: [PATCH 0270/1024] make cdist-tutorial compile Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-tutorial.text | 55 ++++++++++++-------------------- 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/doc/man/man7/cdist-tutorial.text b/doc/man/man7/cdist-tutorial.text index e146f1a8..dfda5325 100755 --- a/doc/man/man7/cdist-tutorial.text +++ b/doc/man/man7/cdist-tutorial.text @@ -1,40 +1,23 @@ -#!/bin/sh -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# Give the user an introduction into cdist -# +cdist-tutorial(7) +================= +Nico Schottelius -. cdist-config -set -eu -banner="cdist-quickstart>" -continue="Press enter to continue or ctrl-c to abort." -create_continue="Press enter to create the described files/directories" +NAME +---- +cdist-tutorial - a guided introduction into cdist -__prompt() -{ - echo -n "$banner" "$@" - read answer -} -################################################################################ +INTRODUCTION +------------ +This tutorial is aimed at people learning cdist and shows +typical approaches as well as gives an easy start into +the world of configuration management. + + +NOT MIGRATED +------------ + # Intro of quickstart # cat << eof @@ -305,6 +288,10 @@ That's it, this is the end of the cdist-quickstart. I hope you've got some impression on how cdist works, here are again some pointers on where to continue to read: -cdist(7), cdist-deploy-to(1), cdist-type(7), cdist-stages(7) eof + +SEE ALSO +-------- +cdist(1), cdist-type(7), cdist-stages(7) + From d5df740f17c2207fdf0e92181c2f74b6671fbe1b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Sep 2011 20:14:04 +0200 Subject: [PATCH 0271/1024] always compile documentation with UTF-8 encoding Signed-off-by: Nico Schottelius --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index bef4393b..68abafde 100755 --- a/build.sh +++ b/build.sh @@ -27,7 +27,7 @@ #set -e # Manpage and HTML -A2XM="a2x -f manpage --no-xmllint" +A2XM="a2x -f manpage --no-xmllint -a encoding=UTF-8" A2XH="a2x -f xhtml --no-xmllint" # Developer webbase From df84480fcc5efb0763f34b420b9568396a0e375a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 00:02:04 +0200 Subject: [PATCH 0272/1024] BUGFIX: emulator compared parameter with value Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index ecdfff25..a97959e6 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -105,11 +105,11 @@ def emulator(argv): sys.exit(1) else: param_fd = open(file, "r") - param_old = param_fd.readlines() + value_old = param_fd.readlines() param_fd.close() - if(param_old != param): - print("Parameter " + param + " differs: " + " ".join(param_old) + " vs. " + param) + if(value_old != value): + print("Parameter " + param + " differs: " + " ".join(value_old) + " vs. " + value) print("Sources: " + " ".join(old_object_source) + " and " + object_source) sys.exit(1) else: From 1cfb6bf5a8f6707b30e9239f69d94c06df446290 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 00:11:59 +0200 Subject: [PATCH 0273/1024] make manpage compile for __partition_msdos_apply Signed-off-by: Nico Schottelius --- conf/type/__partition_msdos_apply/man.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__partition_msdos_apply/man.text b/conf/type/__partition_msdos_apply/man.text index 4d4f127c..6cc53b77 100644 --- a/conf/type/__partition_msdos_apply/man.text +++ b/conf/type/__partition_msdos_apply/man.text @@ -5,7 +5,7 @@ Steven Armstrong NAME ---- -cdist-type__partition_msdos_apply +cdist-type__partition_msdos_apply - Apply dos partition settings DESCRIPTION From 87937ecec92232fc8e4aa402c35b9cd0fb988121 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 00:12:11 +0200 Subject: [PATCH 0274/1024] also always use utf-8 for html Signed-off-by: Nico Schottelius --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 68abafde..d20e0211 100755 --- a/build.sh +++ b/build.sh @@ -28,7 +28,7 @@ # Manpage and HTML A2XM="a2x -f manpage --no-xmllint -a encoding=UTF-8" -A2XH="a2x -f xhtml --no-xmllint" +A2XH="a2x -f xhtml --no-xmllint -a encoding=UTF-8" # Developer webbase WEBDIR=$HOME/niconetz From 877d8fed309fac3df8691f4533f0ee5385b5a406 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 00:34:41 +0200 Subject: [PATCH 0275/1024] verify that corrupted manifests are detected as such Signed-off-by: Nico Schottelius --- test.py | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/test.py b/test.py index b5b80dc9..d1d62d25 100755 --- a/test.py +++ b/test.py @@ -42,12 +42,12 @@ class Exec(unittest.TestCase): self.shell_false = os.path.join(self.temp_dir, "shell_false") self.shell_true = os.path.join(self.temp_dir, "shell_true") - true_fd = open(self.shell_false, "w") - true_fd.writelines(["!/bin/sh", "/bin/true"]) + true_fd = open(self.shell_true, "w") + true_fd.writelines(["#!/bin/sh", "/bin/true"]) true_fd.close() false_fd = open(self.shell_false, "w") - false_fd.writelines(["!/bin/sh", "/bin/false"]) + false_fd.writelines(["#!/bin/sh", "/bin/false"]) false_fd.close() def tearDown(self): @@ -55,7 +55,7 @@ class Exec(unittest.TestCase): def test_local_success_shell(self): try: - cdist.shell_run_or_debug_fail(self.shell_true, [self.shell_true]) + cdist.exec.shell_run_or_debug_fail(self.shell_true, [self.shell_true]) except cdist.Error: failed = True else: @@ -80,6 +80,47 @@ class Exec(unittest.TestCase): def test_local_fail(self): self.assertRaises(cdist.Error, cdist.exec.run_or_fail, ["/bin/false"]) +class Config(unittest.TestCase): + def setUp(self): + self.temp_dir = tempfile.mkdtemp() + self.init_manifest = os.path.join(self.temp_dir, "manifest") + self.config = cdist.config.Config("localhost", + initial_manifest=self.init_manifest) + + def test_initial_manifest_different_parameter(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh", + "__file " + self.temp_dir + "--mode 0700", + "__file " + self.temp_dir + "--mode 0600", + ]) + manifest_fd.close() + + self.assertRaises(cdist.Error, self.config.run_initial_manifest()) + + def test_initial_manifest_parameter_added(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh", + "__file " + self.temp_dir, + "__file " + self.temp_dir + "--mode 0600", + ]) + manifest_fd.close() + + self.assertRaises(cdist.Error, self.config.run_initial_manifest()) + + def test_initial_manifest_parameter_removed(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh", + "__file " + self.temp_dir + "--mode 0600", + "__file " + self.temp_dir, + ]) + manifest_fd.close() + + self.assertRaises(cdist.Error, self.config.run_initial_manifest()) + +# Todo: +# fail if parameter in manifest given are different +# fail if parameter in manifest given are absent once/given once +# succeed if same parameter is specified twice if __name__ == '__main__': unittest.main() From 603f1c3ae075c7d5e47f1bfd472e89cec884cda4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 00:38:08 +0200 Subject: [PATCH 0276/1024] also check that giving a paramter twice works Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-tutorial.text | 65 +++++++++++++++++++++++++++++++- test.py | 20 ++++++++-- 2 files changed, 79 insertions(+), 6 deletions(-) diff --git a/doc/man/man7/cdist-tutorial.text b/doc/man/man7/cdist-tutorial.text index dfda5325..8abcbad4 100755 --- a/doc/man/man7/cdist-tutorial.text +++ b/doc/man/man7/cdist-tutorial.text @@ -15,8 +15,69 @@ typical approaches as well as gives an easy start into the world of configuration management. -NOT MIGRATED ------------- + +QUICK START +----------- +For those who just want to configure a system with the +cdist configuration management and do not need (or want) +to understand everything. + +Cdist uses **ssh** for communication and transportation +and usually logs into the **target host** as the +**root** user. So you need to configure the **ssh server** +of the target host to allow root logins: Edit +the file **/etc/ssh/sshd_config** and add one of the following +lines: + +-------------------------------------------------------------------------------- +# Allow login only via public key +PermitRootLogin without-password + +# Allow login via password and public key +PermitRootLogin yes +-------------------------------------------------------------------------------- + + +Before you can start using cdist, you need to ensure that +you can login +sshd config! + + + + + +You can copy and paste the following +code into your shell to get started and even configure your system. + +-------------------------------------------------------------------------------- +# Get cdist +git clone git://git.schottelius.org/cdist + +# Create manifest (maps configuration to host(s) +cd cdist +echo '__file /etc/cdist-configured' > conf/manifest/init +chmod 0700 conf/manifest/init + +echo 'Ensure that you can login as root to localhost without password' +echo '(i.e. via public key) and then press return' +read tmp + +# Configure localhost +./bin/cdist config localhost + +# Find out that cdist created /etc/cdist-configured +ls -l /etc/cdist-configured +-------------------------------------------------------------------------------- + +The file 'conf/manifest/init' is usually the entry point for cdist, +to find out what to configure on which host. All manifests are +essentially shell scripts. Every manifest can use the types known to +cdist, which are usually underline prefixed (\_\_). + + + +Everything you specify in manifests + # Intro of quickstart # diff --git a/test.py b/test.py index d1d62d25..2eb0b89f 100755 --- a/test.py +++ b/test.py @@ -117,10 +117,22 @@ class Config(unittest.TestCase): self.assertRaises(cdist.Error, self.config.run_initial_manifest()) -# Todo: -# fail if parameter in manifest given are different -# fail if parameter in manifest given are absent once/given once -# succeed if same parameter is specified twice + def test_initial_manifest_parameter_twice(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh", + "__file " + self.temp_dir + "--mode 0600", + "__file " + self.temp_dir + "--mode 0600", + ]) + manifest_fd.close() + + try: + self.config.run_initial_manifest() + except cdist.Error: + failed = True + else: + failed = False + + self.assertFalse(failed) if __name__ == '__main__': unittest.main() From 326ff6728365cd94b8e29d3dbbb49d0d704ebbe2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 00:48:29 +0200 Subject: [PATCH 0277/1024] break tests by fixing them Signed-off-by: Nico Schottelius --- test.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test.py b/test.py index 2eb0b89f..a3652c41 100755 --- a/test.py +++ b/test.py @@ -89,9 +89,9 @@ class Config(unittest.TestCase): def test_initial_manifest_different_parameter(self): manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh", - "__file " + self.temp_dir + "--mode 0700", - "__file " + self.temp_dir + "--mode 0600", + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + "--mode 0700\n", + "__file " + self.temp_dir + "--mode 0600\n", ]) manifest_fd.close() @@ -99,9 +99,9 @@ class Config(unittest.TestCase): def test_initial_manifest_parameter_added(self): manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh", - "__file " + self.temp_dir, - "__file " + self.temp_dir + "--mode 0600", + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + '\n', + "__file " + self.temp_dir + "--mode 0600\n", ]) manifest_fd.close() @@ -109,9 +109,9 @@ class Config(unittest.TestCase): def test_initial_manifest_parameter_removed(self): manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh", - "__file " + self.temp_dir + "--mode 0600", - "__file " + self.temp_dir, + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + "--mode 0600\n", + "__file " + self.temp_dir + "\n", ]) manifest_fd.close() @@ -119,9 +119,9 @@ class Config(unittest.TestCase): def test_initial_manifest_parameter_twice(self): manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh", - "__file " + self.temp_dir + "--mode 0600", - "__file " + self.temp_dir + "--mode 0600", + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + "--mode 0600\n", + "__file " + self.temp_dir + "--mode 0600\n", ]) manifest_fd.close() From 2c0a7adf74578ce6151468afcf724ddddbcf46fc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 00:49:12 +0200 Subject: [PATCH 0278/1024] replace CdistError with cdist.Error Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 3 ++- lib/cdist/exec.py | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index a97959e6..bd97f69b 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -24,6 +24,7 @@ import logging import os import sys +import cdist import cdist.path log = logging.getLogger(__name__) @@ -87,7 +88,7 @@ def emulator(argv): try: os.makedirs(param_out_dir, exist_ok=True) except OSError as error: - raise CdistError(param_out_dir + ": " + error.args[1]) + raise cdist.Error(param_out_dir + ": " + error.args[1]) # Record parameter params = vars(args) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index 7985bdb3..9cedefcc 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -58,7 +58,6 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): except OSError as error: raise cdist.Error(" ".join(*args) + ": " + error.args[1]) - def run_or_fail(*args, remote_prefix=False, **kargs): if remote_prefix: args[0][:0] = remote_prefix From 1dcc3b771e42c7593f65890aa41fd723957693a7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 00:58:16 +0200 Subject: [PATCH 0279/1024] +some ssh hints, localhost hint Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-tutorial.text | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/man/man7/cdist-tutorial.text b/doc/man/man7/cdist-tutorial.text index 8abcbad4..9b6e7492 100755 --- a/doc/man/man7/cdist-tutorial.text +++ b/doc/man/man7/cdist-tutorial.text @@ -14,6 +14,10 @@ This tutorial is aimed at people learning cdist and shows typical approaches as well as gives an easy start into the world of configuration management. +This tutorial assumes you are configuring **localhost**, because +it is always available. Just repace **localhost** with your target +host for real life usage. + QUICK START @@ -37,6 +41,19 @@ PermitRootLogin without-password PermitRootLogin yes -------------------------------------------------------------------------------- +As cdist uses ssh intensively, it is recommended to setup authentication +with public keys: + +-------------------------------------------------------------------------------- +# Generate pubkey pair as a normal user +ssh-keygen + +# Copy pubkey over to target host +ssh-copy-id root@target_host +-------------------------------------------------------------------------------- + +As soon as you are able to login to the target host + Before you can start using cdist, you need to ensure that you can login @@ -75,6 +92,9 @@ essentially shell scripts. Every manifest can use the types known to cdist, which are usually underline prefixed (\_\_). +SSH HINTS +--------- +Control master, ssh agent Everything you specify in manifests From d87deba30eccd70ce37b9b4844e2a25e873d9513 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 01:01:12 +0200 Subject: [PATCH 0280/1024] cleanup tutorial, fillup todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 280 ++++++++++++++++++++++++++++ doc/man/man7/cdist-tutorial.text | 301 +------------------------------ 2 files changed, 283 insertions(+), 298 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 4e07dd96..91b418a2 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -8,6 +8,286 @@ - and that ssh will wait for answer of prompt - nasty if used in parallel mode (scroll up!) + +SSH HINTS +--------- +Control master, ssh agent + +Everything you specify in manifests + + +# Intro of quickstart +# +cat << eof +$banner cdist version $__cdist_version + +Welcome to the interactive guide to cdist! +This is the interactive tutorial and beginners help for cdist and here's +our schedule: + + - Stages: How cdist operates + - Explorer: Explore facts of the target host + - Manifest: Map configurations to hosts + - Types: Bundled functionality + - Deploy a configuration to the local host! + +eof +__prompt "$continue" + +################################################################################ +# Stages +# +cat << eof + +To deploy configurations to a host, you call + + cdist-deploy-to + +which makes calls to other scripts, which realise the so called "stages". +Usually you'll not notice this, but in case you want to debug or hack cdist, +you can run each stage on its own. Besides that, you just need to remember +that the command cdist-deploy-to is the main cdist command. + +See also: + + Source of cdist-deploy-to(1), cdist-stages(7) + +eof +__prompt "$continue" + +################################################################################ +# Explorer +# +cat << eof + +The first thing cdist always does is running different explorers on the +target host. The explorers can be found in the directory + + ${__cdist_explorer_dir} + +An explorer is executed on the target host and its output is saved to a file. +You can use these files later to decide what or how to configure the host. + +For a demonstration, we'll call the OS explorer locally now, but remember: +This is only for demonstration, normally it is run on the target host. +The os explorer will which either displays the detected operating system or +nothing if it does not know your OS. + +See also: + + cdist-explorer(7) + +eof +explorer="${__cdist_explorer_dir}/os" + +__prompt "Press enter to execute $explorer" + +set -x +"$explorer" +set +x + +################################################################################ +# Manifest +# +cat << eof + +The initial manifest is the entry point for cdist to find out, what you would +like to have configured. It is located at + + ${__cdist_manifest_init} + +And can be as simple as + +-------------------------------------------------------------------------------- +__file /etc/cdist-configured --type file +-------------------------------------------------------------------------------- + +See also: + + cdist-manifest(7) + +eof +__prompt "$continue" + +cat << eof + +Let's take a deeper look at the initial manifest to understand what it means: + + __file /etc/cdist-configured --type file + | | | \\ + | | The parameter type \\ With the value file + | | + | | + | | This is the object id + | + __file is a so called "type" + + +This essentially looks like a standard command executed in the shell. +eof +__prompt "$continue" + +cat << eof + +And that's exactly true. Manifests are shell snippets that can use +types as commands with arguments. cdist prepends a special path +that contain links to the cdist-type-emulator, to \$PATH, so you +can use your types as a command. + +This is also the reason why types should always be prefixed with +"__", to prevent collisions with existing binaries. + +The object id is unique per type and used to prevent you from creating +the same object twice. + +Parameters are type specific and are always specified as --parameter . + +See also: + + cdist-type-build-emulation(1), cdist-type-emulator(1) + +eof +__prompt "$continue" + +################################################################################ +# Types +# +cat << eof + +Types are bundled functionality and are the main component of cdist. +If you want to have a feature x, you write the type __x. Types are stored in + + ${__cdist_type_dir} + +And cdist ships with some types already! + +See also: + + cdist-type(7) + +eof +__prompt "Press enter to see available types" + +set -x +ls ${__cdist_type_dir} +set +x + +cat << eof + +Types consist of the following parts: + + - ${__cdist_name_parameter} (${__cdist_name_parameter_required}/${__cdist_name_parameter_optional} + - ${__cdist_name_manifest} + - ${__cdist_name_explorer} + - ${__cdist_name_gencode} + +eof +__prompt "$continue" + + +cat << eof + +Every type must have a directory named ${__cdist_name_parameter}, which +contains required or optional parameters (in newline seperated files). + +If an object of a specific type was created in the initial manifest, +the manifest of the type is run and may create other objects. + +A type may have ${__cdist_name_explorer}, which are very similar to the +${__cdist_name_explorer} seen above, but with a different purpose: +They are specific to the type and are not relevant for other types. + +You may use them for instance to find out details on the target host, +so you can decide what to do on the target host eventually. + +After the ${__cdist_name_manifest} and the ${__cdist_name_explorer} of +a type have been run, ${__cdist_name_gencode} is executed, which creates +code to be executed on the target on stdout. + +eof +__prompt "$continue" + +################################################################################ +# Deployment +# + +cat << eof + +Now you've got some basic knowledge about cdist, let's configure your a host! + +Ensure that you have a ssh server running on the host and that you can login as root. + +eof + +__prompt "Enter hostname or press enter for localhost: " + +if [ "$answer" ]; then + host="$answer" +else + host="localhost" +fi + +manifestinit="conf/manifest/init" +cat << eof + +I'll now setup $manifestinit, containing the following code: + +-------------------------------------------------------------------------------- +# Every machine becomes a marker, so sysadmins know that automatic +# configurations are happening +__file /etc/cdist-configured + +case "\$__target_host" in + $host) + __link /tmp/cdist-testfile --source /etc/cdist-configured --type symbolic + __addifnosuchline /tmp/cdist-welcome --line "Welcome to cdist" + ;; +esac +-------------------------------------------------------------------------------- + +WARNING: This will overwrite ${manifestinit}. + +eof + +cat > "$__cdist_abs_mydir/../$manifestinit" << eof + +# Every machine becomes a marker, so sysadmins know that automatic +# configurations are happening +__file /etc/cdist-configured + +case "\$__target_host" in + $host) + __link /tmp/cdist-testfile --source /etc/cdist-configured --type symbolic + __addifnosuchline /tmp/cdist-welcome --line "Welcome to cdist" + ;; +esac + +eof + +chmod u+x "$__cdist_abs_mydir/../$manifestinit" + +cmd="cdist-deploy-to $host" + +__prompt "Press enter to run \"$cmd\"" + +# No quotes, we need field splitting +$cmd + +################################################################################ +# End +# + +cat << eof + + +-------------------------------------------------------------------------------- +That's it, this is the end of the cdist-quickstart. + +I hope you've got some impression on how cdist works, here are again some +pointers on where to continue to read: + + +eof -------------------------------------------------------------------------------- - Initial install support diff --git a/doc/man/man7/cdist-tutorial.text b/doc/man/man7/cdist-tutorial.text index 9b6e7492..15f2a81d 100755 --- a/doc/man/man7/cdist-tutorial.text +++ b/doc/man/man7/cdist-tutorial.text @@ -52,19 +52,9 @@ ssh-keygen ssh-copy-id root@target_host -------------------------------------------------------------------------------- -As soon as you are able to login to the target host - - -Before you can start using cdist, you need to ensure that -you can login -sshd config! - - - - - -You can copy and paste the following -code into your shell to get started and even configure your system. +As soon as you are able to login without passwort to the target host, +we can use cdist, to configure it. You can copy and paste the following +code into your shell to get started and configure localhost: -------------------------------------------------------------------------------- # Get cdist @@ -75,10 +65,6 @@ cd cdist echo '__file /etc/cdist-configured' > conf/manifest/init chmod 0700 conf/manifest/init -echo 'Ensure that you can login as root to localhost without password' -echo '(i.e. via public key) and then press return' -read tmp - # Configure localhost ./bin/cdist config localhost @@ -92,287 +78,6 @@ essentially shell scripts. Every manifest can use the types known to cdist, which are usually underline prefixed (\_\_). -SSH HINTS ---------- -Control master, ssh agent - -Everything you specify in manifests - - -# Intro of quickstart -# -cat << eof -$banner cdist version $__cdist_version - -Welcome to the interactive guide to cdist! -This is the interactive tutorial and beginners help for cdist and here's -our schedule: - - - Stages: How cdist operates - - Explorer: Explore facts of the target host - - Manifest: Map configurations to hosts - - Types: Bundled functionality - - Deploy a configuration to the local host! - -eof -__prompt "$continue" - -################################################################################ -# Stages -# -cat << eof - -To deploy configurations to a host, you call - - cdist-deploy-to - -which makes calls to other scripts, which realise the so called "stages". -Usually you'll not notice this, but in case you want to debug or hack cdist, -you can run each stage on its own. Besides that, you just need to remember -that the command cdist-deploy-to is the main cdist command. - -See also: - - Source of cdist-deploy-to(1), cdist-stages(7) - -eof -__prompt "$continue" - -################################################################################ -# Explorer -# -cat << eof - -The first thing cdist always does is running different explorers on the -target host. The explorers can be found in the directory - - ${__cdist_explorer_dir} - -An explorer is executed on the target host and its output is saved to a file. -You can use these files later to decide what or how to configure the host. - -For a demonstration, we'll call the OS explorer locally now, but remember: -This is only for demonstration, normally it is run on the target host. -The os explorer will which either displays the detected operating system or -nothing if it does not know your OS. - -See also: - - cdist-explorer(7) - -eof -explorer="${__cdist_explorer_dir}/os" - -__prompt "Press enter to execute $explorer" - -set -x -"$explorer" -set +x - -################################################################################ -# Manifest -# -cat << eof - -The initial manifest is the entry point for cdist to find out, what you would -like to have configured. It is located at - - ${__cdist_manifest_init} - -And can be as simple as - --------------------------------------------------------------------------------- -__file /etc/cdist-configured --type file --------------------------------------------------------------------------------- - -See also: - - cdist-manifest(7) - -eof -__prompt "$continue" - -cat << eof - -Let's take a deeper look at the initial manifest to understand what it means: - - __file /etc/cdist-configured --type file - | | | \\ - | | The parameter type \\ With the value file - | | - | | - | | This is the object id - | - __file is a so called "type" - - -This essentially looks like a standard command executed in the shell. -eof -__prompt "$continue" - -cat << eof - -And that's exactly true. Manifests are shell snippets that can use -types as commands with arguments. cdist prepends a special path -that contain links to the cdist-type-emulator, to \$PATH, so you -can use your types as a command. - -This is also the reason why types should always be prefixed with -"__", to prevent collisions with existing binaries. - -The object id is unique per type and used to prevent you from creating -the same object twice. - -Parameters are type specific and are always specified as --parameter . - -See also: - - cdist-type-build-emulation(1), cdist-type-emulator(1) - -eof -__prompt "$continue" - -################################################################################ -# Types -# -cat << eof - -Types are bundled functionality and are the main component of cdist. -If you want to have a feature x, you write the type __x. Types are stored in - - ${__cdist_type_dir} - -And cdist ships with some types already! - -See also: - - cdist-type(7) - -eof -__prompt "Press enter to see available types" - -set -x -ls ${__cdist_type_dir} -set +x - -cat << eof - -Types consist of the following parts: - - - ${__cdist_name_parameter} (${__cdist_name_parameter_required}/${__cdist_name_parameter_optional} - - ${__cdist_name_manifest} - - ${__cdist_name_explorer} - - ${__cdist_name_gencode} - -eof -__prompt "$continue" - - -cat << eof - -Every type must have a directory named ${__cdist_name_parameter}, which -contains required or optional parameters (in newline seperated files). - -If an object of a specific type was created in the initial manifest, -the manifest of the type is run and may create other objects. - -A type may have ${__cdist_name_explorer}, which are very similar to the -${__cdist_name_explorer} seen above, but with a different purpose: -They are specific to the type and are not relevant for other types. - -You may use them for instance to find out details on the target host, -so you can decide what to do on the target host eventually. - -After the ${__cdist_name_manifest} and the ${__cdist_name_explorer} of -a type have been run, ${__cdist_name_gencode} is executed, which creates -code to be executed on the target on stdout. - -eof -__prompt "$continue" - -################################################################################ -# Deployment -# - -cat << eof - -Now you've got some basic knowledge about cdist, let's configure your a host! - -Ensure that you have a ssh server running on the host and that you can login as root. - -eof - -__prompt "Enter hostname or press enter for localhost: " - -if [ "$answer" ]; then - host="$answer" -else - host="localhost" -fi - -manifestinit="conf/manifest/init" -cat << eof - -I'll now setup $manifestinit, containing the following code: - --------------------------------------------------------------------------------- -# Every machine becomes a marker, so sysadmins know that automatic -# configurations are happening -__file /etc/cdist-configured - -case "\$__target_host" in - $host) - __link /tmp/cdist-testfile --source /etc/cdist-configured --type symbolic - __addifnosuchline /tmp/cdist-welcome --line "Welcome to cdist" - ;; -esac --------------------------------------------------------------------------------- - -WARNING: This will overwrite ${manifestinit}. - -eof - -cat > "$__cdist_abs_mydir/../$manifestinit" << eof - -# Every machine becomes a marker, so sysadmins know that automatic -# configurations are happening -__file /etc/cdist-configured - -case "\$__target_host" in - $host) - __link /tmp/cdist-testfile --source /etc/cdist-configured --type symbolic - __addifnosuchline /tmp/cdist-welcome --line "Welcome to cdist" - ;; -esac - -eof - -chmod u+x "$__cdist_abs_mydir/../$manifestinit" - -cmd="cdist-deploy-to $host" - -__prompt "Press enter to run \"$cmd\"" - -# No quotes, we need field splitting -$cmd - -################################################################################ -# End -# - -cat << eof - - --------------------------------------------------------------------------------- -That's it, this is the end of the cdist-quickstart. - -I hope you've got some impression on how cdist works, here are again some -pointers on where to continue to read: - - -eof - SEE ALSO -------- cdist(1), cdist-type(7), cdist-stages(7) - From cdd4e0968343cc72d79f3228fd7e2f56c611c404 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 01:12:09 +0200 Subject: [PATCH 0281/1024] prefix/localhost in tutorial Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-tutorial.text | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/man/man7/cdist-tutorial.text b/doc/man/man7/cdist-tutorial.text index 15f2a81d..80135da9 100755 --- a/doc/man/man7/cdist-tutorial.text +++ b/doc/man/man7/cdist-tutorial.text @@ -49,7 +49,7 @@ with public keys: ssh-keygen # Copy pubkey over to target host -ssh-copy-id root@target_host +ssh-copy-id root@localhost -------------------------------------------------------------------------------- As soon as you are able to login without passwort to the target host, @@ -75,7 +75,7 @@ ls -l /etc/cdist-configured The file 'conf/manifest/init' is usually the entry point for cdist, to find out what to configure on which host. All manifests are essentially shell scripts. Every manifest can use the types known to -cdist, which are usually underline prefixed (\_\_). +cdist, which are usually underline prefixed (__). SEE ALSO From 3e49b12a6d30dd4621aa5150948c3662cc18aaf0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 01:17:32 +0200 Subject: [PATCH 0282/1024] update cdist-hacker Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-hacker.text | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/doc/man/man7/cdist-hacker.text b/doc/man/man7/cdist-hacker.text index efd6ef7d..b9f79d01 100644 --- a/doc/man/man7/cdist-hacker.text +++ b/doc/man/man7/cdist-hacker.text @@ -26,26 +26,12 @@ in the latest version, drop a mail to the cdist mailing list, subject prefixed with "[BUG] ". -UNDERSTANDING CDIST INTERNALS ------------------------------ -IF you are interested in how cdist internally works, you can open -bin/cdist-config and bin/cdist-deploy-to in your favorite editor and -read the scripts bin/cdist-deploy-to calls. The magnificent HACKERS_README -may be of great help as well. - - CODING CONVENTIONS (EVERYWHERE) ------------------------------- If something should be better done or needs to fixed, add the word FIXME nearby, so grepping for FIXME gives all positions that need to be fixed. -CODING CONVENTIONS (CORE) -------------------------- -- All variables exported by cdist are prefixed with a double underscore (__) -- All cdist-internal variables are prefixed with __cdist_ and are generally not exported. - - HOW TO SUBMIT STUFF FOR INCLUSION INTO UPSTREAM CDIST ----------------------------------------------------- If you did some cool changes to cdist, which you value as a benefit for From ae4d6002f06364a12598d449262c3872746bc7b2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 01:21:16 +0200 Subject: [PATCH 0283/1024] permissions/rephrase Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-explorer.text | 2 +- doc/man/man7/cdist-tutorial.text | 0 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 doc/man/man7/cdist-tutorial.text diff --git a/doc/man/man7/cdist-explorer.text b/doc/man/man7/cdist-explorer.text index 63c7a5c9..e1909ab5 100644 --- a/doc/man/man7/cdist-explorer.text +++ b/doc/man/man7/cdist-explorer.text @@ -26,7 +26,7 @@ $__explorer/ (general and type explorer) or $__type_explorer/ (type explorer). In case of significant errors, the explorer may exit non-zero and return an -error message on stderr, which will cause the cdist run to abort. +error message on stderr, which will cause cdist to abort. You can also use stderr for debugging purposes while developing a new explorer. diff --git a/doc/man/man7/cdist-tutorial.text b/doc/man/man7/cdist-tutorial.text old mode 100755 new mode 100644 From 75023a4ac9061f0eca8792622e972d5d4b57e124 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 01:22:45 +0200 Subject: [PATCH 0284/1024] begin to cleanup cdist-stages Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 1 + doc/man/man7/cdist-stages.text | 35 +--------------------------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 91b418a2..14098099 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -8,6 +8,7 @@ - and that ssh will wait for answer of prompt - nasty if used in parallel mode (scroll up!) +- rewrite cdist-stages SSH HINTS --------- diff --git a/doc/man/man7/cdist-stages.text b/doc/man/man7/cdist-stages.text index 294dffc7..8ac30015 100644 --- a/doc/man/man7/cdist-stages.text +++ b/doc/man/man7/cdist-stages.text @@ -32,11 +32,6 @@ explorers. Every existing explorer is run on the target and the output of all explorers are copied back into the local cache. The results can be used by manifests and types. -Related documentation: - - cdist-explorer-run-global(1) - - cdist-remote-explorer-run(1) - - cdist-explorer(7) - STAGE 2: RUN THE INITIAL MANIFEST --------------------------------- @@ -46,11 +41,6 @@ the objects as defined in the manifest for the specific host. In this stage, no conflicts may occur, i.e. no object of the same type with the same id may be created. -Related documentation: - - cdist-manifest-run-init(1) - - cdist-manifest-run(1) - - cdist-manifest(7) - STAGE 3: OBJECT INFORMATION RETRIEVAL ------------------------------------- @@ -59,12 +49,6 @@ transfered to the target host and executed. The results are transfered back and can be used in the following stages to decide what changes need to be made on the target to implement the desired state. -Related documentation: - - cdist-object-explorer-run(1) - - cdist-remote-explorer-run(1) - - cdist-type(7) - - cdist-explorer(7) - STAGE 4: RUN THE OBJECT MANIFEST -------------------------------- @@ -79,11 +63,6 @@ The newly created objects are merged back into the existing tree. No conflicts may occur during the merge. A conflict would mean that two different objects try to create the same object, which indicates a broken configuration. -Related documentation: - - cdist-object-manifest-run(1) - - cdist-manifest-run(1) - - cdist-type(7) - STAGE 5: CODE GENERATION ------------------------ @@ -92,29 +71,17 @@ gencode scripts. The gencode scripts generate the code to be executed on the target on stdout. If the gencode executables fail, they must print diagnostic messages on stderr and exit non-zero. -Related documentation: - - cdist-object-gencode-run(1) - - cdist-object-gencode(1) - - cdist-type(7) - STAGE 6: CODE EXECUTION ----------------------- For every object the resulting code from the previous stage is transferred to the target host and executed there to apply the configuration changes. -Related documentation: - - cdist-object-code-run(1) - - cdist-code-run(1) - STAGE 7: CACHE -------------- The cache stores the information from the current run for later use. -Related documentation: - - cdist-cache(1) - SUMMARY ------- @@ -126,8 +93,8 @@ in correct order. SEE ALSO -------- +- cdist(1) - cdist(7) -- cdist-deploy-to(1) - cdist-reference(7) From 4879f744c168b536843764a1e40a99a6821ed279 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 01:25:04 +0200 Subject: [PATCH 0285/1024] manpage cleanups Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 4 +++- doc/man/man7/cdist-type.text | 6 +----- doc/man/man7/cdist.text | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 14098099..b7748949 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -8,7 +8,9 @@ - and that ssh will wait for answer of prompt - nasty if used in parallel mode (scroll up!) -- rewrite cdist-stages +- rewrite cdist-stages, remove +- update man7! +- exec flag is not true for manifest anymore SSH HINTS --------- diff --git a/doc/man/man7/cdist-type.text b/doc/man/man7/cdist-type.text index 1af386fb..2439876c 100644 --- a/doc/man/man7/cdist-type.text +++ b/doc/man/man7/cdist-type.text @@ -35,10 +35,6 @@ __file /etc/cdist-configured --type file __package tree --state installed -------------------------------------------------------------------------------- -Internally cdist-type-emulator(1) will be called from cdist-manifest-run(1) to -save the given parameters into a cconfig database, so they can be accessed by -the manifest and gencode scripts of the type (see below). - A list of supported types can be found in the cdist-reference(7) manpage. SINGLETON TYPES @@ -111,7 +107,7 @@ __package_$type "$@" -------------------------------------------------------------------------------- As you can see, the type can reference different environment variables, -which are documented in cdist-environment-variables(7). +which are documented in cdist-reference(7). Always ensure the manifest is executable, otherwise cdist will not be able to execute it. diff --git a/doc/man/man7/cdist.text b/doc/man/man7/cdist.text index 9f7dbbab..2a5d1fe5 100644 --- a/doc/man/man7/cdist.text +++ b/doc/man/man7/cdist.text @@ -35,12 +35,11 @@ pull mechanism (client requests configuration). SEE ALSO -------- - Website: http://www.nico.schottelius.org/software/cdist/[] -- cdist-best-practise(7) -- cdist-deploy-to(1) - cdist-hacker(7) - cdist-manifest(7) -- cdist-quickstart(1) - cdist-type(7) +- cdist(1) +- cdist(7) COPYING From b9335bb7ce221abf09cc96951edd3ae2587d8ae9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 10:35:25 +0200 Subject: [PATCH 0286/1024] update os/os_version explorer to support owl (openwall linux) Signed-off-by: Nico Schottelius --- conf/explorer/os | 2 +- conf/explorer/os_version | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/conf/explorer/os b/conf/explorer/os index 3e1582ec..e59301e7 100755 --- a/conf/explorer/os +++ b/conf/explorer/os @@ -65,7 +65,7 @@ if [ -f /etc/SuSE-release ]; then exit 0 fi -if uname -r | grep -s '.owl' >/dev/null 2>&1; then +if [ -f /etc/owl-release ]; then echo owl exit 0 fi diff --git a/conf/explorer/os_version b/conf/explorer/os_version index 08fda60b..ef80e8fc 100755 --- a/conf/explorer/os_version +++ b/conf/explorer/os_version @@ -42,6 +42,9 @@ case "$($__explorer/os)" in *bsd|solaris) uname -r ;; + owl) + cat /etc/owl-release + ;; redhat|centos) cat /etc/redhat-release ;; From 6f1a13b531cc0664721b5763f8f2be17e8beb807 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 13:38:25 +0200 Subject: [PATCH 0287/1024] move emulator link to emulator module and make source variable (exec_path) Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 115 +++++++----------------------------------- lib/cdist/emulator.py | 9 ++++ lib/cdist/path.py | 10 ---- 3 files changed, 26 insertions(+), 108 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index a5a2252f..cc0f7817 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -24,9 +24,11 @@ import datetime import logging import os import stat +import sys log = logging.getLogger(__name__) +import cdist.emulator import cdist.path CODE_HEADER = "#!/bin/sh -e\n" @@ -35,12 +37,18 @@ class Config: """Cdist main class to hold arbitrary data""" def __init__(self, target_host, - initial_manifest=False, remote_user="root", - home=None, debug=False): + initial_manifest=False, + remote_user="root", + home=None, + exec_path=sys.argv[0], + debug=False): - self.target_host = target_host - self.debug = debug - self.remote_user = remote_user + self.target_host = target_host + self.debug = debug + self.remote_user = remote_user + self.exec_path = exec_path + + # FIXME: broken - construct elsewhere! self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] self.path = cdist.path.Path(self.target_host, @@ -94,7 +102,7 @@ class Config: output = os.path.join(self.path.type_explorer_output_dir(cdist_object), explorer) output_fd = open(output, mode='w') log.debug("%s exploring %s using %s storing to %s", - cdist_object, explorer, remote_cmd, output) + cdist_object, explorer, remote_cmd, output) cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) output_fd.close() @@ -106,6 +114,9 @@ class Config: self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) + cdist.emulator.link(self.exec_path, + self.path.bin_dir, self.path.list_types()) + def run_initial_manifest(self): """Run the initial manifest""" env = { "__manifest" : self.path.manifest_dir } @@ -299,95 +310,3 @@ def config(args): time_end = datetime.datetime.now() log.info("Total processing time for %s host(s): %s", len(args.host), (time_end - time_start).total_seconds()) - -def install(args): - """Install remote system""" - process = {} - -def commandline(): - """Parse command line""" - # Construct parser others can reuse - parser = {} - # Options _all_ parsers have in common - parser['most'] = argparse.ArgumentParser(add_help=False) - parser['most'].add_argument('-d', '--debug', - help='Set log level to debug', action='store_true') - - # Main subcommand parser - parser['main'] = argparse.ArgumentParser(description='cdist ' + cdist.VERSION) - 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', - add_help=False) - 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', - 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') - - # Config - parser['config'] = parser['sub'].add_parser('config', - parents=[parser['most'], parser['configinstall']]) - parser['config'].set_defaults(func=config) - - # Install - parser['install'] = parser['sub'].add_parser('install', - parents=[parser['most'], 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:]) - - # Most subcommands have --debug, so handle it here - if 'debug' in args: - if args.debug: - logging.root.setLevel(logging.DEBUG) - log.debug(args) - - args.func(args) - - -if __name__ == "__main__": - try: - logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') - - if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): - cdist_lib = os.environ["__cdist_python_lib"] - sys.path.insert(0, cdist_lib) - import cdist.emulator - cdist.emulator.emulator(sys.argv) - else: - cdist_lib = os.path.abspath(os.path.join(os.path.dirname(__file__), - '../lib')) - sys.path.insert(0, cdist_lib) - - import cdist - import cdist.banner - import cdist.exec - import cdist.path - - commandline() - except KeyboardInterrupt: - sys.exit(0) - except cdist.Error as e: - log.error(e) - sys.exit(1) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index bd97f69b..b96b62dd 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -133,3 +133,12 @@ def emulator(argv): # sys.exit(1) print("Finished " + type + "/" + object_id + repr(params)) + + +def link(exec_path, bin_dir, type_list): + """Link type names to cdist-type-emulator""" + source = os.path.abspath(exec_path) + for type in type_list: + destination = os.path.join(bin_dir, type) + log.debug("Linking %s to %s", source, destination) + os.symlink(source, destination) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 277b1401..e416c42d 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -94,7 +94,6 @@ class Path: # Setup binary directory + contents self.bin_dir = os.path.join(self.out_dir, "bin") os.mkdir(self.bin_dir) - self.link_type_to_emulator() # List of type explorers transferred self.type_explorers_transferred = {} @@ -275,12 +274,3 @@ class Path: # Ensure that the path exists self.remote_mkdir(remote_base) self.transfer_dir(src, dst) - - - def link_type_to_emulator(self): - """Link type names to cdist-type-emulator""" - source = os.path.abspath(sys.argv[0]) - for type in self.list_types(): - destination = os.path.join(self.bin_dir, type) - log.debug("Linking %s to %s", source, destination) - os.symlink(source, destination) From 7ec9fbbf128e72b16a588007cd2d11d92198a673 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 14:01:04 +0200 Subject: [PATCH 0288/1024] fix argument passing in tests Signed-off-by: Nico Schottelius --- test.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test.py b/test.py index a3652c41..908fad5e 100755 --- a/test.py +++ b/test.py @@ -30,6 +30,9 @@ import unittest sys.path.insert(0, os.path.abspath( os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib'))) +cdist_exec_path = os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin/cdist")) + import cdist import cdist.config import cdist.exec @@ -85,13 +88,14 @@ class Config(unittest.TestCase): self.temp_dir = tempfile.mkdtemp() self.init_manifest = os.path.join(self.temp_dir, "manifest") self.config = cdist.config.Config("localhost", - initial_manifest=self.init_manifest) + initial_manifest=self.init_manifest, + exec_path=cdist_exec_path) def test_initial_manifest_different_parameter(self): manifest_fd = open(self.init_manifest, "w") manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + "--mode 0700\n", - "__file " + self.temp_dir + "--mode 0600\n", + "__file " + self.temp_dir + " --mode 0700\n", + "__file " + self.temp_dir + " --mode 0600\n", ]) manifest_fd.close() @@ -101,7 +105,7 @@ class Config(unittest.TestCase): manifest_fd = open(self.init_manifest, "w") manifest_fd.writelines(["#!/bin/sh\n", "__file " + self.temp_dir + '\n', - "__file " + self.temp_dir + "--mode 0600\n", + "__file " + self.temp_dir + " --mode 0600\n", ]) manifest_fd.close() @@ -110,7 +114,7 @@ class Config(unittest.TestCase): def test_initial_manifest_parameter_removed(self): manifest_fd = open(self.init_manifest, "w") manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + "--mode 0600\n", + "__file " + self.temp_dir + " --mode 0600\n", "__file " + self.temp_dir + "\n", ]) manifest_fd.close() @@ -120,8 +124,8 @@ class Config(unittest.TestCase): def test_initial_manifest_parameter_twice(self): manifest_fd = open(self.init_manifest, "w") manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + "--mode 0600\n", - "__file " + self.temp_dir + "--mode 0600\n", + "__file " + self.temp_dir + " --mode 0600\n", + "__file " + self.temp_dir + " --mode 0600\n", ]) manifest_fd.close() From 9d582ae24f1fa4c3697bb0ddfd83a146fcb75432 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 14:01:09 +0200 Subject: [PATCH 0289/1024] rename emulator to run Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- lib/cdist/emulator.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index d21fda40..245b2fc0 100755 --- a/bin/cdist +++ b/bin/cdist @@ -101,7 +101,7 @@ if __name__ == "__main__": if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): import cdist.emulator - cdist.emulator.emulator(sys.argv) + cdist.emulator.run(sys.argv) else: import cdist import cdist.banner diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index b96b62dd..33594e45 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -29,7 +29,7 @@ import cdist.path log = logging.getLogger(__name__) -def emulator(argv): +def run(argv): """Emulate type commands (i.e. __file and co)""" type = os.path.basename(argv[0]) type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type) @@ -101,8 +101,8 @@ def emulator(argv): # Already exists, verify all parameter are the same if object_exists: if not os.path.isfile(file): - print("New parameter + " + param + "specified, aborting") - print("Source = " + old_object_source + "new =" + object_source) + print("New parameter + \"" + param + "\" specified, aborting") + print("Source = " + " ".join(old_object_source) + " new =" + object_source) sys.exit(1) else: param_fd = open(file, "r") From 0913bb21dd26ec871a683d77a9e623f2be3716f5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 14:08:11 +0200 Subject: [PATCH 0290/1024] use raise instead of sys.exit in emulator Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 33594e45..68a67176 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -22,7 +22,6 @@ import argparse import logging import os -import sys import cdist import cdist.path @@ -101,18 +100,22 @@ def run(argv): # Already exists, verify all parameter are the same if object_exists: if not os.path.isfile(file): - print("New parameter + \"" + param + "\" specified, aborting") - print("Source = " + " ".join(old_object_source) + " new =" + object_source) - sys.exit(1) + raise cdist.Error("New parameter \"" + + param + "\" specified, aborting\n" + + "Source = " + + " ".join(old_object_source) + + " new =" + object_source) else: param_fd = open(file, "r") value_old = param_fd.readlines() param_fd.close() if(value_old != value): - print("Parameter " + param + " differs: " + " ".join(value_old) + " vs. " + value) - print("Sources: " + " ".join(old_object_source) + " and " + object_source) - sys.exit(1) + raise cdist.Error("Parameter + \"" + param + + "\" differs: " + " ".join(value_old) + " vs. " + + value + + "\nSource = " + " ".join(old_object_source) + + " new =" + object_source) else: param_fd = open(file, "w") param_fd.writelines(value) @@ -131,7 +134,6 @@ def run(argv): source_fd.writelines(object_source) source_fd.close() - # sys.exit(1) print("Finished " + type + "/" + object_id + repr(params)) From cc87573d6b877fb7e49db8cea342204bd02efc18 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 15:35:04 +0200 Subject: [PATCH 0291/1024] remove lecagy cdist-type-emulator support Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index cc0f7817..aef0b28a 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -146,12 +146,6 @@ class Config: env['__target_host'] = self.target_host env['__global'] = self.path.out_dir - # Legacy stuff to make cdist-type-emulator work - env['__cdist_core_dir'] = os.path.join(self.path.base_dir, "core") - env['__cdist_local_base_dir'] = self.path.temp_dir - - # Submit information to new type emulator - # Required for recording source env['__cdist_manifest'] = manifest From dc416f5f4910ba9c8d80efdcc68e0717123d906e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 15:43:54 +0200 Subject: [PATCH 0292/1024] pass function, not return :-) Signed-off-by: Nico Schottelius --- test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test.py b/test.py index 908fad5e..44068d52 100755 --- a/test.py +++ b/test.py @@ -99,7 +99,7 @@ class Config(unittest.TestCase): ]) manifest_fd.close() - self.assertRaises(cdist.Error, self.config.run_initial_manifest()) + self.assertRaises(cdist.Error, self.config.run_initial_manifest) def test_initial_manifest_parameter_added(self): manifest_fd = open(self.init_manifest, "w") @@ -109,7 +109,7 @@ class Config(unittest.TestCase): ]) manifest_fd.close() - self.assertRaises(cdist.Error, self.config.run_initial_manifest()) + self.assertRaises(cdist.Error, self.config.run_initial_manifest) def test_initial_manifest_parameter_removed(self): manifest_fd = open(self.init_manifest, "w") @@ -119,7 +119,7 @@ class Config(unittest.TestCase): ]) manifest_fd.close() - self.assertRaises(cdist.Error, self.config.run_initial_manifest()) + self.assertRaises(cdist.Error, self.config.run_initial_manifest) def test_initial_manifest_parameter_twice(self): manifest_fd = open(self.init_manifest, "w") From 3ebece5784bf64f1e961a5d8fdae1a4da8d52507 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 15:47:56 +0200 Subject: [PATCH 0293/1024] +\n in writelines Signed-off-by: Nico Schottelius --- test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test.py b/test.py index 44068d52..8a797d98 100755 --- a/test.py +++ b/test.py @@ -46,11 +46,11 @@ class Exec(unittest.TestCase): self.shell_true = os.path.join(self.temp_dir, "shell_true") true_fd = open(self.shell_true, "w") - true_fd.writelines(["#!/bin/sh", "/bin/true"]) + true_fd.writelines(["#!/bin/sh\n", "/bin/true"]) true_fd.close() false_fd = open(self.shell_false, "w") - false_fd.writelines(["#!/bin/sh", "/bin/false"]) + false_fd.writelines(["#!/bin/sh\n", "/bin/false"]) false_fd.close() def tearDown(self): From 1d981200c8cfaff9da4a301a261525649bab2da7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 15:56:43 +0200 Subject: [PATCH 0294/1024] test breaking run, if a non existent command is called Signed-off-by: Nico Schottelius --- test.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test.py b/test.py index 8a797d98..1e9aee48 100755 --- a/test.py +++ b/test.py @@ -121,6 +121,14 @@ class Config(unittest.TestCase): self.assertRaises(cdist.Error, self.config.run_initial_manifest) + def test_initial_manifest_non_existent_command(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "thereisdefinitelynosuchcommend"]) + manifest_fd.close() + + self.assertRaises(cdist.Error, self.config.run_initial_manifest) + def test_initial_manifest_parameter_twice(self): manifest_fd = open(self.init_manifest, "w") manifest_fd.writelines(["#!/bin/sh\n", From ccbd0f1d8450af180f5883f3b4dad0d429dc35d6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 16:05:26 +0200 Subject: [PATCH 0295/1024] introduce config.link_emulator() to be called from test Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 11 +++++++---- test.py | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index aef0b28a..05bdb2a1 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -107,15 +107,18 @@ class Config: cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) output_fd.close() + def link_emulator(self): + """Link emulator to types""" + cdist.emulator.link(self.exec_path, + self.path.bin_dir, self.path.list_types()) + def init_deploy(self): """Ensure the base directories are cleaned up""" log.debug("Creating clean directory structure") self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) - - cdist.emulator.link(self.exec_path, - self.path.bin_dir, self.path.list_types()) + self.link_emulator() def run_initial_manifest(self): """Run the initial manifest""" @@ -149,7 +152,7 @@ class Config: # Required for recording source env['__cdist_manifest'] = manifest - # Required to find types + # Required to find types env['__cdist_type_base_dir'] = self.path.type_base_dir # Other environment stuff diff --git a/test.py b/test.py index 1e9aee48..ce433152 100755 --- a/test.py +++ b/test.py @@ -90,6 +90,7 @@ class Config(unittest.TestCase): self.config = cdist.config.Config("localhost", initial_manifest=self.init_manifest, exec_path=cdist_exec_path) + self.config.link_emulator() def test_initial_manifest_different_parameter(self): manifest_fd = open(self.init_manifest, "w") From 272b8722c1cdda9fa7f1ef349abe9cdc9366945d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 16:10:53 +0200 Subject: [PATCH 0296/1024] fix output, compare string with string not string with list Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 6 +++--- test.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 68a67176..6a99ba79 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -110,12 +110,12 @@ def run(argv): value_old = param_fd.readlines() param_fd.close() - if(value_old != value): - raise cdist.Error("Parameter + \"" + param + + if(value_old[0] != value): + raise cdist.Error("Parameter\"" + param + "\" differs: " + " ".join(value_old) + " vs. " + value + "\nSource = " + " ".join(old_object_source) - + " new =" + object_source) + + " new = " + object_source) else: param_fd = open(file, "w") param_fd.writelines(value) diff --git a/test.py b/test.py index ce433152..b6a575e9 100755 --- a/test.py +++ b/test.py @@ -139,7 +139,9 @@ class Config(unittest.TestCase): manifest_fd.close() try: + print("a") self.config.run_initial_manifest() + print("b") except cdist.Error: failed = True else: From a1655856999a06fae352e61bf54d6b29561d58dd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 16:20:46 +0200 Subject: [PATCH 0297/1024] pass __debug to manifest Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 5 ++++- lib/cdist/emulator.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 05bdb2a1..6df5d6d8 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -149,10 +149,13 @@ class Config: env['__target_host'] = self.target_host env['__global'] = self.path.out_dir + # Submit debug flag to manifest, can be used by emulator and types + env['__debug'] = "yes" + # Required for recording source env['__cdist_manifest'] = manifest - # Required to find types + # Required to find types env['__cdist_type_base_dir'] = self.path.type_base_dir # Other environment stuff diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 6a99ba79..9fc7c576 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -36,6 +36,9 @@ def run(argv): global_dir = os.environ['__global'] object_source = os.environ['__cdist_manifest'] + if '__debug' in os.environ: + logging.root.setLevel(logging.DEBUG) + parser = argparse.ArgumentParser(add_help=False) # Setup optional parameters @@ -134,7 +137,7 @@ def run(argv): source_fd.writelines(object_source) source_fd.close() - print("Finished " + type + "/" + object_id + repr(params)) + log.debug("Finished " + type + "/" + object_id + repr(params)) def link(exec_path, bin_dir, type_list): From b63fdf16edb71129908fedda0fd82e06d33d7b7a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 16:21:36 +0200 Subject: [PATCH 0298/1024] document __debug in reference Signed-off-by: Nico Schottelius --- doc/man/cdist-reference.text.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index c205bdcc..7196c3b3 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -166,6 +166,11 @@ changed:: ENVIRONMENT VARIABLES --------------------- +__debug:: + If this variable is setup, cdist runs in debug mode. + You can use this information, to only output stuff in debug + mode as well. + Available for: initial manifest, type manifest __explorer:: Directory that contains all global explorers. Available for: explorer From ae7887f775b8db8b1f89f1798de22dc15f9aa98a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 16:25:58 +0200 Subject: [PATCH 0299/1024] ++changes Signed-off-by: Nico Schottelius --- doc/changelog | 2 ++ lib/cdist/emulator.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index a08efb34..53ea04a4 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,5 +1,7 @@ 2.0.2: * Add support for detection of OpenWall Linux (Matthias Teege) + * Add support for __debug variable in manifests + * Bugfix core: Various issues with type emulator 2.0.1: 2011-09-23 * Bugfix core: Always print source of error in case of exec errors diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 9fc7c576..d69694df 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -127,7 +127,7 @@ def run(argv): # Record requirements if "__require" in os.environ: requirements = os.environ['__require'] - print(object_id + ":Writing requirements: " + requirements) + log.debug(object_id + ":Writing requirements: " + requirements) require_fd = open(os.path.join(object_dir, "require"), "a") require_fd.writelines(requirements.split(" ")) require_fd.close() From b52939ccfedf2b4e536f103cd883f61b19cf67a9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 16:40:50 +0200 Subject: [PATCH 0300/1024] only debug if __debug is setup Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 3 ++- lib/cdist/emulator.py | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 6df5d6d8..af47d091 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -150,7 +150,8 @@ class Config: env['__global'] = self.path.out_dir # Submit debug flag to manifest, can be used by emulator and types - env['__debug'] = "yes" + if self.debug: + env['__debug'] = "yes" # Required for recording source env['__cdist_manifest'] = manifest diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index d69694df..38a58f8c 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -38,21 +38,19 @@ def run(argv): if '__debug' in os.environ: logging.root.setLevel(logging.DEBUG) + else: + logging.basicConfig(level=logging.INFO) parser = argparse.ArgumentParser(add_help=False) - # Setup optional parameters for parameter in cdist.path.file_to_list(os.path.join(param_dir, "optional")): argument = "--" + parameter parser.add_argument(argument, action='store', required=False) - - # Setup required parameters for parameter in cdist.path.file_to_list(os.path.join(param_dir, "required")): argument = "--" + parameter parser.add_argument(argument, action='store', required=True) - # Setup positional parameter, if not singleton - + # If not singleton support one positional parameter if not os.path.isfile(os.path.join(type_dir, "singleton")): parser.add_argument("object_id", nargs=1) @@ -70,6 +68,10 @@ def run(argv): if object_id[0] == '/': object_id = object_id[1:] + # Prefix output by object_self + logformat = '%(levelname)s: ' + type + '/' + object_id + ': %(message)s' + logging.basicConfig(format=logformat) + # FIXME: verify object id log.debug(args) From 67f45944dd7d99b4a7710f34dc419ce760d65047 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 16:43:53 +0200 Subject: [PATCH 0301/1024] less todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index b7748949..11c734f9 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -311,15 +311,13 @@ eof via __global/ - Support parallel execution - - and maximum number of parallel runs (-p X) - error handling / report failed hosts -- Allow manifest to be read from stdin - Create new video for cdist 2.0.0 http://www.youtube.com/watch?v=PRMjzy48eTI - Setup __debug, if -d is given, so other tools can reuse it - (-> non core feature! + - implement everywhere to external! - remote_prefix: scp vs. ssh issue From 4a0e0ceb8a9ec695ae5e0c7c0760dc5684d82d0f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 16:44:38 +0200 Subject: [PATCH 0302/1024] release 2.0.2 today Signed-off-by: Nico Schottelius --- doc/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index 53ea04a4..39455351 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,4 +1,4 @@ -2.0.2: +2.0.2: 2011-09-27 * Add support for detection of OpenWall Linux (Matthias Teege) * Add support for __debug variable in manifests * Bugfix core: Various issues with type emulator From 6519d7e92c72ff66ee2fcaeeaa62e2fb45424269 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 16:53:02 +0200 Subject: [PATCH 0303/1024] add hint for debian/argparse Signed-off-by: Nico Schottelius --- README | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README b/README index daa12f70..7c089cf3 100644 --- a/README +++ b/README @@ -86,13 +86,23 @@ cdist was tested or is know to run on at least * SSH-Server -## Getting cdist +## Installation + +### Preperation + +Ensure you have Python 3.x and the **argparse** module installed on +the machine you use to **deploy to the targets**. + +#### Debian + + aptitude install python3 python3-setuptools + easy_install3 argparse + + +### Get cdist You can clone cdist from git, which gives you the advantage of having a version control in place for development of your own stuff as well. - -### Installation - To install cdist, execute the following commands: git clone git://git.schottelius.org/cdist From dfc3d4c7c87bc6ce0e601940a6e4417f037684da Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 16:55:39 +0200 Subject: [PATCH 0304/1024] toc = level 3 (we are getting bigger) Signed-off-by: Nico Schottelius --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 7c089cf3..555d28d6 100644 --- a/README +++ b/README @@ -15,7 +15,7 @@ "P' "" "" -[[!toc levels=2]] +[[!toc levels=3]] ## Introduction From 6c9bf9e5d7d527f4e098272e68e5ad67d6de0322 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 17:12:08 +0200 Subject: [PATCH 0305/1024] use cdist, not __main__ as logger name Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 245b2fc0..c79db293 100755 --- a/bin/cdist +++ b/bin/cdist @@ -26,7 +26,7 @@ import os import re import sys -log = logging.getLogger(__name__) +log = logging.getLogger("cdist") # Ensure our /lib/ is included into PYTHON_PATH sys.path.insert(0, os.path.abspath( From d8da7635def25dc9873886681345d67418e80de5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 17:15:54 +0200 Subject: [PATCH 0306/1024] use warning loglevel by default Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- lib/cdist/config.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index c79db293..ea7cf4f9 100755 --- a/bin/cdist +++ b/bin/cdist @@ -97,7 +97,7 @@ def commandline(): if __name__ == "__main__": try: - logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') + logging.basicConfig(format='%(levelname)s: %(message)s') if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): import cdist.emulator diff --git a/lib/cdist/config.py b/lib/cdist/config.py index af47d091..f50195aa 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -65,6 +65,7 @@ class Config: def run_global_explores(self): """Run global explorers""" + log.info("Running global explorers") explorers = self.path.list_global_explorers() if(len(explorers) == 0): raise CdistError("No explorers found in", self.path.global_explorer_dir) From 0e8dcb2f3db257e5e76f89b4b8394e3ceaa09a4b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 17:20:31 +0200 Subject: [PATCH 0307/1024] add verbose support Signed-off-by: Nico Schottelius --- bin/cdist | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index ea7cf4f9..7d78ff51 100755 --- a/bin/cdist +++ b/bin/cdist @@ -41,7 +41,11 @@ def commandline(): # Options _all_ parsers have in common parser['most'] = argparse.ArgumentParser(add_help=False) parser['most'].add_argument('-d', '--debug', - help='Set log level to debug', action='store_true') + help='Set log level to debug', action='store_true', + default=False) + parser['most'].add_argument('-v', '--verbose', + help='Set log level to info, is more verbose', + action='store_true', default=False) # Main subcommand parser parser['main'] = argparse.ArgumentParser(description='cdist ' + cdist.VERSION) @@ -87,12 +91,13 @@ def commandline(): args = parser['main'].parse_args(sys.argv[1:]) - # Most subcommands have --debug, so handle it here - if 'debug' in args: - if args.debug: - logging.root.setLevel(logging.DEBUG) - log.debug(args) + # 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) if __name__ == "__main__": From d15d65924835d0c0f1c4d559bf44fcc9cdccb21c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 17:20:43 +0200 Subject: [PATCH 0308/1024] increment version for next release Signed-off-by: Nico Schottelius --- lib/cdist/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index 192e5001..a0ca2ba2 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -19,7 +19,7 @@ # # -VERSION = "2.0.2" +VERSION = "2.0.3" class Error(Exception): """Base exception class for this project""" From 26c0d5d9aa28b67b1da47e326bdc3facc045d29a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 17:27:28 +0200 Subject: [PATCH 0309/1024] upcoming changes for 2.0.3 Signed-off-by: Nico Schottelius --- doc/changelog | 3 +++ lib/cdist/config.py | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/changelog b/doc/changelog index 39455351..9fb11307 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,3 +1,6 @@ +2.0.3: + * Improved logging, added --verbose, by more quiet by default + 2.0.2: 2011-09-27 * Add support for detection of OpenWall Linux (Matthias Teege) * Add support for __debug variable in manifests diff --git a/lib/cdist/config.py b/lib/cdist/config.py index f50195aa..51615c28 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -123,6 +123,7 @@ class Config: def run_initial_manifest(self): """Run the initial manifest""" + log.info("Running initial manifest %s", self.path.initial_manifest) env = { "__manifest" : self.path.manifest_dir } self.run_manifest(self.path.initial_manifest, extra_env=env) @@ -243,12 +244,13 @@ class Config: self.run_global_explores() self.run_initial_manifest() + log.info("Running object manifests and type explorers") + old_objects = [] objects = self.path.list_objects() # Continue process until no new objects are created anymore while old_objects != objects: - log.debug("Prepare stage") old_objects = list(objects) for cdist_object in objects: if cdist_object in self.objects_prepared: @@ -263,7 +265,7 @@ class Config: def stage_run(self): """The final (and real) step of deployment""" - log.debug("Actual run objects") + log.info("Generating and executing code") # Now do the final steps over the existing objects for cdist_object in self.path.list_objects(): log.debug("Run object: %s", cdist_object) @@ -306,7 +308,7 @@ def config(args): if args.parallel: for p in process.keys(): - log.debug("Joining %s", p) + log.debug("Joining process %s", p) process[p].join() time_end = datetime.datetime.now() From 298688eb35eef7b4faee8f538062145272b7308d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 17:31:39 +0200 Subject: [PATCH 0310/1024] hint for archlinux users Signed-off-by: Nico Schottelius --- README | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README b/README index 555d28d6..28580c38 100644 --- a/README +++ b/README @@ -93,6 +93,12 @@ cdist was tested or is know to run on at least Ensure you have Python 3.x and the **argparse** module installed on the machine you use to **deploy to the targets**. +#### Archlinux + +Archlinux already has python >= 3.2, so you only need to do: + + pacman -S python + #### Debian aptitude install python3 python3-setuptools From fdb694bc42a09f94a71765c85d3fcaba74f2c70e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 27 Sep 2011 17:36:01 +0200 Subject: [PATCH 0311/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 8be1da54..4cdb6fcf 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -34,6 +34,8 @@ USER INTERFACE -> given after manifest run already! - use absent/present for state by default? +- buggy output with packages that don't exist in archlinux and fedora: + python3 vs. python TYPES ------ From e162861b17e3bd4287ddd55e8532bb00c49ffae1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 28 Sep 2011 09:06:20 +0200 Subject: [PATCH 0312/1024] consistently support -h, -v, -d in all commands Signed-off-by: Nico Schottelius --- bin/cdist | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/cdist b/bin/cdist index 7d78ff51..0bf3ed9c 100755 --- a/bin/cdist +++ b/bin/cdist @@ -39,16 +39,17 @@ def commandline(): # Construct parser others can reuse parser = {} # Options _all_ parsers have in common - parser['most'] = argparse.ArgumentParser(add_help=False) - parser['most'].add_argument('-d', '--debug', + 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['most'].add_argument('-v', '--verbose', - help='Set log level to info, is more verbose', + 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) + 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) @@ -56,7 +57,7 @@ def commandline(): # Banner parser['banner'] = parser['sub'].add_parser('banner', - add_help=False) + parents=[parser['loglevel']]) parser['banner'].set_defaults(func=cdist.banner.banner) # Config and install (common stuff) @@ -78,12 +79,12 @@ def commandline(): # Config parser['config'] = parser['sub'].add_parser('config', - parents=[parser['most'], parser['configinstall']]) + parents=[parser['loglevel'], parser['configinstall']]) parser['config'].set_defaults(func=cdist.config.config) # Install parser['install'] = parser['sub'].add_parser('install', - parents=[parser['most'], parser['configinstall']]) + parents=[parser['loglevel'], parser['configinstall']]) parser['install'].set_defaults(func=cdist.install.install) for p in parser: From 5d018393a9a25e41121d12c8697a0c7368cd1c2f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 28 Sep 2011 09:13:39 +0200 Subject: [PATCH 0313/1024] test if banner works Signed-off-by: Nico Schottelius --- test.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test.py b/test.py index b6a575e9..8fe759a6 100755 --- a/test.py +++ b/test.py @@ -24,6 +24,7 @@ import os import sys import shutil +import subprocess import tempfile import unittest @@ -149,5 +150,11 @@ class Config(unittest.TestCase): self.assertFalse(failed) + +class UI(unittest.TestCase): + def test_banner(self): + self.assertEqual(subprocess.call([cdist_exec_path, "banner"]), 0) + + if __name__ == '__main__': unittest.main() From 3265755bb9197e54e66de791d24b7eff70c980e1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 28 Sep 2011 09:15:04 +0200 Subject: [PATCH 0314/1024] test help function Signed-off-by: Nico Schottelius --- test.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test.py b/test.py index 8fe759a6..d03ad0f1 100755 --- a/test.py +++ b/test.py @@ -34,6 +34,8 @@ sys.path.insert(0, os.path.abspath( cdist_exec_path = os.path.abspath( os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin/cdist")) +cdist_commands=["banner", "config", "install"] + import cdist import cdist.config import cdist.exec @@ -155,6 +157,10 @@ class UI(unittest.TestCase): def test_banner(self): self.assertEqual(subprocess.call([cdist_exec_path, "banner"]), 0) + def test_help(self): + for cmd in cdist_commands: + self.assertEqual(subprocess.call([cdist_exec_path, cmd, "-h"]), 0) + if __name__ == '__main__': unittest.main() From f357eb3038c9d5eef63c506384011f1d0a7e0067 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 28 Sep 2011 09:17:27 +0200 Subject: [PATCH 0315/1024] test config of localhost Signed-off-by: Nico Schottelius --- test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test.py b/test.py index d03ad0f1..5d57fae4 100755 --- a/test.py +++ b/test.py @@ -161,6 +161,11 @@ class UI(unittest.TestCase): for cmd in cdist_commands: self.assertEqual(subprocess.call([cdist_exec_path, cmd, "-h"]), 0) + # FIXME: mockup needed + def test_config_localhost(self): + for cmd in cdist_commands: + self.assertEqual(subprocess.call([cdist_exec_path, "config", "localhost"]), 0) + if __name__ == '__main__': unittest.main() From ab061770f4c4fa2b5fdde1fea46a73c156776278 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Sat, 1 Oct 2011 13:08:07 +0200 Subject: [PATCH 0316/1024] Installation with gentoo --- README | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README b/README index 28580c38..aab4c3a5 100644 --- a/README +++ b/README @@ -105,6 +105,16 @@ Archlinux already has python >= 3.2, so you only need to do: easy_install3 argparse +#### Gentoo + +Gentoo only provides python 3.2 in testing packages (http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=3). +If you want to ensure nothing breaks you must set back the python version to what was default before. + + emerge -av =python-3.2.2 --autounmask-write + emerge -av =python-3.2.2 + eselect python list + eselect python list set python3.2 + ### Get cdist You can clone cdist from git, which gives you the advantage of having From 7d290a7755532a66618caa94093db1a040d90492 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 1 Oct 2011 16:34:25 +0200 Subject: [PATCH 0317/1024] begin to splitup test cases Signed-off-by: Nico Schottelius --- test.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/test.py b/test.py index 5d57fae4..1e0973c5 100755 --- a/test.py +++ b/test.py @@ -142,9 +142,7 @@ class Config(unittest.TestCase): manifest_fd.close() try: - print("a") self.config.run_initial_manifest() - print("b") except cdist.Error: failed = True else: @@ -166,6 +164,30 @@ class UI(unittest.TestCase): for cmd in cdist_commands: self.assertEqual(subprocess.call([cdist_exec_path, "config", "localhost"]), 0) - + +def almost_all_tests(): + suite = unittest.TestSuite([ + unittest.TestLoader().loadTestsFromTestCase(Config), + unittest.TestLoader().loadTestsFromTestCase(Exec)]) + + return suite + +def all_tests(): + suite = unittest.defaultTestLoader + return suite + if __name__ == '__main__': - unittest.main() + result = unittest.TestResult() + # only run some tests, when giving -a -> stuff that usually breaks + if len(sys.argv) >= 2: + if sys.argv[1] == "-a": + suite = all_tests(); + else: + sys.exit(1) + else: + suite = almost_all_tests(); + + # suite.run(result) + # unittest.main() + # unittest.TextTestRunner().run(suite) + From f3bedd8d93b56fc3c2c3aa29b6638ed441f972d9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 1 Oct 2011 17:25:12 +0200 Subject: [PATCH 0318/1024] move tests to test/ again, but seperate them now and add ./build.sh test Signed-off-by: Nico Schottelius --- build.sh | 4 ++ test/test_config.py | 101 ++++++++++++++++++++++++++++++++++++++++++++ test/test_exec.py | 80 +++++++++++++++++++++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100644 test/test_config.py create mode 100755 test/test_exec.py diff --git a/build.sh b/build.sh index d20e0211..24c907e6 100755 --- a/build.sh +++ b/build.sh @@ -126,6 +126,10 @@ case "$1" in | xargs rm -f ;; + test) + python3 -m unittest discover test 'test_*.py' + ;; + *) echo '' echo 'Welcome to cdist!' diff --git a/test/test_config.py b/test/test_config.py new file mode 100644 index 00000000..0632ebcc --- /dev/null +++ b/test/test_config.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 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 . +# +# + +import os +import sys +import tempfile +import unittest + +sys.path.insert(0, os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) + +import cdist.config + +cdist_exec_path = os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin/cdist")) + + +class Config(unittest.TestCase): + def setUp(self): + self.temp_dir = tempfile.mkdtemp() + self.init_manifest = os.path.join(self.temp_dir, "manifest") + self.config = cdist.config.Config("localhost", + initial_manifest=self.init_manifest, + exec_path=cdist_exec_path) + self.config.link_emulator() + + def test_initial_manifest_different_parameter(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + " --mode 0700\n", + "__file " + self.temp_dir + " --mode 0600\n", + ]) + manifest_fd.close() + + self.assertRaises(cdist.Error, self.config.run_initial_manifest) + + def test_initial_manifest_parameter_added(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + '\n', + "__file " + self.temp_dir + " --mode 0600\n", + ]) + manifest_fd.close() + + self.assertRaises(cdist.Error, self.config.run_initial_manifest) + + def test_initial_manifest_parameter_removed(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + " --mode 0600\n", + "__file " + self.temp_dir + "\n", + ]) + manifest_fd.close() + + self.assertRaises(cdist.Error, self.config.run_initial_manifest) + + def test_initial_manifest_non_existent_command(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "thereisdefinitelynosuchcommend"]) + manifest_fd.close() + + self.assertRaises(cdist.Error, self.config.run_initial_manifest) + + def test_initial_manifest_parameter_twice(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + " --mode 0600\n", + "__file " + self.temp_dir + " --mode 0600\n", + ]) + manifest_fd.close() + + try: + self.config.run_initial_manifest() + except cdist.Error: + failed = True + else: + failed = False + + self.assertFalse(failed) + + diff --git a/test/test_exec.py b/test/test_exec.py new file mode 100755 index 00000000..901b5efd --- /dev/null +++ b/test/test_exec.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 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 . +# +# + + +import os +import sys +import shutil +import subprocess +import tempfile +import unittest + +sys.path.insert(0, os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) + +import cdist.exec + +class Exec(unittest.TestCase): + def setUp(self): + """Create shell code and co.""" + + self.temp_dir = tempfile.mkdtemp() + self.shell_false = os.path.join(self.temp_dir, "shell_false") + self.shell_true = os.path.join(self.temp_dir, "shell_true") + + true_fd = open(self.shell_true, "w") + true_fd.writelines(["#!/bin/sh\n", "/bin/true"]) + true_fd.close() + + false_fd = open(self.shell_false, "w") + false_fd.writelines(["#!/bin/sh\n", "/bin/false"]) + false_fd.close() + + def tearDown(self): + shutil.rmtree(self.temp_dir) + + def test_local_success_shell(self): + try: + cdist.exec.shell_run_or_debug_fail(self.shell_true, [self.shell_true]) + except cdist.Error: + failed = True + else: + failed = False + + self.assertFalse(failed) + + def test_local_fail_shell(self): + self.assertRaises(cdist.Error, cdist.exec.shell_run_or_debug_fail, + self.shell_false, [self.shell_false]) + + def test_local_success(self): + try: + cdist.exec.run_or_fail(["/bin/true"]) + except cdist.Error: + failed = True + else: + failed = False + + self.assertFalse(failed) + + def test_local_fail(self): + self.assertRaises(cdist.Error, cdist.exec.run_or_fail, ["/bin/false"]) From 390342b324c0b7bca68bdcf381c37bac98c5c326 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Sat, 1 Oct 2011 14:02:45 +0200 Subject: [PATCH 0319/1024] Mac OS X Tutorial --- README | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README b/README index aab4c3a5..2c6465f2 100644 --- a/README +++ b/README @@ -115,6 +115,12 @@ If you want to ensure nothing breaks you must set back the python version to wha eselect python list eselect python list set python3.2 +#### Max OS X + +Ensure you have port installed and configured (http://www.macports.org/install.php). + + port install python32 + ### Get cdist You can clone cdist from git, which gives you the advantage of having From 6425f1d55c86d383464d64e177eb2d28ac544f41 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Sat, 1 Oct 2011 14:46:41 +0200 Subject: [PATCH 0320/1024] Finished Mac OS X installation --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 2c6465f2..3dff690f 100644 --- a/README +++ b/README @@ -120,6 +120,7 @@ If you want to ensure nothing breaks you must set back the python version to wha Ensure you have port installed and configured (http://www.macports.org/install.php). port install python32 + ln -s /opt/local/bin/python3.2 /opt/local/bin/python3 ### Get cdist From df727a6b6bf52bd35c820480640ec651c3ede841 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 2 Oct 2011 15:52:19 +0200 Subject: [PATCH 0321/1024] remove everything but ui from ui test Signed-off-by: Nico Schottelius --- test.py | 193 ------------------------------------------------ test/nico_ui.py | 41 ++++++++++ 2 files changed, 41 insertions(+), 193 deletions(-) delete mode 100755 test.py create mode 100755 test/nico_ui.py diff --git a/test.py b/test.py deleted file mode 100755 index 1e0973c5..00000000 --- a/test.py +++ /dev/null @@ -1,193 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# 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 . -# -# - - -import os -import sys -import shutil -import subprocess -import tempfile -import unittest - -sys.path.insert(0, os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib'))) - -cdist_exec_path = os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin/cdist")) - -cdist_commands=["banner", "config", "install"] - -import cdist -import cdist.config -import cdist.exec - -class Exec(unittest.TestCase): - def setUp(self): - """Create shell code and co.""" - - self.temp_dir = tempfile.mkdtemp() - self.shell_false = os.path.join(self.temp_dir, "shell_false") - self.shell_true = os.path.join(self.temp_dir, "shell_true") - - true_fd = open(self.shell_true, "w") - true_fd.writelines(["#!/bin/sh\n", "/bin/true"]) - true_fd.close() - - false_fd = open(self.shell_false, "w") - false_fd.writelines(["#!/bin/sh\n", "/bin/false"]) - false_fd.close() - - def tearDown(self): - shutil.rmtree(self.temp_dir) - - def test_local_success_shell(self): - try: - cdist.exec.shell_run_or_debug_fail(self.shell_true, [self.shell_true]) - except cdist.Error: - failed = True - else: - failed = False - - self.assertFalse(failed) - - def test_local_fail_shell(self): - self.assertRaises(cdist.Error, cdist.exec.shell_run_or_debug_fail, - self.shell_false, [self.shell_false]) - - def test_local_success(self): - try: - cdist.exec.run_or_fail(["/bin/true"]) - except cdist.Error: - failed = True - else: - failed = False - - self.assertFalse(failed) - - def test_local_fail(self): - self.assertRaises(cdist.Error, cdist.exec.run_or_fail, ["/bin/false"]) - -class Config(unittest.TestCase): - def setUp(self): - self.temp_dir = tempfile.mkdtemp() - self.init_manifest = os.path.join(self.temp_dir, "manifest") - self.config = cdist.config.Config("localhost", - initial_manifest=self.init_manifest, - exec_path=cdist_exec_path) - self.config.link_emulator() - - def test_initial_manifest_different_parameter(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + " --mode 0700\n", - "__file " + self.temp_dir + " --mode 0600\n", - ]) - manifest_fd.close() - - self.assertRaises(cdist.Error, self.config.run_initial_manifest) - - def test_initial_manifest_parameter_added(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + '\n', - "__file " + self.temp_dir + " --mode 0600\n", - ]) - manifest_fd.close() - - self.assertRaises(cdist.Error, self.config.run_initial_manifest) - - def test_initial_manifest_parameter_removed(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + " --mode 0600\n", - "__file " + self.temp_dir + "\n", - ]) - manifest_fd.close() - - self.assertRaises(cdist.Error, self.config.run_initial_manifest) - - def test_initial_manifest_non_existent_command(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "thereisdefinitelynosuchcommend"]) - manifest_fd.close() - - self.assertRaises(cdist.Error, self.config.run_initial_manifest) - - def test_initial_manifest_parameter_twice(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + " --mode 0600\n", - "__file " + self.temp_dir + " --mode 0600\n", - ]) - manifest_fd.close() - - try: - self.config.run_initial_manifest() - except cdist.Error: - failed = True - else: - failed = False - - self.assertFalse(failed) - - -class UI(unittest.TestCase): - def test_banner(self): - self.assertEqual(subprocess.call([cdist_exec_path, "banner"]), 0) - - def test_help(self): - for cmd in cdist_commands: - self.assertEqual(subprocess.call([cdist_exec_path, cmd, "-h"]), 0) - - # FIXME: mockup needed - def test_config_localhost(self): - for cmd in cdist_commands: - self.assertEqual(subprocess.call([cdist_exec_path, "config", "localhost"]), 0) - - -def almost_all_tests(): - suite = unittest.TestSuite([ - unittest.TestLoader().loadTestsFromTestCase(Config), - unittest.TestLoader().loadTestsFromTestCase(Exec)]) - - return suite - -def all_tests(): - suite = unittest.defaultTestLoader - return suite - -if __name__ == '__main__': - result = unittest.TestResult() - # only run some tests, when giving -a -> stuff that usually breaks - if len(sys.argv) >= 2: - if sys.argv[1] == "-a": - suite = all_tests(); - else: - sys.exit(1) - else: - suite = almost_all_tests(); - - # suite.run(result) - # unittest.main() - # unittest.TextTestRunner().run(suite) - diff --git a/test/nico_ui.py b/test/nico_ui.py new file mode 100755 index 00000000..4e5b1a17 --- /dev/null +++ b/test/nico_ui.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 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 . +# +# + + +import subprocess + +cdist_exec_path = os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin/cdist")) + +class UI(unittest.TestCase): + def test_banner(self): + self.assertEqual(subprocess.call([cdist_exec_path, "banner"]), 0) + + def test_help(self): + for cmd in cdist_commands: + self.assertEqual(subprocess.call([cdist_exec_path, cmd, "-h"]), 0) + + # FIXME: mockup needed + def test_config_localhost(self): + for cmd in cdist_commands: + self.assertEqual(subprocess.call([cdist_exec_path, "config", "localhost"]), 0) + From cadb4fa852870f872fc65ea7e85680406eff20a5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 2 Oct 2011 15:56:27 +0200 Subject: [PATCH 0322/1024] add test all and make ui tests work again Signed-off-by: Nico Schottelius --- build.sh | 4 ++++ test/nico_ui.py | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 24c907e6..021fb480 100755 --- a/build.sh +++ b/build.sh @@ -130,6 +130,10 @@ case "$1" in python3 -m unittest discover test 'test_*.py' ;; + test-all) + python3 -m unittest discover test '*.py' + ;; + *) echo '' echo 'Welcome to cdist!' diff --git a/test/nico_ui.py b/test/nico_ui.py index 4e5b1a17..8ce98043 100755 --- a/test/nico_ui.py +++ b/test/nico_ui.py @@ -21,10 +21,14 @@ # +import os import subprocess +import unittest + +cdist_commands=["banner", "config", "install"] cdist_exec_path = os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin/cdist")) + os.path.join(os.path.dirname(os.path.realpath(__file__)), "../bin/cdist")) class UI(unittest.TestCase): def test_banner(self): From 5d256b21b1e844026426f4ab22207952ecf35b7f Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Sun, 2 Oct 2011 22:33:56 +0200 Subject: [PATCH 0323/1024] Initial init_script type --- conf/type/__init_script/gencode-remote | 30 ++++++++++++++++++++++ conf/type/__init_script/parameter/optional | 1 + conf/type/__init_script/parameter/required | 1 + 3 files changed, 32 insertions(+) create mode 100644 conf/type/__init_script/gencode-remote create mode 100644 conf/type/__init_script/parameter/optional create mode 100644 conf/type/__init_script/parameter/required diff --git a/conf/type/__init_script/gencode-remote b/conf/type/__init_script/gencode-remote new file mode 100644 index 00000000..d9e56970 --- /dev/null +++ b/conf/type/__init_script/gencode-remote @@ -0,0 +1,30 @@ +#!/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/service" ]; then + service=$(cat "$__object/parameter/service") +else + service="/$__object_id" +fi + +mode=$(cat "$__object/parameter/mode") + +echo "/etc/init.d/${service} ${mode}" diff --git a/conf/type/__init_script/parameter/optional b/conf/type/__init_script/parameter/optional new file mode 100644 index 00000000..24e10984 --- /dev/null +++ b/conf/type/__init_script/parameter/optional @@ -0,0 +1 @@ +service diff --git a/conf/type/__init_script/parameter/required b/conf/type/__init_script/parameter/required new file mode 100644 index 00000000..17ab372f --- /dev/null +++ b/conf/type/__init_script/parameter/required @@ -0,0 +1 @@ +mode From 5f1afb08f6387111a754fef0bbdc1e7abe093257 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 3 Oct 2011 17:33:19 +0200 Subject: [PATCH 0324/1024] man page --- conf/type/__init_script/man.text | 49 ++++++++++++++++++++++ conf/type/__init_script/parameter/optional | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 conf/type/__init_script/man.text diff --git a/conf/type/__init_script/man.text b/conf/type/__init_script/man.text new file mode 100644 index 00000000..34065260 --- /dev/null +++ b/conf/type/__init_script/man.text @@ -0,0 +1,49 @@ +cdist-type__init_script(7) +============================== +Daniel Roth + + +NAME +---- +cdist-type__init_script - Use the init scripts + + +DESCRIPTION +----------- +This type can be used to control your init scripts. + + +REQUIRED PARAMETERS +------------------- +mode:: + Specifies what shall be done with the init script (usually one of 'start'|'stop'|'restart'|'reload' or 'force-reload') + + +OPTIONAL PARAMETERS +------------------- +script:: + If supplied, use this as the init-script. + Otherwise the object_id is used. The script will be pretended with '/etc/init.d/' + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Reloads the configuration for lighttpd +__init_script lighttpd --mode force-reload + +# Reloads the configuration for lighttpd +__init_script lighty --script lighttpd --mode force-reload +-------------------------------------------------------------------------------- + + +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/__init_script/parameter/optional b/conf/type/__init_script/parameter/optional index 24e10984..84f7e31d 100644 --- a/conf/type/__init_script/parameter/optional +++ b/conf/type/__init_script/parameter/optional @@ -1 +1 @@ -service +script From 342cbca533a5da451555769d55cd83b7cb0959c1 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 3 Oct 2011 18:00:07 +0200 Subject: [PATCH 0325/1024] additional parameter base_dir --- conf/type/__init_script/gencode-remote | 16 ++++++++++++---- conf/type/__init_script/man.text | 4 +++- conf/type/__init_script/parameter/optional | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/conf/type/__init_script/gencode-remote b/conf/type/__init_script/gencode-remote index d9e56970..9b493cfc 100644 --- a/conf/type/__init_script/gencode-remote +++ b/conf/type/__init_script/gencode-remote @@ -19,12 +19,20 @@ # # -if [ -f "$__object/parameter/service" ]; then - service=$(cat "$__object/parameter/service") +if [ -f "$__object/parameter/script" ]; then + script=$(cat "$__object/parameter/script") else - service="/$__object_id" + script="/$__object_id" fi +if [ -f "$__object/parameter/base_dir" ]; then + base_dir=$(cat "$__object/parameter/base_dir") +else + base_dir="/etc/init.d" +fi + + + mode=$(cat "$__object/parameter/mode") -echo "/etc/init.d/${service} ${mode}" +echo "${base_dir}/${script} ${mode}" diff --git a/conf/type/__init_script/man.text b/conf/type/__init_script/man.text index 34065260..898943a5 100644 --- a/conf/type/__init_script/man.text +++ b/conf/type/__init_script/man.text @@ -23,8 +23,10 @@ OPTIONAL PARAMETERS ------------------- script:: If supplied, use this as the init-script. - Otherwise the object_id is used. The script will be pretended with '/etc/init.d/' + Otherwise the object_id is used. +base_dir:: + If supplied, this type uses this directory instead of '/etc/init.d'. The parameter will not need an ending slash. EXAMPLES -------- diff --git a/conf/type/__init_script/parameter/optional b/conf/type/__init_script/parameter/optional index 84f7e31d..5551a8f2 100644 --- a/conf/type/__init_script/parameter/optional +++ b/conf/type/__init_script/parameter/optional @@ -1 +1,2 @@ script +base_dir From 2147480fcd418c21b3a539e622d9ad46641f6a6f Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 3 Oct 2011 18:35:45 +0200 Subject: [PATCH 0326/1024] base_dir is /etc/rc.d for archlinux /etc/init.d otherwise --- conf/type/__init_script/gencode-remote | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/conf/type/__init_script/gencode-remote b/conf/type/__init_script/gencode-remote index 9b493cfc..ff823cad 100644 --- a/conf/type/__init_script/gencode-remote +++ b/conf/type/__init_script/gencode-remote @@ -28,11 +28,13 @@ fi if [ -f "$__object/parameter/base_dir" ]; then base_dir=$(cat "$__object/parameter/base_dir") else - base_dir="/etc/init.d" + os="$(cat "$__global/explorer/os")" + case "$os" in + archlinux) base_dir="/etc/rc.d" ;; + *) base_dir="/etc/init.d" + esac fi - - mode=$(cat "$__object/parameter/mode") echo "${base_dir}/${script} ${mode}" From 40d5b9cb05f93a8fc770fd595aadc8d9cd0ce40c Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 3 Oct 2011 21:39:07 +0200 Subject: [PATCH 0327/1024] bsd init location --- conf/type/__init_script/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__init_script/gencode-remote b/conf/type/__init_script/gencode-remote index ff823cad..d212feb7 100644 --- a/conf/type/__init_script/gencode-remote +++ b/conf/type/__init_script/gencode-remote @@ -30,7 +30,7 @@ if [ -f "$__object/parameter/base_dir" ]; then else os="$(cat "$__global/explorer/os")" case "$os" in - archlinux) base_dir="/etc/rc.d" ;; + archlinux|netbsd|macosx|freebsd|openbsd) base_dir="/etc/rc.d" ;; *) base_dir="/etc/init.d" esac fi From d3923c7b0f06a3cf11b9adb0a1ffc1ffa9a4cdb3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 14:15:30 +0200 Subject: [PATCH 0328/1024] add template for install tests Signed-off-by: Nico Schottelius --- test/test_install.py | 101 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 test/test_install.py diff --git a/test/test_install.py b/test/test_install.py new file mode 100644 index 00000000..21e8ca06 --- /dev/null +++ b/test/test_install.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 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 . +# +# + +import os +import sys +import tempfile +import unittest + +sys.path.insert(0, os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) + +import cdist.config + +cdist_exec_path = os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin/cdist")) + + +class Install(unittest.TestCase): + def setUp(self): + self.temp_dir = tempfile.mkdtemp() + self.init_manifest = os.path.join(self.temp_dir, "manifest") + self.config = cdist.config.Config("localhost", + initial_manifest=self.init_manifest, + exec_path=cdist_exec_path) + self.config.link_emulator() + + def test_initial_manifest_different_parameter(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + " --mode 0700\n", + "__file " + self.temp_dir + " --mode 0600\n", + ]) + manifest_fd.close() + + self.assertRaises(cdist.Error, self.config.run_initial_manifest) + + def test_initial_manifest_parameter_added(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + '\n', + "__file " + self.temp_dir + " --mode 0600\n", + ]) + manifest_fd.close() + + self.assertRaises(cdist.Error, self.config.run_initial_manifest) + + def test_initial_manifest_parameter_removed(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + " --mode 0600\n", + "__file " + self.temp_dir + "\n", + ]) + manifest_fd.close() + + self.assertRaises(cdist.Error, self.config.run_initial_manifest) + + def test_initial_manifest_non_existent_command(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "thereisdefinitelynosuchcommend"]) + manifest_fd.close() + + self.assertRaises(cdist.Error, self.config.run_initial_manifest) + + def test_initial_manifest_parameter_twice(self): + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + " --mode 0600\n", + "__file " + self.temp_dir + " --mode 0600\n", + ]) + manifest_fd.close() + + try: + self.config.run_initial_manifest() + except cdist.Error: + failed = True + else: + failed = False + + self.assertFalse(failed) + + From 2d567c175926fa40b427b3cbb9eaeaa00ff8b9da Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 14:18:39 +0200 Subject: [PATCH 0329/1024] prepare cleanup of tests for later Signed-off-by: Nico Schottelius --- build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sh b/build.sh index 021fb480..c6906357 100755 --- a/build.sh +++ b/build.sh @@ -41,6 +41,9 @@ MAN1DSTDIR=${MANDIR}/man1 MAN7DSTDIR=${MANDIR}/man7 SPEECHESDIR=doc/speeches +# FIXME: make lib for tests! +# PYTHONPATH=$PYTHONPATH:$(pwd -P)/test/lib + case "$1" in man) set -e From ffb533eae8b881ac7b67781453d60baaa1916649 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 14:18:43 +0200 Subject: [PATCH 0330/1024] -exec Signed-off-by: Nico Schottelius --- test/nico_ui.py | 0 test/test_exec.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 test/nico_ui.py mode change 100755 => 100644 test/test_exec.py diff --git a/test/nico_ui.py b/test/nico_ui.py old mode 100755 new mode 100644 diff --git a/test/test_exec.py b/test/test_exec.py old mode 100755 new mode 100644 From db322c0b5e52849c99226bec383978f3fbab2a65 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 14:29:33 +0200 Subject: [PATCH 0331/1024] integrate tests into library Signed-off-by: Nico Schottelius --- lib/cdist/test/__init__.py | 0 {test => lib/cdist/test}/nico_ui.py | 0 {test => lib/cdist/test}/test_config.py | 0 {test => lib/cdist/test}/test_exec.py | 0 {test => lib/cdist/test}/test_install.py | 0 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 lib/cdist/test/__init__.py rename {test => lib/cdist/test}/nico_ui.py (100%) rename {test => lib/cdist/test}/test_config.py (100%) rename {test => lib/cdist/test}/test_exec.py (100%) rename {test => lib/cdist/test}/test_install.py (100%) diff --git a/lib/cdist/test/__init__.py b/lib/cdist/test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/nico_ui.py b/lib/cdist/test/nico_ui.py similarity index 100% rename from test/nico_ui.py rename to lib/cdist/test/nico_ui.py diff --git a/test/test_config.py b/lib/cdist/test/test_config.py similarity index 100% rename from test/test_config.py rename to lib/cdist/test/test_config.py diff --git a/test/test_exec.py b/lib/cdist/test/test_exec.py similarity index 100% rename from test/test_exec.py rename to lib/cdist/test/test_exec.py diff --git a/test/test_install.py b/lib/cdist/test/test_install.py similarity index 100% rename from test/test_install.py rename to lib/cdist/test/test_install.py From f5a58f768371be278dd66760c87b43127c5acb6f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 14:30:38 +0200 Subject: [PATCH 0332/1024] adjust auto discovery Signed-off-by: Nico Schottelius --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index c6906357..39192c78 100755 --- a/build.sh +++ b/build.sh @@ -130,11 +130,11 @@ case "$1" in ;; test) - python3 -m unittest discover test 'test_*.py' + python3 -m unittest discover lib/cdist/test 'test_*.py' ;; test-all) - python3 -m unittest discover test '*.py' + python3 -m unittest discover lib/cdist/test '*.py' ;; *) From 13ed37a4e954d60e27199bfc981d7b795fb36302 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 14:45:35 +0200 Subject: [PATCH 0333/1024] begin to test explorer success in test_install Signed-off-by: Nico Schottelius --- build.sh | 8 +++++--- lib/cdist/test/test_install.py | 12 ++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 39192c78..01094e12 100755 --- a/build.sh +++ b/build.sh @@ -41,9 +41,6 @@ MAN1DSTDIR=${MANDIR}/man1 MAN7DSTDIR=${MANDIR}/man7 SPEECHESDIR=doc/speeches -# FIXME: make lib for tests! -# PYTHONPATH=$PYTHONPATH:$(pwd -P)/test/lib - case "$1" in man) set -e @@ -133,6 +130,11 @@ case "$1" in python3 -m unittest discover lib/cdist/test 'test_*.py' ;; + test-install) + PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib \ + python3 -m unittest cdist.test.test_install + ;; + test-all) python3 -m unittest discover lib/cdist/test '*.py' ;; diff --git a/lib/cdist/test/test_install.py b/lib/cdist/test/test_install.py index 21e8ca06..f5956585 100644 --- a/lib/cdist/test/test_install.py +++ b/lib/cdist/test/test_install.py @@ -43,6 +43,18 @@ class Install(unittest.TestCase): exec_path=cdist_exec_path) self.config.link_emulator() +### NEW FOR INSTALL ############################################################ + + def test_explorer_ran(self): + """Check that all explorers returned a result""" + self.config.run_global_explores() + explorers = self.config.path.list_global_explorers() + + for explorer in explorers: + output = self.path.global_explorer_output_path(explorer) + self.assertTrue(os.path.isfile(output)) + +### OLD FROM CONFIG ############################################################ def test_initial_manifest_different_parameter(self): manifest_fd = open(self.init_manifest, "w") manifest_fd.writelines(["#!/bin/sh\n", From 5940c21fba007f9f8fad0650d696ed2056a57f8e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 14:56:59 +0200 Subject: [PATCH 0334/1024] get rid of bashism /echo -n/printf/ Signed-off-by: Steven Armstrong --- conf/type/__partition_msdos_apply/files/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__partition_msdos_apply/files/lib.sh b/conf/type/__partition_msdos_apply/files/lib.sh index e24c1cb7..01a817a8 100644 --- a/conf/type/__partition_msdos_apply/files/lib.sh +++ b/conf/type/__partition_msdos_apply/files/lib.sh @@ -11,7 +11,7 @@ fdisk_command() { local cmd="$2" debug fdisk_command "running fdisk command '${cmd}' on device ${device}" - echo -en "${cmd}\nw\n" | fdisk -c -u "$device" + printf "${cmd}\nw\n" | fdisk -c -u "$device" return $? } From 410a2fe7ff1f56dc54420c921fff6390af357e62 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 15:08:37 +0200 Subject: [PATCH 0335/1024] test_explorer_ran finished Signed-off-by: Nico Schottelius --- lib/cdist/test/test_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/test/test_install.py b/lib/cdist/test/test_install.py index f5956585..3289ea47 100644 --- a/lib/cdist/test/test_install.py +++ b/lib/cdist/test/test_install.py @@ -51,7 +51,7 @@ class Install(unittest.TestCase): explorers = self.config.path.list_global_explorers() for explorer in explorers: - output = self.path.global_explorer_output_path(explorer) + output = self.config.path.global_explorer_output_path(explorer) self.assertTrue(os.path.isfile(output)) ### OLD FROM CONFIG ############################################################ From ec82fa8f972b13cec907d8fff4560ff2fa3201ad Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 15:09:33 +0200 Subject: [PATCH 0336/1024] document tests/single ones Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-04 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 doc/dev/logs/2011-10-04 diff --git a/doc/dev/logs/2011-10-04 b/doc/dev/logs/2011-10-04 new file mode 100644 index 00000000..f3bb852d --- /dev/null +++ b/doc/dev/logs/2011-10-04 @@ -0,0 +1,3 @@ +Testing for single tests: + PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib python3 -m unittest cdist.test.test_install.Install.test_explorer_ran + From 32832777c6778a881b9389e3e3b325c101b4a131 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 15:24:19 +0200 Subject: [PATCH 0337/1024] give disk some time to write parition table Signed-off-by: Steven Armstrong --- conf/type/__partition_msdos_apply/files/lib.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conf/type/__partition_msdos_apply/files/lib.sh b/conf/type/__partition_msdos_apply/files/lib.sh index 01a817a8..f0859aab 100644 --- a/conf/type/__partition_msdos_apply/files/lib.sh +++ b/conf/type/__partition_msdos_apply/files/lib.sh @@ -12,6 +12,8 @@ fdisk_command() { debug fdisk_command "running fdisk command '${cmd}' on device ${device}" printf "${cmd}\nw\n" | fdisk -c -u "$device" + # give disk some time + sleep 1 return $? } From 3d75ec9bfcde3b3f057d1d7c4061c1e553c3e681 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 15:49:18 +0200 Subject: [PATCH 0338/1024] make test suite usable from command line Signed-off-by: Nico Schottelius --- lib/cdist/test/__main__.py | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/cdist/test/__main__.py diff --git a/lib/cdist/test/__main__.py b/lib/cdist/test/__main__.py new file mode 100644 index 00000000..03bca847 --- /dev/null +++ b/lib/cdist/test/__main__.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 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 . +# +# + + +import sys +import cdist.test + +#class UI(unittest.TestCase): +# def test_banner(self): +# self.assertEqual(subprocess.call([cdist_exec_path, "banner"]), 0) +# +# def test_help(self): +# for cmd in cdist_commands: +# self.assertEqual(subprocess.call([cdist_exec_path, cmd, "-h"]), 0) +# +# # FIXME: mockup needed +# def test_config_localhost(self): +# for cmd in cdist_commands: +# self.assertEqual(subprocess.call([cdist_exec_path, "config", "localhost"]), 0) + +print(cdist.test.cdist_exec_path) +print(sys.argv) From 40a1619c1ad6731666a6c3303e4550958e43ef45 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 16:15:10 +0200 Subject: [PATCH 0339/1024] make build test work (or fail, but work) again Signed-off-by: Nico Schottelius --- build.sh | 6 +++-- lib/cdist/test/__init__.py | 47 ++++++++++++++++++++++++++++++++++++++ lib/cdist/test/__main__.py | 5 ++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 01094e12..6a91ff3d 100755 --- a/build.sh +++ b/build.sh @@ -127,7 +127,8 @@ case "$1" in ;; test) - python3 -m unittest discover lib/cdist/test 'test_*.py' + PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib \ + python3 -m cdist.test ;; test-install) @@ -136,7 +137,8 @@ case "$1" in ;; test-all) - python3 -m unittest discover lib/cdist/test '*.py' + PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib \ + python3 -m unittest discover lib/cdist/test '*.py' ;; *) diff --git a/lib/cdist/test/__init__.py b/lib/cdist/test/__init__.py index e69de29b..f614fa05 100644 --- a/lib/cdist/test/__init__.py +++ b/lib/cdist/test/__init__.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 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 . +# +# + + +import os +import subprocess +import unittest + +cdist_commands=["banner", "config", "install"] + +cdist_exec_path = os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../bin/cdist")) + +def exec(): + print(cdist_exec_path) + +#class UI(unittest.TestCase): +# def test_banner(self): +# self.assertEqual(subprocess.call([cdist_exec_path, "banner"]), 0) +# +# def test_help(self): +# for cmd in cdist_commands: +# self.assertEqual(subprocess.call([cdist_exec_path, cmd, "-h"]), 0) +# +# # FIXME: mockup needed +# def test_config_localhost(self): +# for cmd in cdist_commands: +# self.assertEqual(subprocess.call([cdist_exec_path, "config", "localhost"]), 0) diff --git a/lib/cdist/test/__main__.py b/lib/cdist/test/__main__.py index 03bca847..3b31a2cd 100644 --- a/lib/cdist/test/__main__.py +++ b/lib/cdist/test/__main__.py @@ -21,8 +21,10 @@ # +import os import sys import cdist.test +import unittest #class UI(unittest.TestCase): # def test_banner(self): @@ -39,3 +41,6 @@ import cdist.test print(cdist.test.cdist_exec_path) print(sys.argv) + +suite = unittest.defaultTestLoader.discover(os.path.dirname(__file__)) +unittest.TextTestRunner(verbosity=1).run(suite) From 6c22867fc253096f8134960fbb0b4c68f05dd44b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 16:32:43 +0200 Subject: [PATCH 0340/1024] begin to test path and add method to check type Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 6 +++ lib/cdist/test/test_install.py | 16 ++++++++ lib/cdist/test/test_path.py | 71 ++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 lib/cdist/test/test_path.py diff --git a/lib/cdist/path.py b/lib/cdist/path.py index e416c42d..2dd9dcf1 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -175,8 +175,14 @@ class Path: return list def list_types(self): + """Retuns list of types""" return os.listdir(self.type_base_dir) + def is_install_type(self, type): + """Check whether a type is used for installation (if not: for configuration)""" + marker = os.path.join(self.type_dir(type), "install") + return os.path.isfile(marker) + def list_object_paths(self, starting_point): """Return list of paths of existing objects""" object_paths = [] diff --git a/lib/cdist/test/test_install.py b/lib/cdist/test/test_install.py index 3289ea47..9cfae066 100644 --- a/lib/cdist/test/test_install.py +++ b/lib/cdist/test/test_install.py @@ -54,6 +54,22 @@ class Install(unittest.TestCase): output = self.config.path.global_explorer_output_path(explorer) self.assertTrue(os.path.isfile(output)) + def test_manifest_uses_install_types_only(self): + """Check that objects created from manifest are only of install type""" + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + " --mode 0700\n", + "__partition_msdos /dev/null --type 82\n", + ]) + manifest_fd.close() + + self.config.run_initial_manifest() + + # FIXME: check that only __partition_msdos objects are created! + + self.assertFalse(failed) + + ### OLD FROM CONFIG ############################################################ def test_initial_manifest_different_parameter(self): manifest_fd = open(self.init_manifest, "w") diff --git a/lib/cdist/test/test_path.py b/lib/cdist/test/test_path.py new file mode 100644 index 00000000..04a107b8 --- /dev/null +++ b/lib/cdist/test/test_path.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 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 . +# +# + +import os +import sys +import tempfile +import unittest + +import cdist.path +import cdist.test + +class Path(unittest.TestCase): + def setUp(self): + self.temp_dir = tempfile.mkdtemp() + self.init_manifest = os.path.join(self.temp_dir, "manifest") + self.path = cdist.config.Path("localhost", "root", + "ssh root@localhost", + initial_manifest=self.init_manifest, + base_dir=self.temp_dir) + + def tearDown(self): + self.path.cleanup() + + def test_type_detection(self): + """Check that a type is identified as install or configuration correctly""" + + # Create install type + install_type = os.path.join( + os.mkdir( + # Create non-install type + + self.config.run_global_explores() + explorers = self.config.path.list_global_explorers() + + for explorer in explorers: + output = self.config.path.global_explorer_output_path(explorer) + self.assertTrue(os.path.isfile(output)) + + def test_manifest_uses_install_types_only(self): + """Check that objects created from manifest are only of install type""" + manifest_fd = open(self.init_manifest, "w") + manifest_fd.writelines(["#!/bin/sh\n", + "__file " + self.temp_dir + " --mode 0700\n", + "__partition_msdos /dev/null --type 82\n", + ]) + manifest_fd.close() + + self.config.run_initial_manifest() + + # FIXME: check that only __partition_msdos objects are created! + + self.assertFalse(failed) From 919f251759958403e097150e460f31a708d95ee2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 16:33:58 +0200 Subject: [PATCH 0341/1024] ++examples Signed-off-by: Steven Armstrong --- conf/type/__partition_msdos/man.text | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/conf/type/__partition_msdos/man.text b/conf/type/__partition_msdos/man.text index c9ef0cf1..78220ee0 100644 --- a/conf/type/__partition_msdos/man.text +++ b/conf/type/__partition_msdos/man.text @@ -36,20 +36,18 @@ EXAMPLES -------- -------------------------------------------------------------------------------- -# 128MB linux, bootable +# 128MB, linux, bootable __partition_msdos /dev/sda1 --type 83 --size 128M --bootable true -# 512MB swap +# 512MB, swap __partition_msdos /dev/sda2 --type 82 --size 512M -# extended +# 100GB, extended __partition_msdos /dev/sda3 --type extended --size 100G # 10GB, linux __partition_msdos /dev/sda5 --type 83 --size 10G -# 50% of free space, linux +# 50% of the free space of the extended partition, linux __partition_msdos /dev/sda6 --type 83 --size 50% -# rest of disk, linux +# rest of the extended partition, linux __partition_msdos /dev/sda7 --type 83 --size + -# same thing as -__partition_msdos /dev/sda7 --type 83 -------------------------------------------------------------------------------- From 60fab053f2a08d0aeda0a780aecdc22e0fdd5f12 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 16:36:33 +0200 Subject: [PATCH 0342/1024] ++changes for 2.0.3 Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 9fb11307..632ddb45 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,5 +1,6 @@ 2.0.3: * Improved logging, added --verbose, by more quiet by default + * Bugfix __user: Correct quoting (Steven Armstrong) 2.0.2: 2011-09-27 * Add support for detection of OpenWall Linux (Matthias Teege) From 1d2ec72396498731e693f809e08104ca90240ad3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 16:43:13 +0200 Subject: [PATCH 0343/1024] add paragraph to cdist-hacker that states manpages always need to build on merge request Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-hacker.text | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/man/man7/cdist-hacker.text b/doc/man/man7/cdist-hacker.text index b9f79d01..f8e3730e 100644 --- a/doc/man/man7/cdist-hacker.text +++ b/doc/man/man7/cdist-hacker.text @@ -46,9 +46,8 @@ work nor kill the authors brain: private branch! - Code to be included should be branched of the upstream "master" branch - Exception: Bugfixes to a version branch -- Code submissions should be in your master branch - - Other branches are fine as well, but you need to tell me which branch - your work is in! +- On a merge request, always name the branch I should pull from +- Always ensure **all** manpages build: ./build.sh man - If you developed more than **one** feature, consider submitting them in seperate branches. This way one feature can already be included, even if the other needs to be improved. From 8dd248cf7664c2cc428c7639b26b102a20e6cbea Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 17:01:11 +0200 Subject: [PATCH 0344/1024] cleanup on exit and begin to create test types Signed-off-by: Nico Schottelius --- lib/cdist/test/test_path.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/cdist/test/test_path.py b/lib/cdist/test/test_path.py index 04a107b8..1fd955e3 100644 --- a/lib/cdist/test/test_path.py +++ b/lib/cdist/test/test_path.py @@ -21,6 +21,7 @@ # import os +import shutil import sys import tempfile import unittest @@ -32,28 +33,29 @@ class Path(unittest.TestCase): def setUp(self): self.temp_dir = tempfile.mkdtemp() self.init_manifest = os.path.join(self.temp_dir, "manifest") - self.path = cdist.config.Path("localhost", "root", - "ssh root@localhost", + self.path = cdist.path.Path("localhost", "root", "ssh root@localhost", initial_manifest=self.init_manifest, base_dir=self.temp_dir) + os.mkdir(self.path.conf_dir) + os.mkdir(self.path.type_base_dir) + + # Create install type + self.install_type = os.path.join(self.path.type_base_dir, "__install_test") + os.mkdir(self.install_type) + open(os.path.join(self.install_type, "install"), "w").close() + + # Create config type + config_type = os.path.join(self.path.type_base_dir, "__config_test") + os.mkdir(config_type) + def tearDown(self): self.path.cleanup() + shutil.rmtree(self.temp_dir) def test_type_detection(self): """Check that a type is identified as install or configuration correctly""" - # Create install type - install_type = os.path.join( - os.mkdir( - # Create non-install type - - self.config.run_global_explores() - explorers = self.config.path.list_global_explorers() - - for explorer in explorers: - output = self.config.path.global_explorer_output_path(explorer) - self.assertTrue(os.path.isfile(output)) def test_manifest_uses_install_types_only(self): """Check that objects created from manifest are only of install type""" From f88cb78d61bd803b183aab450075e0b1bdee8304 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 18:36:43 +0200 Subject: [PATCH 0345/1024] finish test_path.test_type_detection Signed-off-by: Nico Schottelius --- lib/cdist/test/test_path.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/cdist/test/test_path.py b/lib/cdist/test/test_path.py index 1fd955e3..c8ca95c0 100644 --- a/lib/cdist/test/test_path.py +++ b/lib/cdist/test/test_path.py @@ -40,14 +40,17 @@ class Path(unittest.TestCase): os.mkdir(self.path.conf_dir) os.mkdir(self.path.type_base_dir) + self.install_type_name = "__install_test" + self.config_type_name = "__config_test" + # Create install type - self.install_type = os.path.join(self.path.type_base_dir, "__install_test") + self.install_type = os.path.join(self.path.type_base_dir, self.install_type_name) os.mkdir(self.install_type) open(os.path.join(self.install_type, "install"), "w").close() # Create config type - config_type = os.path.join(self.path.type_base_dir, "__config_test") - os.mkdir(config_type) + self.config_type = os.path.join(self.path.type_base_dir, self.config_type_name) + os.mkdir(self.config_type) def tearDown(self): self.path.cleanup() @@ -55,7 +58,9 @@ class Path(unittest.TestCase): def test_type_detection(self): """Check that a type is identified as install or configuration correctly""" - + + self.assertTrue(self.path.is_install_type(self.install_type)) + self.assertFalse(self.path.is_install_type(self.config_type)) def test_manifest_uses_install_types_only(self): """Check that objects created from manifest are only of install type""" From b3f914f6f6fa2ef0ce390622d5b5cb4438000270 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 4 Oct 2011 18:45:29 +0200 Subject: [PATCH 0346/1024] create base module for install and config Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 268 +-------------------------------- lib/cdist/config_install.py | 292 ++++++++++++++++++++++++++++++++++++ 2 files changed, 295 insertions(+), 265 deletions(-) create mode 100644 lib/cdist/config_install.py diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 51615c28..fcc9ed7e 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -22,274 +22,12 @@ import datetime import logging -import os -import stat -import sys - log = logging.getLogger(__name__) -import cdist.emulator -import cdist.path +import cdist.config_install -CODE_HEADER = "#!/bin/sh -e\n" - -class Config: - """Cdist main class to hold arbitrary data""" - - def __init__(self, target_host, - initial_manifest=False, - remote_user="root", - home=None, - exec_path=sys.argv[0], - debug=False): - - self.target_host = target_host - self.debug = debug - self.remote_user = remote_user - self.exec_path = exec_path - - # FIXME: broken - construct elsewhere! - self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] - - self.path = cdist.path.Path(self.target_host, - initial_manifest=initial_manifest, - remote_user=self.remote_user, - remote_prefix=self.remote_prefix, - base_dir=home, - debug=debug) - - self.objects_prepared = [] - - def cleanup(self): - self.path.cleanup() - - def run_global_explores(self): - """Run global explorers""" - log.info("Running global explorers") - explorers = self.path.list_global_explorers() - if(len(explorers) == 0): - raise CdistError("No explorers found in", self.path.global_explorer_dir) - - self.path.transfer_global_explorers() - for explorer in explorers: - output = self.path.global_explorer_output_path(explorer) - output_fd = open(output, mode='w') - cmd = [] - cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append(self.path.remote_global_explorer_path(explorer)) - - cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=self.remote_prefix) - output_fd.close() - - def run_type_explorer(self, cdist_object): - """Run type specific explorers for objects""" - - type = self.path.get_type_from_object(cdist_object) - self.path.transfer_type_explorers(type) - - cmd = [] - cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append("__type_explorer=" + self.path.remote_type_explorer_dir(type)) - cmd.append("__object=" + self.path.remote_object_dir(cdist_object)) - cmd.append("__object_id=" + self.path.get_object_id_from_object(cdist_object)) - cmd.append("__object_fq=" + cdist_object) - - # Need to transfer at least the parameters for objects to be useful - self.path.transfer_object_parameter(cdist_object) - - explorers = self.path.list_type_explorers(type) - for explorer in explorers: - remote_cmd = cmd + [os.path.join(self.path.remote_type_explorer_dir(type), explorer)] - output = os.path.join(self.path.type_explorer_output_dir(cdist_object), explorer) - output_fd = open(output, mode='w') - log.debug("%s exploring %s using %s storing to %s", - cdist_object, explorer, remote_cmd, output) - - cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) - output_fd.close() - - def link_emulator(self): - """Link emulator to types""" - cdist.emulator.link(self.exec_path, - self.path.bin_dir, self.path.list_types()) - - def init_deploy(self): - """Ensure the base directories are cleaned up""" - log.debug("Creating clean directory structure") - - self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) - self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) - self.link_emulator() - - def run_initial_manifest(self): - """Run the initial manifest""" - log.info("Running initial manifest %s", self.path.initial_manifest) - env = { "__manifest" : self.path.manifest_dir } - self.run_manifest(self.path.initial_manifest, extra_env=env) - - def run_type_manifest(self, cdist_object): - """Run manifest for a specific object""" - type = self.path.get_type_from_object(cdist_object) - manifest = self.path.type_dir(type, "manifest") - - log.debug("%s: Running %s", cdist_object, manifest) - if os.path.exists(manifest): - env = { "__object" : self.path.object_dir(cdist_object), - "__object_id": self.path.get_object_id_from_object(cdist_object), - "__object_fq": cdist_object, - "__type": self.path.type_dir(type) - } - self.run_manifest(manifest, extra_env=env) - - def run_manifest(self, manifest, extra_env=None): - """Run a manifest""" - log.debug("Running manifest %s, env=%s", manifest, extra_env) - env = os.environ.copy() - env['PATH'] = self.path.bin_dir + ":" + env['PATH'] - - # Information required in every manifest - env['__target_host'] = self.target_host - env['__global'] = self.path.out_dir - - # Submit debug flag to manifest, can be used by emulator and types - if self.debug: - env['__debug'] = "yes" - - # Required for recording source - env['__cdist_manifest'] = manifest - - # Required to find types - env['__cdist_type_base_dir'] = self.path.type_base_dir - - # Other environment stuff - if extra_env: - env.update(extra_env) - - cdist.exec.shell_run_or_debug_fail(manifest, [manifest], env=env) - - def object_run(self, cdist_object, mode): - """Run gencode or code for an object""" - log.debug("Running %s from %s", mode, cdist_object) - file=os.path.join(self.path.object_dir(cdist_object), "require") - requirements = cdist.path.file_to_list(file) - type = self.path.get_type_from_object(cdist_object) - - for requirement in requirements: - log.debug("Object %s requires %s", cdist_object, requirement) - self.object_run(requirement, mode=mode) - - # - # Setup env Variable: - # - env = os.environ.copy() - env['__target_host'] = self.target_host - env['__global'] = self.path.out_dir - env["__object"] = self.path.object_dir(cdist_object) - env["__object_id"] = self.path.get_object_id_from_object(cdist_object) - env["__object_fq"] = cdist_object - env["__type"] = self.path.type_dir(type) - - if mode == "gencode": - paths = [ - self.path.type_dir(type, "gencode-local"), - self.path.type_dir(type, "gencode-remote") - ] - for bin in paths: - if os.path.isfile(bin): - # omit "gen" from gencode and use it for output base - outfile=os.path.join(self.path.object_dir(cdist_object), - os.path.basename(bin)[3:]) - - outfile_fd = open(outfile, "w") - - # Need to flush to ensure our write is done before stdout write - outfile_fd.write(CODE_HEADER) - outfile_fd.flush() - - cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) - outfile_fd.close() - - status = os.stat(outfile) - - # Remove output if empty, else make it executable - if status.st_size == len(CODE_HEADER): - os.unlink(outfile) - else: - # Add header and make executable - identically to 0o700 - os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) - - # Mark object as changed - open(os.path.join(self.path.object_dir(cdist_object), "changed"), "w").close() - - - if mode == "code": - local_dir = self.path.object_dir(cdist_object) - remote_dir = self.path.remote_object_dir(cdist_object) - - bin = os.path.join(local_dir, "code-local") - if os.path.isfile(bin): - cdist.exec.run_or_fail([bin]) - - - local_remote_code = os.path.join(local_dir, "code-remote") - remote_remote_code = os.path.join(remote_dir, "code-remote") - if os.path.isfile(local_remote_code): - self.path.transfer_file(local_remote_code, remote_remote_code) - # FIXME: remote_prefix - cdist.exec.run_or_fail([remote_remote_code], remote_prefix=self.remote_prefix) - - def stage_prepare(self): - """Do everything for a deploy, minus the actual code stage""" - self.init_deploy() - self.run_global_explores() - self.run_initial_manifest() - - log.info("Running object manifests and type explorers") - - old_objects = [] - objects = self.path.list_objects() - - # Continue process until no new objects are created anymore - while old_objects != objects: - old_objects = list(objects) - for cdist_object in objects: - if cdist_object in self.objects_prepared: - log.debug("Skipping rerun of object %s", cdist_object) - continue - else: - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - self.objects_prepared.append(cdist_object) - - objects = self.path.list_objects() - - def stage_run(self): - """The final (and real) step of deployment""" - log.info("Generating and executing code") - # Now do the final steps over the existing objects - for cdist_object in self.path.list_objects(): - log.debug("Run object: %s", cdist_object) - self.object_run(cdist_object, mode="gencode") - self.object_run(cdist_object, mode="code") - - def deploy_to(self): - """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.target_host) - time_start = datetime.datetime.now() - - self.stage_prepare() - self.stage_run() - - time_end = datetime.datetime.now() - duration = time_end - time_start - log.info("Finished run of %s in %s seconds", - self.target_host, - duration.total_seconds()) - - def deploy_and_cleanup(self): - """Do what is most often done: deploy & cleanup""" - self.deploy_to() - self.cleanup() +class Config(cdist.config_install.ConfigInstall): + pass def config(args): """Configure remote system""" diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py new file mode 100644 index 00000000..f7bd43e8 --- /dev/null +++ b/lib/cdist/config_install.py @@ -0,0 +1,292 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import datetime +import logging +import os +import stat +import sys + +log = logging.getLogger(__name__) + +import cdist.emulator +import cdist.path + +CODE_HEADER = "#!/bin/sh -e\n" + +class ConfigInstall: + """Class to hold install and config methods""" + + def __init__(self, target_host, + initial_manifest=False, + remote_user="root", + home=None, + exec_path=sys.argv[0], + debug=False): + + self.target_host = target_host + self.debug = debug + self.remote_user = remote_user + self.exec_path = exec_path + + # FIXME: broken - construct elsewhere! + self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] + + self.path = cdist.path.Path(self.target_host, + initial_manifest=initial_manifest, + remote_user=self.remote_user, + remote_prefix=self.remote_prefix, + base_dir=home, + debug=debug) + + self.objects_prepared = [] + + def cleanup(self): + self.path.cleanup() + + def run_global_explores(self): + """Run global explorers""" + log.info("Running global explorers") + explorers = self.path.list_global_explorers() + if(len(explorers) == 0): + raise CdistError("No explorers found in", self.path.global_explorer_dir) + + self.path.transfer_global_explorers() + for explorer in explorers: + output = self.path.global_explorer_output_path(explorer) + output_fd = open(output, mode='w') + cmd = [] + cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append(self.path.remote_global_explorer_path(explorer)) + + cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=self.remote_prefix) + output_fd.close() + + def run_type_explorer(self, cdist_object): + """Run type specific explorers for objects""" + + type = self.path.get_type_from_object(cdist_object) + self.path.transfer_type_explorers(type) + + cmd = [] + cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append("__type_explorer=" + self.path.remote_type_explorer_dir(type)) + cmd.append("__object=" + self.path.remote_object_dir(cdist_object)) + cmd.append("__object_id=" + self.path.get_object_id_from_object(cdist_object)) + cmd.append("__object_fq=" + cdist_object) + + # Need to transfer at least the parameters for objects to be useful + self.path.transfer_object_parameter(cdist_object) + + explorers = self.path.list_type_explorers(type) + for explorer in explorers: + remote_cmd = cmd + [os.path.join(self.path.remote_type_explorer_dir(type), explorer)] + output = os.path.join(self.path.type_explorer_output_dir(cdist_object), explorer) + output_fd = open(output, mode='w') + log.debug("%s exploring %s using %s storing to %s", + cdist_object, explorer, remote_cmd, output) + + cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) + output_fd.close() + + def link_emulator(self): + """Link emulator to types""" + cdist.emulator.link(self.exec_path, + self.path.bin_dir, self.path.list_types()) + + def init_deploy(self): + """Ensure the base directories are cleaned up""" + log.debug("Creating clean directory structure") + + self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) + self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) + self.link_emulator() + + def run_initial_manifest(self): + """Run the initial manifest""" + log.info("Running initial manifest %s", self.path.initial_manifest) + env = { "__manifest" : self.path.manifest_dir } + self.run_manifest(self.path.initial_manifest, extra_env=env) + + def run_type_manifest(self, cdist_object): + """Run manifest for a specific object""" + type = self.path.get_type_from_object(cdist_object) + manifest = self.path.type_dir(type, "manifest") + + log.debug("%s: Running %s", cdist_object, manifest) + if os.path.exists(manifest): + env = { "__object" : self.path.object_dir(cdist_object), + "__object_id": self.path.get_object_id_from_object(cdist_object), + "__object_fq": cdist_object, + "__type": self.path.type_dir(type) + } + self.run_manifest(manifest, extra_env=env) + + def run_manifest(self, manifest, extra_env=None): + """Run a manifest""" + log.debug("Running manifest %s, env=%s", manifest, extra_env) + env = os.environ.copy() + env['PATH'] = self.path.bin_dir + ":" + env['PATH'] + + # Information required in every manifest + env['__target_host'] = self.target_host + env['__global'] = self.path.out_dir + + # Submit debug flag to manifest, can be used by emulator and types + if self.debug: + env['__debug'] = "yes" + + # Required for recording source + env['__cdist_manifest'] = manifest + + # Required to find types + env['__cdist_type_base_dir'] = self.path.type_base_dir + + # Other environment stuff + if extra_env: + env.update(extra_env) + + cdist.exec.shell_run_or_debug_fail(manifest, [manifest], env=env) + + def object_run(self, cdist_object, mode): + """Run gencode or code for an object""" + log.debug("Running %s from %s", mode, cdist_object) + file=os.path.join(self.path.object_dir(cdist_object), "require") + requirements = cdist.path.file_to_list(file) + type = self.path.get_type_from_object(cdist_object) + + for requirement in requirements: + log.debug("Object %s requires %s", cdist_object, requirement) + self.object_run(requirement, mode=mode) + + # + # Setup env Variable: + # + env = os.environ.copy() + env['__target_host'] = self.target_host + env['__global'] = self.path.out_dir + env["__object"] = self.path.object_dir(cdist_object) + env["__object_id"] = self.path.get_object_id_from_object(cdist_object) + env["__object_fq"] = cdist_object + env["__type"] = self.path.type_dir(type) + + if mode == "gencode": + paths = [ + self.path.type_dir(type, "gencode-local"), + self.path.type_dir(type, "gencode-remote") + ] + for bin in paths: + if os.path.isfile(bin): + # omit "gen" from gencode and use it for output base + outfile=os.path.join(self.path.object_dir(cdist_object), + os.path.basename(bin)[3:]) + + outfile_fd = open(outfile, "w") + + # Need to flush to ensure our write is done before stdout write + outfile_fd.write(CODE_HEADER) + outfile_fd.flush() + + cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) + outfile_fd.close() + + status = os.stat(outfile) + + # Remove output if empty, else make it executable + if status.st_size == len(CODE_HEADER): + os.unlink(outfile) + else: + # Add header and make executable - identically to 0o700 + os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + + # Mark object as changed + open(os.path.join(self.path.object_dir(cdist_object), "changed"), "w").close() + + + if mode == "code": + local_dir = self.path.object_dir(cdist_object) + remote_dir = self.path.remote_object_dir(cdist_object) + + bin = os.path.join(local_dir, "code-local") + if os.path.isfile(bin): + cdist.exec.run_or_fail([bin]) + + + local_remote_code = os.path.join(local_dir, "code-remote") + remote_remote_code = os.path.join(remote_dir, "code-remote") + if os.path.isfile(local_remote_code): + self.path.transfer_file(local_remote_code, remote_remote_code) + # FIXME: remote_prefix + cdist.exec.run_or_fail([remote_remote_code], remote_prefix=self.remote_prefix) + + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" + self.init_deploy() + self.run_global_explores() + self.run_initial_manifest() + + log.info("Running object manifests and type explorers") + + old_objects = [] + objects = self.path.list_objects() + + # Continue process until no new objects are created anymore + while old_objects != objects: + old_objects = list(objects) + for cdist_object in objects: + if cdist_object in self.objects_prepared: + log.debug("Skipping rerun of object %s", cdist_object) + continue + else: + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + self.objects_prepared.append(cdist_object) + + objects = self.path.list_objects() + + def stage_run(self): + """The final (and real) step of deployment""" + log.info("Generating and executing code") + # Now do the final steps over the existing objects + for cdist_object in self.path.list_objects(): + log.debug("Run object: %s", cdist_object) + self.object_run(cdist_object, mode="gencode") + self.object_run(cdist_object, mode="code") + + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + log.info("Deploying to " + self.target_host) + time_start = datetime.datetime.now() + + self.stage_prepare() + self.stage_run() + + time_end = datetime.datetime.now() + duration = time_end - time_start + log.info("Finished run of %s in %s seconds", + self.target_host, + duration.total_seconds()) + + def deploy_and_cleanup(self): + """Do what is most often done: deploy & cleanup""" + self.deploy_to() + self.cleanup() From acc64caf95524156686f3aabbe7fea1b9c4fab60 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 22:23:26 +0200 Subject: [PATCH 0347/1024] new type: __mkfs Signed-off-by: Steven Armstrong --- conf/type/__mkfs/gencode-remote | 36 ++++++++++++++++++ conf/type/__mkfs/installer | 0 conf/type/__mkfs/man.text | 57 +++++++++++++++++++++++++++++ conf/type/__mkfs/manifest | 31 ++++++++++++++++ conf/type/__mkfs/parameter/optional | 3 ++ conf/type/__mkfs/parameter/required | 1 + 6 files changed, 128 insertions(+) create mode 100755 conf/type/__mkfs/gencode-remote create mode 100644 conf/type/__mkfs/installer create mode 100644 conf/type/__mkfs/man.text create mode 100755 conf/type/__mkfs/manifest create mode 100644 conf/type/__mkfs/parameter/optional create mode 100644 conf/type/__mkfs/parameter/required diff --git a/conf/type/__mkfs/gencode-remote b/conf/type/__mkfs/gencode-remote new file mode 100755 index 00000000..e5061013 --- /dev/null +++ b/conf/type/__mkfs/gencode-remote @@ -0,0 +1,36 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +device="(cat "$__object/parameter/device")" +type="(cat "$__object/parameter/type")" + +command="mkfs -t $type" + +if [ -f "$__object/parameter/options" ]; then + options="(cat "$__object/parameter/options")" + command="$command -o '$options'" +fi +command="$command $device" +if [ -f "$__object/parameter/blocks" ]; then + blocks="(cat "$__object/parameter/blocks")" + command="$command $blocks" +fi + +echo "$command" diff --git a/conf/type/__mkfs/installer b/conf/type/__mkfs/installer new file mode 100644 index 00000000..e69de29b diff --git a/conf/type/__mkfs/man.text b/conf/type/__mkfs/man.text new file mode 100644 index 00000000..4320c639 --- /dev/null +++ b/conf/type/__mkfs/man.text @@ -0,0 +1,57 @@ +cdist-type__mkfs(7) +=================== +Steven Armstrong + + +NAME +---- +cdist-type__mkfs - build a linux file system + + +DESCRIPTION +----------- +This cdist type is a wrapper for the mkfs command. + + +REQUIRED PARAMETERS +------------------- +type:: + The filesystem type to use. Same as mkfs -t. + + +OPTIONAL PARAMETERS +------------------- +device:: + defaults to object_id + +options:: + file system-specific options to be passed to the mkfs command + +blocks:: + the number of blocks to be used for the file system + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# reiserfs /dev/sda5 +__mkfs /dev/sda5 --type reiserfs +# same thing with explicit device +__mkfs whatever --device /dev/sda5 --type reiserfs + +# jfs with journal on /dev/sda2 +__mkfs /dev/sda1 --type jfs --options "-j /dev/sda2" +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- mkfs(8) + + +COPYING +------- +Copyright \(C) 2011 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__mkfs/manifest b/conf/type/__mkfs/manifest new file mode 100755 index 00000000..e9d275a4 --- /dev/null +++ b/conf/type/__mkfs/manifest @@ -0,0 +1,31 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +# set defaults +if [ -f "$__object/parameter/device" ]; then + device="(cat "$__object/parameter/device")" +else + device="/$__object_id" + echo "$device" > "$__object/parameter/device" +fi + +type="(cat "$__object/parameter/type")" + +options="(cat "$__object/parameter/options")" diff --git a/conf/type/__mkfs/parameter/optional b/conf/type/__mkfs/parameter/optional new file mode 100644 index 00000000..86aeae30 --- /dev/null +++ b/conf/type/__mkfs/parameter/optional @@ -0,0 +1,3 @@ +device +options +blocks diff --git a/conf/type/__mkfs/parameter/required b/conf/type/__mkfs/parameter/required new file mode 100644 index 00000000..aa80e646 --- /dev/null +++ b/conf/type/__mkfs/parameter/required @@ -0,0 +1 @@ +type From 27a774432e900896fc2a9a5e73adec794e13c296 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 22:42:19 +0200 Subject: [PATCH 0348/1024] mark __partition_msdos and __partition_msdos_apply as installer types Signed-off-by: Steven Armstrong --- conf/type/__partition_msdos/installer | 0 conf/type/__partition_msdos_apply/installer | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 conf/type/__partition_msdos/installer create mode 100644 conf/type/__partition_msdos_apply/installer diff --git a/conf/type/__partition_msdos/installer b/conf/type/__partition_msdos/installer new file mode 100644 index 00000000..e69de29b diff --git a/conf/type/__partition_msdos_apply/installer b/conf/type/__partition_msdos_apply/installer new file mode 100644 index 00000000..e69de29b From 9fd74acfac2194874224ea046953094cd56dfffa Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 22:50:49 +0200 Subject: [PATCH 0349/1024] add support for swap Signed-off-by: Steven Armstrong --- conf/type/__mkfs/gencode-remote | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/conf/type/__mkfs/gencode-remote b/conf/type/__mkfs/gencode-remote index e5061013..0a220ec9 100755 --- a/conf/type/__mkfs/gencode-remote +++ b/conf/type/__mkfs/gencode-remote @@ -21,16 +21,18 @@ device="(cat "$__object/parameter/device")" type="(cat "$__object/parameter/type")" -command="mkfs -t $type" - -if [ -f "$__object/parameter/options" ]; then - options="(cat "$__object/parameter/options")" - command="$command -o '$options'" +if [ "$type" = "swap" ]; then + echo "mkswap $device" +else + command="mkfs -t $type" + if [ -f "$__object/parameter/options" ]; then + options="(cat "$__object/parameter/options")" + command="$command -o '$options'" + fi + command="$command $device" + if [ -f "$__object/parameter/blocks" ]; then + blocks="(cat "$__object/parameter/blocks")" + command="$command $blocks" + fi + echo "$command" fi -command="$command $device" -if [ -f "$__object/parameter/blocks" ]; then - blocks="(cat "$__object/parameter/blocks")" - command="$command $blocks" -fi - -echo "$command" From 20241a0c5c4d005f66ac2591e8bddcebb9ba8ab6 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 22:56:24 +0200 Subject: [PATCH 0350/1024] fix copy/paste error Signed-off-by: Steven Armstrong --- conf/type/__mkfs/gencode-remote | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/type/__mkfs/gencode-remote b/conf/type/__mkfs/gencode-remote index 0a220ec9..67e37cce 100755 --- a/conf/type/__mkfs/gencode-remote +++ b/conf/type/__mkfs/gencode-remote @@ -18,20 +18,20 @@ # along with cdist. If not, see . # -device="(cat "$__object/parameter/device")" -type="(cat "$__object/parameter/type")" +device="$(cat "$__object/parameter/device")" +type="$(cat "$__object/parameter/type")" if [ "$type" = "swap" ]; then echo "mkswap $device" else command="mkfs -t $type" if [ -f "$__object/parameter/options" ]; then - options="(cat "$__object/parameter/options")" + options="$(cat "$__object/parameter/options")" command="$command -o '$options'" fi command="$command $device" if [ -f "$__object/parameter/blocks" ]; then - blocks="(cat "$__object/parameter/blocks")" + blocks="$(cat "$__object/parameter/blocks")" command="$command $blocks" fi echo "$command" From 3d017abd6f207a819b9fc90fc043bbe1be91accc Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 22:56:50 +0200 Subject: [PATCH 0351/1024] pass options to mkfs without -o Signed-off-by: Steven Armstrong --- conf/type/__mkfs/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__mkfs/gencode-remote b/conf/type/__mkfs/gencode-remote index 67e37cce..e774f33d 100755 --- a/conf/type/__mkfs/gencode-remote +++ b/conf/type/__mkfs/gencode-remote @@ -27,7 +27,7 @@ else command="mkfs -t $type" if [ -f "$__object/parameter/options" ]; then options="$(cat "$__object/parameter/options")" - command="$command -o '$options'" + command="$command $options" fi command="$command $device" if [ -f "$__object/parameter/blocks" ]; then From de4ddf9d1e4cdce8376e1bc87381c70de8cf6eba Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 23:03:50 +0200 Subject: [PATCH 0352/1024] mv installer install Signed-off-by: Steven Armstrong --- conf/type/__mkfs/gencode-remote | 2 +- conf/type/__mkfs/{installer => install} | 0 conf/type/__partition_msdos/{installer => install} | 0 conf/type/__partition_msdos_apply/{installer => install} | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename conf/type/__mkfs/{installer => install} (100%) rename conf/type/__partition_msdos/{installer => install} (100%) rename conf/type/__partition_msdos_apply/{installer => install} (100%) diff --git a/conf/type/__mkfs/gencode-remote b/conf/type/__mkfs/gencode-remote index e774f33d..b3561bad 100755 --- a/conf/type/__mkfs/gencode-remote +++ b/conf/type/__mkfs/gencode-remote @@ -24,7 +24,7 @@ type="$(cat "$__object/parameter/type")" if [ "$type" = "swap" ]; then echo "mkswap $device" else - command="mkfs -t $type" + command="mkfs -t $type -q" if [ -f "$__object/parameter/options" ]; then options="$(cat "$__object/parameter/options")" command="$command $options" diff --git a/conf/type/__mkfs/installer b/conf/type/__mkfs/install similarity index 100% rename from conf/type/__mkfs/installer rename to conf/type/__mkfs/install diff --git a/conf/type/__partition_msdos/installer b/conf/type/__partition_msdos/install similarity index 100% rename from conf/type/__partition_msdos/installer rename to conf/type/__partition_msdos/install diff --git a/conf/type/__partition_msdos_apply/installer b/conf/type/__partition_msdos_apply/install similarity index 100% rename from conf/type/__partition_msdos_apply/installer rename to conf/type/__partition_msdos_apply/install From f0223647e34c642aa24abb5b08db0cee4ae05154 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 23:12:49 +0200 Subject: [PATCH 0353/1024] --debug Signed-off-by: Steven Armstrong --- conf/type/__partition_msdos_apply/files/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__partition_msdos_apply/files/lib.sh b/conf/type/__partition_msdos_apply/files/lib.sh index f0859aab..021c11d4 100644 --- a/conf/type/__partition_msdos_apply/files/lib.sh +++ b/conf/type/__partition_msdos_apply/files/lib.sh @@ -3,7 +3,7 @@ die() { exit 1 } debug() { - echo "[__partition_msdos_apply] $@" >&2 + #echo "[__partition_msdos_apply] $@" >&2 } fdisk_command() { From 9d6a00af3885f8e8f23f450c0b589c2660c1ef12 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 23:13:53 +0200 Subject: [PATCH 0354/1024] --debug without creating syntax errors Signed-off-by: Steven Armstrong --- conf/type/__partition_msdos_apply/files/lib.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/type/__partition_msdos_apply/files/lib.sh b/conf/type/__partition_msdos_apply/files/lib.sh index 021c11d4..d7f07060 100644 --- a/conf/type/__partition_msdos_apply/files/lib.sh +++ b/conf/type/__partition_msdos_apply/files/lib.sh @@ -4,6 +4,7 @@ die() { } debug() { #echo "[__partition_msdos_apply] $@" >&2 + : } fdisk_command() { From 648f57173c7fa1f405e62bd7f441c88f2e83b758 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 23:53:06 +0200 Subject: [PATCH 0355/1024] bugfix: use -gt when comparing int values Signed-off-by: Steven Armstrong --- conf/type/__partition_msdos_apply/files/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__partition_msdos_apply/files/lib.sh b/conf/type/__partition_msdos_apply/files/lib.sh index d7f07060..5767ea43 100644 --- a/conf/type/__partition_msdos_apply/files/lib.sh +++ b/conf/type/__partition_msdos_apply/files/lib.sh @@ -52,7 +52,7 @@ create_partition() { first_minor="${minor}\n" type_minor="${minor}\n" primary_extended="l\n" - [ "$primary_count" > "3" ] && primary_extended="" + [ "$primary_count" -gt "3" ] && primary_extended="" fi [ -n "${size}" ] && size="+${size}M" fdisk_command ${device} "n\n${primary_extended}${first_minor}\n${size}\nt\n${type_minor}${type}\n" From 9dfd6a27ad2b0e771e03d633a20248b2c7a0e102 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 5 Oct 2011 09:15:20 +0200 Subject: [PATCH 0356/1024] fixed broken man page --- conf/type/__init_script/man.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__init_script/man.text b/conf/type/__init_script/man.text index 898943a5..c33ff7b7 100644 --- a/conf/type/__init_script/man.text +++ b/conf/type/__init_script/man.text @@ -1,5 +1,5 @@ cdist-type__init_script(7) -============================== +========================== Daniel Roth From 8a044919eb9e74dde6651ccd60ce390004ab8e97 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Oct 2011 13:24:07 +0200 Subject: [PATCH 0357/1024] +discussion about restructering/ "object-orientation" Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-05 | 112 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 doc/dev/logs/2011-10-05 diff --git a/doc/dev/logs/2011-10-05 b/doc/dev/logs/2011-10-05 new file mode 100644 index 00000000..92e8675f --- /dev/null +++ b/doc/dev/logs/2011-10-05 @@ -0,0 +1,112 @@ +Config/Install/Deploy/Run: + target host + remote_cmd_prefix - ssh user@bla sudo foo????? + remote_cp_prefix - cp statt scp oder so + + debug -> env für alles += __debug + + +Storage/Metaobject/Tree? == Path? + base_dir? + nimmt objekte + + Sammelt Objekte + + Ist prepared hier? + +Object + "Infos" / Datenhalde + + Base_Dir-Abhängigkeit? - wo + + out_dir - wo speichern + + nur eigenes verzeichnis interessant? + -> nicht für shell code / aka gencode! + -> __global abhängigkeit + + object.gencode()? + + hast du type-explorer? + ja? + führe JEDEN remote aus + speichere ausgabe in object + nein: + fertig + hast du gencode-{local,remote}? + ja? + führe local oder remote aus + speichere ausgabe in s/^gen// + nein: + fertig + + hast du code-{local,remote}? + ja? + führe local oder remote aus + nein: + fertig + + ich habe ... + object_id + type + type.singleton() == False -> require object_id + parameter gegeben + requirements / order + + type_explorer := methode zum ausführen? + + cdist.object.Object(type, id) + + methoden: + gen_code + code + run_manifest + manifest == ort + +Type + singleton: ja / nein + install: ja / nein + type_explorer := liste + + optional_parameter + required_parameter + + TypeExplorer + verwandt oder == explorer + Verwandschaft klären! + + sehr abhängig von base_dir! + - welche gibt es? + - was für optionen haben sie + + cdist.type.Type("/path/to/type") + Tree/Path vieh, das liste von $_ speichert + Einfach iterieren + + + +Explorer + execute(env) + env == __explorer -> nur im explorer + +z.B. BaseExplorer oder andersherum GlobalExplorer + +Manifest + +Exec + wrapper um auszuführen, + error handling, + output redirection (variable, file, beides, socat :-) + + +-------------------------------------------------------------------------------- + +- base_dir (conf/, type, ...) +- manifest (initiale) + $methode_mit_inhalt_von_manifest? + run_manifest(code) + ob sinnvoll? + geht auch mit stdin oder datei + + stdin -> muss in tmp-datei, für sh -e? +- From f00b8fe56a8cb45116b9595c212c9a54796b2007 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Oct 2011 13:31:57 +0200 Subject: [PATCH 0358/1024] buffering/output idea Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-05 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/dev/logs/2011-10-05 b/doc/dev/logs/2011-10-05 index 92e8675f..39fc48a2 100644 --- a/doc/dev/logs/2011-10-05 +++ b/doc/dev/logs/2011-10-05 @@ -110,3 +110,7 @@ Exec stdin -> muss in tmp-datei, für sh -e? - +-------------------------------------------------------------------------------- + +save output of shell in buffer instead of displaying? + -> freedom to decide whether to display or not! From a875d69d7e9dc6dabdcd33c0ee4d33dd13640376 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Oct 2011 14:15:05 +0200 Subject: [PATCH 0359/1024] continue on test_path testcase Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 5 +++-- lib/cdist/install.py | 6 ++++++ lib/cdist/test/test_path.py | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index f7bd43e8..cd8ea720 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -26,11 +26,11 @@ import os import stat import sys -log = logging.getLogger(__name__) - import cdist.emulator import cdist.path +log = logging.getLogger(__name__) + CODE_HEADER = "#!/bin/sh -e\n" class ConfigInstall: @@ -203,6 +203,7 @@ class ConfigInstall: outfile_fd = open(outfile, "w") # Need to flush to ensure our write is done before stdout write + # FIXME: CODE_HEADER needed in our sh -e scenario???? outfile_fd.write(CODE_HEADER) outfile_fd.flush() diff --git a/lib/cdist/install.py b/lib/cdist/install.py index 98b388ec..5a35626d 100644 --- a/lib/cdist/install.py +++ b/lib/cdist/install.py @@ -22,8 +22,14 @@ import logging +import cdist.config_install + log = logging.getLogger(__name__) + +Class Install(cdist.config_install.ConfigInstall): + pass + def install(args): """Install remote system""" process = {} diff --git a/lib/cdist/test/test_path.py b/lib/cdist/test/test_path.py index c8ca95c0..f86c8fad 100644 --- a/lib/cdist/test/test_path.py +++ b/lib/cdist/test/test_path.py @@ -66,12 +66,12 @@ class Path(unittest.TestCase): """Check that objects created from manifest are only of install type""" manifest_fd = open(self.init_manifest, "w") manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + " --mode 0700\n", - "__partition_msdos /dev/null --type 82\n", + self.install_type_name + "testid\n", + self.config_type_name + "testid\n", ]) manifest_fd.close() - self.config.run_initial_manifest() + self.install.run_initial_manifest() # FIXME: check that only __partition_msdos objects are created! From 9128cc28c414e1fa1abe4a482f6777f753123910 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Oct 2011 15:50:17 +0200 Subject: [PATCH 0360/1024] introduce a lot todo in path Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 2dd9dcf1..5cde357b 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -107,6 +107,7 @@ class Path: else: self.initial_manifest = os.path.join(self.manifest_dir, "init") + # FIXME: stays def cleanup(self): # Do not use in __del__: # http://docs.python.org/reference/datamodel.html#customization @@ -120,13 +121,16 @@ class Path: shutil.move(self.temp_dir, self.cache_dir) + # FIXME: belongs to here - clearify remote* def remote_mkdir(self, directory): """Create directory on remote side""" cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=self.remote_prefix) + # FIXME: belongs to here - clearify remote* def remove_remote_dir(self, destination): cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=self.remote_prefix) + # FIXME: belongs to here - clearify remote* def transfer_dir(self, source, destination): """Transfer directory and previously delete the remote destination""" self.remove_remote_dir(destination) @@ -135,6 +139,7 @@ class Path: self.target_host + ":" + destination]) + # FIXME: belongs to here - clearify remote* def transfer_file(self, source, destination): """Transfer file""" cdist.exec.run_or_fail(["scp", "-q", source, @@ -142,10 +147,12 @@ class Path: self.target_host + ":" + destination]) + # FIXME: Explorer or stays def global_explorer_output_path(self, explorer): """Returns path of the output for a global explorer""" return os.path.join(self.global_explorer_out_dir, explorer) + # FIXME: object def type_explorer_output_dir(self, cdist_object): """Returns and creates dir of the output for a type explorer""" dir = os.path.join(self.object_dir(cdist_object), "explorer") @@ -154,14 +161,17 @@ class Path: return dir + # FIXME Stays here / Explorer? def remote_global_explorer_path(self, explorer): """Returns path to the remote explorer""" return os.path.join(REMOTE_GLOBAL_EXPLORER_DIR, explorer) + # FIXME: stays here def list_global_explorers(self): """Return list of available explorers""" return os.listdir(self.global_explorer_dir) + # FIXME: Type - only needs to know its path def list_type_explorers(self, type): """Return list of available explorers for a specific type""" dir = self.type_dir(type, "explorer") @@ -174,15 +184,18 @@ class Path: return list + # Stays here def list_types(self): """Retuns list of types""" return os.listdir(self.type_base_dir) + # FIXME: type def is_install_type(self, type): """Check whether a type is used for installation (if not: for configuration)""" marker = os.path.join(self.type_dir(type), "install") return os.path.isfile(marker) + # Stays here def list_object_paths(self, starting_point): """Return list of paths of existing objects""" object_paths = [] @@ -198,36 +211,43 @@ class Path: return object_paths - # FIXME + # FIXME: Object def get_type_from_object(self, cdist_object): """Returns the first part (i.e. type) of an object""" return cdist_object.split(os.sep)[0] + # FIXME: Object def get_object_id_from_object(self, cdist_object): """Returns everything but the first part (i.e. object_id) of an object""" return os.sep.join(cdist_object.split(os.sep)[1:]) + # FIXME: Object def object_dir(self, cdist_object): """Returns the full path to the object (including .cdist)""" return os.path.join(self.object_base_dir, cdist_object, DOT_CDIST) + # FIXME: Object def remote_object_dir(self, cdist_object): """Returns the remote full path to the object (including .cdist)""" return os.path.join(REMOTE_OBJECT_DIR, cdist_object, DOT_CDIST) + # FIXME: Object def object_parameter_dir(self, cdist_object): """Returns the dir to the object parameter""" return os.path.join(self.object_dir(cdist_object), "parameter") + # FIXME: object def remote_object_parameter_dir(self, cdist_object): """Returns the remote dir to the object parameter""" return os.path.join(self.remote_object_dir(cdist_object), "parameter") + # FIXME: object def object_code_paths(self, cdist_object): """Return paths to code scripts of object""" return [os.path.join(self.object_dir(cdist_object), "code-local"), os.path.join(self.object_dir(cdist_object), "code-remote")] + # Stays here def list_objects(self): """Return list of existing objects""" @@ -240,14 +260,17 @@ class Path: return objects + # FIXME: Type def type_dir(self, type, *args): - """Return directory the type""" + """Return (sub-)directory of a type""" return os.path.join(self.type_base_dir, type, *args) + # FIXME: Type def remote_type_explorer_dir(self, type): """Return remote directory that holds the explorers of a type""" return os.path.join(REMOTE_TYPE_DIR, type, "explorer") + # Stays here def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" # Create base path before using mkdir -p @@ -257,11 +280,13 @@ class Path: self.transfer_dir(self.object_parameter_dir(cdist_object), self.remote_object_parameter_dir(cdist_object)) + # Stays here def transfer_global_explorers(self): """Transfer the global explorers""" self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) self.transfer_dir(self.global_explorer_dir, REMOTE_GLOBAL_EXPLORER_DIR) + # Stays here def transfer_type_explorers(self, type): """Transfer explorers of a type, but only once""" if type in self.type_explorers_transferred: From 28428177ae8734c3b4eb84d361f2c6447c58debc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Oct 2011 15:53:34 +0200 Subject: [PATCH 0361/1024] --typo Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 426 ++++++++++++++++++------------------ 1 file changed, 213 insertions(+), 213 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index cd8ea720..a550c45e 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -31,263 +31,263 @@ import cdist.path log = logging.getLogger(__name__) -CODE_HEADER = "#!/bin/sh -e\n" +CODE_HEADER = "#!/bin/sh -e\n" class ConfigInstall: - """Class to hold install and config methods""" + """Class to hold install and config methods""" - def __init__(self, target_host, - initial_manifest=False, - remote_user="root", - home=None, - exec_path=sys.argv[0], - debug=False): + def __init__(self, target_host, + initial_manifest=False, + remote_user="root", + home=None, + exec_path=sys.argv[0], + debug=False): - self.target_host = target_host - self.debug = debug - self.remote_user = remote_user - self.exec_path = exec_path + self.target_host = target_host + self.debug = debug + self.remote_user = remote_user + self.exec_path = exec_path - # FIXME: broken - construct elsewhere! - self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] + # FIXME: broken - construct elsewhere! + self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] - self.path = cdist.path.Path(self.target_host, - initial_manifest=initial_manifest, - remote_user=self.remote_user, - remote_prefix=self.remote_prefix, - base_dir=home, - debug=debug) - - self.objects_prepared = [] + self.path = cdist.path.Path(self.target_host, + initial_manifest=initial_manifest, + remote_user=self.remote_user, + remote_prefix=self.remote_prefix, + base_dir=home, + debug=debug) + + self.objects_prepared = [] - def cleanup(self): - self.path.cleanup() + def cleanup(self): + self.path.cleanup() - def run_global_explores(self): - """Run global explorers""" - log.info("Running global explorers") - explorers = self.path.list_global_explorers() - if(len(explorers) == 0): - raise CdistError("No explorers found in", self.path.global_explorer_dir) + def run_global_explorers(self): + """Run global explorers""" + log.info("Running global explorers") + explorers = self.path.list_global_explorers() + if(len(explorers) == 0): + raise CdistError("No explorers found in", self.path.global_explorer_dir) - self.path.transfer_global_explorers() - for explorer in explorers: - output = self.path.global_explorer_output_path(explorer) - output_fd = open(output, mode='w') - cmd = [] - cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append(self.path.remote_global_explorer_path(explorer)) + self.path.transfer_global_explorers() + for explorer in explorers: + output = self.path.global_explorer_output_path(explorer) + output_fd = open(output, mode='w') + cmd = [] + cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append(self.path.remote_global_explorer_path(explorer)) - cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=self.remote_prefix) - output_fd.close() + cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=self.remote_prefix) + output_fd.close() - def run_type_explorer(self, cdist_object): - """Run type specific explorers for objects""" + def run_type_explorer(self, cdist_object): + """Run type specific explorers for objects""" - type = self.path.get_type_from_object(cdist_object) - self.path.transfer_type_explorers(type) + type = self.path.get_type_from_object(cdist_object) + self.path.transfer_type_explorers(type) - cmd = [] - cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append("__type_explorer=" + self.path.remote_type_explorer_dir(type)) - cmd.append("__object=" + self.path.remote_object_dir(cdist_object)) - cmd.append("__object_id=" + self.path.get_object_id_from_object(cdist_object)) - cmd.append("__object_fq=" + cdist_object) + cmd = [] + cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append("__type_explorer=" + self.path.remote_type_explorer_dir(type)) + cmd.append("__object=" + self.path.remote_object_dir(cdist_object)) + cmd.append("__object_id=" + self.path.get_object_id_from_object(cdist_object)) + cmd.append("__object_fq=" + cdist_object) - # Need to transfer at least the parameters for objects to be useful - self.path.transfer_object_parameter(cdist_object) + # Need to transfer at least the parameters for objects to be useful + self.path.transfer_object_parameter(cdist_object) - explorers = self.path.list_type_explorers(type) - for explorer in explorers: - remote_cmd = cmd + [os.path.join(self.path.remote_type_explorer_dir(type), explorer)] - output = os.path.join(self.path.type_explorer_output_dir(cdist_object), explorer) - output_fd = open(output, mode='w') - log.debug("%s exploring %s using %s storing to %s", - cdist_object, explorer, remote_cmd, output) - - cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) - output_fd.close() + explorers = self.path.list_type_explorers(type) + for explorer in explorers: + remote_cmd = cmd + [os.path.join(self.path.remote_type_explorer_dir(type), explorer)] + output = os.path.join(self.path.type_explorer_output_dir(cdist_object), explorer) + output_fd = open(output, mode='w') + log.debug("%s exploring %s using %s storing to %s", + cdist_object, explorer, remote_cmd, output) + + cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) + output_fd.close() - def link_emulator(self): - """Link emulator to types""" - cdist.emulator.link(self.exec_path, - self.path.bin_dir, self.path.list_types()) + def link_emulator(self): + """Link emulator to types""" + cdist.emulator.link(self.exec_path, + self.path.bin_dir, self.path.list_types()) - def init_deploy(self): - """Ensure the base directories are cleaned up""" - log.debug("Creating clean directory structure") + def init_deploy(self): + """Ensure the base directories are cleaned up""" + log.debug("Creating clean directory structure") - self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) - self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) - self.link_emulator() + self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) + self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) + self.link_emulator() - def run_initial_manifest(self): - """Run the initial manifest""" - log.info("Running initial manifest %s", self.path.initial_manifest) - env = { "__manifest" : self.path.manifest_dir } - self.run_manifest(self.path.initial_manifest, extra_env=env) + def run_initial_manifest(self): + """Run the initial manifest""" + log.info("Running initial manifest %s", self.path.initial_manifest) + env = { "__manifest" : self.path.manifest_dir } + self.run_manifest(self.path.initial_manifest, extra_env=env) - def run_type_manifest(self, cdist_object): - """Run manifest for a specific object""" - type = self.path.get_type_from_object(cdist_object) - manifest = self.path.type_dir(type, "manifest") - - log.debug("%s: Running %s", cdist_object, manifest) - if os.path.exists(manifest): - env = { "__object" : self.path.object_dir(cdist_object), - "__object_id": self.path.get_object_id_from_object(cdist_object), - "__object_fq": cdist_object, - "__type": self.path.type_dir(type) - } - self.run_manifest(manifest, extra_env=env) + def run_type_manifest(self, cdist_object): + """Run manifest for a specific object""" + type = self.path.get_type_from_object(cdist_object) + manifest = self.path.type_dir(type, "manifest") + + log.debug("%s: Running %s", cdist_object, manifest) + if os.path.exists(manifest): + env = { "__object" : self.path.object_dir(cdist_object), + "__object_id": self.path.get_object_id_from_object(cdist_object), + "__object_fq": cdist_object, + "__type": self.path.type_dir(type) + } + self.run_manifest(manifest, extra_env=env) - def run_manifest(self, manifest, extra_env=None): - """Run a manifest""" - log.debug("Running manifest %s, env=%s", manifest, extra_env) - env = os.environ.copy() - env['PATH'] = self.path.bin_dir + ":" + env['PATH'] + def run_manifest(self, manifest, extra_env=None): + """Run a manifest""" + log.debug("Running manifest %s, env=%s", manifest, extra_env) + env = os.environ.copy() + env['PATH'] = self.path.bin_dir + ":" + env['PATH'] - # Information required in every manifest - env['__target_host'] = self.target_host - env['__global'] = self.path.out_dir - - # Submit debug flag to manifest, can be used by emulator and types - if self.debug: - env['__debug'] = "yes" + # Information required in every manifest + env['__target_host'] = self.target_host + env['__global'] = self.path.out_dir + + # Submit debug flag to manifest, can be used by emulator and types + if self.debug: + env['__debug'] = "yes" - # Required for recording source - env['__cdist_manifest'] = manifest + # Required for recording source + env['__cdist_manifest'] = manifest - # Required to find types - env['__cdist_type_base_dir'] = self.path.type_base_dir + # Required to find types + env['__cdist_type_base_dir'] = self.path.type_base_dir - # Other environment stuff - if extra_env: - env.update(extra_env) + # Other environment stuff + if extra_env: + env.update(extra_env) - cdist.exec.shell_run_or_debug_fail(manifest, [manifest], env=env) + cdist.exec.shell_run_or_debug_fail(manifest, [manifest], env=env) - def object_run(self, cdist_object, mode): - """Run gencode or code for an object""" - log.debug("Running %s from %s", mode, cdist_object) - file=os.path.join(self.path.object_dir(cdist_object), "require") - requirements = cdist.path.file_to_list(file) - type = self.path.get_type_from_object(cdist_object) - - for requirement in requirements: - log.debug("Object %s requires %s", cdist_object, requirement) - self.object_run(requirement, mode=mode) + def object_run(self, cdist_object, mode): + """Run gencode or code for an object""" + log.debug("Running %s from %s", mode, cdist_object) + file=os.path.join(self.path.object_dir(cdist_object), "require") + requirements = cdist.path.file_to_list(file) + type = self.path.get_type_from_object(cdist_object) + + for requirement in requirements: + log.debug("Object %s requires %s", cdist_object, requirement) + self.object_run(requirement, mode=mode) - # - # Setup env Variable: - # - env = os.environ.copy() - env['__target_host'] = self.target_host - env['__global'] = self.path.out_dir - env["__object"] = self.path.object_dir(cdist_object) - env["__object_id"] = self.path.get_object_id_from_object(cdist_object) - env["__object_fq"] = cdist_object - env["__type"] = self.path.type_dir(type) + # + # Setup env Variable: + # + env = os.environ.copy() + env['__target_host'] = self.target_host + env['__global'] = self.path.out_dir + env["__object"] = self.path.object_dir(cdist_object) + env["__object_id"] = self.path.get_object_id_from_object(cdist_object) + env["__object_fq"] = cdist_object + env["__type"] = self.path.type_dir(type) - if mode == "gencode": - paths = [ - self.path.type_dir(type, "gencode-local"), - self.path.type_dir(type, "gencode-remote") - ] - for bin in paths: - if os.path.isfile(bin): - # omit "gen" from gencode and use it for output base - outfile=os.path.join(self.path.object_dir(cdist_object), - os.path.basename(bin)[3:]) + if mode == "gencode": + paths = [ + self.path.type_dir(type, "gencode-local"), + self.path.type_dir(type, "gencode-remote") + ] + for bin in paths: + if os.path.isfile(bin): + # omit "gen" from gencode and use it for output base + outfile=os.path.join(self.path.object_dir(cdist_object), + os.path.basename(bin)[3:]) - outfile_fd = open(outfile, "w") + outfile_fd = open(outfile, "w") - # Need to flush to ensure our write is done before stdout write - # FIXME: CODE_HEADER needed in our sh -e scenario???? - outfile_fd.write(CODE_HEADER) - outfile_fd.flush() + # Need to flush to ensure our write is done before stdout write + # FIXME: CODE_HEADER needed in our sh -e scenario? + outfile_fd.write(CODE_HEADER) + outfile_fd.flush() - cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) - outfile_fd.close() + cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) + outfile_fd.close() - status = os.stat(outfile) + status = os.stat(outfile) - # Remove output if empty, else make it executable - if status.st_size == len(CODE_HEADER): - os.unlink(outfile) - else: - # Add header and make executable - identically to 0o700 - os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + # Remove output if empty, else make it executable + if status.st_size == len(CODE_HEADER): + os.unlink(outfile) + else: + # Add header and make executable - identically to 0o700 + os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) - # Mark object as changed - open(os.path.join(self.path.object_dir(cdist_object), "changed"), "w").close() + # Mark object as changed + open(os.path.join(self.path.object_dir(cdist_object), "changed"), "w").close() - if mode == "code": - local_dir = self.path.object_dir(cdist_object) - remote_dir = self.path.remote_object_dir(cdist_object) + if mode == "code": + local_dir = self.path.object_dir(cdist_object) + remote_dir = self.path.remote_object_dir(cdist_object) - bin = os.path.join(local_dir, "code-local") - if os.path.isfile(bin): - cdist.exec.run_or_fail([bin]) - + bin = os.path.join(local_dir, "code-local") + if os.path.isfile(bin): + cdist.exec.run_or_fail([bin]) + - local_remote_code = os.path.join(local_dir, "code-remote") - remote_remote_code = os.path.join(remote_dir, "code-remote") - if os.path.isfile(local_remote_code): - self.path.transfer_file(local_remote_code, remote_remote_code) - # FIXME: remote_prefix - cdist.exec.run_or_fail([remote_remote_code], remote_prefix=self.remote_prefix) - - def stage_prepare(self): - """Do everything for a deploy, minus the actual code stage""" - self.init_deploy() - self.run_global_explores() - self.run_initial_manifest() - - log.info("Running object manifests and type explorers") + local_remote_code = os.path.join(local_dir, "code-remote") + remote_remote_code = os.path.join(remote_dir, "code-remote") + if os.path.isfile(local_remote_code): + self.path.transfer_file(local_remote_code, remote_remote_code) + # FIXME: remote_prefix + cdist.exec.run_or_fail([remote_remote_code], remote_prefix=self.remote_prefix) + + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" + self.init_deploy() + self.run_global_explorers() + self.run_initial_manifest() + + log.info("Running object manifests and type explorers") - old_objects = [] - objects = self.path.list_objects() + old_objects = [] + objects = self.path.list_objects() - # Continue process until no new objects are created anymore - while old_objects != objects: - old_objects = list(objects) - for cdist_object in objects: - if cdist_object in self.objects_prepared: - log.debug("Skipping rerun of object %s", cdist_object) - continue - else: - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - self.objects_prepared.append(cdist_object) + # Continue process until no new objects are created anymore + while old_objects != objects: + old_objects = list(objects) + for cdist_object in objects: + if cdist_object in self.objects_prepared: + log.debug("Skipping rerun of object %s", cdist_object) + continue + else: + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + self.objects_prepared.append(cdist_object) - objects = self.path.list_objects() + objects = self.path.list_objects() - def stage_run(self): - """The final (and real) step of deployment""" - log.info("Generating and executing code") - # Now do the final steps over the existing objects - for cdist_object in self.path.list_objects(): - log.debug("Run object: %s", cdist_object) - self.object_run(cdist_object, mode="gencode") - self.object_run(cdist_object, mode="code") + def stage_run(self): + """The final (and real) step of deployment""" + log.info("Generating and executing code") + # Now do the final steps over the existing objects + for cdist_object in self.path.list_objects(): + log.debug("Run object: %s", cdist_object) + self.object_run(cdist_object, mode="gencode") + self.object_run(cdist_object, mode="code") - def deploy_to(self): - """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.target_host) - time_start = datetime.datetime.now() + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + log.info("Deploying to " + self.target_host) + time_start = datetime.datetime.now() - self.stage_prepare() - self.stage_run() + self.stage_prepare() + self.stage_run() - time_end = datetime.datetime.now() - duration = time_end - time_start - log.info("Finished run of %s in %s seconds", - self.target_host, - duration.total_seconds()) + time_end = datetime.datetime.now() + duration = time_end - time_start + log.info("Finished run of %s in %s seconds", + self.target_host, + duration.total_seconds()) - def deploy_and_cleanup(self): - """Do what is most often done: deploy & cleanup""" - self.deploy_to() - self.cleanup() + def deploy_and_cleanup(self): + """Do what is most often done: deploy & cleanup""" + self.deploy_to() + self.cleanup() From 2176e4e2d402318713b08a7004317a742effc2b1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Oct 2011 16:05:11 +0200 Subject: [PATCH 0362/1024] begin new type type (no typo) Signed-off-by: Nico Schottelius --- lib/cdist/type.py | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 lib/cdist/type.py diff --git a/lib/cdist/type.py b/lib/cdist/type.py new file mode 100644 index 00000000..b0280660 --- /dev/null +++ b/lib/cdist/type.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 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 . +# +# + +import logging +import os +log = logging.getLogger(__name__) + +class Type(object): + + def __init__(self, path, remote_path): + self.path = path + self.remote_path = remote_path + + def list_explorers(self): + """Return list of available explorers""" + dir = os.path.join(self.path, "explorer") + if os.path.isdir(dir): + list = os.listdir(dir) + else: + list = [] + + log.debug("Explorers for %s in %s: %s", type, dir, list) + + return list + + def is_install(self): + """Check whether a type is used for installation (if not: for configuration)""" + return os.path.isfile(os.path.join(self.path, "install")) + + # FIXME: Type + def type_dir(self, type, *args): + """Return (sub-)directory of a type""" + return os.path.join(self.type_base_dir, type, *args) + + # FIXME: Type + def remote_type_explorer_dir(self, type): + """Return remote directory that holds the explorers of a type""" + return os.path.join(REMOTE_TYPE_DIR, type, "explorer") From 099adec61fb22ca2b79005612980035326718ebd Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 5 Oct 2011 16:08:29 +0200 Subject: [PATCH 0363/1024] start working on object class Signed-off-by: Steven Armstrong --- lib/cdist/object.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lib/cdist/object.py diff --git a/lib/cdist/object.py b/lib/cdist/object.py new file mode 100644 index 00000000..396d8e48 --- /dev/null +++ b/lib/cdist/object.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import os +import logging +log = logging.getLogger(__name__) + + + +class Object(object): + def __init__(self, path, remote_path): + self.path = path + self.remote_path = remote_path + + From 68889c4bf7a5281cab51a8be0ba7fa7ca40c4da7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Oct 2011 16:12:25 +0200 Subject: [PATCH 0364/1024] finish type, shrink path Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 31 +------------------------------ lib/cdist/type.py | 10 ++-------- 2 files changed, 3 insertions(+), 38 deletions(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 5cde357b..e709e6fe 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -171,30 +171,11 @@ class Path: """Return list of available explorers""" return os.listdir(self.global_explorer_dir) - # FIXME: Type - only needs to know its path - def list_type_explorers(self, type): - """Return list of available explorers for a specific type""" - dir = self.type_dir(type, "explorer") - if os.path.isdir(dir): - list = os.listdir(dir) - else: - list = [] - - log.debug("Explorers for %s in %s: %s", type, dir, list) - - return list - # Stays here def list_types(self): """Retuns list of types""" return os.listdir(self.type_base_dir) - # FIXME: type - def is_install_type(self, type): - """Check whether a type is used for installation (if not: for configuration)""" - marker = os.path.join(self.type_dir(type), "install") - return os.path.isfile(marker) - # Stays here def list_object_paths(self, starting_point): """Return list of paths of existing objects""" @@ -260,16 +241,6 @@ class Path: return objects - # FIXME: Type - def type_dir(self, type, *args): - """Return (sub-)directory of a type""" - return os.path.join(self.type_base_dir, type, *args) - - # FIXME: Type - def remote_type_explorer_dir(self, type): - """Return remote directory that holds the explorers of a type""" - return os.path.join(REMOTE_TYPE_DIR, type, "explorer") - # Stays here def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" @@ -286,7 +257,7 @@ class Path: self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) self.transfer_dir(self.global_explorer_dir, REMOTE_GLOBAL_EXPLORER_DIR) - # Stays here + # Stays here - FIXME: adjust to type code, loop over types! def transfer_type_explorers(self, type): """Transfer explorers of a type, but only once""" if type in self.type_explorers_transferred: diff --git a/lib/cdist/type.py b/lib/cdist/type.py index b0280660..e1c5f589 100644 --- a/lib/cdist/type.py +++ b/lib/cdist/type.py @@ -46,12 +46,6 @@ class Type(object): """Check whether a type is used for installation (if not: for configuration)""" return os.path.isfile(os.path.join(self.path, "install")) - # FIXME: Type - def type_dir(self, type, *args): - """Return (sub-)directory of a type""" - return os.path.join(self.type_base_dir, type, *args) - - # FIXME: Type - def remote_type_explorer_dir(self, type): + def remote_explorer_dir(self): """Return remote directory that holds the explorers of a type""" - return os.path.join(REMOTE_TYPE_DIR, type, "explorer") + return os.path.join(self.remote_path, "explorer") From a0c984acddbe9fc88c588d3b54901a6a40337faa Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Oct 2011 16:38:19 +0200 Subject: [PATCH 0365/1024] config+install is broken now due to refactoring Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index a550c45e..8211f374 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -81,6 +81,7 @@ class ConfigInstall: cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=self.remote_prefix) output_fd.close() +# FIXME: where to call this from? def run_type_explorer(self, cdist_object): """Run type specific explorers for objects""" @@ -97,6 +98,7 @@ class ConfigInstall: # Need to transfer at least the parameters for objects to be useful self.path.transfer_object_parameter(cdist_object) + # FIXME: Broken due to refactoring into type.py explorers = self.path.list_type_explorers(type) for explorer in explorers: remote_cmd = cmd + [os.path.join(self.path.remote_type_explorer_dir(type), explorer)] From 2e61e8b202e883a899413bd8c18e9ad04709f031 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 5 Oct 2011 16:44:22 +0200 Subject: [PATCH 0366/1024] finish object class Signed-off-by: Steven Armstrong --- lib/cdist/object.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/cdist/object.py b/lib/cdist/object.py index 396d8e48..0a282dc2 100644 --- a/lib/cdist/object.py +++ b/lib/cdist/object.py @@ -26,8 +26,26 @@ log = logging.getLogger(__name__) class Object(object): - def __init__(self, path, remote_path): + + def __init__(self, path, remote_path, object_fq): self.path = path self.remote_path = remote_path + self.object_fq = object_fq + self.type = self.object_fq.split(os.sep)[0] + self.object_id = self.object_fq.split(os.sep)[1:] + self.parameter_dir = os.path.join(self.path, "parameter") + self.remote_object_parameter_dir = os.path.join(self.remote_path, "parameter") + self.object_code_paths = [ + os.path.join(self.path, "code-local"), + os.path.join(self.path, "code-remote")] + @property + def type_explorer_output_dir(self): + """Returns and creates dir of the output for a type explorer""" + if not self.__type_explorer_output_dir: + dir = os.path.join(self.path, "explorer") + if not os.path.isdir(dir): + os.mkdir(dir) + self.__type_explorer_output_dir = dir + return self.__type_explorer_output_dir From 7f85aab3ef3b63a261be8da5e9edcc1c39765d2c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Oct 2011 16:45:10 +0200 Subject: [PATCH 0367/1024] add some pseudo code to adapt to changes Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 8211f374..9a84c2cf 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -260,6 +260,17 @@ class ConfigInstall: log.debug("Skipping rerun of object %s", cdist_object) continue else: + # FIXME: run_type_explorer: + # object can return type + # type has explorers + # path knows about where to save explorer output + # type = self.path.objects[object].type() + # self.path.types['type'].explorers() + # for explorer in explorers: + # output = cdist.exec.run_debug_or_fail_shell(explorer) + # if output: + # write_output_to(output, os.path.join(self.path.objects[object].explorer_dir(),explorer) ) + # self.run_type_explorer(cdist_object) self.run_type_manifest(cdist_object) self.objects_prepared.append(cdist_object) From f84cabffe35c720614a2d327cc3e3c1d799113b6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Oct 2011 16:49:20 +0200 Subject: [PATCH 0368/1024] cleanup path Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 54 ++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index e709e6fe..5a2b64d2 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -75,6 +75,7 @@ class Path: self.remote_user = remote_user self.remote_prefix = remote_prefix + # Input directories self.conf_dir = os.path.join(self.base_dir, "conf") self.cache_base_dir = os.path.join(self.base_dir, "cache") self.cache_dir = os.path.join(self.cache_base_dir, target_host) @@ -83,31 +84,27 @@ class Path: self.manifest_dir = os.path.join(self.conf_dir, "manifest") self.type_base_dir = os.path.join(self.conf_dir, "type") - self.out_dir = os.path.join(self.temp_dir, "out") - os.mkdir(self.out_dir) - - self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") - os.mkdir(self.global_explorer_out_dir) - - self.object_base_dir = os.path.join(self.out_dir, "object") - - # Setup binary directory + contents - self.bin_dir = os.path.join(self.out_dir, "bin") - os.mkdir(self.bin_dir) - - # List of type explorers transferred - self.type_explorers_transferred = {} - - # objects - self.objects_prepared = [] - # Mostly static, but can be overwritten on user demand if initial_manifest: self.initial_manifest = initial_manifest else: self.initial_manifest = os.path.join(self.manifest_dir, "init") - # FIXME: stays + # Output directories + self.out_dir = os.path.join(self.temp_dir, "out") + self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") + self.object_base_dir = os.path.join(self.out_dir, "object") + self.bin_dir = os.path.join(self.out_dir, "bin") + + # List of type explorers transferred + self.type_explorers_transferred = {} + + # objects prepared + self.objects_prepared = [] + + # Create directories + self.__init_out_dirs() + def cleanup(self): # Do not use in __del__: # http://docs.python.org/reference/datamodel.html#customization @@ -120,6 +117,20 @@ class Path: shutil.rmtree(self.cache_dir) shutil.move(self.temp_dir, self.cache_dir) + + def __init_out_dirs(self): + """Initialise output directory structure""" + os.mkdir(self.out_dir) + os.mkdir(self.global_explorer_out_dir) + os.mkdir(self.bin_dir) + + + # Stays here + def list_types(self): + """Retuns list of types""" + return os.listdir(self.type_base_dir) + + ###################################################################### # FIXME: belongs to here - clearify remote* def remote_mkdir(self, directory): @@ -171,11 +182,6 @@ class Path: """Return list of available explorers""" return os.listdir(self.global_explorer_dir) - # Stays here - def list_types(self): - """Retuns list of types""" - return os.listdir(self.type_base_dir) - # Stays here def list_object_paths(self, starting_point): """Return list of paths of existing objects""" From 50a3ad7993d08a6ac630007b49758337d6963fd3 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 6 Oct 2011 00:58:43 +0200 Subject: [PATCH 0369/1024] proof of concept object oriented aproach Signed-off-by: Steven Armstrong --- oo.py | 242 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 oo.py diff --git a/oo.py b/oo.py new file mode 100644 index 00000000..dd33e0bc --- /dev/null +++ b/oo.py @@ -0,0 +1,242 @@ +import os +import tempfile + +# FIXME: change these to match your environment +os.environ['__cdist_base_dir'] = '/home/sar/vcs/cdist' +# FIXME: testing against the cache, change path +os.environ['__cdist_out_dir'] = '/home/sar/vcs/cdist/cache/sans-asteven-02.ethz.ch/out' + + +''' +cd /path/to/dir/with/this/file +ipython + + +In [1]: import oo + +In [2]: t = oo.Type('__mkfs') + +In [3]: t. +t.base_dir t.is_install t.list_type_names t.name t.path +t.explorers t.is_singleton t.list_types t.optional_parameters t.required_parameters + +In [3]: t.path +Out[3]: '/home/sar/vcs/cdist/conf/type/__mkfs' + +In [4]: t.required_parameters +Out[4]: ['type'] + +In [5]: t.optional_parameters +Out[5]: ['device', 'options', 'blocks'] + +In [6]: t.is +t.is_install t.is_singleton + +In [6]: t.is_singleton +Out[6]: False + +In [7]: o = oo.Object(t, 'dev/sda1') + +In [8]: o. +o.base_dir o.list_object_names o.list_type_names o.parameter o.qualified_name o.type +o.changed o.list_objects o.object_id o.path o.requirements + +In [8]: o.pa +o.parameter o.path + +In [8]: o.path +Out[8]: '/home/sar/vcs/cdist/cache/sans-asteven-02.ethz.ch/out/object/__mkfs/dev/sda1/.cdist' + +In [9]: o.changed +Out[9]: False + +In [10]: o.changed = True + +In [11]: # creates /home/sar/vcs/cdist/cache/sans-asteven-02.ethz.ch/out/object/__mkfs/dev/sda1/.cdist/changed + +In [12]: o.changed +Out[12]: True + +In [13]: o.changed = False + +In [14]: # removes /home/sar/vcs/cdist/cache/sans-asteven-02.ethz.ch/out/object/__mkfs/dev/sda1/.cdist/changed + +In [15]: + +''' + +class Type(object): + + @staticmethod + def base_dir(): + """Return the absolute path to the top level directory where types + are defined. + + Requires the environment variable '__cdist_base_dir' to be set. + + """ + return os.path.join( + os.environ['__cdist_base_dir'], + 'conf', + 'type' + ) + + @classmethod + def list_types(cls): + """Return a list of type instances""" + for type_name in cls.list_type_names(): + yield cls(type_name) + + @classmethod + def list_type_names(cls): + """Return a list of type names""" + return os.listdir(cls.base_dir()) + + + def __init__(self, name): + self.name = name + self.__explorers = None + self.__required_parameters = None + self.__optional_parameters = None + + def __repr__(self): + return '' % self.name + + @property + def path(self): + return os.path.join( + self.base_dir(), + self.name + ) + + @property + def is_singleton(self): + """Check whether a type is a singleton.""" + return os.path.isfile(os.path.join(self.path, "singleton")) + + @property + def is_install(self): + """Check whether a type is used for installation (if not: for configuration)""" + return os.path.isfile(os.path.join(self.path, "install")) + + @property + def explorers(self): + """Return a list of available explorers""" + if not self.__explorers: + try: + self.__explorers = os.listdir(os.path.join(self.path, "explorer")) + except EnvironmentError as e: + # error ignored + self.__explorers = [] + return self.__explorers + + @property + def required_parameters(self): + """Return a list of required parameters""" + if not self.__required_parameters: + parameters = [] + try: + with open(os.path.join(self.path, "parameter", "required")) as fd: + for line in fd: + parameters.append(line.strip()) + except EnvironmentError as e: + # error ignored + pass + finally: + self.__required_parameters = parameters + return self.__required_parameters + + @property + def optional_parameters(self): + """Return a list of optional parameters""" + if not self.__optional_parameters: + parameters = [] + try: + with open(os.path.join(self.path, "parameter", "optional")) as fd: + for line in fd: + parameters.append(line.strip()) + except EnvironmentError as e: + # error ignored + pass + finally: + self.__optional_parameters = parameters + return self.__optional_parameters + + +class Object(object): + + @staticmethod + def base_dir(): + """Return the absolute path to the top level directory where objects + are defined. + + Requires the environment variable '__cdist_out_dir' to be set. + + """ + base_dir = os.path.join( + os.environ['__cdist_out_dir'], + 'object' + ) + # FIXME: should directory be created elsewhere? + if not os.path.isdir(base_dir): + os.mkdir(base_dir) + return base_dir + + @classmethod + def list_objects(cls): + """Return a list of object instances""" + for object_name in cls.list_object_names(): + type_name = object_name.split(os.sep)[0] + object_id = os.sep.join(object_name.split(os.sep)[1:]) + yield cls(Type(type_name), object_id=object_id) + + @classmethod + def list_type_names(cls): + """Return a list of type names""" + return os.listdir(cls.base_dir()) + + @classmethod + def list_object_names(cls): + """Return a list of object names""" + for path, dirs, files in os.walk(cls.base_dir()): + # FIXME: use constant instead of string + if '.cdist' in dirs: + yield os.path.relpath(path, cls.base_dir()) + + def __init__(self, type, object_id=None, parameter=None, requirements=None): + self.type = type # instance of Type + self.object_id = object_id + self.qualified_name = os.path.join(self.type.name, self.object_id) + self.parameter = parameter or {} + self.requirements = requirements or [] + + def __repr__(self): + return '' % self.qualified_name + + @property + def path(self): + return os.path.join( + self.base_dir(), + self.qualified_name, + '.cdist' + ) + + @property + def changed(self): + """Check whether the object has been changed.""" + return os.path.isfile(os.path.join(self.path, "changed")) + + @changed.setter + def changed(self, value): + """Change the objects changed status.""" + path = os.path.join(self.path, "changed") + if value: + open(path, "w").close() + else: + try: + os.remove(path) + except EnvironmentError: + # ignore + pass + + # FIXME: implement other properties/methods From f262cc4ccf1110365f92ce35c1fc83288ebb8f53 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 6 Oct 2011 01:04:09 +0200 Subject: [PATCH 0370/1024] ++example usage Signed-off-by: Steven Armstrong --- oo.py | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/oo.py b/oo.py index dd33e0bc..081b3e56 100644 --- a/oo.py +++ b/oo.py @@ -63,6 +63,129 @@ In [14]: # removes /home/sar/vcs/cdist/cache/sans-asteven-02.ethz.ch/out/object/ In [15]: + +----- + +In [1]: import oo + +In [2]: oo.Type. +oo.Type.base_dir oo.Type.is_install oo.Type.list_type_names oo.Type.mro oo.Type.path +oo.Type.explorers oo.Type.is_singleton oo.Type.list_types oo.Type.optional_parameters oo.Type.required_parameters + +In [2]: oo.Type.list +oo.Type.list_type_names oo.Type.list_types + +In [2]: oo.Type.list_type_names() +Out[2]: +['__addifnosuchline', + '__apt_ppa', + '__apt_update_index', + '__autofs_map', + '__autofs_master', + '__debconf_set_selections', + '__directory', + '__file', + '__group', + '__issue', + '__key_value', + '__link', + '__mkfs', + '__motd', + '__package', + '__package_apt', + '__package_pacman', + '__package_pkg_openbsd', + '__package_rubygem', + '__package_yum', + '__partition_msdos', + '__partition_msdos_apply', + '__postgres_database', + '__postgres_role', + '__process', + '__removeline', + '__ssh_authorized_key', + '__timezone', + '__user'] + +In [3]: list(oo.Type.list_types()) +Out[3]: +[, + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + ] + +In [4]: + +In [4]: oo.Object. +oo.Object.base_dir oo.Object.changed oo.Object.list_object_names oo.Object.list_objects oo.Object.list_type_names oo.Object.mro oo.Object.path + +In [4]: oo.Object.list +oo.Object.list_object_names oo.Object.list_objects oo.Object.list_type_names + +In [4]: oo.Object.list_ob +oo.Object.list_object_names oo.Object.list_objects + +In [4]: oo.Object.list_object_names() +Out[4]: + +In [5]: list(oo.Object.list_object_names()) +Out[5]: +['__mkfs/dev/sda1', + '__mkfs/dev/sda2', + '__mkfs/dev/sda5', + '__mkfs/dev/sda6', + '__mkfs/dev/sda7', + '__partition_msdos/dev/sda1', + '__partition_msdos/dev/sda2', + '__partition_msdos/dev/sda3', + '__partition_msdos/dev/sda5', + '__partition_msdos/dev/sda6', + '__partition_msdos/dev/sda7', + '__partition_msdos_apply/singleton'] + +In [6]: list(oo.Object.list_objects()) +Out[6]: +[, + , + , + , + , + , + , + , + , + , + , + ] + +In [7]: + + ''' class Type(object): From 820eea56fb5a2cde0784eadedf6bf5710061a534 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 09:27:16 +0200 Subject: [PATCH 0371/1024] install finish Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 2 +- lib/cdist/type.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 9a84c2cf..39ee79c6 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -68,7 +68,7 @@ class ConfigInstall: log.info("Running global explorers") explorers = self.path.list_global_explorers() if(len(explorers) == 0): - raise CdistError("No explorers found in", self.path.global_explorer_dir) + raise CdistError("No explorers found in ", self.path.global_explorer_dir) self.path.transfer_global_explorers() for explorer in explorers: diff --git a/lib/cdist/type.py b/lib/cdist/type.py index e1c5f589..e6c35ad1 100644 --- a/lib/cdist/type.py +++ b/lib/cdist/type.py @@ -46,6 +46,10 @@ class Type(object): """Check whether a type is used for installation (if not: for configuration)""" return os.path.isfile(os.path.join(self.path, "install")) + def explorer_dir(self): + """Return remote directory that holds the explorers of a type""" + return os.path.join(self.remote_path, "explorer") + def remote_explorer_dir(self): """Return remote directory that holds the explorers of a type""" return os.path.join(self.remote_path, "explorer") From 5b70ff5694bfa18ad745987d9aee7c32a131eeb3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 12:07:50 +0200 Subject: [PATCH 0372/1024] whiteboard to file Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-06 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 doc/dev/logs/2011-10-06 diff --git a/doc/dev/logs/2011-10-06 b/doc/dev/logs/2011-10-06 new file mode 100644 index 00000000..14edab51 --- /dev/null +++ b/doc/dev/logs/2011-10-06 @@ -0,0 +1,30 @@ +GlobalExplorer + list_explorers() + list_explorers_names() + + base_dir + __init__(name) + out_dir + env + name = id + path + return_code + return_value + +-------------------------------------------------------------------------------- +Exec: + +normal: + +scp /from/where $USER@$HOST:REMOTE_BASE/cdist-internal +ssh $USER@$HOST MY_CMD_THAT_NEEDS_TO_RUN_IN_BIN_SH (including ENV) + +sudo: + +scp $USER@$HOST:REMOTE_BASE/cdist-internal +ssh $USER@$HOST sudo MY_CMD_THAT_NEEDS_TO_RUN_IN_BIN_SH (including ENV) + +chroot: + +[sudo] cp file /chroot/THE_HOST_BASE/REMOTE_BASE/cdist-internal +[sudo] chroot /chroot MY_CMD_THAT_NEEDS_TO_RUN_IN_BIN_SH (including ENV) From 2ec2ab26ce95b967a82577409e42fdf745adba41 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 12:34:34 +0200 Subject: [PATCH 0373/1024] update path with changes from yesterday (system crash) Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 5a2b64d2..2fcf3aea 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -117,7 +117,7 @@ class Path: shutil.rmtree(self.cache_dir) shutil.move(self.temp_dir, self.cache_dir) - + def __init_out_dirs(self): """Initialise output directory structure""" os.mkdir(self.out_dir) From a4abb53ced22a5af16b6f0d68c90146c9e3dd423 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 6 Oct 2011 12:52:13 +0200 Subject: [PATCH 0374/1024] +MissingEnvironmentVariableError Signed-off-by: Steven Armstrong --- lib/cdist/__init__.py | 10 ++++++++++ oo.py => lib/cdist/core/object.py | 0 2 files changed, 10 insertions(+) rename oo.py => lib/cdist/core/object.py (100%) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index a0ca2ba2..864b4f37 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -24,3 +24,13 @@ VERSION = "2.0.3" class Error(Exception): """Base exception class for this project""" pass + + +class MissingEnvironmentVariableError(Error): + """Raised when a required environment variable is not set.""" + + def __init__(self, name) + self.name = name + + def __str__(self): + return 'Missing required environment variable: {0.name}'.format(o) diff --git a/oo.py b/lib/cdist/core/object.py similarity index 100% rename from oo.py rename to lib/cdist/core/object.py From cdba503ff279a67e0f99ff430952a822dd7e2a88 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 6 Oct 2011 12:57:38 +0200 Subject: [PATCH 0375/1024] move Object class into its own file Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 325 +++++---------------------------------- 1 file changed, 37 insertions(+), 288 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 081b3e56..c136390e 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -1,292 +1,37 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + import os -import tempfile -# FIXME: change these to match your environment -os.environ['__cdist_base_dir'] = '/home/sar/vcs/cdist' -# FIXME: testing against the cache, change path -os.environ['__cdist_out_dir'] = '/home/sar/vcs/cdist/cache/sans-asteven-02.ethz.ch/out' - - -''' -cd /path/to/dir/with/this/file -ipython - - -In [1]: import oo - -In [2]: t = oo.Type('__mkfs') - -In [3]: t. -t.base_dir t.is_install t.list_type_names t.name t.path -t.explorers t.is_singleton t.list_types t.optional_parameters t.required_parameters - -In [3]: t.path -Out[3]: '/home/sar/vcs/cdist/conf/type/__mkfs' - -In [4]: t.required_parameters -Out[4]: ['type'] - -In [5]: t.optional_parameters -Out[5]: ['device', 'options', 'blocks'] - -In [6]: t.is -t.is_install t.is_singleton - -In [6]: t.is_singleton -Out[6]: False - -In [7]: o = oo.Object(t, 'dev/sda1') - -In [8]: o. -o.base_dir o.list_object_names o.list_type_names o.parameter o.qualified_name o.type -o.changed o.list_objects o.object_id o.path o.requirements - -In [8]: o.pa -o.parameter o.path - -In [8]: o.path -Out[8]: '/home/sar/vcs/cdist/cache/sans-asteven-02.ethz.ch/out/object/__mkfs/dev/sda1/.cdist' - -In [9]: o.changed -Out[9]: False - -In [10]: o.changed = True - -In [11]: # creates /home/sar/vcs/cdist/cache/sans-asteven-02.ethz.ch/out/object/__mkfs/dev/sda1/.cdist/changed - -In [12]: o.changed -Out[12]: True - -In [13]: o.changed = False - -In [14]: # removes /home/sar/vcs/cdist/cache/sans-asteven-02.ethz.ch/out/object/__mkfs/dev/sda1/.cdist/changed - -In [15]: - - ------ - -In [1]: import oo - -In [2]: oo.Type. -oo.Type.base_dir oo.Type.is_install oo.Type.list_type_names oo.Type.mro oo.Type.path -oo.Type.explorers oo.Type.is_singleton oo.Type.list_types oo.Type.optional_parameters oo.Type.required_parameters - -In [2]: oo.Type.list -oo.Type.list_type_names oo.Type.list_types - -In [2]: oo.Type.list_type_names() -Out[2]: -['__addifnosuchline', - '__apt_ppa', - '__apt_update_index', - '__autofs_map', - '__autofs_master', - '__debconf_set_selections', - '__directory', - '__file', - '__group', - '__issue', - '__key_value', - '__link', - '__mkfs', - '__motd', - '__package', - '__package_apt', - '__package_pacman', - '__package_pkg_openbsd', - '__package_rubygem', - '__package_yum', - '__partition_msdos', - '__partition_msdos_apply', - '__postgres_database', - '__postgres_role', - '__process', - '__removeline', - '__ssh_authorized_key', - '__timezone', - '__user'] - -In [3]: list(oo.Type.list_types()) -Out[3]: -[, - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - ] - -In [4]: - -In [4]: oo.Object. -oo.Object.base_dir oo.Object.changed oo.Object.list_object_names oo.Object.list_objects oo.Object.list_type_names oo.Object.mro oo.Object.path - -In [4]: oo.Object.list -oo.Object.list_object_names oo.Object.list_objects oo.Object.list_type_names - -In [4]: oo.Object.list_ob -oo.Object.list_object_names oo.Object.list_objects - -In [4]: oo.Object.list_object_names() -Out[4]: - -In [5]: list(oo.Object.list_object_names()) -Out[5]: -['__mkfs/dev/sda1', - '__mkfs/dev/sda2', - '__mkfs/dev/sda5', - '__mkfs/dev/sda6', - '__mkfs/dev/sda7', - '__partition_msdos/dev/sda1', - '__partition_msdos/dev/sda2', - '__partition_msdos/dev/sda3', - '__partition_msdos/dev/sda5', - '__partition_msdos/dev/sda6', - '__partition_msdos/dev/sda7', - '__partition_msdos_apply/singleton'] - -In [6]: list(oo.Object.list_objects()) -Out[6]: -[, - , - , - , - , - , - , - , - , - , - , - ] - -In [7]: - - -''' - -class Type(object): - - @staticmethod - def base_dir(): - """Return the absolute path to the top level directory where types - are defined. - - Requires the environment variable '__cdist_base_dir' to be set. - - """ - return os.path.join( - os.environ['__cdist_base_dir'], - 'conf', - 'type' - ) - - @classmethod - def list_types(cls): - """Return a list of type instances""" - for type_name in cls.list_type_names(): - yield cls(type_name) - - @classmethod - def list_type_names(cls): - """Return a list of type names""" - return os.listdir(cls.base_dir()) - - - def __init__(self, name): - self.name = name - self.__explorers = None - self.__required_parameters = None - self.__optional_parameters = None - - def __repr__(self): - return '' % self.name - - @property - def path(self): - return os.path.join( - self.base_dir(), - self.name - ) - - @property - def is_singleton(self): - """Check whether a type is a singleton.""" - return os.path.isfile(os.path.join(self.path, "singleton")) - - @property - def is_install(self): - """Check whether a type is used for installation (if not: for configuration)""" - return os.path.isfile(os.path.join(self.path, "install")) - - @property - def explorers(self): - """Return a list of available explorers""" - if not self.__explorers: - try: - self.__explorers = os.listdir(os.path.join(self.path, "explorer")) - except EnvironmentError as e: - # error ignored - self.__explorers = [] - return self.__explorers - - @property - def required_parameters(self): - """Return a list of required parameters""" - if not self.__required_parameters: - parameters = [] - try: - with open(os.path.join(self.path, "parameter", "required")) as fd: - for line in fd: - parameters.append(line.strip()) - except EnvironmentError as e: - # error ignored - pass - finally: - self.__required_parameters = parameters - return self.__required_parameters - - @property - def optional_parameters(self): - """Return a list of optional parameters""" - if not self.__optional_parameters: - parameters = [] - try: - with open(os.path.join(self.path, "parameter", "optional")) as fd: - for line in fd: - parameters.append(line.strip()) - except EnvironmentError as e: - # error ignored - pass - finally: - self.__optional_parameters = parameters - return self.__optional_parameters +import cdist class Object(object): + """Represents a cdist object. + + All interaction with objects in cdist should be done through this class. + Directly accessing an object through the file system from python code is + a bug. + + """ @staticmethod def base_dir(): @@ -296,10 +41,14 @@ class Object(object): Requires the environment variable '__cdist_out_dir' to be set. """ - base_dir = os.path.join( - os.environ['__cdist_out_dir'], - 'object' - ) + try: + base_dir = os.path.join( + os.environ['__cdist_out_dir'], + 'object' + ) + except KeyError as e: + raise cdist.MissingEnvironmentVariableError(e.args[0]) + # FIXME: should directory be created elsewhere? if not os.path.isdir(base_dir): os.mkdir(base_dir) From 080ca10e193a1889f82d3be7f4bcffb352e1a1a8 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 6 Oct 2011 12:58:08 +0200 Subject: [PATCH 0376/1024] new package cdist.core Signed-off-by: Steven Armstrong --- lib/cdist/core/__init__.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lib/cdist/core/__init__.py diff --git a/lib/cdist/core/__init__.py b/lib/cdist/core/__init__.py new file mode 100644 index 00000000..80310ffc --- /dev/null +++ b/lib/cdist/core/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +__all__ = ['Type', 'Object'] + +from cdist.core.type import Type +from cdist.core.object import Object From aa1c13898aa6b66cb833036af43aef7facb0d363 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 13:00:00 +0200 Subject: [PATCH 0377/1024] add ideas about remote exec/copy Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot | 45 +++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot diff --git a/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot b/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot new file mode 100644 index 00000000..1dd9039d --- /dev/null +++ b/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot @@ -0,0 +1,45 @@ +Commands needed: + conf/cmd/remote_exec + conf/cmd/copy + +If ! conf/cmd/remote_exec: + use builtin +If ! conf/cmd/copy: + use builtin + + -> Depend on session! + +Builtin: + cdist.exec.run_or_fail(["scp", "-qr", source, + self.remote_user + "@" + + self.target_host + ":" + + destination]) + +self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] + + self.remote_user = remote_user + self.remote_prefix = remote_prefix + +-------------------------------------------------------------------------------- +What is in a session? + + base_dir + target_host + +-------------------------------------------------------------------------------- +remote_user + pseudo-static, can be hardcoded again +-------------------------------------------------------------------------------- + +Result: + +os.environ['__remote_exec'] = ["ssh", "-l", "root" ] +os.environ['__remote_copy'] = ["scp", "-o" "User=root" ] + +args for __remote_exec + $1 = hostname + $2 - ... = stuff to be executed in /bin/sh on remote side + +args for __remote_copy + $1 = file here + $2 = hostname:destination From 4de5f6f58ecef4068ccdd2e42f00268fe0693a1f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 6 Oct 2011 13:00:17 +0200 Subject: [PATCH 0378/1024] move Type into its own file Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 125 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 lib/cdist/core/type.py diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py new file mode 100644 index 00000000..c35e0ad8 --- /dev/null +++ b/lib/cdist/core/type.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import os + +import cdist + + +class Type(object): + + @staticmethod + def base_dir(): + """Return the absolute path to the top level directory where types + are defined. + + Requires the environment variable '__cdist_base_dir' to be set. + + """ + try: + return os.path.join( + os.environ['__cdist_base_dir'], + 'conf', + 'type' + ) + except KeyError as e: + raise cdist.MissingEnvironmentVariableError(e.args[0]) + + @classmethod + def list_types(cls): + """Return a list of type instances""" + for type_name in cls.list_type_names(): + yield cls(type_name) + + @classmethod + def list_type_names(cls): + """Return a list of type names""" + return os.listdir(cls.base_dir()) + + + def __init__(self, name): + self.name = name + self.__explorers = None + self.__required_parameters = None + self.__optional_parameters = None + + def __repr__(self): + return '' % self.name + + @property + def path(self): + return os.path.join( + self.base_dir(), + self.name + ) + + @property + def is_singleton(self): + """Check whether a type is a singleton.""" + return os.path.isfile(os.path.join(self.path, "singleton")) + + @property + def is_install(self): + """Check whether a type is used for installation (if not: for configuration)""" + return os.path.isfile(os.path.join(self.path, "install")) + + @property + def explorers(self): + """Return a list of available explorers""" + if not self.__explorers: + try: + self.__explorers = os.listdir(os.path.join(self.path, "explorer")) + except EnvironmentError as e: + # error ignored + self.__explorers = [] + return self.__explorers + + @property + def required_parameters(self): + """Return a list of required parameters""" + if not self.__required_parameters: + parameters = [] + try: + with open(os.path.join(self.path, "parameter", "required")) as fd: + for line in fd: + parameters.append(line.strip()) + except EnvironmentError as e: + # error ignored + pass + finally: + self.__required_parameters = parameters + return self.__required_parameters + + @property + def optional_parameters(self): + """Return a list of optional parameters""" + if not self.__optional_parameters: + parameters = [] + try: + with open(os.path.join(self.path, "parameter", "optional")) as fd: + for line in fd: + parameters.append(line.strip()) + except EnvironmentError as e: + # error ignored + pass + finally: + self.__optional_parameters = parameters + return self.__optional_parameters From 41ab7390dbb223415d15387507a9aaaccb585483 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 6 Oct 2011 13:02:08 +0200 Subject: [PATCH 0379/1024] use constant instead of string for .cdist Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index c136390e..80c2c351 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -22,6 +22,7 @@ import os import cdist +import cdist.path class Object(object): @@ -72,7 +73,7 @@ class Object(object): """Return a list of object names""" for path, dirs, files in os.walk(cls.base_dir()): # FIXME: use constant instead of string - if '.cdist' in dirs: + if cdist.path.DOT_CDIST in dirs: yield os.path.relpath(path, cls.base_dir()) def __init__(self, type, object_id=None, parameter=None, requirements=None): @@ -90,7 +91,7 @@ class Object(object): return os.path.join( self.base_dir(), self.qualified_name, - '.cdist' + cdist.path.DOT_CDIST ) @property From c0f04cab0f5e9ed0d0b70114111f46c6ad64dc90 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 13:20:05 +0200 Subject: [PATCH 0380/1024] more hints on env Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot b/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot index 1dd9039d..91f5d204 100644 --- a/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot +++ b/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot @@ -7,6 +7,12 @@ If ! conf/cmd/remote_exec: If ! conf/cmd/copy: use builtin +-------------------------------------------------------------------------------- + +--cmd-dir? +$__cdist_cmd_dir + +-------------------------------------------------------------------------------- -> Depend on session! Builtin: @@ -34,12 +40,26 @@ remote_user Result: os.environ['__remote_exec'] = ["ssh", "-l", "root" ] -os.environ['__remote_copy'] = ["scp", "-o" "User=root" ] + +os.environ['__remote_exec'] = ["ssh", "-o", "User=root" ] +os.environ['__remote_copy'] = ["scp", "-o", "User=root" ] args for __remote_exec $1 = hostname $2 - ... = stuff to be executed in /bin/sh on remote side + $2 - $7 = env + $7 - 12 = cmd + args for __remote_copy $1 = file here $2 = hostname:destination + +-------------------------------------------------------------------------------- +There needs to be an easy way to change those cmds! +-------------------------------------------------------------------------------- +Env-Passing: + _a=b test -> test can access $_a + _a=b test $_a -> $1 = "", because _a is *not* set within the shell + _a=b; test -> can access $_a + _a=b; test $_a -> $1 == "b" From a15972f20da781f61767b060a1243bb2a53ca5ad Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 6 Oct 2011 13:21:48 +0200 Subject: [PATCH 0381/1024] +docstring Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index c35e0ad8..126b4d16 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -25,6 +25,13 @@ import cdist class Type(object): + """Represents a cdist type. + + All interaction with types in cdist should be done through this class. + Directly accessing an type through the file system from python code is + a bug. + + """ @staticmethod def base_dir(): From eaf2b28fd7b9af740b511657ad66d2e3f52fa3cb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 13:34:28 +0200 Subject: [PATCH 0382/1024] more prefix ideas Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot b/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot index 91f5d204..ec89a999 100644 --- a/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot +++ b/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot @@ -44,6 +44,28 @@ os.environ['__remote_exec'] = ["ssh", "-l", "root" ] os.environ['__remote_exec'] = ["ssh", "-o", "User=root" ] os.environ['__remote_copy'] = ["scp", "-o", "User=root" ] + +__remote_exec=~/sudossh __remote_copy=... cdist config localhost + +~/sudossh hostname $@... +~/sudocopy a hostname:b + +~/chrootssh +~/chrootcopy + + + +a) + 3 cmd verzeichnnise: cdist, sudo, chroot + pro aufruf variable ändern + +b) + 1 dir, mit zeug + pro aufruf variablen ändern + + +conf/cmd/remote_exec + args for __remote_exec $1 = hostname $2 - ... = stuff to be executed in /bin/sh on remote side From ecc4fc10d73b8c56d2203e67803b3154a8a066f0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 13:34:45 +0200 Subject: [PATCH 0383/1024] setup __remote_exec and __remote_copy variables Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 51615c28..43d4bf51 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -297,6 +297,9 @@ def config(args): time_start = datetime.datetime.now() + os.environ['__remote_exec'] = ["ssh", "-o", "User=root" ] + os.environ['__remote_copy'] = ["scp", "-o", "User=root" ] + for host in args.host: c = Config(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) if args.parallel: From 278c379e077b398685db1ebff5d72ddcc4f9b78e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 13:37:12 +0200 Subject: [PATCH 0384/1024] use os.environ['__remote_exec'] in exec* Signed-off-by: Nico Schottelius --- lib/cdist/exec.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index 9cedefcc..aaa2c13f 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -20,6 +20,7 @@ # import logging +import os import subprocess log = logging.getLogger(__name__) @@ -32,7 +33,7 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): args[0][:0] = [ "/bin/sh", "-e" ] if remote_prefix: - args[0][:0] = remote_prefix + args[0][:0] = os.environ['__remote_exec'] log.debug("Shell exec cmd: %s", args) @@ -43,8 +44,8 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: log.error("Code that raised the error:\n") - if remote_prefix: - run_or_fail(["cat", script], remote_prefix=remote_prefix) + + run_or_fail(["cat", script], remote_prefix=remote_prefix) else: try: @@ -60,7 +61,7 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): def run_or_fail(*args, remote_prefix=False, **kargs): if remote_prefix: - args[0][:0] = remote_prefix + args[0][:0] = os.environ['__remote_exec'] log.debug("Exec: " + " ".join(*args)) try: From eea6a38f3342d38973fcc79ebdf4204dc94cc831 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 13:39:08 +0200 Subject: [PATCH 0385/1024] cat only locally :-) Signed-off-by: Nico Schottelius --- lib/cdist/exec.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index aaa2c13f..bb375404 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -45,7 +45,8 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): except subprocess.CalledProcessError: log.error("Code that raised the error:\n") - run_or_fail(["cat", script], remote_prefix=remote_prefix) + if remote_prefix: + run_or_fail(["cat", script], remote_prefix=remote_prefix) else: try: From df630e1fdf0da5049a802717e039baa75a2f734f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 13:40:46 +0200 Subject: [PATCH 0386/1024] user remote_prefix=True now Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 43d4bf51..81c5b3fc 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -38,23 +38,16 @@ class Config: def __init__(self, target_host, initial_manifest=False, - remote_user="root", home=None, exec_path=sys.argv[0], debug=False): self.target_host = target_host self.debug = debug - self.remote_user = remote_user self.exec_path = exec_path - # FIXME: broken - construct elsewhere! - self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] - self.path = cdist.path.Path(self.target_host, initial_manifest=initial_manifest, - remote_user=self.remote_user, - remote_prefix=self.remote_prefix, base_dir=home, debug=debug) @@ -78,7 +71,7 @@ class Config: cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) cmd.append(self.path.remote_global_explorer_path(explorer)) - cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=self.remote_prefix) + cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) output_fd.close() def run_type_explorer(self, cdist_object): @@ -105,7 +98,7 @@ class Config: log.debug("%s exploring %s using %s storing to %s", cdist_object, explorer, remote_cmd, output) - cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) + cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=True) output_fd.close() def link_emulator(self): @@ -235,8 +228,7 @@ class Config: remote_remote_code = os.path.join(remote_dir, "code-remote") if os.path.isfile(local_remote_code): self.path.transfer_file(local_remote_code, remote_remote_code) - # FIXME: remote_prefix - cdist.exec.run_or_fail([remote_remote_code], remote_prefix=self.remote_prefix) + cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" @@ -297,8 +289,8 @@ def config(args): time_start = datetime.datetime.now() - os.environ['__remote_exec'] = ["ssh", "-o", "User=root" ] - os.environ['__remote_copy'] = ["scp", "-o", "User=root" ] + os.environ['__remote_exec'] = "ssh -o User=root" + os.environ['__remote_copy'] = "scp -o User=root" for host in args.host: c = Config(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) From 59bee1410147bfc40eb6387d2363e27921e859a2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 14:02:37 +0200 Subject: [PATCH 0387/1024] begin to eliminate remote_user/prefix from path Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index e416c42d..721764bf 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -57,8 +57,6 @@ class Path: def __init__(self, target_host, - remote_user, - remote_prefix, initial_manifest=False, base_dir=None, debug=False): @@ -72,9 +70,6 @@ class Path: self.temp_dir = tempfile.mkdtemp() self.target_host = target_host - self.remote_user = remote_user - self.remote_prefix = remote_prefix - self.conf_dir = os.path.join(self.base_dir, "conf") self.cache_base_dir = os.path.join(self.base_dir, "cache") self.cache_dir = os.path.join(self.cache_base_dir, target_host) @@ -122,10 +117,10 @@ class Path: def remote_mkdir(self, directory): """Create directory on remote side""" - cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=self.remote_prefix) + cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) def remove_remote_dir(self, destination): - cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=self.remote_prefix) + cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) def transfer_dir(self, source, destination): """Transfer directory and previously delete the remote destination""" From 0d9906b0b8f678a2359bc6728aef81753d0456ef Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 6 Oct 2011 15:18:06 +0200 Subject: [PATCH 0388/1024] --typo, missing colon Signed-off-by: Steven Armstrong --- lib/cdist/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index 864b4f37..1f325a8c 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -29,7 +29,7 @@ class Error(Exception): class MissingEnvironmentVariableError(Error): """Raised when a required environment variable is not set.""" - def __init__(self, name) + def __init__(self, name): self.name = name def __str__(self): From 5a7e4b2f322aaf06fcb422b72fabbcda3ae9bbf8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 15:48:44 +0200 Subject: [PATCH 0389/1024] quiet ssh/scp Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 81c5b3fc..7b59d416 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -289,8 +289,8 @@ def config(args): time_start = datetime.datetime.now() - os.environ['__remote_exec'] = "ssh -o User=root" - os.environ['__remote_copy'] = "scp -o User=root" + os.environ['__remote_exec'] = "ssh -o User=root -q" + os.environ['__remote_copy'] = "scp -o User=root -q" for host in args.host: c = Config(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) From 919f67184a01bde6f45d3e36e1d94ff5a9503cbf Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 15:49:08 +0200 Subject: [PATCH 0390/1024] do not reference scp anymore Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 721764bf..a2b47610 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -125,17 +125,13 @@ class Path: def transfer_dir(self, source, destination): """Transfer directory and previously delete the remote destination""" self.remove_remote_dir(destination) - cdist.exec.run_or_fail(["scp", "-qr", source, - self.remote_user + "@" + - self.target_host + ":" + - destination]) + cdist.exec.run_or_fail([os.environ['__remote_copy'], "-r", source, + self.target_host + ":" + destination]) def transfer_file(self, source, destination): """Transfer file""" - cdist.exec.run_or_fail(["scp", "-q", source, - self.remote_user + "@" + - self.target_host + ":" + - destination]) + cdist.exec.run_or_fail([os.environ['__remote_copy'], source, + self.target_host + ":" + destination]) def global_explorer_output_path(self, explorer): """Returns path of the output for a global explorer""" From 26278b1e326a4b8951e6df433b9b352985968f71 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 16:28:21 +0200 Subject: [PATCH 0391/1024] expose target host from config Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 7b59d416..c027da17 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -43,6 +43,8 @@ class Config: debug=False): self.target_host = target_host + os.environ['target_host'] = target_host + self.debug = debug self.exec_path = exec_path From 8b561fd63ca886d20644d1e8f977258c9074947c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 16:30:06 +0200 Subject: [PATCH 0392/1024] fixup correct split/insert of os.environ() for target_host and args Signed-off-by: Nico Schottelius --- lib/cdist/exec.py | 8 ++++++-- lib/cdist/path.py | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index bb375404..a9b8d147 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -33,7 +33,9 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): args[0][:0] = [ "/bin/sh", "-e" ] if remote_prefix: - args[0][:0] = os.environ['__remote_exec'] + remote_prefix = os.environ['__remote_exec'].split() + remote_prefix.append(os.environ['target_host']) + args[0][:0] = remote_prefix log.debug("Shell exec cmd: %s", args) @@ -62,7 +64,9 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): def run_or_fail(*args, remote_prefix=False, **kargs): if remote_prefix: - args[0][:0] = os.environ['__remote_exec'] + remote_prefix = os.environ['__remote_exec'].split() + remote_prefix.append(os.environ['target_host']) + args[0][:0] = remote_prefix log.debug("Exec: " + " ".join(*args)) try: diff --git a/lib/cdist/path.py b/lib/cdist/path.py index a2b47610..85d1a87f 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -125,13 +125,13 @@ class Path: def transfer_dir(self, source, destination): """Transfer directory and previously delete the remote destination""" self.remove_remote_dir(destination) - cdist.exec.run_or_fail([os.environ['__remote_copy'], "-r", source, - self.target_host + ":" + destination]) + cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + + ["-r", source, self.target_host + ":" + destination]) def transfer_file(self, source, destination): """Transfer file""" - cdist.exec.run_or_fail([os.environ['__remote_copy'], source, - self.target_host + ":" + destination]) + cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + + [source, self.target_host + ":" + destination]) def global_explorer_output_path(self, explorer): """Returns path of the output for a global explorer""" From 063fc61291edc18b3c0205526f903dbee47b257c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 16:41:28 +0200 Subject: [PATCH 0393/1024] remove legacy manpage of cdist-type-emulator Signed-off-by: Nico Schottelius --- doc/man/man1/cdist-type-emulator.text | 56 --------------------------- 1 file changed, 56 deletions(-) delete mode 100644 doc/man/man1/cdist-type-emulator.text diff --git a/doc/man/man1/cdist-type-emulator.text b/doc/man/man1/cdist-type-emulator.text deleted file mode 100644 index 507c1054..00000000 --- a/doc/man/man1/cdist-type-emulator.text +++ /dev/null @@ -1,56 +0,0 @@ -cdist-type-emulator(1) -====================== -Nico Schottelius - - -NAME ----- -cdist-type-emulator - Emulate type and record parameters and dependencies - - -SYNOPSIS --------- -cdist-type-emulator [TYPE ARGS] - - -DESCRIPTION ------------ -cdist-type-emulator is normally called through a link to it of the -name of a specifc type. It saves the given parameters into -a parameters directory and the requirements into a require file. - -It checks whether the parameters are valid: - -- are required parameter given? -- are all other required parameters specified as optional? - - -EXAMPLES --------- -Your manifest may contain stuff like this: - - --------------------------------------------------------------------------------- -__addifnosuchline /tmp/linetest --line "test" - -__motd --------------------------------------------------------------------------------- - -In both cases, cdist-type-emulator is called instead of a real type. -In the first case, the object id "/tmp/linetest" is recorded and the -parameter "line" stored with the content "test". - -In the second case, __motd must be decleared as a singleton, as the -object id is missing. - - -SEE ALSO --------- -- cdist(7) -- cdist-type-build-emulation(1) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). From afa3920ca987347c50ffd44f9b4d11a3d28f37d3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 16:42:45 +0200 Subject: [PATCH 0394/1024] remove more obsolete manpages Signed-off-by: Nico Schottelius --- doc/man/man1/cdist-config.text | 48 ----------------------------- doc/man/man1/cdist-env.text | 49 ------------------------------ doc/man/man1/cdist-quickstart.text | 47 ---------------------------- 3 files changed, 144 deletions(-) delete mode 100644 doc/man/man1/cdist-config.text delete mode 100644 doc/man/man1/cdist-env.text delete mode 100644 doc/man/man1/cdist-quickstart.text diff --git a/doc/man/man1/cdist-config.text b/doc/man/man1/cdist-config.text deleted file mode 100644 index 0c8b0735..00000000 --- a/doc/man/man1/cdist-config.text +++ /dev/null @@ -1,48 +0,0 @@ -cdist-config(1) -=============== -Nico Schottelius - - -NAME ----- -cdist-config - Read basic cdist configuration - - -DESCRIPTION ------------ -Cdist-config is sourced by cdist programs and provides hints on where to find -types, manifests, etc. Generally speaking, it's just usable from within the -core and is only of interest for cdist-developers. - - -ENVIRONMENT VARIABLES ---------------------- -The following list contains environment variables that are known -to be changed by users in various situations. To change the variable, -use your current shell and export it, so all cdist-binaries know about it. - -__cdist_tmp_base_dir:: - Normally this points to /tmp. In case /tmp is not suitable for - cdist (i.e. has noexec flag setup) you can change this variable - to point to a better location. - - -EXAMPLES --------- - -If /tmp has the noexec flag, you can use $HOME/.tmp for instance: - --------------------------------------------------------------------------------- -export __cdist_tmp_base_dir=$HOME/.tmp --------------------------------------------------------------------------------- - - -SEE ALSO --------- -cdist(7) - - -COPYING -------- -Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-env.text b/doc/man/man1/cdist-env.text deleted file mode 100644 index 9a736133..00000000 --- a/doc/man/man1/cdist-env.text +++ /dev/null @@ -1,49 +0,0 @@ -cdist-env(1) -============ -Nico Schottelius - - -NAME ----- -cdist-env - Setup environment for using cdist - - -SYNOPSIS --------- -cdist-env - - -DESCRIPTION ------------ -cdist-env outputs two strings suitable for usage in your current shell, -so you can use cdist from the checkout. cdist-env essentially helps you -to easily setup PATH and MANPATH. - -If you've multiple checkouts of cdist and run cdist-env from the various -checkouts, a new run will prepend the last directory, thus ensures you -can run it multiple times and does what one expects. - -EXAMPLES --------- -For use in bourne shell variants (like dash, bash, ksh) as well as -in csh variants (csh, tcsh): - --------------------------------------------------------------------------------- -eval `./bin/cdist-env` --------------------------------------------------------------------------------- - -For bourne shell, there is also a shorter version: --------------------------------------------------------------------------------- -. ./bin/cdist-env --------------------------------------------------------------------------------- - - -SEE ALSO --------- -cdist(7) - - -COPYING -------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/man1/cdist-quickstart.text b/doc/man/man1/cdist-quickstart.text deleted file mode 100644 index 087fd2d5..00000000 --- a/doc/man/man1/cdist-quickstart.text +++ /dev/null @@ -1,47 +0,0 @@ -cdist-quickstart(1) -=================== -Nico Schottelius - -NAME ----- -cdist-quickstart - Make use of cinit in 5 minutes - - -SYNOPSIS --------- -cdist-quickstart - - -DESCRIPTION ------------ -cdist-quickstart is an interactive guide to cdist. It should be one -of the first tools you use when you begin with cdist. - - -EXAMPLES --------- -To use cdist-quickstart, add the bin directory to your PATH, execute -cdist-quickstart and enjoy cdist: - --------------------------------------------------------------------------------- -# Bourne shell example -export PATH=$(pwd -P)/bin:$PATH - -# Alternatively, usable for csh and bsh, set's up PATH and MANPATH -eval `./bin/cdist-env` - -# Let's go! -cdist-quickstart --------------------------------------------------------------------------------- - - -SEE ALSO --------- -- cdist(7) -- cdist-env(1) - - -COPYING -------- -Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). From 7c11fa09378e63c49a52114f80f5d9e00919453f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 16:49:27 +0200 Subject: [PATCH 0395/1024] introduce unclear changes (names not yet decided) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 632ddb45..798c90e0 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,6 +1,7 @@ 2.0.3: * Improved logging, added --verbose, by more quiet by default * Bugfix __user: Correct quoting (Steven Armstrong) + * FIXME: Support for __remote_exec and __remote_copy 2.0.2: 2011-09-27 * Add support for detection of OpenWall Linux (Matthias Teege) From 1c8a14339759aece4029e8ca8452b22bca3a9753 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 16:52:56 +0200 Subject: [PATCH 0396/1024] commit previously missed change Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 429 +++++++++++++++++------------------- 1 file changed, 202 insertions(+), 227 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 39ee79c6..4829061b 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -31,276 +31,251 @@ import cdist.path log = logging.getLogger(__name__) -CODE_HEADER = "#!/bin/sh -e\n" +CODE_HEADER = "#!/bin/sh -e\n" class ConfigInstall: - """Class to hold install and config methods""" + """Cdist main class to hold arbitrary data""" - def __init__(self, target_host, - initial_manifest=False, - remote_user="root", - home=None, - exec_path=sys.argv[0], - debug=False): + def __init__(self, target_host, + initial_manifest=False, + home=None, + exec_path=sys.argv[0], + debug=False): - self.target_host = target_host - self.debug = debug - self.remote_user = remote_user - self.exec_path = exec_path + self.target_host = target_host + os.environ['target_host'] = target_host - # FIXME: broken - construct elsewhere! - self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] + self.debug = debug + self.exec_path = exec_path - self.path = cdist.path.Path(self.target_host, - initial_manifest=initial_manifest, - remote_user=self.remote_user, - remote_prefix=self.remote_prefix, - base_dir=home, - debug=debug) - - self.objects_prepared = [] + self.path = cdist.path.Path(self.target_host, + initial_manifest=initial_manifest, + base_dir=home, + debug=debug) + + self.objects_prepared = [] - def cleanup(self): - self.path.cleanup() + def cleanup(self): + self.path.cleanup() - def run_global_explorers(self): - """Run global explorers""" - log.info("Running global explorers") - explorers = self.path.list_global_explorers() - if(len(explorers) == 0): - raise CdistError("No explorers found in ", self.path.global_explorer_dir) + def run_global_explores(self): + """Run global explorers""" + log.info("Running global explorers") + explorers = self.path.list_global_explorers() + if(len(explorers) == 0): + raise CdistError("No explorers found in", self.path.global_explorer_dir) - self.path.transfer_global_explorers() - for explorer in explorers: - output = self.path.global_explorer_output_path(explorer) - output_fd = open(output, mode='w') - cmd = [] - cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append(self.path.remote_global_explorer_path(explorer)) + self.path.transfer_global_explorers() + for explorer in explorers: + output = self.path.global_explorer_output_path(explorer) + output_fd = open(output, mode='w') + cmd = [] + cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append(self.path.remote_global_explorer_path(explorer)) - cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=self.remote_prefix) - output_fd.close() + cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) + output_fd.close() -# FIXME: where to call this from? - def run_type_explorer(self, cdist_object): - """Run type specific explorers for objects""" + def run_type_explorer(self, cdist_object): + """Run type specific explorers for objects""" - type = self.path.get_type_from_object(cdist_object) - self.path.transfer_type_explorers(type) + type = self.path.get_type_from_object(cdist_object) + self.path.transfer_type_explorers(type) - cmd = [] - cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append("__type_explorer=" + self.path.remote_type_explorer_dir(type)) - cmd.append("__object=" + self.path.remote_object_dir(cdist_object)) - cmd.append("__object_id=" + self.path.get_object_id_from_object(cdist_object)) - cmd.append("__object_fq=" + cdist_object) + cmd = [] + cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) + cmd.append("__type_explorer=" + self.path.remote_type_explorer_dir(type)) + cmd.append("__object=" + self.path.remote_object_dir(cdist_object)) + cmd.append("__object_id=" + self.path.get_object_id_from_object(cdist_object)) + cmd.append("__object_fq=" + cdist_object) - # Need to transfer at least the parameters for objects to be useful - self.path.transfer_object_parameter(cdist_object) + # Need to transfer at least the parameters for objects to be useful + self.path.transfer_object_parameter(cdist_object) - # FIXME: Broken due to refactoring into type.py - explorers = self.path.list_type_explorers(type) - for explorer in explorers: - remote_cmd = cmd + [os.path.join(self.path.remote_type_explorer_dir(type), explorer)] - output = os.path.join(self.path.type_explorer_output_dir(cdist_object), explorer) - output_fd = open(output, mode='w') - log.debug("%s exploring %s using %s storing to %s", - cdist_object, explorer, remote_cmd, output) - - cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=self.remote_prefix) - output_fd.close() + explorers = self.path.list_type_explorers(type) + for explorer in explorers: + remote_cmd = cmd + [os.path.join(self.path.remote_type_explorer_dir(type), explorer)] + output = os.path.join(self.path.type_explorer_output_dir(cdist_object), explorer) + output_fd = open(output, mode='w') + log.debug("%s exploring %s using %s storing to %s", + cdist_object, explorer, remote_cmd, output) + + cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=True) + output_fd.close() - def link_emulator(self): - """Link emulator to types""" - cdist.emulator.link(self.exec_path, - self.path.bin_dir, self.path.list_types()) + def link_emulator(self): + """Link emulator to types""" + cdist.emulator.link(self.exec_path, + self.path.bin_dir, self.path.list_types()) - def init_deploy(self): - """Ensure the base directories are cleaned up""" - log.debug("Creating clean directory structure") + def init_deploy(self): + """Ensure the base directories are cleaned up""" + log.debug("Creating clean directory structure") - self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) - self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) - self.link_emulator() + self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) + self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) + self.link_emulator() - def run_initial_manifest(self): - """Run the initial manifest""" - log.info("Running initial manifest %s", self.path.initial_manifest) - env = { "__manifest" : self.path.manifest_dir } - self.run_manifest(self.path.initial_manifest, extra_env=env) + def run_initial_manifest(self): + """Run the initial manifest""" + log.info("Running initial manifest %s", self.path.initial_manifest) + env = { "__manifest" : self.path.manifest_dir } + self.run_manifest(self.path.initial_manifest, extra_env=env) - def run_type_manifest(self, cdist_object): - """Run manifest for a specific object""" - type = self.path.get_type_from_object(cdist_object) - manifest = self.path.type_dir(type, "manifest") - - log.debug("%s: Running %s", cdist_object, manifest) - if os.path.exists(manifest): - env = { "__object" : self.path.object_dir(cdist_object), - "__object_id": self.path.get_object_id_from_object(cdist_object), - "__object_fq": cdist_object, - "__type": self.path.type_dir(type) - } - self.run_manifest(manifest, extra_env=env) + def run_type_manifest(self, cdist_object): + """Run manifest for a specific object""" + type = self.path.get_type_from_object(cdist_object) + manifest = self.path.type_dir(type, "manifest") + + log.debug("%s: Running %s", cdist_object, manifest) + if os.path.exists(manifest): + env = { "__object" : self.path.object_dir(cdist_object), + "__object_id": self.path.get_object_id_from_object(cdist_object), + "__object_fq": cdist_object, + "__type": self.path.type_dir(type) + } + self.run_manifest(manifest, extra_env=env) - def run_manifest(self, manifest, extra_env=None): - """Run a manifest""" - log.debug("Running manifest %s, env=%s", manifest, extra_env) - env = os.environ.copy() - env['PATH'] = self.path.bin_dir + ":" + env['PATH'] + def run_manifest(self, manifest, extra_env=None): + """Run a manifest""" + log.debug("Running manifest %s, env=%s", manifest, extra_env) + env = os.environ.copy() + env['PATH'] = self.path.bin_dir + ":" + env['PATH'] - # Information required in every manifest - env['__target_host'] = self.target_host - env['__global'] = self.path.out_dir - - # Submit debug flag to manifest, can be used by emulator and types - if self.debug: - env['__debug'] = "yes" + # Information required in every manifest + env['__target_host'] = self.target_host + env['__global'] = self.path.out_dir + + # Submit debug flag to manifest, can be used by emulator and types + if self.debug: + env['__debug'] = "yes" - # Required for recording source - env['__cdist_manifest'] = manifest + # Required for recording source + env['__cdist_manifest'] = manifest - # Required to find types - env['__cdist_type_base_dir'] = self.path.type_base_dir + # Required to find types + env['__cdist_type_base_dir'] = self.path.type_base_dir - # Other environment stuff - if extra_env: - env.update(extra_env) + # Other environment stuff + if extra_env: + env.update(extra_env) - cdist.exec.shell_run_or_debug_fail(manifest, [manifest], env=env) + cdist.exec.shell_run_or_debug_fail(manifest, [manifest], env=env) - def object_run(self, cdist_object, mode): - """Run gencode or code for an object""" - log.debug("Running %s from %s", mode, cdist_object) - file=os.path.join(self.path.object_dir(cdist_object), "require") - requirements = cdist.path.file_to_list(file) - type = self.path.get_type_from_object(cdist_object) - - for requirement in requirements: - log.debug("Object %s requires %s", cdist_object, requirement) - self.object_run(requirement, mode=mode) + def object_run(self, cdist_object, mode): + """Run gencode or code for an object""" + log.debug("Running %s from %s", mode, cdist_object) + file=os.path.join(self.path.object_dir(cdist_object), "require") + requirements = cdist.path.file_to_list(file) + type = self.path.get_type_from_object(cdist_object) + + for requirement in requirements: + log.debug("Object %s requires %s", cdist_object, requirement) + self.object_run(requirement, mode=mode) - # - # Setup env Variable: - # - env = os.environ.copy() - env['__target_host'] = self.target_host - env['__global'] = self.path.out_dir - env["__object"] = self.path.object_dir(cdist_object) - env["__object_id"] = self.path.get_object_id_from_object(cdist_object) - env["__object_fq"] = cdist_object - env["__type"] = self.path.type_dir(type) + # + # Setup env Variable: + # + env = os.environ.copy() + env['__target_host'] = self.target_host + env['__global'] = self.path.out_dir + env["__object"] = self.path.object_dir(cdist_object) + env["__object_id"] = self.path.get_object_id_from_object(cdist_object) + env["__object_fq"] = cdist_object + env["__type"] = self.path.type_dir(type) - if mode == "gencode": - paths = [ - self.path.type_dir(type, "gencode-local"), - self.path.type_dir(type, "gencode-remote") - ] - for bin in paths: - if os.path.isfile(bin): - # omit "gen" from gencode and use it for output base - outfile=os.path.join(self.path.object_dir(cdist_object), - os.path.basename(bin)[3:]) + if mode == "gencode": + paths = [ + self.path.type_dir(type, "gencode-local"), + self.path.type_dir(type, "gencode-remote") + ] + for bin in paths: + if os.path.isfile(bin): + # omit "gen" from gencode and use it for output base + outfile=os.path.join(self.path.object_dir(cdist_object), + os.path.basename(bin)[3:]) - outfile_fd = open(outfile, "w") + outfile_fd = open(outfile, "w") - # Need to flush to ensure our write is done before stdout write - # FIXME: CODE_HEADER needed in our sh -e scenario? - outfile_fd.write(CODE_HEADER) - outfile_fd.flush() + # Need to flush to ensure our write is done before stdout write + outfile_fd.write(CODE_HEADER) + outfile_fd.flush() - cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) - outfile_fd.close() + cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) + outfile_fd.close() - status = os.stat(outfile) + status = os.stat(outfile) - # Remove output if empty, else make it executable - if status.st_size == len(CODE_HEADER): - os.unlink(outfile) - else: - # Add header and make executable - identically to 0o700 - os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + # Remove output if empty, else make it executable + if status.st_size == len(CODE_HEADER): + os.unlink(outfile) + else: + # Add header and make executable - identically to 0o700 + os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) - # Mark object as changed - open(os.path.join(self.path.object_dir(cdist_object), "changed"), "w").close() + # Mark object as changed + open(os.path.join(self.path.object_dir(cdist_object), "changed"), "w").close() - if mode == "code": - local_dir = self.path.object_dir(cdist_object) - remote_dir = self.path.remote_object_dir(cdist_object) + if mode == "code": + local_dir = self.path.object_dir(cdist_object) + remote_dir = self.path.remote_object_dir(cdist_object) - bin = os.path.join(local_dir, "code-local") - if os.path.isfile(bin): - cdist.exec.run_or_fail([bin]) - + bin = os.path.join(local_dir, "code-local") + if os.path.isfile(bin): + cdist.exec.run_or_fail([bin]) + - local_remote_code = os.path.join(local_dir, "code-remote") - remote_remote_code = os.path.join(remote_dir, "code-remote") - if os.path.isfile(local_remote_code): - self.path.transfer_file(local_remote_code, remote_remote_code) - # FIXME: remote_prefix - cdist.exec.run_or_fail([remote_remote_code], remote_prefix=self.remote_prefix) - - def stage_prepare(self): - """Do everything for a deploy, minus the actual code stage""" - self.init_deploy() - self.run_global_explorers() - self.run_initial_manifest() - - log.info("Running object manifests and type explorers") + local_remote_code = os.path.join(local_dir, "code-remote") + remote_remote_code = os.path.join(remote_dir, "code-remote") + if os.path.isfile(local_remote_code): + self.path.transfer_file(local_remote_code, remote_remote_code) + cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) + + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" + self.init_deploy() + self.run_global_explores() + self.run_initial_manifest() + + log.info("Running object manifests and type explorers") - old_objects = [] - objects = self.path.list_objects() + old_objects = [] + objects = self.path.list_objects() - # Continue process until no new objects are created anymore - while old_objects != objects: - old_objects = list(objects) - for cdist_object in objects: - if cdist_object in self.objects_prepared: - log.debug("Skipping rerun of object %s", cdist_object) - continue - else: - # FIXME: run_type_explorer: - # object can return type - # type has explorers - # path knows about where to save explorer output - # type = self.path.objects[object].type() - # self.path.types['type'].explorers() - # for explorer in explorers: - # output = cdist.exec.run_debug_or_fail_shell(explorer) - # if output: - # write_output_to(output, os.path.join(self.path.objects[object].explorer_dir(),explorer) ) - # - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - self.objects_prepared.append(cdist_object) + # Continue process until no new objects are created anymore + while old_objects != objects: + old_objects = list(objects) + for cdist_object in objects: + if cdist_object in self.objects_prepared: + log.debug("Skipping rerun of object %s", cdist_object) + continue + else: + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + self.objects_prepared.append(cdist_object) - objects = self.path.list_objects() + objects = self.path.list_objects() - def stage_run(self): - """The final (and real) step of deployment""" - log.info("Generating and executing code") - # Now do the final steps over the existing objects - for cdist_object in self.path.list_objects(): - log.debug("Run object: %s", cdist_object) - self.object_run(cdist_object, mode="gencode") - self.object_run(cdist_object, mode="code") + def stage_run(self): + """The final (and real) step of deployment""" + log.info("Generating and executing code") + # Now do the final steps over the existing objects + for cdist_object in self.path.list_objects(): + log.debug("Run object: %s", cdist_object) + self.object_run(cdist_object, mode="gencode") + self.object_run(cdist_object, mode="code") - def deploy_to(self): - """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.target_host) - time_start = datetime.datetime.now() + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + log.info("Deploying to " + self.target_host) + time_start = datetime.datetime.now() - self.stage_prepare() - self.stage_run() + self.stage_prepare() + self.stage_run() - time_end = datetime.datetime.now() - duration = time_end - time_start - log.info("Finished run of %s in %s seconds", - self.target_host, - duration.total_seconds()) - - def deploy_and_cleanup(self): - """Do what is most often done: deploy & cleanup""" - self.deploy_to() - self.cleanup() + time_end = datetime.datetime.now() + duration = time_end - time_start + log.info("Finished run of %s in %s seconds", + self.target_host, + duration.total_seconds()) From 8341e0cc0f964ad8e3c9b301e3c548b953fe7d9a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 16:54:47 +0200 Subject: [PATCH 0397/1024] think about the __init_script type (probably raise discussion) Signed-off-by: Nico Schottelius --- other/types_pending_inclusion/__init_script/README | 4 ++++ .../types_pending_inclusion}/__init_script/gencode-remote | 0 .../types_pending_inclusion}/__init_script/man.text | 0 .../types_pending_inclusion}/__init_script/parameter/optional | 0 .../types_pending_inclusion}/__init_script/parameter/required | 0 5 files changed, 4 insertions(+) create mode 100644 other/types_pending_inclusion/__init_script/README rename {conf/type => other/types_pending_inclusion}/__init_script/gencode-remote (100%) rename {conf/type => other/types_pending_inclusion}/__init_script/man.text (100%) rename {conf/type => other/types_pending_inclusion}/__init_script/parameter/optional (100%) rename {conf/type => other/types_pending_inclusion}/__init_script/parameter/required (100%) diff --git a/other/types_pending_inclusion/__init_script/README b/other/types_pending_inclusion/__init_script/README new file mode 100644 index 00000000..f2621f12 --- /dev/null +++ b/other/types_pending_inclusion/__init_script/README @@ -0,0 +1,4 @@ +Moved out of conf/type/ to think about whether this type makes sense or not. + +Cdist describes the state and using an init_script may be useful, but +should only be used conditionally. diff --git a/conf/type/__init_script/gencode-remote b/other/types_pending_inclusion/__init_script/gencode-remote similarity index 100% rename from conf/type/__init_script/gencode-remote rename to other/types_pending_inclusion/__init_script/gencode-remote diff --git a/conf/type/__init_script/man.text b/other/types_pending_inclusion/__init_script/man.text similarity index 100% rename from conf/type/__init_script/man.text rename to other/types_pending_inclusion/__init_script/man.text diff --git a/conf/type/__init_script/parameter/optional b/other/types_pending_inclusion/__init_script/parameter/optional similarity index 100% rename from conf/type/__init_script/parameter/optional rename to other/types_pending_inclusion/__init_script/parameter/optional diff --git a/conf/type/__init_script/parameter/required b/other/types_pending_inclusion/__init_script/parameter/required similarity index 100% rename from conf/type/__init_script/parameter/required rename to other/types_pending_inclusion/__init_script/parameter/required From 220611604b5ecc8c01a2f592c99f1ff793c7b26e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 17:00:09 +0200 Subject: [PATCH 0398/1024] +: Signed-off-by: Nico Schottelius --- lib/cdist/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index 864b4f37..1f325a8c 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -29,7 +29,7 @@ class Error(Exception): class MissingEnvironmentVariableError(Error): """Raised when a required environment variable is not set.""" - def __init__(self, name) + def __init__(self, name): self.name = name def __str__(self): From 60b5f8783c56b405c4b13105dbd4bfeeb9671b6e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 17:02:37 +0200 Subject: [PATCH 0399/1024] revert changes from upcoming install branch Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 7 +++---- lib/cdist/install.py | 3 --- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 657714a4..0ae41174 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -22,13 +22,15 @@ import datetime import logging -log = logging.getLogger(__name__) +import sys import cdist.emulator import cdist.path CODE_HEADER = "#!/bin/sh -e\n" +log = logging.getLogger(__name__) + class Config: """Cdist main class to hold arbitrary data""" @@ -276,9 +278,6 @@ class Config: self.target_host, duration.total_seconds()) -class Config(cdist.config_install.ConfigInstall): - pass - def config(args): """Configure remote system""" process = {} diff --git a/lib/cdist/install.py b/lib/cdist/install.py index 5a35626d..87714fa8 100644 --- a/lib/cdist/install.py +++ b/lib/cdist/install.py @@ -27,9 +27,6 @@ import cdist.config_install log = logging.getLogger(__name__) -Class Install(cdist.config_install.ConfigInstall): - pass - def install(args): """Install remote system""" process = {} From 12dc0d2bddcbb55c98727126f2fd0747edd87060 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 6 Oct 2011 17:15:45 +0200 Subject: [PATCH 0400/1024] cleanup and file system backed properties Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 58 ++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 80c2c351..127bf038 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -20,9 +20,13 @@ # import os +import collections import cdist -import cdist.path +import cdist.core.property + + +DOT_CDIST = '.cdist' class Object(object): @@ -73,27 +77,64 @@ class Object(object): """Return a list of object names""" for path, dirs, files in os.walk(cls.base_dir()): # FIXME: use constant instead of string - if cdist.path.DOT_CDIST in dirs: + if DOT_CDIST in dirs: yield os.path.relpath(path, cls.base_dir()) - def __init__(self, type, object_id=None, parameter=None, requirements=None): + def __init__(self, type, object_id=None, parameters=None, requirements=None): self.type = type # instance of Type self.object_id = object_id - self.qualified_name = os.path.join(self.type.name, self.object_id) - self.parameter = parameter or {} + self.name = os.path.join(self.type.name, self.object_id) + self.parameters = parameters or {} self.requirements = requirements or [] + + self.__parameters = None + self.__requirements = None def __repr__(self): - return '' % self.qualified_name + return '' % self.name @property def path(self): return os.path.join( self.base_dir(), - self.qualified_name, - cdist.path.DOT_CDIST + self.name, + DOT_CDIST ) + + ### requirements + @property + def requirements(self): + if not self.__requirements: + self.__requirements = cdist.core.property.FileList(os.path.join(self.path, "require")) + return self.__requirements + + @requirements.setter + def requirements(self, value): + if isinstance(value, cdist.core.property.FileList): + self.__requirements = value + else: + self.__requirements = cdist.core.property.FileList(os.path.join(self.path, "require"), value) + ### /requirements + + + ### parameters + @property + def parameters(self): + if not self.__parameters: + self.__parameters = cdist.core.property.DirectoryDict(os.path.join(self.path, "parameter")) + return self.__parameters + + @parameters.setter + def parameters(self, value): + if isinstance(value, cdist.core.property.DirectoryDict): + self.__parameters = value + else: + self.__parameters = cdist.core.property.DirectoryDict(os.path.join(self.path, "parameter"), value) + ### /parameters + + + ### changed @property def changed(self): """Check whether the object has been changed.""" @@ -111,5 +152,6 @@ class Object(object): except EnvironmentError: # ignore pass + ### /changed # FIXME: implement other properties/methods From 3a1cea68873f585529dcfab5b0d7dc3a7df58942 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 6 Oct 2011 17:16:12 +0200 Subject: [PATCH 0401/1024] file system backed properties Signed-off-by: Steven Armstrong --- lib/cdist/core/property.py | 119 +++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 lib/cdist/core/property.py diff --git a/lib/cdist/core/property.py b/lib/cdist/core/property.py new file mode 100644 index 00000000..e22e33cd --- /dev/null +++ b/lib/cdist/core/property.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import os +import collections + +import cdist + + +DOT_CDIST = '.cdist' + + +class FileList(collections.MutableSequence): + """A list that stores it's state in a file. + + """ + def __init__(self, path, initial=None): + self._path = path + if initial: + for i in initial: + self.append(i) + + def __read(self): + lines = [] + try: + with open(self._path) as fd: + for line in fd: + lines.append(line.strip()) + except EnvironmentError as e: + # error ignored + pass + return lines + + def __write(self, lines): + try: + with open(self._path, 'w') as fd: + for line in lines: + fd.write(line + '\n') + except EnvironmentError as e: + # error ignored + raise + + def __repr__(self): + return repr(list(self)) + + def __getitem__(self, index): + return self.__read()[index] + + def __setitem__(self, index, value): + lines = self.__read() + lines[index] = value + self.__write(lines) + + def __delitem__(self, index): + lines = self.__read() + del lines[index] + self.__write(lines) + + def __len__(self): + lines = self.__read() + return len(lines) + + def insert(self, index, value): + lines = self.__read() + lines.insert(index, value) + self.__write(lines) + + +class DirectoryDict(collections.MutableMapping): + """A dict that stores it's state in a directory. + + """ + def __init__(self, path, dict=None, **kwargs): + self._path = path + if dict is not None: + self.update(dict) + if len(kwargs): + self.update(kwargs) + + def __repr__(self): + return repr(dict(self)) + + def __getitem__(self, key): + try: + with open(os.path.join(self._path, key), "r") as fd: + return fd.read() + except EnvironmentError: + raise KeyError(key) + + def __setitem__(self, key, value): + with open(os.path.join(self._path, key), "w") as fd: + fd.write(value) + + def __delitem__(self, key): + os.remove(os.path.join(self._path, key)) + + def __iter__(self): + return iter(os.listdir(self._path)) + + def __len__(self): + return len(os.listdir(self._path)) From c0854ebb2e00041fd1f3d69dacaff86c52f8962b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 6 Oct 2011 17:47:08 +0200 Subject: [PATCH 0402/1024] remove unused constant Signed-off-by: Steven Armstrong --- lib/cdist/core/property.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/cdist/core/property.py b/lib/cdist/core/property.py index e22e33cd..790ff802 100644 --- a/lib/cdist/core/property.py +++ b/lib/cdist/core/property.py @@ -25,9 +25,6 @@ import collections import cdist -DOT_CDIST = '.cdist' - - class FileList(collections.MutableSequence): """A list that stores it's state in a file. From df5de24b72cf98c6ca091b11fbf827758dd78d1c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 18:26:55 +0200 Subject: [PATCH 0403/1024] begin use of cdist.core.Object.list_objects() Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index c7c592a5..b6d7451b 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -29,6 +29,8 @@ import sys import cdist.emulator import cdist.path +import cdist.core + log = logging.getLogger(__name__) CODE_HEADER = "#!/bin/sh -e\n" @@ -108,14 +110,6 @@ class ConfigInstall: cdist.emulator.link(self.exec_path, self.path.bin_dir, self.path.list_types()) - def init_deploy(self): - """Ensure the base directories are cleaned up""" - log.debug("Creating clean directory structure") - - self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) - self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) - self.link_emulator() - def run_initial_manifest(self): """Run the initial manifest""" log.info("Running initial manifest %s", self.path.initial_manifest) @@ -241,11 +235,11 @@ class ConfigInstall: log.info("Running object manifests and type explorers") old_objects = [] - objects = self.path.list_objects() + objects = cdist.core.Object.list_objects() # Continue process until no new objects are created anymore while old_objects != objects: - old_objects = list(objects) + old_objects = objects for cdist_object in objects: if cdist_object in self.objects_prepared: log.debug("Skipping rerun of object %s", cdist_object) @@ -255,7 +249,7 @@ class ConfigInstall: self.run_type_manifest(cdist_object) self.objects_prepared.append(cdist_object) - objects = self.path.list_objects() + objects = cdist.core.Object.list_objects() def stage_run(self): """The final (and real) step of deployment""" @@ -285,3 +279,11 @@ class ConfigInstall: self.deploy_to() self.cleanup() + ### Cleaned / check functions: Round 1 :-) ################################# + def init_deploy(self): + """Ensure the base directories are cleaned up""" + log.debug("Creating clean directory structure") + + self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) + self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) + self.link_emulator() From 2157cef2a6048a61ef9708269b2dc4a0c1ed38d2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 19:22:08 +0200 Subject: [PATCH 0404/1024] make cdist.MissingEnvironmentVariableError print the key and not fail :-) Signed-off-by: Nico Schottelius --- lib/cdist/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index 1f325a8c..fcfa3693 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -33,4 +33,4 @@ class MissingEnvironmentVariableError(Error): self.name = name def __str__(self): - return 'Missing required environment variable: {0.name}'.format(o) + return 'Missing required environment variable: ' + str(self.name) From 5c9694215ca4943c5209062d9394c5ee1194df7e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 19:26:58 +0200 Subject: [PATCH 0405/1024] setup '__cdist_out_dir' in path for use in Object Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index c45ddcd6..73a90302 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -68,6 +68,8 @@ class Path: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) self.temp_dir = tempfile.mkdtemp() + os.environ['__cdist_out_dir'] = self.temp_dir + self.target_host = target_host # Input directories From 344bfb06030f4ebe4e59efe755d642f52893765a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 19:40:19 +0200 Subject: [PATCH 0406/1024] was the object prepared/ran? Signed-off-by: Nico Schottelius --- lib/cdist/core/object.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 127bf038..544f7565 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -89,6 +89,10 @@ class Object(object): self.__parameters = None self.__requirements = None + + # Whether this object was prepared/ran + self.prepared = False + self.ran = False def __repr__(self): return '' % self.name From 8305f07aab6c7c9b57ce2d69045a4550b3fcfadd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 19:43:07 +0200 Subject: [PATCH 0407/1024] stage prepare uses new object interface Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 48 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index b6d7451b..b1db2855 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -226,31 +226,6 @@ class ConfigInstall: self.path.transfer_file(local_remote_code, remote_remote_code) cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) - def stage_prepare(self): - """Do everything for a deploy, minus the actual code stage""" - self.init_deploy() - self.run_global_explores() - self.run_initial_manifest() - - log.info("Running object manifests and type explorers") - - old_objects = [] - objects = cdist.core.Object.list_objects() - - # Continue process until no new objects are created anymore - while old_objects != objects: - old_objects = objects - for cdist_object in objects: - if cdist_object in self.objects_prepared: - log.debug("Skipping rerun of object %s", cdist_object) - continue - else: - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - self.objects_prepared.append(cdist_object) - - objects = cdist.core.Object.list_objects() - def stage_run(self): """The final (and real) step of deployment""" log.info("Generating and executing code") @@ -287,3 +262,26 @@ class ConfigInstall: self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) self.link_emulator() + + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" + self.init_deploy() + self.run_global_explores() + self.run_initial_manifest() + + log.info("Running object manifests and type explorers") + + # Continue process until no new objects are created anymore + new_objects_created = True + while new_objects_created: + new_objects_created = False + for cdist_object in cdist.core.Object.list_objects(): + if cdist_object.prepared: + log.debug("Skipping rerun of object %s", cdist_object) + continue + else: + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + self.objects_prepared.append(cdist_object) + cdist_object.prepared = True + new_objects_created = True From ccb2ffcae620d829d090729ff7232f3c35df25f1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 19:47:55 +0200 Subject: [PATCH 0408/1024] remove toplevel object/type Signed-off-by: Nico Schottelius --- lib/cdist/object.py | 51 ----------------------------------------- lib/cdist/type.py | 55 --------------------------------------------- 2 files changed, 106 deletions(-) delete mode 100644 lib/cdist/object.py delete mode 100644 lib/cdist/type.py diff --git a/lib/cdist/object.py b/lib/cdist/object.py deleted file mode 100644 index 0a282dc2..00000000 --- a/lib/cdist/object.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# -# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -import os -import logging -log = logging.getLogger(__name__) - - - -class Object(object): - - def __init__(self, path, remote_path, object_fq): - self.path = path - self.remote_path = remote_path - self.object_fq = object_fq - self.type = self.object_fq.split(os.sep)[0] - self.object_id = self.object_fq.split(os.sep)[1:] - self.parameter_dir = os.path.join(self.path, "parameter") - self.remote_object_parameter_dir = os.path.join(self.remote_path, "parameter") - self.object_code_paths = [ - os.path.join(self.path, "code-local"), - os.path.join(self.path, "code-remote")] - - @property - def type_explorer_output_dir(self): - """Returns and creates dir of the output for a type explorer""" - if not self.__type_explorer_output_dir: - dir = os.path.join(self.path, "explorer") - if not os.path.isdir(dir): - os.mkdir(dir) - self.__type_explorer_output_dir = dir - return self.__type_explorer_output_dir - diff --git a/lib/cdist/type.py b/lib/cdist/type.py deleted file mode 100644 index e6c35ad1..00000000 --- a/lib/cdist/type.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# 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 . -# -# - -import logging -import os -log = logging.getLogger(__name__) - -class Type(object): - - def __init__(self, path, remote_path): - self.path = path - self.remote_path = remote_path - - def list_explorers(self): - """Return list of available explorers""" - dir = os.path.join(self.path, "explorer") - if os.path.isdir(dir): - list = os.listdir(dir) - else: - list = [] - - log.debug("Explorers for %s in %s: %s", type, dir, list) - - return list - - def is_install(self): - """Check whether a type is used for installation (if not: for configuration)""" - return os.path.isfile(os.path.join(self.path, "install")) - - def explorer_dir(self): - """Return remote directory that holds the explorers of a type""" - return os.path.join(self.remote_path, "explorer") - - def remote_explorer_dir(self): - """Return remote directory that holds the explorers of a type""" - return os.path.join(self.remote_path, "explorer") From ae9eba80a9e369e91d5b9a69c2af0fe88c5769fc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 19:50:45 +0200 Subject: [PATCH 0409/1024] use require, not __require in emulator Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 38a58f8c..519afd24 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -127,7 +127,7 @@ def run(argv): param_fd.close() # Record requirements - if "__require" in os.environ: + if "require" in os.environ: requirements = os.environ['__require'] log.debug(object_id + ":Writing requirements: " + requirements) require_fd = open(os.path.join(object_dir, "require"), "a") From 52268d032a11afe0c6abfc473314be654571be69 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 19:51:42 +0200 Subject: [PATCH 0410/1024] ++todos Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 11c734f9..42dec573 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,3 +1,10 @@ +2.0.3: + +- fix emulator +- introduce tests for $require + +-------------------------------------------------------------------------------- + - Fix / rewrite cdist-quickstart - write tutorial!!!!!!!!! From d07a191867b31efc914248181de207fbaef37fc3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 19:54:41 +0200 Subject: [PATCH 0411/1024] add logger to config Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 6bf9d782..942d2917 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -27,6 +27,8 @@ import sys import cdist.config_install +log = logging.getLogger(__name__) + class Config(cdist.config_install.ConfigInstall): pass From a87e6f22b5251c364e86d74da535d7aa52b8ce3f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 19:59:07 +0200 Subject: [PATCH 0412/1024] use new cdist.Error exception Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index b1db2855..3b6c79a1 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -65,7 +65,7 @@ class ConfigInstall: log.info("Running global explorers") explorers = self.path.list_global_explorers() if(len(explorers) == 0): - raise CdistError("No explorers found in", self.path.global_explorer_dir) + raise cdist.Error("No explorers found in", self.path.global_explorer_dir) self.path.transfer_global_explorers() for explorer in explorers: @@ -159,6 +159,8 @@ class ConfigInstall: def object_run(self, cdist_object, mode): """Run gencode or code for an object""" log.debug("Running %s from %s", mode, cdist_object) + + # FIXME: replace with new object interface file=os.path.join(self.path.object_dir(cdist_object), "require") requirements = cdist.path.file_to_list(file) type = self.path.get_type_from_object(cdist_object) @@ -169,7 +171,7 @@ class ConfigInstall: # # Setup env Variable: - # + # env = os.environ.copy() env['__target_host'] = self.target_host env['__global'] = self.path.out_dir @@ -230,7 +232,7 @@ class ConfigInstall: """The final (and real) step of deployment""" log.info("Generating and executing code") # Now do the final steps over the existing objects - for cdist_object in self.path.list_objects(): + for cdist_object in cdist.core.Object.list_objects(): log.debug("Run object: %s", cdist_object) self.object_run(cdist_object, mode="gencode") self.object_run(cdist_object, mode="code") From 14126cb4b85a88a1dbd55af19c975243877d19dd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:04:44 +0200 Subject: [PATCH 0413/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 42dec573..966ead7a 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,8 +1,12 @@ 2.0.3: - fix emulator -- introduce tests for $require +- introduce tests: + - does $require work? + - $whatever should fail if there is no global explorer directory +- Create GlobalExplorer + -------------------------------------------------------------------------------- - Fix / rewrite cdist-quickstart From 14082f5c0049e8eba532034bf601dfc500f71392 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:05:24 +0200 Subject: [PATCH 0414/1024] string, not tuple in exception Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3b6c79a1..f3dac289 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -65,7 +65,7 @@ class ConfigInstall: log.info("Running global explorers") explorers = self.path.list_global_explorers() if(len(explorers) == 0): - raise cdist.Error("No explorers found in", self.path.global_explorer_dir) + raise cdist.Error("No explorers found in " + self.path.global_explorer_dir) self.path.transfer_global_explorers() for explorer in explorers: @@ -251,12 +251,13 @@ class ConfigInstall: self.target_host, duration.total_seconds()) + + ### Cleaned / check functions: Round 1 :-) ################################# def deploy_and_cleanup(self): """Do what is most often done: deploy & cleanup""" self.deploy_to() self.cleanup() - ### Cleaned / check functions: Round 1 :-) ################################# def init_deploy(self): """Ensure the base directories are cleaned up""" log.debug("Creating clean directory structure") From d4bf98cf0c5b9c5026f136b92c973c6a9d5a93c4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:08:46 +0200 Subject: [PATCH 0415/1024] +tests needed Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 966ead7a..85620098 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -4,6 +4,7 @@ - introduce tests: - does $require work? - $whatever should fail if there is no global explorer directory + - emulator may only be called with __ as prefix - fail otherwise! - Create GlobalExplorer From 1db4cd48d24fecd4e92b4a941de3f86ef291c910 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:11:23 +0200 Subject: [PATCH 0416/1024] -typo Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index f3dac289..1f590d07 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -55,12 +55,10 @@ class ConfigInstall: base_dir=home, debug=debug) - self.objects_prepared = [] - def cleanup(self): self.path.cleanup() - def run_global_explores(self): + def run_global_explorers(self): """Run global explorers""" log.info("Running global explorers") explorers = self.path.list_global_explorers() @@ -269,7 +267,7 @@ class ConfigInstall: def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" self.init_deploy() - self.run_global_explores() + self.run_global_explorers() self.run_initial_manifest() log.info("Running object manifests and type explorers") @@ -285,6 +283,5 @@ class ConfigInstall: else: self.run_type_explorer(cdist_object) self.run_type_manifest(cdist_object) - self.objects_prepared.append(cdist_object) cdist_object.prepared = True new_objects_created = True From 609efcbfd1af1b2e679c5a0c708941c3b35caedd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:14:34 +0200 Subject: [PATCH 0417/1024] Remove datetime from config_install, break code and make it more beautiful Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 1f590d07..3be7e0b1 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -20,7 +20,6 @@ # # -import datetime import logging import os import stat From 84867db20a08aa7c742d28e891a1ffea328f90de Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:14:48 +0200 Subject: [PATCH 0418/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 85620098..bfbdd8c3 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -10,6 +10,9 @@ -------------------------------------------------------------------------------- +- insert prefix into logger to distinguish between modules + - in debug/info only? + - Fix / rewrite cdist-quickstart - write tutorial!!!!!!!!! From 13d47f3cf4fd2a083218073e6fc7f79fcc57e3b9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:20:35 +0200 Subject: [PATCH 0419/1024] remove datetime from config to wrong position Signed-off-by: Nico Schottelius --- bin/cdist | 11 +++++++++++ lib/cdist/config_install.py | 11 +---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/bin/cdist b/bin/cdist index 0bf3ed9c..36dc3d5c 100755 --- a/bin/cdist +++ b/bin/cdist @@ -21,6 +21,7 @@ # import argparse +import datetime import logging import os import re @@ -105,6 +106,8 @@ if __name__ == "__main__": try: logging.basicConfig(format='%(levelname)s: %(message)s') + time_start = datetime.datetime.now() + if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): import cdist.emulator cdist.emulator.run(sys.argv) @@ -117,6 +120,14 @@ if __name__ == "__main__": import cdist.path commandline() + + time_end = datetime.datetime.now() + duration = time_end - time_start + # FIXME: move into runner + # log.info("Finished run of %s in %s seconds", self.target_host, + # duration.total_seconds()) + log.info("Finished run in %s seconds", duration.total_seconds()) + except KeyboardInterrupt: sys.exit(0) except cdist.Error as e: diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3be7e0b1..7d0e2c9a 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -234,22 +234,13 @@ class ConfigInstall: self.object_run(cdist_object, mode="gencode") self.object_run(cdist_object, mode="code") + ### Cleaned / check functions: Round 1 :-) ################################# def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" log.info("Deploying to " + self.target_host) - time_start = datetime.datetime.now() - self.stage_prepare() self.stage_run() - time_end = datetime.datetime.now() - duration = time_end - time_start - log.info("Finished run of %s in %s seconds", - self.target_host, - duration.total_seconds()) - - - ### Cleaned / check functions: Round 1 :-) ################################# def deploy_and_cleanup(self): """Do what is most often done: deploy & cleanup""" self.deploy_to() From 579bd45c8765f44560f2279a063bf97c46dc050f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:24:40 +0200 Subject: [PATCH 0420/1024] cleanup more stuff in config_install Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 7d0e2c9a..ac988425 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -225,6 +225,7 @@ class ConfigInstall: self.path.transfer_file(local_remote_code, remote_remote_code) cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) + ### Cleaned / check functions: Round 1 :-) ################################# def stage_run(self): """The final (and real) step of deployment""" log.info("Generating and executing code") @@ -234,7 +235,6 @@ class ConfigInstall: self.object_run(cdist_object, mode="gencode") self.object_run(cdist_object, mode="code") - ### Cleaned / check functions: Round 1 :-) ################################# def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" log.info("Deploying to " + self.target_host) @@ -271,6 +271,7 @@ class ConfigInstall: log.debug("Skipping rerun of object %s", cdist_object) continue else: + log.debug("Preparing object: " + cdist_object) self.run_type_explorer(cdist_object) self.run_type_manifest(cdist_object) cdist_object.prepared = True From be1d4afd589e3265089d736b9a75e2e191d94776 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:27:07 +0200 Subject: [PATCH 0421/1024] add log to object Signed-off-by: Nico Schottelius --- lib/cdist/core/object.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 544f7565..8ad2a9eb 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -19,12 +19,14 @@ # # +import logging import os import collections import cdist import cdist.core.property +log = logging.getLogger(__name__) DOT_CDIST = '.cdist' From 9b5b94577fd75f6433b045c4dfa18770e80a9dde Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:32:47 +0200 Subject: [PATCH 0422/1024] add debug Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 2 ++ lib/cdist/emulator.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index ac988425..29154f84 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -262,6 +262,8 @@ class ConfigInstall: log.info("Running object manifests and type explorers") + log.debug("Searching for objects in " + cdist.core.Object.base_dir()) + # Continue process until no new objects are created anymore new_objects_created = True while new_objects_created: diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 519afd24..51b2ecc1 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -77,6 +77,8 @@ def run(argv): object_dir = os.path.join(global_dir, "object", type, object_id, cdist.path.DOT_CDIST) + log.debug("Object output dir = " + object_dir) + param_out_dir = os.path.join(object_dir, "parameter") object_source_file = os.path.join(object_dir, "source") From 6bd64437213a177924f699b22d5e5b72ec8653c9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:32:59 +0200 Subject: [PATCH 0423/1024] fix out dir for object Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 73a90302..98572b81 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -68,7 +68,6 @@ class Path: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) self.temp_dir = tempfile.mkdtemp() - os.environ['__cdist_out_dir'] = self.temp_dir self.target_host = target_host @@ -93,6 +92,8 @@ class Path: self.object_base_dir = os.path.join(self.out_dir, "object") self.bin_dir = os.path.join(self.out_dir, "bin") + os.environ['__cdist_out_dir'] = self.out_dir + # List of type explorers transferred self.type_explorers_transferred = {} From 354e15015a9385a7cae7b4e0a83c3599a69a6a69 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:34:36 +0200 Subject: [PATCH 0424/1024] use full.path.to.cdist.core.Type(), Steven ;-) Signed-off-by: Nico Schottelius --- lib/cdist/core/object.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 8ad2a9eb..dbb6542d 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # -# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2011 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -67,7 +68,7 @@ class Object(object): for object_name in cls.list_object_names(): type_name = object_name.split(os.sep)[0] object_id = os.sep.join(object_name.split(os.sep)[1:]) - yield cls(Type(type_name), object_id=object_id) + yield cls(cdist.core.Type(type_name), object_id=object_id) @classmethod def list_type_names(cls): From c0d6d4d5309d46530090ed0ef9460c86fc7237d1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:37:55 +0200 Subject: [PATCH 0425/1024] use name, not object Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 29154f84..3c11d6bb 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -273,7 +273,7 @@ class ConfigInstall: log.debug("Skipping rerun of object %s", cdist_object) continue else: - log.debug("Preparing object: " + cdist_object) + log.debug("Preparing object: " + cdist_object.name) self.run_type_explorer(cdist_object) self.run_type_manifest(cdist_object) cdist_object.prepared = True From b891818b9cd34ec59878eeb04f1880f4a006a0de Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:42:31 +0200 Subject: [PATCH 0426/1024] remove obsolete get_type_from_object() and use Object.type Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 2 +- lib/cdist/path.py | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3c11d6bb..2071a0e9 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -78,7 +78,7 @@ class ConfigInstall: def run_type_explorer(self, cdist_object): """Run type specific explorers for objects""" - type = self.path.get_type_from_object(cdist_object) + type = cdist_object.type self.path.transfer_type_explorers(type) cmd = [] diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 98572b81..d82ae974 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -192,11 +192,6 @@ class Path: return object_paths - # FIXME: Object - def get_type_from_object(self, cdist_object): - """Returns the first part (i.e. type) of an object""" - return cdist_object.split(os.sep)[0] - # FIXME: Object def get_object_id_from_object(self, cdist_object): """Returns everything but the first part (i.e. object_id) of an object""" From 35a7757e1aa6f1f7d6722a6bd903ce631aefb24a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:51:31 +0200 Subject: [PATCH 0427/1024] rewrite path to include calls to non-existent methods in type (fix needed, sar :-) Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index d82ae974..deeb6b0d 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -255,19 +255,25 @@ class Path: # Stays here - FIXME: adjust to type code, loop over types! def transfer_type_explorers(self, type): """Transfer explorers of a type, but only once""" - if type in self.type_explorers_transferred: + if type.transferred: log.debug("Skipping retransfer for explorers of %s", type) return else: # Do not retransfer - self.type_explorers_transferred[type] = 1 + type.transferred = True - src = self.type_dir(type, "explorer") - remote_base = os.path.join(REMOTE_TYPE_DIR, type) - dst = self.remote_type_explorer_dir(type) + # FIXME: need to get explorer path from type! + src = type.explorer_path() + dst = type.remote_explorer_path() + # FIXME: where to construct remote path? here? + # remote_base = os.path.join(REMOTE_TYPE_DIR, type.name) + # dst = self.remote_type_explorer_dir(type) # Only continue, if there is at least the directory - if os.path.isdir(src): + #if os.path.isdir(src): + + # Transfer if there is at least one explorer + if len(type.explorers) > 0: # Ensure that the path exists - self.remote_mkdir(remote_base) + self.remote_mkdir(dst) self.transfer_dir(src, dst) From 6f58b18c8cff14d3ce736dc6a605a222ccf0d913 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 20:52:34 +0200 Subject: [PATCH 0428/1024] remove legacy code, fail until type supports us Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index deeb6b0d..f7d2a8ae 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -262,16 +262,10 @@ class Path: # Do not retransfer type.transferred = True - # FIXME: need to get explorer path from type! + # FIXME: Can be explorer_path or explorer_dir, I don't care. src = type.explorer_path() dst = type.remote_explorer_path() - # FIXME: where to construct remote path? here? - # remote_base = os.path.join(REMOTE_TYPE_DIR, type.name) - # dst = self.remote_type_explorer_dir(type) - # Only continue, if there is at least the directory - #if os.path.isdir(src): - # Transfer if there is at least one explorer if len(type.explorers) > 0: # Ensure that the path exists From 3873aefcf55ed2c0953b164e14ef46546bd912b5 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 00:46:59 +0200 Subject: [PATCH 0429/1024] cleanup, add sort method Signed-off-by: Steven Armstrong --- lib/cdist/core/property.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/cdist/core/property.py b/lib/cdist/core/property.py index 790ff802..359cf32c 100644 --- a/lib/cdist/core/property.py +++ b/lib/cdist/core/property.py @@ -32,6 +32,8 @@ class FileList(collections.MutableSequence): def __init__(self, path, initial=None): self._path = path if initial: + # delete existing file + os.unlink(self._path) for i in initial: self.append(i) @@ -40,7 +42,7 @@ class FileList(collections.MutableSequence): try: with open(self._path) as fd: for line in fd: - lines.append(line.strip()) + lines.append(line.rstrip('\n')) except EnvironmentError as e: # error ignored pass @@ -50,7 +52,7 @@ class FileList(collections.MutableSequence): try: with open(self._path, 'w') as fd: for line in lines: - fd.write(line + '\n') + fd.write(str(line) + '\n') except EnvironmentError as e: # error ignored raise @@ -80,6 +82,10 @@ class FileList(collections.MutableSequence): lines.insert(index, value) self.__write(lines) + def sort(self): + lines = sorted(self) + self.__write(lines) + class DirectoryDict(collections.MutableMapping): """A dict that stores it's state in a directory. @@ -98,13 +104,13 @@ class DirectoryDict(collections.MutableMapping): def __getitem__(self, key): try: with open(os.path.join(self._path, key), "r") as fd: - return fd.read() + return fd.read().rstrip('\n') except EnvironmentError: raise KeyError(key) def __setitem__(self, key, value): with open(os.path.join(self._path, key), "w") as fd: - fd.write(value) + fd.write(str(value)) def __delitem__(self, key): os.remove(os.path.join(self._path, key)) From 7bbecb25868a8bc798dfbc7f96c9efa0649a0de6 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 00:48:06 +0200 Subject: [PATCH 0430/1024] implement descriptor protocol for FileList and DirectoryDict Signed-off-by: Steven Armstrong --- lib/cdist/core/property.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/cdist/core/property.py b/lib/cdist/core/property.py index 359cf32c..30887547 100644 --- a/lib/cdist/core/property.py +++ b/lib/cdist/core/property.py @@ -87,6 +87,22 @@ class FileList(collections.MutableSequence): self.__write(lines) +class FileListProperty(FileList): + # Descriptor Protocol + def __get__(self, obj, objtype=None): + if obj is None: + return self.__class__ + return self + + def __set__(self, obj, value): + os.unlink(self._path) + for item in value: + self.append(item) + + def __delete__(self, obj): + raise AttributeError("can't delete attribute") + + class DirectoryDict(collections.MutableMapping): """A dict that stores it's state in a directory. @@ -120,3 +136,20 @@ class DirectoryDict(collections.MutableMapping): def __len__(self): return len(os.listdir(self._path)) + + +class DirectoryDictProperty(DirectoryDict): + # Descriptor Protocol + def __get__(self, obj, objtype=None): + if obj is None: + return self.__class__ + return self + + def __set__(self, obj, value): + for name in self.keys(): + del self[name] + if value is not None: + self.update(value) + + def __delete__(self, obj): + raise AttributeError("can't delete attribute") From 2b1c4df8d97686a6c80e1e55c4139b6b2f6bffd6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:01:47 +0200 Subject: [PATCH 0431/1024] have explorers been transferred? (type) Signed-off-by: Nico Schottelius --- lib/cdist/core/type.py | 5 ++++- lib/cdist/path.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index 126b4d16..7492659e 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # -# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2011 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -68,6 +69,8 @@ class Type(object): self.__required_parameters = None self.__optional_parameters = None + self.transferred_explorers = False + def __repr__(self): return '' % self.name diff --git a/lib/cdist/path.py b/lib/cdist/path.py index f7d2a8ae..e2d319ef 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -255,12 +255,12 @@ class Path: # Stays here - FIXME: adjust to type code, loop over types! def transfer_type_explorers(self, type): """Transfer explorers of a type, but only once""" - if type.transferred: + if type.transferred_explorers: log.debug("Skipping retransfer for explorers of %s", type) return else: # Do not retransfer - type.transferred = True + type.transferred_explorers = True # FIXME: Can be explorer_path or explorer_dir, I don't care. src = type.explorer_path() From 6be542d9bb5ed50aa7a71e2a6d57b4a3eac940f6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:05:26 +0200 Subject: [PATCH 0432/1024] missing functionality in oo Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index e69de29b..0ff17f6a 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -0,0 +1,8 @@ +Object: + code_remote + code_local + gencode_local + gencode_remote + +Type: + explorer_path From 1810462989c6ad6e81137ad2168907a14effe364 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:05:42 +0200 Subject: [PATCH 0433/1024] move stuff over from path to object to be fixed Signed-off-by: Nico Schottelius --- lib/cdist/core/object.py | 36 +++++++++++++++++++++++++++++++++++- lib/cdist/path.py | 31 ------------------------------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index dbb6542d..e75c06c8 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -161,4 +161,38 @@ class Object(object): pass ### /changed - # FIXME: implement other properties/methods + # FIXME: implement other properties/methods + + # FIXME: check following methods: implement or revoke / delete + # FIXME: Object + def get_object_id_from_object(self, cdist_object): + """Returns everything but the first part (i.e. object_id) of an object""" + return os.sep.join(cdist_object.split(os.sep)[1:]) + + # FIXME: Object + def object_dir(self, cdist_object): + """Returns the full path to the object (including .cdist)""" + return os.path.join(self.object_base_dir, cdist_object, DOT_CDIST) + + # FIXME: Object + def remote_object_dir(self, cdist_object): + """Returns the remote full path to the object (including .cdist)""" + return os.path.join(REMOTE_OBJECT_DIR, cdist_object, DOT_CDIST) + + # FIXME: Object + def object_parameter_dir(self, cdist_object): + """Returns the dir to the object parameter""" + return os.path.join(self.object_dir(cdist_object), "parameter") + + # FIXME: object + def remote_object_parameter_dir(self, cdist_object): + """Returns the remote dir to the object parameter""" + return os.path.join(self.remote_object_dir(cdist_object), "parameter") + + # FIXME: object + def object_code_paths(self, cdist_object): + """Return paths to code scripts of object""" + return [os.path.join(self.object_dir(cdist_object), "code-local"), + os.path.join(self.object_dir(cdist_object), "code-remote")] + + diff --git a/lib/cdist/path.py b/lib/cdist/path.py index e2d319ef..99adfe99 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -192,37 +192,6 @@ class Path: return object_paths - # FIXME: Object - def get_object_id_from_object(self, cdist_object): - """Returns everything but the first part (i.e. object_id) of an object""" - return os.sep.join(cdist_object.split(os.sep)[1:]) - - # FIXME: Object - def object_dir(self, cdist_object): - """Returns the full path to the object (including .cdist)""" - return os.path.join(self.object_base_dir, cdist_object, DOT_CDIST) - - # FIXME: Object - def remote_object_dir(self, cdist_object): - """Returns the remote full path to the object (including .cdist)""" - return os.path.join(REMOTE_OBJECT_DIR, cdist_object, DOT_CDIST) - - # FIXME: Object - def object_parameter_dir(self, cdist_object): - """Returns the dir to the object parameter""" - return os.path.join(self.object_dir(cdist_object), "parameter") - - # FIXME: object - def remote_object_parameter_dir(self, cdist_object): - """Returns the remote dir to the object parameter""" - return os.path.join(self.remote_object_dir(cdist_object), "parameter") - - # FIXME: object - def object_code_paths(self, cdist_object): - """Return paths to code scripts of object""" - return [os.path.join(self.object_dir(cdist_object), "code-local"), - os.path.join(self.object_dir(cdist_object), "code-remote")] - # Stays here def list_objects(self): """Return list of existing objects""" From cf97fd9837c4253613ba809b9d87763197741d51 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:27:46 +0200 Subject: [PATCH 0434/1024] remove type_explorer information from path Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 99adfe99..4c36bfa5 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -92,7 +92,6 @@ class Path: self.object_base_dir = os.path.join(self.out_dir, "object") self.bin_dir = os.path.join(self.out_dir, "bin") - os.environ['__cdist_out_dir'] = self.out_dir # List of type explorers transferred self.type_explorers_transferred = {} @@ -116,6 +115,10 @@ class Path: shutil.move(self.temp_dir, self.cache_dir) + def __init_env(self): + """Setup environment""" + os.environ['__cdist_out_dir'] = self.out_dir + def __init_out_dirs(self): """Initialise output directory structure""" os.mkdir(self.out_dir) From e26f6120123c142fcbb949eaa69c1d20aa089f18 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:29:22 +0200 Subject: [PATCH 0435/1024] move file_to_list to cdist Signed-off-by: Nico Schottelius --- lib/cdist/__init__.py | 14 ++++++++++++++ lib/cdist/emulator.py | 4 ++-- lib/cdist/path.py | 21 --------------------- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index fcfa3693..3a1b94e3 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -34,3 +34,17 @@ class MissingEnvironmentVariableError(Error): def __str__(self): return 'Missing required environment variable: ' + str(self.name) + +def file_to_list(filename): + """Return list from \n seperated file""" + if os.path.isfile(filename): + file_fd = open(filename, "r") + lines = file_fd.readlines() + file_fd.close() + + # Remove \n from all lines + lines = map(lambda s: s.strip(), lines) + else: + lines = [] + + return lines diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 51b2ecc1..f3e9ac30 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -43,10 +43,10 @@ def run(argv): parser = argparse.ArgumentParser(add_help=False) - for parameter in cdist.path.file_to_list(os.path.join(param_dir, "optional")): + for parameter in cdist.file_to_list(os.path.join(param_dir, "optional")): argument = "--" + parameter parser.add_argument(argument, action='store', required=False) - for parameter in cdist.path.file_to_list(os.path.join(param_dir, "required")): + for parameter in cdist.file_to_list(os.path.join(param_dir, "required")): argument = "--" + parameter parser.add_argument(argument, action='store', required=True) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 4c36bfa5..50977afd 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -38,20 +38,6 @@ log = logging.getLogger(__name__) import cdist.exec -def file_to_list(filename): - """Return list from \n seperated file""" - if os.path.isfile(filename): - file_fd = open(filename, "r") - lines = file_fd.readlines() - file_fd.close() - - # Remove \n from all lines - lines = map(lambda s: s.strip(), lines) - else: - lines = [] - - return lines - class Path: """Class that handles path related configurations""" @@ -92,13 +78,6 @@ class Path: self.object_base_dir = os.path.join(self.out_dir, "object") self.bin_dir = os.path.join(self.out_dir, "bin") - - # List of type explorers transferred - self.type_explorers_transferred = {} - - # objects prepared - self.objects_prepared = [] - # Create directories self.__init_out_dirs() From ee69971465a61874e65eebc2665ed23a2d8c9082 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:38:52 +0200 Subject: [PATCH 0436/1024] make temp_dir unecessary / only implementation detail Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 50977afd..b9d0b6bf 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -41,22 +41,16 @@ import cdist.exec class Path: """Class that handles path related configurations""" - def __init__(self, - target_host, - initial_manifest=False, - base_dir=None, - debug=False): - - # Base and Temp Base - if base_dir: - self.base_dir = base_dir - else: - self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) - - self.temp_dir = tempfile.mkdtemp() + def __init__(self, target_host, initial_manifest=False, debug=False): self.target_host = target_host + # Base and Temp Base + if "__cdist_base_dir" in os.environ: + self.base_dir = os.environ['__cdist_base_dir'] + else: + self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) + # Input directories self.conf_dir = os.path.join(self.base_dir, "conf") self.cache_base_dir = os.path.join(self.base_dir, "cache") @@ -73,7 +67,11 @@ class Path: self.initial_manifest = os.path.join(self.manifest_dir, "init") # Output directories - self.out_dir = os.path.join(self.temp_dir, "out") + if "__cdist_out_dir" in os.environ: + self.out_dir = os.environ['__cdist_out_dir'] + else: + self.out_dir = os.path.join(tempfile.mkdtemp(), "out") + self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") self.object_base_dir = os.path.join(self.out_dir, "object") self.bin_dir = os.path.join(self.out_dir, "bin") @@ -87,12 +85,11 @@ class Path: # "other globals referenced by the __del__() method may already have been deleted # or in the process of being torn down (e.g. the import machinery shutting down)" # - log.debug("Saving" + self.temp_dir + "to " + self.cache_dir) + log.debug("Saving" + self.base_dir + "to " + self.cache_dir) # Remove previous cache if os.path.exists(self.cache_dir): shutil.rmtree(self.cache_dir) - shutil.move(self.temp_dir, self.cache_dir) - + shutil.move(self.base_dir, self.cache_dir) def __init_env(self): """Setup environment""" @@ -100,6 +97,11 @@ class Path: def __init_out_dirs(self): """Initialise output directory structure""" + + # Create base dir, if user supplied and not existing + if not os.isdir(self.base_dir): + os.mkdir(self.base_dir) + os.mkdir(self.out_dir) os.mkdir(self.global_explorer_out_dir) os.mkdir(self.bin_dir) From 06f438f824afc0ae5d9a28b78f65ee090e5d0174 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:46:06 +0200 Subject: [PATCH 0437/1024] move stuff from path to object, remove if already existent Signed-off-by: Nico Schottelius --- lib/cdist/core/object.py | 37 ++++++++++++++++++++ lib/cdist/path.py | 73 +++------------------------------------- 2 files changed, 42 insertions(+), 68 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index e75c06c8..85822a24 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -195,4 +195,41 @@ class Object(object): return [os.path.join(self.object_dir(cdist_object), "code-local"), os.path.join(self.object_dir(cdist_object), "code-remote")] + # Stays here + def list_object_paths(self, starting_point): + """Return list of paths of existing objects""" + object_paths = [] + + for content in os.listdir(starting_point): + full_path = os.path.join(starting_point, content) + if os.path.isdir(full_path): + object_paths.extend(self.list_object_paths(starting_point = full_path)) + + # Directory contains .cdist -> is an object + if content == DOT_CDIST: + object_paths.append(starting_point) + + return object_paths + + # Stays here + def list_objects(self): + """Return list of existing objects""" + + objects = [] + if os.path.isdir(self.object_base_dir): + object_paths = self.list_object_paths(self.object_base_dir) + + for path in object_paths: + objects.append(os.path.relpath(path, self.object_base_dir)) + + return objects + + # FIXME: object + def type_explorer_output_dir(self, cdist_object): + """Returns and creates dir of the output for a type explorer""" + dir = os.path.join(self.object_dir(cdist_object), "explorer") + if not os.path.isdir(dir): + os.mkdir(dir) + + return dir diff --git a/lib/cdist/path.py b/lib/cdist/path.py index b9d0b6bf..448fc918 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -106,90 +106,27 @@ class Path: os.mkdir(self.global_explorer_out_dir) os.mkdir(self.bin_dir) - - # Stays here - def list_types(self): - """Retuns list of types""" - return os.listdir(self.type_base_dir) - - ###################################################################### - - # FIXME: belongs to here - clearify remote* def remote_mkdir(self, directory): """Create directory on remote side""" cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) - # FIXME: belongs to here - clearify remote* def remove_remote_dir(self, destination): cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) - # FIXME: belongs to here - clearify remote* + # FIXME: To Copy def transfer_dir(self, source, destination): """Transfer directory and previously delete the remote destination""" self.remove_remote_dir(destination) cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + ["-r", source, self.target_host + ":" + destination]) - # FIXME: belongs to here - clearify remote* + # FIXME: To Copy def transfer_file(self, source, destination): """Transfer file""" cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + [source, self.target_host + ":" + destination]) - # FIXME: Explorer or stays - def global_explorer_output_path(self, explorer): - """Returns path of the output for a global explorer""" - return os.path.join(self.global_explorer_out_dir, explorer) - - # FIXME: object - def type_explorer_output_dir(self, cdist_object): - """Returns and creates dir of the output for a type explorer""" - dir = os.path.join(self.object_dir(cdist_object), "explorer") - if not os.path.isdir(dir): - os.mkdir(dir) - - return dir - - # FIXME Stays here / Explorer? - def remote_global_explorer_path(self, explorer): - """Returns path to the remote explorer""" - return os.path.join(REMOTE_GLOBAL_EXPLORER_DIR, explorer) - - # FIXME: stays here - def list_global_explorers(self): - """Return list of available explorers""" - return os.listdir(self.global_explorer_dir) - - # Stays here - def list_object_paths(self, starting_point): - """Return list of paths of existing objects""" - object_paths = [] - - for content in os.listdir(starting_point): - full_path = os.path.join(starting_point, content) - if os.path.isdir(full_path): - object_paths.extend(self.list_object_paths(starting_point = full_path)) - - # Directory contains .cdist -> is an object - if content == DOT_CDIST: - object_paths.append(starting_point) - - return object_paths - - # Stays here - def list_objects(self): - """Return list of existing objects""" - - objects = [] - if os.path.isdir(self.object_base_dir): - object_paths = self.list_object_paths(self.object_base_dir) - - for path in object_paths: - objects.append(os.path.relpath(path, self.object_base_dir)) - - return objects - - # Stays here + # FIXME Move into configinstall def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" # Create base path before using mkdir -p @@ -199,13 +136,13 @@ class Path: self.transfer_dir(self.object_parameter_dir(cdist_object), self.remote_object_parameter_dir(cdist_object)) - # Stays here + # FIXME Move into configinstall def transfer_global_explorers(self): """Transfer the global explorers""" self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) self.transfer_dir(self.global_explorer_dir, REMOTE_GLOBAL_EXPLORER_DIR) - # Stays here - FIXME: adjust to type code, loop over types! + # FIXME Move into configinstall def transfer_type_explorers(self, type): """Transfer explorers of a type, but only once""" if type.transferred_explorers: From 0b63919cdd3b8f74b11a66016098e2d213de908c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:46:48 +0200 Subject: [PATCH 0438/1024] path -> copy Signed-off-by: Nico Schottelius --- lib/cdist/copy.py | 13 +++++++++++++ lib/cdist/path.py | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 lib/cdist/copy.py diff --git a/lib/cdist/copy.py b/lib/cdist/copy.py new file mode 100644 index 00000000..b0eae54e --- /dev/null +++ b/lib/cdist/copy.py @@ -0,0 +1,13 @@ + # FIXME: To Copy + def transfer_dir(self, source, destination): + """Transfer directory and previously delete the remote destination""" + self.remove_remote_dir(destination) + cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + + ["-r", source, self.target_host + ":" + destination]) + + # FIXME: To Copy + def transfer_file(self, source, destination): + """Transfer file""" + cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + + [source, self.target_host + ":" + destination]) + diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 448fc918..2f6670e8 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -113,19 +113,6 @@ class Path: def remove_remote_dir(self, destination): cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) - # FIXME: To Copy - def transfer_dir(self, source, destination): - """Transfer directory and previously delete the remote destination""" - self.remove_remote_dir(destination) - cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + - ["-r", source, self.target_host + ":" + destination]) - - # FIXME: To Copy - def transfer_file(self, source, destination): - """Transfer file""" - cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + - [source, self.target_host + ":" + destination]) - # FIXME Move into configinstall def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" From 08975c4d2f2f78fa13fc0ed1fa07c96d557670da Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:47:29 +0200 Subject: [PATCH 0439/1024] path -> config_install Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 36 ++++++++++++++++++++++++++++++++++++ lib/cdist/path.py | 35 ----------------------------------- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 2071a0e9..9e2b5edc 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -278,3 +278,39 @@ class ConfigInstall: self.run_type_manifest(cdist_object) cdist_object.prepared = True new_objects_created = True + + # FIXME Move into configinstall + def transfer_object_parameter(self, cdist_object): + """Transfer the object parameter to the remote destination""" + # Create base path before using mkdir -p + self.remote_mkdir(self.remote_object_parameter_dir(cdist_object)) + + # Synchronise parameter dir afterwards + self.transfer_dir(self.object_parameter_dir(cdist_object), + self.remote_object_parameter_dir(cdist_object)) + + # FIXME Move into configinstall + def transfer_global_explorers(self): + """Transfer the global explorers""" + self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) + self.transfer_dir(self.global_explorer_dir, REMOTE_GLOBAL_EXPLORER_DIR) + + # FIXME Move into configinstall + def transfer_type_explorers(self, type): + """Transfer explorers of a type, but only once""" + if type.transferred_explorers: + log.debug("Skipping retransfer for explorers of %s", type) + return + else: + # Do not retransfer + type.transferred_explorers = True + + # FIXME: Can be explorer_path or explorer_dir, I don't care. + src = type.explorer_path() + dst = type.remote_explorer_path() + + # Transfer if there is at least one explorer + if len(type.explorers) > 0: + # Ensure that the path exists + self.remote_mkdir(dst) + self.transfer_dir(src, dst) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 2f6670e8..2dc06ceb 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -113,38 +113,3 @@ class Path: def remove_remote_dir(self, destination): cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) - # FIXME Move into configinstall - def transfer_object_parameter(self, cdist_object): - """Transfer the object parameter to the remote destination""" - # Create base path before using mkdir -p - self.remote_mkdir(self.remote_object_parameter_dir(cdist_object)) - - # Synchronise parameter dir afterwards - self.transfer_dir(self.object_parameter_dir(cdist_object), - self.remote_object_parameter_dir(cdist_object)) - - # FIXME Move into configinstall - def transfer_global_explorers(self): - """Transfer the global explorers""" - self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) - self.transfer_dir(self.global_explorer_dir, REMOTE_GLOBAL_EXPLORER_DIR) - - # FIXME Move into configinstall - def transfer_type_explorers(self, type): - """Transfer explorers of a type, but only once""" - if type.transferred_explorers: - log.debug("Skipping retransfer for explorers of %s", type) - return - else: - # Do not retransfer - type.transferred_explorers = True - - # FIXME: Can be explorer_path or explorer_dir, I don't care. - src = type.explorer_path() - dst = type.remote_explorer_path() - - # Transfer if there is at least one explorer - if len(type.explorers) > 0: - # Ensure that the path exists - self.remote_mkdir(dst) - self.transfer_dir(src, dst) From 886c1d32acfa31ec156eccdb3e3169af1053437a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:48:43 +0200 Subject: [PATCH 0440/1024] DOT_CDIST -> cdist Signed-off-by: Nico Schottelius --- lib/cdist/__init__.py | 1 + lib/cdist/path.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index 3a1b94e3..6ce0c788 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -20,6 +20,7 @@ # VERSION = "2.0.3" +DOT_CDIST = ".cdist" class Error(Exception): """Base exception class for this project""" diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 2dc06ceb..9921dd0f 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -32,8 +32,6 @@ REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") -DOT_CDIST = ".cdist" - log = logging.getLogger(__name__) import cdist.exec From 359e5156e27c7f1b397062b07bbe3dbc438c8e43 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:52:37 +0200 Subject: [PATCH 0441/1024] +globalexplorer start Signed-off-by: Nico Schottelius --- lib/cdist/core/globalexplorer.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lib/cdist/core/globalexplorer.py diff --git a/lib/cdist/core/globalexplorer.py b/lib/cdist/core/globalexplorer.py new file mode 100644 index 00000000..1af466e0 --- /dev/null +++ b/lib/cdist/core/globalexplorer.py @@ -0,0 +1,15 @@ + # FIXME: Explorer or stays + def global_explorer_output_path(self, explorer): + """Returns path of the output for a global explorer""" + return os.path.join(self.global_explorer_out_dir, explorer) + + # FIXME Stays here / Explorer? + def remote_global_explorer_path(self, explorer): + """Returns path to the remote explorer""" + return os.path.join(REMOTE_GLOBAL_EXPLORER_DIR, explorer) + + # FIXME: stays here + def list_global_explorers(self): + """Return list of available explorers""" + return os.listdir(self.global_explorer_dir) + From 4b306e45f946ad3f01118ef59fdf512b4563fbe7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:53:09 +0200 Subject: [PATCH 0442/1024] more ideas for globalexplorer Signed-off-by: Nico Schottelius --- lib/cdist/core/globalexplorer.py | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/lib/cdist/core/globalexplorer.py b/lib/cdist/core/globalexplorer.py index 1af466e0..49052d53 100644 --- a/lib/cdist/core/globalexplorer.py +++ b/lib/cdist/core/globalexplorer.py @@ -13,3 +13,54 @@ """Return list of available explorers""" return os.listdir(self.global_explorer_dir) +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 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 . +# +# + +import logging +import os +log = logging.getLogger(__name__) + +class Explorer(object): + + def __init__(self, src_dir, dst_dir): + self.src_dir = src_dir + self.dst_dir = dst_dir + + def list_explorers(self): + """Return list of available explorers""" + dir = os.path.join(self.path, "explorer") + if os.path.isdir(dir): + list = os.listdir(dir) + else: + list = [] + + log.debug("Explorers for %s in %s: %s", type, dir, list) + + return list + + def is_install(self): + """Check whether a type is used for installation (if not: for configuration)""" + return os.path.isfile(os.path.join(self.path, "install")) + + def remote_explorer_dir(self): + """Return remote directory that holds the explorers of a type""" + return os.path.join(self.remote_path, "explorer") From 9540d529d687699fc2da7b03626fd6318965aa9a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:53:24 +0200 Subject: [PATCH 0443/1024] also allow to overwrite remote_base_dir Signed-off-by: Nico Schottelius --- lib/cdist/path.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/cdist/path.py b/lib/cdist/path.py index 9921dd0f..44b121df 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -25,12 +25,6 @@ import shutil import sys import tempfile -# Hardcoded paths usually not changable -REMOTE_BASE_DIR = "/var/lib/cdist" -REMOTE_CONF_DIR = os.path.join(REMOTE_BASE_DIR, "conf") -REMOTE_OBJECT_DIR = os.path.join(REMOTE_BASE_DIR, "object") -REMOTE_TYPE_DIR = os.path.join(REMOTE_CONF_DIR, "type") -REMOTE_GLOBAL_EXPLORER_DIR = os.path.join(REMOTE_CONF_DIR, "explorer") log = logging.getLogger(__name__) @@ -74,6 +68,17 @@ class Path: self.object_base_dir = os.path.join(self.out_dir, "object") self.bin_dir = os.path.join(self.out_dir, "bin") + # Remote directories + if "__cdist_remote_base_dir" in os.environ: + self.remote_base_dir = os.environ['__cdist_remote_base_dir'] + else: + self.remote_base_dir = "/var/lib/cdist" + + self.remote_conf_dir = os.path.join(self.remote_base_dir, "conf") + self.remote_object_dir = os.path.join(self.remote_base_dir, "object") + self.remote_type_dir = os.path.join(self.remote_conf_dir, "type") + self.remote_global_explorer_dir = os.path.join(self.remote_conf_dir, "explorer") + # Create directories self.__init_out_dirs() From 73fa0e1ab7ac34b1f621060332e7c72e69a6d0a2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 11:51:21 +0200 Subject: [PATCH 0444/1024] path becomes context (+1 happy developer) Signed-off-by: Nico Schottelius --- lib/cdist/{path.py => context.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/cdist/{path.py => context.py} (100%) diff --git a/lib/cdist/path.py b/lib/cdist/context.py similarity index 100% rename from lib/cdist/path.py rename to lib/cdist/context.py From b568a5886c24554d7b5f13ffd032b04c45b78422 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 11:56:16 +0200 Subject: [PATCH 0445/1024] retrieve explorers from explorer class and allow zero explorers Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 9e2b5edc..d0c27e54 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -60,9 +60,8 @@ class ConfigInstall: def run_global_explorers(self): """Run global explorers""" log.info("Running global explorers") - explorers = self.path.list_global_explorers() - if(len(explorers) == 0): - raise cdist.Error("No explorers found in " + self.path.global_explorer_dir) + + explorers = cdist.core.GlobalExplorer.list_explorers() self.path.transfer_global_explorers() for explorer in explorers: From f99df72931c8374a8f821310ed1f4af9b810806a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 12:04:12 +0200 Subject: [PATCH 0446/1024] ++todo for steven Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 0ff17f6a..0383c23e 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -6,3 +6,14 @@ Object: Type: explorer_path + +GlobalExplorer: + out_path: local path into which the output is written + + cdist.core.GlobalExplorer.base_dir - local directory containing explorers + cdist.core.GlobalExplorer.remote_base_dir - remote directory containing explorers + + path: local path to explorer + remote_path: remote path to explorer + + See config_install: run_global_explorers() From 8a4b8e9b66fa271f1e4b85aa185f110cfeb58d0e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 12:04:38 +0200 Subject: [PATCH 0447/1024] cleanup run_global_explorers() Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index d0c27e54..c2c4a804 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -57,23 +57,6 @@ class ConfigInstall: def cleanup(self): self.path.cleanup() - def run_global_explorers(self): - """Run global explorers""" - log.info("Running global explorers") - - explorers = cdist.core.GlobalExplorer.list_explorers() - - self.path.transfer_global_explorers() - for explorer in explorers: - output = self.path.global_explorer_output_path(explorer) - output_fd = open(output, mode='w') - cmd = [] - cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append(self.path.remote_global_explorer_path(explorer)) - - cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) - output_fd.close() - def run_type_explorer(self, cdist_object): """Run type specific explorers for objects""" @@ -225,6 +208,25 @@ class ConfigInstall: cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) ### Cleaned / check functions: Round 1 :-) ################################# + def run_global_explorers(self): + """Run global explorers""" + log.info("Running global explorers") + + src = cdist.core.GlobalExplorer.base_dir + dst = cdist.core.GlobalExplorer.remote_base_dir + + self.context.transfer_dir(src, dst) + + for explorer in cdist.core.GlobalExplorer.list_explorers(): + output_fd = open(explorer.out_path, mode='w') + cmd = [] + cmd.append("__explorer=" + cdist.core.GlobalExplorer.remote_base_dir) + cmd.append(explorer.remote_path) + + cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) + output_fd.close() + + def stage_run(self): """The final (and real) step of deployment""" log.info("Generating and executing code") From b936fea3e53729f6f74dc9aa2b36772da7f67d75 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 12:10:57 +0200 Subject: [PATCH 0448/1024] link to emulator in config_install and remove it from emulator Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 19 +++++++++++-------- lib/cdist/emulator.py | 9 --------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index c2c4a804..e3e15548 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -37,9 +37,7 @@ CODE_HEADER = "#!/bin/sh -e\n" class ConfigInstall: """Cdist main class to hold arbitrary data""" - def __init__(self, target_host, - initial_manifest=False, - home=None, + def __init__(self, target_host, initial_manifest=False, exec_path=sys.argv[0], debug=False): @@ -51,7 +49,6 @@ class ConfigInstall: self.path = cdist.path.Path(self.target_host, initial_manifest=initial_manifest, - base_dir=home, debug=debug) def cleanup(self): @@ -84,10 +81,7 @@ class ConfigInstall: cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=True) output_fd.close() - def link_emulator(self): - """Link emulator to types""" - cdist.emulator.link(self.exec_path, - self.path.bin_dir, self.path.list_types()) + def run_initial_manifest(self): """Run the initial manifest""" @@ -208,6 +202,15 @@ class ConfigInstall: cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) ### Cleaned / check functions: Round 1 :-) ################################# + def link_emulator(self): + """Link emulator to types""" + src = os.path.abspath(self.exec_path) + for type in cdist.core.Type.list_types(): + log.debug("Linking emulator: %s to %s", source, destination) + dst = os.path.join(self.context.bin_dir, type.name) + # FIXME: handle exception / make it more beautiful + os.symlink(src, dst) + def run_global_explorers(self): """Run global explorers""" log.info("Running global explorers") diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index f3e9ac30..77f26e7f 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -142,12 +142,3 @@ def run(argv): source_fd.close() log.debug("Finished " + type + "/" + object_id + repr(params)) - - -def link(exec_path, bin_dir, type_list): - """Link type names to cdist-type-emulator""" - source = os.path.abspath(exec_path) - for type in type_list: - destination = os.path.join(bin_dir, type) - log.debug("Linking %s to %s", source, destination) - os.symlink(source, destination) From 240383e4b625afd1ae222e83233efcb7292e24e4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 12:15:23 +0200 Subject: [PATCH 0449/1024] update todo steven Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 0383c23e..09c87851 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -5,7 +5,8 @@ Object: gencode_remote Type: - explorer_path + explorer_dir + remote_explorer_dir GlobalExplorer: out_path: local path into which the output is written From fecd5c99b649b6592b81ea888a7fade843786e65 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 12:18:04 +0200 Subject: [PATCH 0450/1024] ++todo steven Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 09c87851..77b74451 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,9 +1,11 @@ Object: code_remote - code_local + code gencode_local gencode_remote + path_remote + Type: explorer_dir remote_explorer_dir From 79dd98739df2ef323b685185b57c55a77c9a11bd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 12:29:49 +0200 Subject: [PATCH 0451/1024] ++todo steven Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 77b74451..41306a66 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -10,6 +10,9 @@ Type: explorer_dir remote_explorer_dir + explorer_remote_dir + + GlobalExplorer: out_path: local path into which the output is written From e301b74610827ccb2119d386e9393db6fb243856 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 12:42:11 +0200 Subject: [PATCH 0452/1024] ++steven Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 41306a66..cb452450 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,11 +1,13 @@ Object: code_remote code - gencode_local + gencode gencode_remote path_remote + explorer_out_dir + Type: explorer_dir remote_explorer_dir From 480c1bbb357d5bd8215401c5d0b0c3792ae9bc7b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 12:43:17 +0200 Subject: [PATCH 0453/1024] cleanup run_type_explorer() Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 56 +++++++++++++++++++------------------ lib/cdist/context.py | 17 +++++------ 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index e3e15548..b9442f68 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -54,33 +54,6 @@ class ConfigInstall: def cleanup(self): self.path.cleanup() - def run_type_explorer(self, cdist_object): - """Run type specific explorers for objects""" - - type = cdist_object.type - self.path.transfer_type_explorers(type) - - cmd = [] - cmd.append("__explorer=" + cdist.path.REMOTE_GLOBAL_EXPLORER_DIR) - cmd.append("__type_explorer=" + self.path.remote_type_explorer_dir(type)) - cmd.append("__object=" + self.path.remote_object_dir(cdist_object)) - cmd.append("__object_id=" + self.path.get_object_id_from_object(cdist_object)) - cmd.append("__object_fq=" + cdist_object) - - # Need to transfer at least the parameters for objects to be useful - self.path.transfer_object_parameter(cdist_object) - - explorers = self.path.list_type_explorers(type) - for explorer in explorers: - remote_cmd = cmd + [os.path.join(self.path.remote_type_explorer_dir(type), explorer)] - output = os.path.join(self.path.type_explorer_output_dir(cdist_object), explorer) - output_fd = open(output, mode='w') - log.debug("%s exploring %s using %s storing to %s", - cdist_object, explorer, remote_cmd, output) - - cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=True) - output_fd.close() - def run_initial_manifest(self): @@ -202,6 +175,35 @@ class ConfigInstall: cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) ### Cleaned / check functions: Round 1 :-) ################################# + def run_type_explorer(self, cdist_object): + """Run type specific explorers for objects""" + + type = cdist_object.type + # FIXME + self.path.transfer_type_explorers(type) + + cmd = [] + cmd.append("__explorer=" + self.context.remote_global_explorer_dir) + cmd.append("__type_explorer=" + type.explorer_remote_dir) + cmd.append("__object=" + object.path_remote) + cmd.append("__object_id=" + object.object_id) + cmd.append("__object_fq=" + cdist_object) + + # Need to transfer at least the parameters for objects to be useful + self.path.transfer_object_parameter(cdist_object) + + explorers = self.path.list_type_explorers(type) + for explorer in explorers: + remote_cmd = cmd + [os.path.join(type.explorer_remote_dir, explorer)] + output = os.path.join(cdist_object.explorer_output_dir(), explorer) + output_fd = open(output, mode='w') + log.debug("%s exploring %s using %s storing to %s", + cdist_object, explorer, remote_cmd, output) + + cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=True) + output_fd.close() + + def link_emulator(self): """Link emulator to types""" src = os.path.abspath(self.exec_path) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 44b121df..44f432a8 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -30,8 +30,8 @@ log = logging.getLogger(__name__) import cdist.exec -class Path: - """Class that handles path related configurations""" +class Context: + """Storing context dependent information""" def __init__(self, target_host, initial_manifest=False, debug=False): @@ -44,13 +44,14 @@ class Path: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) # Input directories - self.conf_dir = os.path.join(self.base_dir, "conf") - self.cache_base_dir = os.path.join(self.base_dir, "cache") - self.cache_dir = os.path.join(self.cache_base_dir, target_host) - self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") - self.lib_dir = os.path.join(self.base_dir, "lib") + self.cache_dir = os.path.join(self.base_dir, "cache", target_host) self.manifest_dir = os.path.join(self.conf_dir, "manifest") - self.type_base_dir = os.path.join(self.conf_dir, "type") + + # Probably unused paths + # self.conf_dir = os.path.join(self.base_dir, "conf") + # self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") + # self.lib_dir = os.path.join(self.base_dir, "lib") + # self.type_base_dir = os.path.join(self.conf_dir, "type") # Mostly static, but can be overwritten on user demand if initial_manifest: From 860473fcda835e8e9d94171a4e4229a907ba9192 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 12:46:03 +0200 Subject: [PATCH 0454/1024] +info required Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index cb452450..a4f2dd40 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -14,6 +14,8 @@ Type: explorer_remote_dir + type.manifest_path + GlobalExplorer: out_path: local path into which the output is written From 9473a3a19e24a9bde1bc6de9ec8875af3930c7f1 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 12:49:30 +0200 Subject: [PATCH 0455/1024] Type: implement explorer_dir, remote_explorer_dir Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index 7492659e..7856c92f 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -25,6 +25,8 @@ import os import cdist +# FIXME: i should not have to care about prefix directory, local, remote and such. +# I know what my internals look like, the outside is none of my business. class Type(object): """Represents a cdist type. @@ -51,6 +53,28 @@ class Type(object): except KeyError as e: raise cdist.MissingEnvironmentVariableError(e.args[0]) + @staticmethod + def remote_base_dir(): + """Return the absolute path to the top level directory where types + are kept on the remote/target host. + + Requires the environment variable '__cdist_remote_base_dir' to be set. + + """ + try: + return os.path.join( + os.environ['__cdist_remote_base_dir'], + 'conf', + 'type' + ) + except KeyError as e: + raise cdist.MissingEnvironmentVariableError(e.args[0]) + + # FIXME: probably wrong place for this + @property + def remote_explorer_dir(self): + return os.path.join(self.remote_path, "explorer") + @classmethod def list_types(cls): """Return a list of type instances""" @@ -80,6 +104,13 @@ class Type(object): self.base_dir(), self.name ) + # FIXME: prefix directory should not leak into me + @property + def remote_path(self): + return os.path.join( + self.remote_base_dir(), + self.name + ) @property def is_singleton(self): From 9a8e1681687b7eca7f9c04dc595fb593697195ce Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 12:50:00 +0200 Subject: [PATCH 0456/1024] --todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 7 ------- 1 file changed, 7 deletions(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 41306a66..37945166 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -6,13 +6,6 @@ Object: path_remote -Type: - explorer_dir - remote_explorer_dir - - explorer_remote_dir - - GlobalExplorer: out_path: local path into which the output is written From 4a98b9af55931dccd565ee243abaccc02ff748f0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 12:56:36 +0200 Subject: [PATCH 0457/1024] finish run_type_manifest Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index b9442f68..96f9224e 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -47,15 +47,13 @@ class ConfigInstall: self.debug = debug self.exec_path = exec_path - self.path = cdist.path.Path(self.target_host, - initial_manifest=initial_manifest, - debug=debug) + self.context = cdist.context.Context(self.target_host, + initial_manifest=initial_manifest, + debug=debug) def cleanup(self): self.path.cleanup() - - def run_initial_manifest(self): """Run the initial manifest""" log.info("Running initial manifest %s", self.path.initial_manifest) @@ -64,15 +62,15 @@ class ConfigInstall: def run_type_manifest(self, cdist_object): """Run manifest for a specific object""" - type = self.path.get_type_from_object(cdist_object) - manifest = self.path.type_dir(type, "manifest") + type = cdist_object.type + manifest = type.manifest_path - log.debug("%s: Running %s", cdist_object, manifest) + log.debug("%s: Running %s", cdist_object.name, manifest) if os.path.exists(manifest): - env = { "__object" : self.path.object_dir(cdist_object), - "__object_id": self.path.get_object_id_from_object(cdist_object), - "__object_fq": cdist_object, - "__type": self.path.type_dir(type) + env = { "__object" : cdist_object.path, + "__object_id": cdist_object.object_id, + "__object_fq": cdist_object.name, + "__type": type.path, } self.run_manifest(manifest, extra_env=env) @@ -80,11 +78,14 @@ class ConfigInstall: """Run a manifest""" log.debug("Running manifest %s, env=%s", manifest, extra_env) env = os.environ.copy() - env['PATH'] = self.path.bin_dir + ":" + env['PATH'] + env['PATH'] = self.context.bin_dir + ":" + env['PATH'] # Information required in every manifest env['__target_host'] = self.target_host - env['__global'] = self.path.out_dir + + # FIXME: __global == __cdist_out_dir + # FIXME: __global? shouldn't this be $global? + env['__global'] = self.context.out_dir # Submit debug flag to manifest, can be used by emulator and types if self.debug: @@ -102,6 +103,7 @@ class ConfigInstall: cdist.exec.shell_run_or_debug_fail(manifest, [manifest], env=env) +################################################################################ def object_run(self, cdist_object, mode): """Run gencode or code for an object""" log.debug("Running %s from %s", mode, cdist_object) From 00550edfcbed8f767994ac602846cb7ff634de42 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 12:58:35 +0200 Subject: [PATCH 0458/1024] finish run_manifest() Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 96f9224e..548d3808 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -83,8 +83,7 @@ class ConfigInstall: # Information required in every manifest env['__target_host'] = self.target_host - # FIXME: __global == __cdist_out_dir - # FIXME: __global? shouldn't this be $global? + # FIXME: __global == __cdist_out_dir - duplication env['__global'] = self.context.out_dir # Submit debug flag to manifest, can be used by emulator and types @@ -95,7 +94,7 @@ class ConfigInstall: env['__cdist_manifest'] = manifest # Required to find types - env['__cdist_type_base_dir'] = self.path.type_base_dir + env['__cdist_type_base_dir'] = type.path # Other environment stuff if extra_env: @@ -104,6 +103,7 @@ class ConfigInstall: cdist.exec.shell_run_or_debug_fail(manifest, [manifest], env=env) ################################################################################ + def object_run(self, cdist_object, mode): """Run gencode or code for an object""" log.debug("Running %s from %s", mode, cdist_object) From 34f2999e146aa10ca72dc72a9c4d8c3621c756e9 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 12:59:29 +0200 Subject: [PATCH 0459/1024] Type: implement manifest_path Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index 7856c92f..36f6c276 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -70,11 +70,6 @@ class Type(object): except KeyError as e: raise cdist.MissingEnvironmentVariableError(e.args[0]) - # FIXME: probably wrong place for this - @property - def remote_explorer_dir(self): - return os.path.join(self.remote_path, "explorer") - @classmethod def list_types(cls): """Return a list of type instances""" @@ -112,6 +107,15 @@ class Type(object): self.name ) + # FIXME: probably wrong place for this + @property + def remote_explorer_dir(self): + return os.path.join(self.remote_path, "explorer") + + @property + def manifest_path(self): + return os.path.join(self.path, "manifest") + @property def is_singleton(self): """Check whether a type is a singleton.""" From d3ae8b7c9017d49ff81ae9d3d969f3753809f34b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 12:59:53 +0200 Subject: [PATCH 0460/1024] --todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index a2a4740e..d35565eb 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -10,7 +10,6 @@ Object: Type: - type.manifest_path GlobalExplorer: From 4f33e5222dda3bb2477281b613277ac3214172d0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 13:04:00 +0200 Subject: [PATCH 0461/1024] Type: implement gencode, gencode_remote Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index 36f6c276..f679bb04 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -116,6 +116,14 @@ class Type(object): def manifest_path(self): return os.path.join(self.path, "manifest") + @property + def gencode(self): + return os.path.join(self.path, "gencode-local") + + @property + def gencode_remote(self): + return os.path.join(self.path, "gencode-remote") + @property def is_singleton(self): """Check whether a type is a singleton.""" From 9482f9ef439aabffe2640a1a5eaec37ab1d0aea7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 13:05:06 +0200 Subject: [PATCH 0462/1024] --todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index d35565eb..0bf8aed1 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,10 +1,6 @@ Object: code_remote code - gencode - gencode_remote - - path_remote explorer_out_dir From 3ef97980987bd113ad618bc31dcd14212bfa74a9 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 13:06:56 +0200 Subject: [PATCH 0463/1024] implement code, code_remote Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 85822a24..65abc012 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -108,6 +108,13 @@ class Object(object): DOT_CDIST ) + @property + def code(self): + return os.path.join(self.path, "code-local") + + @property + def code_remote(self): + return os.path.join(self.path, "code-remote") ### requirements @property From 36803d16dbaccc689bdb2d16adc1cedcdb3e619e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 13:07:13 +0200 Subject: [PATCH 0464/1024] --todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 0bf8aed1..144c4150 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,6 +1,4 @@ Object: - code_remote - code explorer_out_dir From af5a99dc9fd7ca6ef10589eee7bcc73c88ed8a17 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:14:47 +0200 Subject: [PATCH 0465/1024] update object_run() for new interface Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 548d3808..64ad33d0 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -108,11 +108,11 @@ class ConfigInstall: """Run gencode or code for an object""" log.debug("Running %s from %s", mode, cdist_object) - # FIXME: replace with new object interface - file=os.path.join(self.path.object_dir(cdist_object), "require") - requirements = cdist.path.file_to_list(file) - type = self.path.get_type_from_object(cdist_object) + requirements = cdist_object.requirements + type = cdist_object.type + # FIXME: ensure objects are not run multiple times! + # FIXME: probably mark objects! for requirement in requirements: log.debug("Object %s requires %s", cdist_object, requirement) self.object_run(requirement, mode=mode) @@ -122,22 +122,23 @@ class ConfigInstall: # env = os.environ.copy() env['__target_host'] = self.target_host - env['__global'] = self.path.out_dir - env["__object"] = self.path.object_dir(cdist_object) - env["__object_id"] = self.path.get_object_id_from_object(cdist_object) - env["__object_fq"] = cdist_object - env["__type"] = self.path.type_dir(type) + env['__global'] = self.context.out_dir + env["__object"] = cdist_object.path + env["__object_id"] = cdist_object.object_id + env["__object_fq"] = cdist_object.name + env["__type"] = type.name if mode == "gencode": paths = [ - self.path.type_dir(type, "gencode-local"), - self.path.type_dir(type, "gencode-remote") + type.gencode + type.gencode_remote ] - for bin in paths: + + for cmd in ["local", "remote"]: + bin = getattr(type, "gencode_" + cmd) + if os.path.isfile(bin): - # omit "gen" from gencode and use it for output base - outfile=os.path.join(self.path.object_dir(cdist_object), - os.path.basename(bin)[3:]) + outfile = getattr(cdist_object, "code_" + cmd) outfile_fd = open(outfile, "w") @@ -157,6 +158,7 @@ class ConfigInstall: # Add header and make executable - identically to 0o700 os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + # FIXME: use new interface # Mark object as changed open(os.path.join(self.path.object_dir(cdist_object), "changed"), "w").close() From 6e011dc289c4545c4d078f3dec86b3f038a45295 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 13:15:11 +0200 Subject: [PATCH 0466/1024] implement explorer_out_dir Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 65abc012..e224a18f 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -116,6 +116,13 @@ class Object(object): def code_remote(self): return os.path.join(self.path, "code-remote") + @property + def explorer_out_dir(self): + path = os.path.join(self.path, "explorer") + if not os.path.isdir(path): + os.mkdir(path) + return path + ### requirements @property def requirements(self): From d36ab75b1a38066b7195b47685997827e76a874b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 13:15:23 +0200 Subject: [PATCH 0467/1024] --todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 144c4150..262255d7 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,7 +1,5 @@ Object: - explorer_out_dir - Type: From d9f86e26d96afd6adcc6115bd01e3be13a8a6795 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 13:15:52 +0200 Subject: [PATCH 0468/1024] consistent naming Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index e224a18f..c47fc905 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -109,7 +109,7 @@ class Object(object): ) @property - def code(self): + def code_local(self): return os.path.join(self.path, "code-local") @property From 4db02516e7952d6ab3219d1beb84b4db7f7a6c3d Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 13:16:14 +0200 Subject: [PATCH 0469/1024] consistent naming Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index f679bb04..8439464e 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -117,7 +117,7 @@ class Type(object): return os.path.join(self.path, "manifest") @property - def gencode(self): + def gencode_local(self): return os.path.join(self.path, "gencode-local") @property From f121934769959386d3e95e77d37663323bb083e3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:34:22 +0200 Subject: [PATCH 0470/1024] cleanup object_run() finally Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 99 +++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 55 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 64ad33d0..d77f6d7b 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -104,16 +104,17 @@ class ConfigInstall: ################################################################################ - def object_run(self, cdist_object, mode): + def object_run(self, cdist_object): """Run gencode or code for an object""" log.debug("Running %s from %s", mode, cdist_object) - requirements = cdist_object.requirements + # Catch requirements, which re-call us + if cdist_object.ran: + return + type = cdist_object.type - # FIXME: ensure objects are not run multiple times! - # FIXME: probably mark objects! - for requirement in requirements: + for requirement in cdist_object.requirements: log.debug("Object %s requires %s", cdist_object, requirement) self.object_run(requirement, mode=mode) @@ -128,56 +129,46 @@ class ConfigInstall: env["__object_fq"] = cdist_object.name env["__type"] = type.name - if mode == "gencode": - paths = [ - type.gencode - type.gencode_remote - ] + # gencode + for cmd in ["local", "remote"]: + bin = getattr(type, "gencode_" + cmd) - for cmd in ["local", "remote"]: - bin = getattr(type, "gencode_" + cmd) - - if os.path.isfile(bin): - outfile = getattr(cdist_object, "code_" + cmd) - - outfile_fd = open(outfile, "w") - - # Need to flush to ensure our write is done before stdout write - outfile_fd.write(CODE_HEADER) - outfile_fd.flush() - - cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) - outfile_fd.close() - - status = os.stat(outfile) - - # Remove output if empty, else make it executable - if status.st_size == len(CODE_HEADER): - os.unlink(outfile) - else: - # Add header and make executable - identically to 0o700 - os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) - - # FIXME: use new interface - # Mark object as changed - open(os.path.join(self.path.object_dir(cdist_object), "changed"), "w").close() - - - if mode == "code": - local_dir = self.path.object_dir(cdist_object) - remote_dir = self.path.remote_object_dir(cdist_object) - - bin = os.path.join(local_dir, "code-local") if os.path.isfile(bin): - cdist.exec.run_or_fail([bin]) - + outfile = getattr(cdist_object, "code_" + cmd) + + outfile_fd = open(outfile, "w") + + # Need to flush to ensure our write is done before stdout write + outfile_fd.write(CODE_HEADER) + outfile_fd.flush() + + cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) + outfile_fd.close() + + status = os.stat(outfile) + + # Remove output if empty, else make it executable + if status.st_size == len(CODE_HEADER): + os.unlink(outfile) + else: + # Add header and make executable - identically to 0o700 + os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + cdist_object.changed=True + + # code local + code_local = cdist_object.code_local + if os.path.isfile(code_local): + cdist.exec.run_or_fail([code_local]) + + # code remote + local_remote_code = cdist_object.code_remote + remote_remote_code = cdist_object.code_remote_remote + if os.path.isfile(local_remote_code): + self.context.transfer_file(local_remote_code, remote_remote_code) + cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) + + cdist_object.ran = True - local_remote_code = os.path.join(local_dir, "code-remote") - remote_remote_code = os.path.join(remote_dir, "code-remote") - if os.path.isfile(local_remote_code): - self.path.transfer_file(local_remote_code, remote_remote_code) - cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) - ### Cleaned / check functions: Round 1 :-) ################################# def run_type_explorer(self, cdist_object): """Run type specific explorers for objects""" @@ -239,11 +230,9 @@ class ConfigInstall: def stage_run(self): """The final (and real) step of deployment""" log.info("Generating and executing code") - # Now do the final steps over the existing objects for cdist_object in cdist.core.Object.list_objects(): log.debug("Run object: %s", cdist_object) - self.object_run(cdist_object, mode="gencode") - self.object_run(cdist_object, mode="code") + self.object_run(cdist_object) def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" From ca5361afc1df1cdb585f581281e9cc5bccf16868 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:36:51 +0200 Subject: [PATCH 0471/1024] remote cdist.path, use base_dir Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 2 +- lib/cdist/config_install.py | 5 ++--- lib/cdist/emulator.py | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 942d2917..c5f4b4ef 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -42,7 +42,7 @@ def config(args): os.environ['__remote_copy'] = "scp -o User=root -q" for host in args.host: - c = Config(host, initial_manifest=args.manifest, home=args.cdist_home, debug=args.debug) + c = Config(host, initial_manifest=args.manifest, base_dir=args.cdist_home, debug=args.debug) if args.parallel: log.debug("Creating child process for %s", host) process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index d77f6d7b..a8ea9043 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -25,10 +25,9 @@ import os import stat import sys -import cdist.emulator -import cdist.path - +import cdist.context import cdist.core +import cdist.emulator log = logging.getLogger(__name__) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 77f26e7f..aa22e1fa 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -24,7 +24,6 @@ import logging import os import cdist -import cdist.path log = logging.getLogger(__name__) From 386e2ca34c2c400a6d848dd0f8bc24d50c4f72ce Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:37:56 +0200 Subject: [PATCH 0472/1024] make cli work again Signed-off-by: Nico Schottelius --- bin/cdist | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 36dc3d5c..bd6825eb 100755 --- a/bin/cdist +++ b/bin/cdist @@ -115,9 +115,7 @@ if __name__ == "__main__": import cdist import cdist.banner import cdist.config - import cdist.exec import cdist.install - import cdist.path commandline() From 1138d8b439acb2f343a4d4f046882ec10b9dff84 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:44:07 +0200 Subject: [PATCH 0473/1024] remote_remote_code_remote_remote Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index a8ea9043..e8d179e8 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -101,8 +101,6 @@ class ConfigInstall: cdist.exec.shell_run_or_debug_fail(manifest, [manifest], env=env) -################################################################################ - def object_run(self, cdist_object): """Run gencode or code for an object""" log.debug("Running %s from %s", mode, cdist_object) @@ -161,7 +159,7 @@ class ConfigInstall: # code remote local_remote_code = cdist_object.code_remote - remote_remote_code = cdist_object.code_remote_remote + remote_remote_code = cdist_object.remote_code_remote if os.path.isfile(local_remote_code): self.context.transfer_file(local_remote_code, remote_remote_code) cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) From 2b0a337584b929546e1515824c3b8ccc991ab7ec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:45:19 +0200 Subject: [PATCH 0474/1024] fix base_dir passing Signed-off-by: Nico Schottelius --- bin/cdist | 1 - lib/cdist/config_install.py | 7 ++++--- lib/cdist/context.py | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index bd6825eb..7d2c035b 100755 --- a/bin/cdist +++ b/bin/cdist @@ -112,7 +112,6 @@ if __name__ == "__main__": import cdist.emulator cdist.emulator.run(sys.argv) else: - import cdist import cdist.banner import cdist.config import cdist.install diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index e8d179e8..407cdcd7 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -37,8 +37,9 @@ class ConfigInstall: """Cdist main class to hold arbitrary data""" def __init__(self, target_host, initial_manifest=False, - exec_path=sys.argv[0], - debug=False): + base_dir=False, + exec_path=sys.argv[0], + debug=False): self.target_host = target_host os.environ['target_host'] = target_host @@ -47,7 +48,7 @@ class ConfigInstall: self.exec_path = exec_path self.context = cdist.context.Context(self.target_host, - initial_manifest=initial_manifest, + initial_manifest=initial_manifest, base_dir=base_dir, debug=debug) def cleanup(self): diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 44f432a8..1615d196 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -33,12 +33,15 @@ import cdist.exec class Context: """Storing context dependent information""" - def __init__(self, target_host, initial_manifest=False, debug=False): + def __init__(self, target_host, initial_manifest=False, base_dir=False, + debug=False): self.target_host = target_host # Base and Temp Base - if "__cdist_base_dir" in os.environ: + if base_dir: + self.base_dir = base_dir + elif "__cdist_base_dir" in os.environ: self.base_dir = os.environ['__cdist_base_dir'] else: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) From fc7ae28b02f10109ccde685ccfd04021b7131558 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:45:45 +0200 Subject: [PATCH 0475/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index bfbdd8c3..b8fcc5b0 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -8,6 +8,8 @@ - Create GlobalExplorer +- base_dir passing in config/config_install superseeded by __cdist_base_dir? + -------------------------------------------------------------------------------- - insert prefix into logger to distinguish between modules From e03ebcd5c163ca583279ae937c4f837a98ea3f4a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:46:30 +0200 Subject: [PATCH 0476/1024] require conf_dir to find manifest_dir to find manifest Signed-off-by: Nico Schottelius --- lib/cdist/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 1615d196..673309af 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -48,10 +48,10 @@ class Context: # Input directories self.cache_dir = os.path.join(self.base_dir, "cache", target_host) + self.conf_dir = os.path.join(self.base_dir, "conf") self.manifest_dir = os.path.join(self.conf_dir, "manifest") # Probably unused paths - # self.conf_dir = os.path.join(self.base_dir, "conf") # self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") # self.lib_dir = os.path.join(self.base_dir, "lib") # self.type_base_dir = os.path.join(self.conf_dir, "type") From fc6ae548893fd9bc1a447e79aec70ba417145057 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:48:10 +0200 Subject: [PATCH 0477/1024] os.path not os Signed-off-by: Nico Schottelius --- lib/cdist/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 673309af..3ecd84e0 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -106,7 +106,7 @@ class Context: """Initialise output directory structure""" # Create base dir, if user supplied and not existing - if not os.isdir(self.base_dir): + if not os.path.isdir(self.base_dir): os.mkdir(self.base_dir) os.mkdir(self.out_dir) From ed347ffb8a547ca3df02a98b2241c29bc3a20faf Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:49:14 +0200 Subject: [PATCH 0478/1024] fix init_deploy() Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 407cdcd7..8d926447 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -247,8 +247,8 @@ class ConfigInstall: """Ensure the base directories are cleaned up""" log.debug("Creating clean directory structure") - self.path.remove_remote_dir(cdist.path.REMOTE_BASE_DIR) - self.path.remote_mkdir(cdist.path.REMOTE_BASE_DIR) + self.context.remove_remote_dir(self.context.remote_base_dir) + self.context.remote_mkdir(self.context.remote_base_dir) self.link_emulator() def stage_prepare(self): From f39418a7b5f9d71c7ec49b1ffa1f5bbd1126ade0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 13:50:17 +0200 Subject: [PATCH 0479/1024] implement remote_code_remote :-( Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 42 ++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index c47fc905..b4469e61 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -31,7 +31,8 @@ log = logging.getLogger(__name__) DOT_CDIST = '.cdist' - +# FIXME: i should not have to care about prefix directory, local, remote and such. +# I know what my internals look like, the outside is none of my business. class Object(object): """Represents a cdist object. @@ -63,6 +64,21 @@ class Object(object): return base_dir @classmethod + def remote_base_dir(): + """Return the absolute path to the top level directory where objects + are kept on the remote/target host. + + Requires the environment variable '__cdist_remote_out_dir' to be set. + + """ + try: + return os.path.join( + os.environ['__cdist_remote_out_dir'], + 'object', + ) + except KeyError as e: + raise cdist.MissingEnvironmentVariableError(e.args[0]) + def list_objects(cls): """Return a list of object instances""" for object_name in cls.list_object_names(): @@ -123,6 +139,19 @@ class Object(object): os.mkdir(path) return path + # FIXME: prefix directory should not leak into me + @property + def remote_path(self): + return os.path.join( + self.remote_base_dir(), + self.name, + DOT_CDIST + ) + @property + def remote_code_remote(self): + return os.path.join(self.remote_path, "code-remote") + + ### requirements @property def requirements(self): @@ -175,18 +204,7 @@ class Object(object): pass ### /changed - # FIXME: implement other properties/methods - # FIXME: check following methods: implement or revoke / delete - # FIXME: Object - def get_object_id_from_object(self, cdist_object): - """Returns everything but the first part (i.e. object_id) of an object""" - return os.sep.join(cdist_object.split(os.sep)[1:]) - - # FIXME: Object - def object_dir(self, cdist_object): - """Returns the full path to the object (including .cdist)""" - return os.path.join(self.object_base_dir, cdist_object, DOT_CDIST) # FIXME: Object def remote_object_dir(self, cdist_object): From 1b484e2d87111d0c44bdeb8e985d6f45937618bd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:50:37 +0200 Subject: [PATCH 0480/1024] setup __cdist_base_dir Signed-off-by: Nico Schottelius --- lib/cdist/context.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 3ecd84e0..a503372f 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -45,6 +45,7 @@ class Context: self.base_dir = os.environ['__cdist_base_dir'] else: self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) + # Input directories self.cache_dir = os.path.join(self.base_dir, "cache", target_host) @@ -86,6 +87,8 @@ class Context: # Create directories self.__init_out_dirs() + self.__init_env() + def cleanup(self): # Do not use in __del__: # http://docs.python.org/reference/datamodel.html#customization @@ -100,7 +103,8 @@ class Context: def __init_env(self): """Setup environment""" - os.environ['__cdist_out_dir'] = self.out_dir + os.environ['__cdist_out_dir'] = self.out_dir + os.environ['__cdist_base_dir'] = self.base_dir def __init_out_dirs(self): """Initialise output directory structure""" From fa1a4263e062507003bc569e15086d4b184c0232 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 13:51:00 +0200 Subject: [PATCH 0481/1024] setup __cdist_base_dir Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 8d926447..71d352da 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -201,8 +201,9 @@ class ConfigInstall: """Link emulator to types""" src = os.path.abspath(self.exec_path) for type in cdist.core.Type.list_types(): - log.debug("Linking emulator: %s to %s", source, destination) dst = os.path.join(self.context.bin_dir, type.name) + log.debug("Linking emulator: %s to %s", src, dst) + # FIXME: handle exception / make it more beautiful os.symlink(src, dst) From 1992c9a1751b0bc5c3143224ed8c46693fc87e46 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 13:52:55 +0200 Subject: [PATCH 0482/1024] --legacy code Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 44 ---------------------------------------- 1 file changed, 44 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index b4469e61..b922701d 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -95,7 +95,6 @@ class Object(object): def list_object_names(cls): """Return a list of object names""" for path, dirs, files in os.walk(cls.base_dir()): - # FIXME: use constant instead of string if DOT_CDIST in dirs: yield os.path.relpath(path, cls.base_dir()) @@ -206,11 +205,6 @@ class Object(object): - # FIXME: Object - def remote_object_dir(self, cdist_object): - """Returns the remote full path to the object (including .cdist)""" - return os.path.join(REMOTE_OBJECT_DIR, cdist_object, DOT_CDIST) - # FIXME: Object def object_parameter_dir(self, cdist_object): """Returns the dir to the object parameter""" @@ -227,41 +221,3 @@ class Object(object): return [os.path.join(self.object_dir(cdist_object), "code-local"), os.path.join(self.object_dir(cdist_object), "code-remote")] - # Stays here - def list_object_paths(self, starting_point): - """Return list of paths of existing objects""" - object_paths = [] - - for content in os.listdir(starting_point): - full_path = os.path.join(starting_point, content) - if os.path.isdir(full_path): - object_paths.extend(self.list_object_paths(starting_point = full_path)) - - # Directory contains .cdist -> is an object - if content == DOT_CDIST: - object_paths.append(starting_point) - - return object_paths - - # Stays here - def list_objects(self): - """Return list of existing objects""" - - objects = [] - if os.path.isdir(self.object_base_dir): - object_paths = self.list_object_paths(self.object_base_dir) - - for path in object_paths: - objects.append(os.path.relpath(path, self.object_base_dir)) - - return objects - - # FIXME: object - def type_explorer_output_dir(self, cdist_object): - """Returns and creates dir of the output for a type explorer""" - dir = os.path.join(self.object_dir(cdist_object), "explorer") - if not os.path.isdir(dir): - os.mkdir(dir) - - return dir - From 13ec2a82b6689b075f6c65ea8dc1fb51105cd037 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 14:25:39 +0200 Subject: [PATCH 0483/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 262255d7..0760f368 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -14,3 +14,7 @@ GlobalExplorer: remote_path: remote path to explorer See config_install: run_global_explorers() + +Object/Type: + - rutern relative only + - Have accept absulet path on listing From e1f0d60e8bf3aff20d028ea7920105fa274e0aec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:03:26 +0200 Subject: [PATCH 0484/1024] restructure to _path and do not make context dependent on env Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 9 +++-- lib/cdist/context.py | 75 ++++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 38 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 71d352da..d122348d 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -54,11 +54,14 @@ class ConfigInstall: def cleanup(self): self.path.cleanup() + def __init_env(self): + """Setup environment""" + def run_initial_manifest(self): """Run the initial manifest""" - log.info("Running initial manifest %s", self.path.initial_manifest) - env = { "__manifest" : self.path.manifest_dir } - self.run_manifest(self.path.initial_manifest, extra_env=env) + log.info("Running initial manifest %s", self.context.initial_manifest) + env = { "__manifest" : self.context.manifest_dir } + self.run_manifest(self.context.initial_manifest, extra_env=env) def run_type_manifest(self, cdist_object): """Run manifest for a specific object""" diff --git a/lib/cdist/context.py b/lib/cdist/context.py index a503372f..edc29d60 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -31,58 +31,63 @@ log = logging.getLogger(__name__) import cdist.exec class Context: - """Storing context dependent information""" + """Storing context information""" - def __init__(self, target_host, initial_manifest=False, base_dir=False, + def __init__(self, + target_host, + initial_manifest=False, + base_path=False, + out_path=False, debug=False): self.target_host = target_host # Base and Temp Base - if base_dir: - self.base_dir = base_dir - elif "__cdist_base_dir" in os.environ: - self.base_dir = os.environ['__cdist_base_dir'] + if base_path: + self.base_path = base_path else: - self.base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) + self.base_path = + os.path.abspath( + os.path.join(os.path.dirname(__file__), + os.pardir, + os.pardir)) # Input directories - self.cache_dir = os.path.join(self.base_dir, "cache", target_host) - self.conf_dir = os.path.join(self.base_dir, "conf") - self.manifest_dir = os.path.join(self.conf_dir, "manifest") + self.cache_path = os.path.join(self.base_path, "cache", target_host) + self.conf_path = os.path.join(self.base_path, "conf") - # Probably unused paths - # self.global_explorer_dir = os.path.join(self.conf_dir, "explorer") - # self.lib_dir = os.path.join(self.base_dir, "lib") - # self.type_base_dir = os.path.join(self.conf_dir, "type") + self.global_explorer_path = os.path.join(self.conf_path, "explorer") + self.manifest_path = os.path.join(self.conf_path, "manifest") + self.type_base_path = os.path.join(self.conf_path, "type") + self.lib_path = os.path.join(self.base_path, "lib") # Mostly static, but can be overwritten on user demand if initial_manifest: self.initial_manifest = initial_manifest else: - self.initial_manifest = os.path.join(self.manifest_dir, "init") + self.initial_manifest = os.path.join(self.manifest_path, "init") # Output directories - if "__cdist_out_dir" in os.environ: - self.out_dir = os.environ['__cdist_out_dir'] + if out_path: + self.out_path = out_path: else: - self.out_dir = os.path.join(tempfile.mkdtemp(), "out") + self.out_path = os.path.join(tempfile.mkdtemp(), "out") - self.global_explorer_out_dir = os.path.join(self.out_dir, "explorer") - self.object_base_dir = os.path.join(self.out_dir, "object") - self.bin_dir = os.path.join(self.out_dir, "bin") + self.global_explorer_out_path = os.path.join(self.out_path, "explorer") + self.object_base_path = os.path.join(self.out_path, "object") + self.bin_path = os.path.join(self.out_path, "bin") # Remote directories - if "__cdist_remote_base_dir" in os.environ: - self.remote_base_dir = os.environ['__cdist_remote_base_dir'] + if "__cdist_remote_base_path" in os.environ: + self.remote_base_path = os.environ['__cdist_remote_base_path'] else: - self.remote_base_dir = "/var/lib/cdist" + self.remote_base_path = "/var/lib/cdist" - self.remote_conf_dir = os.path.join(self.remote_base_dir, "conf") - self.remote_object_dir = os.path.join(self.remote_base_dir, "object") - self.remote_type_dir = os.path.join(self.remote_conf_dir, "type") - self.remote_global_explorer_dir = os.path.join(self.remote_conf_dir, "explorer") + self.remote_conf_path = os.path.join(self.remote_base_path, "conf") + self.remote_object_dir = os.path.join(self.remote_base_path, "object") + self.remote_type_dir = os.path.join(self.remote_conf_path, "type") + self.remote_global_explorer_dir = os.path.join(self.remote_conf_path, "explorer") # Create directories self.__init_out_dirs() @@ -95,23 +100,23 @@ class Context: # "other globals referenced by the __del__() method may already have been deleted # or in the process of being torn down (e.g. the import machinery shutting down)" # - log.debug("Saving" + self.base_dir + "to " + self.cache_dir) + log.debug("Saving" + self.base_path + "to " + self.cache_path) # Remove previous cache - if os.path.exists(self.cache_dir): - shutil.rmtree(self.cache_dir) - shutil.move(self.base_dir, self.cache_dir) + if os.path.exists(self.cache_path): + shutil.rmtree(self.cache_path) + shutil.move(self.base_path, self.cache_path) def __init_env(self): """Setup environment""" os.environ['__cdist_out_dir'] = self.out_dir - os.environ['__cdist_base_dir'] = self.base_dir + os.environ['__cdist_base_path'] = self.base_path def __init_out_dirs(self): """Initialise output directory structure""" # Create base dir, if user supplied and not existing - if not os.path.isdir(self.base_dir): - os.mkdir(self.base_dir) + if not os.path.isdir(self.base_path): + os.mkdir(self.base_path) os.mkdir(self.out_dir) os.mkdir(self.global_explorer_out_dir) From 7169d6ac42385093f721a534504b96389a18227d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:05:52 +0200 Subject: [PATCH 0485/1024] more s/_dir/_path/g Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 57 +++++++++++++++++++------------------ lib/cdist/context.py | 34 +++++++++++----------- 2 files changed, 46 insertions(+), 45 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index d122348d..e8d8b0c9 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -37,7 +37,7 @@ class ConfigInstall: """Cdist main class to hold arbitrary data""" def __init__(self, target_host, initial_manifest=False, - base_dir=False, + base_path=False, exec_path=sys.argv[0], debug=False): @@ -48,7 +48,7 @@ class ConfigInstall: self.exec_path = exec_path self.context = cdist.context.Context(self.target_host, - initial_manifest=initial_manifest, base_dir=base_dir, + initial_manifest=initial_manifest, base_path=base_path, debug=debug) def cleanup(self): @@ -60,17 +60,18 @@ class ConfigInstall: def run_initial_manifest(self): """Run the initial manifest""" log.info("Running initial manifest %s", self.context.initial_manifest) - env = { "__manifest" : self.context.manifest_dir } + env = { "__manifest" : self.context.manifest_path } self.run_manifest(self.context.initial_manifest, extra_env=env) def run_type_manifest(self, cdist_object): """Run manifest for a specific object""" type = cdist_object.type - manifest = type.manifest_path + manifest_path = os.path.join(self.context.type_base_path, + type.manifest_path) log.debug("%s: Running %s", cdist_object.name, manifest) if os.path.exists(manifest): - env = { "__object" : cdist_object.path, + env = { "__object" : os.path.join(self.context.cdist_object.path, "__object_id": cdist_object.object_id, "__object_fq": cdist_object.name, "__type": type.path, @@ -81,13 +82,13 @@ class ConfigInstall: """Run a manifest""" log.debug("Running manifest %s, env=%s", manifest, extra_env) env = os.environ.copy() - env['PATH'] = self.context.bin_dir + ":" + env['PATH'] + env['PATH'] = self.context.bin_path + ":" + env['PATH'] # Information required in every manifest env['__target_host'] = self.target_host - # FIXME: __global == __cdist_out_dir - duplication - env['__global'] = self.context.out_dir + # FIXME: __global == __cdist_out_path - duplication + env['__global'] = self.context.out_path # Submit debug flag to manifest, can be used by emulator and types if self.debug: @@ -97,7 +98,7 @@ class ConfigInstall: env['__cdist_manifest'] = manifest # Required to find types - env['__cdist_type_base_dir'] = type.path + env['__cdist_type_base_path'] = type.path # Other environment stuff if extra_env: @@ -124,7 +125,7 @@ class ConfigInstall: # env = os.environ.copy() env['__target_host'] = self.target_host - env['__global'] = self.context.out_dir + env['__global'] = self.context.out_path env["__object"] = cdist_object.path env["__object_id"] = cdist_object.object_id env["__object_fq"] = cdist_object.name @@ -179,8 +180,8 @@ class ConfigInstall: self.path.transfer_type_explorers(type) cmd = [] - cmd.append("__explorer=" + self.context.remote_global_explorer_dir) - cmd.append("__type_explorer=" + type.explorer_remote_dir) + cmd.append("__explorer=" + self.context.remote_global_explorer_path) + cmd.append("__type_explorer=" + type.explorer_remote_path) cmd.append("__object=" + object.path_remote) cmd.append("__object_id=" + object.object_id) cmd.append("__object_fq=" + cdist_object) @@ -190,8 +191,8 @@ class ConfigInstall: explorers = self.path.list_type_explorers(type) for explorer in explorers: - remote_cmd = cmd + [os.path.join(type.explorer_remote_dir, explorer)] - output = os.path.join(cdist_object.explorer_output_dir(), explorer) + remote_cmd = cmd + [os.path.join(type.explorer_remote_path, explorer)] + output = os.path.join(cdist_object.explorer_output_path(), explorer) output_fd = open(output, mode='w') log.debug("%s exploring %s using %s storing to %s", cdist_object, explorer, remote_cmd, output) @@ -204,7 +205,7 @@ class ConfigInstall: """Link emulator to types""" src = os.path.abspath(self.exec_path) for type in cdist.core.Type.list_types(): - dst = os.path.join(self.context.bin_dir, type.name) + dst = os.path.join(self.context.bin_path, type.name) log.debug("Linking emulator: %s to %s", src, dst) # FIXME: handle exception / make it more beautiful @@ -214,15 +215,15 @@ class ConfigInstall: """Run global explorers""" log.info("Running global explorers") - src = cdist.core.GlobalExplorer.base_dir - dst = cdist.core.GlobalExplorer.remote_base_dir + src = cdist.core.GlobalExplorer.base_path + dst = cdist.core.GlobalExplorer.remote_base_path - self.context.transfer_dir(src, dst) + self.context.transfer_path(src, dst) for explorer in cdist.core.GlobalExplorer.list_explorers(): output_fd = open(explorer.out_path, mode='w') cmd = [] - cmd.append("__explorer=" + cdist.core.GlobalExplorer.remote_base_dir) + cmd.append("__explorer=" + cdist.core.GlobalExplorer.remote_base_path) cmd.append(explorer.remote_path) cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) @@ -251,8 +252,8 @@ class ConfigInstall: """Ensure the base directories are cleaned up""" log.debug("Creating clean directory structure") - self.context.remove_remote_dir(self.context.remote_base_dir) - self.context.remote_mkdir(self.context.remote_base_dir) + self.context.remove_remote_path(self.context.remote_base_path) + self.context.remote_mkdir(self.context.remote_base_path) self.link_emulator() def stage_prepare(self): @@ -263,7 +264,7 @@ class ConfigInstall: log.info("Running object manifests and type explorers") - log.debug("Searching for objects in " + cdist.core.Object.base_dir()) + log.debug("Searching for objects in " + cdist.core.Object.base_path()) # Continue process until no new objects are created anymore new_objects_created = True @@ -284,17 +285,17 @@ class ConfigInstall: def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" # Create base path before using mkdir -p - self.remote_mkdir(self.remote_object_parameter_dir(cdist_object)) + self.remote_mkdir(self.remote_object_parameter_path(cdist_object)) # Synchronise parameter dir afterwards - self.transfer_dir(self.object_parameter_dir(cdist_object), - self.remote_object_parameter_dir(cdist_object)) + self.transfer_path(self.object_parameter_path(cdist_object), + self.remote_object_parameter_path(cdist_object)) # FIXME Move into configinstall def transfer_global_explorers(self): """Transfer the global explorers""" self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) - self.transfer_dir(self.global_explorer_dir, REMOTE_GLOBAL_EXPLORER_DIR) + self.transfer_path(self.global_explorer_path, REMOTE_GLOBAL_EXPLORER_DIR) # FIXME Move into configinstall def transfer_type_explorers(self, type): @@ -306,7 +307,7 @@ class ConfigInstall: # Do not retransfer type.transferred_explorers = True - # FIXME: Can be explorer_path or explorer_dir, I don't care. + # FIXME: Can be explorer_path or explorer_path, I don't care. src = type.explorer_path() dst = type.remote_explorer_path() @@ -314,4 +315,4 @@ class ConfigInstall: if len(type.explorers) > 0: # Ensure that the path exists self.remote_mkdir(dst) - self.transfer_dir(src, dst) + self.transfer_path(src, dst) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index edc29d60..1de57f94 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -38,6 +38,7 @@ class Context: initial_manifest=False, base_path=False, out_path=False, + remote_base_path=False, debug=False): self.target_host = target_host @@ -53,7 +54,7 @@ class Context: os.pardir)) - # Input directories + # Local input directories self.cache_path = os.path.join(self.base_path, "cache", target_host) self.conf_path = os.path.join(self.base_path, "conf") @@ -62,35 +63,34 @@ class Context: self.type_base_path = os.path.join(self.conf_path, "type") self.lib_path = os.path.join(self.base_path, "lib") - # Mostly static, but can be overwritten on user demand if initial_manifest: self.initial_manifest = initial_manifest else: self.initial_manifest = os.path.join(self.manifest_path, "init") - # Output directories + # Local output directories if out_path: self.out_path = out_path: else: self.out_path = os.path.join(tempfile.mkdtemp(), "out") + self.bin_path = os.path.join(self.out_path, "bin") self.global_explorer_out_path = os.path.join(self.out_path, "explorer") - self.object_base_path = os.path.join(self.out_path, "object") - self.bin_path = os.path.join(self.out_path, "bin") + self.object_base_path = os.path.join(self.out_path, "object") # Remote directories - if "__cdist_remote_base_path" in os.environ: - self.remote_base_path = os.environ['__cdist_remote_base_path'] + if remote_base_path: + self.remote_base_path = remote_base_path else: self.remote_base_path = "/var/lib/cdist" self.remote_conf_path = os.path.join(self.remote_base_path, "conf") - self.remote_object_dir = os.path.join(self.remote_base_path, "object") - self.remote_type_dir = os.path.join(self.remote_conf_path, "type") - self.remote_global_explorer_dir = os.path.join(self.remote_conf_path, "explorer") + self.remote_object_path = os.path.join(self.remote_base_path, "object") + self.remote_type_path = os.path.join(self.remote_conf_path, "type") + self.remote_global_explorer_path = os.path.join(self.remote_conf_path, "explorer") # Create directories - self.__init_out_dirs() + self.__init_out_paths() self.__init_env() @@ -108,24 +108,24 @@ class Context: def __init_env(self): """Setup environment""" - os.environ['__cdist_out_dir'] = self.out_dir + os.environ['__cdist_out_path'] = self.out_path os.environ['__cdist_base_path'] = self.base_path - def __init_out_dirs(self): + def __init_out_paths(self): """Initialise output directory structure""" # Create base dir, if user supplied and not existing if not os.path.isdir(self.base_path): os.mkdir(self.base_path) - os.mkdir(self.out_dir) - os.mkdir(self.global_explorer_out_dir) - os.mkdir(self.bin_dir) + os.mkdir(self.out_path) + os.mkdir(self.global_explorer_out_path) + os.mkdir(self.bin_path) def remote_mkdir(self, directory): """Create directory on remote side""" cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) - def remove_remote_dir(self, destination): + def remove_remote_path(self, destination): cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) From 8aa91726870955967f9686d01db786e450818062 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:07:38 +0200 Subject: [PATCH 0486/1024] ++tests Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 0760f368..a66255a9 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -18,3 +18,8 @@ GlobalExplorer: Object/Type: - rutern relative only - Have accept absulet path on listing + +Tests needed: + + - Fail if cache_dir from previous run cannot be deleted + - Fail if cache_dir cannot be created from current out_dir From c56d17d674cbaac17cf175713465cee95f6847c5 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 15:07:57 +0200 Subject: [PATCH 0487/1024] relative paths Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 98 +++++++++--------------------------------- 1 file changed, 20 insertions(+), 78 deletions(-) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index 8439464e..4493be18 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -25,8 +25,6 @@ import os import cdist -# FIXME: i should not have to care about prefix directory, local, remote and such. -# I know what my internals look like, the outside is none of my business. class Type(object): """Represents a cdist type. @@ -36,93 +34,37 @@ class Type(object): """ - @staticmethod - def base_dir(): - """Return the absolute path to the top level directory where types - are defined. - - Requires the environment variable '__cdist_base_dir' to be set. - - """ - try: - return os.path.join( - os.environ['__cdist_base_dir'], - 'conf', - 'type' - ) - except KeyError as e: - raise cdist.MissingEnvironmentVariableError(e.args[0]) - - @staticmethod - def remote_base_dir(): - """Return the absolute path to the top level directory where types - are kept on the remote/target host. - - Requires the environment variable '__cdist_remote_base_dir' to be set. - - """ - try: - return os.path.join( - os.environ['__cdist_remote_base_dir'], - 'conf', - 'type' - ) - except KeyError as e: - raise cdist.MissingEnvironmentVariableError(e.args[0]) - @classmethod - def list_types(cls): + def list_types(cls, base_path): """Return a list of type instances""" - for type_name in cls.list_type_names(): - yield cls(type_name) + for name in cls.list_type_names(base_path): + yield cls(base_path, name) @classmethod - def list_type_names(cls): + def list_type_names(cls, base_path): """Return a list of type names""" - return os.listdir(cls.base_dir()) + return os.listdir(base_path) - def __init__(self, name): + def __init__(self, base_path, name): + self._base_path = base_path self.name = name + self.manifest_path = os.path.join(self.name, "manifest") + self.explorer_path = os.path.join(self.name, "explorer") + self.manifest_path = os.path.join(self.name, "manifest") + self.gencode_local_path = os.path.join(self.name, "gencode-local") + self.gencode_remote_path = os.path.join(self.name, "gencode-remote") + self.manifest_path = os.path.join(self.name, "manifest") + + self.transferred_explorers = False + self.__explorers = None self.__required_parameters = None self.__optional_parameters = None - self.transferred_explorers = False def __repr__(self): - return '' % self.name - - @property - def path(self): - return os.path.join( - self.base_dir(), - self.name - ) - # FIXME: prefix directory should not leak into me - @property - def remote_path(self): - return os.path.join( - self.remote_base_dir(), - self.name - ) - - # FIXME: probably wrong place for this - @property - def remote_explorer_dir(self): - return os.path.join(self.remote_path, "explorer") - - @property - def manifest_path(self): - return os.path.join(self.path, "manifest") - - @property - def gencode_local(self): - return os.path.join(self.path, "gencode-local") - - @property - def gencode_remote(self): - return os.path.join(self.path, "gencode-remote") + return '' % self.name @property def is_singleton(self): @@ -140,7 +82,7 @@ class Type(object): if not self.__explorers: try: self.__explorers = os.listdir(os.path.join(self.path, "explorer")) - except EnvironmentError as e: + except EnvironmentError: # error ignored self.__explorers = [] return self.__explorers @@ -154,7 +96,7 @@ class Type(object): with open(os.path.join(self.path, "parameter", "required")) as fd: for line in fd: parameters.append(line.strip()) - except EnvironmentError as e: + except EnvironmentError: # error ignored pass finally: @@ -170,7 +112,7 @@ class Type(object): with open(os.path.join(self.path, "parameter", "optional")) as fd: for line in fd: parameters.append(line.strip()) - except EnvironmentError as e: + except EnvironmentError: # error ignored pass finally: From ffb33189c76e3d53a67e1e3ae28e909aeefa4faa Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 15:18:25 +0200 Subject: [PATCH 0488/1024] fix path/absolute_path handling Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index 4493be18..c701bf48 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -49,6 +49,8 @@ class Type(object): def __init__(self, base_path, name): self._base_path = base_path self.name = name + self.path = self.name + self.absolute_path = os.path.join(self._base_path, self.path) self.manifest_path = os.path.join(self.name, "manifest") self.explorer_path = os.path.join(self.name, "explorer") self.manifest_path = os.path.join(self.name, "manifest") @@ -66,22 +68,24 @@ class Type(object): def __repr__(self): return '' % self.name + def + @property def is_singleton(self): """Check whether a type is a singleton.""" - return os.path.isfile(os.path.join(self.path, "singleton")) + return os.path.isfile(os.path.join(self.absolute_path, "singleton")) @property def is_install(self): """Check whether a type is used for installation (if not: for configuration)""" - return os.path.isfile(os.path.join(self.path, "install")) + return os.path.isfile(os.path.join(self.absolute_path, "install")) @property def explorers(self): """Return a list of available explorers""" if not self.__explorers: try: - self.__explorers = os.listdir(os.path.join(self.path, "explorer")) + self.__explorers = os.listdir(os.path.join(self.absolute_path, "explorer")) except EnvironmentError: # error ignored self.__explorers = [] @@ -93,7 +97,7 @@ class Type(object): if not self.__required_parameters: parameters = [] try: - with open(os.path.join(self.path, "parameter", "required")) as fd: + with open(os.path.join(self.absolute_path, "parameter", "required")) as fd: for line in fd: parameters.append(line.strip()) except EnvironmentError: @@ -109,7 +113,7 @@ class Type(object): if not self.__optional_parameters: parameters = [] try: - with open(os.path.join(self.path, "parameter", "optional")) as fd: + with open(os.path.join(self.absolute_path, "parameter", "optional")) as fd: for line in fd: parameters.append(line.strip()) except EnvironmentError: From 8af7c075ec584981e9eb8654ab35823d3f97e53b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:19:01 +0200 Subject: [PATCH 0489/1024] ++todo(steven) Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index a66255a9..2a953e0d 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,4 +1,7 @@ Object: + cdist_object.code_local_path + cdist_object.code_remote_path + cdist_object.remote_code_remote_path Type: From dd29e86b8163b3a09f42525b2ceed1f63156d0a9 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 15:19:03 +0200 Subject: [PATCH 0490/1024] -syntax error Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index c701bf48..309528ef 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -68,8 +68,6 @@ class Type(object): def __repr__(self): return '' % self.name - def - @property def is_singleton(self): """Check whether a type is a singleton.""" From 4f76cfc84e8ea7d0c3dfaa428d77d68a22dff1dd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:20:38 +0200 Subject: [PATCH 0491/1024] changes for relative Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 43 +++++++++++++++++++------------------ lib/cdist/context.py | 8 +++---- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index e8d8b0c9..c630487f 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -70,45 +70,45 @@ class ConfigInstall: type.manifest_path) log.debug("%s: Running %s", cdist_object.name, manifest) - if os.path.exists(manifest): - env = { "__object" : os.path.join(self.context.cdist_object.path, + if os.path.exists(manifest_path): + env = { "__object" : os.path.join(self.context.object_base_path, + cdist_object.path) "__object_id": cdist_object.object_id, "__object_fq": cdist_object.name, - "__type": type.path, + "__type": os.path.join(self.context.type_base_path, + type.path) } - self.run_manifest(manifest, extra_env=env) + self.run_manifest(manifest_path, extra_env=env) - def run_manifest(self, manifest, extra_env=None): + def run_manifest(self, manifest_path, extra_env=None): """Run a manifest""" - log.debug("Running manifest %s, env=%s", manifest, extra_env) + log.debug("Running manifest %s, env=%s", manifest_path, extra_env) env = os.environ.copy() env['PATH'] = self.context.bin_path + ":" + env['PATH'] # Information required in every manifest env['__target_host'] = self.target_host - - # FIXME: __global == __cdist_out_path - duplication env['__global'] = self.context.out_path # Submit debug flag to manifest, can be used by emulator and types if self.debug: env['__debug'] = "yes" - # Required for recording source - env['__cdist_manifest'] = manifest + # Required for recording source in emulator + env['__cdist_manifest'] = manifest_path - # Required to find types + # Required to find types in emulator env['__cdist_type_base_path'] = type.path # Other environment stuff if extra_env: env.update(extra_env) - cdist.exec.shell_run_or_debug_fail(manifest, [manifest], env=env) + cdist.exec.shell_run_or_debug_fail(manifest_path, [manifest_path], env=env) def object_run(self, cdist_object): """Run gencode or code for an object""" - log.debug("Running %s from %s", mode, cdist_object) + log.debug("Running object %s", cdist_object) # Catch requirements, which re-call us if cdist_object.ran: @@ -118,7 +118,7 @@ class ConfigInstall: for requirement in cdist_object.requirements: log.debug("Object %s requires %s", cdist_object, requirement) - self.object_run(requirement, mode=mode) + self.object_run(requirement) # # Setup env Variable: @@ -126,17 +126,19 @@ class ConfigInstall: env = os.environ.copy() env['__target_host'] = self.target_host env['__global'] = self.context.out_path - env["__object"] = cdist_object.path + env["__object"] = os.path.join(self.context.object_base_path, cdist_object.path) env["__object_id"] = cdist_object.object_id env["__object_fq"] = cdist_object.name env["__type"] = type.name # gencode for cmd in ["local", "remote"]: - bin = getattr(type, "gencode_" + cmd) + bin = os.path.join(self.context.type_base_path, + getattr(type, "gencode_" + cmd)) if os.path.isfile(bin): - outfile = getattr(cdist_object, "code_" + cmd) + outfile = os.path.join(self.context.object_base_path, + getattr(cdist_object, "code_" + cmd)) outfile_fd = open(outfile, "w") @@ -158,20 +160,19 @@ class ConfigInstall: cdist_object.changed=True # code local - code_local = cdist_object.code_local + code_local = cdist_object.code_local_path if os.path.isfile(code_local): cdist.exec.run_or_fail([code_local]) # code remote - local_remote_code = cdist_object.code_remote - remote_remote_code = cdist_object.remote_code_remote + local_remote_code = cdist_object.code_remote_path + remote_remote_code = cdist_object.remote_code_remote_path if os.path.isfile(local_remote_code): self.context.transfer_file(local_remote_code, remote_remote_code) cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) cdist_object.ran = True - ### Cleaned / check functions: Round 1 :-) ################################# def run_type_explorer(self, cdist_object): """Run type specific explorers for objects""" diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 1de57f94..af37199e 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -106,10 +106,10 @@ class Context: shutil.rmtree(self.cache_path) shutil.move(self.base_path, self.cache_path) - def __init_env(self): - """Setup environment""" - os.environ['__cdist_out_path'] = self.out_path - os.environ['__cdist_base_path'] = self.base_path + #def __init_env(self): + # """Setup environment""" + # os.environ['__cdist_out_path'] = self.out_path + # os.environ['__cdist_base_path'] = self.base_path def __init_out_paths(self): """Initialise output directory structure""" From e6e1c07531258ca225bac975db3d9dcfed9871c8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:22:01 +0200 Subject: [PATCH 0492/1024] ++todo(steven) Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 2a953e0d..b79b719b 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -5,6 +5,7 @@ Object: Type: + type.transferred_explorers GlobalExplorer: From c1db2bd51ae60e7f65347fca17998ed361b17b0e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:23:48 +0200 Subject: [PATCH 0493/1024] ++todo(steven) Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index b79b719b..35648910 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -7,6 +7,8 @@ Object: Type: type.transferred_explorers + type.type_explorer_paths() -> relative list of paths of explorer + GlobalExplorer: out_path: local path into which the output is written From 73ba8e2366d25333314d4bf960ce558ce31d596e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:26:38 +0200 Subject: [PATCH 0494/1024] --todo(steven) Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 35648910..b79b719b 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -7,8 +7,6 @@ Object: Type: type.transferred_explorers - type.type_explorer_paths() -> relative list of paths of explorer - GlobalExplorer: out_path: local path into which the output is written From 187510bbd34ccdd3a7d74d49847bfb274a254ce5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:33:27 +0200 Subject: [PATCH 0495/1024] ++todo(steven) Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index b79b719b..dc9f965b 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -27,3 +27,5 @@ Tests needed: - Fail if cache_dir from previous run cannot be deleted - Fail if cache_dir cannot be created from current out_dir + - transfer_type_explorers: Explorers are not transferred twice + - transfer_type_explorers: No transfer tried if there are no type_explorers From 183bbf61d4e1b96125c5e1421ef73f4a45bfde2a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:34:47 +0200 Subject: [PATCH 0496/1024] fix imports from path in config_install Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index c630487f..0b05f8a9 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -177,8 +177,7 @@ class ConfigInstall: """Run type specific explorers for objects""" type = cdist_object.type - # FIXME - self.path.transfer_type_explorers(type) + self.transfer_type_explorers(type) cmd = [] cmd.append("__explorer=" + self.context.remote_global_explorer_path) @@ -292,13 +291,15 @@ class ConfigInstall: self.transfer_path(self.object_parameter_path(cdist_object), self.remote_object_parameter_path(cdist_object)) - # FIXME Move into configinstall + +####FIXED ###################################################################### + def transfer_global_explorers(self): """Transfer the global explorers""" - self.remote_mkdir(REMOTE_GLOBAL_EXPLORER_DIR) - self.transfer_path(self.global_explorer_path, REMOTE_GLOBAL_EXPLORER_DIR) + self.remote_mkdir(self.context.remote_global_explorer_path) + self.transfer_path(self.context.global_explorer_path, + self.remote_global_explorer_path) - # FIXME Move into configinstall def transfer_type_explorers(self, type): """Transfer explorers of a type, but only once""" if type.transferred_explorers: @@ -308,12 +309,13 @@ class ConfigInstall: # Do not retransfer type.transferred_explorers = True - # FIXME: Can be explorer_path or explorer_path, I don't care. - src = type.explorer_path() - dst = type.remote_explorer_path() + explorers = type.explorers() + + if len(explorers) > 0: + rel_path = os.path.join(type.explorer_path(), explorer) + src = os.path.join(self.context.type_base_path, rel_path) + dst = os.path.join(self.context.remote_type_path, rel_path) - # Transfer if there is at least one explorer - if len(type.explorers) > 0: # Ensure that the path exists self.remote_mkdir(dst) self.transfer_path(src, dst) From c268e5f7c25778b2cf0fbdf58818546b08d56942 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:36:59 +0200 Subject: [PATCH 0497/1024] ++todo(steven) Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index dc9f965b..54b43210 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -3,6 +3,10 @@ Object: cdist_object.code_remote_path cdist_object.remote_code_remote_path + cdist_object.parameter_path + + + Type: type.transferred_explorers From 79234148aa7eaf249ad6b24eb06f255acb8f3bfa Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:39:29 +0200 Subject: [PATCH 0498/1024] transfer_object_parameter: new src/dst Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 0b05f8a9..9c1f3b9d 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -284,12 +284,19 @@ class ConfigInstall: # FIXME Move into configinstall def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" + local_path = + os.path.join(self.context.object_base_path, + cdist_object.parameter_path) + remote_path = + os.path.join(self.context.remote_object_path, + cdist_object.parameter_path) + # Create base path before using mkdir -p - self.remote_mkdir(self.remote_object_parameter_path(cdist_object)) + # FIXME: needed? + self.remote_mkdir(remote_path) # Synchronise parameter dir afterwards - self.transfer_path(self.object_parameter_path(cdist_object), - self.remote_object_parameter_path(cdist_object)) + self.transfer_path(local_path, remote_path) ####FIXED ###################################################################### From f8853467f3aae87bd6c1b670aeac75c0dd206bd8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:39:51 +0200 Subject: [PATCH 0499/1024] do not create base directory in transfer_object_parameter, somebody else should have done this Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 9c1f3b9d..734f7280 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -291,10 +291,6 @@ class ConfigInstall: os.path.join(self.context.remote_object_path, cdist_object.parameter_path) - # Create base path before using mkdir -p - # FIXME: needed? - self.remote_mkdir(remote_path) - # Synchronise parameter dir afterwards self.transfer_path(local_path, remote_path) From be8428e592da733a81de35c74697e8f2bd859883 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 15:42:04 +0200 Subject: [PATCH 0500/1024] relative paths Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 152 +++++++++++++++------------------------ 1 file changed, 57 insertions(+), 95 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index b922701d..8a214a58 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -42,113 +42,52 @@ class Object(object): """ - @staticmethod - def base_dir(): - """Return the absolute path to the top level directory where objects - are defined. - - Requires the environment variable '__cdist_out_dir' to be set. - - """ - try: - base_dir = os.path.join( - os.environ['__cdist_out_dir'], - 'object' - ) - except KeyError as e: - raise cdist.MissingEnvironmentVariableError(e.args[0]) - - # FIXME: should directory be created elsewhere? - if not os.path.isdir(base_dir): - os.mkdir(base_dir) - return base_dir - @classmethod - def remote_base_dir(): - """Return the absolute path to the top level directory where objects - are kept on the remote/target host. - - Requires the environment variable '__cdist_remote_out_dir' to be set. - - """ - try: - return os.path.join( - os.environ['__cdist_remote_out_dir'], - 'object', - ) - except KeyError as e: - raise cdist.MissingEnvironmentVariableError(e.args[0]) - - def list_objects(cls): + def list_objects(cls, object_base_path, type_base_path): """Return a list of object instances""" - for object_name in cls.list_object_names(): + for object_name in cls.list_object_names(object_base_path): type_name = object_name.split(os.sep)[0] + # FIXME: allow object without object_id? e.g. for singleton object_id = os.sep.join(object_name.split(os.sep)[1:]) - yield cls(cdist.core.Type(type_name), object_id=object_id) + yield cls(cdist.core.Type(type_base_path, type_name), object_base_path, object_id=object_id) @classmethod - def list_type_names(cls): + def list_type_names(cls, object_base_path): """Return a list of type names""" - return os.listdir(cls.base_dir()) + return os.listdir(object_base_path) @classmethod - def list_object_names(cls): + def list_object_names(cls, object_base_path): """Return a list of object names""" - for path, dirs, files in os.walk(cls.base_dir()): + for path, dirs, files in os.walk(object_base_path): if DOT_CDIST in dirs: - yield os.path.relpath(path, cls.base_dir()) + yield os.path.relpath(path, object_base_path) - def __init__(self, type, object_id=None, parameters=None, requirements=None): + def __init__(self, type, base_path, object_id=None) self.type = type # instance of Type + self.base_path = base_path self.object_id = object_id self.name = os.path.join(self.type.name, self.object_id) - self.parameters = parameters or {} - self.requirements = requirements or [] + self.path = os.path.join(self.type.path, self.object_id) + self.absolute_path = os.path.join(self.base_path, self.path) + self.code_local_path = os.path.join(self.path, "code-local") + self.code_remote_path = os.path.join(self.path, "code-remote") + self.parameter_path = os.path.join(self.path, "parameter") self.__parameters = None self.__requirements = None - # Whether this object was prepared/ran - self.prepared = False - self.ran = False - def __repr__(self): return '' % self.name @property - def path(self): - return os.path.join( - self.base_dir(), - self.name, - DOT_CDIST - ) - - @property - def code_local(self): - return os.path.join(self.path, "code-local") - - @property - def code_remote(self): - return os.path.join(self.path, "code-remote") - - @property - def explorer_out_dir(self): - path = os.path.join(self.path, "explorer") + def explorer_path(self): + # create absolute path + path = os.path.join(self.absolute_path, "explorer") if not os.path.isdir(path): os.mkdir(path) - return path - - # FIXME: prefix directory should not leak into me - @property - def remote_path(self): - return os.path.join( - self.remote_base_dir(), - self.name, - DOT_CDIST - ) - @property - def remote_code_remote(self): - return os.path.join(self.remote_path, "code-remote") + # return relative path + return os.path.join(self.path, "explorer") ### requirements @@ -204,20 +143,43 @@ class Object(object): ### /changed + ### prepared + @property + def prepared(self): + """Check whether the object has been prepared.""" + return os.path.isfile(os.path.join(self.path, "prepared")) - # FIXME: Object - def object_parameter_dir(self, cdist_object): - """Returns the dir to the object parameter""" - return os.path.join(self.object_dir(cdist_object), "parameter") + @prepared.setter + def prepared(self, value): + """Change the objects prepared status.""" + path = os.path.join(self.path, "prepared") + if value: + open(path, "w").close() + else: + try: + os.remove(path) + except EnvironmentError: + # ignore + pass + ### /prepared - # FIXME: object - def remote_object_parameter_dir(self, cdist_object): - """Returns the remote dir to the object parameter""" - return os.path.join(self.remote_object_dir(cdist_object), "parameter") - # FIXME: object - def object_code_paths(self, cdist_object): - """Return paths to code scripts of object""" - return [os.path.join(self.object_dir(cdist_object), "code-local"), - os.path.join(self.object_dir(cdist_object), "code-remote")] + ### ran + @property + def ran(self): + """Check whether the object has been ran.""" + return os.path.isfile(os.path.join(self.path, "ran")) + @ran.setter + def ran(self, value): + """Change the objects ran status.""" + path = os.path.join(self.path, "ran") + if value: + open(path, "w").close() + else: + try: + os.remove(path) + except EnvironmentError: + # ignore + pass + ### /ran From c1e773199251f79db92f5083ef736b3835056ab7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 15:49:25 +0200 Subject: [PATCH 0501/1024] cleanups/fixes Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 33 +++++++++------------------------ lib/cdist/context.py | 8 +++++++- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 734f7280..3f1c467e 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -48,15 +48,13 @@ class ConfigInstall: self.exec_path = exec_path self.context = cdist.context.Context(self.target_host, - initial_manifest=initial_manifest, base_path=base_path, + initial_manifest=initial_manifest, + base_path=base_path, debug=debug) - + def cleanup(self): self.path.cleanup() - def __init_env(self): - """Setup environment""" - def run_initial_manifest(self): """Run the initial manifest""" log.info("Running initial manifest %s", self.context.initial_manifest) @@ -248,22 +246,15 @@ class ConfigInstall: self.deploy_to() self.cleanup() - def init_deploy(self): - """Ensure the base directories are cleaned up""" - log.debug("Creating clean directory structure") +####FIXED ###################################################################### - self.context.remove_remote_path(self.context.remote_base_path) - self.context.remote_mkdir(self.context.remote_base_path) - self.link_emulator() - def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" - self.init_deploy() + self.link_emulator() self.run_global_explorers() self.run_initial_manifest() log.info("Running object manifests and type explorers") - log.debug("Searching for objects in " + cdist.core.Object.base_path()) # Continue process until no new objects are created anymore @@ -281,22 +272,16 @@ class ConfigInstall: cdist_object.prepared = True new_objects_created = True - # FIXME Move into configinstall def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" - local_path = - os.path.join(self.context.object_base_path, - cdist_object.parameter_path) - remote_path = - os.path.join(self.context.remote_object_path, - cdist_object.parameter_path) + src = os.path.join(self.context.object_base_path, + cdist_object.parameter_path) + dst = os.path.join(self.context.remote_object_path, + cdist_object.parameter_path) # Synchronise parameter dir afterwards self.transfer_path(local_path, remote_path) - -####FIXED ###################################################################### - def transfer_global_explorers(self): """Transfer the global explorers""" self.remote_mkdir(self.context.remote_global_explorer_path) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index af37199e..4cfc6c59 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -91,7 +91,7 @@ class Context: # Create directories self.__init_out_paths() - + self.__init_remote_paths() self.__init_env() def cleanup(self): @@ -122,6 +122,12 @@ class Context: os.mkdir(self.global_explorer_out_path) os.mkdir(self.bin_path) + def __init_remote_paths(self): + """Initialise remote directory structure""" + + self.remove_remote_path(self.remote_base_path) + self.remote_mkdir(self.remote_base_path) + def remote_mkdir(self, directory): """Create directory on remote side""" cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) From e5e2fb866c301474f8e25bd738318cfe1c7882a0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:00:32 +0200 Subject: [PATCH 0502/1024] ++fixes Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 2 +- lib/cdist/config_install.py | 17 +++++++++-------- lib/cdist/context.py | 17 +++++------------ 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index c5f4b4ef..71ce14ed 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -42,7 +42,7 @@ def config(args): os.environ['__remote_copy'] = "scp -o User=root -q" for host in args.host: - c = Config(host, initial_manifest=args.manifest, base_dir=args.cdist_home, debug=args.debug) + c = Config(host, initial_manifest=args.manifest, base_path=args.cdist_home, debug=args.debug) if args.parallel: log.debug("Creating child process for %s", host) process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3f1c467e..c1cdf328 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -70,7 +70,7 @@ class ConfigInstall: log.debug("%s: Running %s", cdist_object.name, manifest) if os.path.exists(manifest_path): env = { "__object" : os.path.join(self.context.object_base_path, - cdist_object.path) + cdist_object.path), "__object_id": cdist_object.object_id, "__object_fq": cdist_object.name, "__type": os.path.join(self.context.type_base_path, @@ -213,16 +213,17 @@ class ConfigInstall: """Run global explorers""" log.info("Running global explorers") - src = cdist.core.GlobalExplorer.base_path - dst = cdist.core.GlobalExplorer.remote_base_path + src_path = cdist.context.global_explorer_path + dst_path = cdist.context.global_explorer_out_path + remote_dst_path = cdist.context.remote_global_explorer_path - self.context.transfer_path(src, dst) + self.context.transfer_path(src_path, remote_dst_path) - for explorer in cdist.core.GlobalExplorer.list_explorers(): - output_fd = open(explorer.out_path, mode='w') + for explorer in os.listdir(src_path): + output_fd = open(os.path.join(dst_path, explorer), mode='w') cmd = [] - cmd.append("__explorer=" + cdist.core.GlobalExplorer.remote_base_path) - cmd.append(explorer.remote_path) + cmd.append("__explorer=" + remote_dst_path) + cmd.append(os.path.join(src_path, explorer)) cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) output_fd.close() diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 4cfc6c59..f1f031a8 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -47,11 +47,10 @@ class Context: if base_path: self.base_path = base_path else: - self.base_path = - os.path.abspath( - os.path.join(os.path.dirname(__file__), - os.pardir, - os.pardir)) + self.base_path = os.path.abspath( + os.path.join(os.path.dirname(__file__), + os.pardir, + os.pardir)) # Local input directories @@ -70,7 +69,7 @@ class Context: # Local output directories if out_path: - self.out_path = out_path: + self.out_path = out_path else: self.out_path = os.path.join(tempfile.mkdtemp(), "out") @@ -92,7 +91,6 @@ class Context: # Create directories self.__init_out_paths() self.__init_remote_paths() - self.__init_env() def cleanup(self): # Do not use in __del__: @@ -106,11 +104,6 @@ class Context: shutil.rmtree(self.cache_path) shutil.move(self.base_path, self.cache_path) - #def __init_env(self): - # """Setup environment""" - # os.environ['__cdist_out_path'] = self.out_path - # os.environ['__cdist_base_path'] = self.base_path - def __init_out_paths(self): """Initialise output directory structure""" From a7a086e29bfc2fe02ee575630dc1459005cc3700 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 16:01:02 +0200 Subject: [PATCH 0503/1024] only one instance of each named type Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index 309528ef..42a74398 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -46,6 +46,16 @@ class Type(object): return os.listdir(base_path) + _instances = {} + def __new__(cls, *args, **kwargs): + """only one instance of each named type may exist""" + # name is second argument + name = args[1] + if not name in cls._instances: + instance = super(Type, cls).__new__(cls, *args, **kwargs) + cls._instances[name] = instance + return cls._instances[name] + def __init__(self, base_path, name): self._base_path = base_path self.name = name @@ -64,7 +74,6 @@ class Type(object): self.__required_parameters = None self.__optional_parameters = None - def __repr__(self): return '' % self.name From 600e7fb5b5d427d6de6810fed08a1ec5227fe8e7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 16:03:37 +0200 Subject: [PATCH 0504/1024] --typo Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 8a214a58..76f37487 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -63,7 +63,7 @@ class Object(object): if DOT_CDIST in dirs: yield os.path.relpath(path, object_base_path) - def __init__(self, type, base_path, object_id=None) + def __init__(self, type, base_path, object_id=None): self.type = type # instance of Type self.base_path = base_path self.object_id = object_id From 3fcbabc5e8db1f41baf6b706baf1826edd9180a8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:04:37 +0200 Subject: [PATCH 0505/1024] ++fixes Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 8 ++++---- lib/cdist/context.py | 5 +++++ lib/cdist/copy.py | 13 ------------- 3 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 lib/cdist/copy.py diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index c1cdf328..78630f25 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -202,7 +202,7 @@ class ConfigInstall: def link_emulator(self): """Link emulator to types""" src = os.path.abspath(self.exec_path) - for type in cdist.core.Type.list_types(): + for type in cdist.core.Type.list_types(self.context.type_base_path): dst = os.path.join(self.context.bin_path, type.name) log.debug("Linking emulator: %s to %s", src, dst) @@ -213,9 +213,9 @@ class ConfigInstall: """Run global explorers""" log.info("Running global explorers") - src_path = cdist.context.global_explorer_path - dst_path = cdist.context.global_explorer_out_path - remote_dst_path = cdist.context.remote_global_explorer_path + src_path = self.context.global_explorer_path + dst_path = self.context.global_explorer_out_path + remote_dst_path = self.context.remote_global_explorer_path self.context.transfer_path(src_path, remote_dst_path) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index f1f031a8..b39e603e 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -128,3 +128,8 @@ class Context: def remove_remote_path(self, destination): cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) + def transfer_path(self, source, destination): + """Transfer directory and previously delete the remote destination""" + self.remove_remote_path(destination) + cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + + ["-r", source, self.target_host + ":" + destination]) diff --git a/lib/cdist/copy.py b/lib/cdist/copy.py deleted file mode 100644 index b0eae54e..00000000 --- a/lib/cdist/copy.py +++ /dev/null @@ -1,13 +0,0 @@ - # FIXME: To Copy - def transfer_dir(self, source, destination): - """Transfer directory and previously delete the remote destination""" - self.remove_remote_dir(destination) - cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + - ["-r", source, self.target_host + ":" + destination]) - - # FIXME: To Copy - def transfer_file(self, source, destination): - """Transfer file""" - cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + - [source, self.target_host + ":" + destination]) - From 9045b30136794c5003c17c0d3307a75601321cb0 Mon Sep 17 00:00:00 2001 From: Thomas Reifenberger Date: Fri, 7 Oct 2011 16:07:02 +0200 Subject: [PATCH 0506/1024] fix multiple requirements Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index aa22e1fa..8b531e22 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -132,7 +132,7 @@ def run(argv): requirements = os.environ['__require'] log.debug(object_id + ":Writing requirements: " + requirements) require_fd = open(os.path.join(object_dir, "require"), "a") - require_fd.writelines(requirements.split(" ")) + require_fd.write(requirements.replace(" ","\n")) require_fd.close() # Record / Append source From c93e0f90c9062cf6976add1b563828bb770fc29c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:09:10 +0200 Subject: [PATCH 0507/1024] create remote conf path on new context Signed-off-by: Nico Schottelius --- lib/cdist/context.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index b39e603e..fb00b423 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -85,6 +85,7 @@ class Context: self.remote_conf_path = os.path.join(self.remote_base_path, "conf") self.remote_object_path = os.path.join(self.remote_base_path, "object") + self.remote_type_path = os.path.join(self.remote_conf_path, "type") self.remote_global_explorer_path = os.path.join(self.remote_conf_path, "explorer") @@ -120,6 +121,7 @@ class Context: self.remove_remote_path(self.remote_base_path) self.remote_mkdir(self.remote_base_path) + self.remote_mkdir(self.remote_conf_path) def remote_mkdir(self, directory): """Create directory on remote side""" From 79d0a18bb24aea5a19d9c034b74db1e9441a8a0e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 16:12:01 +0200 Subject: [PATCH 0508/1024] use absolute path for accessing file system Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 76f37487..f5179606 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -126,12 +126,12 @@ class Object(object): @property def changed(self): """Check whether the object has been changed.""" - return os.path.isfile(os.path.join(self.path, "changed")) + return os.path.isfile(os.path.join(self.absolute_path, "changed")) @changed.setter def changed(self, value): """Change the objects changed status.""" - path = os.path.join(self.path, "changed") + path = os.path.join(self.absolute_path, "changed") if value: open(path, "w").close() else: @@ -147,12 +147,12 @@ class Object(object): @property def prepared(self): """Check whether the object has been prepared.""" - return os.path.isfile(os.path.join(self.path, "prepared")) + return os.path.isfile(os.path.join(self.absolute_path, "prepared")) @prepared.setter def prepared(self, value): """Change the objects prepared status.""" - path = os.path.join(self.path, "prepared") + path = os.path.join(self.absolute_path, "prepared") if value: open(path, "w").close() else: @@ -168,12 +168,12 @@ class Object(object): @property def ran(self): """Check whether the object has been ran.""" - return os.path.isfile(os.path.join(self.path, "ran")) + return os.path.isfile(os.path.join(self.absolute_path, "ran")) @ran.setter def ran(self, value): """Change the objects ran status.""" - path = os.path.join(self.path, "ran") + path = os.path.join(self.absolute_path, "ran") if value: open(path, "w").close() else: From 14c9317f66384e50888a3fd1baa4f7ee6881658a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:12:15 +0200 Subject: [PATCH 0509/1024] remove old type.path Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 78630f25..3822b688 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -96,7 +96,7 @@ class ConfigInstall: env['__cdist_manifest'] = manifest_path # Required to find types in emulator - env['__cdist_type_base_path'] = type.path + env['__cdist_type_base_path'] = self.context.type_base_path # Other environment stuff if extra_env: From 2aa0a316e6fad4bebb5c1b819dde1d6722e46614 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:13:00 +0200 Subject: [PATCH 0510/1024] use _path not _dir in emulator Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 8b531e22..9672d24a 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -30,7 +30,7 @@ log = logging.getLogger(__name__) def run(argv): """Emulate type commands (i.e. __file and co)""" type = os.path.basename(argv[0]) - type_dir = os.path.join(os.environ['__cdist_type_base_dir'], type) + type_dir = os.path.join(os.environ['__cdist_type_base_path'], type) param_dir = os.path.join(type_dir, "parameter") global_dir = os.environ['__global'] object_source = os.environ['__cdist_manifest'] From 149a605b16befdd8c4339af2295e1a4c27639725 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:14:29 +0200 Subject: [PATCH 0511/1024] use more path, move type -> cdist_type Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 9672d24a..815df948 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -29,9 +29,9 @@ log = logging.getLogger(__name__) def run(argv): """Emulate type commands (i.e. __file and co)""" - type = os.path.basename(argv[0]) - type_dir = os.path.join(os.environ['__cdist_type_base_path'], type) - param_dir = os.path.join(type_dir, "parameter") + cdist_type = os.path.basename(argv[0]) + type_path = os.path.join(os.environ['__cdist_type_base_path'], cdist_type) + param_dir = os.path.join(type_path, "parameter") global_dir = os.environ['__global'] object_source = os.environ['__cdist_manifest'] @@ -50,14 +50,14 @@ def run(argv): parser.add_argument(argument, action='store', required=True) # If not singleton support one positional parameter - if not os.path.isfile(os.path.join(type_dir, "singleton")): + if not os.path.isfile(os.path.join(type_path, "singleton")): parser.add_argument("object_id", nargs=1) # And finally verify parameter args = parser.parse_args(argv[1:]) # Setup object_id - if os.path.isfile(os.path.join(type_dir, "singleton")): + if os.path.isfile(os.path.join(type_path, "singleton")): object_id = "singleton" else: object_id = args.object_id[0] @@ -68,13 +68,13 @@ def run(argv): object_id = object_id[1:] # Prefix output by object_self - logformat = '%(levelname)s: ' + type + '/' + object_id + ': %(message)s' + logformat = '%(levelname)s: ' + cdist_type + '/' + object_id + ': %(message)s' logging.basicConfig(format=logformat) # FIXME: verify object id log.debug(args) - object_dir = os.path.join(global_dir, "object", type, + object_dir = os.path.join(global_dir, "object", cdist_type, object_id, cdist.path.DOT_CDIST) log.debug("Object output dir = " + object_dir) @@ -140,4 +140,4 @@ def run(argv): source_fd.writelines(object_source) source_fd.close() - log.debug("Finished " + type + "/" + object_id + repr(params)) + log.debug("Finished " + cdist_type + "/" + object_id + repr(params)) From 03f5e1b456a1e6bf951965510f7236866ee9f904 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:15:48 +0200 Subject: [PATCH 0512/1024] fix emulator and cdist module Signed-off-by: Nico Schottelius --- lib/cdist/__init__.py | 2 ++ lib/cdist/emulator.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index 6ce0c788..7aca5ac7 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -22,6 +22,8 @@ VERSION = "2.0.3" DOT_CDIST = ".cdist" +import os + class Error(Exception): """Base exception class for this project""" pass diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 815df948..2df95597 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -75,7 +75,7 @@ def run(argv): log.debug(args) object_dir = os.path.join(global_dir, "object", cdist_type, - object_id, cdist.path.DOT_CDIST) + object_id, cdist.DOT_CDIST) log.debug("Object output dir = " + object_dir) param_out_dir = os.path.join(object_dir, "parameter") From a25ef7f0e885cb3ca9bf6d62a14863d7ca30a335 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:16:45 +0200 Subject: [PATCH 0513/1024] fix emulator and cdist module Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3822b688..a553f6d8 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -256,7 +256,6 @@ class ConfigInstall: self.run_initial_manifest() log.info("Running object manifests and type explorers") - log.debug("Searching for objects in " + cdist.core.Object.base_path()) # Continue process until no new objects are created anymore new_objects_created = True From ea402fc0c546a79cb73818ea520f6164e1a254ce Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:18:38 +0200 Subject: [PATCH 0514/1024] use new call to object lists in absolute path Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index a553f6d8..2905df67 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -232,7 +232,7 @@ class ConfigInstall: def stage_run(self): """The final (and real) step of deployment""" log.info("Generating and executing code") - for cdist_object in cdist.core.Object.list_objects(): + for cdist_object in cdist.core.Object.list_objects(self.context.object_base_path): log.debug("Run object: %s", cdist_object) self.object_run(cdist_object) @@ -247,8 +247,6 @@ class ConfigInstall: self.deploy_to() self.cleanup() -####FIXED ###################################################################### - def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" self.link_emulator() @@ -261,7 +259,7 @@ class ConfigInstall: new_objects_created = True while new_objects_created: new_objects_created = False - for cdist_object in cdist.core.Object.list_objects(): + for cdist_object in cdist.core.Object.list_objects(self.context.object_base_path): if cdist_object.prepared: log.debug("Skipping rerun of object %s", cdist_object) continue From 2c9beb95064c7105bacdbbbf2870f27646a3558d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:23:33 +0200 Subject: [PATCH 0515/1024] use list not method Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 2905df67..ad8a13b9 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -232,7 +232,8 @@ class ConfigInstall: def stage_run(self): """The final (and real) step of deployment""" log.info("Generating and executing code") - for cdist_object in cdist.core.Object.list_objects(self.context.object_base_path): + for cdist_object in cdist.core.Object.list_objects(self.context.object_base_path, + self.context.type_base_path): log.debug("Run object: %s", cdist_object) self.object_run(cdist_object) @@ -259,7 +260,8 @@ class ConfigInstall: new_objects_created = True while new_objects_created: new_objects_created = False - for cdist_object in cdist.core.Object.list_objects(self.context.object_base_path): + for cdist_object in cdist.core.Object.list_objects(self.context.object_base_path, + self.context.type_base_path): if cdist_object.prepared: log.debug("Skipping rerun of object %s", cdist_object) continue @@ -286,16 +288,16 @@ class ConfigInstall: self.transfer_path(self.context.global_explorer_path, self.remote_global_explorer_path) - def transfer_type_explorers(self, type): + def transfer_type_explorers(self, cdist_type): """Transfer explorers of a type, but only once""" - if type.transferred_explorers: + if cdist_type.transferred_explorers: log.debug("Skipping retransfer for explorers of %s", type) return else: # Do not retransfer - type.transferred_explorers = True + cdist_type.transferred_explorers = True - explorers = type.explorers() + explorers = cdist_type.explorers if len(explorers) > 0: rel_path = os.path.join(type.explorer_path(), explorer) From fd2fa235647bbd86e86ad0cd59b741fb44647a43 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:27:15 +0200 Subject: [PATCH 0516/1024] fix typeexplorer transfer Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index ad8a13b9..eeb9e4c0 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -291,7 +291,7 @@ class ConfigInstall: def transfer_type_explorers(self, cdist_type): """Transfer explorers of a type, but only once""" if cdist_type.transferred_explorers: - log.debug("Skipping retransfer for explorers of %s", type) + log.debug("Skipping retransfer for explorers of %s", cdist_type) return else: # Do not retransfer @@ -300,10 +300,8 @@ class ConfigInstall: explorers = cdist_type.explorers if len(explorers) > 0: - rel_path = os.path.join(type.explorer_path(), explorer) + rel_path = cdist_type.explorer_path src = os.path.join(self.context.type_base_path, rel_path) dst = os.path.join(self.context.remote_type_path, rel_path) + self.context.transfer_path(src, dst) - # Ensure that the path exists - self.remote_mkdir(dst) - self.transfer_path(src, dst) From dd8617141e41599182a56cd3a8110d733d772f05 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:27:50 +0200 Subject: [PATCH 0517/1024] todo shift Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 8 -------- doc/dev/todo/steven | 4 ++++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index b8fcc5b0..f96da0de 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,14 +1,6 @@ 2.0.3: - fix emulator -- introduce tests: - - does $require work? - - $whatever should fail if there is no global explorer directory - - emulator may only be called with __ as prefix - fail otherwise! - -- Create GlobalExplorer - -- base_dir passing in config/config_install superseeded by __cdist_base_dir? -------------------------------------------------------------------------------- diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 54b43210..4b374a92 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -33,3 +33,7 @@ Tests needed: - Fail if cache_dir cannot be created from current out_dir - transfer_type_explorers: Explorers are not transferred twice - transfer_type_explorers: No transfer tried if there are no type_explorers + + - does $require work? + - $whatever should fail if there is no global explorer directory + - emulator may only be called with __ as prefix - fail otherwise! From 03226dc5aa5c379c153153e079d696eb5277ab3a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:36:05 +0200 Subject: [PATCH 0518/1024] more fixes for relative path address Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index eeb9e4c0..2f4aa261 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -174,18 +174,22 @@ class ConfigInstall: def run_type_explorer(self, cdist_object): """Run type specific explorers for objects""" - type = cdist_object.type - self.transfer_type_explorers(type) + cdist_type = cdist_object.type + self.transfer_type_explorers(cdist_type) cmd = [] cmd.append("__explorer=" + self.context.remote_global_explorer_path) - cmd.append("__type_explorer=" + type.explorer_remote_path) - cmd.append("__object=" + object.path_remote) - cmd.append("__object_id=" + object.object_id) - cmd.append("__object_fq=" + cdist_object) + cmd.append("__type_explorer=" + os.path.join( + self.context.remote_type_path, + cdist_type.explorer_path)) + cmd.append("__object=" + os.path.join( + self.context.remote_object_path, + cdist_object.path)) + cmd.append("__object_id=" + cdist_object.object_id) + cmd.append("__object_fq=" + cdist_object.name) # Need to transfer at least the parameters for objects to be useful - self.path.transfer_object_parameter(cdist_object) + self.transfer_object_parameter(cdist_object) explorers = self.path.list_type_explorers(type) for explorer in explorers: @@ -280,7 +284,7 @@ class ConfigInstall: cdist_object.parameter_path) # Synchronise parameter dir afterwards - self.transfer_path(local_path, remote_path) + self.context.transfer_path(src, dst) def transfer_global_explorers(self): """Transfer the global explorers""" @@ -303,5 +307,11 @@ class ConfigInstall: rel_path = cdist_type.explorer_path src = os.path.join(self.context.type_base_path, rel_path) dst = os.path.join(self.context.remote_type_path, rel_path) + + # Ensure full path until type exists: + # /var/lib/cdist/conf/type/__directory/explorer + # /var/lib/cdist/conf/type/__directory may not exist, + # but remote_mkdir uses -p to fix this + self.context.remote_mkdir(dst) self.context.transfer_path(src, dst) From 22784f447d1f60edb11c588be5dc79cd291df5e3 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 16:43:05 +0200 Subject: [PATCH 0519/1024] --todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 7 ------- 1 file changed, 7 deletions(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 54b43210..47e0f6e7 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,11 +1,4 @@ Object: - cdist_object.code_local_path - cdist_object.code_remote_path - cdist_object.remote_code_remote_path - - cdist_object.parameter_path - - Type: From e8c9b1022748ed24514d82fe124f1f116dc8de2e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:44:53 +0200 Subject: [PATCH 0520/1024] also use path in emulator Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 2df95597..298161d9 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -30,9 +30,9 @@ log = logging.getLogger(__name__) def run(argv): """Emulate type commands (i.e. __file and co)""" cdist_type = os.path.basename(argv[0]) - type_path = os.path.join(os.environ['__cdist_type_base_path'], cdist_type) - param_dir = os.path.join(type_path, "parameter") - global_dir = os.environ['__global'] + type_path = os.path.join(os.environ['__cdist_type_base_path'], cdist_type) + param_path = os.path.join(type_path, "parameter") + global_path = os.environ['__global'] object_source = os.environ['__cdist_manifest'] if '__debug' in os.environ: @@ -42,10 +42,10 @@ def run(argv): parser = argparse.ArgumentParser(add_help=False) - for parameter in cdist.file_to_list(os.path.join(param_dir, "optional")): + for parameter in cdist.file_to_list(os.path.join(param_path, "optional")): argument = "--" + parameter parser.add_argument(argument, action='store', required=False) - for parameter in cdist.file_to_list(os.path.join(param_dir, "required")): + for parameter in cdist.file_to_list(os.path.join(param_path, "required")): argument = "--" + parameter parser.add_argument(argument, action='store', required=True) @@ -74,15 +74,15 @@ def run(argv): # FIXME: verify object id log.debug(args) - object_dir = os.path.join(global_dir, "object", cdist_type, + object_path = os.path.join(global_path, "object", cdist_type, object_id, cdist.DOT_CDIST) - log.debug("Object output dir = " + object_dir) + log.debug("Object output dir = " + object_path) - param_out_dir = os.path.join(object_dir, "parameter") + param_out_dir = os.path.join(object_path, "parameter") - object_source_file = os.path.join(object_dir, "source") + object_source_file = os.path.join(object_path, "source") - if os.path.exists(param_out_dir): + if os.path.exists(object_path): object_exists = True old_object_source_fd = open(object_source_file, "r") old_object_source = old_object_source_fd.readlines() @@ -91,7 +91,9 @@ def run(argv): else: object_exists = False try: - os.makedirs(param_out_dir, exist_ok=True) + os.makedirs(object_path, exist_ok=False) + log.debug("Object param dir = " + param_out_dir) + os.makedirs(param_out_dir, exist_ok=False) except OSError as error: raise cdist.Error(param_out_dir + ": " + error.args[1]) @@ -131,12 +133,12 @@ def run(argv): if "require" in os.environ: requirements = os.environ['__require'] log.debug(object_id + ":Writing requirements: " + requirements) - require_fd = open(os.path.join(object_dir, "require"), "a") + require_fd = open(os.path.join(object_path, "require"), "a") require_fd.write(requirements.replace(" ","\n")) require_fd.close() # Record / Append source - source_fd = open(os.path.join(object_dir, "source"), "a") + source_fd = open(os.path.join(object_path, "source"), "a") source_fd.writelines(object_source) source_fd.close() From 3115ee46ab08e9b16a0d05865caba45be90ad2c3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:46:52 +0200 Subject: [PATCH 0521/1024] ++todo(steven) Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 41941739..2c2f523c 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -30,3 +30,5 @@ Tests needed: - does $require work? - $whatever should fail if there is no global explorer directory - emulator may only be called with __ as prefix - fail otherwise! + + - ensure paths returned by object include dot-cdist From 53737aad3a0e83a74ea7150f1210844ca0850bda Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 16:46:55 +0200 Subject: [PATCH 0522/1024] append .cdist to absolute paths Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index f5179606..2f1d93c4 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -69,7 +69,7 @@ class Object(object): self.object_id = object_id self.name = os.path.join(self.type.name, self.object_id) self.path = os.path.join(self.type.path, self.object_id) - self.absolute_path = os.path.join(self.base_path, self.path) + self.absolute_path = os.path.join(self.base_path, self.path, DOT_CDIST) self.code_local_path = os.path.join(self.path, "code-local") self.code_remote_path = os.path.join(self.path, "code-remote") self.parameter_path = os.path.join(self.path, "parameter") From 5f4a85f6ad88f8411965060fc568ed65e4bbbce3 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 16:49:18 +0200 Subject: [PATCH 0523/1024] also need .cdist in relative paths Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 2f1d93c4..4cbcd550 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -68,7 +68,7 @@ class Object(object): self.base_path = base_path self.object_id = object_id self.name = os.path.join(self.type.name, self.object_id) - self.path = os.path.join(self.type.path, self.object_id) + self.path = os.path.join(self.type.path, self.object_id, DOT_CDIST) self.absolute_path = os.path.join(self.base_path, self.path, DOT_CDIST) self.code_local_path = os.path.join(self.path, "code-local") self.code_remote_path = os.path.join(self.path, "code-remote") From d9bb8e31071253f9854b75865ac40addf123d5c4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:55:19 +0200 Subject: [PATCH 0524/1024] use cdist_type Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 2f4aa261..afc32d63 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -63,9 +63,9 @@ class ConfigInstall: def run_type_manifest(self, cdist_object): """Run manifest for a specific object""" - type = cdist_object.type + cdist_type = cdist_object.type manifest_path = os.path.join(self.context.type_base_path, - type.manifest_path) + cdist_type.manifest_path) log.debug("%s: Running %s", cdist_object.name, manifest) if os.path.exists(manifest_path): @@ -74,7 +74,7 @@ class ConfigInstall: "__object_id": cdist_object.object_id, "__object_fq": cdist_object.name, "__type": os.path.join(self.context.type_base_path, - type.path) + cdist_type.path) } self.run_manifest(manifest_path, extra_env=env) @@ -112,7 +112,7 @@ class ConfigInstall: if cdist_object.ran: return - type = cdist_object.type + cdist_type = cdist_object.type for requirement in cdist_object.requirements: log.debug("Object %s requires %s", cdist_object, requirement) @@ -127,12 +127,12 @@ class ConfigInstall: env["__object"] = os.path.join(self.context.object_base_path, cdist_object.path) env["__object_id"] = cdist_object.object_id env["__object_fq"] = cdist_object.name - env["__type"] = type.name + env["__type"] = cdist_type.name # gencode for cmd in ["local", "remote"]: bin = os.path.join(self.context.type_base_path, - getattr(type, "gencode_" + cmd)) + getattr(cdist_type, "gencode_" + cmd)) if os.path.isfile(bin): outfile = os.path.join(self.context.object_base_path, @@ -191,10 +191,9 @@ class ConfigInstall: # Need to transfer at least the parameters for objects to be useful self.transfer_object_parameter(cdist_object) - explorers = self.path.list_type_explorers(type) - for explorer in explorers: - remote_cmd = cmd + [os.path.join(type.explorer_remote_path, explorer)] - output = os.path.join(cdist_object.explorer_output_path(), explorer) + for explorer in cdist_type.explorers: + remote_cmd = cmd + [os.path.join(cdist_type.explorer_path, explorer)] + output = os.path.join(cdist_object.explorer_output_path, explorer) output_fd = open(output, mode='w') log.debug("%s exploring %s using %s storing to %s", cdist_object, explorer, remote_cmd, output) @@ -206,8 +205,8 @@ class ConfigInstall: def link_emulator(self): """Link emulator to types""" src = os.path.abspath(self.exec_path) - for type in cdist.core.Type.list_types(self.context.type_base_path): - dst = os.path.join(self.context.bin_path, type.name) + for cdist_type in cdist.core.Type.list_types(self.context.type_base_path): + dst = os.path.join(self.context.bin_path, cdist_type.name) log.debug("Linking emulator: %s to %s", src, dst) # FIXME: handle exception / make it more beautiful @@ -284,6 +283,7 @@ class ConfigInstall: cdist_object.parameter_path) # Synchronise parameter dir afterwards + self.context.remote_mkdir(dst) self.context.transfer_path(src, dst) def transfer_global_explorers(self): From df2b4fbfd7111c0d8e7fd37e52ddb73d15f469db Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 16:57:24 +0200 Subject: [PATCH 0525/1024] ++todo(steven) Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 2c2f523c..722b6b6b 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -32,3 +32,4 @@ Tests needed: - emulator may only be called with __ as prefix - fail otherwise! - ensure paths returned by object include dot-cdist + - ensure path of explorer of object returns correct path From b778c9ff15f9ab61875257ca1a905d86dca636c0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 16:59:52 +0200 Subject: [PATCH 0526/1024] absolute path is based on relative path -> does not need another .cdist Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 4cbcd550..12d16838 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -69,7 +69,7 @@ class Object(object): self.object_id = object_id self.name = os.path.join(self.type.name, self.object_id) self.path = os.path.join(self.type.path, self.object_id, DOT_CDIST) - self.absolute_path = os.path.join(self.base_path, self.path, DOT_CDIST) + self.absolute_path = os.path.join(self.base_path, self.path) self.code_local_path = os.path.join(self.path, "code-local") self.code_remote_path = os.path.join(self.path, "code-remote") self.parameter_path = os.path.join(self.path, "parameter") From 35900ae66cfda15945a185b1045620210bd54ef2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:01:59 +0200 Subject: [PATCH 0527/1024] make type explorer work Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index afc32d63..d55429ed 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -192,8 +192,10 @@ class ConfigInstall: self.transfer_object_parameter(cdist_object) for explorer in cdist_type.explorers: - remote_cmd = cmd + [os.path.join(cdist_type.explorer_path, explorer)] - output = os.path.join(cdist_object.explorer_output_path, explorer) + remote_cmd = cmd + [os.path.join(self.context.type_base_path, + cdist_type.explorer_path, explorer)] + output = os.path.join(self.context.object_base_path, + cdist_object.explorer_path, explorer) output_fd = open(output, mode='w') log.debug("%s exploring %s using %s storing to %s", cdist_object, explorer, remote_cmd, output) From 4a1cf3dbf3ca40c823ea916d1ee2c87892eb9316 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:02:24 +0200 Subject: [PATCH 0528/1024] -typo Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index d55429ed..db0c8caf 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -67,7 +67,7 @@ class ConfigInstall: manifest_path = os.path.join(self.context.type_base_path, cdist_type.manifest_path) - log.debug("%s: Running %s", cdist_object.name, manifest) + log.debug("%s: Running %s", cdist_object.name, manifest_path) if os.path.exists(manifest_path): env = { "__object" : os.path.join(self.context.object_base_path, cdist_object.path), From c6e8f163f58cf9d3359e8531d6624d7c80e3a666 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:03:38 +0200 Subject: [PATCH 0529/1024] use variable require, not __require for defining Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 298161d9..27a3abb1 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -131,7 +131,7 @@ def run(argv): # Record requirements if "require" in os.environ: - requirements = os.environ['__require'] + requirements = os.environ['require'] log.debug(object_id + ":Writing requirements: " + requirements) require_fd = open(os.path.join(object_path, "require"), "a") require_fd.write(requirements.replace(" ","\n")) From b5c01f7354e92981ae7ed6c6e0beaadb9d700f3c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:04:52 +0200 Subject: [PATCH 0530/1024] update code to use new _path from object and type Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index db0c8caf..c4c1af10 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -132,11 +132,11 @@ class ConfigInstall: # gencode for cmd in ["local", "remote"]: bin = os.path.join(self.context.type_base_path, - getattr(cdist_type, "gencode_" + cmd)) + getattr(cdist_type, "gencode_" + cmd + "_path")) if os.path.isfile(bin): outfile = os.path.join(self.context.object_base_path, - getattr(cdist_object, "code_" + cmd)) + getattr(cdist_object, "code_" + cmd + "_path")) outfile_fd = open(outfile, "w") From 073717e07e68769a5878dd20cbe81eedbcd3e8b9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:07:10 +0200 Subject: [PATCH 0531/1024] some more relative to absolute path changes Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index c4c1af10..e6172a8c 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -163,10 +163,12 @@ class ConfigInstall: cdist.exec.run_or_fail([code_local]) # code remote - local_remote_code = cdist_object.code_remote_path - remote_remote_code = cdist_object.remote_code_remote_path + local_remote_code = os.path.join(self.context.object_base_path, + cdist_object.code_remote_path) + remote_remote_code = os.path.join(self.context.remote_object_path, + cdist_object.code_remote_path) if os.path.isfile(local_remote_code): - self.context.transfer_file(local_remote_code, remote_remote_code) + self.context.transfer_path(local_remote_code, remote_remote_code) cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) cdist_object.ran = True From d32aa37fba9713b80fa71de9f94a30d1fae94076 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:07:31 +0200 Subject: [PATCH 0532/1024] cleanup context Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index e6172a8c..fcbc79fc 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -53,7 +53,7 @@ class ConfigInstall: debug=debug) def cleanup(self): - self.path.cleanup() + self.context.cleanup() def run_initial_manifest(self): """Run the initial manifest""" From c0561958d0efca781a2c27fd1f73e58d7af236f2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:10:10 +0200 Subject: [PATCH 0533/1024] todo(steven) == changed Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 722b6b6b..2e38d817 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,25 +1,3 @@ -Object: - - -Type: - type.transferred_explorers - - -GlobalExplorer: - out_path: local path into which the output is written - - cdist.core.GlobalExplorer.base_dir - local directory containing explorers - cdist.core.GlobalExplorer.remote_base_dir - remote directory containing explorers - - path: local path to explorer - remote_path: remote path to explorer - - See config_install: run_global_explorers() - -Object/Type: - - rutern relative only - - Have accept absulet path on listing - Tests needed: - Fail if cache_dir from previous run cannot be deleted @@ -33,3 +11,7 @@ Tests needed: - ensure paths returned by object include dot-cdist - ensure path of explorer of object returns correct path + +Code fixes needed: + + - shutil, os.mkdir, etc. everywhere: catch/reraise exceptions correctly From 63c9a91bcad5eac759240f00c8ddc0cdcf0d9ff4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:12:06 +0200 Subject: [PATCH 0534/1024] +whitespace save out only Signed-off-by: Nico Schottelius --- lib/cdist/context.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index fb00b423..a4fdbca5 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -99,11 +99,11 @@ class Context: # "other globals referenced by the __del__() method may already have been deleted # or in the process of being torn down (e.g. the import machinery shutting down)" # - log.debug("Saving" + self.base_path + "to " + self.cache_path) + log.debug("Saving " + self.out_path + " to " + self.cache_path) # Remove previous cache if os.path.exists(self.cache_path): shutil.rmtree(self.cache_path) - shutil.move(self.base_path, self.cache_path) + shutil.move(self.out_path, self.cache_path) def __init_out_paths(self): """Initialise output directory structure""" From 9b0c0be5568b503bd5435bc4448d758529097cb0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:13:01 +0200 Subject: [PATCH 0535/1024] ++todo(nico) Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index f96da0de..005f1bb0 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,6 +1,7 @@ 2.0.3: -- fix emulator +- fix emulator / require +- sanity checks -------------------------------------------------------------------------------- From be78955cc6fe28aef9dc0dd0de3fe3c11ba7890b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:18:39 +0200 Subject: [PATCH 0536/1024] move banner into cdist module Signed-off-by: Nico Schottelius --- lib/cdist/__init__.py | 17 ++++++++++++++++- lib/cdist/banner.py | 19 +++---------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index 7aca5ac7..a3dc01cc 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -19,8 +19,23 @@ # # -VERSION = "2.0.3" +BANNER = """ + .. . .x+=:. s + dF @88> z` ^% :8 + '88bu. %8P . z` ^% :8 - '88bu. %8P . Date: Fri, 7 Oct 2011 17:38:10 +0200 Subject: [PATCH 0537/1024] 100% test coverage for the banner (feels good, doesn't it?) Signed-off-by: Nico Schottelius --- lib/cdist/test/test_banner.py | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 lib/cdist/test/test_banner.py diff --git a/lib/cdist/test/test_banner.py b/lib/cdist/test/test_banner.py new file mode 100644 index 00000000..4b0ab6ac --- /dev/null +++ b/lib/cdist/test/test_banner.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 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 . +# +# + +import io +import sys +import unittest + +import cdist +import cdist.banner + +class Banner(unittest.TestCase): + def setUp(self): + self.banner = cdist.BANNER + "\n" + + def test_banner_output(self): + """Check that printed banner equals saved banner""" + output = io.StringIO() + + sys.stdout = output + + cdist.banner.banner(None) + + self.assertEqual(output.getvalue(), self.banner) From e985c0d69713d7f32be71b387088d5a36792bd83 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:38:50 +0200 Subject: [PATCH 0538/1024] remove sys.exit from banner Signed-off-by: Nico Schottelius --- lib/cdist/banner.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/cdist/banner.py b/lib/cdist/banner.py index d7ee1b00..4148fa72 100644 --- a/lib/cdist/banner.py +++ b/lib/cdist/banner.py @@ -30,4 +30,3 @@ log = logging.getLogger(__name__) def banner(args): """Guess what :-)""" print(cdist.BANNER) - sys.exit(0) From d3f0965ace998fe95cc8151b1d0de6b11f6b34f1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:39:04 +0200 Subject: [PATCH 0539/1024] make t less verbose Signed-off-by: Nico Schottelius --- build.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.sh b/build.sh index 6a91ff3d..63c380cf 100755 --- a/build.sh +++ b/build.sh @@ -126,6 +126,12 @@ case "$1" in | xargs rm -f ;; + t) + shift # skip t + PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib \ + python3 -m unittest "$@" + ;; + test) PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib \ python3 -m cdist.test From f2869161ed6c366e3f88d08b07ca977b8f4ffdec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:45:39 +0200 Subject: [PATCH 0540/1024] ++todo(steven) Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 2e38d817..8d403245 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -12,6 +12,15 @@ Tests needed: - ensure paths returned by object include dot-cdist - ensure path of explorer of object returns correct path + config_install: + run_type_manifest() - same tests as for test_initial_manifest_*? + run_manifest() - raise exception if manifest is not existent + object_run(): ensure no object is run twice + object_run(): ensure requirements are taken into account + object_run(): check (from extern?) that all needed variables are setup + object_run(): ensure no code-{local, remote} is created, if gencode is not producing code + object_run(): ensure no code-{local, remote} contains what gencode created + Code fixes needed: - shutil, os.mkdir, etc. everywhere: catch/reraise exceptions correctly From 71af3b60c08850853954b71c2b506ef74f29cdc2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 17:48:36 +0200 Subject: [PATCH 0541/1024] move test todos to own file Signed-off-by: Nico Schottelius --- doc/dev/todo/steven | 23 ----------------------- doc/dev/todo/tests | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 doc/dev/todo/tests diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 8d403245..f0c867e1 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,26 +1,3 @@ -Tests needed: - - - Fail if cache_dir from previous run cannot be deleted - - Fail if cache_dir cannot be created from current out_dir - - transfer_type_explorers: Explorers are not transferred twice - - transfer_type_explorers: No transfer tried if there are no type_explorers - - - does $require work? - - $whatever should fail if there is no global explorer directory - - emulator may only be called with __ as prefix - fail otherwise! - - - ensure paths returned by object include dot-cdist - - ensure path of explorer of object returns correct path - - config_install: - run_type_manifest() - same tests as for test_initial_manifest_*? - run_manifest() - raise exception if manifest is not existent - object_run(): ensure no object is run twice - object_run(): ensure requirements are taken into account - object_run(): check (from extern?) that all needed variables are setup - object_run(): ensure no code-{local, remote} is created, if gencode is not producing code - object_run(): ensure no code-{local, remote} contains what gencode created - Code fixes needed: - shutil, os.mkdir, etc. everywhere: catch/reraise exceptions correctly diff --git a/doc/dev/todo/tests b/doc/dev/todo/tests new file mode 100644 index 00000000..8f019fed --- /dev/null +++ b/doc/dev/todo/tests @@ -0,0 +1,28 @@ +Tests needed: + + - Fail if cache_dir from previous run cannot be deleted + - Fail if cache_dir cannot be created from current out_dir + - transfer_type_explorers: Explorers are not transferred twice + - transfer_type_explorers: No transfer tried if there are no type_explorers + + - does $require work? + - $whatever should fail if there is no global explorer directory + - emulator may only be called with __ as prefix - fail otherwise! + + - ensure paths returned by object include dot-cdist + - ensure path of explorer of object returns correct path + + config_install: + run_type_manifest() - same tests as for test_initial_manifest_*? + run_manifest() - raise exception if manifest is not existent + object_run(): ensure no object is run twice + object_run(): ensure requirements are taken into account + object_run(): check (from extern?) that all needed variables are setup + object_run(): ensure no code-{local, remote} is created, if gencode is not producing code + object_run(): ensure no code-{local, remote} contains what gencode created + + run_type_explorer(): ensure output is saved to correct path + run_type_explorer(): ensure a type with no explorers works + run_type_explorer(): ensure environment is setup correctly + + From ae15779c8137420f9cd66b471e883badc56c6349 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 17:50:53 +0200 Subject: [PATCH 0542/1024] -- DeprecationWarning: object.__new__() takes no parameters Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index 42a74398..a9a34946 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -52,7 +52,7 @@ class Type(object): # name is second argument name = args[1] if not name in cls._instances: - instance = super(Type, cls).__new__(cls, *args, **kwargs) + instance = super(Type, cls).__new__(cls) cls._instances[name] = instance return cls._instances[name] From f515e20572c314fa99012e675b05338e8d3283ab Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 17:52:38 +0200 Subject: [PATCH 0543/1024] start unittests for Type Signed-off-by: Steven Armstrong --- lib/cdist/test/type/__init__.py | 0 .../test/type/fixtures/__not_singleton/.keep | 0 .../test/type/fixtures/__singleton/singleton | 0 lib/cdist/test/type/test_type.py | 61 +++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 lib/cdist/test/type/__init__.py create mode 100644 lib/cdist/test/type/fixtures/__not_singleton/.keep create mode 100644 lib/cdist/test/type/fixtures/__singleton/singleton create mode 100644 lib/cdist/test/type/test_type.py diff --git a/lib/cdist/test/type/__init__.py b/lib/cdist/test/type/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/fixtures/__not_singleton/.keep b/lib/cdist/test/type/fixtures/__not_singleton/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/fixtures/__singleton/singleton b/lib/cdist/test/type/fixtures/__singleton/singleton new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/test_type.py b/lib/cdist/test/type/test_type.py new file mode 100644 index 00000000..de202b8b --- /dev/null +++ b/lib/cdist/test/type/test_type.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import os +import tempfile +import unittest +import shutil + +import cdist.core + +import os.path as op +my_dir = op.abspath(op.dirname(__file__)) +fixtures = op.join(my_dir, 'fixtures') + + +class TypeTestCase(unittest.TestCase): + def setUp(self): + # FIXME: use defined set of types for testing? + # FIXME: generate object tree or use predefined? + self.temp_dir = tempfile.mkdtemp() + self.object_base_path = op.join(self.temp_dir, '') + + def tearDown(self): + shutil.rmtree(self.temp_dir) + + def test_singleton_is_singleton(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__singleton') + self.assertTrue(cdist_type.is_singleton) + + def test_not_singleton_is_singleton(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__not_singleton') + self.assertFalse(cdist_type.is_singleton) + + +''' +suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) + +def suite(): + tests = [] + return unittest.TestSuite(map(ObjectTestCase, tests)) +''' From d21126189cc92957087da37b3f4c5d0b4b0ab367 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 18:04:13 +0200 Subject: [PATCH 0544/1024] indent/cleanup Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index fcbc79fc..766cffa2 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -90,13 +90,13 @@ class ConfigInstall: # Submit debug flag to manifest, can be used by emulator and types if self.debug: - env['__debug'] = "yes" + env['__debug'] = "yes" # Required for recording source in emulator env['__cdist_manifest'] = manifest_path # Required to find types in emulator - env['__cdist_type_base_path'] = self.context.type_base_path + env['__cdist_type_base_path'] = self.context.type_base_path # Other environment stuff if extra_env: From 11a8379c75265e721452ab039b7adefb37939579 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 18:13:58 +0200 Subject: [PATCH 0545/1024] +comment Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 766cffa2..3e67f7c1 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -105,7 +105,7 @@ class ConfigInstall: cdist.exec.shell_run_or_debug_fail(manifest_path, [manifest_path], env=env) def object_run(self, cdist_object): - """Run gencode or code for an object""" + """Run gencode and code for an object""" log.debug("Running object %s", cdist_object) # Catch requirements, which re-call us From 71ed728b4adf68ab3460e309d012554af46216d5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 18:14:17 +0200 Subject: [PATCH 0546/1024] move parallel code to main binary, allow branching out on install and config Signed-off-by: Nico Schottelius --- bin/cdist | 40 ++++++++++++++++++++++++++++++++++++++-- lib/cdist/config.py | 27 --------------------------- 2 files changed, 38 insertions(+), 29 deletions(-) diff --git a/bin/cdist b/bin/cdist index 7d2c035b..1b8b4346 100755 --- a/bin/cdist +++ b/bin/cdist @@ -81,12 +81,12 @@ def commandline(): # Config parser['config'] = parser['sub'].add_parser('config', parents=[parser['loglevel'], parser['configinstall']]) - parser['config'].set_defaults(func=cdist.config.config) + parser['config'].set_defaults(func=config) # Install parser['install'] = parser['sub'].add_parser('install', parents=[parser['loglevel'], parser['configinstall']]) - parser['install'].set_defaults(func=cdist.install.install) + parser['install'].set_defaults(func=install) for p in parser: parser[p].epilog = "Get cdist at http://www.nico.schottelius.org/software/cdist/" @@ -102,6 +102,42 @@ def commandline(): 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""" + process = {} + + time_start = datetime.datetime.now() + + os.environ['__remote_exec'] = "ssh -o User=root -q" + os.environ['__remote_copy'] = "scp -o User=root -q" + + for host in args.host: + c = mode(host, initial_manifest=args.manifest, base_path=args.cdist_home, debug=args.debug) + if args.parallel: + log.debug("Creating child process for %s", host) + process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) + process[host].start() + else: + c.deploy_and_cleanup() + + if args.parallel: + for p in process.keys(): + log.debug("Joining process %s", p) + process[p].join() + + # FIXME: error handling for parallel mode! + + time_end = datetime.datetime.now() + log.info("Total processing time for %s host(s): %s", len(args.host), + (time_end - time_start).total_seconds()) + + if __name__ == "__main__": try: logging.basicConfig(format='%(levelname)s: %(message)s') diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 71ce14ed..782c88a1 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -31,30 +31,3 @@ log = logging.getLogger(__name__) class Config(cdist.config_install.ConfigInstall): pass - -def config(args): - """Configure remote system""" - process = {} - - time_start = datetime.datetime.now() - - os.environ['__remote_exec'] = "ssh -o User=root -q" - os.environ['__remote_copy'] = "scp -o User=root -q" - - for host in args.host: - c = Config(host, initial_manifest=args.manifest, base_path=args.cdist_home, debug=args.debug) - if args.parallel: - log.debug("Creating child process for %s", host) - process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) - process[host].start() - else: - c.deploy_and_cleanup() - - if args.parallel: - for p in process.keys(): - log.debug("Joining process %s", p) - process[p].join() - - time_end = datetime.datetime.now() - log.info("Total processing time for %s host(s): %s", len(args.host), - (time_end - time_start).total_seconds()) From 52f9388f07ae4842e28e3935c45ea69c2feac543 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 18:22:38 +0200 Subject: [PATCH 0547/1024] tests and fixtures for Type.is_install Signed-off-by: Steven Armstrong --- lib/cdist/test/type/fixtures/__install/install | 0 lib/cdist/test/type/fixtures/__not_install/.keep | 0 lib/cdist/test/type/test_type.py | 8 ++++++++ 3 files changed, 8 insertions(+) create mode 100644 lib/cdist/test/type/fixtures/__install/install create mode 100644 lib/cdist/test/type/fixtures/__not_install/.keep diff --git a/lib/cdist/test/type/fixtures/__install/install b/lib/cdist/test/type/fixtures/__install/install new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/fixtures/__not_install/.keep b/lib/cdist/test/type/fixtures/__not_install/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/test_type.py b/lib/cdist/test/type/test_type.py index de202b8b..ca62002a 100644 --- a/lib/cdist/test/type/test_type.py +++ b/lib/cdist/test/type/test_type.py @@ -51,7 +51,15 @@ class TypeTestCase(unittest.TestCase): cdist_type = cdist.core.Type(base_path, '__not_singleton') self.assertFalse(cdist_type.is_singleton) + def test_install_is_install(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__install') + self.assertTrue(cdist_type.is_install) + def test_not_install_is_install(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__not_install') + self.assertFalse(cdist_type.is_install) ''' suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) From 8e0501aaa906677c47f418735d491429670d4bdb Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 18:28:22 +0200 Subject: [PATCH 0548/1024] tests and fixtures for Type.explorers Signed-off-by: Steven Armstrong --- lib/cdist/test/test_object.py | 46 +++++++++++++++++++ .../__with_explorers/explorer/whatever | 2 + .../type/fixtures/__without_explorers/.keep | 0 lib/cdist/test/type/test_type.py | 12 +++++ 4 files changed, 60 insertions(+) create mode 100644 lib/cdist/test/test_object.py create mode 100755 lib/cdist/test/type/fixtures/__with_explorers/explorer/whatever create mode 100644 lib/cdist/test/type/fixtures/__without_explorers/.keep diff --git a/lib/cdist/test/test_object.py b/lib/cdist/test/test_object.py new file mode 100644 index 00000000..ae584840 --- /dev/null +++ b/lib/cdist/test/test_object.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import os +import tempfile +import unittest +import shutil + +import os.path as op +my_dir = op.abspath(op.dirname(__file__)) +base_path = op.join(my_dir, 'fixtures') + +class ObjectTestCase(unittest.TestCase): + def setUp(self): + # FIXME: use defined set of types for testing? + # FIXME: generate object tree or use predefined? + self.object_base_dir = tempfile.mkdtemp() + + def tearDown(self): + shutil.rmtree(self.temp_dir) + +''' +suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) + +def suite(): + tests = [] + return unittest.TestSuite(map(ObjectTestCase, tests)) +''' diff --git a/lib/cdist/test/type/fixtures/__with_explorers/explorer/whatever b/lib/cdist/test/type/fixtures/__with_explorers/explorer/whatever new file mode 100755 index 00000000..01b7b61c --- /dev/null +++ b/lib/cdist/test/type/fixtures/__with_explorers/explorer/whatever @@ -0,0 +1,2 @@ +#!/bin/sh +echo whatever diff --git a/lib/cdist/test/type/fixtures/__without_explorers/.keep b/lib/cdist/test/type/fixtures/__without_explorers/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/test_type.py b/lib/cdist/test/type/test_type.py index ca62002a..15a596ca 100644 --- a/lib/cdist/test/type/test_type.py +++ b/lib/cdist/test/type/test_type.py @@ -60,6 +60,18 @@ class TypeTestCase(unittest.TestCase): base_path = fixtures cdist_type = cdist.core.Type(base_path, '__not_install') self.assertFalse(cdist_type.is_install) + + def test_with_explorers(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__with_explorers') + self.assertEqual(cdist_type.explorers, ['whatever']) + + def test_without_explorers(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__without_explorers') + self.assertEqual(cdist_type.explorers, []) + + ''' suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) From b7c88b03d30a189bd55cf7b0f9ce65f7cd14a842 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 18:29:24 +0200 Subject: [PATCH 0549/1024] removed unused code/imports Signed-off-by: Steven Armstrong --- lib/cdist/test/type/test_type.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/cdist/test/type/test_type.py b/lib/cdist/test/type/test_type.py index 15a596ca..49cc3a34 100644 --- a/lib/cdist/test/type/test_type.py +++ b/lib/cdist/test/type/test_type.py @@ -20,9 +20,7 @@ # import os -import tempfile import unittest -import shutil import cdist.core @@ -32,14 +30,6 @@ fixtures = op.join(my_dir, 'fixtures') class TypeTestCase(unittest.TestCase): - def setUp(self): - # FIXME: use defined set of types for testing? - # FIXME: generate object tree or use predefined? - self.temp_dir = tempfile.mkdtemp() - self.object_base_path = op.join(self.temp_dir, '') - - def tearDown(self): - shutil.rmtree(self.temp_dir) def test_singleton_is_singleton(self): base_path = fixtures From 8d3cad1815671d3b74b23ef46ff8a89a92e34d67 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 22:32:55 +0200 Subject: [PATCH 0550/1024] test and fixtures for Type.{required,optional}_parameters Signed-off-by: Steven Armstrong --- .../parameter/optional | 2 ++ .../parameter/required | 2 ++ .../__without_optional_parameters/.keep | 0 .../__without_required_parameters/.keep | 0 lib/cdist/test/type/test_type.py | 19 +++++++++++++++++++ 5 files changed, 23 insertions(+) create mode 100644 lib/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional create mode 100644 lib/cdist/test/type/fixtures/__with_required_parameters/parameter/required create mode 100644 lib/cdist/test/type/fixtures/__without_optional_parameters/.keep create mode 100644 lib/cdist/test/type/fixtures/__without_required_parameters/.keep diff --git a/lib/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional b/lib/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional new file mode 100644 index 00000000..8174d2a9 --- /dev/null +++ b/lib/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional @@ -0,0 +1,2 @@ +optional1 +optional2 diff --git a/lib/cdist/test/type/fixtures/__with_required_parameters/parameter/required b/lib/cdist/test/type/fixtures/__with_required_parameters/parameter/required new file mode 100644 index 00000000..e0fba2c9 --- /dev/null +++ b/lib/cdist/test/type/fixtures/__with_required_parameters/parameter/required @@ -0,0 +1,2 @@ +required1 +required2 diff --git a/lib/cdist/test/type/fixtures/__without_optional_parameters/.keep b/lib/cdist/test/type/fixtures/__without_optional_parameters/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/fixtures/__without_required_parameters/.keep b/lib/cdist/test/type/fixtures/__without_required_parameters/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/test_type.py b/lib/cdist/test/type/test_type.py index 49cc3a34..99ef3820 100644 --- a/lib/cdist/test/type/test_type.py +++ b/lib/cdist/test/type/test_type.py @@ -61,6 +61,25 @@ class TypeTestCase(unittest.TestCase): cdist_type = cdist.core.Type(base_path, '__without_explorers') self.assertEqual(cdist_type.explorers, []) + def test_with_required_parameters(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__with_required_parameters') + self.assertEqual(cdist_type.required_parameters, ['required1', 'required2']) + + def test_without_required_parameters(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__without_required_parameters') + self.assertEqual(cdist_type.required_parameters, []) + + def test_with_optional_parameters(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__with_optional_parameters') + self.assertEqual(cdist_type.optional_parameters, ['optional1', 'optional2']) + + def test_without_optional_parameters(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__without_optional_parameters') + self.assertEqual(cdist_type.optional_parameters, []) ''' suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) From d3e12769658b21f96d676140952d171f634d47fe Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 22:39:45 +0200 Subject: [PATCH 0551/1024] remove duplicate code Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index a9a34946..58a147b7 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -63,7 +63,6 @@ class Type(object): self.absolute_path = os.path.join(self._base_path, self.path) self.manifest_path = os.path.join(self.name, "manifest") self.explorer_path = os.path.join(self.name, "explorer") - self.manifest_path = os.path.join(self.name, "manifest") self.gencode_local_path = os.path.join(self.name, "gencode-local") self.gencode_remote_path = os.path.join(self.name, "gencode-remote") self.manifest_path = os.path.join(self.name, "manifest") From 73bdb7f11f345aaa6ed7a360d8ae92ebd8bb047f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 22:49:09 +0200 Subject: [PATCH 0552/1024] test and fixtures for Type members (name, path, ...) Signed-off-by: Steven Armstrong --- .../test/type/fixtures/__name_path/.keep | 0 lib/cdist/test/type/test_type.py | 36 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 lib/cdist/test/type/fixtures/__name_path/.keep diff --git a/lib/cdist/test/type/fixtures/__name_path/.keep b/lib/cdist/test/type/fixtures/__name_path/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/test_type.py b/lib/cdist/test/type/test_type.py index 99ef3820..140e5349 100644 --- a/lib/cdist/test/type/test_type.py +++ b/lib/cdist/test/type/test_type.py @@ -31,6 +31,42 @@ fixtures = op.join(my_dir, 'fixtures') class TypeTestCase(unittest.TestCase): + + def test_name(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.name, '__name_path') + + def test_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.path, '__name_path') + + def test_absolute_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.absolute_path, os.path.join(base_path, '__name_path')) + + def test_manifest_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.manifest_path, os.path.join('__name_path', 'manifest')) + + def test_explorer_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.explorer_path, os.path.join('__name_path', 'explorer')) + + def test_gencode_local_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.gencode_local_path, os.path.join('__name_path', 'gencode-local')) + + def test_gencode_remote_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.gencode_remote_path, os.path.join('__name_path', 'gencode-remote')) + def test_singleton_is_singleton(self): base_path = fixtures cdist_type = cdist.core.Type(base_path, '__singleton') From 5d59102018419e4a78774d3c7e0c9e26ba1eb83d Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 22:50:11 +0200 Subject: [PATCH 0553/1024] test only one instance of same type Signed-off-by: Steven Armstrong --- lib/cdist/test/type/test_type.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/cdist/test/type/test_type.py b/lib/cdist/test/type/test_type.py index 140e5349..1c8d10aa 100644 --- a/lib/cdist/test/type/test_type.py +++ b/lib/cdist/test/type/test_type.py @@ -32,6 +32,12 @@ fixtures = op.join(my_dir, 'fixtures') class TypeTestCase(unittest.TestCase): + def test_only_one_instance(self): + base_path = fixtures + cdist_type1 = cdist.core.Type(base_path, '__name_path') + cdist_type2 = cdist.core.Type(base_path, '__name_path') + self.assertEqual(id(cdist_type1), id(cdist_type2)) + def test_name(self): base_path = fixtures cdist_type = cdist.core.Type(base_path, '__name_path') From f46344effe9794481b4f2fddd3e967683e6e8d87 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 22:51:06 +0200 Subject: [PATCH 0554/1024] test and fixtures for Type.list_* Signed-off-by: Steven Armstrong --- .../test/type/fixtures/list_types/__first/.keep | 0 .../test/type/fixtures/list_types/__second/.keep | 0 .../test/type/fixtures/list_types/__third/.keep | 0 lib/cdist/test/type/test_type.py | 14 ++++++++++++++ 4 files changed, 14 insertions(+) create mode 100644 lib/cdist/test/type/fixtures/list_types/__first/.keep create mode 100644 lib/cdist/test/type/fixtures/list_types/__second/.keep create mode 100644 lib/cdist/test/type/fixtures/list_types/__third/.keep diff --git a/lib/cdist/test/type/fixtures/list_types/__first/.keep b/lib/cdist/test/type/fixtures/list_types/__first/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/fixtures/list_types/__second/.keep b/lib/cdist/test/type/fixtures/list_types/__second/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/fixtures/list_types/__third/.keep b/lib/cdist/test/type/fixtures/list_types/__third/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/test_type.py b/lib/cdist/test/type/test_type.py index 1c8d10aa..5ba1f4b9 100644 --- a/lib/cdist/test/type/test_type.py +++ b/lib/cdist/test/type/test_type.py @@ -31,6 +31,20 @@ fixtures = op.join(my_dir, 'fixtures') class TypeTestCase(unittest.TestCase): + def test_list_type_names(self): + base_path = op.join(fixtures, 'list_types') + type_names = cdist.core.Type.list_type_names(base_path) + self.assertEqual(type_names, ['__first', '__second', '__third']) + + def test_list_types(self): + base_path = op.join(fixtures, 'list_types') + types = list(cdist.core.Type.list_types(base_path)) + types_expected = [ + cdist.core.Type(base_path, '__first'), + cdist.core.Type(base_path, '__second'), + cdist.core.Type(base_path, '__third'), + ] + self.assertEqual(types, types_expected) def test_only_one_instance(self): base_path = fixtures From d190b192deef9366262ff8fa9607206e8b1dd4ec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Oct 2011 03:22:19 +0200 Subject: [PATCH 0555/1024] update timing method Signed-off-by: Nico Schottelius --- bin/cdist | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/bin/cdist b/bin/cdist index 1b8b4346..c42e540c 100755 --- a/bin/cdist +++ b/bin/cdist @@ -21,11 +21,11 @@ # import argparse -import datetime import logging import os import re import sys +import time log = logging.getLogger("cdist") @@ -112,7 +112,7 @@ def configinstall(args, mode): """Configure or install remote system""" process = {} - time_start = datetime.datetime.now() + time_start = time.time() os.environ['__remote_exec'] = "ssh -o User=root -q" os.environ['__remote_copy'] = "scp -o User=root -q" @@ -133,17 +133,15 @@ def configinstall(args, mode): # FIXME: error handling for parallel mode! - time_end = datetime.datetime.now() + time_end = time.time() log.info("Total processing time for %s host(s): %s", len(args.host), - (time_end - time_start).total_seconds()) + (time_end - time_start)) if __name__ == "__main__": try: logging.basicConfig(format='%(levelname)s: %(message)s') - time_start = datetime.datetime.now() - if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): import cdist.emulator cdist.emulator.run(sys.argv) @@ -154,13 +152,6 @@ if __name__ == "__main__": commandline() - time_end = datetime.datetime.now() - duration = time_end - time_start - # FIXME: move into runner - # log.info("Finished run of %s in %s seconds", self.target_host, - # duration.total_seconds()) - log.info("Finished run in %s seconds", duration.total_seconds()) - except KeyboardInterrupt: sys.exit(0) except cdist.Error as e: From e10ebeadf89f31bb1b6a85c45e7eb65b1c6aba0a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Oct 2011 03:24:05 +0200 Subject: [PATCH 0556/1024] BUGFIX: export global explorer with path from remote Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3e67f7c1..3544a901 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -24,6 +24,7 @@ import logging import os import stat import sys +import time import cdist.context import cdist.core @@ -230,7 +231,7 @@ class ConfigInstall: output_fd = open(os.path.join(dst_path, explorer), mode='w') cmd = [] cmd.append("__explorer=" + remote_dst_path) - cmd.append(os.path.join(src_path, explorer)) + cmd.append(os.path.join(remote_dst_path, explorer)) cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) output_fd.close() @@ -252,8 +253,11 @@ class ConfigInstall: def deploy_and_cleanup(self): """Do what is most often done: deploy & cleanup""" + start_time = time.time() self.deploy_to() self.cleanup() + log.info("Finished run of %s in %s seconds", + self.target_host, time.time() - start_time) def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" From ea146c88e7a0cf6f46cb4c6e35f0f3e643d85c17 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Oct 2011 11:59:26 +0200 Subject: [PATCH 0557/1024] cleanup config Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 782c88a1..9af25b75 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -20,14 +20,7 @@ # # -import datetime -import logging -import os -import sys - import cdist.config_install -log = logging.getLogger(__name__) - class Config(cdist.config_install.ConfigInstall): pass From 56e1fc9eb8f47be7139aea1eb1f3e1af3a2be8d5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Oct 2011 12:01:53 +0200 Subject: [PATCH 0558/1024] type explorer should run with remote base as well :-) Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3544a901..e4b51ad4 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -195,7 +195,7 @@ class ConfigInstall: self.transfer_object_parameter(cdist_object) for explorer in cdist_type.explorers: - remote_cmd = cmd + [os.path.join(self.context.type_base_path, + remote_cmd = cmd + [os.path.join(self.context.remote_base_path, cdist_type.explorer_path, explorer)] output = os.path.join(self.context.object_base_path, cdist_object.explorer_path, explorer) From 93a312702c207e003032f32e9c6f43db4201567b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Oct 2011 12:06:45 +0200 Subject: [PATCH 0559/1024] ++todo(nico) Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 005f1bb0..9710f4ea 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -331,3 +331,4 @@ eof - remote_prefix: scp vs. ssh issue +locale_type From c9159b15f17be4d4f7262d1670e88398571a5b02 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Sun, 9 Oct 2011 07:41:53 +0200 Subject: [PATCH 0560/1024] use package, no need for another file Signed-off-by: Steven Armstrong --- lib/cdist/test/type/__init__.py | 146 +++++++++++++++++++++++++++++++ lib/cdist/test/type/test_type.py | 146 ------------------------------- 2 files changed, 146 insertions(+), 146 deletions(-) delete mode 100644 lib/cdist/test/type/test_type.py diff --git a/lib/cdist/test/type/__init__.py b/lib/cdist/test/type/__init__.py index e69de29b..5ba1f4b9 100644 --- a/lib/cdist/test/type/__init__.py +++ b/lib/cdist/test/type/__init__.py @@ -0,0 +1,146 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import os +import unittest + +import cdist.core + +import os.path as op +my_dir = op.abspath(op.dirname(__file__)) +fixtures = op.join(my_dir, 'fixtures') + + +class TypeTestCase(unittest.TestCase): + + def test_list_type_names(self): + base_path = op.join(fixtures, 'list_types') + type_names = cdist.core.Type.list_type_names(base_path) + self.assertEqual(type_names, ['__first', '__second', '__third']) + + def test_list_types(self): + base_path = op.join(fixtures, 'list_types') + types = list(cdist.core.Type.list_types(base_path)) + types_expected = [ + cdist.core.Type(base_path, '__first'), + cdist.core.Type(base_path, '__second'), + cdist.core.Type(base_path, '__third'), + ] + self.assertEqual(types, types_expected) + + def test_only_one_instance(self): + base_path = fixtures + cdist_type1 = cdist.core.Type(base_path, '__name_path') + cdist_type2 = cdist.core.Type(base_path, '__name_path') + self.assertEqual(id(cdist_type1), id(cdist_type2)) + + def test_name(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.name, '__name_path') + + def test_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.path, '__name_path') + + def test_absolute_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.absolute_path, os.path.join(base_path, '__name_path')) + + def test_manifest_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.manifest_path, os.path.join('__name_path', 'manifest')) + + def test_explorer_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.explorer_path, os.path.join('__name_path', 'explorer')) + + def test_gencode_local_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.gencode_local_path, os.path.join('__name_path', 'gencode-local')) + + def test_gencode_remote_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.gencode_remote_path, os.path.join('__name_path', 'gencode-remote')) + + def test_singleton_is_singleton(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__singleton') + self.assertTrue(cdist_type.is_singleton) + + def test_not_singleton_is_singleton(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__not_singleton') + self.assertFalse(cdist_type.is_singleton) + + def test_install_is_install(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__install') + self.assertTrue(cdist_type.is_install) + + def test_not_install_is_install(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__not_install') + self.assertFalse(cdist_type.is_install) + + def test_with_explorers(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__with_explorers') + self.assertEqual(cdist_type.explorers, ['whatever']) + + def test_without_explorers(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__without_explorers') + self.assertEqual(cdist_type.explorers, []) + + def test_with_required_parameters(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__with_required_parameters') + self.assertEqual(cdist_type.required_parameters, ['required1', 'required2']) + + def test_without_required_parameters(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__without_required_parameters') + self.assertEqual(cdist_type.required_parameters, []) + + def test_with_optional_parameters(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__with_optional_parameters') + self.assertEqual(cdist_type.optional_parameters, ['optional1', 'optional2']) + + def test_without_optional_parameters(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__without_optional_parameters') + self.assertEqual(cdist_type.optional_parameters, []) + +''' +suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) + +def suite(): + tests = [] + return unittest.TestSuite(map(ObjectTestCase, tests)) +''' diff --git a/lib/cdist/test/type/test_type.py b/lib/cdist/test/type/test_type.py deleted file mode 100644 index 5ba1f4b9..00000000 --- a/lib/cdist/test/type/test_type.py +++ /dev/null @@ -1,146 +0,0 @@ -# -*- coding: utf-8 -*- -# -# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -import os -import unittest - -import cdist.core - -import os.path as op -my_dir = op.abspath(op.dirname(__file__)) -fixtures = op.join(my_dir, 'fixtures') - - -class TypeTestCase(unittest.TestCase): - - def test_list_type_names(self): - base_path = op.join(fixtures, 'list_types') - type_names = cdist.core.Type.list_type_names(base_path) - self.assertEqual(type_names, ['__first', '__second', '__third']) - - def test_list_types(self): - base_path = op.join(fixtures, 'list_types') - types = list(cdist.core.Type.list_types(base_path)) - types_expected = [ - cdist.core.Type(base_path, '__first'), - cdist.core.Type(base_path, '__second'), - cdist.core.Type(base_path, '__third'), - ] - self.assertEqual(types, types_expected) - - def test_only_one_instance(self): - base_path = fixtures - cdist_type1 = cdist.core.Type(base_path, '__name_path') - cdist_type2 = cdist.core.Type(base_path, '__name_path') - self.assertEqual(id(cdist_type1), id(cdist_type2)) - - def test_name(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') - self.assertEqual(cdist_type.name, '__name_path') - - def test_path(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') - self.assertEqual(cdist_type.path, '__name_path') - - def test_absolute_path(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') - self.assertEqual(cdist_type.absolute_path, os.path.join(base_path, '__name_path')) - - def test_manifest_path(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') - self.assertEqual(cdist_type.manifest_path, os.path.join('__name_path', 'manifest')) - - def test_explorer_path(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') - self.assertEqual(cdist_type.explorer_path, os.path.join('__name_path', 'explorer')) - - def test_gencode_local_path(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') - self.assertEqual(cdist_type.gencode_local_path, os.path.join('__name_path', 'gencode-local')) - - def test_gencode_remote_path(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') - self.assertEqual(cdist_type.gencode_remote_path, os.path.join('__name_path', 'gencode-remote')) - - def test_singleton_is_singleton(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__singleton') - self.assertTrue(cdist_type.is_singleton) - - def test_not_singleton_is_singleton(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__not_singleton') - self.assertFalse(cdist_type.is_singleton) - - def test_install_is_install(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__install') - self.assertTrue(cdist_type.is_install) - - def test_not_install_is_install(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__not_install') - self.assertFalse(cdist_type.is_install) - - def test_with_explorers(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__with_explorers') - self.assertEqual(cdist_type.explorers, ['whatever']) - - def test_without_explorers(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__without_explorers') - self.assertEqual(cdist_type.explorers, []) - - def test_with_required_parameters(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__with_required_parameters') - self.assertEqual(cdist_type.required_parameters, ['required1', 'required2']) - - def test_without_required_parameters(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__without_required_parameters') - self.assertEqual(cdist_type.required_parameters, []) - - def test_with_optional_parameters(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__with_optional_parameters') - self.assertEqual(cdist_type.optional_parameters, ['optional1', 'optional2']) - - def test_without_optional_parameters(self): - base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__without_optional_parameters') - self.assertEqual(cdist_type.optional_parameters, []) - -''' -suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) - -def suite(): - tests = [] - return unittest.TestSuite(map(ObjectTestCase, tests)) -''' From 790deb464502d97c5e84fe37410cd081d22d4977 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 9 Oct 2011 12:49:57 +0200 Subject: [PATCH 0561/1024] in theory finish the install command Signed-off-by: Nico Schottelius --- lib/cdist/install.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/cdist/install.py b/lib/cdist/install.py index 87714fa8..0f06f5e7 100644 --- a/lib/cdist/install.py +++ b/lib/cdist/install.py @@ -20,14 +20,14 @@ # # -import logging - +import os import cdist.config_install -log = logging.getLogger(__name__) +class Install(cdist.config_install.ConfigInstall): + def __init__(self, *args, **kargs): + """Enhance config install with install support""" + # Setup environ to be used in emulator + os.environ['__install'] = "yes" -def install(args): - """Install remote system""" - process = {} - + super().__init__(*args, **kargs) From 48a9309522d4223c0ae8f91d6cfb08ac591e8086 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 9 Oct 2011 12:50:47 +0200 Subject: [PATCH 0562/1024] indent/+FIXME Signed-off-by: Nico Schottelius --- bin/cdist | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index c42e540c..61dad1db 100755 --- a/bin/cdist +++ b/bin/cdist @@ -114,11 +114,16 @@ def configinstall(args, mode): time_start = time.time() + # FIXME: do not overwrite, if set! os.environ['__remote_exec'] = "ssh -o User=root -q" os.environ['__remote_copy'] = "scp -o User=root -q" for host in args.host: - c = mode(host, initial_manifest=args.manifest, base_path=args.cdist_home, debug=args.debug) + c = mode(host, + initial_manifest=args.manifest, + base_path=args.cdist_home, + debug=args.debug, + parallel=True) if args.parallel: log.debug("Creating child process for %s", host) process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) From e27cd9e809d8d7c711662c6f9020f3e6c6ea9a15 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 09:23:27 +0200 Subject: [PATCH 0563/1024] when comparing objects, define equality as 'attributes are the same' Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 12d16838..b6bdeee3 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -80,6 +80,10 @@ class Object(object): def __repr__(self): return '' % self.name + def __eq__(self, other): + """define equality as 'attributes are the same'""" + return self.__dict__ == other.__dict__ + @property def explorer_path(self): # create absolute path From 7c12027311c4483de05bc0c583890382f7517536 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 09:30:28 +0200 Subject: [PATCH 0564/1024] test and fixtures for Object class/static methods Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 61 +++++++++++++++++++ .../test/object/fixtures/object/__first/.keep | 0 .../fixtures/object/__first/man/.cdist/.keep | 0 .../object/fixtures/object/__second/.keep | 0 .../object/__second/on-the/.cdist/.keep | 0 .../test/object/fixtures/object/__third/.keep | 0 .../fixtures/object/__third/moon/.cdist/.keep | 0 .../test/object/fixtures/type/__first/.keep | 0 .../test/object/fixtures/type/__second/.keep | 0 .../test/object/fixtures/type/__third/.keep | 0 lib/cdist/test/test_object.py | 46 -------------- 11 files changed, 61 insertions(+), 46 deletions(-) create mode 100644 lib/cdist/test/object/__init__.py create mode 100644 lib/cdist/test/object/fixtures/object/__first/.keep create mode 100644 lib/cdist/test/object/fixtures/object/__first/man/.cdist/.keep create mode 100644 lib/cdist/test/object/fixtures/object/__second/.keep create mode 100644 lib/cdist/test/object/fixtures/object/__second/on-the/.cdist/.keep create mode 100644 lib/cdist/test/object/fixtures/object/__third/.keep create mode 100644 lib/cdist/test/object/fixtures/object/__third/moon/.cdist/.keep create mode 100644 lib/cdist/test/object/fixtures/type/__first/.keep create mode 100644 lib/cdist/test/object/fixtures/type/__second/.keep create mode 100644 lib/cdist/test/object/fixtures/type/__third/.keep delete mode 100644 lib/cdist/test/test_object.py diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py new file mode 100644 index 00000000..3d04a7a3 --- /dev/null +++ b/lib/cdist/test/object/__init__.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import os +import tempfile +import unittest +import shutil + +import cdist.core + +import os.path as op +my_dir = op.abspath(op.dirname(__file__)) +fixtures = op.join(my_dir, 'fixtures') +object_base_path = op.join(fixtures, 'object') +type_base_path = op.join(fixtures, 'type') + +class ObjectClassTestCase(unittest.TestCase): + + def test_list_object_names(self): + object_names = list(cdist.core.Object.list_object_names(object_base_path)) + self.assertEqual(object_names, ['__first/man', '__second/on-the', '__third/moon']) + + def test_list_type_names(self): + type_names = list(cdist.core.Object.list_type_names(object_base_path)) + self.assertEqual(type_names, ['__first', '__second', '__third']) + + def test_list_objects(self): + objects = list(cdist.core.Object.list_objects(object_base_path, type_base_path)) + objects_expected = [ + cdist.core.Object(cdist.core.Type(type_base_path, '__first'), object_base_path, 'man'), + cdist.core.Object(cdist.core.Type(type_base_path, '__second'), object_base_path, 'on-the'), + cdist.core.Object(cdist.core.Type(type_base_path, '__third'), object_base_path, 'moon'), + ] + self.assertEqual(objects, objects_expected) + + +''' +suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) + +def suite(): + tests = [] + return unittest.TestSuite(map(ObjectTestCase, tests)) +''' diff --git a/lib/cdist/test/object/fixtures/object/__first/.keep b/lib/cdist/test/object/fixtures/object/__first/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/object/fixtures/object/__first/man/.cdist/.keep b/lib/cdist/test/object/fixtures/object/__first/man/.cdist/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/object/fixtures/object/__second/.keep b/lib/cdist/test/object/fixtures/object/__second/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/object/fixtures/object/__second/on-the/.cdist/.keep b/lib/cdist/test/object/fixtures/object/__second/on-the/.cdist/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/object/fixtures/object/__third/.keep b/lib/cdist/test/object/fixtures/object/__third/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/.keep b/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/object/fixtures/type/__first/.keep b/lib/cdist/test/object/fixtures/type/__first/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/object/fixtures/type/__second/.keep b/lib/cdist/test/object/fixtures/type/__second/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/object/fixtures/type/__third/.keep b/lib/cdist/test/object/fixtures/type/__third/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/test_object.py b/lib/cdist/test/test_object.py deleted file mode 100644 index ae584840..00000000 --- a/lib/cdist/test/test_object.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# -# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -import os -import tempfile -import unittest -import shutil - -import os.path as op -my_dir = op.abspath(op.dirname(__file__)) -base_path = op.join(my_dir, 'fixtures') - -class ObjectTestCase(unittest.TestCase): - def setUp(self): - # FIXME: use defined set of types for testing? - # FIXME: generate object tree or use predefined? - self.object_base_dir = tempfile.mkdtemp() - - def tearDown(self): - shutil.rmtree(self.temp_dir) - -''' -suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) - -def suite(): - tests = [] - return unittest.TestSuite(map(ObjectTestCase, tests)) -''' From f3b942e591423c09e71e92af32887d6782f3d5ee Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 09:34:16 +0200 Subject: [PATCH 0565/1024] test for Object paths Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 3d04a7a3..c1685c58 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -52,10 +52,28 @@ class ObjectClassTestCase(unittest.TestCase): self.assertEqual(objects, objects_expected) -''' -suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) +class ObjectTestCase(unittest.TestCase): -def suite(): - tests = [] - return unittest.TestSuite(map(ObjectTestCase, tests)) -''' + def setUp(self): + self.cdist_type = cdist.core.Type(type_base_path, '__third') + self.cdist_object = cdist.core.Object(self.cdist_type, object_base_path, 'moon') + + def test_name(self): + self.assertEqual(self.cdist_object.name, '__third/moon') + + def test_path(self): + self.assertEqual(self.cdist_object.path, '__third/moon/.cdist') + + def test_absolute_path(self): + self.assertEqual(self.cdist_object.absolute_path, os.path.join(object_base_path, '__third/moon/.cdist')) + + def test_code_local_path(self): + self.assertEqual(self.cdist_object.code_local_path, '__third/moon/.cdist/code-local') + + def test_code_remote_path(self): + self.assertEqual(self.cdist_object.code_remote_path, '__third/moon/.cdist/code-remote') + + def test_parameter_path(self): + self.assertEqual(self.cdist_object.parameter_path, '__third/moon/.cdist/parameter') + +#suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) From 8384176080156f3fb6b3087eb5e26b177827c963 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 09:36:48 +0200 Subject: [PATCH 0566/1024] test Object explorer_path Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 3 +++ .../object/fixtures/object/__third/moon/.cdist/explorer/.keep | 0 2 files changed, 3 insertions(+) create mode 100644 lib/cdist/test/object/fixtures/object/__third/moon/.cdist/explorer/.keep diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index c1685c58..55af5bf9 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -76,4 +76,7 @@ class ObjectTestCase(unittest.TestCase): def test_parameter_path(self): self.assertEqual(self.cdist_object.parameter_path, '__third/moon/.cdist/parameter') + def test_explorer_path(self): + self.assertEqual(self.cdist_object.explorer_path, '__third/moon/.cdist/explorer') + #suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) diff --git a/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/explorer/.keep b/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/explorer/.keep new file mode 100644 index 00000000..e69de29b From 88a1e34f3004defd6020f753c9ecec9669302d96 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 09:44:29 +0200 Subject: [PATCH 0567/1024] test for Object object_id Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 55af5bf9..cd6e7f04 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -61,6 +61,9 @@ class ObjectTestCase(unittest.TestCase): def test_name(self): self.assertEqual(self.cdist_object.name, '__third/moon') + def test_object_id(self): + self.assertEqual(self.cdist_object.object_id, 'moon') + def test_path(self): self.assertEqual(self.cdist_object.path, '__third/moon/.cdist') From abf318ae90b827b2fc99555b386c8321a38e0cc0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 09:47:06 +0200 Subject: [PATCH 0568/1024] test and fixtures for Object parameters Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 4 ++++ .../object/fixtures/object/__third/moon/.cdist/parameter/name | 1 + .../fixtures/object/__third/moon/.cdist/parameter/planet | 1 + 3 files changed, 6 insertions(+) create mode 100644 lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/name create mode 100644 lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/planet diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index cd6e7f04..a9edfdd0 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -82,4 +82,8 @@ class ObjectTestCase(unittest.TestCase): def test_explorer_path(self): self.assertEqual(self.cdist_object.explorer_path, '__third/moon/.cdist/explorer') + def test_parameters(self): + expected_parameters = {'planet': 'Saturn', 'name': 'Prometheus'} + self.assertEqual(self.cdist_object.parameters, expected_parameters) + #suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) diff --git a/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/name b/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/name new file mode 100644 index 00000000..4129a761 --- /dev/null +++ b/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/name @@ -0,0 +1 @@ +Prometheus diff --git a/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/planet b/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/planet new file mode 100644 index 00000000..8e6ee422 --- /dev/null +++ b/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/planet @@ -0,0 +1 @@ +Saturn From 96ca5b6988f249b8320c977d3242846b2e1f0519 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 09:48:19 +0200 Subject: [PATCH 0569/1024] bugfix: use absolute path to when accessing file sytem (unittest discoverd :-) Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index b6bdeee3..96c6076a 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -114,7 +114,7 @@ class Object(object): @property def parameters(self): if not self.__parameters: - self.__parameters = cdist.core.property.DirectoryDict(os.path.join(self.path, "parameter")) + self.__parameters = cdist.core.property.DirectoryDict(os.path.join(self.absolute_path, "parameter")) return self.__parameters @parameters.setter @@ -122,7 +122,7 @@ class Object(object): if isinstance(value, cdist.core.property.DirectoryDict): self.__parameters = value else: - self.__parameters = cdist.core.property.DirectoryDict(os.path.join(self.path, "parameter"), value) + self.__parameters = cdist.core.property.DirectoryDict(os.path.join(self.absolute_path, "parameter"), value) ### /parameters From 0ba6d551919090d079ef6667e1f228be0b79c358 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 09:57:56 +0200 Subject: [PATCH 0570/1024] raise exception when given a relative path Signed-off-by: Steven Armstrong --- lib/cdist/core/property.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/cdist/core/property.py b/lib/cdist/core/property.py index 30887547..e63cadcf 100644 --- a/lib/cdist/core/property.py +++ b/lib/cdist/core/property.py @@ -25,11 +25,21 @@ import collections import cdist +class AbsolutePathRequiredError(cdist.Error): + def __init__(self, path): + self.path = path + + def __str__(self): + return 'Absolute path required, got: %s' % self.path + + class FileList(collections.MutableSequence): """A list that stores it's state in a file. """ def __init__(self, path, initial=None): + if not os.path.isabs(path): + raise AbsolutePathRequiredError(path) self._path = path if initial: # delete existing file @@ -108,6 +118,8 @@ class DirectoryDict(collections.MutableMapping): """ def __init__(self, path, dict=None, **kwargs): + if not os.path.isabs(path): + raise AbsolutePathRequiredError(path) self._path = path if dict is not None: self.update(dict) From b1efc27b39b02ae43cd43156ad82e8a61022023c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 10:00:42 +0200 Subject: [PATCH 0571/1024] test for Object requirements Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index a9edfdd0..910a75e1 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -86,4 +86,8 @@ class ObjectTestCase(unittest.TestCase): expected_parameters = {'planet': 'Saturn', 'name': 'Prometheus'} self.assertEqual(self.cdist_object.parameters, expected_parameters) + def test_requirements(self): + expected = [] + self.assertEqual(list(self.cdist_object.requirements), expected) + #suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) From 86f976976ec5743fa1dfee2dcc5b67f11a3b1066 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 10:01:28 +0200 Subject: [PATCH 0572/1024] bugfix: use absolute path when accessing file system Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 96c6076a..76e8faa1 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -98,7 +98,7 @@ class Object(object): @property def requirements(self): if not self.__requirements: - self.__requirements = cdist.core.property.FileList(os.path.join(self.path, "require")) + self.__requirements = cdist.core.property.FileList(os.path.join(self.absolute_path, "require")) return self.__requirements @requirements.setter @@ -106,7 +106,7 @@ class Object(object): if isinstance(value, cdist.core.property.FileList): self.__requirements = value else: - self.__requirements = cdist.core.property.FileList(os.path.join(self.path, "require"), value) + self.__requirements = cdist.core.property.FileList(os.path.join(self.absolute_path, "require"), value) ### /requirements From f2701cb5124d513b9c80fb45ef3ab527ade4a9e5 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 10:04:36 +0200 Subject: [PATCH 0573/1024] test for Object changed Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 910a75e1..a85e8df9 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -58,6 +58,9 @@ class ObjectTestCase(unittest.TestCase): self.cdist_type = cdist.core.Type(type_base_path, '__third') self.cdist_object = cdist.core.Object(self.cdist_type, object_base_path, 'moon') + def tearDown(self): + self.cdist_object.changed = False + def test_name(self): self.assertEqual(self.cdist_object.name, '__third/moon') @@ -90,4 +93,11 @@ class ObjectTestCase(unittest.TestCase): expected = [] self.assertEqual(list(self.cdist_object.requirements), expected) + def test_changed(self): + self.assertFalse(self.cdist_object.changed) + + def test_changed_after_changing(self): + self.cdist_object.changed = True + self.assertTrue(self.cdist_object.changed) + #suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) From 7855a485b627100886275e9446e2257b4c12f054 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 10:05:46 +0200 Subject: [PATCH 0574/1024] test for Object prepared Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index a85e8df9..c490bdc3 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -60,6 +60,7 @@ class ObjectTestCase(unittest.TestCase): def tearDown(self): self.cdist_object.changed = False + self.cdist_object.prepared = False def test_name(self): self.assertEqual(self.cdist_object.name, '__third/moon') @@ -100,4 +101,10 @@ class ObjectTestCase(unittest.TestCase): self.cdist_object.changed = True self.assertTrue(self.cdist_object.changed) + def test_prepared(self): + self.assertFalse(self.cdist_object.prepared) + + def test_prepared_after_changing(self): + self.cdist_object.prepared = True + self.assertTrue(self.cdist_object.prepared) #suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) From 6de7bd3377d060d108df07fcabe1506d66666232 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 10:06:41 +0200 Subject: [PATCH 0575/1024] test for Object ran Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index c490bdc3..75322654 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -61,6 +61,7 @@ class ObjectTestCase(unittest.TestCase): def tearDown(self): self.cdist_object.changed = False self.cdist_object.prepared = False + self.cdist_object.ran = False def test_name(self): self.assertEqual(self.cdist_object.name, '__third/moon') @@ -107,4 +108,10 @@ class ObjectTestCase(unittest.TestCase): def test_prepared_after_changing(self): self.cdist_object.prepared = True self.assertTrue(self.cdist_object.prepared) -#suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) + + def test_ran(self): + self.assertFalse(self.cdist_object.ran) + + def test_ran_after_changing(self): + self.cdist_object.ran = True + self.assertTrue(self.cdist_object.ran) From 7823d0c9977aaabf695e38687106d515819fb988 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 10 Oct 2011 11:31:37 +0200 Subject: [PATCH 0576/1024] merge context back into config (it is in fact the same idea) Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 192 ++++++++++++++++++++++++++---------- lib/cdist/context.py | 137 ------------------------- 2 files changed, 139 insertions(+), 190 deletions(-) delete mode 100644 lib/cdist/context.py diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index e4b51ad4..0da820b2 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -24,10 +24,11 @@ import logging import os import stat import sys +import tempfile import time -import cdist.context import cdist.core +import cdist.exec import cdist.emulator log = logging.getLogger(__name__) @@ -37,44 +38,115 @@ CODE_HEADER = "#!/bin/sh -e\n" class ConfigInstall: """Cdist main class to hold arbitrary data""" - def __init__(self, target_host, initial_manifest=False, - base_path=False, - exec_path=sys.argv[0], - debug=False): + def __init__(self, target_host, + initial_manifest=False, base_path=False, debug=False): self.target_host = target_host - os.environ['target_host'] = target_host self.debug = debug - self.exec_path = exec_path + self.exec_path = sys.argv[0] - self.context = cdist.context.Context(self.target_host, - initial_manifest=initial_manifest, - base_path=base_path, - debug=debug) + # Base and Temp Base + if base_path: + self.base_path = base_path + else: + self.base_path = os.path.abspath( + os.path.join(os.path.dirname(__file__), + os.pardir, + os.pardir)) + + + # Local input + self.cache_path = os.path.join(self.base_path, "cache", + self.target_host) + 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_base_path = os.path.join(self.conf_path, "type") + self.lib_path = os.path.join(self.base_path, "lib") + + if initial_manifest: + self.initial_manifest = initial_manifest + else: + self.initial_manifest = os.path.join(self.manifest_path, "init") + + # Local output + if '__cdist_out_dir' in os.environ: + self.out_path = os.environ['__cdist_out_dir'] + else: + self.out_path = os.path.join(tempfile.mkdtemp(), "out") + self.bin_path = os.path.join(self.out_path, "bin") + self.global_explorer_out_path = os.path.join(self.out_path, "explorer") + self.object_base_path = os.path.join(self.out_path, "object") + + # Remote directory base + if '__cdist_remote_out_dir' in os.environ: + self.remote_base_path = os.environ['__cdist_remote_out_dir'] + else: + self.remote_base_path = "/var/lib/cdist" + self.remote_conf_path = os.path.join(self.remote_base_path, "conf") + self.remote_object_path = os.path.join(self.remote_base_path, "object") + + self.remote_type_path = os.path.join(self.remote_conf_path, "type") + self.remote_global_explorer_path = os.path.join(self.remote_conf_path, "explorer") + + # Create directories + self.__init_local_paths() + self.__init_remote_paths() + + + def __init_remote_paths(self): + """Initialise remote directory structure""" + self.remove_remote_path(self.remote_base_path) + self.remote_mkdir(self.remote_base_path) + self.remote_mkdir(self.remote_conf_path) + + def __init_local_paths(self): + """Initialise local directory structure""" + + # Create base dir, if user supplied and not existing + if not os.path.isdir(self.base_path): + os.mkdir(self.base_path) + + os.mkdir(self.out_path) + os.mkdir(self.global_explorer_out_path) + os.mkdir(self.bin_path) def cleanup(self): - self.context.cleanup() + # Do not use in __del__: + # http://docs.python.org/reference/datamodel.html#customization + # "other globals referenced by the __del__() method may already have been deleted + # or in the process of being torn down (e.g. the import machinery shutting down)" + # + log.debug("Saving " + self.out_path + " to " + self.cache_path) + # Remove previous cache + if os.path.exists(self.cache_path): + shutil.rmtree(self.cache_path) + shutil.move(self.out_path, self.cache_path) + + def logfilter(self): + """Add hostname to logs""" def run_initial_manifest(self): """Run the initial manifest""" - log.info("Running initial manifest %s", self.context.initial_manifest) - env = { "__manifest" : self.context.manifest_path } - self.run_manifest(self.context.initial_manifest, extra_env=env) + log.info("Running initial manifest %s", self.initial_manifest) + env = { "__manifest" : self.manifest_path } + self.run_manifest(self.initial_manifest, extra_env=env) def run_type_manifest(self, cdist_object): """Run manifest for a specific object""" cdist_type = cdist_object.type - manifest_path = os.path.join(self.context.type_base_path, + manifest_path = os.path.join(self.type_base_path, cdist_type.manifest_path) log.debug("%s: Running %s", cdist_object.name, manifest_path) if os.path.exists(manifest_path): - env = { "__object" : os.path.join(self.context.object_base_path, + env = { "__object" : os.path.join(self.object_base_path, cdist_object.path), "__object_id": cdist_object.object_id, "__object_fq": cdist_object.name, - "__type": os.path.join(self.context.type_base_path, + "__type": os.path.join(self.type_base_path, cdist_type.path) } self.run_manifest(manifest_path, extra_env=env) @@ -83,11 +155,11 @@ class ConfigInstall: """Run a manifest""" log.debug("Running manifest %s, env=%s", manifest_path, extra_env) env = os.environ.copy() - env['PATH'] = self.context.bin_path + ":" + env['PATH'] + env['PATH'] = self.bin_path + ":" + env['PATH'] # Information required in every manifest env['__target_host'] = self.target_host - env['__global'] = self.context.out_path + env['__global'] = self.out_path # Submit debug flag to manifest, can be used by emulator and types if self.debug: @@ -97,7 +169,7 @@ class ConfigInstall: env['__cdist_manifest'] = manifest_path # Required to find types in emulator - env['__cdist_type_base_path'] = self.context.type_base_path + env['__cdist_type_base_path'] = self.type_base_path # Other environment stuff if extra_env: @@ -124,19 +196,19 @@ class ConfigInstall: # env = os.environ.copy() env['__target_host'] = self.target_host - env['__global'] = self.context.out_path - env["__object"] = os.path.join(self.context.object_base_path, cdist_object.path) + env['__global'] = self.out_path + env["__object"] = os.path.join(self.object_base_path, cdist_object.path) env["__object_id"] = cdist_object.object_id env["__object_fq"] = cdist_object.name env["__type"] = cdist_type.name # gencode for cmd in ["local", "remote"]: - bin = os.path.join(self.context.type_base_path, + bin = os.path.join(self.type_base_path, getattr(cdist_type, "gencode_" + cmd + "_path")) if os.path.isfile(bin): - outfile = os.path.join(self.context.object_base_path, + outfile = os.path.join(self.object_base_path, getattr(cdist_object, "code_" + cmd + "_path")) outfile_fd = open(outfile, "w") @@ -164,12 +236,12 @@ class ConfigInstall: cdist.exec.run_or_fail([code_local]) # code remote - local_remote_code = os.path.join(self.context.object_base_path, + local_remote_code = os.path.join(self.object_base_path, cdist_object.code_remote_path) - remote_remote_code = os.path.join(self.context.remote_object_path, + remote_remote_code = os.path.join(self.remote_object_path, cdist_object.code_remote_path) if os.path.isfile(local_remote_code): - self.context.transfer_path(local_remote_code, remote_remote_code) + self.transfer_path(local_remote_code, remote_remote_code) cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) cdist_object.ran = True @@ -181,12 +253,12 @@ class ConfigInstall: self.transfer_type_explorers(cdist_type) cmd = [] - cmd.append("__explorer=" + self.context.remote_global_explorer_path) + cmd.append("__explorer=" + self.remote_global_explorer_path) cmd.append("__type_explorer=" + os.path.join( - self.context.remote_type_path, + self.remote_type_path, cdist_type.explorer_path)) cmd.append("__object=" + os.path.join( - self.context.remote_object_path, + self.remote_object_path, cdist_object.path)) cmd.append("__object_id=" + cdist_object.object_id) cmd.append("__object_fq=" + cdist_object.name) @@ -195,9 +267,9 @@ class ConfigInstall: self.transfer_object_parameter(cdist_object) for explorer in cdist_type.explorers: - remote_cmd = cmd + [os.path.join(self.context.remote_base_path, + remote_cmd = cmd + [os.path.join(self.remote_base_path, cdist_type.explorer_path, explorer)] - output = os.path.join(self.context.object_base_path, + output = os.path.join(self.object_base_path, cdist_object.explorer_path, explorer) output_fd = open(output, mode='w') log.debug("%s exploring %s using %s storing to %s", @@ -210,8 +282,8 @@ class ConfigInstall: def link_emulator(self): """Link emulator to types""" src = os.path.abspath(self.exec_path) - for cdist_type in cdist.core.Type.list_types(self.context.type_base_path): - dst = os.path.join(self.context.bin_path, cdist_type.name) + for cdist_type in cdist.core.Type.list_types(self.type_base_path): + dst = os.path.join(self.bin_path, cdist_type.name) log.debug("Linking emulator: %s to %s", src, dst) # FIXME: handle exception / make it more beautiful @@ -221,11 +293,11 @@ class ConfigInstall: """Run global explorers""" log.info("Running global explorers") - src_path = self.context.global_explorer_path - dst_path = self.context.global_explorer_out_path - remote_dst_path = self.context.remote_global_explorer_path + src_path = self.global_explorer_path + dst_path = self.global_explorer_out_path + remote_dst_path = self.remote_global_explorer_path - self.context.transfer_path(src_path, remote_dst_path) + self.transfer_path(src_path, remote_dst_path) for explorer in os.listdir(src_path): output_fd = open(os.path.join(dst_path, explorer), mode='w') @@ -240,8 +312,8 @@ class ConfigInstall: def stage_run(self): """The final (and real) step of deployment""" log.info("Generating and executing code") - for cdist_object in cdist.core.Object.list_objects(self.context.object_base_path, - self.context.type_base_path): + for cdist_object in cdist.core.Object.list_objects(self.object_base_path, + self.type_base_path): log.debug("Run object: %s", cdist_object) self.object_run(cdist_object) @@ -271,8 +343,8 @@ class ConfigInstall: new_objects_created = True while new_objects_created: new_objects_created = False - for cdist_object in cdist.core.Object.list_objects(self.context.object_base_path, - self.context.type_base_path): + for cdist_object in cdist.core.Object.list_objects(self.object_base_path, + self.type_base_path): if cdist_object.prepared: log.debug("Skipping rerun of object %s", cdist_object) continue @@ -285,19 +357,19 @@ class ConfigInstall: def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" - src = os.path.join(self.context.object_base_path, + src = os.path.join(self.object_base_path, cdist_object.parameter_path) - dst = os.path.join(self.context.remote_object_path, + dst = os.path.join(self.remote_object_path, cdist_object.parameter_path) # Synchronise parameter dir afterwards - self.context.remote_mkdir(dst) - self.context.transfer_path(src, dst) + self.remote_mkdir(dst) + self.transfer_path(src, dst) def transfer_global_explorers(self): """Transfer the global explorers""" - self.remote_mkdir(self.context.remote_global_explorer_path) - self.transfer_path(self.context.global_explorer_path, + self.remote_mkdir(self.remote_global_explorer_path) + self.transfer_path(self.global_explorer_path, self.remote_global_explorer_path) def transfer_type_explorers(self, cdist_type): @@ -313,13 +385,27 @@ class ConfigInstall: if len(explorers) > 0: rel_path = cdist_type.explorer_path - src = os.path.join(self.context.type_base_path, rel_path) - dst = os.path.join(self.context.remote_type_path, rel_path) + src = os.path.join(self.type_base_path, rel_path) + dst = os.path.join(self.remote_type_path, rel_path) # Ensure full path until type exists: # /var/lib/cdist/conf/type/__directory/explorer # /var/lib/cdist/conf/type/__directory may not exist, # but remote_mkdir uses -p to fix this - self.context.remote_mkdir(dst) - self.context.transfer_path(src, dst) + self.remote_mkdir(dst) + self.transfer_path(src, dst) + + def remote_mkdir(self, directory): + """Create directory on remote side""" + cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) + + def remove_remote_path(self, destination): + """Ensure path on remote side vanished""" + cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) + + def transfer_path(self, source, destination): + """Transfer directory and previously delete the remote destination""" + self.remove_remote_path(destination) + cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + + ["-r", source, self.target_host + ":" + destination]) diff --git a/lib/cdist/context.py b/lib/cdist/context.py deleted file mode 100644 index a4fdbca5..00000000 --- a/lib/cdist/context.py +++ /dev/null @@ -1,137 +0,0 @@ -# -*- coding: utf-8 -*- -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -import logging -import os -import shutil -import sys -import tempfile - - -log = logging.getLogger(__name__) - -import cdist.exec - -class Context: - """Storing context information""" - - def __init__(self, - target_host, - initial_manifest=False, - base_path=False, - out_path=False, - remote_base_path=False, - debug=False): - - self.target_host = target_host - - # Base and Temp Base - if base_path: - self.base_path = base_path - else: - self.base_path = os.path.abspath( - os.path.join(os.path.dirname(__file__), - os.pardir, - os.pardir)) - - - # Local input directories - self.cache_path = os.path.join(self.base_path, "cache", target_host) - 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_base_path = os.path.join(self.conf_path, "type") - self.lib_path = os.path.join(self.base_path, "lib") - - if initial_manifest: - self.initial_manifest = initial_manifest - else: - self.initial_manifest = os.path.join(self.manifest_path, "init") - - # Local output directories - if out_path: - self.out_path = out_path - else: - self.out_path = os.path.join(tempfile.mkdtemp(), "out") - - self.bin_path = os.path.join(self.out_path, "bin") - self.global_explorer_out_path = os.path.join(self.out_path, "explorer") - self.object_base_path = os.path.join(self.out_path, "object") - - # Remote directories - if remote_base_path: - self.remote_base_path = remote_base_path - else: - self.remote_base_path = "/var/lib/cdist" - - self.remote_conf_path = os.path.join(self.remote_base_path, "conf") - self.remote_object_path = os.path.join(self.remote_base_path, "object") - - self.remote_type_path = os.path.join(self.remote_conf_path, "type") - self.remote_global_explorer_path = os.path.join(self.remote_conf_path, "explorer") - - # Create directories - self.__init_out_paths() - self.__init_remote_paths() - - def cleanup(self): - # Do not use in __del__: - # http://docs.python.org/reference/datamodel.html#customization - # "other globals referenced by the __del__() method may already have been deleted - # or in the process of being torn down (e.g. the import machinery shutting down)" - # - log.debug("Saving " + self.out_path + " to " + self.cache_path) - # Remove previous cache - if os.path.exists(self.cache_path): - shutil.rmtree(self.cache_path) - shutil.move(self.out_path, self.cache_path) - - def __init_out_paths(self): - """Initialise output directory structure""" - - # Create base dir, if user supplied and not existing - if not os.path.isdir(self.base_path): - os.mkdir(self.base_path) - - os.mkdir(self.out_path) - os.mkdir(self.global_explorer_out_path) - os.mkdir(self.bin_path) - - def __init_remote_paths(self): - """Initialise remote directory structure""" - - self.remove_remote_path(self.remote_base_path) - self.remote_mkdir(self.remote_base_path) - self.remote_mkdir(self.remote_conf_path) - - def remote_mkdir(self, directory): - """Create directory on remote side""" - cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) - - def remove_remote_path(self, destination): - cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) - - def transfer_path(self, source, destination): - """Transfer directory and previously delete the remote destination""" - self.remove_remote_path(destination) - cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + - ["-r", source, self.target_host + ":" + destination]) From 44a722042a4e321c38ac50b0b796a4fa494f09e4 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 14:37:33 +0200 Subject: [PATCH 0577/1024] new class for using filesystem as backend for boolean properties Signed-off-by: Steven Armstrong --- lib/cdist/core/property.py | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/lib/cdist/core/property.py b/lib/cdist/core/property.py index e63cadcf..11dddcf3 100644 --- a/lib/cdist/core/property.py +++ b/lib/cdist/core/property.py @@ -165,3 +165,50 @@ class DirectoryDictProperty(DirectoryDict): def __delete__(self, obj): raise AttributeError("can't delete attribute") + + +class FileBooleanProperty(object): + def __init__(self, path): + """ + :param path: string or callable + + Usage: + + class Foo(object): + changed = FileBoolean(lambda obj: os.path.join(obj.absolute_path, 'changed')) + other_boolean = FileBoolean('/tmp/other_boolean') + + def __init__(self): + self.absolute_path = '/tmp/foo_boolean' + + """ + self._path = path + + def _get_path(self, *args, **kwargs): + path = self._path + if callable(path): + return path(*args, **kwargs) + if not os.path.isabs(path): + raise AbsolutePathRequiredError(path) + return path + + # Descriptor Protocol + def __get__(self, obj, objtype=None): + if obj is None: + return self.__class__ + path = self._get_path(obj) + return os.path.isfile(path) + + def __set__(self, obj, value): + path = self._get_path(obj) + if value: + open(path, "w").close() + else: + try: + os.remove(path) + except EnvironmentError: + # ignore + pass + + def __delete__(self, obj): + raise AttributeError("can't delete attribute") From f3932bb662bb73c970ba59b74aaba9bde182237d Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 14:54:26 +0200 Subject: [PATCH 0578/1024] move file based properties out of core Signed-off-by: Steven Armstrong --- lib/cdist/util/property.py | 214 +++++++++++++++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 lib/cdist/util/property.py diff --git a/lib/cdist/util/property.py b/lib/cdist/util/property.py new file mode 100644 index 00000000..11dddcf3 --- /dev/null +++ b/lib/cdist/util/property.py @@ -0,0 +1,214 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import os +import collections + +import cdist + + +class AbsolutePathRequiredError(cdist.Error): + def __init__(self, path): + self.path = path + + def __str__(self): + return 'Absolute path required, got: %s' % self.path + + +class FileList(collections.MutableSequence): + """A list that stores it's state in a file. + + """ + def __init__(self, path, initial=None): + if not os.path.isabs(path): + raise AbsolutePathRequiredError(path) + self._path = path + if initial: + # delete existing file + os.unlink(self._path) + for i in initial: + self.append(i) + + def __read(self): + lines = [] + try: + with open(self._path) as fd: + for line in fd: + lines.append(line.rstrip('\n')) + except EnvironmentError as e: + # error ignored + pass + return lines + + def __write(self, lines): + try: + with open(self._path, 'w') as fd: + for line in lines: + fd.write(str(line) + '\n') + except EnvironmentError as e: + # error ignored + raise + + def __repr__(self): + return repr(list(self)) + + def __getitem__(self, index): + return self.__read()[index] + + def __setitem__(self, index, value): + lines = self.__read() + lines[index] = value + self.__write(lines) + + def __delitem__(self, index): + lines = self.__read() + del lines[index] + self.__write(lines) + + def __len__(self): + lines = self.__read() + return len(lines) + + def insert(self, index, value): + lines = self.__read() + lines.insert(index, value) + self.__write(lines) + + def sort(self): + lines = sorted(self) + self.__write(lines) + + +class FileListProperty(FileList): + # Descriptor Protocol + def __get__(self, obj, objtype=None): + if obj is None: + return self.__class__ + return self + + def __set__(self, obj, value): + os.unlink(self._path) + for item in value: + self.append(item) + + def __delete__(self, obj): + raise AttributeError("can't delete attribute") + + +class DirectoryDict(collections.MutableMapping): + """A dict that stores it's state in a directory. + + """ + def __init__(self, path, dict=None, **kwargs): + if not os.path.isabs(path): + raise AbsolutePathRequiredError(path) + self._path = path + if dict is not None: + self.update(dict) + if len(kwargs): + self.update(kwargs) + + def __repr__(self): + return repr(dict(self)) + + def __getitem__(self, key): + try: + with open(os.path.join(self._path, key), "r") as fd: + return fd.read().rstrip('\n') + except EnvironmentError: + raise KeyError(key) + + def __setitem__(self, key, value): + with open(os.path.join(self._path, key), "w") as fd: + fd.write(str(value)) + + def __delitem__(self, key): + os.remove(os.path.join(self._path, key)) + + def __iter__(self): + return iter(os.listdir(self._path)) + + def __len__(self): + return len(os.listdir(self._path)) + + +class DirectoryDictProperty(DirectoryDict): + # Descriptor Protocol + def __get__(self, obj, objtype=None): + if obj is None: + return self.__class__ + return self + + def __set__(self, obj, value): + for name in self.keys(): + del self[name] + if value is not None: + self.update(value) + + def __delete__(self, obj): + raise AttributeError("can't delete attribute") + + +class FileBooleanProperty(object): + def __init__(self, path): + """ + :param path: string or callable + + Usage: + + class Foo(object): + changed = FileBoolean(lambda obj: os.path.join(obj.absolute_path, 'changed')) + other_boolean = FileBoolean('/tmp/other_boolean') + + def __init__(self): + self.absolute_path = '/tmp/foo_boolean' + + """ + self._path = path + + def _get_path(self, *args, **kwargs): + path = self._path + if callable(path): + return path(*args, **kwargs) + if not os.path.isabs(path): + raise AbsolutePathRequiredError(path) + return path + + # Descriptor Protocol + def __get__(self, obj, objtype=None): + if obj is None: + return self.__class__ + path = self._get_path(obj) + return os.path.isfile(path) + + def __set__(self, obj, value): + path = self._get_path(obj) + if value: + open(path, "w").close() + else: + try: + os.remove(path) + except EnvironmentError: + # ignore + pass + + def __delete__(self, obj): + raise AttributeError("can't delete attribute") From 4a3bc7284664c82b03f433ce100f02a1a932833d Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 14:54:35 +0200 Subject: [PATCH 0579/1024] move file based properties out of core Signed-off-by: Steven Armstrong --- lib/cdist/core/property.py | 214 ------------------------------------- 1 file changed, 214 deletions(-) delete mode 100644 lib/cdist/core/property.py diff --git a/lib/cdist/core/property.py b/lib/cdist/core/property.py deleted file mode 100644 index 11dddcf3..00000000 --- a/lib/cdist/core/property.py +++ /dev/null @@ -1,214 +0,0 @@ -# -*- coding: utf-8 -*- -# -# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -import os -import collections - -import cdist - - -class AbsolutePathRequiredError(cdist.Error): - def __init__(self, path): - self.path = path - - def __str__(self): - return 'Absolute path required, got: %s' % self.path - - -class FileList(collections.MutableSequence): - """A list that stores it's state in a file. - - """ - def __init__(self, path, initial=None): - if not os.path.isabs(path): - raise AbsolutePathRequiredError(path) - self._path = path - if initial: - # delete existing file - os.unlink(self._path) - for i in initial: - self.append(i) - - def __read(self): - lines = [] - try: - with open(self._path) as fd: - for line in fd: - lines.append(line.rstrip('\n')) - except EnvironmentError as e: - # error ignored - pass - return lines - - def __write(self, lines): - try: - with open(self._path, 'w') as fd: - for line in lines: - fd.write(str(line) + '\n') - except EnvironmentError as e: - # error ignored - raise - - def __repr__(self): - return repr(list(self)) - - def __getitem__(self, index): - return self.__read()[index] - - def __setitem__(self, index, value): - lines = self.__read() - lines[index] = value - self.__write(lines) - - def __delitem__(self, index): - lines = self.__read() - del lines[index] - self.__write(lines) - - def __len__(self): - lines = self.__read() - return len(lines) - - def insert(self, index, value): - lines = self.__read() - lines.insert(index, value) - self.__write(lines) - - def sort(self): - lines = sorted(self) - self.__write(lines) - - -class FileListProperty(FileList): - # Descriptor Protocol - def __get__(self, obj, objtype=None): - if obj is None: - return self.__class__ - return self - - def __set__(self, obj, value): - os.unlink(self._path) - for item in value: - self.append(item) - - def __delete__(self, obj): - raise AttributeError("can't delete attribute") - - -class DirectoryDict(collections.MutableMapping): - """A dict that stores it's state in a directory. - - """ - def __init__(self, path, dict=None, **kwargs): - if not os.path.isabs(path): - raise AbsolutePathRequiredError(path) - self._path = path - if dict is not None: - self.update(dict) - if len(kwargs): - self.update(kwargs) - - def __repr__(self): - return repr(dict(self)) - - def __getitem__(self, key): - try: - with open(os.path.join(self._path, key), "r") as fd: - return fd.read().rstrip('\n') - except EnvironmentError: - raise KeyError(key) - - def __setitem__(self, key, value): - with open(os.path.join(self._path, key), "w") as fd: - fd.write(str(value)) - - def __delitem__(self, key): - os.remove(os.path.join(self._path, key)) - - def __iter__(self): - return iter(os.listdir(self._path)) - - def __len__(self): - return len(os.listdir(self._path)) - - -class DirectoryDictProperty(DirectoryDict): - # Descriptor Protocol - def __get__(self, obj, objtype=None): - if obj is None: - return self.__class__ - return self - - def __set__(self, obj, value): - for name in self.keys(): - del self[name] - if value is not None: - self.update(value) - - def __delete__(self, obj): - raise AttributeError("can't delete attribute") - - -class FileBooleanProperty(object): - def __init__(self, path): - """ - :param path: string or callable - - Usage: - - class Foo(object): - changed = FileBoolean(lambda obj: os.path.join(obj.absolute_path, 'changed')) - other_boolean = FileBoolean('/tmp/other_boolean') - - def __init__(self): - self.absolute_path = '/tmp/foo_boolean' - - """ - self._path = path - - def _get_path(self, *args, **kwargs): - path = self._path - if callable(path): - return path(*args, **kwargs) - if not os.path.isabs(path): - raise AbsolutePathRequiredError(path) - return path - - # Descriptor Protocol - def __get__(self, obj, objtype=None): - if obj is None: - return self.__class__ - path = self._get_path(obj) - return os.path.isfile(path) - - def __set__(self, obj, value): - path = self._get_path(obj) - if value: - open(path, "w").close() - else: - try: - os.remove(path) - except EnvironmentError: - # ignore - pass - - def __delete__(self, obj): - raise AttributeError("can't delete attribute") From 09632373216f1f29a11e4743954044c90e82df4b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 14:54:50 +0200 Subject: [PATCH 0580/1024] new package cdist.util Signed-off-by: Steven Armstrong --- lib/cdist/util/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lib/cdist/util/__init__.py diff --git a/lib/cdist/util/__init__.py b/lib/cdist/util/__init__.py new file mode 100644 index 00000000..e69de29b From d2b042ab7fbaf15790533d0e74b58676961bd052 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 10 Oct 2011 15:14:48 +0200 Subject: [PATCH 0581/1024] remove parallel arg, always change logoutput Signed-off-by: Nico Schottelius --- bin/cdist | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 61dad1db..50e66697 100755 --- a/bin/cdist +++ b/bin/cdist @@ -122,8 +122,7 @@ def configinstall(args, mode): c = mode(host, initial_manifest=args.manifest, base_path=args.cdist_home, - debug=args.debug, - parallel=True) + debug=args.debug) if args.parallel: log.debug("Creating child process for %s", host) process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) From 9ce31fa84a9995641958b4b6570635289d5ae5f4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 10 Oct 2011 15:37:39 +0200 Subject: [PATCH 0582/1024] simplify test Signed-off-by: Nico Schottelius --- build.sh | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/build.sh b/build.sh index 63c380cf..0464defc 100755 --- a/build.sh +++ b/build.sh @@ -126,25 +126,15 @@ case "$1" in | xargs rm -f ;; - t) + test) shift # skip t + set -x + if [ $# -lt 1 ]; then + set -- cdist.test + fi PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib \ python3 -m unittest "$@" - ;; - - test) - PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib \ - python3 -m cdist.test - ;; - - test-install) - PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib \ - python3 -m unittest cdist.test.test_install - ;; - - test-all) - PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib \ - python3 -m unittest discover lib/cdist/test '*.py' + ;; *) From c81a2925b87d2654d4db7447900959cd8c31c609 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 10 Oct 2011 15:38:38 +0200 Subject: [PATCH 0583/1024] accept exec_path, setup__target_host Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 15 +++++++++++---- lib/cdist/exec.py | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 0da820b2..6191b118 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -38,13 +38,21 @@ CODE_HEADER = "#!/bin/sh -e\n" class ConfigInstall: """Cdist main class to hold arbitrary data""" - def __init__(self, target_host, - initial_manifest=False, base_path=False, debug=False): + def __init__(self, + target_host, + initial_manifest=False, + base_path=False, + exec_path=sys.argv[0], + debug=False): self.target_host = target_host + # FIXME: should this be setup here? + os.environ['__target_host'] = self.target_host self.debug = debug - self.exec_path = sys.argv[0] + + # Required for testing + self.exec_path = exec_path # Base and Temp Base if base_path: @@ -55,7 +63,6 @@ class ConfigInstall: os.pardir, os.pardir)) - # Local input self.cache_path = os.path.join(self.base_path, "cache", self.target_host) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index a9b8d147..63a3dfa3 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -34,7 +34,7 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): if remote_prefix: remote_prefix = os.environ['__remote_exec'].split() - remote_prefix.append(os.environ['target_host']) + remote_prefix.append(os.environ['__target_host']) args[0][:0] = remote_prefix log.debug("Shell exec cmd: %s", args) @@ -65,7 +65,7 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): def run_or_fail(*args, remote_prefix=False, **kargs): if remote_prefix: remote_prefix = os.environ['__remote_exec'].split() - remote_prefix.append(os.environ['target_host']) + remote_prefix.append(os.environ['__target_host']) args[0][:0] = remote_prefix log.debug("Exec: " + " ".join(*args)) From a8fc8678340c8235953d55710c8f21c5803e0a57 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 10 Oct 2011 15:43:36 +0200 Subject: [PATCH 0584/1024] ++test integration Signed-off-by: Nico Schottelius --- lib/cdist/test/__init__.py | 3 --- lib/cdist/test/test_install.py | 12 +++++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/cdist/test/__init__.py b/lib/cdist/test/__init__.py index f614fa05..09429470 100644 --- a/lib/cdist/test/__init__.py +++ b/lib/cdist/test/__init__.py @@ -30,9 +30,6 @@ cdist_commands=["banner", "config", "install"] cdist_exec_path = os.path.abspath( os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../bin/cdist")) -def exec(): - print(cdist_exec_path) - #class UI(unittest.TestCase): # def test_banner(self): # self.assertEqual(subprocess.call([cdist_exec_path, "banner"]), 0) diff --git a/lib/cdist/test/test_install.py b/lib/cdist/test/test_install.py index 9cfae066..d6502b46 100644 --- a/lib/cdist/test/test_install.py +++ b/lib/cdist/test/test_install.py @@ -29,20 +29,22 @@ sys.path.insert(0, os.path.abspath( os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) import cdist.config - -cdist_exec_path = os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin/cdist")) - +import cdist.test class Install(unittest.TestCase): def setUp(self): self.temp_dir = tempfile.mkdtemp() self.init_manifest = os.path.join(self.temp_dir, "manifest") + + os.environ['__remote_exec'] = "ssh -o User=root -q" + os.environ['__remote_copy'] = "scp -o User=root -q" + self.config = cdist.config.Config("localhost", initial_manifest=self.init_manifest, - exec_path=cdist_exec_path) + exec_path=cdist.test.cdist_exec_path) self.config.link_emulator() + ### NEW FOR INSTALL ############################################################ def test_explorer_ran(self): From 915ec6d9adee3fd10eaa035075298d4dda1662e5 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 16:37:56 +0200 Subject: [PATCH 0585/1024] rename property module to fsproperty Signed-off-by: Steven Armstrong --- lib/cdist/util/{property.py => fsproperty.py} | 92 +++++++++++++++---- 1 file changed, 75 insertions(+), 17 deletions(-) rename lib/cdist/util/{property.py => fsproperty.py} (69%) diff --git a/lib/cdist/util/property.py b/lib/cdist/util/fsproperty.py similarity index 69% rename from lib/cdist/util/property.py rename to lib/cdist/util/fsproperty.py index 11dddcf3..1af2f0f5 100644 --- a/lib/cdist/util/property.py +++ b/lib/cdist/util/fsproperty.py @@ -40,17 +40,17 @@ class FileList(collections.MutableSequence): def __init__(self, path, initial=None): if not os.path.isabs(path): raise AbsolutePathRequiredError(path) - self._path = path + self.path = path if initial: # delete existing file - os.unlink(self._path) + os.unlink(self.path) for i in initial: self.append(i) def __read(self): lines = [] try: - with open(self._path) as fd: + with open(self.path) as fd: for line in fd: lines.append(line.rstrip('\n')) except EnvironmentError as e: @@ -60,7 +60,7 @@ class FileList(collections.MutableSequence): def __write(self, lines): try: - with open(self._path, 'w') as fd: + with open(self.path, 'w') as fd: for line in lines: fd.write(str(line) + '\n') except EnvironmentError as e: @@ -98,14 +98,43 @@ class FileList(collections.MutableSequence): class FileListProperty(FileList): + + def __init__(self, path): + """ + :param path: string or callable + + Usage: + + class Foo(object): + parameters = DirectoryDictProperty(lambda obj: os.path.join(obj.absolute_path, 'parameter')) + other_dict = DirectoryDictProperty('/tmp/folder') + + def __init__(self): + self.absolute_path = '/tmp/foo' + + """ + self.path = None + self.__path = path + + def _set_path(self, *args, **kwargs): + if self.path is None: + path = self.__path + if callable(path): + path = path(*args, **kwargs) + if not os.path.isabs(path): + raise AbsolutePathRequiredError(path) + self.path = path + # Descriptor Protocol def __get__(self, obj, objtype=None): if obj is None: return self.__class__ + self._set_path(obj) return self def __set__(self, obj, value): - os.unlink(self._path) + self._set_path(obj) + os.unlink(self.path) for item in value: self.append(item) @@ -117,13 +146,13 @@ class DirectoryDict(collections.MutableMapping): """A dict that stores it's state in a directory. """ - def __init__(self, path, dict=None, **kwargs): + def __init__(self, path, initial=None, **kwargs): if not os.path.isabs(path): raise AbsolutePathRequiredError(path) - self._path = path - if dict is not None: - self.update(dict) - if len(kwargs): + self.path = path + if initial is not None: + self.update(initial) + if kwargs: self.update(kwargs) def __repr__(self): @@ -131,36 +160,65 @@ class DirectoryDict(collections.MutableMapping): def __getitem__(self, key): try: - with open(os.path.join(self._path, key), "r") as fd: + with open(os.path.join(self.path, key), "r") as fd: return fd.read().rstrip('\n') except EnvironmentError: raise KeyError(key) def __setitem__(self, key, value): - with open(os.path.join(self._path, key), "w") as fd: + with open(os.path.join(self.path, key), "w") as fd: fd.write(str(value)) def __delitem__(self, key): - os.remove(os.path.join(self._path, key)) + os.remove(os.path.join(self.path, key)) def __iter__(self): - return iter(os.listdir(self._path)) + return iter(os.listdir(self.path)) def __len__(self): - return len(os.listdir(self._path)) + return len(os.listdir(self.path)) class DirectoryDictProperty(DirectoryDict): + + def __init__(self, path): + """ + :param path: string or callable + + Usage: + + class Foo(object): + parameters = DirectoryDictProperty(lambda obj: os.path.join(obj.absolute_path, 'parameter')) + other_dict = DirectoryDictProperty('/tmp/folder') + + def __init__(self): + self.absolute_path = '/tmp/foo' + + """ + self.path = None + self.__path = path + + def _set_path(self, *args, **kwargs): + if self.path is None: + path = self.__path + if callable(path): + path = path(*args, **kwargs) + if not os.path.isabs(path): + raise AbsolutePathRequiredError(path) + self.path = path + # Descriptor Protocol def __get__(self, obj, objtype=None): if obj is None: return self.__class__ + self._set_path(obj) return self def __set__(self, obj, value): - for name in self.keys(): - del self[name] + self._set_path(obj) if value is not None: + for name in self.keys(): + del self[name] self.update(value) def __delete__(self, obj): From bbcecc03ef035f6b0c18ca59720c0a9b423dc258 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 16:39:48 +0200 Subject: [PATCH 0586/1024] remove redundant code, use new fsproperty module instead Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 105 +++------------------------------------ 1 file changed, 8 insertions(+), 97 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 76e8faa1..2ae5f81b 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -25,14 +25,14 @@ import os import collections import cdist -import cdist.core.property +import cdist.core +from cdist.util import fsproperty log = logging.getLogger(__name__) DOT_CDIST = '.cdist' -# FIXME: i should not have to care about prefix directory, local, remote and such. -# I know what my internals look like, the outside is none of my business. + class Object(object): """Represents a cdist object. @@ -93,97 +93,8 @@ class Object(object): # return relative path return os.path.join(self.path, "explorer") - - ### requirements - @property - def requirements(self): - if not self.__requirements: - self.__requirements = cdist.core.property.FileList(os.path.join(self.absolute_path, "require")) - return self.__requirements - - @requirements.setter - def requirements(self, value): - if isinstance(value, cdist.core.property.FileList): - self.__requirements = value - else: - self.__requirements = cdist.core.property.FileList(os.path.join(self.absolute_path, "require"), value) - ### /requirements - - - ### parameters - @property - def parameters(self): - if not self.__parameters: - self.__parameters = cdist.core.property.DirectoryDict(os.path.join(self.absolute_path, "parameter")) - return self.__parameters - - @parameters.setter - def parameters(self, value): - if isinstance(value, cdist.core.property.DirectoryDict): - self.__parameters = value - else: - self.__parameters = cdist.core.property.DirectoryDict(os.path.join(self.absolute_path, "parameter"), value) - ### /parameters - - - ### changed - @property - def changed(self): - """Check whether the object has been changed.""" - return os.path.isfile(os.path.join(self.absolute_path, "changed")) - - @changed.setter - def changed(self, value): - """Change the objects changed status.""" - path = os.path.join(self.absolute_path, "changed") - if value: - open(path, "w").close() - else: - try: - os.remove(path) - except EnvironmentError: - # ignore - pass - ### /changed - - - ### prepared - @property - def prepared(self): - """Check whether the object has been prepared.""" - return os.path.isfile(os.path.join(self.absolute_path, "prepared")) - - @prepared.setter - def prepared(self, value): - """Change the objects prepared status.""" - path = os.path.join(self.absolute_path, "prepared") - if value: - open(path, "w").close() - else: - try: - os.remove(path) - except EnvironmentError: - # ignore - pass - ### /prepared - - - ### ran - @property - def ran(self): - """Check whether the object has been ran.""" - return os.path.isfile(os.path.join(self.absolute_path, "ran")) - - @ran.setter - def ran(self, value): - """Change the objects ran status.""" - path = os.path.join(self.absolute_path, "ran") - if value: - open(path, "w").close() - else: - try: - os.remove(path) - except EnvironmentError: - # ignore - pass - ### /ran + requirements = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'require')) + parameters = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.absolute_path, 'parameter')) + changed = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "changed")) + prepared = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "prepared")) + ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran")) From af8f006fc682d120924e44ef024a7eee09304f74 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 16:50:56 +0200 Subject: [PATCH 0587/1024] /type/cdist_type/ Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 2ae5f81b..a3baa941 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -63,8 +63,8 @@ class Object(object): if DOT_CDIST in dirs: yield os.path.relpath(path, object_base_path) - def __init__(self, type, base_path, object_id=None): - self.type = type # instance of Type + def __init__(self, cdist_type, base_path, object_id=None): + self.type = cdist_type # instance of Type self.base_path = base_path self.object_id = object_id self.name = os.path.join(self.type.name, self.object_id) From 67543146f0fa15b9ad3149b42e0999b02fef132e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 17:46:25 +0200 Subject: [PATCH 0588/1024] add source property Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index a3baa941..83446ad7 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -98,3 +98,4 @@ class Object(object): changed = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "changed")) prepared = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "prepared")) ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran")) + source = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "source")) From 1015810391298387b54efc4b58b44347db45673e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 10 Oct 2011 18:31:56 +0200 Subject: [PATCH 0589/1024] ++testtodo Signed-off-by: Nico Schottelius --- doc/dev/todo/tests | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/tests b/doc/dev/todo/tests index 8f019fed..6fcd1a04 100644 --- a/doc/dev/todo/tests +++ b/doc/dev/todo/tests @@ -26,3 +26,4 @@ Tests needed: run_type_explorer(): ensure environment is setup correctly + all: check that messages of all functions contain target_host in string From 35bfa2fcdc5d7cf53dbfac796913aa01f6415c44 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 10 Oct 2011 18:50:06 +0200 Subject: [PATCH 0590/1024] finish merge of context and config_install Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 6191b118..f5b33e3f 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -23,6 +23,7 @@ import logging import os import stat +import shutil import sys import tempfile import time @@ -46,8 +47,6 @@ class ConfigInstall: debug=False): self.target_host = target_host - # FIXME: should this be setup here? - os.environ['__target_host'] = self.target_host self.debug = debug @@ -92,12 +91,16 @@ class ConfigInstall: self.remote_base_path = os.environ['__cdist_remote_out_dir'] else: self.remote_base_path = "/var/lib/cdist" + self.remote_conf_path = os.path.join(self.remote_base_path, "conf") self.remote_object_path = os.path.join(self.remote_base_path, "object") self.remote_type_path = os.path.join(self.remote_conf_path, "type") self.remote_global_explorer_path = os.path.join(self.remote_conf_path, "explorer") + # Setup env to be used by others + self.__init_env() + # Create directories self.__init_local_paths() self.__init_remote_paths() @@ -120,6 +123,10 @@ class ConfigInstall: os.mkdir(self.global_explorer_out_path) os.mkdir(self.bin_path) + def __init_env(self): + """Environment usable for other stuff""" + os.environ['__target_host'] = self.target_host + def cleanup(self): # Do not use in __del__: # http://docs.python.org/reference/datamodel.html#customization @@ -274,7 +281,7 @@ class ConfigInstall: self.transfer_object_parameter(cdist_object) for explorer in cdist_type.explorers: - remote_cmd = cmd + [os.path.join(self.remote_base_path, + remote_cmd = cmd + [os.path.join(self.remote_type_path, cdist_type.explorer_path, explorer)] output = os.path.join(self.object_base_path, cdist_object.explorer_path, explorer) @@ -385,6 +392,7 @@ class ConfigInstall: log.debug("Skipping retransfer for explorers of %s", cdist_type) return else: + log.debug("Ensure no retransfer for %s", cdist_type) # Do not retransfer cdist_type.transferred_explorers = True @@ -402,7 +410,6 @@ class ConfigInstall: self.remote_mkdir(dst) self.transfer_path(src, dst) - def remote_mkdir(self, directory): """Create directory on remote side""" cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) From 92d3925b1cb33cc5d4a5cfbb27eac7ee024e94c8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 00:18:32 +0200 Subject: [PATCH 0591/1024] add filter to prepend hostname in config_install Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index f5b33e3f..0835f972 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -53,6 +53,9 @@ class ConfigInstall: # Required for testing self.exec_path = exec_path + # Configure logging + log.addFilter(self) + # Base and Temp Base if base_path: self.base_path = base_path @@ -106,6 +109,7 @@ class ConfigInstall: self.__init_remote_paths() + def __init_remote_paths(self): """Initialise remote directory structure""" self.remove_remote_path(self.remote_base_path) @@ -139,8 +143,13 @@ class ConfigInstall: shutil.rmtree(self.cache_path) shutil.move(self.out_path, self.cache_path) - def logfilter(self): - """Add hostname to logs""" + def filter(self, record): + """Add hostname to logs via logging Filter""" + + record.msg = self.target_host + ": " + record.msg + + return True + def run_initial_manifest(self): """Run the initial manifest""" From 94cca2e5372336c90246669c54bd0d89b822ea81 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 00:28:53 +0200 Subject: [PATCH 0592/1024] prepend hostname in emulator as well Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 1 - lib/cdist/emulator.py | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 0835f972..7c66d449 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -150,7 +150,6 @@ class ConfigInstall: return True - def run_initial_manifest(self): """Run the initial manifest""" log.info("Running initial manifest %s", self.initial_manifest) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 27a3abb1..b037d63d 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -34,6 +34,7 @@ def run(argv): param_path = os.path.join(type_path, "parameter") global_path = os.environ['__global'] object_source = os.environ['__cdist_manifest'] + target_host = os.environ['__target_host'] if '__debug' in os.environ: logging.root.setLevel(logging.DEBUG) @@ -68,7 +69,7 @@ def run(argv): object_id = object_id[1:] # Prefix output by object_self - logformat = '%(levelname)s: ' + cdist_type + '/' + object_id + ': %(message)s' + logformat = '%(levelname)s: ' + target_host + ": " + cdist_type + '/' + object_id + ': %(message)s' logging.basicConfig(format=logformat) # FIXME: verify object id @@ -103,7 +104,7 @@ def run(argv): value = getattr(args, param) if value: file = os.path.join(param_out_dir, param) - log.debug(file + "<-" + param + " = " + value) + log.debug(file + " = " + value) # Already exists, verify all parameter are the same if object_exists: From 72a2543470a98563077afb69587ff1db04680d94 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 00:42:03 +0200 Subject: [PATCH 0593/1024] introduce install support in emulator Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index b037d63d..7141f16d 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -36,10 +36,28 @@ def run(argv): object_source = os.environ['__cdist_manifest'] target_host = os.environ['__target_host'] + # Logsetup - FIXME: add object_fq as soon as setup! + #id = target_host + ": " + cdist_type + '/' + object_id + id = target_host + ": " + # logformat = '%(levelname)s: ' + target_host + ": " + cdist_type + '/' + object_id + ': %(message)s' + logformat = '%(levelname)s: ' + id + ': %(message)s' + logging.basicConfig(format=logformat) + if '__debug' in os.environ: logging.root.setLevel(logging.DEBUG) else: - logging.basicConfig(level=logging.INFO) + logging.root.setLevel(logging.INFO) + + + if '__install' in os.environ: + install = True + else: + install = False + + if install: + if not os.path.isfile(os.path.join(type_path, "install")): + log.debug("Running in install mode, ignoring non install type") + return True parser = argparse.ArgumentParser(add_help=False) @@ -68,9 +86,6 @@ def run(argv): if object_id[0] == '/': object_id = object_id[1:] - # Prefix output by object_self - logformat = '%(levelname)s: ' + target_host + ": " + cdist_type + '/' + object_id + ': %(message)s' - logging.basicConfig(format=logformat) # FIXME: verify object id log.debug(args) @@ -134,11 +149,13 @@ def run(argv): if "require" in os.environ: requirements = os.environ['require'] log.debug(object_id + ":Writing requirements: " + requirements) + # FIXME: handle exception require_fd = open(os.path.join(object_path, "require"), "a") require_fd.write(requirements.replace(" ","\n")) require_fd.close() # Record / Append source + # FIXME: handle exception source_fd = open(os.path.join(object_path, "source"), "a") source_fd.writelines(object_source) source_fd.close() From 425d973dc28c0e3eb8a75f7815feae8399a8977a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 00:46:01 +0200 Subject: [PATCH 0594/1024] ++changes for 2.0.3 Signed-off-by: Nico Schottelius --- doc/changelog | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index 798c90e0..3540498e 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,7 +1,10 @@ 2.0.3: * Improved logging, added --verbose, by more quiet by default * Bugfix __user: Correct quoting (Steven Armstrong) - * FIXME: Support for __remote_exec and __remote_copy + * Bugfix requirements: Restore original require="" behaviour + * Feature: Initial undocumented support for replacing + the remote exec and remote copy commands + * Feature: Initial undocumented support for installations in core 2.0.2: 2011-09-27 * Add support for detection of OpenWall Linux (Matthias Teege) From a1e1c8d66572e2ee289c3c156cea5688a7779b58 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 09:02:01 +0200 Subject: [PATCH 0595/1024] +docstring Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 51 +++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index 1af2f0f5..b855daa4 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -143,7 +143,7 @@ class FileListProperty(FileList): class DirectoryDict(collections.MutableMapping): - """A dict that stores it's state in a directory. + """A dict that stores it's items as files in a directory. """ def __init__(self, path, initial=None, **kwargs): @@ -270,3 +270,52 @@ class FileBooleanProperty(object): def __delete__(self, obj): raise AttributeError("can't delete attribute") + +# FIXME: should have same anchestor as FileList +class FileStringProperty(object): + """A string property which stores its state in a file. + """ + def __init__(self, path): + """ + :param path: string or callable + + Usage: + + class Foo(object): + source = FileStringProperty(lambda obj: os.path.join(obj.absolute_path, 'source')) + other = FileStringProperty('/tmp/other') + + def __init__(self): + self.absolute_path = '/tmp/foo_boolean' + + """ + self._path = path + + def _get_path(self, *args, **kwargs): + path = self._path + if callable(path): + return path(*args, **kwargs) + if not os.path.isabs(path): + raise AbsolutePathRequiredError(path) + return path + + # Descriptor Protocol + def __get__(self, obj, objtype=None): + if obj is None: + return self.__class__ + path = self._get_path(obj) + value = "" + try: + with open(path, "r") as fd: + value = fd.read().rstrip('\n') + except EnvironmentError: + pass + return value + + def __set__(self, obj, value): + path = self._get_path(obj) + with open(path, "w") as fd: + fd.write(str(value)) + + def __delete__(self, obj): + raise AttributeError("can't delete attribute") From 005009ab5da44539e496ba92bf737c790d909221 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 09:38:03 +0200 Subject: [PATCH 0596/1024] finish FileStringProperty Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index b855daa4..c18a1553 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -271,9 +271,9 @@ class FileBooleanProperty(object): def __delete__(self, obj): raise AttributeError("can't delete attribute") -# FIXME: should have same anchestor as FileList + class FileStringProperty(object): - """A string property which stores its state in a file. + """A string property which stores its value in a file. """ def __init__(self, path): """ @@ -307,15 +307,21 @@ class FileStringProperty(object): value = "" try: with open(path, "r") as fd: - value = fd.read().rstrip('\n') + value = fd.read() except EnvironmentError: pass return value def __set__(self, obj, value): path = self._get_path(obj) - with open(path, "w") as fd: - fd.write(str(value)) + if value: + with open(path, "w") as fd: + fd.write(str(value)) + else: + try: + os.unlink(path) + except EnvironmentError: + pass def __delete__(self, obj): - raise AttributeError("can't delete attribute") + raise AttributeError("Can't delete attribute. Set it's value to an empty string to remove the underlying file.") From af83c7af8e936eb32f934b4f6d40a6d228f876fa Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 09:38:31 +0200 Subject: [PATCH 0597/1024] tests for Object source Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 75322654..eee1563c 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -62,6 +62,7 @@ class ObjectTestCase(unittest.TestCase): self.cdist_object.changed = False self.cdist_object.prepared = False self.cdist_object.ran = False + self.cdist_object.source = "" def test_name(self): self.assertEqual(self.cdist_object.name, '__third/moon') @@ -115,3 +116,10 @@ class ObjectTestCase(unittest.TestCase): def test_ran_after_changing(self): self.cdist_object.ran = True self.assertTrue(self.cdist_object.ran) + + def test_source(self): + self.assertEqual(self.cdist_object.source, '') + + def test_source_after_changing(self): + self.cdist_object.source = '/path/to/manifest' + self.assertEqual(self.cdist_object.source, '/path/to/manifest') From 96c059983a93aa50e97a603c238a3866102ab4d7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 10:28:10 +0200 Subject: [PATCH 0598/1024] - legacy code, + docstrings Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 83446ad7..eda7eb40 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -74,9 +74,6 @@ class Object(object): self.code_remote_path = os.path.join(self.path, "code-remote") self.parameter_path = os.path.join(self.path, "parameter") - self.__parameters = None - self.__requirements = None - def __repr__(self): return '' % self.name @@ -86,6 +83,7 @@ class Object(object): @property def explorer_path(self): + """Create and return the relative path to this objects explorers""" # create absolute path path = os.path.join(self.absolute_path, "explorer") if not os.path.isdir(path): From 5a082058e50de2f21776f3a07f15d79c211c10a6 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 10:28:41 +0200 Subject: [PATCH 0599/1024] new method which checks if object exists on the file system Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index eda7eb40..f3099e1d 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -97,3 +97,8 @@ class Object(object): prepared = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "prepared")) ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran")) source = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "source")) + + @property + def exists(self): + """Checks wether this cdist object exists on the file systems.""" + return os.path.exists(self.absolute_path) From 904396f6a5031c06790190a2d46df0ffe1b5af64 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 10:29:06 +0200 Subject: [PATCH 0600/1024] new method to create object on the file system Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index f3099e1d..acef8079 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -102,3 +102,13 @@ class Object(object): def exists(self): """Checks wether this cdist object exists on the file systems.""" return os.path.exists(self.absolute_path) + + def create(self): + """Create this cdist object on the filesystem. + """ + try: + os.makedirs(self.absolute_path, exist_ok=False) + absolute_parameter_path = os.path.join(self.base_path, self.parameter_path) + os.makedirs(absolute_parameter_path, exist_ok=False) + except EnvironmentError as error: + raise cdist.Error('Error creating directories for cdist object: %s: %s' % (self, error)) From 753936b7c3154546ce8b1c9a2374982cf30e6a17 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 10:30:30 +0200 Subject: [PATCH 0601/1024] make object.source a list Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index acef8079..76634a65 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -96,7 +96,7 @@ class Object(object): changed = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "changed")) prepared = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "prepared")) ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran")) - source = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "source")) + source = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, "source")) @property def exists(self): From 6199a255a49b2bdcb89a31d17583a9d88235d8f9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 11:06:10 +0200 Subject: [PATCH 0602/1024] add emulator output Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-11.emulator-output | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/dev/logs/2011-10-11.emulator-output diff --git a/doc/dev/logs/2011-10-11.emulator-output b/doc/dev/logs/2011-10-11.emulator-output new file mode 100644 index 00000000..d1f066c5 --- /dev/null +++ b/doc/dev/logs/2011-10-11.emulator-output @@ -0,0 +1,8 @@ +Debug: +DEBUG: Namespace(name=None, state='installed') +DEBUG: Object output dir = /home/users/nico/.tmp/tmpsdaonx/out/object/__package_pacman/zsh/.cdist +DEBUG: Object param dir = /home/users/nico/.tmp/tmpsdaonx/out/object/__package_pacman/zsh/.cdist/parameter +DEBUG: /home/users/nico/.tmp/tmpsdaonx/out/object/__package_pacman/zsh/.cdist/parameter/state<-state = installed +DEBUG: zsh:Writing requirements: +DEBUG: Finished __package_pacman/zsh{'state': 'installed', 'name': None} + From e72ad1f7cb26fb2970117e31154a27560647ecf9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 12:19:13 +0200 Subject: [PATCH 0603/1024] emulator not needed in config_install anymore Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 7c66d449..2f1adecd 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -30,7 +30,6 @@ import time import cdist.core import cdist.exec -import cdist.emulator log = logging.getLogger(__name__) From bcde8683af9087b589b84d97151f63d7b6a04c91 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 12:27:08 +0200 Subject: [PATCH 0604/1024] rewrite emulator to use Type and Object classes Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 108 +++++++++++++----------------------------- 1 file changed, 33 insertions(+), 75 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 27a3abb1..0a6d57d6 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -24,122 +24,80 @@ import logging import os import cdist +from cdist import core log = logging.getLogger(__name__) def run(argv): """Emulate type commands (i.e. __file and co)""" - cdist_type = os.path.basename(argv[0]) - type_path = os.path.join(os.environ['__cdist_type_base_path'], cdist_type) - param_path = os.path.join(type_path, "parameter") - global_path = os.environ['__global'] - object_source = os.environ['__cdist_manifest'] - if '__debug' in os.environ: logging.root.setLevel(logging.DEBUG) else: logging.basicConfig(level=logging.INFO) + global_path = os.environ['__global'] + object_source = os.environ['__cdist_manifest'] + type_name = os.path.basename(argv[0]) + + object_base_path = os.path.join(global_path, "object") + type_base_path = os.environ['__cdist_type_base_path'] + cdist_type = core.Type(type_base_path, type_name) + parser = argparse.ArgumentParser(add_help=False) - for parameter in cdist.file_to_list(os.path.join(param_path, "optional")): + for parameter in cdist_type.optional_parameters: argument = "--" + parameter parser.add_argument(argument, action='store', required=False) - for parameter in cdist.file_to_list(os.path.join(param_path, "required")): + for parameter in cdist_type.required_parameters: argument = "--" + parameter parser.add_argument(argument, action='store', required=True) # If not singleton support one positional parameter - if not os.path.isfile(os.path.join(type_path, "singleton")): + if not cdist_type.is_singleton: parser.add_argument("object_id", nargs=1) # And finally verify parameter args = parser.parse_args(argv[1:]) # Setup object_id - if os.path.isfile(os.path.join(type_path, "singleton")): + if cdist_type.is_singleton: object_id = "singleton" else: object_id = args.object_id[0] del args.object_id - # FIXME: / hardcoded - better portable solution available? - if object_id[0] == '/': - object_id = object_id[1:] + # strip leading slash from object_id + object_id = object_id.lstrip('/') + + # Instantiate the cdist object whe are defining + cdist_object = core.Object(cdist_type, object_base_path, object_id) # Prefix output by object_self - logformat = '%(levelname)s: ' + cdist_type + '/' + object_id + ': %(message)s' + logformat = '%%(levelname)s: %s: %%(message)s' % cdist_object.path logging.basicConfig(format=logformat) # FIXME: verify object id log.debug(args) - object_path = os.path.join(global_path, "object", cdist_type, - object_id, cdist.DOT_CDIST) - log.debug("Object output dir = " + object_path) - - param_out_dir = os.path.join(object_path, "parameter") - - object_source_file = os.path.join(object_path, "source") - - if os.path.exists(object_path): - object_exists = True - old_object_source_fd = open(object_source_file, "r") - old_object_source = old_object_source_fd.readlines() - old_object_source_fd.close() - + # Create object with given parameters + parameters = vars(args) + if cdist_object.exists: + if cdist_object.parameters != parameters: + raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s" + % (cdist_object, " ".join(cdist_object.source), cdist_object.parameters, object_source, parameters) + ) else: - object_exists = False - try: - os.makedirs(object_path, exist_ok=False) - log.debug("Object param dir = " + param_out_dir) - os.makedirs(param_out_dir, exist_ok=False) - except OSError as error: - raise cdist.Error(param_out_dir + ": " + error.args[1]) - - # Record parameter - params = vars(args) - for param in params: - value = getattr(args, param) - if value: - file = os.path.join(param_out_dir, param) - log.debug(file + "<-" + param + " = " + value) - - # Already exists, verify all parameter are the same - if object_exists: - if not os.path.isfile(file): - raise cdist.Error("New parameter \"" + - param + "\" specified, aborting\n" + - "Source = " + - " ".join(old_object_source) - + " new =" + object_source) - else: - param_fd = open(file, "r") - value_old = param_fd.readlines() - param_fd.close() - - if(value_old[0] != value): - raise cdist.Error("Parameter\"" + param + - "\" differs: " + " ".join(value_old) + " vs. " + - value + - "\nSource = " + " ".join(old_object_source) - + " new = " + object_source) - else: - param_fd = open(file, "w") - param_fd.writelines(value) - param_fd.close() + cdist_object.create() + cdist_object.parameters = parameters # Record requirements if "require" in os.environ: requirements = os.environ['require'] - log.debug(object_id + ":Writing requirements: " + requirements) - require_fd = open(os.path.join(object_path, "require"), "a") - require_fd.write(requirements.replace(" ","\n")) - require_fd.close() + log.debug("%s:Writing requirements: %s" % (cdist_object.path, requirements)) + cdist_object.requirements.extend(requirements.split(" ")) # Record / Append source - source_fd = open(os.path.join(object_path, "source"), "a") - source_fd.writelines(object_source) - source_fd.close() + # FIXME: source should be list + cdist_object.source.append(object_source) - log.debug("Finished " + cdist_type + "/" + object_id + repr(params)) + log.debug("Finished %s %s" % (cdist_object.path, parameters)) From 5443db97c4d7199c04dfac5d15d37345d6caa7f1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 12:54:55 +0200 Subject: [PATCH 0605/1024] always setup __debug if debug is set Signed-off-by: Nico Schottelius --- doc/dev/todo/tests | 44 ++++++++++++++++++++++++++++++++----- lib/cdist/config_install.py | 28 ++++++++++------------- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/doc/dev/todo/tests b/doc/dev/todo/tests index 6fcd1a04..27bca3b6 100644 --- a/doc/dev/todo/tests +++ b/doc/dev/todo/tests @@ -1,11 +1,43 @@ -Tests needed: +Tests needed for config_install: - - Fail if cache_dir from previous run cannot be deleted - - Fail if cache_dir cannot be created from current out_dir - - transfer_type_explorers: Explorers are not transferred twice - - transfer_type_explorers: No transfer tried if there are no type_explorers + __init__(): + - sets up env: __target_host + + cleanup() + - Fail if cache_dir from previous run cannot be deleted + - Fail if cache_dir cannot be created from current out_dir + + filter() + - ensure logformat is changed: target host is prefixed: + LOGLEVEL: target_host: MESSAGE + + run_initial_manifest(): + - parameter is actually used (from __init__) + - ensure changing the manifest actually runs a different manifest + -> give ConfigInstall Constructor different manifest + -> different manifest is executed. + - test all submitted (from core to type manifest) variables: + - ENVIRONMENT + - they are set + - they contain the correct values + + run_type_manifest(): + - test all submitted (from core to type manifest) variables: + - ENVIRONMENT + - they are set + - they contain the correct values + run_manifest(): + - test all submitted variables: + - ENVIRONMENT + - including __debug, if debug + - they are set + - they contain the correct values + - does $require work? + + transfer_type_explorers(): + - Explorers are not transferred twice + - No transfer tried if there are no type_explorers - - does $require work? - $whatever should fail if there is no global explorer directory - emulator may only be called with __ as prefix - fail otherwise! diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 2f1adecd..a286472b 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -49,20 +49,16 @@ class ConfigInstall: self.debug = debug - # Required for testing + # Only required for testing self.exec_path = exec_path # Configure logging log.addFilter(self) # Base and Temp Base - if base_path: - self.base_path = base_path - else: - self.base_path = os.path.abspath( - os.path.join(os.path.dirname(__file__), - os.pardir, - os.pardir)) + self.base_path = (base_path or + self.base_path = os.path.abspath(os.path.join( + os.path.dirname(__file__), os.pardir, os.pardir)) # Local input self.cache_path = os.path.join(self.base_path, "cache", @@ -74,10 +70,8 @@ class ConfigInstall: self.type_base_path = os.path.join(self.conf_path, "type") self.lib_path = os.path.join(self.base_path, "lib") - if initial_manifest: - self.initial_manifest = initial_manifest - else: - self.initial_manifest = os.path.join(self.manifest_path, "init") + self.initial_manifest = (initial_manifest or + os.path.join(self.manifest_path, "init")) # Local output if '__cdist_out_dir' in os.environ: @@ -108,7 +102,6 @@ class ConfigInstall: self.__init_remote_paths() - def __init_remote_paths(self): """Initialise remote directory structure""" self.remove_remote_path(self.remote_base_path) @@ -122,6 +115,7 @@ class ConfigInstall: if not os.path.isdir(self.base_path): os.mkdir(self.base_path) + # FIXME: raise more beautiful exception / Steven: handle exception os.mkdir(self.out_path) os.mkdir(self.global_explorer_out_path) os.mkdir(self.bin_path) @@ -129,6 +123,9 @@ class ConfigInstall: def __init_env(self): """Environment usable for other stuff""" os.environ['__target_host'] = self.target_host + if self.debug: + os.environ['__debug'] = "yes" + def cleanup(self): # Do not use in __del__: @@ -137,6 +134,7 @@ class ConfigInstall: # or in the process of being torn down (e.g. the import machinery shutting down)" # log.debug("Saving " + self.out_path + " to " + self.cache_path) + # FIXME: raise more beautiful exception / Steven: handle exception # Remove previous cache if os.path.exists(self.cache_path): shutil.rmtree(self.cache_path) @@ -182,10 +180,6 @@ class ConfigInstall: env['__target_host'] = self.target_host env['__global'] = self.out_path - # Submit debug flag to manifest, can be used by emulator and types - if self.debug: - env['__debug'] = "yes" - # Required for recording source in emulator env['__cdist_manifest'] = manifest_path From cfd04dc20449445ff16e7c3315a091dcebc00d44 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 13:04:01 +0200 Subject: [PATCH 0606/1024] ++tests needed Signed-off-by: Nico Schottelius --- doc/dev/todo/tests | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/doc/dev/todo/tests b/doc/dev/todo/tests index 27bca3b6..3d17ba34 100644 --- a/doc/dev/todo/tests +++ b/doc/dev/todo/tests @@ -38,20 +38,21 @@ Tests needed for config_install: - Explorers are not transferred twice - No transfer tried if there are no type_explorers - - $whatever should fail if there is no global explorer directory - - emulator may only be called with __ as prefix - fail otherwise! + emulator() + may only be called with __ as prefix - fail otherwise! - - ensure paths returned by object include dot-cdist - - ensure path of explorer of object returns correct path - - config_install: - run_type_manifest() - same tests as for test_initial_manifest_*? - run_manifest() - raise exception if manifest is not existent - object_run(): ensure no object is run twice - object_run(): ensure requirements are taken into account - object_run(): check (from extern?) that all needed variables are setup - object_run(): ensure no code-{local, remote} is created, if gencode is not producing code - object_run(): ensure no code-{local, remote} contains what gencode created + object_run(): + - ensure no object is run twice + - ensure requirements are taken into account? + - and order of run is adjusted + - check (from extern?) that all needed variables are setup + - ensure no code-{local, remote} is created, + if gencode is not producing code + - ensure THAT code-{local, remote} contains what gencode created + - abort if gencode-* fails + - abort if code-* fails + - abort == raise(FooException) + - gencode-*: ensure ENVIRONMENT is setup correctly run_type_explorer(): ensure output is saved to correct path run_type_explorer(): ensure a type with no explorers works @@ -59,3 +60,7 @@ Tests needed for config_install: all: check that messages of all functions contain target_host in string + + config_install: + run_type_manifest() - same tests as for test_initial_manifest_*? + run_manifest() - raise exception if manifest is not existent From 2c5b064b0034a9a4b8aa3be2448adad23f069f78 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 13:06:29 +0200 Subject: [PATCH 0607/1024] ++todo = remove CODE_HEADER in generated code Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index a286472b..fb27b17d 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -229,6 +229,7 @@ class ConfigInstall: outfile_fd = open(outfile, "w") # Need to flush to ensure our write is done before stdout write + # FIXME: code header still needed? outfile_fd.write(CODE_HEADER) outfile_fd.flush() From 9d7468edf6f7e4408fe04a6d33cdd49018c66efb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 13:09:56 +0200 Subject: [PATCH 0608/1024] add old log of trigger work Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-06-25.trigger-graphic | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 doc/dev/logs/2011-06-25.trigger-graphic diff --git a/doc/dev/logs/2011-06-25.trigger-graphic b/doc/dev/logs/2011-06-25.trigger-graphic new file mode 100644 index 00000000..f17220e1 --- /dev/null +++ b/doc/dev/logs/2011-06-25.trigger-graphic @@ -0,0 +1,15 @@ + + + + + + +client -------------------> trigger via ssh ----------> server + ~/.ssh/authorized_keys + -> cdist-deploy-to + +ssh -R + +server -> via cdist-deploy-to -> client + +cdist-mass-deploy -p From cfb74897c44d8f3fc05797f0bdb4d83a237c8015 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 13:47:41 +0200 Subject: [PATCH 0609/1024] write down (almost?) all tests for config_install Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index fb27b17d..418f9fd9 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -192,6 +192,13 @@ class ConfigInstall: cdist.exec.shell_run_or_debug_fail(manifest_path, [manifest_path], env=env) + def object_prepare(self, cdist_object): + """Prepare object: Run type explorer + manifest""" + log.debug("Preparing object: " + cdist_object.name) + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + cdist_object.prepared = True + def object_run(self, cdist_object): """Run gencode and code for an object""" log.debug("Running object %s", cdist_object) @@ -294,7 +301,6 @@ class ConfigInstall: cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=True) output_fd.close() - def link_emulator(self): """Link emulator to types""" src = os.path.abspath(self.exec_path) @@ -302,7 +308,7 @@ class ConfigInstall: dst = os.path.join(self.bin_path, cdist_type.name) log.debug("Linking emulator: %s to %s", src, dst) - # FIXME: handle exception / make it more beautiful + # FIXME: handle exception / make it more beautiful / Steven: raise except :-) os.symlink(src, dst) def run_global_explorers(self): @@ -324,15 +330,6 @@ class ConfigInstall: cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) output_fd.close() - - def stage_run(self): - """The final (and real) step of deployment""" - log.info("Generating and executing code") - for cdist_object in cdist.core.Object.list_objects(self.object_base_path, - self.type_base_path): - log.debug("Run object: %s", cdist_object) - self.object_run(cdist_object) - def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" log.info("Deploying to " + self.target_host) @@ -365,12 +362,17 @@ class ConfigInstall: log.debug("Skipping rerun of object %s", cdist_object) continue else: - log.debug("Preparing object: " + cdist_object.name) - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - cdist_object.prepared = True + self.object_prepare(cdist_object) new_objects_created = True + def stage_run(self): + """The final (and real) step of deployment""" + log.info("Generating and executing code") + for cdist_object in cdist.core.Object.list_objects(self.object_base_path, + self.type_base_path): + log.debug("Run object: %s", cdist_object) + self.object_run(cdist_object) + def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" src = os.path.join(self.object_base_path, From 2c02b174526089260aa84a93ff99fbacb495e1fe Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 13:47:53 +0200 Subject: [PATCH 0610/1024] write down (almost?) all tests for config_install (really) Signed-off-by: Nico Schottelius --- doc/dev/todo/tests | 101 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 87 insertions(+), 14 deletions(-) diff --git a/doc/dev/todo/tests b/doc/dev/todo/tests index 3d17ba34..78a63d08 100644 --- a/doc/dev/todo/tests +++ b/doc/dev/todo/tests @@ -26,6 +26,8 @@ Tests needed for config_install: - ENVIRONMENT - they are set - they contain the correct values + - same tests as for test_initial_manifest_*? + run_manifest(): - test all submitted variables: - ENVIRONMENT @@ -33,13 +35,7 @@ Tests needed for config_install: - they are set - they contain the correct values - does $require work? - - transfer_type_explorers(): - - Explorers are not transferred twice - - No transfer tried if there are no type_explorers - - emulator() - may only be called with __ as prefix - fail otherwise! + - check that exception raised, if manifest is not existent object_run(): - ensure no object is run twice @@ -54,13 +50,90 @@ Tests needed for config_install: - abort == raise(FooException) - gencode-*: ensure ENVIRONMENT is setup correctly - run_type_explorer(): ensure output is saved to correct path - run_type_explorer(): ensure a type with no explorers works - run_type_explorer(): ensure environment is setup correctly + run_type_explorer() + - ensure ALL type explores have been run + - ensure output is saved to correct path + - ensure a type with {0,1,2} explorers works ? + - none, one, multiple + - ensure ENVIRONMENT is setup correctly + - fails if ANY of the given explorer fails + + run_global_explorers(): + - ensure ALL type explores have been run + - ensure output is saved to correct path + - ensure a type with {0,1,2} explorers works ? + - none, one, multiple + - ensure ENVIRONMENT is setup correctly + - fails if ANY of the given explorer fails + + link_emulator(): + - ensure that links to ALL types are created + - ensure that links points to correct executable + - i.e. readlink() works + - AND target of readlink is the correct executable + + stage_run() + - ensure that for every object in + cdist.core.Object.list_objects() is passed into + self.object_run() + - instantiate + overwrite + test + + object_prepare(): + - calls (in this order): + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + cdist_object.prepared = True + - object is prepared after function call - all: check that messages of all functions contain target_host in string + stage_prepare(): + - calls (in this order): + self.link_emulator() + self.run_global_explorers() + self.run_initial_manifest() + + - ensure that all objects are created :-) + - as defined in inital manifest + type manifests + + deploy_to() + - ensure self.stage_prepare() and self.stage_run() are + run. [ORDER] + - instantiate + overwrite + test + + deploy_and_cleanup() + - ensure self.deploy_to() + self.cleanup() are are run + run. [ORDER] + - instantiate + overwrite + test + + transfer_object_parameter() + - check that object parameters are transferred + - paths are setup correctly + - test via mock of remote_mkdir and transfer_path + - ensure self.remote_mkdir, self.transfer_path are run. [ORDER] + - instantiate + overwrite + test + + transfer_global_explorers() + - paths are setup correctly + - test via mock of self.remote_mkdir() and self.transfer_path() + - ensure self.remote_mkdir, self.transfer_path are run. [ORDER] + - instantiate + overwrite + test + + transfer_type_explorers(): + - Explorers are not transferred twice + - paths are setup correctly + - test via mock of self.remote_mkdir() and self.transfer_path() + - Explorers are transferred + - test via mock of self.remote_mkdir() and self.transfer_path() + + remote_mkdir() + - is directory created + + remove_remote_path + - is path removed + + transfer_path + - is src to dst transferred? + +emulator: + may only be called with __ as prefix - fail otherwise! - config_install: - run_type_manifest() - same tests as for test_initial_manifest_*? - run_manifest() - raise exception if manifest is not existent From 442ffb75fa6017d16e07068dda74b286fca49962 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 14:09:47 +0200 Subject: [PATCH 0611/1024] nuke legacy files Signed-off-by: Steven Armstrong --- lib/cdist/core/globalexplorer.py | 66 -------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 lib/cdist/core/globalexplorer.py diff --git a/lib/cdist/core/globalexplorer.py b/lib/cdist/core/globalexplorer.py deleted file mode 100644 index 49052d53..00000000 --- a/lib/cdist/core/globalexplorer.py +++ /dev/null @@ -1,66 +0,0 @@ - # FIXME: Explorer or stays - def global_explorer_output_path(self, explorer): - """Returns path of the output for a global explorer""" - return os.path.join(self.global_explorer_out_dir, explorer) - - # FIXME Stays here / Explorer? - def remote_global_explorer_path(self, explorer): - """Returns path to the remote explorer""" - return os.path.join(REMOTE_GLOBAL_EXPLORER_DIR, explorer) - - # FIXME: stays here - def list_global_explorers(self): - """Return list of available explorers""" - return os.listdir(self.global_explorer_dir) - -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# 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 . -# -# - -import logging -import os -log = logging.getLogger(__name__) - -class Explorer(object): - - def __init__(self, src_dir, dst_dir): - self.src_dir = src_dir - self.dst_dir = dst_dir - - def list_explorers(self): - """Return list of available explorers""" - dir = os.path.join(self.path, "explorer") - if os.path.isdir(dir): - list = os.listdir(dir) - else: - list = [] - - log.debug("Explorers for %s in %s: %s", type, dir, list) - - return list - - def is_install(self): - """Check whether a type is used for installation (if not: for configuration)""" - return os.path.isfile(os.path.join(self.path, "install")) - - def remote_explorer_dir(self): - """Return remote directory that holds the explorers of a type""" - return os.path.join(self.remote_path, "explorer") From c674d4a94cdb520c81163d9ac072f8e631f0a087 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 14:14:12 +0200 Subject: [PATCH 0612/1024] distribute tests Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 56 ++++++++++++++++++++- doc/dev/todo/steven | 60 ++++++++++++++++++++++ doc/dev/todo/tests | 112 ------------------------------------------ 3 files changed, 115 insertions(+), 113 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 9710f4ea..520128cc 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,7 +1,61 @@ 2.0.3: - fix emulator / require -- sanity checks +- sanity checks: implement tests + + stage_run() + - ensure that for every object in + cdist.core.Object.list_objects() is passed into + self.object_run() + - instantiate + overwrite + test + + object_prepare(): + - calls (in this order): + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + cdist_object.prepared = True + - object is prepared after function call + + + stage_prepare(): + - calls (in this order): + self.link_emulator() + self.run_global_explorers() + self.run_initial_manifest() + + - ensure that all objects are created :-) + - as defined in inital manifest + type manifests + + deploy_to() + - ensure self.stage_prepare() and self.stage_run() are + run. [ORDER] + - instantiate + overwrite + test + + deploy_and_cleanup() + - ensure self.deploy_to() + self.cleanup() are are run + run. [ORDER] + - instantiate + overwrite + test + + transfer_object_parameter() + - check that object parameters are transferred + - paths are setup correctly + - test via mock of remote_mkdir and transfer_path + - ensure self.remote_mkdir, self.transfer_path are run. [ORDER] + - instantiate + overwrite + test + + transfer_global_explorers() + - paths are setup correctly + - test via mock of self.remote_mkdir() and self.transfer_path() + - ensure self.remote_mkdir, self.transfer_path are run. [ORDER] + - instantiate + overwrite + test + + transfer_type_explorers(): + - Explorers are not transferred twice + - paths are setup correctly + - test via mock of self.remote_mkdir() and self.transfer_path() + - Explorers are transferred + - test via mock of self.remote_mkdir() and self.transfer_path() + -------------------------------------------------------------------------------- diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index f0c867e1..93c6cab3 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,3 +1,63 @@ +tests: + + __init__(): + - sets up env: __target_host + + run_initial_manifest(): + - parameter is actually used (from __init__) + - ensure changing the manifest actually runs a different manifest + -> give ConfigInstall Constructor different manifest + -> different manifest is executed. + - test all submitted (from core to type manifest) variables: + - ENVIRONMENT + - they are set + - they contain the correct values + + run_type_manifest(): + - test all submitted (from core to type manifest) variables: + - ENVIRONMENT + - they are set + - they contain the correct values + - same tests as for test_initial_manifest_*? + + run_manifest(): + - test all submitted variables: + - ENVIRONMENT + - including __debug, if debug + - they are set + - they contain the correct values + - does $require work? + - check that exception raised, if manifest is not existent + + object_run(): + - ensure no object is run twice + - ensure requirements are taken into account? + - and order of run is adjusted + - check (from extern?) that all needed variables are setup + - ensure no code-{local, remote} is created, + if gencode is not producing code + - ensure THAT code-{local, remote} contains what gencode created + - abort if gencode-* fails + - abort if code-* fails + - abort == raise(FooException) + - gencode-*: ensure ENVIRONMENT is setup correctly + + run_type_explorer() + - ensure ALL type explores have been run + - ensure output is saved to correct path + - ensure a type with {0,1,2} explorers works ? + - none, one, multiple + - ensure ENVIRONMENT is setup correctly + - fails if ANY of the given explorer fails + + run_global_explorers(): + - ensure ALL type explores have been run + - ensure output is saved to correct path + - ensure a type with {0,1,2} explorers works ? + - none, one, multiple + - ensure ENVIRONMENT is setup correctly + - fails if ANY of the given explorer fails + Code fixes needed: - shutil, os.mkdir, etc. everywhere: catch/reraise exceptions correctly diff --git a/doc/dev/todo/tests b/doc/dev/todo/tests index 78a63d08..d2101980 100644 --- a/doc/dev/todo/tests +++ b/doc/dev/todo/tests @@ -1,8 +1,5 @@ Tests needed for config_install: - __init__(): - - sets up env: __target_host - cleanup() - Fail if cache_dir from previous run cannot be deleted - Fail if cache_dir cannot be created from current out_dir @@ -11,120 +8,12 @@ Tests needed for config_install: - ensure logformat is changed: target host is prefixed: LOGLEVEL: target_host: MESSAGE - run_initial_manifest(): - - parameter is actually used (from __init__) - - ensure changing the manifest actually runs a different manifest - -> give ConfigInstall Constructor different manifest - -> different manifest is executed. - - test all submitted (from core to type manifest) variables: - - ENVIRONMENT - - they are set - - they contain the correct values - - run_type_manifest(): - - test all submitted (from core to type manifest) variables: - - ENVIRONMENT - - they are set - - they contain the correct values - - same tests as for test_initial_manifest_*? - - run_manifest(): - - test all submitted variables: - - ENVIRONMENT - - including __debug, if debug - - they are set - - they contain the correct values - - does $require work? - - check that exception raised, if manifest is not existent - - object_run(): - - ensure no object is run twice - - ensure requirements are taken into account? - - and order of run is adjusted - - check (from extern?) that all needed variables are setup - - ensure no code-{local, remote} is created, - if gencode is not producing code - - ensure THAT code-{local, remote} contains what gencode created - - abort if gencode-* fails - - abort if code-* fails - - abort == raise(FooException) - - gencode-*: ensure ENVIRONMENT is setup correctly - - run_type_explorer() - - ensure ALL type explores have been run - - ensure output is saved to correct path - - ensure a type with {0,1,2} explorers works ? - - none, one, multiple - - ensure ENVIRONMENT is setup correctly - - fails if ANY of the given explorer fails - - run_global_explorers(): - - ensure ALL type explores have been run - - ensure output is saved to correct path - - ensure a type with {0,1,2} explorers works ? - - none, one, multiple - - ensure ENVIRONMENT is setup correctly - - fails if ANY of the given explorer fails - link_emulator(): - ensure that links to ALL types are created - ensure that links points to correct executable - i.e. readlink() works - AND target of readlink is the correct executable - stage_run() - - ensure that for every object in - cdist.core.Object.list_objects() is passed into - self.object_run() - - instantiate + overwrite + test - - object_prepare(): - - calls (in this order): - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - cdist_object.prepared = True - - object is prepared after function call - - - stage_prepare(): - - calls (in this order): - self.link_emulator() - self.run_global_explorers() - self.run_initial_manifest() - - - ensure that all objects are created :-) - - as defined in inital manifest + type manifests - - deploy_to() - - ensure self.stage_prepare() and self.stage_run() are - run. [ORDER] - - instantiate + overwrite + test - - deploy_and_cleanup() - - ensure self.deploy_to() + self.cleanup() are are run - run. [ORDER] - - instantiate + overwrite + test - - transfer_object_parameter() - - check that object parameters are transferred - - paths are setup correctly - - test via mock of remote_mkdir and transfer_path - - ensure self.remote_mkdir, self.transfer_path are run. [ORDER] - - instantiate + overwrite + test - - transfer_global_explorers() - - paths are setup correctly - - test via mock of self.remote_mkdir() and self.transfer_path() - - ensure self.remote_mkdir, self.transfer_path are run. [ORDER] - - instantiate + overwrite + test - - transfer_type_explorers(): - - Explorers are not transferred twice - - paths are setup correctly - - test via mock of self.remote_mkdir() and self.transfer_path() - - Explorers are transferred - - test via mock of self.remote_mkdir() and self.transfer_path() - remote_mkdir() - is directory created @@ -136,4 +25,3 @@ Tests needed for config_install: emulator: may only be called with __ as prefix - fail otherwise! - From d7adff4e21b2d5655925603b8123b274dc1ec123 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 14:21:47 +0200 Subject: [PATCH 0613/1024] silently ignore error when deleting nonexistent file Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index c18a1553..68d5edaa 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -134,7 +134,11 @@ class FileListProperty(FileList): def __set__(self, obj, value): self._set_path(obj) - os.unlink(self.path) + try: + os.unlink(self.path) + except EnvironmentError: + # ignored + pass for item in value: self.append(item) From 45ff8f727ffd07418f5cfc646ab177bb8c95cbe8 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 14:22:29 +0200 Subject: [PATCH 0614/1024] tests for Object source as list Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index eee1563c..decf67bf 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -62,7 +62,7 @@ class ObjectTestCase(unittest.TestCase): self.cdist_object.changed = False self.cdist_object.prepared = False self.cdist_object.ran = False - self.cdist_object.source = "" + self.cdist_object.source = [] def test_name(self): self.assertEqual(self.cdist_object.name, '__third/moon') @@ -118,8 +118,8 @@ class ObjectTestCase(unittest.TestCase): self.assertTrue(self.cdist_object.ran) def test_source(self): - self.assertEqual(self.cdist_object.source, '') + self.assertEqual(list(self.cdist_object.source), []) def test_source_after_changing(self): - self.cdist_object.source = '/path/to/manifest' - self.assertEqual(self.cdist_object.source, '/path/to/manifest') + self.cdist_object.source = ['/path/to/manifest'] + self.assertEqual(list(self.cdist_object.source), ['/path/to/manifest']) From 539347184118f357b801272a657e08d0791271ef Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 15:25:29 +0200 Subject: [PATCH 0615/1024] add template for new explorer type Signed-off-by: Nico Schottelius --- lib/cdist/explorer.py | 460 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 460 insertions(+) create mode 100644 lib/cdist/explorer.py diff --git a/lib/cdist/explorer.py b/lib/cdist/explorer.py new file mode 100644 index 00000000..3cd1b949 --- /dev/null +++ b/lib/cdist/explorer.py @@ -0,0 +1,460 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import logging +import os +import stat +import shutil +import sys +import tempfile +import time + +import cdist.core +import cdist.exec + +log = logging.getLogger(__name__) + +CODE_HEADER = "#!/bin/sh -e\n" + +class ConfigInstall: + """Cdist main class to hold arbitrary data""" + + def __init__(self, + target_host, + initial_manifest=False, + base_path=False, + exec_path=sys.argv[0], + debug=False): + + self.target_host = target_host + + self.debug = debug + + # Only required for testing + self.exec_path = exec_path + + # Configure logging + log.addFilter(self) + + # Base and Temp Base + self.base_path = (base_path or + self.base_path = os.path.abspath(os.path.join( + os.path.dirname(__file__), os.pardir, os.pardir)) + + # Local input + self.cache_path = os.path.join(self.base_path, "cache", + self.target_host) + 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_base_path = os.path.join(self.conf_path, "type") + self.lib_path = os.path.join(self.base_path, "lib") + + self.initial_manifest = (initial_manifest or + os.path.join(self.manifest_path, "init")) + + # Local output + if '__cdist_out_dir' in os.environ: + self.out_path = os.environ['__cdist_out_dir'] + else: + self.out_path = os.path.join(tempfile.mkdtemp(), "out") + self.bin_path = os.path.join(self.out_path, "bin") + self.global_explorer_out_path = os.path.join(self.out_path, "explorer") + self.object_base_path = os.path.join(self.out_path, "object") + + # Remote directory base + if '__cdist_remote_out_dir' in os.environ: + self.remote_base_path = os.environ['__cdist_remote_out_dir'] + else: + self.remote_base_path = "/var/lib/cdist" + + self.remote_conf_path = os.path.join(self.remote_base_path, "conf") + self.remote_object_path = os.path.join(self.remote_base_path, "object") + + self.remote_type_path = os.path.join(self.remote_conf_path, "type") + self.remote_global_explorer_path = os.path.join(self.remote_conf_path, "explorer") + + # Setup env to be used by others + self.__init_env() + + # Create directories + self.__init_local_paths() + self.__init_remote_paths() + + + def __init_remote_paths(self): + """Initialise remote directory structure""" + self.remove_remote_path(self.remote_base_path) + self.remote_mkdir(self.remote_base_path) + self.remote_mkdir(self.remote_conf_path) + + def __init_local_paths(self): + """Initialise local directory structure""" + + # Create base dir, if user supplied and not existing + if not os.path.isdir(self.base_path): + os.mkdir(self.base_path) + + # FIXME: raise more beautiful exception / Steven: handle exception + os.mkdir(self.out_path) + os.mkdir(self.global_explorer_out_path) + os.mkdir(self.bin_path) + + def __init_env(self): + """Environment usable for other stuff""" + os.environ['__target_host'] = self.target_host + if self.debug: + os.environ['__debug'] = "yes" + + + def cleanup(self): + # Do not use in __del__: + # http://docs.python.org/reference/datamodel.html#customization + # "other globals referenced by the __del__() method may already have been deleted + # or in the process of being torn down (e.g. the import machinery shutting down)" + # + log.debug("Saving " + self.out_path + " to " + self.cache_path) + # FIXME: raise more beautiful exception / Steven: handle exception + # Remove previous cache + if os.path.exists(self.cache_path): + shutil.rmtree(self.cache_path) + shutil.move(self.out_path, self.cache_path) + + def filter(self, record): + """Add hostname to logs via logging Filter""" + + record.msg = self.target_host + ": " + record.msg + + return True + + def run_initial_manifest(self): + """Run the initial manifest""" + log.info("Running initial manifest %s", self.initial_manifest) + env = { "__manifest" : self.manifest_path } + self.run_manifest(self.initial_manifest, extra_env=env) + + def run_type_manifest(self, cdist_object): + """Run manifest for a specific object""" + cdist_type = cdist_object.type + manifest_path = os.path.join(self.type_base_path, + cdist_type.manifest_path) + + log.debug("%s: Running %s", cdist_object.name, manifest_path) + if os.path.exists(manifest_path): + env = { "__object" : os.path.join(self.object_base_path, + cdist_object.path), + "__object_id": cdist_object.object_id, + "__object_fq": cdist_object.name, + "__type": os.path.join(self.type_base_path, + cdist_type.path) + } + self.run_manifest(manifest_path, extra_env=env) + + def run_manifest(self, manifest_path, extra_env=None): + """Run a manifest""" + log.debug("Running manifest %s, env=%s", manifest_path, extra_env) + env = os.environ.copy() + env['PATH'] = self.bin_path + ":" + env['PATH'] + + # Information required in every manifest + env['__target_host'] = self.target_host + env['__global'] = self.out_path + + # Required for recording source in emulator + env['__cdist_manifest'] = manifest_path + + # Required to find types in emulator + env['__cdist_type_base_path'] = self.type_base_path + + # Other environment stuff + if extra_env: + env.update(extra_env) + + cdist.exec.shell_run_or_debug_fail(manifest_path, [manifest_path], env=env) + + def object_prepare(self, cdist_object): + """Prepare object: Run type explorer + manifest""" + log.debug("Preparing object: " + cdist_object.name) + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + cdist_object.prepared = True + + def object_run(self, cdist_object): + """Run gencode and code for an object""" + log.debug("Running object %s", cdist_object) + + # Catch requirements, which re-call us + if cdist_object.ran: + return + + cdist_type = cdist_object.type + + for requirement in cdist_object.requirements: + log.debug("Object %s requires %s", cdist_object, requirement) + self.object_run(requirement) + + # + # Setup env Variable: + # + env = os.environ.copy() + env['__target_host'] = self.target_host + env['__global'] = self.out_path + env["__object"] = os.path.join(self.object_base_path, cdist_object.path) + env["__object_id"] = cdist_object.object_id + env["__object_fq"] = cdist_object.name + env["__type"] = cdist_type.name + + # gencode + for cmd in ["local", "remote"]: + bin = os.path.join(self.type_base_path, + getattr(cdist_type, "gencode_" + cmd + "_path")) + + if os.path.isfile(bin): + outfile = os.path.join(self.object_base_path, + getattr(cdist_object, "code_" + cmd + "_path")) + + outfile_fd = open(outfile, "w") + + # Need to flush to ensure our write is done before stdout write + # FIXME: code header still needed? + outfile_fd.write(CODE_HEADER) + outfile_fd.flush() + + cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) + outfile_fd.close() + + status = os.stat(outfile) + + # Remove output if empty, else make it executable + if status.st_size == len(CODE_HEADER): + os.unlink(outfile) + else: + # Add header and make executable - identically to 0o700 + os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + cdist_object.changed=True + + # code local + code_local = cdist_object.code_local_path + if os.path.isfile(code_local): + cdist.exec.run_or_fail([code_local]) + + # code remote + local_remote_code = os.path.join(self.object_base_path, + cdist_object.code_remote_path) + remote_remote_code = os.path.join(self.remote_object_path, + cdist_object.code_remote_path) + if os.path.isfile(local_remote_code): + self.transfer_path(local_remote_code, remote_remote_code) + cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) + + cdist_object.ran = True + + def run_type_explorer(self, cdist_object): + + def run_type_explorer(self, cdist_object, remote_global_explorer_path, remote_type_path, remote_object_path, scp-hints, ssh-hints, object_base_path): + + def __init__(self, remote_global_explorer_path, remote_type_path, remote_object_path, exec-hint, object_base_path, global_explorer_out_path): + + def __init__(self, remote_global_explorer_path, remote_type_path, remote_object_path, exec-hint): + + def run_type_explorer(self, cdist_object) + + self.value = .,.. + return value + + def run_global_explorer(self) + + def __init__(self, remote_global_explorer_path, remote_type_path, remote_object_path, exec-hint): + == 1x + + + + + run_type_explorer() + self.instance.value[obej + + c = ConfigInstall("foo") + c.remote_global_explorer_path = "moo" + + def run_type_explorer(self, cdist_object) + """Run type specific explorers for objects""" + + cdist_type = cdist_object.type + self.transfer_type_explorers(cdist_type) + + cmd = [] + cmd.append("__explorer=" + self.remote_global_explorer_path) + cmd.append("__type_explorer=" + os.path.join( + self.remote_type_path, + cdist_type.explorer_path)) + cmd.append("__object=" + os.path.join( + self.remote_object_path, + cdist_object.path)) + cmd.append("__object_id=" + cdist_object.object_id) + cmd.append("__object_fq=" + cdist_object.name) + + # Need to transfer at least the parameters for objects to be useful + self.transfer_object_parameter(cdist_object) + + for explorer in cdist_type.explorers: + remote_cmd = cmd + [os.path.join(self.remote_type_path, + cdist_type.explorer_path, explorer)] + output = os.path.join(self.object_base_path, + cdist_object.explorer_path, explorer) + output_fd = open(output, mode='w') + log.debug("%s exploring %s using %s storing to %s", + cdist_object, explorer, remote_cmd, output) + + cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=True) + output_fd.close() + + return outputs + + def link_emulator(self): + """Link emulator to types""" + src = os.path.abspath(self.exec_path) + for cdist_type in cdist.core.Type.list_types(self.type_base_path): + dst = os.path.join(self.bin_path, cdist_type.name) + log.debug("Linking emulator: %s to %s", src, dst) + + # FIXME: handle exception / make it more beautiful / Steven: raise except :-) + os.symlink(src, dst) + + def run_global_explorers(src_path, dst_path, remote_dst_path): + + def run_global_explorers(self): + """Run global explorers""" + log.info("Running global explorers") + + src_path = self.global_explorer_path + dst_path = self.global_explorer_out_path + remote_dst_path = self.remote_global_explorer_path + + self.transfer_path(src_path, remote_dst_path) + + for explorer in os.listdir(src_path): + output_fd = open(os.path.join(dst_path, explorer), mode='w') + cmd = [] + cmd.append("__explorer=" + remote_dst_path) + cmd.append(os.path.join(remote_dst_path, explorer)) + + cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) + output_fd.close() + + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + log.info("Deploying to " + self.target_host) + self.stage_prepare() + self.stage_run() + + def deploy_and_cleanup(self): + """Do what is most often done: deploy & cleanup""" + start_time = time.time() + self.deploy_to() + self.cleanup() + log.info("Finished run of %s in %s seconds", + self.target_host, time.time() - start_time) + + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" + self.link_emulator() + self.run_global_explorers() + self.run_initial_manifest() + + log.info("Running object manifests and type explorers") + + # Continue process until no new objects are created anymore + new_objects_created = True + while new_objects_created: + new_objects_created = False + for cdist_object in cdist.core.Object.list_objects(self.object_base_path, + self.type_base_path): + if cdist_object.prepared: + log.debug("Skipping rerun of object %s", cdist_object) + continue + else: + self.object_prepare(cdist_object) + new_objects_created = True + + def stage_run(self): + """The final (and real) step of deployment""" + log.info("Generating and executing code") + for cdist_object in cdist.core.Object.list_objects(self.object_base_path, + self.type_base_path): + log.debug("Run object: %s", cdist_object) + self.object_run(cdist_object) + + def transfer_object_parameter(self, cdist_object): + """Transfer the object parameter to the remote destination""" + src = os.path.join(self.object_base_path, + cdist_object.parameter_path) + dst = os.path.join(self.remote_object_path, + cdist_object.parameter_path) + + # Synchronise parameter dir afterwards + self.remote_mkdir(dst) + self.transfer_path(src, dst) + + def transfer_global_explorers(self): + """Transfer the global explorers""" + self.remote_mkdir(self.remote_global_explorer_path) + self.transfer_path(self.global_explorer_path, + self.remote_global_explorer_path) + + def transfer_type_explorers(self, cdist_type): + """Transfer explorers of a type, but only once""" + if cdist_type.transferred_explorers: + log.debug("Skipping retransfer for explorers of %s", cdist_type) + return + else: + log.debug("Ensure no retransfer for %s", cdist_type) + # Do not retransfer + cdist_type.transferred_explorers = True + + explorers = cdist_type.explorers + + if len(explorers) > 0: + rel_path = cdist_type.explorer_path + src = os.path.join(self.type_base_path, rel_path) + dst = os.path.join(self.remote_type_path, rel_path) + + # Ensure full path until type exists: + # /var/lib/cdist/conf/type/__directory/explorer + # /var/lib/cdist/conf/type/__directory may not exist, + # but remote_mkdir uses -p to fix this + self.remote_mkdir(dst) + self.transfer_path(src, dst) + + def remote_mkdir(self, directory): + """Create directory on remote side""" + cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) + + def remove_remote_path(self, destination): + """Ensure path on remote side vanished""" + cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) + + def transfer_path(self, source, destination): + """Transfer directory and previously delete the remote destination""" + self.remove_remote_path(destination) + cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + + ["-r", source, self.target_host + ":" + destination]) From 2c6c9bcab5d9f80be60ffd43357a86e79385d9e3 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 15:44:31 +0200 Subject: [PATCH 0616/1024] Object handles its explorers itself Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 76634a65..b7890eeb 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -81,6 +81,7 @@ class Object(object): """define equality as 'attributes are the same'""" return self.__dict__ == other.__dict__ + # FIXME: still needed? @property def explorer_path(self): """Create and return the relative path to this objects explorers""" @@ -93,6 +94,7 @@ class Object(object): requirements = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'require')) parameters = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.absolute_path, 'parameter')) + explorers = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.explorer_path)) changed = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "changed")) prepared = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "prepared")) ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran")) From d03f23129b0970719c91cb0366e64a9056b054c7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 15:45:10 +0200 Subject: [PATCH 0617/1024] test and fixtures for Object explorers Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 13 +++++++++++++ .../object/__third/moon/.cdist/explorer/.keep | 0 2 files changed, 13 insertions(+) delete mode 100644 lib/cdist/test/object/fixtures/object/__third/moon/.cdist/explorer/.keep diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index decf67bf..6f26fd19 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -92,6 +92,19 @@ class ObjectTestCase(unittest.TestCase): expected_parameters = {'planet': 'Saturn', 'name': 'Prometheus'} self.assertEqual(self.cdist_object.parameters, expected_parameters) + def test_explorers(self): + self.assertEqual(self.cdist_object.explorers, {}) + + def test_explorers_after_changing(self): + expected = {'first': 'foo', 'second': 'bar'} + # when set, written to file + self.cdist_object.explorers = expected + # when accessed, read from file + self.assertEqual(self.cdist_object.explorers, expected) + # remove dynamically created folder + self.cdist_object.explorers = {} + os.rmdir(os.path.join(self.cdist_object.base_path, self.cdist_object.explorer_path)) + def test_requirements(self): expected = [] self.assertEqual(list(self.cdist_object.requirements), expected) diff --git a/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/explorer/.keep b/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/explorer/.keep deleted file mode 100644 index e69de29b..00000000 From d9d9e6bff6660602b034ea1eba230056ef90c60b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 15:47:32 +0200 Subject: [PATCH 0618/1024] move back transfer stuff to exec Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 45 +++++++++++++++++++++++++------------ lib/cdist/exec.py | 20 +++++++++++++++++ 2 files changed, 51 insertions(+), 14 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 418f9fd9..7214cdba 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -270,6 +270,33 @@ class ConfigInstall: cdist_object.ran = True def run_type_explorer(self, cdist_object): + + def run_type_explorer(self, cdist_object, remote_global_explorer_path, remote_type_path, remote_object_path, scp-hints, ssh-hints, object_base_path): + + def __init__(self, remote_global_explorer_path, remote_type_path, remote_object_path, exec-hint, object_base_path, global_explorer_out_path): + + def __init__(self, remote_global_explorer_path, remote_type_path, remote_object_path, exec-hint): + + def run_type_explorer(self, cdist_object) + + self.value = .,.. + return value + + def run_global_explorer(self) + + def __init__(self, remote_global_explorer_path, remote_type_path, remote_object_path, exec-hint): + == 1x + + + + + run_type_explorer() + self.instance.value[obej + + c = ConfigInstall("foo") + c.remote_global_explorer_path = "moo" + + def run_type_explorer(self, cdist_object) """Run type specific explorers for objects""" cdist_type = cdist_object.type @@ -301,6 +328,8 @@ class ConfigInstall: cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=True) output_fd.close() + return outputs + def link_emulator(self): """Link emulator to types""" src = os.path.abspath(self.exec_path) @@ -311,6 +340,8 @@ class ConfigInstall: # FIXME: handle exception / make it more beautiful / Steven: raise except :-) os.symlink(src, dst) + def run_global_explorers(src_path, dst_path, remote_dst_path): + def run_global_explorers(self): """Run global explorers""" log.info("Running global explorers") @@ -413,17 +444,3 @@ class ConfigInstall: # but remote_mkdir uses -p to fix this self.remote_mkdir(dst) self.transfer_path(src, dst) - - def remote_mkdir(self, directory): - """Create directory on remote side""" - cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) - - def remove_remote_path(self, destination): - """Ensure path on remote side vanished""" - cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) - - def transfer_path(self, source, destination): - """Transfer directory and previously delete the remote destination""" - self.remove_remote_path(destination) - cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + - ["-r", source, self.target_host + ":" + destination]) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index 63a3dfa3..7ec9bc0a 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -27,6 +27,10 @@ log = logging.getLogger(__name__) import cdist +class ExecWrapper(object): + def __init__(self, remote_exec, remote_copy, target_host): + self.remote_exec = remote_exec + def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): # Manually execute /bin/sh, because sh -e does what we want # and sh -c -e does not exit if /bin/false called @@ -75,3 +79,19 @@ def run_or_fail(*args, remote_prefix=False, **kargs): raise cdist.Error("Command failed: " + " ".join(*args)) except OSError as error: raise cdist.Error(" ".join(*args) + ": " + error.args[1]) + + + + def remote_mkdir(self, directory): + """Create directory on remote side""" + cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) + + def remove_remote_path(self, destination): + """Ensure path on remote side vanished""" + cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) + + def transfer_path(self, source, destination): + """Transfer directory and previously delete the remote destination""" + self.remove_remote_path(destination) + cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + + ["-r", source, self.target_host + ":" + destination]) From 8a327b6bc73fcdb303f6f40a1afc1a9d1888fa4a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 15:50:50 +0200 Subject: [PATCH 0619/1024] cleanup explorer Signed-off-by: Nico Schottelius --- lib/cdist/explorer.py | 368 ++++-------------------------------------- 1 file changed, 32 insertions(+), 336 deletions(-) diff --git a/lib/cdist/explorer.py b/lib/cdist/explorer.py index 3cd1b949..e2c41f8a 100644 --- a/lib/cdist/explorer.py +++ b/lib/cdist/explorer.py @@ -20,281 +20,36 @@ # # +import io import logging -import os -import stat -import shutil -import sys -import tempfile -import time - -import cdist.core -import cdist.exec +#import os +#import stat +#import shutil +#import sys +#import tempfile +#import time +# +#import cdist.core +#import cdist.exec log = logging.getLogger(__name__) -CODE_HEADER = "#!/bin/sh -e\n" +class Explorer: + """Execute explorers""" -class ConfigInstall: - """Cdist main class to hold arbitrary data""" + def __init__(self, + object_base_path, + remote_global_explorer_path, + remote_type_path, + remote_object_path, + type_path, + exec_hint): - def __init__(self, - target_host, - initial_manifest=False, - base_path=False, - exec_path=sys.argv[0], - debug=False): - - self.target_host = target_host - - self.debug = debug - - # Only required for testing - self.exec_path = exec_path - - # Configure logging - log.addFilter(self) - - # Base and Temp Base - self.base_path = (base_path or - self.base_path = os.path.abspath(os.path.join( - os.path.dirname(__file__), os.pardir, os.pardir)) - - # Local input - self.cache_path = os.path.join(self.base_path, "cache", - self.target_host) - 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_base_path = os.path.join(self.conf_path, "type") - self.lib_path = os.path.join(self.base_path, "lib") - - self.initial_manifest = (initial_manifest or - os.path.join(self.manifest_path, "init")) - - # Local output - if '__cdist_out_dir' in os.environ: - self.out_path = os.environ['__cdist_out_dir'] - else: - self.out_path = os.path.join(tempfile.mkdtemp(), "out") - self.bin_path = os.path.join(self.out_path, "bin") - self.global_explorer_out_path = os.path.join(self.out_path, "explorer") - self.object_base_path = os.path.join(self.out_path, "object") - - # Remote directory base - if '__cdist_remote_out_dir' in os.environ: - self.remote_base_path = os.environ['__cdist_remote_out_dir'] - else: - self.remote_base_path = "/var/lib/cdist" - - self.remote_conf_path = os.path.join(self.remote_base_path, "conf") - self.remote_object_path = os.path.join(self.remote_base_path, "object") - - self.remote_type_path = os.path.join(self.remote_conf_path, "type") - self.remote_global_explorer_path = os.path.join(self.remote_conf_path, "explorer") - - # Setup env to be used by others - self.__init_env() - - # Create directories - self.__init_local_paths() - self.__init_remote_paths() - - - def __init_remote_paths(self): - """Initialise remote directory structure""" - self.remove_remote_path(self.remote_base_path) - self.remote_mkdir(self.remote_base_path) - self.remote_mkdir(self.remote_conf_path) - - def __init_local_paths(self): - """Initialise local directory structure""" - - # Create base dir, if user supplied and not existing - if not os.path.isdir(self.base_path): - os.mkdir(self.base_path) - - # FIXME: raise more beautiful exception / Steven: handle exception - os.mkdir(self.out_path) - os.mkdir(self.global_explorer_out_path) - os.mkdir(self.bin_path) - - def __init_env(self): - """Environment usable for other stuff""" - os.environ['__target_host'] = self.target_host - if self.debug: - os.environ['__debug'] = "yes" - - - def cleanup(self): - # Do not use in __del__: - # http://docs.python.org/reference/datamodel.html#customization - # "other globals referenced by the __del__() method may already have been deleted - # or in the process of being torn down (e.g. the import machinery shutting down)" - # - log.debug("Saving " + self.out_path + " to " + self.cache_path) - # FIXME: raise more beautiful exception / Steven: handle exception - # Remove previous cache - if os.path.exists(self.cache_path): - shutil.rmtree(self.cache_path) - shutil.move(self.out_path, self.cache_path) - - def filter(self, record): - """Add hostname to logs via logging Filter""" - - record.msg = self.target_host + ": " + record.msg - - return True - - def run_initial_manifest(self): - """Run the initial manifest""" - log.info("Running initial manifest %s", self.initial_manifest) - env = { "__manifest" : self.manifest_path } - self.run_manifest(self.initial_manifest, extra_env=env) - - def run_type_manifest(self, cdist_object): - """Run manifest for a specific object""" - cdist_type = cdist_object.type - manifest_path = os.path.join(self.type_base_path, - cdist_type.manifest_path) - - log.debug("%s: Running %s", cdist_object.name, manifest_path) - if os.path.exists(manifest_path): - env = { "__object" : os.path.join(self.object_base_path, - cdist_object.path), - "__object_id": cdist_object.object_id, - "__object_fq": cdist_object.name, - "__type": os.path.join(self.type_base_path, - cdist_type.path) - } - self.run_manifest(manifest_path, extra_env=env) - - def run_manifest(self, manifest_path, extra_env=None): - """Run a manifest""" - log.debug("Running manifest %s, env=%s", manifest_path, extra_env) - env = os.environ.copy() - env['PATH'] = self.bin_path + ":" + env['PATH'] - - # Information required in every manifest - env['__target_host'] = self.target_host - env['__global'] = self.out_path - - # Required for recording source in emulator - env['__cdist_manifest'] = manifest_path - - # Required to find types in emulator - env['__cdist_type_base_path'] = self.type_base_path - - # Other environment stuff - if extra_env: - env.update(extra_env) - - cdist.exec.shell_run_or_debug_fail(manifest_path, [manifest_path], env=env) - - def object_prepare(self, cdist_object): - """Prepare object: Run type explorer + manifest""" - log.debug("Preparing object: " + cdist_object.name) - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - cdist_object.prepared = True - - def object_run(self, cdist_object): - """Run gencode and code for an object""" - log.debug("Running object %s", cdist_object) - - # Catch requirements, which re-call us - if cdist_object.ran: - return - - cdist_type = cdist_object.type - - for requirement in cdist_object.requirements: - log.debug("Object %s requires %s", cdist_object, requirement) - self.object_run(requirement) - - # - # Setup env Variable: - # - env = os.environ.copy() - env['__target_host'] = self.target_host - env['__global'] = self.out_path - env["__object"] = os.path.join(self.object_base_path, cdist_object.path) - env["__object_id"] = cdist_object.object_id - env["__object_fq"] = cdist_object.name - env["__type"] = cdist_type.name - - # gencode - for cmd in ["local", "remote"]: - bin = os.path.join(self.type_base_path, - getattr(cdist_type, "gencode_" + cmd + "_path")) - - if os.path.isfile(bin): - outfile = os.path.join(self.object_base_path, - getattr(cdist_object, "code_" + cmd + "_path")) - - outfile_fd = open(outfile, "w") - - # Need to flush to ensure our write is done before stdout write - # FIXME: code header still needed? - outfile_fd.write(CODE_HEADER) - outfile_fd.flush() - - cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) - outfile_fd.close() - - status = os.stat(outfile) - - # Remove output if empty, else make it executable - if status.st_size == len(CODE_HEADER): - os.unlink(outfile) - else: - # Add header and make executable - identically to 0o700 - os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) - cdist_object.changed=True - - # code local - code_local = cdist_object.code_local_path - if os.path.isfile(code_local): - cdist.exec.run_or_fail([code_local]) - - # code remote - local_remote_code = os.path.join(self.object_base_path, - cdist_object.code_remote_path) - remote_remote_code = os.path.join(self.remote_object_path, - cdist_object.code_remote_path) - if os.path.isfile(local_remote_code): - self.transfer_path(local_remote_code, remote_remote_code) - cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) - - cdist_object.ran = True - - def run_type_explorer(self, cdist_object): - - def run_type_explorer(self, cdist_object, remote_global_explorer_path, remote_type_path, remote_object_path, scp-hints, ssh-hints, object_base_path): - - def __init__(self, remote_global_explorer_path, remote_type_path, remote_object_path, exec-hint, object_base_path, global_explorer_out_path): - - def __init__(self, remote_global_explorer_path, remote_type_path, remote_object_path, exec-hint): - - def run_type_explorer(self, cdist_object) - - self.value = .,.. - return value - - def run_global_explorer(self) - - def __init__(self, remote_global_explorer_path, remote_type_path, remote_object_path, exec-hint): - == 1x - - - - - run_type_explorer() - self.instance.value[obej - - c = ConfigInstall("foo") - c.remote_global_explorer_path = "moo" + self.object_base_path = object_base_path + self.remote_global_explorer_path = remote_global_explorer_path + self.remote_type_path = remote_type_path + self.remote_object_path = remote_object_path + self.exec_hint = exec_hint def run_type_explorer(self, cdist_object) """Run type specific explorers for objects""" @@ -316,93 +71,34 @@ class ConfigInstall: # Need to transfer at least the parameters for objects to be useful self.transfer_object_parameter(cdist_object) + outputs = {} for explorer in cdist_type.explorers: remote_cmd = cmd + [os.path.join(self.remote_type_path, cdist_type.explorer_path, explorer)] - output = os.path.join(self.object_base_path, - cdist_object.explorer_path, explorer) - output_fd = open(output, mode='w') + outputs[explorer] = io.StringIO() log.debug("%s exploring %s using %s storing to %s", cdist_object, explorer, remote_cmd, output) - cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=True) - output_fd.close() + cdist.exec.run_or_fail(remote_cmd, stdout=outputs[explorer], remote_prefix=True) return outputs - def link_emulator(self): - """Link emulator to types""" - src = os.path.abspath(self.exec_path) - for cdist_type in cdist.core.Type.list_types(self.type_base_path): - dst = os.path.join(self.bin_path, cdist_type.name) - log.debug("Linking emulator: %s to %s", src, dst) - - # FIXME: handle exception / make it more beautiful / Steven: raise except :-) - os.symlink(src, dst) - - def run_global_explorers(src_path, dst_path, remote_dst_path): - def run_global_explorers(self): """Run global explorers""" log.info("Running global explorers") src_path = self.global_explorer_path - dst_path = self.global_explorer_out_path - remote_dst_path = self.remote_global_explorer_path + dst_path = self.remote_global_explorer_path - self.transfer_path(src_path, remote_dst_path) + self.transfer_path(src_path, dst_path) + outputs = {} for explorer in os.listdir(src_path): - output_fd = open(os.path.join(dst_path, explorer), mode='w') + outputs[explorer] = io.StringIO() cmd = [] cmd.append("__explorer=" + remote_dst_path) cmd.append(os.path.join(remote_dst_path, explorer)) - - cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) - output_fd.close() - - def deploy_to(self): - """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.target_host) - self.stage_prepare() - self.stage_run() - - def deploy_and_cleanup(self): - """Do what is most often done: deploy & cleanup""" - start_time = time.time() - self.deploy_to() - self.cleanup() - log.info("Finished run of %s in %s seconds", - self.target_host, time.time() - start_time) - - def stage_prepare(self): - """Do everything for a deploy, minus the actual code stage""" - self.link_emulator() - self.run_global_explorers() - self.run_initial_manifest() - - log.info("Running object manifests and type explorers") - - # Continue process until no new objects are created anymore - new_objects_created = True - while new_objects_created: - new_objects_created = False - for cdist_object in cdist.core.Object.list_objects(self.object_base_path, - self.type_base_path): - if cdist_object.prepared: - log.debug("Skipping rerun of object %s", cdist_object) - continue - else: - self.object_prepare(cdist_object) - new_objects_created = True - - def stage_run(self): - """The final (and real) step of deployment""" - log.info("Generating and executing code") - for cdist_object in cdist.core.Object.list_objects(self.object_base_path, - self.type_base_path): - log.debug("Run object: %s", cdist_object) - self.object_run(cdist_object) + cdist.exec.run_or_fail(cmd, stdout=outputs[explorer], remote_prefix=True) def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" From 5bd23d06058ce9c6c93612d7ed18e5ebe8ae3351 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 15:59:26 +0200 Subject: [PATCH 0620/1024] template for context (REDO) Signed-off-by: Nico Schottelius --- lib/cdist/context.py | 328 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 328 insertions(+) create mode 100644 lib/cdist/context.py diff --git a/lib/cdist/context.py b/lib/cdist/context.py new file mode 100644 index 00000000..523adda0 --- /dev/null +++ b/lib/cdist/context.py @@ -0,0 +1,328 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import logging +import os +import stat +import shutil +import sys +import tempfile +import time + +import cdist.core +import cdist.exec + +log = logging.getLogger(__name__) + +CODE_HEADER = "#!/bin/sh -e\n" + +class ConfigInstall: + """Cdist main class to hold arbitrary data""" + + def __init__(self, + target_host, + initial_manifest=False, + base_path=False, + exec_path=sys.argv[0], + debug=False): + + self.target_host = target_host + + self.debug = debug + + # Only required for testing + self.exec_path = exec_path + + self.exec_wrapper = cdist.exec.Wrapper( + targe_host = self.target_host, + remote_exec=os.environ['__remote_exec'].split(), + remote_copy=os.environ['__remote_copy'].split() + ) + + # Configure logging - FIXME: make available for others + log.addFilter(self) + + # Base and Temp Base + self.base_path = (base_path or + self.base_path = os.path.abspath(os.path.join( + os.path.dirname(__file__), os.pardir, os.pardir)) + + # Local input + self.cache_path = os.path.join(self.base_path, "cache", + self.target_host) + 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_base_path = os.path.join(self.conf_path, "type") + self.lib_path = os.path.join(self.base_path, "lib") + + self.initial_manifest = (initial_manifest or + os.path.join(self.manifest_path, "init")) + + # Local output + if '__cdist_out_dir' in os.environ: + self.out_path = os.environ['__cdist_out_dir'] + else: + self.out_path = os.path.join(tempfile.mkdtemp(), "out") + self.bin_path = os.path.join(self.out_path, "bin") + self.global_explorer_out_path = os.path.join(self.out_path, "explorer") + self.object_base_path = os.path.join(self.out_path, "object") + + # Remote directory base + if '__cdist_remote_out_dir' in os.environ: + self.remote_base_path = os.environ['__cdist_remote_out_dir'] + else: + self.remote_base_path = "/var/lib/cdist" + + self.remote_conf_path = os.path.join(self.remote_base_path, "conf") + self.remote_object_path = os.path.join(self.remote_base_path, "object") + + self.remote_type_path = os.path.join(self.remote_conf_path, "type") + self.remote_global_explorer_path = os.path.join(self.remote_conf_path, "explorer") + + # Setup env to be used by others + self.__init_env() + + # Create directories + self.__init_local_paths() + self.__init_remote_paths() + + + def __init_remote_paths(self): + """Initialise remote directory structure""" + self.remove_remote_path(self.remote_base_path) + self.remote_mkdir(self.remote_base_path) + self.remote_mkdir(self.remote_conf_path) + + def __init_local_paths(self): + """Initialise local directory structure""" + + # Create base dir, if user supplied and not existing + if not os.path.isdir(self.base_path): + os.mkdir(self.base_path) + + # FIXME: raise more beautiful exception / Steven: handle exception + os.mkdir(self.out_path) + os.mkdir(self.global_explorer_out_path) + os.mkdir(self.bin_path) + + def __init_env(self): + """Environment usable for other stuff""" + os.environ['__target_host'] = self.target_host + if self.debug: + os.environ['__debug'] = "yes" + + def cleanup(self): + # Do not use in __del__: + # http://docs.python.org/reference/datamodel.html#customization + # "other globals referenced by the __del__() method may already have been deleted + # or in the process of being torn down (e.g. the import machinery shutting down)" + # + log.debug("Saving " + self.out_path + " to " + self.cache_path) + # FIXME: raise more beautiful exception / Steven: handle exception + # Remove previous cache + if os.path.exists(self.cache_path): + shutil.rmtree(self.cache_path) + shutil.move(self.out_path, self.cache_path) + + def filter(self, record): + """Add hostname to logs via logging Filter""" + + record.msg = self.target_host + ": " + record.msg + + return True + + def run_initial_manifest(self): + """Run the initial manifest""" + log.info("Running initial manifest %s", self.initial_manifest) + env = { "__manifest" : self.manifest_path } + self.run_manifest(self.initial_manifest, extra_env=env) + + def run_type_manifest(self, cdist_object): + """Run manifest for a specific object""" + cdist_type = cdist_object.type + manifest_path = os.path.join(self.type_base_path, + cdist_type.manifest_path) + + log.debug("%s: Running %s", cdist_object.name, manifest_path) + if os.path.exists(manifest_path): + env = { "__object" : os.path.join(self.object_base_path, + cdist_object.path), + "__object_id": cdist_object.object_id, + "__object_fq": cdist_object.name, + "__type": os.path.join(self.type_base_path, + cdist_type.path) + } + self.run_manifest(manifest_path, extra_env=env) + + def run_manifest(self, manifest_path, extra_env=None): + """Run a manifest""" + log.debug("Running manifest %s, env=%s", manifest_path, extra_env) + env = os.environ.copy() + env['PATH'] = self.bin_path + ":" + env['PATH'] + + # Information required in every manifest + env['__target_host'] = self.target_host + env['__global'] = self.out_path + + # Required for recording source in emulator + env['__cdist_manifest'] = manifest_path + + # Required to find types in emulator + env['__cdist_type_base_path'] = self.type_base_path + + # Other environment stuff + if extra_env: + env.update(extra_env) + + cdist.exec.shell_run_or_debug_fail(manifest_path, [manifest_path], env=env) + + def object_prepare(self, cdist_object): + """Prepare object: Run type explorer + manifest""" + log.debug("Preparing object: " + cdist_object.name) + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + cdist_object.prepared = True + + def object_run(self, cdist_object): + """Run gencode and code for an object""" + log.debug("Running object %s", cdist_object) + + # Catch requirements, which re-call us + if cdist_object.ran: + return + + cdist_type = cdist_object.type + + for requirement in cdist_object.requirements: + log.debug("Object %s requires %s", cdist_object, requirement) + self.object_run(requirement) + + # + # Setup env Variable: + # + env = os.environ.copy() + env['__target_host'] = self.target_host + env['__global'] = self.out_path + env["__object"] = os.path.join(self.object_base_path, cdist_object.path) + env["__object_id"] = cdist_object.object_id + env["__object_fq"] = cdist_object.name + env["__type"] = cdist_type.name + + # gencode + for cmd in ["local", "remote"]: + bin = os.path.join(self.type_base_path, + getattr(cdist_type, "gencode_" + cmd + "_path")) + + if os.path.isfile(bin): + outfile = os.path.join(self.object_base_path, + getattr(cdist_object, "code_" + cmd + "_path")) + + outfile_fd = open(outfile, "w") + + # Need to flush to ensure our write is done before stdout write + # FIXME: code header still needed? + outfile_fd.write(CODE_HEADER) + outfile_fd.flush() + + cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) + outfile_fd.close() + + status = os.stat(outfile) + + # Remove output if empty, else make it executable + if status.st_size == len(CODE_HEADER): + os.unlink(outfile) + else: + # Add header and make executable - identically to 0o700 + os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + cdist_object.changed=True + + # code local + code_local = cdist_object.code_local_path + if os.path.isfile(code_local): + cdist.exec.run_or_fail([code_local]) + + # code remote + local_remote_code = os.path.join(self.object_base_path, + cdist_object.code_remote_path) + remote_remote_code = os.path.join(self.remote_object_path, + cdist_object.code_remote_path) + if os.path.isfile(local_remote_code): + self.transfer_path(local_remote_code, remote_remote_code) + cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) + + cdist_object.ran = True + + def link_emulator(self): + """Link emulator to types""" + src = os.path.abspath(self.exec_path) + for cdist_type in cdist.core.Type.list_types(self.type_base_path): + dst = os.path.join(self.bin_path, cdist_type.name) + log.debug("Linking emulator: %s to %s", src, dst) + + # FIXME: handle exception / make it more beautiful / Steven: raise except :-) + os.symlink(src, dst) + + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + log.info("Deploying to " + self.target_host) + self.stage_prepare() + self.stage_run() + + def deploy_and_cleanup(self): + """Do what is most often done: deploy & cleanup""" + start_time = time.time() + self.deploy_to() + self.cleanup() + log.info("Finished run of %s in %s seconds", + self.target_host, time.time() - start_time) + + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" + self.link_emulator() + self.run_global_explorers() + self.run_initial_manifest() + + log.info("Running object manifests and type explorers") + + # Continue process until no new objects are created anymore + new_objects_created = True + while new_objects_created: + new_objects_created = False + for cdist_object in cdist.core.Object.list_objects(self.object_base_path, + self.type_base_path): + if cdist_object.prepared: + log.debug("Skipping rerun of object %s", cdist_object) + continue + else: + self.object_prepare(cdist_object) + new_objects_created = True + + def stage_run(self): + """The final (and real) step of deployment""" + log.info("Generating and executing code") + for cdist_object in cdist.core.Object.list_objects(self.object_base_path, + self.type_base_path): + log.debug("Run object: %s", cdist_object) + self.object_run(cdist_object) From 0397e77a3ec79900675ed61c45581e70c64cca38 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:04:09 +0200 Subject: [PATCH 0621/1024] cleanup context Signed-off-by: Nico Schottelius --- lib/cdist/context.py | 233 ++----------------------------------------- 1 file changed, 11 insertions(+), 222 deletions(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 523adda0..240593db 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -22,43 +22,31 @@ import logging import os -import stat -import shutil -import sys -import tempfile -import time - -import cdist.core -import cdist.exec +#import stat +#import shutil +#import sys +#import tempfile +#import time +# +#import cdist.core +#import cdist.exec log = logging.getLogger(__name__) -CODE_HEADER = "#!/bin/sh -e\n" - -class ConfigInstall: - """Cdist main class to hold arbitrary data""" +class Context: + """Hold information about current context""" def __init__(self, target_host, initial_manifest=False, base_path=False, - exec_path=sys.argv[0], - debug=False): + exec_path=sys.argv[0]): self.target_host = target_host - self.debug = debug - # Only required for testing self.exec_path = exec_path - self.exec_wrapper = cdist.exec.Wrapper( - targe_host = self.target_host, - remote_exec=os.environ['__remote_exec'].split(), - remote_copy=os.environ['__remote_copy'].split() - ) - - # Configure logging - FIXME: make available for others log.addFilter(self) # Base and Temp Base @@ -108,30 +96,6 @@ class ConfigInstall: self.__init_remote_paths() - def __init_remote_paths(self): - """Initialise remote directory structure""" - self.remove_remote_path(self.remote_base_path) - self.remote_mkdir(self.remote_base_path) - self.remote_mkdir(self.remote_conf_path) - - def __init_local_paths(self): - """Initialise local directory structure""" - - # Create base dir, if user supplied and not existing - if not os.path.isdir(self.base_path): - os.mkdir(self.base_path) - - # FIXME: raise more beautiful exception / Steven: handle exception - os.mkdir(self.out_path) - os.mkdir(self.global_explorer_out_path) - os.mkdir(self.bin_path) - - def __init_env(self): - """Environment usable for other stuff""" - os.environ['__target_host'] = self.target_host - if self.debug: - os.environ['__debug'] = "yes" - def cleanup(self): # Do not use in __del__: # http://docs.python.org/reference/datamodel.html#customization @@ -151,178 +115,3 @@ class ConfigInstall: record.msg = self.target_host + ": " + record.msg return True - - def run_initial_manifest(self): - """Run the initial manifest""" - log.info("Running initial manifest %s", self.initial_manifest) - env = { "__manifest" : self.manifest_path } - self.run_manifest(self.initial_manifest, extra_env=env) - - def run_type_manifest(self, cdist_object): - """Run manifest for a specific object""" - cdist_type = cdist_object.type - manifest_path = os.path.join(self.type_base_path, - cdist_type.manifest_path) - - log.debug("%s: Running %s", cdist_object.name, manifest_path) - if os.path.exists(manifest_path): - env = { "__object" : os.path.join(self.object_base_path, - cdist_object.path), - "__object_id": cdist_object.object_id, - "__object_fq": cdist_object.name, - "__type": os.path.join(self.type_base_path, - cdist_type.path) - } - self.run_manifest(manifest_path, extra_env=env) - - def run_manifest(self, manifest_path, extra_env=None): - """Run a manifest""" - log.debug("Running manifest %s, env=%s", manifest_path, extra_env) - env = os.environ.copy() - env['PATH'] = self.bin_path + ":" + env['PATH'] - - # Information required in every manifest - env['__target_host'] = self.target_host - env['__global'] = self.out_path - - # Required for recording source in emulator - env['__cdist_manifest'] = manifest_path - - # Required to find types in emulator - env['__cdist_type_base_path'] = self.type_base_path - - # Other environment stuff - if extra_env: - env.update(extra_env) - - cdist.exec.shell_run_or_debug_fail(manifest_path, [manifest_path], env=env) - - def object_prepare(self, cdist_object): - """Prepare object: Run type explorer + manifest""" - log.debug("Preparing object: " + cdist_object.name) - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - cdist_object.prepared = True - - def object_run(self, cdist_object): - """Run gencode and code for an object""" - log.debug("Running object %s", cdist_object) - - # Catch requirements, which re-call us - if cdist_object.ran: - return - - cdist_type = cdist_object.type - - for requirement in cdist_object.requirements: - log.debug("Object %s requires %s", cdist_object, requirement) - self.object_run(requirement) - - # - # Setup env Variable: - # - env = os.environ.copy() - env['__target_host'] = self.target_host - env['__global'] = self.out_path - env["__object"] = os.path.join(self.object_base_path, cdist_object.path) - env["__object_id"] = cdist_object.object_id - env["__object_fq"] = cdist_object.name - env["__type"] = cdist_type.name - - # gencode - for cmd in ["local", "remote"]: - bin = os.path.join(self.type_base_path, - getattr(cdist_type, "gencode_" + cmd + "_path")) - - if os.path.isfile(bin): - outfile = os.path.join(self.object_base_path, - getattr(cdist_object, "code_" + cmd + "_path")) - - outfile_fd = open(outfile, "w") - - # Need to flush to ensure our write is done before stdout write - # FIXME: code header still needed? - outfile_fd.write(CODE_HEADER) - outfile_fd.flush() - - cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) - outfile_fd.close() - - status = os.stat(outfile) - - # Remove output if empty, else make it executable - if status.st_size == len(CODE_HEADER): - os.unlink(outfile) - else: - # Add header and make executable - identically to 0o700 - os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) - cdist_object.changed=True - - # code local - code_local = cdist_object.code_local_path - if os.path.isfile(code_local): - cdist.exec.run_or_fail([code_local]) - - # code remote - local_remote_code = os.path.join(self.object_base_path, - cdist_object.code_remote_path) - remote_remote_code = os.path.join(self.remote_object_path, - cdist_object.code_remote_path) - if os.path.isfile(local_remote_code): - self.transfer_path(local_remote_code, remote_remote_code) - cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) - - cdist_object.ran = True - - def link_emulator(self): - """Link emulator to types""" - src = os.path.abspath(self.exec_path) - for cdist_type in cdist.core.Type.list_types(self.type_base_path): - dst = os.path.join(self.bin_path, cdist_type.name) - log.debug("Linking emulator: %s to %s", src, dst) - - # FIXME: handle exception / make it more beautiful / Steven: raise except :-) - os.symlink(src, dst) - - def deploy_to(self): - """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.target_host) - self.stage_prepare() - self.stage_run() - - def deploy_and_cleanup(self): - """Do what is most often done: deploy & cleanup""" - start_time = time.time() - self.deploy_to() - self.cleanup() - log.info("Finished run of %s in %s seconds", - self.target_host, time.time() - start_time) - - def stage_prepare(self): - """Do everything for a deploy, minus the actual code stage""" - self.link_emulator() - self.run_global_explorers() - self.run_initial_manifest() - - log.info("Running object manifests and type explorers") - - # Continue process until no new objects are created anymore - new_objects_created = True - while new_objects_created: - new_objects_created = False - for cdist_object in cdist.core.Object.list_objects(self.object_base_path, - self.type_base_path): - if cdist_object.prepared: - log.debug("Skipping rerun of object %s", cdist_object) - continue - else: - self.object_prepare(cdist_object) - new_objects_created = True - - def stage_run(self): - """The final (and real) step of deployment""" - log.info("Generating and executing code") - for cdist_object in cdist.core.Object.list_objects(self.object_base_path, - self.type_base_path): - log.debug("Run object: %s", cdist_object) - self.object_run(cdist_object) From d4f6328eefe1fcf8e210583907b0c82623c1dd71 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:05:32 +0200 Subject: [PATCH 0622/1024] finish context Signed-off-by: Nico Schottelius --- lib/cdist/context.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 240593db..d8d4e5ea 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -31,8 +31,6 @@ import os #import cdist.core #import cdist.exec -log = logging.getLogger(__name__) - class Context: """Hold information about current context""" @@ -47,7 +45,9 @@ class Context: # Only required for testing self.exec_path = exec_path - log.addFilter(self) + # Context logging + self.log = logging.getLogger(__name__) + self.log.addFilter(self) # Base and Temp Base self.base_path = (base_path or @@ -88,14 +88,6 @@ class Context: self.remote_type_path = os.path.join(self.remote_conf_path, "type") self.remote_global_explorer_path = os.path.join(self.remote_conf_path, "explorer") - # Setup env to be used by others - self.__init_env() - - # Create directories - self.__init_local_paths() - self.__init_remote_paths() - - def cleanup(self): # Do not use in __del__: # http://docs.python.org/reference/datamodel.html#customization From e437cd90d66870e299d807442e5da66c962b2b46 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 16:06:21 +0200 Subject: [PATCH 0623/1024] rewrite exec Signed-off-by: Steven Armstrong --- lib/cdist/exec.py | 120 ++++++++++++++++++++++++---------------------- 1 file changed, 62 insertions(+), 58 deletions(-) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index 7ec9bc0a..b3b86a52 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -23,75 +23,79 @@ import logging import os import subprocess -log = logging.getLogger(__name__) - import cdist -class ExecWrapper(object): - def __init__(self, remote_exec, remote_copy, target_host): +log = logging.getLogger(__name__) + + +class Wrapper(object): + def __init__(self, target_host, remote_exec, remote_copy): + self.target_host = target_host self.remote_exec = remote_exec - -def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): - # Manually execute /bin/sh, because sh -e does what we want - # and sh -c -e does not exit if /bin/false called - args[0][:0] = [ "/bin/sh", "-e" ] - - if remote_prefix: - remote_prefix = os.environ['__remote_exec'].split() - remote_prefix.append(os.environ['__target_host']) - args[0][:0] = remote_prefix - - log.debug("Shell exec cmd: %s", args) - - if 'env' in kargs: - log.debug("Shell exec env: %s", kargs['env']) - - try: - subprocess.check_call(*args, **kargs) - except subprocess.CalledProcessError: - log.error("Code that raised the error:\n") - - if remote_prefix: - run_or_fail(["cat", script], remote_prefix=remote_prefix) - - else: - try: - script_fd = open(script) - print(script_fd.read()) - script_fd.close() - except IOError as error: - raise cdist.Error(str(error)) - - raise cdist.Error("Command failed (shell): " + " ".join(*args)) - except OSError as error: - raise cdist.Error(" ".join(*args) + ": " + error.args[1]) - -def run_or_fail(*args, remote_prefix=False, **kargs): - if remote_prefix: - remote_prefix = os.environ['__remote_exec'].split() - remote_prefix.append(os.environ['__target_host']) - args[0][:0] = remote_prefix - - log.debug("Exec: " + " ".join(*args)) - try: - subprocess.check_call(*args, **kargs) - except subprocess.CalledProcessError: - raise cdist.Error("Command failed: " + " ".join(*args)) - except OSError as error: - raise cdist.Error(" ".join(*args) + ": " + error.args[1]) - - + self.remote_copy = remote_copy def remote_mkdir(self, directory): """Create directory on remote side""" - cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) + self.run_or_fail(["mkdir", "-p", directory], remote=True) def remove_remote_path(self, destination): """Ensure path on remote side vanished""" - cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) + self.run_or_fail(["rm", "-rf", destination], remote=True) def transfer_path(self, source, destination): """Transfer directory and previously delete the remote destination""" self.remove_remote_path(destination) - cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + + self.run_or_fail(os.environ['__remote_copy'].split() + ["-r", source, self.target_host + ":" + destination]) + + def shell_run_or_debug_fail(self, script, *args, remote=False, **kargs): + # Manually execute /bin/sh, because sh -e does what we want + # and sh -c -e does not exit if /bin/false called + args[0][:0] = [ "/bin/sh", "-e" ] + + if remote: + remote_prefix = self.remote_exec.split() + remote_prefix.append(self.target_host) + args[0][:0] = remote_prefix + + log.debug("Shell exec cmd: %s", args) + + if 'env' in kargs: + log.debug("Shell exec env: %s", kargs['env']) + + try: + subprocess.check_call(*args, **kargs) + except subprocess.CalledProcessError: + log.error("Code that raised the error:\n") + + if remote: + self.run_or_fail(["cat", script], remote=remote) + + else: + try: + script_fd = open(script) + print(script_fd.read()) + script_fd.close() + except IOError as error: + raise cdist.Error(str(error)) + + raise cdist.Error("Command failed (shell): " + " ".join(*args)) + except OSError as error: + raise cdist.Error(" ".join(*args) + ": " + error.args[1]) + + def run_or_fail(self, *args, remote=False, **kargs): + if remote: + remote_prefix = self.remote_exec.split() + remote_prefix.append(self.target_host) + args[0][:0] = remote_prefix + + log.debug("Exec: " + " ".join(*args)) + try: + subprocess.check_call(*args, **kargs) + except subprocess.CalledProcessError: + raise cdist.Error("Command failed: " + " ".join(*args)) + except OSError as error: + raise cdist.Error(" ".join(*args) + ": " + error.args[1]) + + + From 4c29d9839b64f3a4ff7ec3e800b578bfa3ee3111 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:19:27 +0200 Subject: [PATCH 0624/1024] configure logger based on hostname Signed-off-by: Nico Schottelius --- bin/cdist | 4 ---- lib/cdist/context.py | 13 ++++++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/cdist b/bin/cdist index 50e66697..ac863e9e 100755 --- a/bin/cdist +++ b/bin/cdist @@ -114,10 +114,6 @@ def configinstall(args, mode): time_start = time.time() - # FIXME: do not overwrite, if set! - os.environ['__remote_exec'] = "ssh -o User=root -q" - os.environ['__remote_copy'] = "scp -o User=root -q" - for host in args.host: c = mode(host, initial_manifest=args.manifest, diff --git a/lib/cdist/context.py b/lib/cdist/context.py index d8d4e5ea..f1cd4c14 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -38,7 +38,8 @@ class Context: target_host, initial_manifest=False, base_path=False, - exec_path=sys.argv[0]): + exec_path=sys.argv[0], + debug): self.target_host = target_host @@ -88,6 +89,16 @@ class Context: self.remote_type_path = os.path.join(self.remote_conf_path, "type") self.remote_global_explorer_path = os.path.join(self.remote_conf_path, "explorer") + if '__remote_exec' in os.environ: + self.remote_exec = os.environ['__remote_exec'] + else: + self.remote_exec = "ssh -o User=root -q" + + if '__remote_copy' in os.environ: + self.remote_copy = os.environ['__remote_copy'] + else: + self.remote_copy = "scp -o User=root -q" + def cleanup(self): # Do not use in __del__: # http://docs.python.org/reference/datamodel.html#customization From c28fd5bbfdef3e0fc264e43249a02bea560e332b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:22:44 +0200 Subject: [PATCH 0625/1024] add template for manifest for sar / steven to have fun Signed-off-by: Nico Schottelius --- lib/cdist/manifest.py | 272 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100644 lib/cdist/manifest.py diff --git a/lib/cdist/manifest.py b/lib/cdist/manifest.py new file mode 100644 index 00000000..ab5f7284 --- /dev/null +++ b/lib/cdist/manifest.py @@ -0,0 +1,272 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import logging +import os +import stat +import shutil +import sys +import tempfile +import time + +import cdist.core +import cdist.exec + +CODE_HEADER = "#!/bin/sh -e\n" + +class ConfigInstall: + """Cdist main class to hold arbitrary data""" + + def __init__(self, + target_host, + initial_manifest=False, + base_path=False, + exec_path=sys.argv[0], + debug=False): + + self.context = cdist.context.Context( + target_host=target_host, + initial_manifest=initial_manifest, + base_path=base_path, + exec_path=sys.argv[0], + debug=debug) + + + + self.exec_wrapper = cdist.exec.Wrapper( + targe_host = self.target_host, + remote_exec=os.environ['__remote_exec'].split(), + remote_copy=os.environ['__remote_copy'].split() + ) + + self.log = logging.getLogger(self.context.target_host) + + # Setup env to be used by others - FIXME + self.__init_env() + + # Create directories + self.__init_local_paths() + self.__init_remote_paths() + + def __init_remote_paths(self): + """Initialise remote directory structure""" + self.remove_remote_path(self.context.remote_base_path) + self.remote_mkdir(self.context.remote_base_path) + self.remote_mkdir(self.context.remote_conf_path) + + def __init_local_paths(self): + """Initialise local directory structure""" + + # Create base dir, if user supplied and not existing + if not os.path.isdir(self.context.base_path): + os.mkdir(self.context.base_path) + + # FIXME: raise more beautiful exception / Steven: handle exception + os.mkdir(self.out_path) + os.mkdir(self.global_explorer_out_path) + os.mkdir(self.bin_path) + + # FIXME: remove this function, only expose ENV + # explicitly! + def __init_env(self): + """Environment usable for other stuff""" + os.environ['__target_host'] = self.target_host + if self.debug: + os.environ['__debug'] = "yes" + + def cleanup(self): + self.context.cleanup() + + def run_initial_manifest(self): + """Run the initial manifest""" + log.info("Running initial manifest %s", self.initial_manifest) + env = { "__manifest" : self.manifest_path } + self.run_manifest(self.initial_manifest, extra_env=env) + + def run_type_manifest(self, cdist_object): + """Run manifest for a specific object""" + cdist_type = cdist_object.type + manifest_path = os.path.join(self.type_base_path, + cdist_type.manifest_path) + + log.debug("%s: Running %s", cdist_object.name, manifest_path) + if os.path.exists(manifest_path): + env = { "__object" : os.path.join(self.object_base_path, + cdist_object.path), + "__object_id": cdist_object.object_id, + "__object_fq": cdist_object.name, + "__type": os.path.join(self.type_base_path, + cdist_type.path) + } + self.run_manifest(manifest_path, extra_env=env) + + def run_manifest(self, manifest_path, extra_env=None): + """Run a manifest""" + log.debug("Running manifest %s, env=%s", manifest_path, extra_env) + env = os.environ.copy() + env['PATH'] = self.bin_path + ":" + env['PATH'] + + # Information required in every manifest + env['__target_host'] = self.target_host + env['__global'] = self.out_path + + # Required for recording source in emulator + env['__cdist_manifest'] = manifest_path + + # Required to find types in emulator + env['__cdist_type_base_path'] = self.type_base_path + + # Other environment stuff + if extra_env: + env.update(extra_env) + + cdist.exec.shell_run_or_debug_fail(manifest_path, [manifest_path], env=env) + + def object_prepare(self, cdist_object): + """Prepare object: Run type explorer + manifest""" + log.debug("Preparing object: " + cdist_object.name) + self.run_type_explorer(cdist_object) + self.run_type_manifest(cdist_object) + cdist_object.prepared = True + + def object_run(self, cdist_object): + """Run gencode and code for an object""" + log.debug("Running object %s", cdist_object) + + # Catch requirements, which re-call us + if cdist_object.ran: + return + + cdist_type = cdist_object.type + + for requirement in cdist_object.requirements: + log.debug("Object %s requires %s", cdist_object, requirement) + self.object_run(requirement) + + # + # Setup env Variable: + # + env = os.environ.copy() + env['__target_host'] = self.target_host + env['__global'] = self.out_path + env["__object"] = os.path.join(self.object_base_path, cdist_object.path) + env["__object_id"] = cdist_object.object_id + env["__object_fq"] = cdist_object.name + env["__type"] = cdist_type.name + + # gencode + for cmd in ["local", "remote"]: + bin = os.path.join(self.type_base_path, + getattr(cdist_type, "gencode_" + cmd + "_path")) + + if os.path.isfile(bin): + outfile = os.path.join(self.object_base_path, + getattr(cdist_object, "code_" + cmd + "_path")) + + outfile_fd = open(outfile, "w") + + # Need to flush to ensure our write is done before stdout write + # FIXME: code header still needed? + outfile_fd.write(CODE_HEADER) + outfile_fd.flush() + + cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) + outfile_fd.close() + + status = os.stat(outfile) + + # Remove output if empty, else make it executable + if status.st_size == len(CODE_HEADER): + os.unlink(outfile) + else: + # Add header and make executable - identically to 0o700 + os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) + cdist_object.changed=True + + # code local + code_local = cdist_object.code_local_path + if os.path.isfile(code_local): + cdist.exec.run_or_fail([code_local]) + + # code remote + local_remote_code = os.path.join(self.object_base_path, + cdist_object.code_remote_path) + remote_remote_code = os.path.join(self.remote_object_path, + cdist_object.code_remote_path) + if os.path.isfile(local_remote_code): + self.transfer_path(local_remote_code, remote_remote_code) + cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) + + cdist_object.ran = True + + def link_emulator(self): + """Link emulator to types""" + src = os.path.abspath(self.exec_path) + for cdist_type in cdist.core.Type.list_types(self.type_base_path): + dst = os.path.join(self.bin_path, cdist_type.name) + log.debug("Linking emulator: %s to %s", src, dst) + + # FIXME: handle exception / make it more beautiful / Steven: raise except :-) + os.symlink(src, dst) + + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + log.info("Deploying to " + self.target_host) + self.stage_prepare() + self.stage_run() + + def deploy_and_cleanup(self): + """Do what is most often done: deploy & cleanup""" + start_time = time.time() + self.deploy_to() + self.cleanup() + log.info("Finished run of %s in %s seconds", + self.target_host, time.time() - start_time) + + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" + self.link_emulator() + self.run_global_explorers() + self.run_initial_manifest() + + log.info("Running object manifests and type explorers") + + # Continue process until no new objects are created anymore + new_objects_created = True + while new_objects_created: + new_objects_created = False + for cdist_object in cdist.core.Object.list_objects(self.object_base_path, + self.type_base_path): + if cdist_object.prepared: + log.debug("Skipping rerun of object %s", cdist_object) + continue + else: + self.object_prepare(cdist_object) + new_objects_created = True + + def stage_run(self): + """The final (and real) step of deployment""" + log.info("Generating and executing code") + for cdist_object in cdist.core.Object.list_objects(self.object_base_path, + self.type_base_path): + log.debug("Run object: %s", cdist_object) + self.object_run(cdist_object) From b8a3cf2f4996c11c57adef113389644596051dfb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:25:48 +0200 Subject: [PATCH 0626/1024] remove manifest code from config_install Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 264 ++++-------------------------------- 1 file changed, 23 insertions(+), 241 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 7214cdba..ef37eb86 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -31,8 +31,6 @@ import time import cdist.core import cdist.exec -log = logging.getLogger(__name__) - CODE_HEADER = "#!/bin/sh -e\n" class ConfigInstall: @@ -45,152 +43,59 @@ class ConfigInstall: exec_path=sys.argv[0], debug=False): - self.target_host = target_host + self.context = cdist.context.Context( + target_host=target_host, + initial_manifest=initial_manifest, + base_path=base_path, + exec_path=sys.argv[0], + debug=debug) - self.debug = debug + self.exec_wrapper = cdist.exec.Wrapper( + targe_host = self.target_host, + remote_exec=os.environ['__remote_exec'].split(), + remote_copy=os.environ['__remote_copy'].split() + ) - # Only required for testing - self.exec_path = exec_path + self.explorer = cdist.explorer.Explorer() + self.manifest = cdist.manifest.Mamifest() - # Configure logging - log.addFilter(self) + self.log = logging.getLogger(self.context.target_host) - # Base and Temp Base - self.base_path = (base_path or - self.base_path = os.path.abspath(os.path.join( - os.path.dirname(__file__), os.pardir, os.pardir)) - - # Local input - self.cache_path = os.path.join(self.base_path, "cache", - self.target_host) - 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_base_path = os.path.join(self.conf_path, "type") - self.lib_path = os.path.join(self.base_path, "lib") - - self.initial_manifest = (initial_manifest or - os.path.join(self.manifest_path, "init")) - - # Local output - if '__cdist_out_dir' in os.environ: - self.out_path = os.environ['__cdist_out_dir'] - else: - self.out_path = os.path.join(tempfile.mkdtemp(), "out") - self.bin_path = os.path.join(self.out_path, "bin") - self.global_explorer_out_path = os.path.join(self.out_path, "explorer") - self.object_base_path = os.path.join(self.out_path, "object") - - # Remote directory base - if '__cdist_remote_out_dir' in os.environ: - self.remote_base_path = os.environ['__cdist_remote_out_dir'] - else: - self.remote_base_path = "/var/lib/cdist" - - self.remote_conf_path = os.path.join(self.remote_base_path, "conf") - self.remote_object_path = os.path.join(self.remote_base_path, "object") - - self.remote_type_path = os.path.join(self.remote_conf_path, "type") - self.remote_global_explorer_path = os.path.join(self.remote_conf_path, "explorer") - - # Setup env to be used by others + # Setup env to be used by others - FIXME self.__init_env() # Create directories self.__init_local_paths() self.__init_remote_paths() - def __init_remote_paths(self): """Initialise remote directory structure""" - self.remove_remote_path(self.remote_base_path) - self.remote_mkdir(self.remote_base_path) - self.remote_mkdir(self.remote_conf_path) + self.remove_remote_path(self.context.remote_base_path) + self.remote_mkdir(self.context.remote_base_path) + self.remote_mkdir(self.context.remote_conf_path) def __init_local_paths(self): """Initialise local directory structure""" # Create base dir, if user supplied and not existing - if not os.path.isdir(self.base_path): - os.mkdir(self.base_path) + if not os.path.isdir(self.context.base_path): + os.mkdir(self.context.base_path) # FIXME: raise more beautiful exception / Steven: handle exception os.mkdir(self.out_path) os.mkdir(self.global_explorer_out_path) os.mkdir(self.bin_path) + # FIXME: remove this function, only expose ENV + # explicitly! def __init_env(self): """Environment usable for other stuff""" os.environ['__target_host'] = self.target_host if self.debug: os.environ['__debug'] = "yes" - def cleanup(self): - # Do not use in __del__: - # http://docs.python.org/reference/datamodel.html#customization - # "other globals referenced by the __del__() method may already have been deleted - # or in the process of being torn down (e.g. the import machinery shutting down)" - # - log.debug("Saving " + self.out_path + " to " + self.cache_path) - # FIXME: raise more beautiful exception / Steven: handle exception - # Remove previous cache - if os.path.exists(self.cache_path): - shutil.rmtree(self.cache_path) - shutil.move(self.out_path, self.cache_path) - - def filter(self, record): - """Add hostname to logs via logging Filter""" - - record.msg = self.target_host + ": " + record.msg - - return True - - def run_initial_manifest(self): - """Run the initial manifest""" - log.info("Running initial manifest %s", self.initial_manifest) - env = { "__manifest" : self.manifest_path } - self.run_manifest(self.initial_manifest, extra_env=env) - - def run_type_manifest(self, cdist_object): - """Run manifest for a specific object""" - cdist_type = cdist_object.type - manifest_path = os.path.join(self.type_base_path, - cdist_type.manifest_path) - - log.debug("%s: Running %s", cdist_object.name, manifest_path) - if os.path.exists(manifest_path): - env = { "__object" : os.path.join(self.object_base_path, - cdist_object.path), - "__object_id": cdist_object.object_id, - "__object_fq": cdist_object.name, - "__type": os.path.join(self.type_base_path, - cdist_type.path) - } - self.run_manifest(manifest_path, extra_env=env) - - def run_manifest(self, manifest_path, extra_env=None): - """Run a manifest""" - log.debug("Running manifest %s, env=%s", manifest_path, extra_env) - env = os.environ.copy() - env['PATH'] = self.bin_path + ":" + env['PATH'] - - # Information required in every manifest - env['__target_host'] = self.target_host - env['__global'] = self.out_path - - # Required for recording source in emulator - env['__cdist_manifest'] = manifest_path - - # Required to find types in emulator - env['__cdist_type_base_path'] = self.type_base_path - - # Other environment stuff - if extra_env: - env.update(extra_env) - - cdist.exec.shell_run_or_debug_fail(manifest_path, [manifest_path], env=env) + self.context.cleanup() def object_prepare(self, cdist_object): """Prepare object: Run type explorer + manifest""" @@ -269,67 +174,6 @@ class ConfigInstall: cdist_object.ran = True - def run_type_explorer(self, cdist_object): - - def run_type_explorer(self, cdist_object, remote_global_explorer_path, remote_type_path, remote_object_path, scp-hints, ssh-hints, object_base_path): - - def __init__(self, remote_global_explorer_path, remote_type_path, remote_object_path, exec-hint, object_base_path, global_explorer_out_path): - - def __init__(self, remote_global_explorer_path, remote_type_path, remote_object_path, exec-hint): - - def run_type_explorer(self, cdist_object) - - self.value = .,.. - return value - - def run_global_explorer(self) - - def __init__(self, remote_global_explorer_path, remote_type_path, remote_object_path, exec-hint): - == 1x - - - - - run_type_explorer() - self.instance.value[obej - - c = ConfigInstall("foo") - c.remote_global_explorer_path = "moo" - - def run_type_explorer(self, cdist_object) - """Run type specific explorers for objects""" - - cdist_type = cdist_object.type - self.transfer_type_explorers(cdist_type) - - cmd = [] - cmd.append("__explorer=" + self.remote_global_explorer_path) - cmd.append("__type_explorer=" + os.path.join( - self.remote_type_path, - cdist_type.explorer_path)) - cmd.append("__object=" + os.path.join( - self.remote_object_path, - cdist_object.path)) - cmd.append("__object_id=" + cdist_object.object_id) - cmd.append("__object_fq=" + cdist_object.name) - - # Need to transfer at least the parameters for objects to be useful - self.transfer_object_parameter(cdist_object) - - for explorer in cdist_type.explorers: - remote_cmd = cmd + [os.path.join(self.remote_type_path, - cdist_type.explorer_path, explorer)] - output = os.path.join(self.object_base_path, - cdist_object.explorer_path, explorer) - output_fd = open(output, mode='w') - log.debug("%s exploring %s using %s storing to %s", - cdist_object, explorer, remote_cmd, output) - - cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=True) - output_fd.close() - - return outputs - def link_emulator(self): """Link emulator to types""" src = os.path.abspath(self.exec_path) @@ -340,27 +184,6 @@ class ConfigInstall: # FIXME: handle exception / make it more beautiful / Steven: raise except :-) os.symlink(src, dst) - def run_global_explorers(src_path, dst_path, remote_dst_path): - - def run_global_explorers(self): - """Run global explorers""" - log.info("Running global explorers") - - src_path = self.global_explorer_path - dst_path = self.global_explorer_out_path - remote_dst_path = self.remote_global_explorer_path - - self.transfer_path(src_path, remote_dst_path) - - for explorer in os.listdir(src_path): - output_fd = open(os.path.join(dst_path, explorer), mode='w') - cmd = [] - cmd.append("__explorer=" + remote_dst_path) - cmd.append(os.path.join(remote_dst_path, explorer)) - - cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) - output_fd.close() - def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" log.info("Deploying to " + self.target_host) @@ -403,44 +226,3 @@ class ConfigInstall: self.type_base_path): log.debug("Run object: %s", cdist_object) self.object_run(cdist_object) - - def transfer_object_parameter(self, cdist_object): - """Transfer the object parameter to the remote destination""" - src = os.path.join(self.object_base_path, - cdist_object.parameter_path) - dst = os.path.join(self.remote_object_path, - cdist_object.parameter_path) - - # Synchronise parameter dir afterwards - self.remote_mkdir(dst) - self.transfer_path(src, dst) - - def transfer_global_explorers(self): - """Transfer the global explorers""" - self.remote_mkdir(self.remote_global_explorer_path) - self.transfer_path(self.global_explorer_path, - self.remote_global_explorer_path) - - def transfer_type_explorers(self, cdist_type): - """Transfer explorers of a type, but only once""" - if cdist_type.transferred_explorers: - log.debug("Skipping retransfer for explorers of %s", cdist_type) - return - else: - log.debug("Ensure no retransfer for %s", cdist_type) - # Do not retransfer - cdist_type.transferred_explorers = True - - explorers = cdist_type.explorers - - if len(explorers) > 0: - rel_path = cdist_type.explorer_path - src = os.path.join(self.type_base_path, rel_path) - dst = os.path.join(self.remote_type_path, rel_path) - - # Ensure full path until type exists: - # /var/lib/cdist/conf/type/__directory/explorer - # /var/lib/cdist/conf/type/__directory may not exist, - # but remote_mkdir uses -p to fix this - self.remote_mkdir(dst) - self.transfer_path(src, dst) From dc21405583d2da14b7822df2b57d10ecfe127f91 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:26:01 +0200 Subject: [PATCH 0627/1024] use target host as key for logger Signed-off-by: Nico Schottelius --- lib/cdist/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index f1cd4c14..9550b96e 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -47,7 +47,7 @@ class Context: self.exec_path = exec_path # Context logging - self.log = logging.getLogger(__name__) + self.log = logging.getLogger(self.target_host) self.log.addFilter(self) # Base and Temp Base From d690fb30cbdcf81830d6db895547a34072c1baa4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:26:33 +0200 Subject: [PATCH 0628/1024] add base path and exec path to test main Signed-off-by: Nico Schottelius --- lib/cdist/test/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/cdist/test/__init__.py b/lib/cdist/test/__init__.py index 09429470..06c87917 100644 --- a/lib/cdist/test/__init__.py +++ b/lib/cdist/test/__init__.py @@ -27,8 +27,10 @@ import unittest cdist_commands=["banner", "config", "install"] -cdist_exec_path = os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../bin/cdist")) +cdist_base_path = os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../")) + +cdist_exec_path = os.path.join(cdist_base_path, "bin/cdist") #class UI(unittest.TestCase): # def test_banner(self): From a692e551c0080b8dfe71859486b37496f564c5bc Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 16:31:05 +0200 Subject: [PATCH 0629/1024] use new logger Signed-off-by: Steven Armstrong --- lib/cdist/exec.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index b3b86a52..13cec499 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -25,14 +25,13 @@ import subprocess import cdist -log = logging.getLogger(__name__) - class Wrapper(object): def __init__(self, target_host, remote_exec, remote_copy): self.target_host = target_host self.remote_exec = remote_exec self.remote_copy = remote_copy + self.log = logging.getLogger(self.target_host) def remote_mkdir(self, directory): """Create directory on remote side""" @@ -58,15 +57,15 @@ class Wrapper(object): remote_prefix.append(self.target_host) args[0][:0] = remote_prefix - log.debug("Shell exec cmd: %s", args) + self.log.debug("Shell exec cmd: %s", args) if 'env' in kargs: - log.debug("Shell exec env: %s", kargs['env']) + self.log.debug("Shell exec env: %s", kargs['env']) try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: - log.error("Code that raised the error:\n") + self.log.error("Code that raised the error:\n") if remote: self.run_or_fail(["cat", script], remote=remote) @@ -89,13 +88,10 @@ class Wrapper(object): remote_prefix.append(self.target_host) args[0][:0] = remote_prefix - log.debug("Exec: " + " ".join(*args)) + self.log.debug("Exec: " + " ".join(*args)) try: subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: raise cdist.Error("Command failed: " + " ".join(*args)) except OSError as error: raise cdist.Error(" ".join(*args) + ": " + error.args[1]) - - - From 8ef0c18da0630212a50d92afcfcbcfe006b5da95 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 16:31:43 +0200 Subject: [PATCH 0630/1024] update test suite to match new code Signed-off-by: Steven Armstrong --- lib/cdist/test/test_exec.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/cdist/test/test_exec.py b/lib/cdist/test/test_exec.py index 901b5efd..68f388e9 100644 --- a/lib/cdist/test/test_exec.py +++ b/lib/cdist/test/test_exec.py @@ -49,32 +49,35 @@ class Exec(unittest.TestCase): false_fd.writelines(["#!/bin/sh\n", "/bin/false"]) false_fd.close() + target_host = "does.not.exist" + remote_exec = "ssh -o User=root -q" + remote_copy = "scp -o User=root -q" + self.wrapper = cdist.exec.Wrapper(target_host, remote_exec, remote_copy) + def tearDown(self): shutil.rmtree(self.temp_dir) def test_local_success_shell(self): try: - cdist.exec.shell_run_or_debug_fail(self.shell_true, [self.shell_true]) + self.wrapper.shell_run_or_debug_fail(self.shell_true, [self.shell_true]) except cdist.Error: failed = True else: failed = False - self.assertFalse(failed) def test_local_fail_shell(self): - self.assertRaises(cdist.Error, cdist.exec.shell_run_or_debug_fail, + self.assertRaises(cdist.Error, self.wrapper.shell_run_or_debug_fail, self.shell_false, [self.shell_false]) def test_local_success(self): try: - cdist.exec.run_or_fail(["/bin/true"]) + self.wrapper.run_or_fail(["/bin/true"]) except cdist.Error: failed = True else: failed = False - self.assertFalse(failed) def test_local_fail(self): - self.assertRaises(cdist.Error, cdist.exec.run_or_fail, ["/bin/false"]) + self.assertRaises(cdist.Error, self.wrapper.run_or_fail, ["/bin/false"]) From 29bb5f383cc8a6bbbc5f0184ea40deb84f683e63 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:39:18 +0200 Subject: [PATCH 0631/1024] use context in cdist/bin Signed-off-by: Nico Schottelius --- bin/cdist | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index ac863e9e..aee96e6e 100755 --- a/bin/cdist +++ b/bin/cdist @@ -115,10 +115,14 @@ def configinstall(args, mode): time_start = time.time() for host in args.host: - c = mode(host, - initial_manifest=args.manifest, - base_path=args.cdist_home, - debug=args.debug) + context = cdist.context.Context( + target_host=host, + initial_manifest=args.manifest, + base_path=args.cdist_home, + exec_path=sys.argv[0], + debug=args.debug) + + c = mode(context) if args.parallel: log.debug("Creating child process for %s", host) process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) From 1c73fb1288eabb1006e67626065252e6ca0bf594 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 16:41:01 +0200 Subject: [PATCH 0632/1024] -- unused imports Signed-off-by: Steven Armstrong --- lib/cdist/test/test_exec.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/cdist/test/test_exec.py b/lib/cdist/test/test_exec.py index 68f388e9..deb62d11 100644 --- a/lib/cdist/test/test_exec.py +++ b/lib/cdist/test/test_exec.py @@ -22,17 +22,13 @@ import os -import sys import shutil -import subprocess import tempfile import unittest -sys.path.insert(0, os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) - import cdist.exec + class Exec(unittest.TestCase): def setUp(self): """Create shell code and co.""" From 8543f3ed58fe6577b6dcc02868a607ec2bcdb833 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 16:41:44 +0200 Subject: [PATCH 0633/1024] rename to match others Signed-off-by: Steven Armstrong --- lib/cdist/test/test_exec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/test/test_exec.py b/lib/cdist/test/test_exec.py index deb62d11..c2bb52f6 100644 --- a/lib/cdist/test/test_exec.py +++ b/lib/cdist/test/test_exec.py @@ -29,7 +29,7 @@ import unittest import cdist.exec -class Exec(unittest.TestCase): +class ExecTestCase(unittest.TestCase): def setUp(self): """Create shell code and co.""" From 2ec3753d945c45829659fd4f3fb5f5c287f6c2be Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:45:18 +0200 Subject: [PATCH 0634/1024] cleanup context in main Signed-off-by: Nico Schottelius --- bin/cdist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/cdist b/bin/cdist index aee96e6e..fae83ff1 100755 --- a/bin/cdist +++ b/bin/cdist @@ -130,6 +130,8 @@ def configinstall(args, mode): else: c.deploy_and_cleanup() + context.cleanup() + if args.parallel: for p in process.keys(): log.debug("Joining process %s", p) From dbd31252a868c35435ce27180a42a99907e12ebb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:45:36 +0200 Subject: [PATCH 0635/1024] remove CODE_HEADER Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index ef37eb86..cb903a93 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -29,26 +29,15 @@ import tempfile import time import cdist.core +import cdist.context import cdist.exec -CODE_HEADER = "#!/bin/sh -e\n" - -class ConfigInstall: +class ConfigInstall(object): """Cdist main class to hold arbitrary data""" - def __init__(self, - target_host, - initial_manifest=False, - base_path=False, - exec_path=sys.argv[0], - debug=False): + def __init__(self, context): - self.context = cdist.context.Context( - target_host=target_host, - initial_manifest=initial_manifest, - base_path=base_path, - exec_path=sys.argv[0], - debug=debug) + self.context = context self.exec_wrapper = cdist.exec.Wrapper( targe_host = self.target_host, @@ -70,9 +59,9 @@ class ConfigInstall: def __init_remote_paths(self): """Initialise remote directory structure""" - self.remove_remote_path(self.context.remote_base_path) - self.remote_mkdir(self.context.remote_base_path) - self.remote_mkdir(self.context.remote_conf_path) + self.exec_wrapper.remove_remote_path(self.context.remote_base_path) + self.exec_wrapper.remote_mkdir(self.context.remote_base_path) + self.exec_wrapper.remote_mkdir(self.context.remote_conf_path) def __init_local_paths(self): """Initialise local directory structure""" @@ -95,7 +84,10 @@ class ConfigInstall: os.environ['__debug'] = "yes" def cleanup(self): - self.context.cleanup() + log.debug("Saving " + self.out_path + " to " + self.cache_path) + if os.path.exists(self.context.cache_path): + shutil.rmtree(self.context.cache_path) + shutil.move(self.context.out_path, self.context.cache_path) def object_prepare(self, cdist_object): """Prepare object: Run type explorer + manifest""" From 73f1190d55c1cbd0732167b4153c3eed5c21ccfd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:45:45 +0200 Subject: [PATCH 0636/1024] cleanup context internally Signed-off-by: Nico Schottelius --- lib/cdist/context.py | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 9550b96e..7bb700e8 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -22,24 +22,24 @@ import logging import os +import sys +import tempfile #import stat #import shutil -#import sys -#import tempfile #import time # #import cdist.core #import cdist.exec -class Context: +class Context(object): """Hold information about current context""" - def __init__(self, + def __init__(self, target_host, initial_manifest=False, base_path=False, exec_path=sys.argv[0], - debug): + debug=False): self.target_host = target_host @@ -52,8 +52,8 @@ class Context: # Base and Temp Base self.base_path = (base_path or - self.base_path = os.path.abspath(os.path.join( - os.path.dirname(__file__), os.pardir, os.pardir)) + os.path.abspath(os.path.join(os.path.dirname(__file__), + os.pardir, os.pardir))) # Local input self.cache_path = os.path.join(self.base_path, "cache", @@ -71,8 +71,11 @@ class Context: # Local output if '__cdist_out_dir' in os.environ: self.out_path = os.environ['__cdist_out_dir'] + self.temp_dir = None else: - self.out_path = os.path.join(tempfile.mkdtemp(), "out") + self.temp_dir = tempfile.mkdtemp() + self.out_path = os.path.join(self.temp_dir, "out") + self.bin_path = os.path.join(self.out_path, "bin") self.global_explorer_out_path = os.path.join(self.out_path, "explorer") self.object_base_path = os.path.join(self.out_path, "object") @@ -100,17 +103,9 @@ class Context: self.remote_copy = "scp -o User=root -q" def cleanup(self): - # Do not use in __del__: - # http://docs.python.org/reference/datamodel.html#customization - # "other globals referenced by the __del__() method may already have been deleted - # or in the process of being torn down (e.g. the import machinery shutting down)" - # - log.debug("Saving " + self.out_path + " to " + self.cache_path) - # FIXME: raise more beautiful exception / Steven: handle exception - # Remove previous cache - if os.path.exists(self.cache_path): - shutil.rmtree(self.cache_path) - shutil.move(self.out_path, self.cache_path) + """Remove temp stuff""" + if self.temp_dir: + shutil.rmtree(self.temp_dir) def filter(self, record): """Add hostname to logs via logging Filter""" From 588731661e8a2f13effe29daaa65382de2d3edd4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:49:50 +0200 Subject: [PATCH 0637/1024] use context in explorer Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 19 ++++++++++--------- lib/cdist/explorer.py | 17 +++-------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index cb903a93..2a1c828d 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -31,6 +31,8 @@ import time import cdist.core import cdist.context import cdist.exec +import cdist.explorer +#import cdist.manifest class ConfigInstall(object): """Cdist main class to hold arbitrary data""" @@ -40,12 +42,11 @@ class ConfigInstall(object): self.context = context self.exec_wrapper = cdist.exec.Wrapper( - targe_host = self.target_host, - remote_exec=os.environ['__remote_exec'].split(), - remote_copy=os.environ['__remote_copy'].split() - ) + target_host = self.context.target_host, + remote_exec=self.context.remote_exec, + remote_copy=self.context.remote_copy) - self.explorer = cdist.explorer.Explorer() + self.explorer = cdist.explorer.Explorer(self.context) self.manifest = cdist.manifest.Mamifest() self.log = logging.getLogger(self.context.target_host) @@ -79,7 +80,7 @@ class ConfigInstall(object): # explicitly! def __init_env(self): """Environment usable for other stuff""" - os.environ['__target_host'] = self.target_host + os.environ['__target_host'] = self.context.target_host if self.debug: os.environ['__debug'] = "yes" @@ -114,7 +115,7 @@ class ConfigInstall(object): # Setup env Variable: # env = os.environ.copy() - env['__target_host'] = self.target_host + env['__target_host'] = self.context.target_host env['__global'] = self.out_path env["__object"] = os.path.join(self.object_base_path, cdist_object.path) env["__object_id"] = cdist_object.object_id @@ -178,7 +179,7 @@ class ConfigInstall(object): def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.target_host) + log.info("Deploying to " + self.context.target_host) self.stage_prepare() self.stage_run() @@ -188,7 +189,7 @@ class ConfigInstall(object): self.deploy_to() self.cleanup() log.info("Finished run of %s in %s seconds", - self.target_host, time.time() - start_time) + self.context.target_host, time.time() - start_time) def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" diff --git a/lib/cdist/explorer.py b/lib/cdist/explorer.py index e2c41f8a..b0db60bc 100644 --- a/lib/cdist/explorer.py +++ b/lib/cdist/explorer.py @@ -37,21 +37,10 @@ log = logging.getLogger(__name__) class Explorer: """Execute explorers""" - def __init__(self, - object_base_path, - remote_global_explorer_path, - remote_type_path, - remote_object_path, - type_path, - exec_hint): + def __init__(self, context): + self.context = context - self.object_base_path = object_base_path - self.remote_global_explorer_path = remote_global_explorer_path - self.remote_type_path = remote_type_path - self.remote_object_path = remote_object_path - self.exec_hint = exec_hint - - def run_type_explorer(self, cdist_object) + def run_type_explorer(self, cdist_object): """Run type specific explorers for objects""" cdist_type = cdist_object.type From 794a11d86648524c6a16131035b09e1db9a17473 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:56:05 +0200 Subject: [PATCH 0638/1024] %s/\(self.\)\([a-z]*_path\)/\1context.\2/g Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 2a1c828d..7864489d 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -47,7 +47,7 @@ class ConfigInstall(object): remote_copy=self.context.remote_copy) self.explorer = cdist.explorer.Explorer(self.context) - self.manifest = cdist.manifest.Mamifest() + #self.manifest = cdist.manifest.Mamifest() self.log = logging.getLogger(self.context.target_host) @@ -72,20 +72,20 @@ class ConfigInstall(object): os.mkdir(self.context.base_path) # FIXME: raise more beautiful exception / Steven: handle exception - os.mkdir(self.out_path) + os.mkdir(self.context.out_path) os.mkdir(self.global_explorer_out_path) - os.mkdir(self.bin_path) + os.mkdir(self.context.bin_path) # FIXME: remove this function, only expose ENV # explicitly! def __init_env(self): """Environment usable for other stuff""" os.environ['__target_host'] = self.context.target_host - if self.debug: + if self.context.debug: os.environ['__debug'] = "yes" def cleanup(self): - log.debug("Saving " + self.out_path + " to " + self.cache_path) + log.debug("Saving " + self.context.out_path + " to " + self.context.cache_path) if os.path.exists(self.context.cache_path): shutil.rmtree(self.context.cache_path) shutil.move(self.context.out_path, self.context.cache_path) @@ -116,7 +116,7 @@ class ConfigInstall(object): # env = os.environ.copy() env['__target_host'] = self.context.target_host - env['__global'] = self.out_path + env['__global'] = self.context.out_path env["__object"] = os.path.join(self.object_base_path, cdist_object.path) env["__object_id"] = cdist_object.object_id env["__object_fq"] = cdist_object.name @@ -162,16 +162,16 @@ class ConfigInstall(object): remote_remote_code = os.path.join(self.remote_object_path, cdist_object.code_remote_path) if os.path.isfile(local_remote_code): - self.transfer_path(local_remote_code, remote_remote_code) + self.context.transfer_path(local_remote_code, remote_remote_code) cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) cdist_object.ran = True def link_emulator(self): """Link emulator to types""" - src = os.path.abspath(self.exec_path) + src = os.path.abspath(self.context.exec_path) for cdist_type in cdist.core.Type.list_types(self.type_base_path): - dst = os.path.join(self.bin_path, cdist_type.name) + dst = os.path.join(self.context.bin_path, cdist_type.name) log.debug("Linking emulator: %s to %s", src, dst) # FIXME: handle exception / make it more beautiful / Steven: raise except :-) From dc9092dbef79ef1b4afbd5989e61ccb912d6f6be Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 11 Oct 2011 16:56:59 +0200 Subject: [PATCH 0639/1024] --os.environ Signed-off-by: Steven Armstrong --- lib/cdist/exec.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index 13cec499..a2282347 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -20,7 +20,6 @@ # import logging -import os import subprocess import cdist @@ -44,7 +43,7 @@ class Wrapper(object): def transfer_path(self, source, destination): """Transfer directory and previously delete the remote destination""" self.remove_remote_path(destination) - self.run_or_fail(os.environ['__remote_copy'].split() + + self.run_or_fail(self.remote_copy.split() + ["-r", source, self.target_host + ":" + destination]) def shell_run_or_debug_fail(self, script, *args, remote=False, **kargs): From f0852209f01642bea546aeacb9c816890597a195 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:59:22 +0200 Subject: [PATCH 0640/1024] save debug in context Signed-off-by: Nico Schottelius --- lib/cdist/context.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 7bb700e8..f70e9752 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -41,6 +41,8 @@ class Context(object): exec_path=sys.argv[0], debug=False): + self.debug = debug + self.target_host = target_host # Only required for testing From d95d195b4063b4d7b6806c66c3df5ac34db6dda1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 16:59:43 +0200 Subject: [PATCH 0641/1024] have object seave its explorer outputs Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 7864489d..f9aeaf19 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -93,8 +93,9 @@ class ConfigInstall(object): def object_prepare(self, cdist_object): """Prepare object: Run type explorer + manifest""" log.debug("Preparing object: " + cdist_object.name) - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) + cdist_object.explorers = + self.explorer.run_type_explorer(cdist_object) + self.manifest.run_type_manifest(cdist_object) cdist_object.prepared = True def object_run(self, cdist_object): From b7824c3ead3dfcab89ab6105aaa35b85f94c358c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 17:05:35 +0200 Subject: [PATCH 0642/1024] move explorer out dir creation into Explorer class Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 4 +--- lib/cdist/explorer.py | 9 +++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index f9aeaf19..3c809331 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -73,7 +73,6 @@ class ConfigInstall(object): # FIXME: raise more beautiful exception / Steven: handle exception os.mkdir(self.context.out_path) - os.mkdir(self.global_explorer_out_path) os.mkdir(self.context.bin_path) # FIXME: remove this function, only expose ENV @@ -93,8 +92,7 @@ class ConfigInstall(object): def object_prepare(self, cdist_object): """Prepare object: Run type explorer + manifest""" log.debug("Preparing object: " + cdist_object.name) - cdist_object.explorers = - self.explorer.run_type_explorer(cdist_object) + cdist_object.explorers = self.explorer.run_type_explorer(cdist_object) self.manifest.run_type_manifest(cdist_object) cdist_object.prepared = True diff --git a/lib/cdist/explorer.py b/lib/cdist/explorer.py index b0db60bc..9030e506 100644 --- a/lib/cdist/explorer.py +++ b/lib/cdist/explorer.py @@ -22,16 +22,17 @@ import io import logging -#import os +import os #import stat #import shutil #import sys #import tempfile #import time # -#import cdist.core #import cdist.exec +import cdist + log = logging.getLogger(__name__) class Explorer: @@ -39,6 +40,10 @@ class Explorer: def __init__(self, context): self.context = context + try: + os.mkdir(self.context.global_explorer_out_path) + except OSError as e: + raise cdist.Error("Failed to create explorer out path: %s" % e) def run_type_explorer(self, cdist_object): """Run type specific explorers for objects""" From 9f49f99294bb6f2579b4f3d4e0c6d68c6ce4358d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Oct 2011 17:09:47 +0200 Subject: [PATCH 0643/1024] use self.log for correct logger Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 41 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3c809331..152d6c4a 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -40,12 +40,16 @@ class ConfigInstall(object): def __init__(self, context): self.context = context - + self.log = logging.getLogger(self.context.target_host) self.exec_wrapper = cdist.exec.Wrapper( target_host = self.context.target_host, remote_exec=self.context.remote_exec, remote_copy=self.context.remote_copy) + # Create directories other may depend on + self.__init_local_paths() + self.__init_remote_paths() + self.explorer = cdist.explorer.Explorer(self.context) #self.manifest = cdist.manifest.Mamifest() @@ -54,9 +58,6 @@ class ConfigInstall(object): # Setup env to be used by others - FIXME self.__init_env() - # Create directories - self.__init_local_paths() - self.__init_remote_paths() def __init_remote_paths(self): """Initialise remote directory structure""" @@ -84,21 +85,21 @@ class ConfigInstall(object): os.environ['__debug'] = "yes" def cleanup(self): - log.debug("Saving " + self.context.out_path + " to " + self.context.cache_path) + self.log.debug("Saving " + self.context.out_path + " to " + self.context.cache_path) if os.path.exists(self.context.cache_path): shutil.rmtree(self.context.cache_path) shutil.move(self.context.out_path, self.context.cache_path) def object_prepare(self, cdist_object): """Prepare object: Run type explorer + manifest""" - log.debug("Preparing object: " + cdist_object.name) + self.log.debug("Preparing object: " + cdist_object.name) cdist_object.explorers = self.explorer.run_type_explorer(cdist_object) self.manifest.run_type_manifest(cdist_object) cdist_object.prepared = True def object_run(self, cdist_object): """Run gencode and code for an object""" - log.debug("Running object %s", cdist_object) + self.log.debug("Running object %s", cdist_object) # Catch requirements, which re-call us if cdist_object.ran: @@ -107,7 +108,7 @@ class ConfigInstall(object): cdist_type = cdist_object.type for requirement in cdist_object.requirements: - log.debug("Object %s requires %s", cdist_object, requirement) + self.log.debug("Object %s requires %s", cdist_object, requirement) self.object_run(requirement) # @@ -123,7 +124,7 @@ class ConfigInstall(object): # gencode for cmd in ["local", "remote"]: - bin = os.path.join(self.type_base_path, + bin = os.path.join(self.context.type_base_path, getattr(cdist_type, "gencode_" + cmd + "_path")) if os.path.isfile(bin): @@ -169,16 +170,16 @@ class ConfigInstall(object): def link_emulator(self): """Link emulator to types""" src = os.path.abspath(self.context.exec_path) - for cdist_type in cdist.core.Type.list_types(self.type_base_path): + for cdist_type in cdist.core.Type.list_types(self.context.type_base_path): dst = os.path.join(self.context.bin_path, cdist_type.name) - log.debug("Linking emulator: %s to %s", src, dst) + self.log.debug("Linking emulator: %s to %s", src, dst) # FIXME: handle exception / make it more beautiful / Steven: raise except :-) os.symlink(src, dst) def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.context.target_host) + self.log.info("Deploying to " + self.context.target_host) self.stage_prepare() self.stage_run() @@ -187,25 +188,25 @@ class ConfigInstall(object): start_time = time.time() self.deploy_to() self.cleanup() - log.info("Finished run of %s in %s seconds", + self.log.info("Finished run of %s in %s seconds", self.context.target_host, time.time() - start_time) def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" self.link_emulator() - self.run_global_explorers() + self.explorer.run_global_explorers() self.run_initial_manifest() - log.info("Running object manifests and type explorers") + self.log.info("Running object manifests and type explorers") # Continue process until no new objects are created anymore new_objects_created = True while new_objects_created: new_objects_created = False for cdist_object in cdist.core.Object.list_objects(self.object_base_path, - self.type_base_path): + self.context.type_base_path): if cdist_object.prepared: - log.debug("Skipping rerun of object %s", cdist_object) + self.log.debug("Skipping rerun of object %s", cdist_object) continue else: self.object_prepare(cdist_object) @@ -213,8 +214,8 @@ class ConfigInstall(object): def stage_run(self): """The final (and real) step of deployment""" - log.info("Generating and executing code") + self.log.info("Generating and executing code") for cdist_object in cdist.core.Object.list_objects(self.object_base_path, - self.type_base_path): - log.debug("Run object: %s", cdist_object) + self.context.type_base_path): + self.log.debug("Run object: %s", cdist_object) self.object_run(cdist_object) From c8522af0d0ce7bdbe90131bc929ff8d3916f5c8f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 12:29:20 +0200 Subject: [PATCH 0644/1024] ++todo today Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-12 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/dev/logs/2011-10-12 diff --git a/doc/dev/logs/2011-10-12 b/doc/dev/logs/2011-10-12 new file mode 100644 index 00000000..22caf05e --- /dev/null +++ b/doc/dev/logs/2011-10-12 @@ -0,0 +1,8 @@ +Todo today + tests: + +- explorer (nico) + - create env here +- exec -> local+remote (steven) +- make configinstall work again (nico) +- make manifest work (steven) + - create env here From 7da3a3c30552db6359abc5771a3260bceecdcb1a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 14:30:10 +0200 Subject: [PATCH 0645/1024] remote code execution and tests Signed-off-by: Steven Armstrong --- lib/cdist/exec/__init__.py | 0 lib/cdist/exec/remote.py | 132 +++++++++++++++++++++++++++++ lib/cdist/test/exec/__init__.py | 0 lib/cdist/test/exec/test_remote.py | 111 ++++++++++++++++++++++++ 4 files changed, 243 insertions(+) create mode 100644 lib/cdist/exec/__init__.py create mode 100644 lib/cdist/exec/remote.py create mode 100644 lib/cdist/test/exec/__init__.py create mode 100644 lib/cdist/test/exec/test_remote.py diff --git a/lib/cdist/exec/__init__.py b/lib/cdist/exec/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py new file mode 100644 index 00000000..a5ad0845 --- /dev/null +++ b/lib/cdist/exec/remote.py @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 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 . +# +# + +import io +import os +import sys +import subprocess +import logging + +import cdist + + +class RemoteScriptError(cdist.Error): + def __init__(self, script, command, script_content): + self.script = script + self.command = command + self.script_content = script_content + + def __str__(self): + return "Remote script execution failed: %s %s" % (self.script, self.command) + + +class Remote(object): + """Execute commands remotely. + + All interaction with the remote side should be done through this class. + Directly accessing the remote side from python code is a bug. + + """ + def __init__(self, target_host, remote_base_path, remote_exec, remote_copy): + self.target_host = target_host + self.base_path = remote_base_path + self._exec = remote_exec + self._copy = remote_copy + + self.conf_path = os.path.join(self.base_path, "conf") + self.object_path = os.path.join(self.base_path, "object") + + self.type_path = os.path.join(self.conf_path, "type") + self.global_explorer_path = os.path.join(self.conf_path, "explorer") + + self.log = logging.getLogger(self.target_host) + + def create_directories(self): + self.rmdir(self.base_path) + self.mkdir(self.base_path) + self.mkdir(self.conf_path) + + def rmdir(self, path): + """Remove directory on the remote side.""" + self.log.debug("Remote rmdir: %s", path) + self.run(["rm", "-rf", path]) + + def mkdir(self, path): + """Create directory on the remote side.""" + self.log.debug("Remote mkdir: %s", path) + self.run(["mkdir", "-p", path]) + + def transfer(self, source, destination): + """Transfer a file or directory to the remote side.""" + self.log.debug("Remote transfer: %s -> %s", source, destination) + self.rmdir(destination) + command = self._copy.split() + command.extend(["-r", source, self.target_host + ":" + destination]) + self.run_command(command) + + def run(self, command, env=None): + """Run the given command with the given environment on the remote side. + Return the output as a string. + + """ + # prefix given command with remote_exec + cmd = self._exec.split() + cmd.append(self.target_host) + cmd.extend(command) + return self.run_command(cmd, env=None) + + def run_command(self, command, env=None): + """Run the given command with the given environment. + Return the output as a string. + + """ + assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command + self.log.debug("Remote run: %s", command) + try: + return subprocess.check_output(command, env=env) + except subprocess.CalledProcessError: + raise cdist.Error("Command failed: " + " ".join(command)) + except OSError as error: + raise cdist.Error(" ".join(*args) + ": " + error.args[1]) + + def run_script(self, script, env=None): + """Run the given script with the given environment on the remote side. + Return the output as a string. + + """ + command = self._exec.split() + command.append(self.target_host) + command.extend(["/bin/sh", "-e"]) + command.append(script) + + self.log.debug("Remote run script: %s", command) + if env: + self.log.debug("Remote run script env: %s", env) + + try: + return subprocess.check_output(command, env=env) + except subprocess.CalledProcessError as error: + script_content = self.run(["cat", script]) + self.log.error("Code that raised the error:\n%s", script_content) + raise RemoteScriptError(script, command, script_content) + except EnvironmentError as error: + raise cdist.Error(" ".join(command) + ": " + error.args[1]) diff --git a/lib/cdist/test/exec/__init__.py b/lib/cdist/test/exec/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/exec/test_remote.py b/lib/cdist/test/exec/test_remote.py new file mode 100644 index 00000000..ae5e7aed --- /dev/null +++ b/lib/cdist/test/exec/test_remote.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import unittest +import os +import tempfile +import getpass +import shutil +import string +import random + +import cdist +from cdist.exec import remote + + +class RemoteTestCase(unittest.TestCase): + + def mkdtemp(self, **kwargs): + return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) + + def mkstemp(self, **kwargs): + return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) + + def setUp(self): + self.temp_dir = self.mkdtemp() + target_host = 'localhost' + remote_base_path = self.temp_dir + user = getpass.getuser() + remote_exec = "ssh -o User=%s -q" % user + remote_copy = "scp -o User=%s -q" % user + self.remote = remote.Remote(target_host, remote_base_path, remote_exec, remote_copy) + + def tearDown(self): + shutil.rmtree(self.temp_dir) + + def test_run_success(self): + self.remote.run(['/bin/true']) + + def test_run_fail(self): + self.assertRaises(cdist.Error, self.remote.run, ['/bin/false']) + + def test_run_script_success(self): + handle, script = self.mkstemp(dir=self.temp_dir) + fd = open(script, "w") + fd.writelines(["#!/bin/sh\n", "/bin/true"]) + fd.close() + self.remote.run_script(script) + + def test_run_script_fail(self): + handle, script = self.mkstemp(dir=self.temp_dir) + fd = open(script, "w") + fd.writelines(["#!/bin/sh\n", "/bin/false"]) + fd.close() + self.assertRaises(remote.RemoteScriptError, self.remote.run_script, script) + + def test_run_script_get_output(self): + handle, script = self.mkstemp(dir=self.temp_dir) + fd = open(script, "w") + fd.writelines(["#!/bin/sh\n", "echo foobar"]) + fd.close() + self.assertEqual(self.remote.run_script(script), b"foobar\n") + + def test_mkdir(self): + temp_dir = self.mkdtemp(dir=self.temp_dir) + os.rmdir(temp_dir) + self.remote.mkdir(temp_dir) + self.assertTrue(os.path.isdir(temp_dir)) + + def test_rmdir(self): + temp_dir = self.mkdtemp(dir=self.temp_dir) + self.remote.rmdir(temp_dir) + self.assertFalse(os.path.isdir(temp_dir)) + + def test_transfer_file(self): + handle, source = self.mkstemp(dir=self.temp_dir) + target = self.mkdtemp(dir=self.temp_dir) + self.remote.transfer(source, target) + self.assertTrue(os.path.isfile(target)) + + def test_transfer_dir(self): + source = self.mkdtemp(dir=self.temp_dir) + # put a file in the directory as payload + handle, source_file = self.mkstemp(dir=source) + source_file_name = os.path.split(source_file)[-1] + target = self.mkdtemp(dir=self.temp_dir) + self.remote.transfer(source, target) + # test if the payload file is in the target directory + self.assertTrue(os.path.isfile(os.path.join(target, source_file_name))) + + def test_create_directories(self): + self.remote.create_directories() + self.assertTrue(os.path.isdir(self.remote.base_path)) + self.assertTrue(os.path.isdir(self.remote.conf_path)) From 84e044407e036aa7747a82a0af5f4556f5d69163 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 15:16:33 +0200 Subject: [PATCH 0646/1024] +FIXME Signed-off-by: Steven Armstrong --- lib/cdist/exec/remote.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index a5ad0845..6ec9c46f 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -20,6 +20,8 @@ # # +# FIXME: common base class with Local? + import io import os import sys From 985ed2669a7aae0acd6e6bd6f7b136251a96d328 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 15:17:06 +0200 Subject: [PATCH 0647/1024] local code execution and tests Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 118 ++++++++++++++++++++++++++++++ lib/cdist/test/exec/test_local.py | 102 ++++++++++++++++++++++++++ 2 files changed, 220 insertions(+) create mode 100644 lib/cdist/exec/local.py create mode 100644 lib/cdist/test/exec/test_local.py diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py new file mode 100644 index 00000000..b9c511f4 --- /dev/null +++ b/lib/cdist/exec/local.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 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 . +# +# + +import io +import os +import sys +import subprocess +import shutil +import logging + +import cdist + + +class LocalScriptError(cdist.Error): + def __init__(self, script, command, script_content): + self.script = script + self.command = command + self.script_content = script_content + + def __str__(self): + return "Remote script execution failed: %s %s" % (self.script, self.command) + + +class Local(object): + """Execute commands locally. + + All interaction with the local side should be done through this class. + Directly accessing the local side from python code is a bug. + + """ + def __init__(self, target_host, local_base_path, out_path): + 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_base_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_base_path = os.path.join(self.out_path, "object") + + self.log = logging.getLogger(self.target_host) + + def create_directories(self): + self.mkdir(self.out_path) + self.mkdir(self.bin_path) + + def rmdir(self, path): + """Remove directory on the local side.""" + self.log.debug("Local rmdir: %s", path) + shutil.rmtree(path) + + def mkdir(self, path): + """Create directory on the local side.""" + self.log.debug("Local mkdir: %s", path) + os.makedirs(path, mode=0o700, exist_ok=True) + + def run(self, command, env=None): + """Run the given command with the given environment. + Return the output as a string. + + """ + assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command + self.log.debug("Local run: %s", command) + try: + return subprocess.check_output(command, env=env) + except subprocess.CalledProcessError: + raise cdist.Error("Command failed: " + " ".join(command)) + except OSError as error: + raise cdist.Error(" ".join(*args) + ": " + error.args[1]) + + def run_script(self, script, env=None): + """Run the given script with the given environment. + Return the output as a string. + + """ + command = ["/bin/sh", "-e"] + command.append(script) + + self.log.debug("Local run script: %s", command) + if env: + self.log.debug("Local run script env: %s", env) + + try: + return subprocess.check_output(command, env=env) + except subprocess.CalledProcessError as error: + script_content = self.run(["cat", script]) + self.log.error("Code that raised the error:\n%s", script_content) + raise LocalScriptError(script, command, script_content) + except EnvironmentError as error: + raise cdist.Error(" ".join(command) + ": " + error.args[1]) diff --git a/lib/cdist/test/exec/test_local.py b/lib/cdist/test/exec/test_local.py new file mode 100644 index 00000000..2c021404 --- /dev/null +++ b/lib/cdist/test/exec/test_local.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import unittest +import os +import tempfile +import getpass +import shutil +import string +import random + +#import logging +#logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s') + +import cdist +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 + + +class LocalTestCase(unittest.TestCase): + + def mkdtemp(self, **kwargs): + return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) + + def mkstemp(self, **kwargs): + return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) + + def setUp(self): + self.temp_dir = self.mkdtemp() + target_host = 'localhost' + out_path = self.temp_dir + self.local = local.Local(target_host, local_base_path, out_path) + + def tearDown(self): + #shutil.rmtree(self.temp_dir) + pass + + def test_run_success(self): + self.local.run(['/bin/true']) + + def test_run_fail(self): + self.assertRaises(cdist.Error, self.local.run, ['/bin/false']) + + def test_run_script_success(self): + handle, script = self.mkstemp(dir=self.temp_dir) + fd = open(script, "w") + fd.writelines(["#!/bin/sh\n", "/bin/true"]) + fd.close() + self.local.run_script(script) + + def test_run_script_fail(self): + handle, script = self.mkstemp(dir=self.temp_dir) + fd = open(script, "w") + fd.writelines(["#!/bin/sh\n", "/bin/false"]) + fd.close() + self.assertRaises(local.LocalScriptError, self.local.run_script, script) + + def test_run_script_get_output(self): + handle, script = self.mkstemp(dir=self.temp_dir) + fd = open(script, "w") + fd.writelines(["#!/bin/sh\n", "echo foobar"]) + fd.close() + self.assertEqual(self.local.run_script(script), b"foobar\n") + + def test_mkdir(self): + temp_dir = self.mkdtemp(dir=self.temp_dir) + os.rmdir(temp_dir) + self.local.mkdir(temp_dir) + self.assertTrue(os.path.isdir(temp_dir)) + + def test_rmdir(self): + temp_dir = self.mkdtemp(dir=self.temp_dir) + self.local.rmdir(temp_dir) + self.assertFalse(os.path.isdir(temp_dir)) + + def test_create_directories(self): + self.local.create_directories() + print('self.local.bin_path: %s' % self.local.bin_path) + self.assertTrue(os.path.isdir(self.local.out_path)) + self.assertTrue(os.path.isdir(self.local.bin_path)) From 424c06093415d06a20a5a3c2b47fb09d5a0fef6e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 15:21:25 +0200 Subject: [PATCH 0648/1024] +FIXME Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index b9c511f4..18454b8f 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -20,6 +20,8 @@ # # +# FIXME: common base class with Remote? + import io import os import sys From 117ccf94d311d618b08932c2c485af41151a889a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 16:13:22 +0200 Subject: [PATCH 0649/1024] --debug Signed-off-by: Steven Armstrong --- lib/cdist/test/exec/test_local.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/cdist/test/exec/test_local.py b/lib/cdist/test/exec/test_local.py index 2c021404..40611a0b 100644 --- a/lib/cdist/test/exec/test_local.py +++ b/lib/cdist/test/exec/test_local.py @@ -54,8 +54,7 @@ class LocalTestCase(unittest.TestCase): self.local = local.Local(target_host, local_base_path, out_path) def tearDown(self): - #shutil.rmtree(self.temp_dir) - pass + shutil.rmtree(self.temp_dir) def test_run_success(self): self.local.run(['/bin/true']) From 5f358a5ef124bacbed18ab046b8ea4c3ee22d274 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 16:46:54 +0200 Subject: [PATCH 0650/1024] move link_emulator to local Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index 18454b8f..aec65e68 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -30,6 +30,7 @@ import shutil import logging import cdist +from cdist import core class LocalScriptError(cdist.Error): @@ -118,3 +119,13 @@ class Local(object): raise LocalScriptError(script, command, script_content) except EnvironmentError as error: raise cdist.Error(" ".join(command) + ": " + error.args[1]) + + def link_emulator(self, exec_path): + """Link emulator to types""" + src = os.path.abspath(exec_path) + for cdist_type in core.Type.list_types(self.type_base_path): + dst = os.path.join(self.bin_path, cdist_type.name) + self.log.debug("Linking emulator: %s to %s", src, dst) + + # FIXME: handle exceptions + os.symlink(src, dst) From d2878e931ed572820da507b17761a03ad82a97ed Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 16:50:21 +0200 Subject: [PATCH 0651/1024] /Remote/Local/ Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index aec65e68..b346bf7d 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -40,7 +40,7 @@ class LocalScriptError(cdist.Error): self.script_content = script_content def __str__(self): - return "Remote script execution failed: %s %s" % (self.script, self.command) + return "Local script execution failed: %s %s" % (self.script, self.command) class Local(object): From 78fd611bb02faa5d552bf4efbf94f7ed6f0e67bb Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 16:56:16 +0200 Subject: [PATCH 0652/1024] fix cdist_base_path Signed-off-by: Steven Armstrong --- lib/cdist/test/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/test/__init__.py b/lib/cdist/test/__init__.py index 06c87917..2f88bf7e 100644 --- a/lib/cdist/test/__init__.py +++ b/lib/cdist/test/__init__.py @@ -28,7 +28,7 @@ import unittest cdist_commands=["banner", "config", "install"] 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") From e8f7fe3faae1551b37baebc343fc6e862538e7fe Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 16:59:02 +0200 Subject: [PATCH 0653/1024] intermediate commit for cdist state Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 3 +++ lib/cdist/explorer.py | 47 ++++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 152d6c4a..ad748f0b 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -53,6 +53,9 @@ class ConfigInstall(object): self.explorer = cdist.explorer.Explorer(self.context) #self.manifest = cdist.manifest.Mamifest() + self.manifest.initial_manifest() + self.manifest.type_manifest(cdist_object) + self.log = logging.getLogger(self.context.target_host) # Setup env to be used by others - FIXME diff --git a/lib/cdist/explorer.py b/lib/cdist/explorer.py index 9030e506..46139ece 100644 --- a/lib/cdist/explorer.py +++ b/lib/cdist/explorer.py @@ -40,11 +40,33 @@ class Explorer: def __init__(self, context): self.context = context + + self.global_explorer_path = os.path.join(self.context.conf_path, "explorer") + + self. + try: os.mkdir(self.context.global_explorer_out_path) except OSError as e: raise cdist.Error("Failed to create explorer out path: %s" % e) + def run_global_explorers(self): + """Run global explorers""" + log.info("Running global explorers") + + src_path = self.context.global_explorer_path + dst_path = self.context.remote_global_explorer_path + + self.exec_wrapper.transfer_path(src_path, dst_path) + + outputs = {} + for explorer in os.listdir(src_path): + outputs[explorer] = io.StringIO() + cmd = [] + cmd.append("__explorer=" + remote_dst_path) + cmd.append(os.path.join(remote_dst_path, explorer)) + cdist.exec.run_or_fail(cmd, stdout=outputs[explorer], remote_prefix=True) + def run_type_explorer(self, cdist_object): """Run type specific explorers for objects""" @@ -52,12 +74,12 @@ class Explorer: self.transfer_type_explorers(cdist_type) cmd = [] - cmd.append("__explorer=" + self.remote_global_explorer_path) + cmd.append("__explorer=" + self.context.remote_global_explorer_path) cmd.append("__type_explorer=" + os.path.join( - self.remote_type_path, + self.context.remote_type_path, cdist_type.explorer_path)) cmd.append("__object=" + os.path.join( - self.remote_object_path, + self.context.remote_object_path, cdist_object.path)) cmd.append("__object_id=" + cdist_object.object_id) cmd.append("__object_fq=" + cdist_object.name) @@ -67,7 +89,7 @@ class Explorer: outputs = {} for explorer in cdist_type.explorers: - remote_cmd = cmd + [os.path.join(self.remote_type_path, + remote_cmd = cmd + [os.path.join(self.context.remote_type_path, cdist_type.explorer_path, explorer)] outputs[explorer] = io.StringIO() log.debug("%s exploring %s using %s storing to %s", @@ -77,23 +99,6 @@ class Explorer: return outputs - def run_global_explorers(self): - """Run global explorers""" - log.info("Running global explorers") - - src_path = self.global_explorer_path - dst_path = self.remote_global_explorer_path - - self.transfer_path(src_path, dst_path) - - outputs = {} - for explorer in os.listdir(src_path): - outputs[explorer] = io.StringIO() - cmd = [] - cmd.append("__explorer=" + remote_dst_path) - cmd.append(os.path.join(remote_dst_path, explorer)) - cdist.exec.run_or_fail(cmd, stdout=outputs[explorer], remote_prefix=True) - def transfer_object_parameter(self, cdist_object): """Transfer the object parameter to the remote destination""" src = os.path.join(self.object_base_path, From b8cbf22086e35da72dd5ecf575c4c407d2bfba5f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 17:00:00 +0200 Subject: [PATCH 0654/1024] add global and type explorer Signed-off-by: Nico Schottelius --- lib/cdist/{explorer.py => global_explorer.py} | 0 lib/cdist/type_explorer.py | 155 ++++++++++++++++++ 2 files changed, 155 insertions(+) rename lib/cdist/{explorer.py => global_explorer.py} (100%) create mode 100644 lib/cdist/type_explorer.py diff --git a/lib/cdist/explorer.py b/lib/cdist/global_explorer.py similarity index 100% rename from lib/cdist/explorer.py rename to lib/cdist/global_explorer.py diff --git a/lib/cdist/type_explorer.py b/lib/cdist/type_explorer.py new file mode 100644 index 00000000..46139ece --- /dev/null +++ b/lib/cdist/type_explorer.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import io +import logging +import os +#import stat +#import shutil +#import sys +#import tempfile +#import time +# +#import cdist.exec + +import cdist + +log = logging.getLogger(__name__) + +class Explorer: + """Execute explorers""" + + def __init__(self, context): + self.context = context + + self.global_explorer_path = os.path.join(self.context.conf_path, "explorer") + + self. + + try: + os.mkdir(self.context.global_explorer_out_path) + except OSError as e: + raise cdist.Error("Failed to create explorer out path: %s" % e) + + def run_global_explorers(self): + """Run global explorers""" + log.info("Running global explorers") + + src_path = self.context.global_explorer_path + dst_path = self.context.remote_global_explorer_path + + self.exec_wrapper.transfer_path(src_path, dst_path) + + outputs = {} + for explorer in os.listdir(src_path): + outputs[explorer] = io.StringIO() + cmd = [] + cmd.append("__explorer=" + remote_dst_path) + cmd.append(os.path.join(remote_dst_path, explorer)) + cdist.exec.run_or_fail(cmd, stdout=outputs[explorer], remote_prefix=True) + + def run_type_explorer(self, cdist_object): + """Run type specific explorers for objects""" + + cdist_type = cdist_object.type + self.transfer_type_explorers(cdist_type) + + cmd = [] + cmd.append("__explorer=" + self.context.remote_global_explorer_path) + cmd.append("__type_explorer=" + os.path.join( + self.context.remote_type_path, + cdist_type.explorer_path)) + cmd.append("__object=" + os.path.join( + self.context.remote_object_path, + cdist_object.path)) + cmd.append("__object_id=" + cdist_object.object_id) + cmd.append("__object_fq=" + cdist_object.name) + + # Need to transfer at least the parameters for objects to be useful + self.transfer_object_parameter(cdist_object) + + outputs = {} + for explorer in cdist_type.explorers: + remote_cmd = cmd + [os.path.join(self.context.remote_type_path, + cdist_type.explorer_path, explorer)] + outputs[explorer] = io.StringIO() + log.debug("%s exploring %s using %s storing to %s", + cdist_object, explorer, remote_cmd, output) + + cdist.exec.run_or_fail(remote_cmd, stdout=outputs[explorer], remote_prefix=True) + + return outputs + + def transfer_object_parameter(self, cdist_object): + """Transfer the object parameter to the remote destination""" + src = os.path.join(self.object_base_path, + cdist_object.parameter_path) + dst = os.path.join(self.remote_object_path, + cdist_object.parameter_path) + + # Synchronise parameter dir afterwards + self.remote_mkdir(dst) + self.transfer_path(src, dst) + + def transfer_global_explorers(self): + """Transfer the global explorers""" + self.remote_mkdir(self.remote_global_explorer_path) + self.transfer_path(self.global_explorer_path, + self.remote_global_explorer_path) + + def transfer_type_explorers(self, cdist_type): + """Transfer explorers of a type, but only once""" + if cdist_type.transferred_explorers: + log.debug("Skipping retransfer for explorers of %s", cdist_type) + return + else: + log.debug("Ensure no retransfer for %s", cdist_type) + # Do not retransfer + cdist_type.transferred_explorers = True + + explorers = cdist_type.explorers + + if len(explorers) > 0: + rel_path = cdist_type.explorer_path + src = os.path.join(self.type_base_path, rel_path) + dst = os.path.join(self.remote_type_path, rel_path) + + # Ensure full path until type exists: + # /var/lib/cdist/conf/type/__directory/explorer + # /var/lib/cdist/conf/type/__directory may not exist, + # but remote_mkdir uses -p to fix this + self.remote_mkdir(dst) + self.transfer_path(src, dst) + + def remote_mkdir(self, directory): + """Create directory on remote side""" + cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) + + def remove_remote_path(self, destination): + """Ensure path on remote side vanished""" + cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) + + def transfer_path(self, source, destination): + """Transfer directory and previously delete the remote destination""" + self.remove_remote_path(destination) + cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + + ["-r", source, self.target_host + ":" + destination]) From a254e1f31e5f34cc4944de922131688a692c0fd5 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 17:12:22 +0200 Subject: [PATCH 0655/1024] return output of command execution as string instead of bytestring Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 4 ++-- lib/cdist/exec/remote.py | 4 ++-- lib/cdist/test/exec/test_local.py | 2 +- lib/cdist/test/exec/test_remote.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index b346bf7d..521d56c3 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -93,7 +93,7 @@ class Local(object): assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command self.log.debug("Local run: %s", command) try: - return subprocess.check_output(command, env=env) + return subprocess.check_output(command, env=env).decode() except subprocess.CalledProcessError: raise cdist.Error("Command failed: " + " ".join(command)) except OSError as error: @@ -112,7 +112,7 @@ class Local(object): self.log.debug("Local run script env: %s", env) try: - return subprocess.check_output(command, env=env) + return subprocess.check_output(command, env=env).decode() except subprocess.CalledProcessError as error: script_content = self.run(["cat", script]) self.log.error("Code that raised the error:\n%s", script_content) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index 6ec9c46f..7821e993 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -104,7 +104,7 @@ class Remote(object): assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command self.log.debug("Remote run: %s", command) try: - return subprocess.check_output(command, env=env) + return subprocess.check_output(command, env=env).decode() except subprocess.CalledProcessError: raise cdist.Error("Command failed: " + " ".join(command)) except OSError as error: @@ -125,7 +125,7 @@ class Remote(object): self.log.debug("Remote run script env: %s", env) try: - return subprocess.check_output(command, env=env) + return subprocess.check_output(command, env=env).decode() except subprocess.CalledProcessError as error: script_content = self.run(["cat", script]) self.log.error("Code that raised the error:\n%s", script_content) diff --git a/lib/cdist/test/exec/test_local.py b/lib/cdist/test/exec/test_local.py index 40611a0b..b74f412e 100644 --- a/lib/cdist/test/exec/test_local.py +++ b/lib/cdist/test/exec/test_local.py @@ -81,7 +81,7 @@ class LocalTestCase(unittest.TestCase): fd = open(script, "w") fd.writelines(["#!/bin/sh\n", "echo foobar"]) fd.close() - self.assertEqual(self.local.run_script(script), b"foobar\n") + self.assertEqual(self.local.run_script(script), "foobar\n") def test_mkdir(self): temp_dir = self.mkdtemp(dir=self.temp_dir) diff --git a/lib/cdist/test/exec/test_remote.py b/lib/cdist/test/exec/test_remote.py index ae5e7aed..1fdb5833 100644 --- a/lib/cdist/test/exec/test_remote.py +++ b/lib/cdist/test/exec/test_remote.py @@ -76,7 +76,7 @@ class RemoteTestCase(unittest.TestCase): fd = open(script, "w") fd.writelines(["#!/bin/sh\n", "echo foobar"]) fd.close() - self.assertEqual(self.remote.run_script(script), b"foobar\n") + self.assertEqual(self.remote.run_script(script), "foobar\n") def test_mkdir(self): temp_dir = self.mkdtemp(dir=self.temp_dir) From 5df8479c5a6e69a85c59a923a435003c060cba4b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 17:20:47 +0200 Subject: [PATCH 0656/1024] implement Manifest and tests Signed-off-by: Steven Armstrong --- lib/cdist/core/manifest.py | 94 +++++++++++++++++++ lib/cdist/test/manifest/__init__.py | 87 +++++++++++++++++ .../fixtures/conf/manifest/dump_environment | 7 ++ .../test/manifest/fixtures/conf/manifest/init | 4 + .../manifest/fixtures/conf/type/__moon/.keep | 0 .../fixtures/conf/type/__moon/manifest | 8 ++ .../conf/type/__moon/parameter/optional | 1 + .../conf/type/__moon/parameter/required | 1 + .../fixtures/conf/type/__planet/.keep | 0 .../fixtures/conf/type/__planet/manifest | 8 ++ .../conf/type/__planet/parameter/optional | 1 + 11 files changed, 211 insertions(+) create mode 100644 lib/cdist/core/manifest.py create mode 100644 lib/cdist/test/manifest/__init__.py create mode 100755 lib/cdist/test/manifest/fixtures/conf/manifest/dump_environment create mode 100755 lib/cdist/test/manifest/fixtures/conf/manifest/init create mode 100644 lib/cdist/test/manifest/fixtures/conf/type/__moon/.keep create mode 100755 lib/cdist/test/manifest/fixtures/conf/type/__moon/manifest create mode 100644 lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/optional create mode 100644 lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/required create mode 100644 lib/cdist/test/manifest/fixtures/conf/type/__planet/.keep create mode 100755 lib/cdist/test/manifest/fixtures/conf/type/__planet/manifest create mode 100644 lib/cdist/test/manifest/fixtures/conf/type/__planet/parameter/optional diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py new file mode 100644 index 00000000..8f9fc7ae --- /dev/null +++ b/lib/cdist/core/manifest.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 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 . +# +# + +import logging +import os + +import cdist + +log = logging.getLogger(__name__) + + +''' +common: + runs only locally, does not need remote + + env: + PATH: prepend directory with type emulator symlinks == local.bin_path + __target_host: the target host we are working on + __global: full qualified path to the global output dir == local.out_path + __cdist_manifest: full qualified path of the manifest == script + __cdist_type_base_path: full qualified path to the directory where types are defined for use in type emulator + == local.type_base_path + +initial manifest is: + script: full qualified path to the initial manifest + + env: + __manifest: path to .../conf/manifest/ == local.manifest_path + + creates: new objects through type emulator + +type manifeste is: + script: full qualified path to the type manifest + + env: + __object: full qualified path to the object's dir + __object_id: the objects id + __object_fq: full qualified object id, iow: $type.name + / + object_id + __type: full qualified path to the type's dir + + creates: new objects through type emulator +''' + + +class Manifest(object): + """Represents a cdist manifest. + + """ + def __init__(self, target_host, local): + self.target_host = target_host + self.local = local + self.env = { + 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), + '__target_host': self.target_host, + '__global': self.local.out_path, + '__cdist_type_base_path': self.local.type_base_path, # for use in type emulator + } + + def run_initial_manifest(self, script): + env = os.environ.copy() + env.update(self.env) + env['__manifest'] = self.local.manifest_path + return self.local.run_script(script, env=env) + + def run_type_manifest(self, cdist_object): + env = os.environ.copy() + env.update(self.env) + env.update({ + '__object': cdist_object.absolute_path, + '__object_id': cdist_object.object_id, + '__object_fq': cdist_object.path, + '__type': cdist_object.type.absolute_path, + }) + script = os.path.join(self.local.type_base_path, cdist_object.type.manifest_path) + return self.local.run_script(script, env=env) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py new file mode 100644 index 00000000..8fcb5d79 --- /dev/null +++ b/lib/cdist/test/manifest/__init__.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import unittest +import os +import tempfile +import getpass +import shutil +import string +import random + +#import logging +#logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s') + +import cdist +from cdist.exec import local +from cdist import core +from cdist.core import manifest + +import os.path as op +my_dir = op.abspath(op.dirname(__file__)) +fixtures = op.join(my_dir, 'fixtures') +local_base_path = fixtures + + +class ManifestTestCase(unittest.TestCase): + + def mkdtemp(self, **kwargs): + return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) + + def mkstemp(self, **kwargs): + return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) + + def setUp(self): + self.temp_dir = self.mkdtemp() + target_host = 'localhost' + out_path = self.temp_dir + self.local = local.Local(target_host, local_base_path, out_path) + self.local.create_directories() + self.local.link_emulator(cdist.test.cdist_exec_path) + self.manifest = manifest.Manifest(target_host, self.local) + + def tearDown(self): + #shutil.rmtree(self.temp_dir) + pass + + def test_initial_manifest_environment(self): + #initial_manifest = os.path.join(self.local.manifest_path, "init") + initial_manifest = os.path.join(self.local.manifest_path, "dump_environment") + output_string = self.manifest.run_initial_manifest(initial_manifest) + output_dict = {} + for line in output_string.split('\n'): + if line: + key,value = line.split(': ') + output_dict[key] = value + self.assertTrue(output_dict['PATH'].startswith(self.local.bin_path)) + self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__global'], self.local.out_path) + self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_base_path) + self.assertEqual(output_dict['__manifest'], self.local.manifest_path) + + +# for line in output.split('\n'): +# print(line) + +# def test_type_manifest(self): +# cdist_type = core.Type(self.local.type_base_path, '__moon') +# cdist_object = core.Object(cdist_type, self.local.object_base_path, 'Saturn') +# self.manifest.run_type_manifest(cdist_object) diff --git a/lib/cdist/test/manifest/fixtures/conf/manifest/dump_environment b/lib/cdist/test/manifest/fixtures/conf/manifest/dump_environment new file mode 100755 index 00000000..1abe7755 --- /dev/null +++ b/lib/cdist/test/manifest/fixtures/conf/manifest/dump_environment @@ -0,0 +1,7 @@ +#!/bin/sh + +echo "PATH: $PATH" +echo "__target_host: $__target_host" +echo "__global: $__global" +echo "__cdist_type_base_path: $__cdist_type_base_path" +echo "__manifest: $__manifest" diff --git a/lib/cdist/test/manifest/fixtures/conf/manifest/init b/lib/cdist/test/manifest/fixtures/conf/manifest/init new file mode 100755 index 00000000..0bdb391a --- /dev/null +++ b/lib/cdist/test/manifest/fixtures/conf/manifest/init @@ -0,0 +1,4 @@ +#!/bin/sh + +__planet Saturn +__moon Prometheus --planet Saturn diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__moon/.keep b/lib/cdist/test/manifest/fixtures/conf/type/__moon/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__moon/manifest b/lib/cdist/test/manifest/fixtures/conf/type/__moon/manifest new file mode 100755 index 00000000..362be5a1 --- /dev/null +++ b/lib/cdist/test/manifest/fixtures/conf/type/__moon/manifest @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ -f "$__object/parameter/name" ]; then + name="(cat "$__object/parameter/name")" +else + name="$__object_id" + echo "$name" > "$__object/parameter/name" +fi diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/optional b/lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/optional new file mode 100644 index 00000000..f121bdbf --- /dev/null +++ b/lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/optional @@ -0,0 +1 @@ +name diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/required b/lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/required new file mode 100644 index 00000000..729a5167 --- /dev/null +++ b/lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/required @@ -0,0 +1 @@ +planet diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__planet/.keep b/lib/cdist/test/manifest/fixtures/conf/type/__planet/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__planet/manifest b/lib/cdist/test/manifest/fixtures/conf/type/__planet/manifest new file mode 100755 index 00000000..362be5a1 --- /dev/null +++ b/lib/cdist/test/manifest/fixtures/conf/type/__planet/manifest @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ -f "$__object/parameter/name" ]; then + name="(cat "$__object/parameter/name")" +else + name="$__object_id" + echo "$name" > "$__object/parameter/name" +fi diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__planet/parameter/optional b/lib/cdist/test/manifest/fixtures/conf/type/__planet/parameter/optional new file mode 100644 index 00000000..f121bdbf --- /dev/null +++ b/lib/cdist/test/manifest/fixtures/conf/type/__planet/parameter/optional @@ -0,0 +1 @@ +name From d93d132c05a89e36afc5dde8bea2d122f0a7d6bf Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 17:27:21 +0200 Subject: [PATCH 0657/1024] finish global_explorer (in theory) Signed-off-by: Nico Schottelius --- lib/cdist/global_explorer.py | 104 ++--------------------------------- 1 file changed, 6 insertions(+), 98 deletions(-) diff --git a/lib/cdist/global_explorer.py b/lib/cdist/global_explorer.py index 46139ece..9929cfd6 100644 --- a/lib/cdist/global_explorer.py +++ b/lib/cdist/global_explorer.py @@ -35,30 +35,19 @@ import cdist log = logging.getLogger(__name__) -class Explorer: +class GlobalExplorer: """Execute explorers""" - def __init__(self, context): + def __init__(self, local_path, remote_path): self.context = context - self.global_explorer_path = os.path.join(self.context.conf_path, "explorer") + self.local_path = local_path + self.remote_path = remote_path - self. - - try: - os.mkdir(self.context.global_explorer_out_path) - except OSError as e: - raise cdist.Error("Failed to create explorer out path: %s" % e) - - def run_global_explorers(self): + def run(self): """Run global explorers""" log.info("Running global explorers") - src_path = self.context.global_explorer_path - dst_path = self.context.remote_global_explorer_path - - self.exec_wrapper.transfer_path(src_path, dst_path) - outputs = {} for explorer in os.listdir(src_path): outputs[explorer] = io.StringIO() @@ -67,89 +56,8 @@ class Explorer: cmd.append(os.path.join(remote_dst_path, explorer)) cdist.exec.run_or_fail(cmd, stdout=outputs[explorer], remote_prefix=True) - def run_type_explorer(self, cdist_object): - """Run type specific explorers for objects""" - - cdist_type = cdist_object.type - self.transfer_type_explorers(cdist_type) - - cmd = [] - cmd.append("__explorer=" + self.context.remote_global_explorer_path) - cmd.append("__type_explorer=" + os.path.join( - self.context.remote_type_path, - cdist_type.explorer_path)) - cmd.append("__object=" + os.path.join( - self.context.remote_object_path, - cdist_object.path)) - cmd.append("__object_id=" + cdist_object.object_id) - cmd.append("__object_fq=" + cdist_object.name) - - # Need to transfer at least the parameters for objects to be useful - self.transfer_object_parameter(cdist_object) - - outputs = {} - for explorer in cdist_type.explorers: - remote_cmd = cmd + [os.path.join(self.context.remote_type_path, - cdist_type.explorer_path, explorer)] - outputs[explorer] = io.StringIO() - log.debug("%s exploring %s using %s storing to %s", - cdist_object, explorer, remote_cmd, output) - - cdist.exec.run_or_fail(remote_cmd, stdout=outputs[explorer], remote_prefix=True) - - return outputs - - def transfer_object_parameter(self, cdist_object): - """Transfer the object parameter to the remote destination""" - src = os.path.join(self.object_base_path, - cdist_object.parameter_path) - dst = os.path.join(self.remote_object_path, - cdist_object.parameter_path) - - # Synchronise parameter dir afterwards - self.remote_mkdir(dst) - self.transfer_path(src, dst) - - def transfer_global_explorers(self): + def transfer(self): """Transfer the global explorers""" self.remote_mkdir(self.remote_global_explorer_path) self.transfer_path(self.global_explorer_path, self.remote_global_explorer_path) - - def transfer_type_explorers(self, cdist_type): - """Transfer explorers of a type, but only once""" - if cdist_type.transferred_explorers: - log.debug("Skipping retransfer for explorers of %s", cdist_type) - return - else: - log.debug("Ensure no retransfer for %s", cdist_type) - # Do not retransfer - cdist_type.transferred_explorers = True - - explorers = cdist_type.explorers - - if len(explorers) > 0: - rel_path = cdist_type.explorer_path - src = os.path.join(self.type_base_path, rel_path) - dst = os.path.join(self.remote_type_path, rel_path) - - # Ensure full path until type exists: - # /var/lib/cdist/conf/type/__directory/explorer - # /var/lib/cdist/conf/type/__directory may not exist, - # but remote_mkdir uses -p to fix this - self.remote_mkdir(dst) - self.transfer_path(src, dst) - - def remote_mkdir(self, directory): - """Create directory on remote side""" - cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) - - def remove_remote_path(self, destination): - """Ensure path on remote side vanished""" - cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) - - def transfer_path(self, source, destination): - """Transfer directory and previously delete the remote destination""" - self.remove_remote_path(destination) - cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + - ["-r", source, self.target_host + ":" + destination]) From 1aa2c48baf94b17c148d1671be4e86f384b0ffcb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 17:36:00 +0200 Subject: [PATCH 0658/1024] new style classes Signed-off-by: Nico Schottelius --- lib/cdist/global_explorer.py | 4 +--- lib/cdist/type_explorer.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/cdist/global_explorer.py b/lib/cdist/global_explorer.py index 9929cfd6..8a9b8c73 100644 --- a/lib/cdist/global_explorer.py +++ b/lib/cdist/global_explorer.py @@ -35,12 +35,10 @@ import cdist log = logging.getLogger(__name__) -class GlobalExplorer: +class GlobalExplorer(object): """Execute explorers""" def __init__(self, local_path, remote_path): - self.context = context - self.local_path = local_path self.remote_path = remote_path diff --git a/lib/cdist/type_explorer.py b/lib/cdist/type_explorer.py index 46139ece..7d8df3b2 100644 --- a/lib/cdist/type_explorer.py +++ b/lib/cdist/type_explorer.py @@ -35,7 +35,7 @@ import cdist log = logging.getLogger(__name__) -class Explorer: +class TypeExplorer(object): """Execute explorers""" def __init__(self, context): From 9a33bd3b909a73736abef11c3f3846f390319c9c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 17:56:45 +0200 Subject: [PATCH 0659/1024] test type manifest environment Signed-off-by: Steven Armstrong --- lib/cdist/test/manifest/__init__.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index 8fcb5d79..01d3696a 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -81,7 +81,21 @@ class ManifestTestCase(unittest.TestCase): # for line in output.split('\n'): # print(line) -# def test_type_manifest(self): -# cdist_type = core.Type(self.local.type_base_path, '__moon') -# cdist_object = core.Object(cdist_type, self.local.object_base_path, 'Saturn') -# self.manifest.run_type_manifest(cdist_object) + def test_type_manifest_environment(self): + cdist_type = core.Type(self.local.type_base_path, '__dump_environment') + cdist_object = core.Object(cdist_type, self.local.object_base_path, 'whatever') + + output_string = self.manifest.run_type_manifest(cdist_object) + output_dict = {} + for line in output_string.split('\n'): + if line: + key,value = line.split(': ') + output_dict[key] = value + self.assertTrue(output_dict['PATH'].startswith(self.local.bin_path)) + self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__global'], self.local.out_path) + self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_base_path) + self.assertEqual(output_dict['__type'], cdist_type.absolute_path) + self.assertEqual(output_dict['__object'], cdist_object.absolute_path) + self.assertEqual(output_dict['__object_id'], cdist_object.object_id) + self.assertEqual(output_dict['__object_fq'], cdist_object.path) From 1c38fb492e0989ba307b583fe5a5f35b3e6d5f8a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 17:57:06 +0200 Subject: [PATCH 0660/1024] fixtures for type manifest environment test Signed-off-by: Steven Armstrong --- .../fixtures/conf/type/__dump_environment/manifest | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest b/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest new file mode 100755 index 00000000..92f533a8 --- /dev/null +++ b/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest @@ -0,0 +1,10 @@ +#!/bin/sh + +echo "PATH: $PATH" +echo "__target_host: $__target_host" +echo "__global: $__global" +echo "__cdist_type_base_path: $__cdist_type_base_path" +echo "__type: $__type" +echo "__object: $__object" +echo "__object_id: $__object_id" +echo "__object_fq: $__object_fq" From fb80a9555565360e107ddb58e04f6274cd38a2cb Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 17:58:09 +0200 Subject: [PATCH 0661/1024] --debug Signed-off-by: Steven Armstrong --- lib/cdist/test/manifest/__init__.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index 01d3696a..ffbbff29 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -59,11 +59,9 @@ class ManifestTestCase(unittest.TestCase): self.manifest = manifest.Manifest(target_host, self.local) def tearDown(self): - #shutil.rmtree(self.temp_dir) - pass + shutil.rmtree(self.temp_dir) def test_initial_manifest_environment(self): - #initial_manifest = os.path.join(self.local.manifest_path, "init") initial_manifest = os.path.join(self.local.manifest_path, "dump_environment") output_string = self.manifest.run_initial_manifest(initial_manifest) output_dict = {} @@ -76,10 +74,6 @@ class ManifestTestCase(unittest.TestCase): self.assertEqual(output_dict['__global'], self.local.out_path) self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_base_path) self.assertEqual(output_dict['__manifest'], self.local.manifest_path) - - -# for line in output.split('\n'): -# print(line) def test_type_manifest_environment(self): cdist_type = core.Type(self.local.type_base_path, '__dump_environment') From 09209e47d683c800527cc9f24ba5927e93503b97 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 20:29:53 +0200 Subject: [PATCH 0662/1024] ideas for explorer run Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index ad748f0b..9cb4a0df 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -50,11 +50,17 @@ class ConfigInstall(object): self.__init_local_paths() self.__init_remote_paths() + self.global_explorer = cdist.explorer.GlobalExplorer(self.context.global_in, out) + self.type_explorer = cdist.explorer.GlobalExplorer(self.context.global_in, out) + self.explorer = cdist.explorer.Explorer(self.context) #self.manifest = cdist.manifest.Mamifest() self.manifest.initial_manifest() self.manifest.type_manifest(cdist_object) + self.global_explorer.run()? + + self.type_explorer.run(cdist_object)? self.log = logging.getLogger(self.context.target_host) From 478ee1a09627dd6d7e9e9440252b250176189e01 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 20:30:08 +0200 Subject: [PATCH 0663/1024] -senseless comments Signed-off-by: Nico Schottelius --- lib/cdist/global_explorer.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/cdist/global_explorer.py b/lib/cdist/global_explorer.py index 8a9b8c73..fe0ea018 100644 --- a/lib/cdist/global_explorer.py +++ b/lib/cdist/global_explorer.py @@ -36,8 +36,6 @@ import cdist log = logging.getLogger(__name__) class GlobalExplorer(object): - """Execute explorers""" - def __init__(self, local_path, remote_path): self.local_path = local_path self.remote_path = remote_path From d5e24492bef01b625aff44ab36bab1a2bb211b14 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 20:30:38 +0200 Subject: [PATCH 0664/1024] begin to prepare TypeExplorer Signed-off-by: Nico Schottelius --- lib/cdist/type_explorer.py | 77 ++++++++++---------------------------- 1 file changed, 19 insertions(+), 58 deletions(-) diff --git a/lib/cdist/type_explorer.py b/lib/cdist/type_explorer.py index 7d8df3b2..90c726c3 100644 --- a/lib/cdist/type_explorer.py +++ b/lib/cdist/type_explorer.py @@ -36,65 +36,45 @@ import cdist log = logging.getLogger(__name__) class TypeExplorer(object): - """Execute explorers""" + def __init__(self, + remote_global_explorer_path, + object_base_path, + type_base_path, + remote_object_base_path, + remote_type_base_path + ): - def __init__(self, context): - self.context = context + self.object_base_path = object_base_path + self.global_explorer_path = global_explorer_path + self.type_base_path = type_base_path + self.remote_type_base_path = remote_type_base_path + self.remote_object_path = remote_object_path - self.global_explorer_path = os.path.join(self.context.conf_path, "explorer") - - self. - - try: - os.mkdir(self.context.global_explorer_out_path) - except OSError as e: - raise cdist.Error("Failed to create explorer out path: %s" % e) - - def run_global_explorers(self): - """Run global explorers""" - log.info("Running global explorers") - - src_path = self.context.global_explorer_path - dst_path = self.context.remote_global_explorer_path - - self.exec_wrapper.transfer_path(src_path, dst_path) - - outputs = {} - for explorer in os.listdir(src_path): - outputs[explorer] = io.StringIO() - cmd = [] - cmd.append("__explorer=" + remote_dst_path) - cmd.append(os.path.join(remote_dst_path, explorer)) - cdist.exec.run_or_fail(cmd, stdout=outputs[explorer], remote_prefix=True) - - def run_type_explorer(self, cdist_object): + def run(self, cdist_object): """Run type specific explorers for objects""" cdist_type = cdist_object.type - self.transfer_type_explorers(cdist_type) cmd = [] cmd.append("__explorer=" + self.context.remote_global_explorer_path) cmd.append("__type_explorer=" + os.path.join( - self.context.remote_type_path, + self.remote_type_path, cdist_type.explorer_path)) cmd.append("__object=" + os.path.join( - self.context.remote_object_path, + self.remote_object_base_path, cdist_object.path)) cmd.append("__object_id=" + cdist_object.object_id) cmd.append("__object_fq=" + cdist_object.name) - # Need to transfer at least the parameters for objects to be useful - self.transfer_object_parameter(cdist_object) - outputs = {} for explorer in cdist_type.explorers: - remote_cmd = cmd + [os.path.join(self.context.remote_type_path, + remote_cmd = cmd + [os.path.join(self.remote_type_path, cdist_type.explorer_path, explorer)] outputs[explorer] = io.StringIO() log.debug("%s exploring %s using %s storing to %s", cdist_object, explorer, remote_cmd, output) + # FIXME: change to new style cdist.exec.run_or_fail(remote_cmd, stdout=outputs[explorer], remote_prefix=True) return outputs @@ -103,19 +83,14 @@ class TypeExplorer(object): """Transfer the object parameter to the remote destination""" src = os.path.join(self.object_base_path, cdist_object.parameter_path) - dst = os.path.join(self.remote_object_path, + dst = os.path.join(self.remote_object_base_path, cdist_object.parameter_path) + # FIXME: new style # Synchronise parameter dir afterwards self.remote_mkdir(dst) self.transfer_path(src, dst) - def transfer_global_explorers(self): - """Transfer the global explorers""" - self.remote_mkdir(self.remote_global_explorer_path) - self.transfer_path(self.global_explorer_path, - self.remote_global_explorer_path) - def transfer_type_explorers(self, cdist_type): """Transfer explorers of a type, but only once""" if cdist_type.transferred_explorers: @@ -139,17 +114,3 @@ class TypeExplorer(object): # but remote_mkdir uses -p to fix this self.remote_mkdir(dst) self.transfer_path(src, dst) - - def remote_mkdir(self, directory): - """Create directory on remote side""" - cdist.exec.run_or_fail(["mkdir", "-p", directory], remote_prefix=True) - - def remove_remote_path(self, destination): - """Ensure path on remote side vanished""" - cdist.exec.run_or_fail(["rm", "-rf", destination], remote_prefix=True) - - def transfer_path(self, source, destination): - """Transfer directory and previously delete the remote destination""" - self.remove_remote_path(destination) - cdist.exec.run_or_fail(os.environ['__remote_copy'].split() + - ["-r", source, self.target_host + ":" + destination]) From 0a1418f4d311db9847f0697a5270347b14a78050 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 23:01:41 +0200 Subject: [PATCH 0665/1024] forward env Signed-off-by: Steven Armstrong --- lib/cdist/exec/remote.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index 7821e993..63551e7a 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -94,7 +94,7 @@ class Remote(object): cmd = self._exec.split() cmd.append(self.target_host) cmd.extend(command) - return self.run_command(cmd, env=None) + return self.run_command(cmd, env=env) def run_command(self, command, env=None): """Run the given command with the given environment. From 4ad2e4f7422974d03c15cb2f5fa53cb4a2a64d49 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 23:10:05 +0200 Subject: [PATCH 0666/1024] ++more to fix Signed-off-by: Nico Schottelius --- lib/cdist/type_explorer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/cdist/type_explorer.py b/lib/cdist/type_explorer.py index 90c726c3..9e3c99bf 100644 --- a/lib/cdist/type_explorer.py +++ b/lib/cdist/type_explorer.py @@ -33,6 +33,7 @@ import os import cdist +# FIXME: Logging with hostname log = logging.getLogger(__name__) class TypeExplorer(object): @@ -56,7 +57,7 @@ class TypeExplorer(object): cdist_type = cdist_object.type cmd = [] - cmd.append("__explorer=" + self.context.remote_global_explorer_path) + cmd.append("__explorer=" + self.remote_global_explorer_path) cmd.append("__type_explorer=" + os.path.join( self.remote_type_path, cdist_type.explorer_path)) @@ -75,7 +76,8 @@ class TypeExplorer(object): cdist_object, explorer, remote_cmd, output) # FIXME: change to new style - cdist.exec.run_or_fail(remote_cmd, stdout=outputs[explorer], remote_prefix=True) + cdist.exec.run_or_fail(remote_cmd, stdout=outputs[explorer], + remote_prefix=True) return outputs From f2278c42abf22778408a3ae6048ce2912e77a3bb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 23:10:18 +0200 Subject: [PATCH 0667/1024] init tests for type_explorer Signed-off-by: Nico Schottelius --- lib/cdist/test/type_explorer/__init__.py | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lib/cdist/test/type_explorer/__init__.py diff --git a/lib/cdist/test/type_explorer/__init__.py b/lib/cdist/test/type_explorer/__init__.py new file mode 100644 index 00000000..5e7c82aa --- /dev/null +++ b/lib/cdist/test/type_explorer/__init__.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# +# 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 . +# +# + +import os +import unittest + +import cdist.core + +import os.path as op +my_dir = op.abspath(op.dirname(__file__)) +fixtures = op.join(my_dir, 'fixtures') +object_base_path = op.join(fixtures, 'object') +type_base_path = op.join(fixtures, 'type') + +class TypeExplorer(unittest.TestCase): + + def setUp(self): + + def test_explorer_output(self): + From d9af865523b04b2370c8318c1cc13a239ce06ffe Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 23:12:56 +0200 Subject: [PATCH 0668/1024] fixture type with one explorer Signed-off-by: Nico Schottelius --- .../test/type_explorer/fixtures/type/__test_type/explorer/world | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 lib/cdist/test/type_explorer/fixtures/type/__test_type/explorer/world diff --git a/lib/cdist/test/type_explorer/fixtures/type/__test_type/explorer/world b/lib/cdist/test/type_explorer/fixtures/type/__test_type/explorer/world new file mode 100755 index 00000000..21ba6825 --- /dev/null +++ b/lib/cdist/test/type_explorer/fixtures/type/__test_type/explorer/world @@ -0,0 +1,2 @@ +#!/bin/sh +echo hello From 8d591b45e22fe4f5b12e3a4f7f55ab45bd8e2cd3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 23:49:17 +0200 Subject: [PATCH 0669/1024] add type to test whether object parameter can be read Signed-off-by: Nico Schottelius --- .../type/__test_type_object_parameter/explorer/test_parameter | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 lib/cdist/test/type_explorer/fixtures/type/__test_type_object_parameter/explorer/test_parameter diff --git a/lib/cdist/test/type_explorer/fixtures/type/__test_type_object_parameter/explorer/test_parameter b/lib/cdist/test/type_explorer/fixtures/type/__test_type_object_parameter/explorer/test_parameter new file mode 100755 index 00000000..0778907c --- /dev/null +++ b/lib/cdist/test/type_explorer/fixtures/type/__test_type_object_parameter/explorer/test_parameter @@ -0,0 +1,3 @@ +#!/bin/sh + +cat "$__object/parameter/test" From d47039e91e3a76233233029745b4911279bc945d Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 23:49:42 +0200 Subject: [PATCH 0670/1024] prepend variables to remote commands Signed-off-by: Steven Armstrong --- lib/cdist/exec/remote.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index 63551e7a..2ffc73fd 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -102,9 +102,18 @@ class Remote(object): """ assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command + + # can't pass environment to remote side, so prepend command with + # variable declarations + if env: + cmd = ["%s=%s" % item for item in env.items()] + cmd.extend(command) + else: + cmd = command + self.log.debug("Remote run: %s", command) try: - return subprocess.check_output(command, env=env).decode() + return subprocess.check_output(cmd).decode() except subprocess.CalledProcessError: raise cdist.Error("Command failed: " + " ".join(command)) except OSError as error: @@ -117,6 +126,12 @@ class Remote(object): """ command = self._exec.split() command.append(self.target_host) + + # can't pass environment to remote side, so prepend command with + # variable declarations + if env: + command.extend(["%s=%s" % item for item in env.items()]) + command.extend(["/bin/sh", "-e"]) command.append(script) @@ -125,7 +140,7 @@ class Remote(object): self.log.debug("Remote run script env: %s", env) try: - return subprocess.check_output(command, env=env).decode() + return subprocess.check_output(command).decode() except subprocess.CalledProcessError as error: script_content = self.run(["cat", script]) self.log.error("Code that raised the error:\n%s", script_content) From 50a07da96764445e48a8711497e3c9708ac6df2e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 23:55:02 +0200 Subject: [PATCH 0671/1024] global explorer belongs to core Signed-off-by: Nico Schottelius --- lib/cdist/{ => core}/global_explorer.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/cdist/{ => core}/global_explorer.py (100%) diff --git a/lib/cdist/global_explorer.py b/lib/cdist/core/global_explorer.py similarity index 100% rename from lib/cdist/global_explorer.py rename to lib/cdist/core/global_explorer.py From 6d87f4b917d3e8b96983fd865ec6bc500ac03d5d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 12 Oct 2011 23:59:20 +0200 Subject: [PATCH 0672/1024] integrate global explorer into core Signed-off-by: Nico Schottelius --- lib/cdist/core/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/core/__init__.py b/lib/cdist/core/__init__.py index 80310ffc..d6377b12 100644 --- a/lib/cdist/core/__init__.py +++ b/lib/cdist/core/__init__.py @@ -23,3 +23,4 @@ __all__ = ['Type', 'Object'] from cdist.core.type import Type from cdist.core.object import Object +from cdist.core.global_explorer import GlobalExplorer From 1d85d10f4f9806385f39411bc51c3734ff38e43b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 00:16:02 +0200 Subject: [PATCH 0673/1024] consistent naming: /type_base_path/type_path/ Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index 521d56c3..8192bf0c 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -59,7 +59,7 @@ class Local(object): 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_base_path = os.path.join(self.conf_path, "type") + 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") @@ -123,7 +123,7 @@ class Local(object): def link_emulator(self, exec_path): """Link emulator to types""" src = os.path.abspath(exec_path) - for cdist_type in core.Type.list_types(self.type_base_path): + for cdist_type in core.Type.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) From 8545221787266302ddbe71eef58c147f2c6b7e4e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 00:16:30 +0200 Subject: [PATCH 0674/1024] consistent naming: /object_base_path/object_path/ Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index 8192bf0c..1f253f09 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -67,7 +67,7 @@ class Local(object): 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_base_path = os.path.join(self.out_path, "object") + self.object_path = os.path.join(self.out_path, "object") self.log = logging.getLogger(self.target_host) From 67de9d8c7379c3074b8fce2aeac7bb2e57c8c8a2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 00:20:55 +0200 Subject: [PATCH 0675/1024] tests for Local paths Signed-off-by: Steven Armstrong --- lib/cdist/test/exec/test_local.py | 38 ++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/lib/cdist/test/exec/test_local.py b/lib/cdist/test/exec/test_local.py index b74f412e..8585f87a 100644 --- a/lib/cdist/test/exec/test_local.py +++ b/lib/cdist/test/exec/test_local.py @@ -50,12 +50,45 @@ class LocalTestCase(unittest.TestCase): def setUp(self): self.temp_dir = self.mkdtemp() target_host = 'localhost' - out_path = self.temp_dir - self.local = local.Local(target_host, local_base_path, out_path) + self.out_path = self.temp_dir + self.base_path = local_base_path + self.local = local.Local(target_host, self.base_path, self.out_path) def tearDown(self): shutil.rmtree(self.temp_dir) + ### test api + + def test_cache_path(self): + self.assertEqual(self.local.cache_path, os.path.join(self.base_path, "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")) + + def test_out_path(self): + self.assertEqual(self.local.out_path, self.out_path) + + def test_bin_path(self): + self.assertEqual(self.local.bin_path, os.path.join(self.out_path, "bin")) + + def test_global_explorer_out_path(self): + self.assertEqual(self.local.global_explorer_out_path, os.path.join(self.out_path, "explorer")) + + def test_object_path(self): + self.assertEqual(self.local.object_path, os.path.join(self.out_path, "object")) + + ### /test api + + def test_run_success(self): self.local.run(['/bin/true']) @@ -96,6 +129,5 @@ class LocalTestCase(unittest.TestCase): def test_create_directories(self): self.local.create_directories() - print('self.local.bin_path: %s' % self.local.bin_path) self.assertTrue(os.path.isdir(self.local.out_path)) self.assertTrue(os.path.isdir(self.local.bin_path)) From 5d2827f66ec9152e4e7928e9d4dd47f803f3d7ff Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 00:24:52 +0200 Subject: [PATCH 0676/1024] tests for Remote paths Signed-off-by: Steven Armstrong --- lib/cdist/test/exec/test_remote.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/cdist/test/exec/test_remote.py b/lib/cdist/test/exec/test_remote.py index 1fdb5833..ea9a17aa 100644 --- a/lib/cdist/test/exec/test_remote.py +++ b/lib/cdist/test/exec/test_remote.py @@ -42,15 +42,31 @@ class RemoteTestCase(unittest.TestCase): def setUp(self): self.temp_dir = self.mkdtemp() target_host = 'localhost' - remote_base_path = self.temp_dir + self.base_path = self.temp_dir user = getpass.getuser() remote_exec = "ssh -o User=%s -q" % user remote_copy = "scp -o User=%s -q" % user - self.remote = remote.Remote(target_host, remote_base_path, remote_exec, remote_copy) + self.remote = remote.Remote(target_host, self.base_path, remote_exec, remote_copy) def tearDown(self): shutil.rmtree(self.temp_dir) + ### test api + + def test_conf_path(self): + self.assertEqual(self.remote.conf_path, os.path.join(self.base_path, "conf")) + + def test_object_path(self): + self.assertEqual(self.remote.object_path, os.path.join(self.base_path, "object")) + + def test_type_path(self): + self.assertEqual(self.remote.type_path, os.path.join(self.base_path, "conf", "type")) + + def test_global_explorer_path(self): + self.assertEqual(self.remote.global_explorer_path, os.path.join(self.base_path, "conf", "explorer")) + + ### /test api + def test_run_success(self): self.remote.run(['/bin/true']) From 48eb996a2e5e150c49705bb3531503a9b9e2f828 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 00:26:11 +0200 Subject: [PATCH 0677/1024] remove useless filename prefix Signed-off-by: Steven Armstrong --- lib/cdist/test/exec/{test_local.py => local.py} | 0 lib/cdist/test/exec/{test_remote.py => remote.py} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename lib/cdist/test/exec/{test_local.py => local.py} (100%) rename lib/cdist/test/exec/{test_remote.py => remote.py} (100%) diff --git a/lib/cdist/test/exec/test_local.py b/lib/cdist/test/exec/local.py similarity index 100% rename from lib/cdist/test/exec/test_local.py rename to lib/cdist/test/exec/local.py diff --git a/lib/cdist/test/exec/test_remote.py b/lib/cdist/test/exec/remote.py similarity index 100% rename from lib/cdist/test/exec/test_remote.py rename to lib/cdist/test/exec/remote.py From a8ec91c80484cf248b49559408cf010db99095a2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 00:35:14 +0200 Subject: [PATCH 0678/1024] -e /type_base_path/type_path/ -e /object_base_path/object_path/ Signed-off-by: Steven Armstrong --- lib/cdist/core/manifest.py | 6 +++--- lib/cdist/test/manifest/__init__.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index 8f9fc7ae..e97ba095 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -38,7 +38,7 @@ common: __global: full qualified path to the global output dir == local.out_path __cdist_manifest: full qualified path of the manifest == script __cdist_type_base_path: full qualified path to the directory where types are defined for use in type emulator - == local.type_base_path + == local.type_path initial manifest is: script: full qualified path to the initial manifest @@ -72,7 +72,7 @@ class Manifest(object): 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), '__target_host': self.target_host, '__global': self.local.out_path, - '__cdist_type_base_path': self.local.type_base_path, # for use in type emulator + '__cdist_type_base_path': self.local.type_path, # for use in type emulator } def run_initial_manifest(self, script): @@ -90,5 +90,5 @@ class Manifest(object): '__object_fq': cdist_object.path, '__type': cdist_object.type.absolute_path, }) - script = os.path.join(self.local.type_base_path, cdist_object.type.manifest_path) + script = os.path.join(self.local.type_path, cdist_object.type.manifest_path) return self.local.run_script(script, env=env) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index ffbbff29..341f4893 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -72,12 +72,12 @@ class ManifestTestCase(unittest.TestCase): self.assertTrue(output_dict['PATH'].startswith(self.local.bin_path)) self.assertEqual(output_dict['__target_host'], self.local.target_host) self.assertEqual(output_dict['__global'], self.local.out_path) - self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_base_path) + self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_path) self.assertEqual(output_dict['__manifest'], self.local.manifest_path) def test_type_manifest_environment(self): - cdist_type = core.Type(self.local.type_base_path, '__dump_environment') - cdist_object = core.Object(cdist_type, self.local.object_base_path, 'whatever') + cdist_type = core.Type(self.local.type_path, '__dump_environment') + cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') output_string = self.manifest.run_type_manifest(cdist_object) output_dict = {} @@ -88,7 +88,7 @@ class ManifestTestCase(unittest.TestCase): self.assertTrue(output_dict['PATH'].startswith(self.local.bin_path)) self.assertEqual(output_dict['__target_host'], self.local.target_host) self.assertEqual(output_dict['__global'], self.local.out_path) - self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_base_path) + self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_path) self.assertEqual(output_dict['__type'], cdist_type.absolute_path) self.assertEqual(output_dict['__object'], cdist_object.absolute_path) self.assertEqual(output_dict['__object_id'], cdist_object.object_id) From 62383eed8d8a6a28d7ce44faacaa67bc75c4546f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 13 Oct 2011 03:00:57 +0200 Subject: [PATCH 0679/1024] ++stuff Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 4 ++-- lib/cdist/test/type_explorer/__init__.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 9cb4a0df..a319b88c 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -31,7 +31,7 @@ import time import cdist.core import cdist.context import cdist.exec -import cdist.explorer +#import cdist.explorer #import cdist.manifest class ConfigInstall(object): @@ -53,7 +53,7 @@ class ConfigInstall(object): self.global_explorer = cdist.explorer.GlobalExplorer(self.context.global_in, out) self.type_explorer = cdist.explorer.GlobalExplorer(self.context.global_in, out) - self.explorer = cdist.explorer.Explorer(self.context) + self.global_explorer = cdist.core.GlobalExplorer #self.manifest = cdist.manifest.Mamifest() self.manifest.initial_manifest() diff --git a/lib/cdist/test/type_explorer/__init__.py b/lib/cdist/test/type_explorer/__init__.py index 5e7c82aa..19d59342 100644 --- a/lib/cdist/test/type_explorer/__init__.py +++ b/lib/cdist/test/type_explorer/__init__.py @@ -35,4 +35,5 @@ class TypeExplorer(unittest.TestCase): def setUp(self): def test_explorer_output(self): + """Check for output of type explorer""" From 63eee391e0b49f240ec385ab3936ed321c0a088b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 01:25:31 +0200 Subject: [PATCH 0680/1024] implement Explorer analog to Manifest + tests Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 109 ++++++++++++++++++ lib/cdist/test/explorer/__init__.py | 87 ++++++++++++++ .../explorer/fixtures/conf/explorer/global | 2 + .../conf/type/__test_type/explorer/world | 2 + .../explorer/test_parameter | 3 + 5 files changed, 203 insertions(+) create mode 100644 lib/cdist/core/explorer.py create mode 100644 lib/cdist/test/explorer/__init__.py create mode 100755 lib/cdist/test/explorer/fixtures/conf/explorer/global create mode 100755 lib/cdist/test/explorer/fixtures/conf/type/__test_type/explorer/world create mode 100755 lib/cdist/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py new file mode 100644 index 00000000..7e1d48de --- /dev/null +++ b/lib/cdist/core/explorer.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 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 . +# +# + +import logging +import os + +import cdist + +log = logging.getLogger(__name__) + + +''' +common: + runs only remotely, needs local and remote + + env: + __explorer: full qualified path to other global explorers on remote side == remote.global_explorer_path + +global explorer is: + folder full of scripts which have to be: + (- copied to remote) + - executed one by one on remote + - output saved to local files + + env: + + creates: local files with explorer output + +type explorer is: + folder full of scripts which have to be: + (- copied to remote) + - executed one by one on remote for each object instance + - output saved into object instance + + env: + __object: full qualified path to the object's remote dir + __object_id: the objects id + __object_fq: full qualified object id, iow: $type.name + / + object_id + __type_explorer: full qualified path to the other type explorers on remote side + + creates: nothing, all output is handled by the object instances +''' + + +class Explorer(object): + """Executes cdist explorers. + + """ + def __init__(self, target_host, local, remote): + self.target_host = target_host + self.local = local + self.remote = remote + self.env = { + '__target_host': self.target_host, + '__explorer': self.remote.global_explorer_path, + } + + def transfer_global_explorers(self): + """Transfer the global explorers to the remote side.""" + self.remote.mkdir(self.remote.global_explorer_path) + self.remote.transfer(self.local.global_explorer_path, self.remote.global_explorer_path) + + def run_global_explorer(self, explorer): + """Run the given global explorer and return it's output.""" + script = os.path.join(self.remote.global_explorer_path, explorer) + return self.remote.run_script(script, env=self.env) + + def transfer_type_explorers(self, cdist_type): + """Transfer the type explorers for the given type to the remote side.""" + source = os.path.join(self.local.type_path, cdist_type.explorer_path) + destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) + self.remote.mkdir(destination) + self.remote.transfer(source, destination) + + # FIXME: should i do this? probably not + def transfer_object_parameters(self, cdist_object): + pass + + def run_type_explorer(self, explorer, cdist_object): + """Run the given type explorer for the given object and return it's output.""" + cdist_type = cdist_object.type + env = self.env.copy() + env.update({ + '__object': cdist_object.absolute_path, + '__object_id': cdist_object.object_id, + '__object_fq': cdist_object.path, + '__type_explorer': os.path.join(self.remote.type_path, cdist_type.explorer_path) + }) + script = os.path.join(self.remote.type_path, cdist_type.explorer_path, explorer) + return self.remote.run_script(script, env=env) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py new file mode 100644 index 00000000..6fad157b --- /dev/null +++ b/lib/cdist/test/explorer/__init__.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import os +import tempfile +import unittest +import shutil +import getpass + +import cdist +from cdist import core +from cdist import test +from cdist.exec import local +from cdist.exec import remote +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 + +class ExplorerClassTestCase(unittest.TestCase): + + def mkdtemp(self, **kwargs): + return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) + + def mkstemp(self, **kwargs): + return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) + + def setUp(self): + target_host = 'localhost' + + self.local_base_path = local_base_path + self.out_path = self.mkdtemp() + self.local = local.Local(target_host, self.local_base_path, self.out_path) + self.local.create_directories() + + 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(target_host, self.remote_base_path, remote_exec, remote_copy) + + self.explorer = explorer.Explorer(target_host, self.local, self.remote) + + def tearDown(self): + shutil.rmtree(self.out_path) + shutil.rmtree(self.remote_base_path) + + def test_transfer_global_explorers(self): + # FIXME: test result + self.explorer.transfer_global_explorers() + + def test_run_global_explorer(self): + # FIXME: test result + self.explorer.transfer_global_explorers() + self.explorer.run_global_explorer('global') + + def test_transfer_type_explorers(self): + # FIXME: test result + cdist_type = core.Type(self.local.type_path, '__test_type') + self.explorer.transfer_type_explorers(cdist_type) + + def test_run_type_explorer(self): + cdist_type = core.Type(self.local.type_path, '__test_type') + cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') + self.explorer.transfer_type_explorers(cdist_type) + self.assertEqual(self.explorer.run_type_explorer('world', cdist_object), 'hello\n') + diff --git a/lib/cdist/test/explorer/fixtures/conf/explorer/global b/lib/cdist/test/explorer/fixtures/conf/explorer/global new file mode 100755 index 00000000..39c16ea8 --- /dev/null +++ b/lib/cdist/test/explorer/fixtures/conf/explorer/global @@ -0,0 +1,2 @@ +#!/bin/sh +echo global diff --git a/lib/cdist/test/explorer/fixtures/conf/type/__test_type/explorer/world b/lib/cdist/test/explorer/fixtures/conf/type/__test_type/explorer/world new file mode 100755 index 00000000..21ba6825 --- /dev/null +++ b/lib/cdist/test/explorer/fixtures/conf/type/__test_type/explorer/world @@ -0,0 +1,2 @@ +#!/bin/sh +echo hello diff --git a/lib/cdist/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter b/lib/cdist/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter new file mode 100755 index 00000000..0778907c --- /dev/null +++ b/lib/cdist/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter @@ -0,0 +1,3 @@ +#!/bin/sh + +cat "$__object/parameter/test" From c15673aef79b0805597d326667a9bb99db6b4e9a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 11:05:39 +0200 Subject: [PATCH 0681/1024] +docstring Signed-off-by: Steven Armstrong --- lib/cdist/core/manifest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index e97ba095..fc82b1cc 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -62,7 +62,7 @@ type manifeste is: class Manifest(object): - """Represents a cdist manifest. + """Executes cdist manifests. """ def __init__(self, target_host, local): From 841b54c6d039e0f1b68b9e3ea22d481d1414b4ef Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 11:06:03 +0200 Subject: [PATCH 0682/1024] +devnotes, +FIXME Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index 7e1d48de..c79124b3 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -30,26 +30,25 @@ log = logging.getLogger(__name__) ''' common: - runs only remotely, needs local and remote + runs only remotely, needs local and remote to construct paths env: - __explorer: full qualified path to other global explorers on remote side == remote.global_explorer_path + __explorer: full qualified path to other global explorers on remote side + -> remote.global_explorer_path -global explorer is: - folder full of scripts which have to be: - (- copied to remote) - - executed one by one on remote - - output saved to local files +a global explorer is: + - a script + - executed on the remote side + - returns its output as a string env: - creates: local files with explorer output + creates: nothing, returns output type explorer is: - folder full of scripts which have to be: - (- copied to remote) - - executed one by one on remote for each object instance - - output saved into object instance + - a script + - executed on the remote side for each object instance + - returns its output as a string env: __object: full qualified path to the object's remote dir @@ -57,7 +56,8 @@ type explorer is: __object_fq: full qualified object id, iow: $type.name + / + object_id __type_explorer: full qualified path to the other type explorers on remote side - creates: nothing, all output is handled by the object instances + creates: nothing, returns output + ''' @@ -74,6 +74,7 @@ class Explorer(object): '__explorer': self.remote.global_explorer_path, } + # FIXME: should i do this? def transfer_global_explorers(self): """Transfer the global explorers to the remote side.""" self.remote.mkdir(self.remote.global_explorer_path) @@ -84,6 +85,7 @@ class Explorer(object): script = os.path.join(self.remote.global_explorer_path, explorer) return self.remote.run_script(script, env=self.env) + # FIXME: should i do this? def transfer_type_explorers(self, cdist_type): """Transfer the type explorers for the given type to the remote side.""" source = os.path.join(self.local.type_path, cdist_type.explorer_path) From c305735ed5334ce37742daae650bd6e107c5b524 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 13 Oct 2011 11:08:23 +0200 Subject: [PATCH 0683/1024] begin cleanup/reordering in config_install Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 82 +++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 35 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index a319b88c..6ab2c162 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -99,6 +99,53 @@ class ConfigInstall(object): shutil.rmtree(self.context.cache_path) shutil.move(self.context.out_path, self.context.cache_path) + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + self.log.info("Deploying to " + self.context.target_host) + self.stage_prepare() + self.stage_run() + + def deploy_and_cleanup(self): + """Do what is most often done: deploy & cleanup""" + start_time = time.time() + self.deploy_to() + self.cleanup() + self.log.info("Finished run of %s in %s seconds", + self.context.target_host, time.time() - start_time) + + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" + self.link_emulator() + self.global_explorer_run() + self.run_initial_manifest() + + self.log.info("Running object manifests and type explorers") + + # Continue process until no new objects are created anymore + new_objects_created = True + while new_objects_created: + new_objects_created = False + for cdist_object in cdist.core.Object.list_objects(self.object_base_path, + self.context.type_base_path): + if cdist_object.prepared: + self.log.debug("Skipping rerun of object %s", cdist_object) + continue + else: + self.object_prepare(cdist_object) + new_objects_created = True + + + def self.global_explorer_run() + """Run global explorers and save output""" + + output = self.global_explorer.run() + + for explorer in output: + outfile = os.path.join(self.context.global_explorer_out_path, + explorer) + outfile_fd = open(outfile, "w") + outfile_fd.write() + def object_prepare(self, cdist_object): """Prepare object: Run type explorer + manifest""" self.log.debug("Preparing object: " + cdist_object.name) @@ -186,41 +233,6 @@ class ConfigInstall(object): # FIXME: handle exception / make it more beautiful / Steven: raise except :-) os.symlink(src, dst) - def deploy_to(self): - """Mimic the old deploy to: Deploy to one host""" - self.log.info("Deploying to " + self.context.target_host) - self.stage_prepare() - self.stage_run() - - def deploy_and_cleanup(self): - """Do what is most often done: deploy & cleanup""" - start_time = time.time() - self.deploy_to() - self.cleanup() - self.log.info("Finished run of %s in %s seconds", - self.context.target_host, time.time() - start_time) - - def stage_prepare(self): - """Do everything for a deploy, minus the actual code stage""" - self.link_emulator() - self.explorer.run_global_explorers() - self.run_initial_manifest() - - self.log.info("Running object manifests and type explorers") - - # Continue process until no new objects are created anymore - new_objects_created = True - while new_objects_created: - new_objects_created = False - for cdist_object in cdist.core.Object.list_objects(self.object_base_path, - self.context.type_base_path): - if cdist_object.prepared: - self.log.debug("Skipping rerun of object %s", cdist_object) - continue - else: - self.object_prepare(cdist_object) - new_objects_created = True - def stage_run(self): """The final (and real) step of deployment""" self.log.info("Generating and executing code") From 143939a6f71745876859a53e6b426e3768762744 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 13 Oct 2011 11:09:57 +0200 Subject: [PATCH 0684/1024] do not change current env Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 6ab2c162..4c4fd245 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -85,13 +85,9 @@ class ConfigInstall(object): os.mkdir(self.context.out_path) os.mkdir(self.context.bin_path) - # FIXME: remove this function, only expose ENV - # explicitly! - def __init_env(self): - """Environment usable for other stuff""" - os.environ['__target_host'] = self.context.target_host - if self.context.debug: - os.environ['__debug'] = "yes" +# os.environ['__target_host'] = self.context.target_host +# if self.context.debug: +# os.environ['__debug'] = "yes" def cleanup(self): self.log.debug("Saving " + self.context.out_path + " to " + self.context.cache_path) From 94a5558f3fc40ade0c98c2cb51546cd6e16e15a6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 13 Oct 2011 12:20:51 +0200 Subject: [PATCH 0685/1024] ++todo in bin/cdist Signed-off-by: Nico Schottelius --- bin/cdist | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/cdist b/bin/cdist index fae83ff1..37461aab 100755 --- a/bin/cdist +++ b/bin/cdist @@ -115,6 +115,7 @@ def configinstall(args, mode): time_start = time.time() for host in args.host: + # Setup Local/Remote context = cdist.context.Context( target_host=host, initial_manifest=args.manifest, From 79ad04ebe58d7bfc37af2151e1ea4fc38623b297 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 13 Oct 2011 12:21:24 +0200 Subject: [PATCH 0686/1024] -ws Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 4c4fd245..c49d32fc 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -67,7 +67,6 @@ class ConfigInstall(object): # Setup env to be used by others - FIXME self.__init_env() - def __init_remote_paths(self): """Initialise remote directory structure""" self.exec_wrapper.remove_remote_path(self.context.remote_base_path) From 48ae37e832d921ecd0fd32bb250723b1d56429db Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:04:23 +0200 Subject: [PATCH 0687/1024] implement transfer_object_parameters Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index c79124b3..ad19db20 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -74,7 +74,8 @@ class Explorer(object): '__explorer': self.remote.global_explorer_path, } - # FIXME: should i do this? + ### global + def transfer_global_explorers(self): """Transfer the global explorers to the remote side.""" self.remote.mkdir(self.remote.global_explorer_path) @@ -85,7 +86,8 @@ class Explorer(object): script = os.path.join(self.remote.global_explorer_path, explorer) return self.remote.run_script(script, env=self.env) - # FIXME: should i do this? + ### type + def transfer_type_explorers(self, cdist_type): """Transfer the type explorers for the given type to the remote side.""" source = os.path.join(self.local.type_path, cdist_type.explorer_path) @@ -93,9 +95,12 @@ class Explorer(object): self.remote.mkdir(destination) self.remote.transfer(source, destination) - # FIXME: should i do this? probably not def transfer_object_parameters(self, cdist_object): - pass + """Transfer the parameters for the given object to the remote side.""" + source = os.path.join(self.local.object_path, cdist_object.parameter_path) + destination = os.path.join(self.remotei.object_path, cdist_object.parameter_path) + self.remote.mkdir(destination) + self.remote.transfer(source, destination) def run_type_explorer(self, explorer, cdist_object): """Run the given type explorer for the given object and return it's output.""" From d136a6dee340b76ca883826301f03e266f75b887 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:14:01 +0200 Subject: [PATCH 0688/1024] DirectoryDictProperty: create directory before writing Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index 68d5edaa..50b95ea2 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -221,6 +221,8 @@ class DirectoryDictProperty(DirectoryDict): def __set__(self, obj, value): self._set_path(obj) if value is not None: + # create directory if it doesn't exist + os.makedirs(self.path, exist_ok=True) for name in self.keys(): del self[name] self.update(value) From dc6218c3e1fb182f899c7dff0de9e52726d06803 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:14:46 +0200 Subject: [PATCH 0689/1024] initial test for test_transfer_object_parameters Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index 6fad157b..8139431b 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -79,6 +79,13 @@ class ExplorerClassTestCase(unittest.TestCase): cdist_type = core.Type(self.local.type_path, '__test_type') self.explorer.transfer_type_explorers(cdist_type) + def test_transfer_object_parameters(self): + # FIXME: test result + cdist_type = core.Type(self.local.type_path, '__test_type') + cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') + cdist_object.parameters = {'first': 'first value', 'second': 'second value'} + self.explorer.transfer_object_parameters(cdist_object) + def test_run_type_explorer(self): cdist_type = core.Type(self.local.type_path, '__test_type') cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') From 20fae8b52b2751b891cd041df98c88b73f07e0b1 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:14:56 +0200 Subject: [PATCH 0690/1024] fix typo Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index ad19db20..b86054c7 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -98,7 +98,7 @@ class Explorer(object): def transfer_object_parameters(self, cdist_object): """Transfer the parameters for the given object to the remote side.""" source = os.path.join(self.local.object_path, cdist_object.parameter_path) - destination = os.path.join(self.remotei.object_path, cdist_object.parameter_path) + destination = os.path.join(self.remote.object_path, cdist_object.parameter_path) self.remote.mkdir(destination) self.remote.transfer(source, destination) From 910de0579cc62fb0ba9bf34c4b76b4d6a70fcabb Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:17:22 +0200 Subject: [PATCH 0691/1024] add assertion for test_transfer_object_parameters Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index 8139431b..eb45778b 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -80,11 +80,13 @@ class ExplorerClassTestCase(unittest.TestCase): self.explorer.transfer_type_explorers(cdist_type) def test_transfer_object_parameters(self): - # FIXME: test result cdist_type = core.Type(self.local.type_path, '__test_type') cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') cdist_object.parameters = {'first': 'first value', 'second': 'second value'} self.explorer.transfer_object_parameters(cdist_object) + source = os.path.join(self.local.object_path, cdist_object.parameter_path) + destination = os.path.join(self.remote.object_path, cdist_object.parameter_path) + self.assertEqual(os.listdir(source), os.listdir(destination)) def test_run_type_explorer(self): cdist_type = core.Type(self.local.type_path, '__test_type') From 2eb37367a18ba6168d06f61f0c98a21597df5b60 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:18:34 +0200 Subject: [PATCH 0692/1024] add assertion for test_transfer_type_explorers Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index eb45778b..e6b36f1b 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -75,9 +75,11 @@ class ExplorerClassTestCase(unittest.TestCase): self.explorer.run_global_explorer('global') def test_transfer_type_explorers(self): - # FIXME: test result cdist_type = core.Type(self.local.type_path, '__test_type') self.explorer.transfer_type_explorers(cdist_type) + source = os.path.join(self.local.type_path, cdist_type.explorer_path) + destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) + self.assertEqual(os.listdir(source), os.listdir(destination)) def test_transfer_object_parameters(self): cdist_type = core.Type(self.local.type_path, '__test_type') From f846fdd961501d4133042d49123e4ca8b57d10b3 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:20:07 +0200 Subject: [PATCH 0693/1024] add assertion for test_transfer_global_explorers Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index e6b36f1b..bc1ef820 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -66,8 +66,10 @@ class ExplorerClassTestCase(unittest.TestCase): shutil.rmtree(self.remote_base_path) def test_transfer_global_explorers(self): - # FIXME: test result self.explorer.transfer_global_explorers() + source = self.local.global_explorer_path + destination = self.remote.global_explorer_path + self.assertEqual(os.listdir(source), os.listdir(destination)) def test_run_global_explorer(self): # FIXME: test result From f1fdf0f13c4c92564acb55b232137f6953e90378 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:21:15 +0200 Subject: [PATCH 0694/1024] add assertion for test_run_global_explorer Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index bc1ef820..5974b43a 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -72,9 +72,9 @@ class ExplorerClassTestCase(unittest.TestCase): self.assertEqual(os.listdir(source), os.listdir(destination)) def test_run_global_explorer(self): - # FIXME: test result self.explorer.transfer_global_explorers() - self.explorer.run_global_explorer('global') + output = self.explorer.run_global_explorer('global') + self.assertEqual(output, 'global\n') def test_transfer_type_explorers(self): cdist_type = core.Type(self.local.type_path, '__test_type') From ac79ec101fd678fdb706ed919fa98f0b0110fa23 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:22:52 +0200 Subject: [PATCH 0695/1024] +consistency Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index 5974b43a..a4ad4f7f 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -96,5 +96,6 @@ class ExplorerClassTestCase(unittest.TestCase): cdist_type = core.Type(self.local.type_path, '__test_type') cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') self.explorer.transfer_type_explorers(cdist_type) - self.assertEqual(self.explorer.run_type_explorer('world', cdist_object), 'hello\n') + output = self.explorer.run_type_explorer('world', cdist_object) + self.assertEqual(output, 'hello\n') From f02bdf3e6196285d23a7fd3ff26577ce5840f421 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:30:41 +0200 Subject: [PATCH 0696/1024] test for test_list_global_explorer_names Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index a4ad4f7f..67c05913 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -65,6 +65,10 @@ class ExplorerClassTestCase(unittest.TestCase): shutil.rmtree(self.out_path) shutil.rmtree(self.remote_base_path) + def test_list_global_explorer_names(self): + expected = ['global'] + self.assertEqual(self.explorer.list_global_explorer_names(), expected) + def test_transfer_global_explorers(self): self.explorer.transfer_global_explorers() source = self.local.global_explorer_path From 86fcce928c562dd7f14ccf4d6833db8736120dba Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:31:42 +0200 Subject: [PATCH 0697/1024] implement list_global_explorer_names Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index b86054c7..562683f4 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -76,6 +76,10 @@ class Explorer(object): ### global + def list_global_explorer_names(self): + """Return a list of global explorer names.""" + return os.listdir(self.local.global_explorer_path) + def transfer_global_explorers(self): """Transfer the global explorers to the remote side.""" self.remote.mkdir(self.remote.global_explorer_path) From fb4d20e7e853f8f15cbd4f5b6aae238741478531 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:33:24 +0200 Subject: [PATCH 0698/1024] test for test_list_type_explorer_names Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index 67c05913..96206ae0 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -80,6 +80,11 @@ class ExplorerClassTestCase(unittest.TestCase): output = self.explorer.run_global_explorer('global') self.assertEqual(output, 'global\n') + def test_list_type_explorer_names(self): + cdist_type = core.Type(self.local.type_path, '__test_type') + expected = cdist_type.explorers + self.assertEqual(self.explorer.list_type_explorer_names(cdist_type), expected) + def test_transfer_type_explorers(self): cdist_type = core.Type(self.local.type_path, '__test_type') self.explorer.transfer_type_explorers(cdist_type) From 8fb51a396a640066c99083df69521bd8b1a9148a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:34:06 +0200 Subject: [PATCH 0699/1024] implement list_type_explorer_names Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index 562683f4..7e61639e 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -92,6 +92,11 @@ class Explorer(object): ### type + def list_type_explorer_names(self, cdist_type): + """Return a list of explorer names for the given type.""" + source = os.path.join(self.local.type_path, cdist_type.explorer_path) + return os.listdir(source) + def transfer_type_explorers(self, cdist_type): """Transfer the type explorers for the given type to the remote side.""" source = os.path.join(self.local.type_path, cdist_type.explorer_path) From 8e55e74bc274914b3e2e6c09405f5114a52bfcfd Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:40:20 +0200 Subject: [PATCH 0700/1024] test for code_local Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 6f26fd19..8cffe053 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -136,3 +136,10 @@ class ObjectTestCase(unittest.TestCase): def test_source_after_changing(self): self.cdist_object.source = ['/path/to/manifest'] self.assertEqual(list(self.cdist_object.source), ['/path/to/manifest']) + + def test_code_local(self): + self.assertEqual(self.cdist_object.code_local, '') + + def test_code_local_after_changing(self): + self.cdist_object.code_local = 'Hello World' + self.assertEqual(self.cdist_object.code_local, 'Hello World') From 93ede2a3bedbc6d4e86bb470e4eb690cfae0054a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:40:50 +0200 Subject: [PATCH 0701/1024] implement code_local Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index b7890eeb..8cea077c 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -99,6 +99,7 @@ class Object(object): prepared = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "prepared")) ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran")) source = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, "source")) + code_local = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "code-local")) @property def exists(self): From 6f7528c4114bc09c067c1a9b689cd82ba35c354e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:42:45 +0200 Subject: [PATCH 0702/1024] test for code_remote Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 8cffe053..0953027b 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -63,6 +63,8 @@ class ObjectTestCase(unittest.TestCase): self.cdist_object.prepared = False self.cdist_object.ran = False self.cdist_object.source = [] + self.cdist_object.code_local = '' + self.cdist_object.code_remote = '' def test_name(self): self.assertEqual(self.cdist_object.name, '__third/moon') @@ -143,3 +145,10 @@ class ObjectTestCase(unittest.TestCase): def test_code_local_after_changing(self): self.cdist_object.code_local = 'Hello World' self.assertEqual(self.cdist_object.code_local, 'Hello World') + + def test_code_remote(self): + self.assertEqual(self.cdist_object.code_remote, '') + + def test_code_remote_after_changing(self): + self.cdist_object.code_remote = 'Hello World' + self.assertEqual(self.cdist_object.code_remote, 'Hello World') From 939962b583f741f5f24ce57ab2534389bbffa9f9 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 13:42:58 +0200 Subject: [PATCH 0703/1024] implement code_remote Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 8cea077c..242b094a 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -100,6 +100,7 @@ class Object(object): ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran")) source = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, "source")) code_local = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "code-local")) + code_remote = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "code-remote")) @property def exists(self): From df57b5188b3604a06bd5564d261110636505c84c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 14:26:36 +0200 Subject: [PATCH 0704/1024] tests for code Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 132 ++++++++++++++++++ .../type/__dump_environment/gencode-local | 8 ++ .../type/__dump_environment/gencode-remote | 1 + 3 files changed, 141 insertions(+) create mode 100644 lib/cdist/test/code/__init__.py create mode 100755 lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local create mode 120000 lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-remote diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py new file mode 100644 index 00000000..397922e8 --- /dev/null +++ b/lib/cdist/test/code/__init__.py @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import os +import tempfile +import unittest +import shutil +import getpass + +import cdist +from cdist import core +from cdist import test +from cdist.exec import local +from cdist.exec import remote +from cdist.core import code + +import os.path as op +my_dir = op.abspath(op.dirname(__file__)) +fixtures = op.join(my_dir, 'fixtures') +local_base_path = fixtures + +class ExplorerClassTestCase(unittest.TestCase): + + def mkdtemp(self, **kwargs): + return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) + + def mkstemp(self, **kwargs): + return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) + + def setUp(self): + target_host = 'localhost' + + self.local_base_path = local_base_path + self.out_path = self.mkdtemp() + self.local = local.Local(target_host, self.local_base_path, self.out_path) + self.local.create_directories() + + 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(target_host, self.remote_base_path, remote_exec, remote_copy) + + self.code = code.Code(target_host, self.local, self.remote) + + def tearDown(self): + shutil.rmtree(self.out_path) + shutil.rmtree(self.remote_base_path) + + def test_run_gencode_local_environment(self): + cdist_type = core.Type(self.local.type_path, '__dump_environment') + cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') + output_string = self.code.run_gencode_local(cdist_object) + output_dict = {} + for line in output_string.split('\n'): + if line: + junk,value = line.split(': ') + key = junk.split(' ')[1] + output_dict[key] = value + self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__global'], self.local.out_path) + self.assertEqual(output_dict['__type'], cdist_type.absolute_path) + self.assertEqual(output_dict['__object'], cdist_object.absolute_path) + self.assertEqual(output_dict['__object_id'], cdist_object.object_id) + self.assertEqual(output_dict['__object_fq'], cdist_object.path) + + def test_run_gencode_remote_environment(self): + cdist_type = core.Type(self.local.type_path, '__dump_environment') + cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') + output_string = self.code.run_gencode_remote(cdist_object) + output_dict = {} + for line in output_string.split('\n'): + if line: + junk,value = line.split(': ') + key = junk.split(' ')[1] + output_dict[key] = value + self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__global'], self.local.out_path) + self.assertEqual(output_dict['__type'], cdist_type.absolute_path) + self.assertEqual(output_dict['__object'], cdist_object.absolute_path) + self.assertEqual(output_dict['__object_id'], cdist_object.object_id) + self.assertEqual(output_dict['__object_fq'], cdist_object.path) + + + +''' + def test_list_type_explorer_names(self): + cdist_type = core.Type(self.local.type_path, '__test_type') + expected = cdist_type.explorers + self.assertEqual(self.explorer.list_type_explorer_names(cdist_type), expected) + + def test_transfer_type_explorers(self): + cdist_type = core.Type(self.local.type_path, '__test_type') + self.explorer.transfer_type_explorers(cdist_type) + source = os.path.join(self.local.type_path, cdist_type.explorer_path) + destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) + self.assertEqual(os.listdir(source), os.listdir(destination)) + + def test_transfer_object_parameters(self): + cdist_type = core.Type(self.local.type_path, '__test_type') + cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') + cdist_object.parameters = {'first': 'first value', 'second': 'second value'} + self.explorer.transfer_object_parameters(cdist_object) + source = os.path.join(self.local.object_path, cdist_object.parameter_path) + destination = os.path.join(self.remote.object_path, cdist_object.parameter_path) + self.assertEqual(os.listdir(source), os.listdir(destination)) + + def test_run_type_explorer(self): + cdist_type = core.Type(self.local.type_path, '__test_type') + cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') + self.explorer.transfer_type_explorers(cdist_type) + output = self.explorer.run_type_explorer('world', cdist_object) + self.assertEqual(output, 'hello\n') +''' diff --git a/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local b/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local new file mode 100755 index 00000000..ac292546 --- /dev/null +++ b/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local @@ -0,0 +1,8 @@ +#!/bin/sh + +echo "echo __target_host: $__target_host" +echo "echo __global: $__global" +echo "echo __type: $__type" +echo "echo __object: $__object" +echo "echo __object_id: $__object_id" +echo "echo __object_fq: $__object_fq" diff --git a/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-remote b/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-remote new file mode 120000 index 00000000..7b427cac --- /dev/null +++ b/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-remote @@ -0,0 +1 @@ +gencode-local \ No newline at end of file From 6d438d4ec5cbb738283fa37c1f96e61834287412 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 14:29:20 +0200 Subject: [PATCH 0705/1024] implement run_gencode_local Signed-off-by: Steven Armstrong --- lib/cdist/core/code.py | 110 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 lib/cdist/core/code.py diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py new file mode 100644 index 00000000..de735cb4 --- /dev/null +++ b/lib/cdist/core/code.py @@ -0,0 +1,110 @@ +# -*- coding: utf-8 -*- +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 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 . +# +# + +import logging +import os + +import cdist + +log = logging.getLogger(__name__) + + +''' +common: + runs only locally, does not need remote + + env: + PATH: prepend directory with type emulator symlinks == local.bin_path + __target_host: the target host we are working on + __cdist_manifest: full qualified path of the manifest == script + __cdist_type_base_path: full qualified path to the directory where types are defined for use in type emulator + == local.type_path + +gencode-local + script: full qualified path to a types gencode-local + + env: + __target_host: the target host we are working on + __global: full qualified path to the global output dir == local.out_path + __object: full qualified path to the object's dir + __object_id: the objects id + __object_fq: full qualified object id, iow: $type.name + / + object_id + __type: full qualified path to the type's dir + + returns: string containing the generated code or None + +gencode-remote + script: full qualified path to a types gencode-remote + + env: + __target_host: the target host we are working on + __global: full qualified path to the global output dir == local.out_path + __object: full qualified path to the object's dir + __object_id: the objects id + __object_fq: full qualified object id, iow: $type.name + / + object_id + __type: full qualified path to the type's dir + + returns: string containing the generated code or None + + +code-local + script: full qualified path to object's code-local + - run script localy + returns: string containing the output + +code-remote + script: full qualified path to object's code-remote + - copy script to remote + - run script remotely + returns: string containing the output +''' + + +class Code(object): + """Generates and executes cdist code scripts. + + """ + def __init__(self, target_host, local, remote): + self.target_host = target_host + self.local = local + self.remote = remote + self.env = { + '__target_host': self.target_host, + '__global': self.local.out_path, + } + + def _get_env_for_object(self, cdist_object): + return { + '__type': cdist_object.type.absolute_path, + '__object': cdist_object.absolute_path, + '__object_id': cdist_object.object_id, + '__object_fq': cdist_object.path, + } + + def run_gencode_local(self, cdist_object): + cdist_type = cdist_object.type + script = os.path.join(self.local.type_path, cdist_type.gencode_local_path) + env = os.environ.copy() + env.update(self.env) + env.update(self._get_env_for_object(cdist_object)) + return self.local.run_script(script, env=env) + From 1665b4b5e651b392b91c1a946180117a9cd61eca Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 14:32:52 +0200 Subject: [PATCH 0706/1024] implement run_gencode_remote Signed-off-by: Steven Armstrong --- lib/cdist/core/code.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index de735cb4..a6804c0b 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -100,11 +100,18 @@ class Code(object): '__object_fq': cdist_object.path, } - def run_gencode_local(self, cdist_object): + def _run_gencode(self, cdist_object, which): cdist_type = cdist_object.type - script = os.path.join(self.local.type_path, cdist_type.gencode_local_path) + script = os.path.join(self.local.type_path, getattr(cdist_type, 'gencode_%s_path' % which)) env = os.environ.copy() env.update(self.env) env.update(self._get_env_for_object(cdist_object)) return self.local.run_script(script, env=env) + def run_gencode_local(self, cdist_object): + """Run the gencode-local script for the given cdist object.""" + return self._run_gencode(cdist_object, 'local') + + def run_gencode_remote(self, cdist_object): + """Run the gencode-remote script for the given cdist object.""" + return self._run_gencode(cdist_object, 'remote') From 5edcc0537b4671d5888a43a8b2113ff8fa7aabeb Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 14:37:50 +0200 Subject: [PATCH 0707/1024] use api internally instead of constructing the same paths again Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 242b094a..a170dd30 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -93,14 +93,14 @@ class Object(object): return os.path.join(self.path, "explorer") requirements = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'require')) - parameters = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.absolute_path, 'parameter')) + parameters = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.parameter_path)) explorers = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.explorer_path)) changed = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "changed")) prepared = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "prepared")) ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran")) source = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, "source")) - code_local = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "code-local")) - code_remote = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "code-remote")) + code_local = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_local_path)) + code_remote = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_remote_path)) @property def exists(self): From 01ab81a4469d58f2fb421ea3141c6cae228954df Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 14:50:50 +0200 Subject: [PATCH 0708/1024] -- duplicate code Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index 397922e8..0c35e09a 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -61,14 +61,15 @@ class ExplorerClassTestCase(unittest.TestCase): self.code = code.Code(target_host, self.local, self.remote) + self.cdist_type = core.Type(self.local.type_path, '__dump_environment') + self.cdist_object = core.Object(self.cdist_type, self.local.object_path, 'whatever') + def tearDown(self): shutil.rmtree(self.out_path) shutil.rmtree(self.remote_base_path) def test_run_gencode_local_environment(self): - cdist_type = core.Type(self.local.type_path, '__dump_environment') - cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') - output_string = self.code.run_gencode_local(cdist_object) + output_string = self.code.run_gencode_local(self.cdist_object) output_dict = {} for line in output_string.split('\n'): if line: @@ -77,15 +78,13 @@ class ExplorerClassTestCase(unittest.TestCase): output_dict[key] = value self.assertEqual(output_dict['__target_host'], self.local.target_host) self.assertEqual(output_dict['__global'], self.local.out_path) - self.assertEqual(output_dict['__type'], cdist_type.absolute_path) - self.assertEqual(output_dict['__object'], cdist_object.absolute_path) - self.assertEqual(output_dict['__object_id'], cdist_object.object_id) - self.assertEqual(output_dict['__object_fq'], cdist_object.path) + self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path) + self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) + self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) + self.assertEqual(output_dict['__object_fq'], self.cdist_object.path) def test_run_gencode_remote_environment(self): - cdist_type = core.Type(self.local.type_path, '__dump_environment') - cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') - output_string = self.code.run_gencode_remote(cdist_object) + output_string = self.code.run_gencode_remote(self.cdist_object) output_dict = {} for line in output_string.split('\n'): if line: @@ -94,12 +93,12 @@ class ExplorerClassTestCase(unittest.TestCase): output_dict[key] = value self.assertEqual(output_dict['__target_host'], self.local.target_host) self.assertEqual(output_dict['__global'], self.local.out_path) - self.assertEqual(output_dict['__type'], cdist_type.absolute_path) - self.assertEqual(output_dict['__object'], cdist_object.absolute_path) - self.assertEqual(output_dict['__object_id'], cdist_object.object_id) - self.assertEqual(output_dict['__object_fq'], cdist_object.path) - + self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path) + self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) + self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) + self.assertEqual(output_dict['__object_fq'], self.cdist_object.path) + ''' def test_list_type_explorer_names(self): From 5055afe0c08f67cf1bf484016b2c4a415a6b87bb Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 14:57:09 +0200 Subject: [PATCH 0709/1024] test for test_transfer_code_remote Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index 0c35e09a..be4530d8 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -63,6 +63,7 @@ class ExplorerClassTestCase(unittest.TestCase): self.cdist_type = core.Type(self.local.type_path, '__dump_environment') self.cdist_object = core.Object(self.cdist_type, self.local.object_path, 'whatever') + self.cdist_object.create() def tearDown(self): shutil.rmtree(self.out_path) @@ -98,6 +99,12 @@ class ExplorerClassTestCase(unittest.TestCase): self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) self.assertEqual(output_dict['__object_fq'], self.cdist_object.path) + def test_transfer_code_remote(self): + self.cdist_object.code_remote = self.code.run_gencode_remote(self.cdist_object) + self.code.transfer_code_remote(self.cdist_object) + destination = os.path.join(self.remote.object_path, self.cdist_object.code_remote_path) + self.assertTrue(os.path.isfile(destination)) + ''' From 31ce938593ca53c32a7c7756eadd8a373676f42e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 14:57:49 +0200 Subject: [PATCH 0710/1024] implement transfer_code_remote Signed-off-by: Steven Armstrong --- lib/cdist/core/code.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index a6804c0b..c42c360b 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -115,3 +115,10 @@ class Code(object): def run_gencode_remote(self, cdist_object): """Run the gencode-remote script for the given cdist object.""" return self._run_gencode(cdist_object, 'remote') + + def transfer_code_remote(self, cdist_object): + """Transfer the code_remote script for the given object to the remote side.""" + source = os.path.join(self.local.object_path, cdist_object.code_remote_path) + destination = os.path.join(self.remote.object_path, cdist_object.code_remote_path) + self.remote.mkdir(destination) + self.remote.transfer(source, destination) From 12e5b3e8dc2c480c3359499a9bef8c49222c93b7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 15:00:07 +0200 Subject: [PATCH 0711/1024] test for run_code_local Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index be4530d8..a6e12e06 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -105,6 +105,20 @@ class ExplorerClassTestCase(unittest.TestCase): destination = os.path.join(self.remote.object_path, self.cdist_object.code_remote_path) self.assertTrue(os.path.isfile(destination)) + def test_run_code_local_environment(self): + self.cdist_object.code_local = self.code.run_gencode_local(self.cdist_object) + output_string = self.code.run_code_local(self.cdist_object) + output_dict = {} + for line in output_string.split('\n'): + if line: + key,value = line.split(': ') + output_dict[key] = value + self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__global'], self.local.out_path) + self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path) + self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) + self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) + self.assertEqual(output_dict['__object_fq'], self.cdist_object.path) ''' From e60510228132f426019389659947cfeef020844c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 15:02:10 +0200 Subject: [PATCH 0712/1024] implement run_code_local Signed-off-by: Steven Armstrong --- lib/cdist/core/code.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index c42c360b..22a8ad34 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -116,6 +116,10 @@ class Code(object): """Run the gencode-remote script for the given cdist object.""" return self._run_gencode(cdist_object, 'remote') + def run_code_local(self, cdist_object): + script = os.path.join(self.local.object_path, cdist_object.code_local_path) + return self.local.run_script(script) + def transfer_code_remote(self, cdist_object): """Transfer the code_remote script for the given object to the remote side.""" source = os.path.join(self.local.object_path, cdist_object.code_remote_path) From 7bc68476a1d879747ae39c96fda20e05ef024172 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 15:09:05 +0200 Subject: [PATCH 0713/1024] test for run_code_remote Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index a6e12e06..970d7692 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -120,6 +120,20 @@ class ExplorerClassTestCase(unittest.TestCase): self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) self.assertEqual(output_dict['__object_fq'], self.cdist_object.path) + def test_run_code_remote_environment(self): + self.cdist_object.code_remote = self.code.run_gencode_remote(self.cdist_object) + output_string = self.code.run_code_remote(self.cdist_object) + output_dict = {} + for line in output_string.split('\n'): + if line: + key,value = line.split(': ') + output_dict[key] = value + self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__global'], self.local.out_path) + self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path) + self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) + self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) + self.assertEqual(output_dict['__object_fq'], self.cdist_object.path) ''' def test_list_type_explorer_names(self): From 1c3902f3db6dc05240c7ef1c84d825e9e7a3822c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 15:09:47 +0200 Subject: [PATCH 0714/1024] implement run_code_remote Signed-off-by: Steven Armstrong --- lib/cdist/core/code.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index 22a8ad34..b2cc033c 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -116,13 +116,22 @@ class Code(object): """Run the gencode-remote script for the given cdist object.""" return self._run_gencode(cdist_object, 'remote') - def run_code_local(self, cdist_object): - script = os.path.join(self.local.object_path, cdist_object.code_local_path) - return self.local.run_script(script) - def transfer_code_remote(self, cdist_object): """Transfer the code_remote script for the given object to the remote side.""" source = os.path.join(self.local.object_path, cdist_object.code_remote_path) destination = os.path.join(self.remote.object_path, cdist_object.code_remote_path) self.remote.mkdir(destination) self.remote.transfer(source, destination) + + def _run_code(self, cdist_object, which): + which_exec = getattr(self, which) + script = os.path.join(self.local.object_path, getattr(cdist_object, 'code_%s_path' % which)) + return which_exec.run_script(script) + + def run_code_local(self, cdist_object): + """Run the code-local script for the given cdist object.""" + return self._run_code(cdist_object, 'local') + + def run_code_remote(self, cdist_object): + """Run the code-remote script for the given cdist object on the remote side.""" + return self._run_code(cdist_object, 'remote') From 6c7e280eac188051fb0a6bca0fb33a6d91f492b6 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 15:11:50 +0200 Subject: [PATCH 0715/1024] remove obsolete method, merge code Signed-off-by: Steven Armstrong --- lib/cdist/core/code.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index b2cc033c..6dfa2da4 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -92,20 +92,17 @@ class Code(object): '__global': self.local.out_path, } - def _get_env_for_object(self, cdist_object): - return { - '__type': cdist_object.type.absolute_path, - '__object': cdist_object.absolute_path, - '__object_id': cdist_object.object_id, - '__object_fq': cdist_object.path, - } - def _run_gencode(self, cdist_object, which): cdist_type = cdist_object.type script = os.path.join(self.local.type_path, getattr(cdist_type, 'gencode_%s_path' % which)) env = os.environ.copy() env.update(self.env) - env.update(self._get_env_for_object(cdist_object)) + env.update({ + '__type': cdist_object.type.absolute_path, + '__object': cdist_object.absolute_path, + '__object_id': cdist_object.object_id, + '__object_fq': cdist_object.path, + }) return self.local.run_script(script, env=env) def run_gencode_local(self, cdist_object): From fec3cca3b01dabbe7133c4be8b53655f7785d630 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 16:25:44 +0200 Subject: [PATCH 0716/1024] delegate path handling to local and remote Signed-off-by: Steven Armstrong --- lib/cdist/context.py | 50 +++++++++++--------------------------------- 1 file changed, 12 insertions(+), 38 deletions(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index f70e9752..3a6ed8a2 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -52,25 +52,13 @@ class Context(object): self.log = logging.getLogger(self.target_host) self.log.addFilter(self) - # Base and Temp Base + # Local base directory self.base_path = (base_path or os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))) - # Local input - self.cache_path = os.path.join(self.base_path, "cache", - self.target_host) - 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_base_path = os.path.join(self.conf_path, "type") - self.lib_path = os.path.join(self.base_path, "lib") - - self.initial_manifest = (initial_manifest or - os.path.join(self.manifest_path, "init")) - - # Local output + # 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: self.out_path = os.environ['__cdist_out_dir'] self.temp_dir = None @@ -78,31 +66,17 @@ class Context(object): self.temp_dir = tempfile.mkdtemp() self.out_path = os.path.join(self.temp_dir, "out") - self.bin_path = os.path.join(self.out_path, "bin") - self.global_explorer_out_path = os.path.join(self.out_path, "explorer") - self.object_base_path = os.path.join(self.out_path, "object") + self.local = local.Local(self.target_host, self.base_path, self.out_path) - # Remote directory base - if '__cdist_remote_out_dir' in os.environ: - self.remote_base_path = os.environ['__cdist_remote_out_dir'] - else: - self.remote_base_path = "/var/lib/cdist" + self.initial_manifest = (initial_manifest or + os.path.join(self.local.manifest_path, "init")) - self.remote_conf_path = os.path.join(self.remote_base_path, "conf") - self.remote_object_path = os.path.join(self.remote_base_path, "object") - - self.remote_type_path = os.path.join(self.remote_conf_path, "type") - self.remote_global_explorer_path = os.path.join(self.remote_conf_path, "explorer") - - if '__remote_exec' in os.environ: - self.remote_exec = os.environ['__remote_exec'] - else: - self.remote_exec = "ssh -o User=root -q" - - if '__remote_copy' in os.environ: - self.remote_copy = os.environ['__remote_copy'] - else: - self.remote_copy = "scp -o User=root -q" + # Remote + self.remote_base_path = os.environ.get('__cdist_remote_out_dir', "/var/lib/cdist") + self.remote_exec = os.environ.get('__remote_exec', "ssh -o User=root -q") + self.remote_copy = os.environ.get('__remote_copy', "scp -o User=root -q") + self.remote = remote.Remote(self.target_host, self.remote_base_path, + self.remote_exec, self.remote_copy) def cleanup(self): """Remove temp stuff""" From 12784c8bd806ebef0f84099a055b234bfc614c98 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 16:26:07 +0200 Subject: [PATCH 0717/1024] +FIXME Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index 1f253f09..fd9f8229 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -83,6 +83,7 @@ class Local(object): def mkdir(self, path): """Create directory on the local side.""" self.log.debug("Local mkdir: %s", path) + # FIXME: dont set mode here, fix unittest mkdtemp instead os.makedirs(path, mode=0o700, exist_ok=True) def run(self, command, env=None): From 4f7d75e6047efd9dd102df23c95d86eb3e141f6e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 16:27:07 +0200 Subject: [PATCH 0718/1024] remove/fix copy paste stuff Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index 970d7692..2b4b1c87 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -37,7 +37,7 @@ my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') local_base_path = fixtures -class ExplorerClassTestCase(unittest.TestCase): +class CodeTestCase(unittest.TestCase): def mkdtemp(self, **kwargs): return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) @@ -134,33 +134,3 @@ class ExplorerClassTestCase(unittest.TestCase): 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_fq'], self.cdist_object.path) - -''' - def test_list_type_explorer_names(self): - cdist_type = core.Type(self.local.type_path, '__test_type') - expected = cdist_type.explorers - self.assertEqual(self.explorer.list_type_explorer_names(cdist_type), expected) - - def test_transfer_type_explorers(self): - cdist_type = core.Type(self.local.type_path, '__test_type') - self.explorer.transfer_type_explorers(cdist_type) - source = os.path.join(self.local.type_path, cdist_type.explorer_path) - destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) - self.assertEqual(os.listdir(source), os.listdir(destination)) - - def test_transfer_object_parameters(self): - cdist_type = core.Type(self.local.type_path, '__test_type') - cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') - cdist_object.parameters = {'first': 'first value', 'second': 'second value'} - self.explorer.transfer_object_parameters(cdist_object) - source = os.path.join(self.local.object_path, cdist_object.parameter_path) - destination = os.path.join(self.remote.object_path, cdist_object.parameter_path) - self.assertEqual(os.listdir(source), os.listdir(destination)) - - def test_run_type_explorer(self): - cdist_type = core.Type(self.local.type_path, '__test_type') - cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') - self.explorer.transfer_type_explorers(cdist_type) - output = self.explorer.run_type_explorer('world', cdist_object) - self.assertEqual(output, 'hello\n') -''' From fced07634a526f3fb58a08fa3b47a0651d9d786e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 16:27:41 +0200 Subject: [PATCH 0719/1024] initial rewrite of config_install Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 174 +++++++++--------------------------- 1 file changed, 44 insertions(+), 130 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index c49d32fc..dc847a8b 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -28,11 +28,8 @@ import sys import tempfile import time -import cdist.core -import cdist.context -import cdist.exec -#import cdist.explorer -#import cdist.manifest +from cdist import core + class ConfigInstall(object): """Cdist main class to hold arbitrary data""" @@ -41,58 +38,29 @@ class ConfigInstall(object): self.context = context self.log = logging.getLogger(self.context.target_host) - self.exec_wrapper = cdist.exec.Wrapper( - target_host = self.context.target_host, - remote_exec=self.context.remote_exec, - remote_copy=self.context.remote_copy) - # Create directories other may depend on - self.__init_local_paths() - self.__init_remote_paths() + # For easy access + self.local = context.local + self.remote = context.remote - self.global_explorer = cdist.explorer.GlobalExplorer(self.context.global_in, out) - self.type_explorer = cdist.explorer.GlobalExplorer(self.context.global_in, out) + # Initialise local directory structure + self.local.create_directories() + # Initialise remote directory structure + self.remote.create_directories() - self.global_explorer = cdist.core.GlobalExplorer - #self.manifest = cdist.manifest.Mamifest() - - self.manifest.initial_manifest() - self.manifest.type_manifest(cdist_object) - self.global_explorer.run()? - - self.type_explorer.run(cdist_object)? - - self.log = logging.getLogger(self.context.target_host) + self.explorer = core.Explorer(self.context.target_host, self.local, self.remote) + self.manifest = core.Manifest(self.context.target_host, self.local) + self.code = core.Code(self.context.target_host, self.local, self.remote) # Setup env to be used by others - FIXME self.__init_env() - def __init_remote_paths(self): - """Initialise remote directory structure""" - self.exec_wrapper.remove_remote_path(self.context.remote_base_path) - self.exec_wrapper.remote_mkdir(self.context.remote_base_path) - self.exec_wrapper.remote_mkdir(self.context.remote_conf_path) - - def __init_local_paths(self): - """Initialise local directory structure""" - - # Create base dir, if user supplied and not existing - if not os.path.isdir(self.context.base_path): - os.mkdir(self.context.base_path) - - # FIXME: raise more beautiful exception / Steven: handle exception - os.mkdir(self.context.out_path) - os.mkdir(self.context.bin_path) - -# os.environ['__target_host'] = self.context.target_host -# if self.context.debug: -# os.environ['__debug'] = "yes" - def cleanup(self): - self.log.debug("Saving " + self.context.out_path + " to " + self.context.cache_path) - if os.path.exists(self.context.cache_path): - shutil.rmtree(self.context.cache_path) - shutil.move(self.context.out_path, self.context.cache_path) + # FIXME: move to local? + self.log.debug("Saving " + self.local.out_path + " to " + self.local.cache_path) + if os.path.exists(self.local.cache_path): + shutil.rmtree(self.local.cache_path) + shutil.move(self.local.out_path, self.local.cache_path) def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" @@ -110,9 +78,9 @@ class ConfigInstall(object): def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" - self.link_emulator() - self.global_explorer_run() - self.run_initial_manifest() + self.local.link_emulator() + self.run_global_explorers() + self.manifest.run_initial_manifest(self.context.initial_manifest) self.log.info("Running object manifests and type explorers") @@ -120,8 +88,8 @@ class ConfigInstall(object): new_objects_created = True while new_objects_created: new_objects_created = False - for cdist_object in cdist.core.Object.list_objects(self.object_base_path, - self.context.type_base_path): + for cdist_object in core.Object.list_objects(self.local.object_path, + self.local.type_path): if cdist_object.prepared: self.log.debug("Skipping rerun of object %s", cdist_object) continue @@ -129,17 +97,15 @@ class ConfigInstall(object): self.object_prepare(cdist_object) new_objects_created = True - - def self.global_explorer_run() + def run_global_explorers(self): """Run global explorers and save output""" - - output = self.global_explorer.run() - - for explorer in output: - outfile = os.path.join(self.context.global_explorer_out_path, - explorer) - outfile_fd = open(outfile, "w") - outfile_fd.write() + # FIXME: move to explorer, pass global_explorer_out_path as argument + self.explorer.transfer_global_explorers() + for explorer in self.explorer.list_global_explorer_names(): + output = self.explorer.run_global_explorer(explorer) + path = os.path.join(self.local.global_explorer_out_path, explorer) + with open(path, 'w') as fd: + fd.write(output) def object_prepare(self, cdist_object): """Prepare object: Run type explorer + manifest""" @@ -160,78 +126,26 @@ class ConfigInstall(object): for requirement in cdist_object.requirements: self.log.debug("Object %s requires %s", cdist_object, requirement) + # FIXME: requirement is a string, need to create object here self.object_run(requirement) - # - # Setup env Variable: - # - env = os.environ.copy() - env['__target_host'] = self.context.target_host - env['__global'] = self.context.out_path - env["__object"] = os.path.join(self.object_base_path, cdist_object.path) - env["__object_id"] = cdist_object.object_id - env["__object_fq"] = cdist_object.name - env["__type"] = cdist_type.name + # Generate + cdist_object.code_local = self.code.run_gencode_local(cdist_object) + cdist_object.code_remote = self.code.run_gencode_remote(cdist_object) + if cdist_object.code_local or cdist_object.code_remote: + cdist_object.changed = True - # gencode - for cmd in ["local", "remote"]: - bin = os.path.join(self.context.type_base_path, - getattr(cdist_type, "gencode_" + cmd + "_path")) - - if os.path.isfile(bin): - outfile = os.path.join(self.object_base_path, - getattr(cdist_object, "code_" + cmd + "_path")) - - outfile_fd = open(outfile, "w") - - # Need to flush to ensure our write is done before stdout write - # FIXME: code header still needed? - outfile_fd.write(CODE_HEADER) - outfile_fd.flush() - - cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) - outfile_fd.close() - - status = os.stat(outfile) - - # Remove output if empty, else make it executable - if status.st_size == len(CODE_HEADER): - os.unlink(outfile) - else: - # Add header and make executable - identically to 0o700 - os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) - cdist_object.changed=True - - # code local - code_local = cdist_object.code_local_path - if os.path.isfile(code_local): - cdist.exec.run_or_fail([code_local]) - - # code remote - local_remote_code = os.path.join(self.object_base_path, - cdist_object.code_remote_path) - remote_remote_code = os.path.join(self.remote_object_path, - cdist_object.code_remote_path) - if os.path.isfile(local_remote_code): - self.context.transfer_path(local_remote_code, remote_remote_code) - cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) - - cdist_object.ran = True - - def link_emulator(self): - """Link emulator to types""" - src = os.path.abspath(self.context.exec_path) - for cdist_type in cdist.core.Type.list_types(self.context.type_base_path): - dst = os.path.join(self.context.bin_path, cdist_type.name) - self.log.debug("Linking emulator: %s to %s", src, dst) - - # FIXME: handle exception / make it more beautiful / Steven: raise except :-) - os.symlink(src, dst) + # Execute + if cdist_object.code_local: + self.code.run_code_local(cdist_object) + if cdist_object.code_remote: + self.code.transfer_code_remote(cdist_object) + self.code.run_code_remote(cdist_object) def stage_run(self): """The final (and real) step of deployment""" self.log.info("Generating and executing code") - for cdist_object in cdist.core.Object.list_objects(self.object_base_path, - self.context.type_base_path): + for cdist_object in cdist.core.Object.list_objects(self.local.object_path, + self.local.type_path): self.log.debug("Run object: %s", cdist_object) self.object_run(cdist_object) From f1ff8d2f61e0416830949135129fe3a8fdc28f79 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 16:28:36 +0200 Subject: [PATCH 0720/1024] -todo Signed-off-by: Steven Armstrong --- bin/cdist | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 37461aab..fae83ff1 100755 --- a/bin/cdist +++ b/bin/cdist @@ -115,7 +115,6 @@ def configinstall(args, mode): time_start = time.time() for host in args.host: - # Setup Local/Remote context = cdist.context.Context( target_host=host, initial_manifest=args.manifest, From 08ffaf61f5ed93868749d6d64f6ff675ebda2222 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 16:36:00 +0200 Subject: [PATCH 0721/1024] -legacy code Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index dc847a8b..ff6d3921 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -52,9 +52,6 @@ class ConfigInstall(object): self.manifest = core.Manifest(self.context.target_host, self.local) self.code = core.Code(self.context.target_host, self.local, self.remote) - # Setup env to be used by others - FIXME - self.__init_env() - def cleanup(self): # FIXME: move to local? self.log.debug("Saving " + self.local.out_path + " to " + self.local.cache_path) From be21cdce178ed0083ace63c11ff717a2a79c8178 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 16:41:54 +0200 Subject: [PATCH 0722/1024] set __cdist_manifest for use in type emulator Signed-off-by: Steven Armstrong --- lib/cdist/core/manifest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index fc82b1cc..8d7f6e36 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -79,6 +79,7 @@ class Manifest(object): env = os.environ.copy() env.update(self.env) env['__manifest'] = self.local.manifest_path + env['__cdist_manifest'] = script return self.local.run_script(script, env=env) def run_type_manifest(self, cdist_object): From 74300ab38ec83be2366a4962e19460f013dddd1c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 16:52:06 +0200 Subject: [PATCH 0723/1024] set __cdist_manifest for use in type emulator Signed-off-by: Steven Armstrong --- lib/cdist/core/manifest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index 8d7f6e36..c1d6b7f0 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -83,6 +83,7 @@ class Manifest(object): return self.local.run_script(script, env=env) def run_type_manifest(self, cdist_object): + script = os.path.join(self.local.type_path, cdist_object.type.manifest_path) env = os.environ.copy() env.update(self.env) env.update({ @@ -90,6 +91,6 @@ class Manifest(object): '__object_id': cdist_object.object_id, '__object_fq': cdist_object.path, '__type': cdist_object.type.absolute_path, + '__cdist_manifest': script, }) - script = os.path.join(self.local.type_path, cdist_object.type.manifest_path) return self.local.run_script(script, env=env) From 6dada17509e7dd37543d654a3f5f92402d091283 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 16:53:07 +0200 Subject: [PATCH 0724/1024] only run type manifest if it exists Signed-off-by: Steven Armstrong --- lib/cdist/core/manifest.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index c1d6b7f0..93eb6f2d 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -84,13 +84,14 @@ class Manifest(object): def run_type_manifest(self, cdist_object): script = os.path.join(self.local.type_path, cdist_object.type.manifest_path) - env = os.environ.copy() - env.update(self.env) - env.update({ - '__object': cdist_object.absolute_path, - '__object_id': cdist_object.object_id, - '__object_fq': cdist_object.path, - '__type': cdist_object.type.absolute_path, - '__cdist_manifest': script, - }) - return self.local.run_script(script, env=env) + if os.path.isfile(script): + env = os.environ.copy() + env.update(self.env) + env.update({ + '__object': cdist_object.absolute_path, + '__object_id': cdist_object.object_id, + '__object_fq': cdist_object.path, + '__type': cdist_object.type.absolute_path, + '__cdist_manifest': script, + }) + return self.local.run_script(script, env=env) From d37ca88752690d6d4f00c204b57fabd6e8d36f9b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 16:53:48 +0200 Subject: [PATCH 0725/1024] +run_type_explorers, minor fixes Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index ff6d3921..d20fb92d 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -75,7 +75,7 @@ class ConfigInstall(object): def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" - self.local.link_emulator() + self.local.link_emulator(self.context.exec_path) self.run_global_explorers() self.manifest.run_initial_manifest(self.context.initial_manifest) @@ -104,10 +104,17 @@ class ConfigInstall(object): with open(path, 'w') as fd: fd.write(output) + def run_type_explorers(self, cdist_object): + """Run type explorers and save output in object.""" + self.explorer.transfer_type_explorers(cdist_object.type) + for explorer in self.explorer.list_type_explorer_names(cdist_object.type): + output = self.explorer.run_type_explorer(explorer, cdist_object) + cdist_object.explorers[explorer] = output + def object_prepare(self, cdist_object): """Prepare object: Run type explorer + manifest""" self.log.debug("Preparing object: " + cdist_object.name) - cdist_object.explorers = self.explorer.run_type_explorer(cdist_object) + self.run_type_explorers(cdist_object) self.manifest.run_type_manifest(cdist_object) cdist_object.prepared = True @@ -142,7 +149,7 @@ class ConfigInstall(object): def stage_run(self): """The final (and real) step of deployment""" self.log.info("Generating and executing code") - for cdist_object in cdist.core.Object.list_objects(self.local.object_path, + for cdist_object in core.Object.list_objects(self.local.object_path, self.local.type_path): self.log.debug("Run object: %s", cdist_object) self.object_run(cdist_object) From 773d325afa67380340d0d6fc12229ccb1eef4d17 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 16:56:03 +0200 Subject: [PATCH 0726/1024] only run gencode scripts if they exist Signed-off-by: Steven Armstrong --- lib/cdist/core/code.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index 6dfa2da4..2345acc8 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -95,15 +95,16 @@ class Code(object): def _run_gencode(self, cdist_object, which): cdist_type = cdist_object.type script = os.path.join(self.local.type_path, getattr(cdist_type, 'gencode_%s_path' % which)) - env = os.environ.copy() - env.update(self.env) - env.update({ - '__type': cdist_object.type.absolute_path, - '__object': cdist_object.absolute_path, - '__object_id': cdist_object.object_id, - '__object_fq': cdist_object.path, - }) - return self.local.run_script(script, env=env) + if os.path.isfile(script): + env = os.environ.copy() + env.update(self.env) + env.update({ + '__type': cdist_object.type.absolute_path, + '__object': cdist_object.absolute_path, + '__object_id': cdist_object.object_id, + '__object_fq': cdist_object.path, + }) + return self.local.run_script(script, env=env) def run_gencode_local(self, cdist_object): """Run the gencode-local script for the given cdist object.""" From 1f44617133b5af4e3d1c1d49793ad67aa9aefe8c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 17:03:05 +0200 Subject: [PATCH 0727/1024] use remote paths when executing on remote side Signed-off-by: Steven Armstrong --- lib/cdist/core/code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index 2345acc8..af756263 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -123,7 +123,7 @@ class Code(object): def _run_code(self, cdist_object, which): which_exec = getattr(self, which) - script = os.path.join(self.local.object_path, getattr(cdist_object, 'code_%s_path' % which)) + script = os.path.join(which_exec.object_path, getattr(cdist_object, 'code_%s_path' % which)) return which_exec.run_script(script) def run_code_local(self, cdist_object): From d2bbd1d14c929f7d534737de26d301555255a762 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 17:04:07 +0200 Subject: [PATCH 0728/1024] fix imports Signed-off-by: Steven Armstrong --- lib/cdist/context.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 3a6ed8a2..cf314409 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -24,12 +24,11 @@ import logging import os import sys import tempfile -#import stat -#import shutil -#import time -# -#import cdist.core -#import cdist.exec +import shutil + +from cdist.exec import local +from cdist.exec import remote + class Context(object): """Hold information about current context""" From 99ffda3cdf2dc202bd9852f4b124e6e9557659b8 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 17:04:33 +0200 Subject: [PATCH 0729/1024] always create global_explorer_out_path Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index fd9f8229..bef44e21 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -73,6 +73,7 @@ class Local(object): def create_directories(self): self.mkdir(self.out_path) + self.mkdir(self.global_explorer_out_path) self.mkdir(self.bin_path) def rmdir(self, path): From d02b8d9d308fcc40b5e00d9d3ad0fde82600f575 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 17:04:54 +0200 Subject: [PATCH 0730/1024] fix imports Signed-off-by: Steven Armstrong --- lib/cdist/core/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cdist/core/__init__.py b/lib/cdist/core/__init__.py index d6377b12..1dec9e8f 100644 --- a/lib/cdist/core/__init__.py +++ b/lib/cdist/core/__init__.py @@ -19,8 +19,8 @@ # # -__all__ = ['Type', 'Object'] - from cdist.core.type import Type from cdist.core.object import Object -from cdist.core.global_explorer import GlobalExplorer +from cdist.core.explorer import Explorer +from cdist.core.manifest import Manifest +from cdist.core.code import Code From 08d98ac3890a6535571540727bd0c9ecdf0d34a7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 17:05:34 +0200 Subject: [PATCH 0731/1024] only list type explorers if there are any; only transfer type explorers if there are ant Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index 7e61639e..ee1008fe 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -95,14 +95,18 @@ class Explorer(object): def list_type_explorer_names(self, cdist_type): """Return a list of explorer names for the given type.""" source = os.path.join(self.local.type_path, cdist_type.explorer_path) - return os.listdir(source) + try: + return os.listdir(source) + except EnvironmentError: + return [] def transfer_type_explorers(self, cdist_type): """Transfer the type explorers for the given type to the remote side.""" - source = os.path.join(self.local.type_path, cdist_type.explorer_path) - destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) - self.remote.mkdir(destination) - self.remote.transfer(source, destination) + if cdist_type.explorers: + source = os.path.join(self.local.type_path, cdist_type.explorer_path) + destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) + self.remote.mkdir(destination) + self.remote.transfer(source, destination) def transfer_object_parameters(self, cdist_object): """Transfer the parameters for the given object to the remote side.""" From e2e2ddb33b4e187d3a3a0403ed1a628ddfabd253 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 17:05:53 +0200 Subject: [PATCH 0732/1024] add missing import Signed-off-by: Steven Armstrong --- bin/cdist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/cdist b/bin/cdist index fae83ff1..88cdf399 100755 --- a/bin/cdist +++ b/bin/cdist @@ -114,6 +114,8 @@ def configinstall(args, mode): time_start = time.time() + import cdist.context + for host in args.host: context = cdist.context.Context( target_host=host, From a822b64d9545e7603f36d460332005d3d00acedd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 13 Oct 2011 17:08:51 +0200 Subject: [PATCH 0733/1024] +output Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-13.output | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 doc/dev/logs/2011-10-13.output diff --git a/doc/dev/logs/2011-10-13.output b/doc/dev/logs/2011-10-13.output new file mode 100644 index 00000000..3eb68e1f --- /dev/null +++ b/doc/dev/logs/2011-10-13.output @@ -0,0 +1,10 @@ +[17:07] brief:cdist% ./bin/cdist config localhost +cat: /home/users/nico/.tmp/tmpfgy16_/out/object/__directory/tmp/foo/bar/.cdist/explorer/exists: No such file or directory +chgrp: cannot access `/tmp/foo/bar': No such file or directory +ERROR: localhost: Code that raised the error: +chgrp -R "postdrop" "/tmp/foo/bar" +chown -R "nico" "/tmp/foo/bar" + +ERROR: Remote script execution failed: /var/lib/cdist/object/__directory/tmp/foo/bar/.cdist/code-remote ['ssh', '-o', 'User=root', '-q', 'localhost', '/bin/sh', '-e', '/var/lib/cdist/object/__directory/tmp/foo/bar/.cdist/code-remote'] +[17:08] brief:cdist% + From 7abb33838107a5302f2e5c8f267295b5dab32010 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 17:11:03 +0200 Subject: [PATCH 0734/1024] bugfix test case Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index 2b4b1c87..0d7aec75 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -122,6 +122,7 @@ class CodeTestCase(unittest.TestCase): def test_run_code_remote_environment(self): self.cdist_object.code_remote = self.code.run_gencode_remote(self.cdist_object) + self.code.transfer_code_remote(self.cdist_object) output_string = self.code.run_code_remote(self.cdist_object) output_dict = {} for line in output_string.split('\n'): From 6271e27eb51030df9a8f5e65422c66a594616122 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 17:38:09 +0200 Subject: [PATCH 0735/1024] transfer object parameter before running type explorers Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index d20fb92d..22e836e2 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -107,6 +107,7 @@ class ConfigInstall(object): def run_type_explorers(self, cdist_object): """Run type explorers and save output in object.""" self.explorer.transfer_type_explorers(cdist_object.type) + self.explorer.transfer_object_parameters(cdist_object) for explorer in self.explorer.list_type_explorer_names(cdist_object.type): output = self.explorer.run_type_explorer(explorer, cdist_object) cdist_object.explorers[explorer] = output From 589b5a68b9dc3815e9595e64097d917659949945 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 17:59:23 +0200 Subject: [PATCH 0736/1024] FileList raise exception if write failse Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index 50b95ea2..e441533a 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -49,6 +49,7 @@ class FileList(collections.MutableSequence): def __read(self): lines = [] + # if file does not exist return empty list try: with open(self.path) as fd: for line in fd: @@ -59,13 +60,9 @@ class FileList(collections.MutableSequence): return lines def __write(self, lines): - try: - with open(self.path, 'w') as fd: - for line in lines: - fd.write(str(line) + '\n') - except EnvironmentError as e: - # error ignored - raise + with open(self.path, 'w') as fd: + for line in lines: + fd.write(str(line) + '\n') def __repr__(self): return repr(list(self)) From e70e0569ec24047966925bbba6fda2109f66624e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 18:01:46 +0200 Subject: [PATCH 0737/1024] FileList handle exception when deleting old/unused file Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index e441533a..cfdb007e 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -43,7 +43,11 @@ class FileList(collections.MutableSequence): self.path = path if initial: # delete existing file - os.unlink(self.path) + try: + os.unlink(self.path) + except EnvironmentError: + # ignored + pass for i in initial: self.append(i) From 9c04da1d4267adc713955b775e278f92c2e22939 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 21:21:59 +0200 Subject: [PATCH 0738/1024] DirectoryDictProperty: create directory if it doesnt exist Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index cfdb007e..f00ea98a 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -155,6 +155,9 @@ class DirectoryDict(collections.MutableMapping): if not os.path.isabs(path): raise AbsolutePathRequiredError(path) self.path = path + # create directory if it doesn't exist + if not os.path.isdir(self.path): + os.mkdir(self.path) if initial is not None: self.update(initial) if kwargs: @@ -210,6 +213,9 @@ class DirectoryDictProperty(DirectoryDict): path = path(*args, **kwargs) if not os.path.isabs(path): raise AbsolutePathRequiredError(path) + # create directory if it doesn't exist + if not os.path.isdir(path): + os.mkdir(path) self.path = path # Descriptor Protocol @@ -222,8 +228,6 @@ class DirectoryDictProperty(DirectoryDict): def __set__(self, obj, value): self._set_path(obj) if value is not None: - # create directory if it doesn't exist - os.makedirs(self.path, exist_ok=True) for name in self.keys(): del self[name] self.update(value) From 1b7ebc5885ce9f58466da7d48dbb7ef2465af3cf Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 21:23:04 +0200 Subject: [PATCH 0739/1024] more tests for different ways to access object.explorers Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 0953027b..982784f2 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -97,10 +97,27 @@ class ObjectTestCase(unittest.TestCase): def test_explorers(self): self.assertEqual(self.cdist_object.explorers, {}) - def test_explorers_after_changing(self): + # FIXME: actually testing fsproperty.DirectoryDictProperty here, move to their own test case + def test_explorers_assign_dict(self): expected = {'first': 'foo', 'second': 'bar'} # when set, written to file self.cdist_object.explorers = expected + object_explorer_path = os.path.join(self.cdist_object.base_path, self.cdist_object.explorer_path) + self.assertTrue(os.path.isdir(object_explorer_path)) + # when accessed, read from file + self.assertEqual(self.cdist_object.explorers, expected) + # remove dynamically created folder + self.cdist_object.explorers = {} + os.rmdir(os.path.join(self.cdist_object.base_path, self.cdist_object.explorer_path)) + + # FIXME: actually testing fsproperty.DirectoryDictProperty here, move to their own test case + def test_explorers_assign_key_value(self): + expected = {'first': 'foo', 'second': 'bar'} + object_explorer_path = os.path.join(self.cdist_object.base_path, self.cdist_object.explorer_path) + for key,value in expected.items(): + # when set, written to file + self.cdist_object.explorers[key] = value + self.assertTrue(os.path.isfile(os.path.join(object_explorer_path, key))) # when accessed, read from file self.assertEqual(self.cdist_object.explorers, expected) # remove dynamically created folder From 94724427fa36154cb9b175e089f658e3229d6c70 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 21:27:19 +0200 Subject: [PATCH 0740/1024] ++debug Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 22e836e2..c146d1da 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -110,6 +110,7 @@ class ConfigInstall(object): self.explorer.transfer_object_parameters(cdist_object) for explorer in self.explorer.list_type_explorer_names(cdist_object.type): output = self.explorer.run_type_explorer(explorer, cdist_object) + print("run_type_explorers: %s = %s" % (explorer, output)) cdist_object.explorers[explorer] = output def object_prepare(self, cdist_object): From a8e8d7b2274d38e353dd05ad6819b0a8e302b6b4 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 21:30:17 +0200 Subject: [PATCH 0741/1024] ++debug Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index f00ea98a..9b55be72 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -211,9 +211,11 @@ class DirectoryDictProperty(DirectoryDict): path = self.__path if callable(path): path = path(*args, **kwargs) + print("_set_path: %s" % path) if not os.path.isabs(path): raise AbsolutePathRequiredError(path) # create directory if it doesn't exist + print("os.path.isdir(%s): %s" % (path, os.path.isdir(path))) if not os.path.isdir(path): os.mkdir(path) self.path = path From cf6139504bbb94b92b755b6908834cc2bcedcc17 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 21:38:37 +0200 Subject: [PATCH 0742/1024] ++debug Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index c146d1da..96a1555d 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -106,10 +106,13 @@ class ConfigInstall(object): def run_type_explorers(self, cdist_object): """Run type explorers and save output in object.""" + self.log.debug("Transfering type explorers for type: %s", cdist_object.type) self.explorer.transfer_type_explorers(cdist_object.type) + self.log.debug("Transfering object parameters for object: %s", cdist_object.name) self.explorer.transfer_object_parameters(cdist_object) for explorer in self.explorer.list_type_explorer_names(cdist_object.type): output = self.explorer.run_type_explorer(explorer, cdist_object) + self.log.debug("Running type explorer '%s' for object '%s'", explorer, cdist_object.name) print("run_type_explorers: %s = %s" % (explorer, output)) cdist_object.explorers[explorer] = output From 0aa53bab4cfc88620b045b321dee67a396202474 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 21:51:16 +0200 Subject: [PATCH 0743/1024] ++debug Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index 9b55be72..3559fdcf 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -207,6 +207,7 @@ class DirectoryDictProperty(DirectoryDict): self.__path = path def _set_path(self, *args, **kwargs): + print("_set_path: self=%s, args=%s, kwargs=%s" % (self, args, kwargs)) if self.path is None: path = self.__path if callable(path): From 7fc63a380215c7694676f0cb3d80b26e46d35ca1 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 21:53:37 +0200 Subject: [PATCH 0744/1024] ++debug Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index 3559fdcf..a6b7b414 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -207,7 +207,7 @@ class DirectoryDictProperty(DirectoryDict): self.__path = path def _set_path(self, *args, **kwargs): - print("_set_path: self=%s, args=%s, kwargs=%s" % (self, args, kwargs)) + print("_set_path: self=%s, args=%s, kwargs=%s" % (self, str(args), str(kwargs))) if self.path is None: path = self.__path if callable(path): From 17ce03f54dcfad34c233ce403f2d1160a8d4e448 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 21:54:53 +0200 Subject: [PATCH 0745/1024] ++debug Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index a6b7b414..d5c17d50 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -207,7 +207,7 @@ class DirectoryDictProperty(DirectoryDict): self.__path = path def _set_path(self, *args, **kwargs): - print("_set_path: self=%s, args=%s, kwargs=%s" % (self, str(args), str(kwargs))) + print("_set_path: self=%r, args=%r, kwargs=%r" % (self, args, kwargs)) if self.path is None: path = self.__path if callable(path): From a3e1ca9a186f429a895be8ccbbb7c73583ad7fcc Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 21:56:40 +0200 Subject: [PATCH 0746/1024] ++debug Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index d5c17d50..76e8b5ba 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -207,7 +207,9 @@ class DirectoryDictProperty(DirectoryDict): self.__path = path def _set_path(self, *args, **kwargs): - print("_set_path: self=%r, args=%r, kwargs=%r" % (self, args, kwargs)) + print("_set_path: self: %s" % self) + print("_set_path: args: %s" % args) + print("_set_path: kwargs: %s" % kwargs) if self.path is None: path = self.__path if callable(path): From 5bf0f24e6207d81437ec4ec0f317aa65232f7ddc Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 21:58:35 +0200 Subject: [PATCH 0747/1024] ++debug Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index 76e8b5ba..e17d1438 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -207,7 +207,7 @@ class DirectoryDictProperty(DirectoryDict): self.__path = path def _set_path(self, *args, **kwargs): - print("_set_path: self: %s" % self) + #print("_set_path: self: %s" % self) print("_set_path: args: %s" % args) print("_set_path: kwargs: %s" % kwargs) if self.path is None: From 453adefc9148eac265ae137415d22f3df7c3c21f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 21:59:57 +0200 Subject: [PATCH 0748/1024] ++debug Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index e17d1438..9ac7017f 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -210,6 +210,7 @@ class DirectoryDictProperty(DirectoryDict): #print("_set_path: self: %s" % self) print("_set_path: args: %s" % args) print("_set_path: kwargs: %s" % kwargs) + print("_set_path: self.path: %s" % self.path) if self.path is None: path = self.__path if callable(path): From be02dc5ff10a1cdb470e459bb082f155246544d1 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 00:35:23 +0200 Subject: [PATCH 0749/1024] create object directory befor accessing it Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index 96206ae0..3b3a7e98 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -95,6 +95,7 @@ class ExplorerClassTestCase(unittest.TestCase): def test_transfer_object_parameters(self): cdist_type = core.Type(self.local.type_path, '__test_type') cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') + cdist_object.create() cdist_object.parameters = {'first': 'first value', 'second': 'second value'} self.explorer.transfer_object_parameters(cdist_object) source = os.path.join(self.local.object_path, cdist_object.parameter_path) From ede35ffd73b63c2cbf6dd4d07bb77861fb1b6770 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 01:15:08 +0200 Subject: [PATCH 0750/1024] completely rewrite file based property handling Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 225 ++++++++++++----------------------- 1 file changed, 76 insertions(+), 149 deletions(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index 9ac7017f..5b8aa708 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -98,55 +98,6 @@ class FileList(collections.MutableSequence): self.__write(lines) -class FileListProperty(FileList): - - def __init__(self, path): - """ - :param path: string or callable - - Usage: - - class Foo(object): - parameters = DirectoryDictProperty(lambda obj: os.path.join(obj.absolute_path, 'parameter')) - other_dict = DirectoryDictProperty('/tmp/folder') - - def __init__(self): - self.absolute_path = '/tmp/foo' - - """ - self.path = None - self.__path = path - - def _set_path(self, *args, **kwargs): - if self.path is None: - path = self.__path - if callable(path): - path = path(*args, **kwargs) - if not os.path.isabs(path): - raise AbsolutePathRequiredError(path) - self.path = path - - # Descriptor Protocol - def __get__(self, obj, objtype=None): - if obj is None: - return self.__class__ - self._set_path(obj) - return self - - def __set__(self, obj, value): - self._set_path(obj) - try: - os.unlink(self.path) - except EnvironmentError: - # ignored - pass - for item in value: - self.append(item) - - def __delete__(self, obj): - raise AttributeError("can't delete attribute") - - class DirectoryDict(collections.MutableMapping): """A dict that stores it's items as files in a directory. @@ -178,7 +129,10 @@ class DirectoryDict(collections.MutableMapping): fd.write(str(value)) def __delitem__(self, key): - os.remove(os.path.join(self.path, key)) + try: + os.remove(os.path.join(self.path, key)) + except EnvironmentError: + raise KeyError(key) def __iter__(self): return iter(os.listdir(self.path)) @@ -187,95 +141,98 @@ class DirectoryDict(collections.MutableMapping): return len(os.listdir(self.path)) -class DirectoryDictProperty(DirectoryDict): +class FileBasedProperty(object): + attribute_class = None def __init__(self, path): """ :param path: string or callable - Usage: + Abstract super class. Subclass and set the class member attribute_class accordingly. + + Usage with a sublcass: class Foo(object): - parameters = DirectoryDictProperty(lambda obj: os.path.join(obj.absolute_path, 'parameter')) - other_dict = DirectoryDictProperty('/tmp/folder') + # note that the actual DirectoryDict is stored as __parameters on the instance + parameters = DirectoryDictProperty(lambda instance: os.path.join(instance.absolute_path, 'parameter')) + # note that the actual DirectoryDict is stored as __other_dict on the instance + other_dict = DirectoryDictProperty('/tmp/other_dict') def __init__(self): self.absolute_path = '/tmp/foo' """ - self.path = None - self.__path = path + self.path = path - def _set_path(self, *args, **kwargs): - #print("_set_path: self: %s" % self) - print("_set_path: args: %s" % args) - print("_set_path: kwargs: %s" % kwargs) - print("_set_path: self.path: %s" % self.path) - if self.path is None: - path = self.__path - if callable(path): - path = path(*args, **kwargs) - print("_set_path: %s" % path) - if not os.path.isabs(path): - raise AbsolutePathRequiredError(path) - # create directory if it doesn't exist - print("os.path.isdir(%s): %s" % (path, os.path.isdir(path))) - if not os.path.isdir(path): - os.mkdir(path) - self.path = path + def _get_path(self, instance): + path = self.path + if callable(path): + path = path(instance) + return path - # Descriptor Protocol - def __get__(self, obj, objtype=None): - if obj is None: - return self.__class__ - self._set_path(obj) - return self + def _get_property_name(self, owner): + for name, prop in owner.__dict__.items(): + if self == prop: + return name - def __set__(self, obj, value): - self._set_path(obj) - if value is not None: - for name in self.keys(): - del self[name] - self.update(value) + def _get_attribute(self, instance, owner): + name = self._get_property_name(owner) + attribute_name = '__%s' % name + if not hasattr(instance, attribute_name): + path = self._get_path(instance) + attribute_instance = self.attribute_class(path) + setattr(instance, attribute_name, attribute_instance) + return getattr(instance, attribute_name) - def __delete__(self, obj): + def __get__(self, instance, owner): + if instance is None: + return self + return self._get_attribute(instance, owner) + + def __delete__(self, instance): raise AttributeError("can't delete attribute") -class FileBooleanProperty(object): - def __init__(self, path): - """ - :param path: string or callable +class DirectoryDictProperty(FileBasedProperty): + attribute_class = DirectoryDict - Usage: + def __set__(self, instance, value): + attribute_instance = self._get_attribute(instance, instance.__class__) + for name in attribute_instance.keys(): + del attribute_instance[name] + attribute_instance.update(value) - class Foo(object): - changed = FileBoolean(lambda obj: os.path.join(obj.absolute_path, 'changed')) - other_boolean = FileBoolean('/tmp/other_boolean') - def __init__(self): - self.absolute_path = '/tmp/foo_boolean' +class FileListProperty(FileBasedProperty): + attribute_class = FileList - """ - self._path = path + def __set__(self, instance, value): + path = self._get_path(instance) + try: + os.unlink(path) + except EnvironmentError: + # ignored + pass + attribute_instance = self._get_attribute(instance, instance.__class__) + for item in value: + attribute_instance.append(item) - def _get_path(self, *args, **kwargs): - path = self._path - if callable(path): - return path(*args, **kwargs) - if not os.path.isabs(path): - raise AbsolutePathRequiredError(path) - return path +class FileBooleanProperty(FileBasedProperty): + """A boolean property which uses a file to represent its value. + + File exists -> True + File does not exists -> False + """ # Descriptor Protocol - def __get__(self, obj, objtype=None): - if obj is None: - return self.__class__ - path = self._get_path(obj) + def __get__(self, instance, owner): + if instance is None: + return self + path = self._get_path(instance) return os.path.isfile(path) - def __set__(self, obj, value): - path = self._get_path(obj) + def __set__(self, instance, value): + path = self._get_path(instance) if value: open(path, "w").close() else: @@ -285,42 +242,15 @@ class FileBooleanProperty(object): # ignore pass - def __delete__(self, obj): - raise AttributeError("can't delete attribute") - -class FileStringProperty(object): +class FileStringProperty(FileBasedProperty): """A string property which stores its value in a file. """ - def __init__(self, path): - """ - :param path: string or callable - - Usage: - - class Foo(object): - source = FileStringProperty(lambda obj: os.path.join(obj.absolute_path, 'source')) - other = FileStringProperty('/tmp/other') - - def __init__(self): - self.absolute_path = '/tmp/foo_boolean' - - """ - self._path = path - - def _get_path(self, *args, **kwargs): - path = self._path - if callable(path): - return path(*args, **kwargs) - if not os.path.isabs(path): - raise AbsolutePathRequiredError(path) - return path - # Descriptor Protocol - def __get__(self, obj, objtype=None): - if obj is None: - return self.__class__ - path = self._get_path(obj) + def __get__(self, instance, owner): + if instance is None: + return self + path = self._get_path(instance) value = "" try: with open(path, "r") as fd: @@ -329,16 +259,13 @@ class FileStringProperty(object): pass return value - def __set__(self, obj, value): - path = self._get_path(obj) + def __set__(self, instance, value): + path = self._get_path(instance) if value: with open(path, "w") as fd: fd.write(str(value)) else: try: - os.unlink(path) + os.remove(path) except EnvironmentError: pass - - def __delete__(self, obj): - raise AttributeError("Can't delete attribute. Set it's value to an empty string to remove the underlying file.") From a8733c5b9b87214ebf922d99ed3f1b2543fb6c43 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 08:57:06 +0200 Subject: [PATCH 0751/1024] make base_path public Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index 58a147b7..8cf21ce7 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -57,10 +57,10 @@ class Type(object): return cls._instances[name] def __init__(self, base_path, name): - self._base_path = base_path + self.base_path = base_path self.name = name self.path = self.name - self.absolute_path = os.path.join(self._base_path, self.path) + self.absolute_path = os.path.join(self.base_path, self.path) self.manifest_path = os.path.join(self.name, "manifest") self.explorer_path = os.path.join(self.name, "explorer") self.gencode_local_path = os.path.join(self.name, "gencode-local") From f4b12520631dbebec1e5927d9b9652f72dda2cb3 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 08:58:34 +0200 Subject: [PATCH 0752/1024] add test for Type base_path Signed-off-by: Steven Armstrong --- lib/cdist/test/type/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/cdist/test/type/__init__.py b/lib/cdist/test/type/__init__.py index 5ba1f4b9..42234069 100644 --- a/lib/cdist/test/type/__init__.py +++ b/lib/cdist/test/type/__init__.py @@ -62,6 +62,11 @@ class TypeTestCase(unittest.TestCase): cdist_type = cdist.core.Type(base_path, '__name_path') self.assertEqual(cdist_type.path, '__name_path') + def test_base_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.base_path, base_path) + def test_absolute_path(self): base_path = fixtures cdist_type = cdist.core.Type(base_path, '__name_path') From f6adefddec0c842df3b3c803079b0dfd08a844e2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 09:03:18 +0200 Subject: [PATCH 0753/1024] test for Object object_from_name Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 982784f2..790d6679 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -169,3 +169,11 @@ class ObjectTestCase(unittest.TestCase): def test_code_remote_after_changing(self): self.cdist_object.code_remote = 'Hello World' self.assertEqual(self.cdist_object.code_remote, 'Hello World') + + def test_object_from_name(self): + self.cdist_object.code_remote = 'Hello World' + other_name = '__first/man' + other_object = self.cdist_object.object_from_name(other_name) + self.assertTrue(isinstance(other_object, core.Object)) + self.assertEqual(other_object.type.name, '__first') + self.assertEqual(other_object.object_id, 'man') From 8e224b43c39e171f48503ba6c75d43342a83808b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 09:05:22 +0200 Subject: [PATCH 0754/1024] fix imports Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 790d6679..9ba3ed61 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -24,7 +24,7 @@ import tempfile import unittest import shutil -import cdist.core +from cdist import core import os.path as op my_dir = op.abspath(op.dirname(__file__)) @@ -35,19 +35,19 @@ type_base_path = op.join(fixtures, 'type') class ObjectClassTestCase(unittest.TestCase): def test_list_object_names(self): - object_names = list(cdist.core.Object.list_object_names(object_base_path)) + object_names = list(core.Object.list_object_names(object_base_path)) self.assertEqual(object_names, ['__first/man', '__second/on-the', '__third/moon']) def test_list_type_names(self): - type_names = list(cdist.core.Object.list_type_names(object_base_path)) + type_names = list(core.Object.list_type_names(object_base_path)) self.assertEqual(type_names, ['__first', '__second', '__third']) def test_list_objects(self): - objects = list(cdist.core.Object.list_objects(object_base_path, type_base_path)) + objects = list(core.Object.list_objects(object_base_path, type_base_path)) objects_expected = [ - cdist.core.Object(cdist.core.Type(type_base_path, '__first'), object_base_path, 'man'), - cdist.core.Object(cdist.core.Type(type_base_path, '__second'), object_base_path, 'on-the'), - cdist.core.Object(cdist.core.Type(type_base_path, '__third'), object_base_path, 'moon'), + core.Object(core.Type(type_base_path, '__first'), object_base_path, 'man'), + core.Object(core.Type(type_base_path, '__second'), object_base_path, 'on-the'), + core.Object(core.Type(type_base_path, '__third'), object_base_path, 'moon'), ] self.assertEqual(objects, objects_expected) @@ -55,8 +55,8 @@ class ObjectClassTestCase(unittest.TestCase): class ObjectTestCase(unittest.TestCase): def setUp(self): - self.cdist_type = cdist.core.Type(type_base_path, '__third') - self.cdist_object = cdist.core.Object(self.cdist_type, object_base_path, 'moon') + self.cdist_type = core.Type(type_base_path, '__third') + self.cdist_object = core.Object(self.cdist_type, object_base_path, 'moon') def tearDown(self): self.cdist_object.changed = False From b122b53d7338d507a13ad70b2dda097b9c80342a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 09:05:51 +0200 Subject: [PATCH 0755/1024] implement Object object_from_name Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index a170dd30..282e8be5 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -63,6 +63,21 @@ class Object(object): if DOT_CDIST in dirs: yield os.path.relpath(path, object_base_path) + def object_from_name(self, object_name): + """Convenience method for creating an object instance from an object name. + + Mainly intended to create objects when resolving requirements. + + e.g: + .object_from_name('__other/object') -> + + """ + type_path = self.type.base_path + object_path = self.base_path + type_name = object_name.split(os.sep)[0] + object_id = os.sep.join(object_name.split(os.sep)[1:]) + return self.__class__(self.type.__class__(type_path, type_name), object_path, object_id=object_id) + def __init__(self, cdist_type, base_path, object_id=None): self.type = cdist_type # instance of Type self.base_path = base_path From 74f4ec2f5d085f6a3b5f2065407055489deba6dc Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 09:06:32 +0200 Subject: [PATCH 0756/1024] resolve required objects using new object_from_name method Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 96a1555d..0d051685 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -136,7 +136,8 @@ class ConfigInstall(object): for requirement in cdist_object.requirements: self.log.debug("Object %s requires %s", cdist_object, requirement) # FIXME: requirement is a string, need to create object here - self.object_run(requirement) + required_object = cdist_object.object_from_name(requirement) + self.object_run(required_object) # Generate cdist_object.code_local = self.code.run_gencode_local(cdist_object) From 1c1cff37e3710c64917ab391671620274263a256 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 09:07:21 +0200 Subject: [PATCH 0757/1024] --debug Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 0d051685..e4ac2dde 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -113,7 +113,6 @@ class ConfigInstall(object): for explorer in self.explorer.list_type_explorer_names(cdist_object.type): output = self.explorer.run_type_explorer(explorer, cdist_object) self.log.debug("Running type explorer '%s' for object '%s'", explorer, cdist_object.name) - print("run_type_explorers: %s = %s" % (explorer, output)) cdist_object.explorers[explorer] = output def object_prepare(self, cdist_object): From 9f231a9ce7a93a80eb0637f8a1ba4fdae669b5af Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 09:47:59 +0200 Subject: [PATCH 0758/1024] suffix cache path with target_host Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index e4ac2dde..72ff7c6c 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -54,10 +54,11 @@ class ConfigInstall(object): def cleanup(self): # FIXME: move to local? - self.log.debug("Saving " + self.local.out_path + " to " + self.local.cache_path) - if os.path.exists(self.local.cache_path): - shutil.rmtree(self.local.cache_path) - shutil.move(self.local.out_path, self.local.cache_path) + destination = os.path.join(self.local.cache_path, self.context.target_host) + self.log.debug("Saving " + self.local.out_path + " to " + destination) + if os.path.exists(destination): + shutil.rmtree(destination) + shutil.move(self.local.out_path, destination) def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" From 69f8b74702331fa2effd5341cf783a00eb971cbe Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 09:49:37 +0200 Subject: [PATCH 0759/1024] +todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 93c6cab3..3209fe8c 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,3 +1,9 @@ +logging: + - logging from type emulator without clobbering stdout + maybe implement logging server as described here [1] + [1] http://docs.python.org/py3k/howto/logging-cookbook.html#configuration-server-example + + tests: __init__(): From 1375ed55b67c97774b275de1a88f92fd08ad54d2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 10:12:02 +0200 Subject: [PATCH 0760/1024] +todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 3209fe8c..6364c4d4 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -3,6 +3,13 @@ logging: maybe implement logging server as described here [1] [1] http://docs.python.org/py3k/howto/logging-cookbook.html#configuration-server-example + - use different logger to limit output to current area of interest, + e.g. + explorer.$target_host: explorer related messages for the run for $target_host + manifest.$target_host: manifest related messages for the run for $target_host + ... + then one could filter e.g. on explorer.* + tests: From 77813efdf369152d2616439c0cc320b072124931 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 10:30:56 +0200 Subject: [PATCH 0761/1024] +todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 6364c4d4..a602b753 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -10,6 +10,10 @@ logging: ... then one could filter e.g. on explorer.* +exec local & remote: + - don't capture output by default + - add new mechanism to capture output explicitly + tests: From 96d5d9b8e8a22256212ecd9fa9d924d5bca67ab8 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 10:32:25 +0200 Subject: [PATCH 0762/1024] +todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index a602b753..c7e93423 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -15,6 +15,10 @@ exec local & remote: - add new mechanism to capture output explicitly +config_install: + - move code for running global and type explorer run to cdist.core.explorer + + tests: __init__(): From 6067646ffa4855f357cc3f3902a96e3425934ad7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 10:40:10 +0200 Subject: [PATCH 0763/1024] +todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index c7e93423..90040ad6 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -10,6 +10,10 @@ logging: ... then one could filter e.g. on explorer.* + - more granular debug output, + [2] http://blog.ooz.ie/2011/03/python-logging-extending-standard.html + + exec local & remote: - don't capture output by default - add new mechanism to capture output explicitly @@ -18,6 +22,10 @@ exec local & remote: config_install: - move code for running global and type explorer run to cdist.core.explorer +tests: + - aufraeumen + - test suite + tests: From 8ac1406020dc567be29cafeaac995a9de5edc247 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 10:49:28 +0200 Subject: [PATCH 0764/1024] stage away obsolete tests Signed-off-by: Nico Schottelius --- lib/cdist/test/test_path.py | 78 ------------------- .../tests_reintegrate}/test_banner.py | 0 .../tests_reintegrate}/test_config.py | 0 .../tests_reintegrate}/test_exec.py | 0 .../tests_reintegrate}/test_install.py | 0 5 files changed, 78 deletions(-) delete mode 100644 lib/cdist/test/test_path.py rename {lib/cdist/test => other/tests_reintegrate}/test_banner.py (100%) rename {lib/cdist/test => other/tests_reintegrate}/test_config.py (100%) rename {lib/cdist/test => other/tests_reintegrate}/test_exec.py (100%) rename {lib/cdist/test => other/tests_reintegrate}/test_install.py (100%) diff --git a/lib/cdist/test/test_path.py b/lib/cdist/test/test_path.py deleted file mode 100644 index f86c8fad..00000000 --- a/lib/cdist/test/test_path.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# 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 . -# -# - -import os -import shutil -import sys -import tempfile -import unittest - -import cdist.path -import cdist.test - -class Path(unittest.TestCase): - def setUp(self): - self.temp_dir = tempfile.mkdtemp() - self.init_manifest = os.path.join(self.temp_dir, "manifest") - self.path = cdist.path.Path("localhost", "root", "ssh root@localhost", - initial_manifest=self.init_manifest, - base_dir=self.temp_dir) - - os.mkdir(self.path.conf_dir) - os.mkdir(self.path.type_base_dir) - - self.install_type_name = "__install_test" - self.config_type_name = "__config_test" - - # Create install type - self.install_type = os.path.join(self.path.type_base_dir, self.install_type_name) - os.mkdir(self.install_type) - open(os.path.join(self.install_type, "install"), "w").close() - - # Create config type - self.config_type = os.path.join(self.path.type_base_dir, self.config_type_name) - os.mkdir(self.config_type) - - def tearDown(self): - self.path.cleanup() - shutil.rmtree(self.temp_dir) - - def test_type_detection(self): - """Check that a type is identified as install or configuration correctly""" - - self.assertTrue(self.path.is_install_type(self.install_type)) - self.assertFalse(self.path.is_install_type(self.config_type)) - - def test_manifest_uses_install_types_only(self): - """Check that objects created from manifest are only of install type""" - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - self.install_type_name + "testid\n", - self.config_type_name + "testid\n", - ]) - manifest_fd.close() - - self.install.run_initial_manifest() - - # FIXME: check that only __partition_msdos objects are created! - - self.assertFalse(failed) diff --git a/lib/cdist/test/test_banner.py b/other/tests_reintegrate/test_banner.py similarity index 100% rename from lib/cdist/test/test_banner.py rename to other/tests_reintegrate/test_banner.py diff --git a/lib/cdist/test/test_config.py b/other/tests_reintegrate/test_config.py similarity index 100% rename from lib/cdist/test/test_config.py rename to other/tests_reintegrate/test_config.py diff --git a/lib/cdist/test/test_exec.py b/other/tests_reintegrate/test_exec.py similarity index 100% rename from lib/cdist/test/test_exec.py rename to other/tests_reintegrate/test_exec.py diff --git a/lib/cdist/test/test_install.py b/other/tests_reintegrate/test_install.py similarity index 100% rename from lib/cdist/test/test_install.py rename to other/tests_reintegrate/test_install.py From 9640c3a0981ce165ac4e552cf97de7062232b25f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 11:21:12 +0200 Subject: [PATCH 0765/1024] test for illegal object_id Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 9ba3ed61..9a13f524 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -52,6 +52,14 @@ class ObjectClassTestCase(unittest.TestCase): self.assertEqual(objects, objects_expected) +class ObjectIdTestCase(unittest.TestCase): + def test_illegal_object_id(self): + cdist_type = core.Type(type_base_path, '__third') + illegal_object_id = '/object_id/may/not/start/with/slash' + with self.assertRaises(core.IllegalObjectIdError): + core.Object(cdist_type, object_base_path, illegal_object_id) + + class ObjectTestCase(unittest.TestCase): def setUp(self): From 3e3919d15f00c62c670b3ab901d7274e43a2b770 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 11:25:39 +0200 Subject: [PATCH 0766/1024] implement fail if object_id starts with / Signed-off-by: Steven Armstrong --- lib/cdist/core/__init__.py | 1 + lib/cdist/core/object.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/cdist/core/__init__.py b/lib/cdist/core/__init__.py index 1dec9e8f..507082a3 100644 --- a/lib/cdist/core/__init__.py +++ b/lib/cdist/core/__init__.py @@ -21,6 +21,7 @@ from cdist.core.type import Type from cdist.core.object import Object +from cdist.core.object import IllegalObjectIdError from cdist.core.explorer import Explorer from cdist.core.manifest import Manifest from cdist.core.code import Code diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 282e8be5..c447f243 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -33,6 +33,14 @@ log = logging.getLogger(__name__) DOT_CDIST = '.cdist' +class IllegalObjectIdError(cdist.Error): + def __init__(self, object_id): + self.object_id = object_id + + def __str__(self): + return 'Illegal object id: %s' % self.object_id + + class Object(object): """Represents a cdist object. @@ -79,6 +87,8 @@ class Object(object): return self.__class__(self.type.__class__(type_path, type_name), object_path, object_id=object_id) def __init__(self, cdist_type, base_path, object_id=None): + if object_id and object_id.startswith('/'): + raise IllegalObjectIdError(object_id) self.type = cdist_type # instance of Type self.base_path = base_path self.object_id = object_id From d346364544b0eea9f2687477103884caf3720c50 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 11:39:03 +0200 Subject: [PATCH 0767/1024] better error message Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index c447f243..eeb5799b 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -34,11 +34,12 @@ DOT_CDIST = '.cdist' class IllegalObjectIdError(cdist.Error): - def __init__(self, object_id): + def __init__(self, object_id, message=None): self.object_id = object_id + self.message = message or 'Illegal object id' def __str__(self): - return 'Illegal object id: %s' % self.object_id + return '%s: %s' % (self.message, self.object_id) class Object(object): @@ -88,7 +89,7 @@ class Object(object): def __init__(self, cdist_type, base_path, object_id=None): if object_id and object_id.startswith('/'): - raise IllegalObjectIdError(object_id) + raise IllegalObjectIdError(object_id, 'object_id may not start with /') self.type = cdist_type # instance of Type self.base_path = base_path self.object_id = object_id From f285d9e64ee1e3e3111eab7ccba0099097fac43e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 11:39:55 +0200 Subject: [PATCH 0768/1024] emulator: fail if object_id of requirement starts with slash Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 4445f0f7..ca65e731 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -106,8 +106,19 @@ def run(argv): # Record requirements if "require" in os.environ: requirements = os.environ['require'] - log.debug("%s:Writing requirements: %s" % (cdist_object.path, requirements)) - cdist_object.requirements.extend(requirements.split(" ")) + for requirement in requirements.split(" "): + requirement_parts = requirement.split(os.sep, 1) + requirement_parts.reverse() + requirement_type_name = requirement_parts.pop() + try: + requirement_object_id = requirement_parts.pop() + except IndexError: + # no object id, must be singleton + requirement_object_id = 'singleton' + if requirement_object_id.startswith('/'): + raise core.IllegalObjectIdError(requirement_object_id, 'object_id may not start with /') + log.debug("Recording requirement: %s -> %s" % (cdist_object.path, requirement)) + cdist_object.requirements.append(rement_object_id) # Record / Append source cdist_object.source.append(object_source) From 1c84e423d11b9535a940ed9f76f8e69a3b2ff40e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 11:49:37 +0200 Subject: [PATCH 0769/1024] include type name in error message Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 7 ++++--- lib/cdist/emulator.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index eeb5799b..60ae59f4 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -34,12 +34,13 @@ DOT_CDIST = '.cdist' class IllegalObjectIdError(cdist.Error): - def __init__(self, object_id, message=None): + def __init__(self, object_id, type_name, message=None): self.object_id = object_id + self.type_name = type_name self.message = message or 'Illegal object id' def __str__(self): - return '%s: %s' % (self.message, self.object_id) + return '%s: %s' % (self.message, os.path.join(self.type_name. self.object_id)) class Object(object): @@ -89,7 +90,7 @@ class Object(object): def __init__(self, cdist_type, base_path, object_id=None): if object_id and object_id.startswith('/'): - raise IllegalObjectIdError(object_id, 'object_id may not start with /') + raise IllegalObjectIdError(object_id, cdist_type.name, 'object_id may not start with /') self.type = cdist_type # instance of Type self.base_path = base_path self.object_id = object_id diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index ca65e731..f37c3169 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -116,9 +116,9 @@ def run(argv): # no object id, must be singleton requirement_object_id = 'singleton' if requirement_object_id.startswith('/'): - raise core.IllegalObjectIdError(requirement_object_id, 'object_id may not start with /') + raise core.IllegalObjectIdError(requirement_object_id, requirement_type_name, 'object_id may not start with /') log.debug("Recording requirement: %s -> %s" % (cdist_object.path, requirement)) - cdist_object.requirements.append(rement_object_id) + cdist_object.requirements.append(requirement) # Record / Append source cdist_object.source.append(object_source) From f76a5abf6f1e97483bd974a905df26d1f6037c49 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 11:50:40 +0200 Subject: [PATCH 0770/1024] /./,/ Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 60ae59f4..a802a457 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -40,7 +40,7 @@ class IllegalObjectIdError(cdist.Error): self.message = message or 'Illegal object id' def __str__(self): - return '%s: %s' % (self.message, os.path.join(self.type_name. self.object_id)) + return '%s: %s' % (self.message, os.path.join(self.type_name, self.object_id)) class Object(object): From 2194368c0cdeb3728e4f72c610dd110471b6332c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 12:03:03 +0200 Subject: [PATCH 0771/1024] load all test classes Signed-off-by: Nico Schottelius --- lib/cdist/test/__main__.py | 39 ++++++++++--------- .../tests_reintegrate}/nico_ui.py | 0 2 files changed, 21 insertions(+), 18 deletions(-) rename {lib/cdist/test => other/tests_reintegrate}/nico_ui.py (100%) diff --git a/lib/cdist/test/__main__.py b/lib/cdist/test/__main__.py index 3b31a2cd..136e122a 100644 --- a/lib/cdist/test/__main__.py +++ b/lib/cdist/test/__main__.py @@ -1,3 +1,4 @@ +#c1406:!/usr/bin/env python3 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # @@ -20,27 +21,29 @@ # # - +import imp import os import sys -import cdist.test import unittest -#class UI(unittest.TestCase): -# def test_banner(self): -# self.assertEqual(subprocess.call([cdist_exec_path, "banner"]), 0) -# -# def test_help(self): -# for cmd in cdist_commands: -# self.assertEqual(subprocess.call([cdist_exec_path, cmd, "-h"]), 0) -# -# # FIXME: mockup needed -# def test_config_localhost(self): -# for cmd in cdist_commands: -# self.assertEqual(subprocess.call([cdist_exec_path, "config", "localhost"]), 0) +base_dir = os.path.dirname(os.path.realpath(__file__)) + +test_modules = [] +for possible_test in os.listdir(base_dir): + filename = "__init__.py" + mod_path = os.path.join(base_dir, possible_test, filename) + + print(mod_path + "x") + + if os.path.isfile(mod_path): + test_modules.append(possible_test) + +print(sys.path) + +for test_module in test_modules: + module = imp.find_module(test_module, [base_dir]) + imp.load_module(test_module, *module) + +#suite = unittest.defaultTestLoader.loadTestsFromModule(cdist.test.code) -print(cdist.test.cdist_exec_path) -print(sys.argv) -suite = unittest.defaultTestLoader.discover(os.path.dirname(__file__)) -unittest.TextTestRunner(verbosity=1).run(suite) diff --git a/lib/cdist/test/nico_ui.py b/other/tests_reintegrate/nico_ui.py similarity index 100% rename from lib/cdist/test/nico_ui.py rename to other/tests_reintegrate/nico_ui.py From 588d789ee2c18a576547b4218393d0e930289a8d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 12:03:44 +0200 Subject: [PATCH 0772/1024] empty init Signed-off-by: Nico Schottelius --- lib/cdist/test/__init__.py | 46 -------------------------------------- 1 file changed, 46 deletions(-) diff --git a/lib/cdist/test/__init__.py b/lib/cdist/test/__init__.py index 2f88bf7e..e69de29b 100644 --- a/lib/cdist/test/__init__.py +++ b/lib/cdist/test/__init__.py @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# 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 . -# -# - - -import os -import subprocess -import unittest - -cdist_commands=["banner", "config", "install"] - -cdist_base_path = os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../")) - -cdist_exec_path = os.path.join(cdist_base_path, "bin/cdist") - -#class UI(unittest.TestCase): -# def test_banner(self): -# self.assertEqual(subprocess.call([cdist_exec_path, "banner"]), 0) -# -# def test_help(self): -# for cmd in cdist_commands: -# self.assertEqual(subprocess.call([cdist_exec_path, cmd, "-h"]), 0) -# -# # FIXME: mockup needed -# def test_config_localhost(self): -# for cmd in cdist_commands: -# self.assertEqual(subprocess.call([cdist_exec_path, "config", "localhost"]), 0) From 93db0b58d64210f14539a3c79766e810c368423a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 12:05:30 +0200 Subject: [PATCH 0773/1024] append type to error message Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index a802a457..339591ad 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -40,7 +40,7 @@ class IllegalObjectIdError(cdist.Error): self.message = message or 'Illegal object id' def __str__(self): - return '%s: %s' % (self.message, os.path.join(self.type_name, self.object_id)) + return '%s: type: %s, object_id: %s' % (self.message, self.type_name, self.object_id) class Object(object): From 9aa064a0ae9ed103e09ce7760f7f0a4bed1e0e2e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 12:10:21 +0200 Subject: [PATCH 0774/1024] remove obsolete test Signed-off-by: Nico Schottelius --- lib/cdist/test/type_explorer/__init__.py | 39 ------------------- .../fixtures/type/__test_type/explorer/world | 2 - .../explorer/test_parameter | 3 -- 3 files changed, 44 deletions(-) delete mode 100644 lib/cdist/test/type_explorer/__init__.py delete mode 100755 lib/cdist/test/type_explorer/fixtures/type/__test_type/explorer/world delete mode 100755 lib/cdist/test/type_explorer/fixtures/type/__test_type_object_parameter/explorer/test_parameter diff --git a/lib/cdist/test/type_explorer/__init__.py b/lib/cdist/test/type_explorer/__init__.py deleted file mode 100644 index 19d59342..00000000 --- a/lib/cdist/test/type_explorer/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -# -# 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 . -# -# - -import os -import unittest - -import cdist.core - -import os.path as op -my_dir = op.abspath(op.dirname(__file__)) -fixtures = op.join(my_dir, 'fixtures') -object_base_path = op.join(fixtures, 'object') -type_base_path = op.join(fixtures, 'type') - -class TypeExplorer(unittest.TestCase): - - def setUp(self): - - def test_explorer_output(self): - """Check for output of type explorer""" - diff --git a/lib/cdist/test/type_explorer/fixtures/type/__test_type/explorer/world b/lib/cdist/test/type_explorer/fixtures/type/__test_type/explorer/world deleted file mode 100755 index 21ba6825..00000000 --- a/lib/cdist/test/type_explorer/fixtures/type/__test_type/explorer/world +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -echo hello diff --git a/lib/cdist/test/type_explorer/fixtures/type/__test_type_object_parameter/explorer/test_parameter b/lib/cdist/test/type_explorer/fixtures/type/__test_type_object_parameter/explorer/test_parameter deleted file mode 100755 index 0778907c..00000000 --- a/lib/cdist/test/type_explorer/fixtures/type/__test_type_object_parameter/explorer/test_parameter +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -cat "$__object/parameter/test" From 97da16f4bc23b3de0dbf2ef38257246ba4b45b5b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 12:12:06 +0200 Subject: [PATCH 0775/1024] load test suites Signed-off-by: Nico Schottelius --- lib/cdist/test/__main__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/cdist/test/__main__.py b/lib/cdist/test/__main__.py index 136e122a..eba262fa 100644 --- a/lib/cdist/test/__main__.py +++ b/lib/cdist/test/__main__.py @@ -33,17 +33,19 @@ for possible_test in os.listdir(base_dir): filename = "__init__.py" mod_path = os.path.join(base_dir, possible_test, filename) - print(mod_path + "x") - if os.path.isfile(mod_path): test_modules.append(possible_test) print(sys.path) +suites = [] + for test_module in test_modules: module = imp.find_module(test_module, [base_dir]) imp.load_module(test_module, *module) -#suite = unittest.defaultTestLoader.loadTestsFromModule(cdist.test.code) - + print(module) + # module_name = + suite = unittest.defaultTestLoader.loadTestsFromModule("cdist.test." + test_module) + suites.append(suite) From fb705adc5d8af9d708dcfd11f7ac37c2ca803342 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 14:04:56 +0200 Subject: [PATCH 0776/1024] simplify object_id error handling Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 339591ad..eeb5799b 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -34,13 +34,12 @@ DOT_CDIST = '.cdist' class IllegalObjectIdError(cdist.Error): - def __init__(self, object_id, type_name, message=None): + def __init__(self, object_id, message=None): self.object_id = object_id - self.type_name = type_name self.message = message or 'Illegal object id' def __str__(self): - return '%s: type: %s, object_id: %s' % (self.message, self.type_name, self.object_id) + return '%s: %s' % (self.message, self.object_id) class Object(object): @@ -90,7 +89,7 @@ class Object(object): def __init__(self, cdist_type, base_path, object_id=None): if object_id and object_id.startswith('/'): - raise IllegalObjectIdError(object_id, cdist_type.name, 'object_id may not start with /') + raise IllegalObjectIdError(object_id, 'object_id may not start with /') self.type = cdist_type # instance of Type self.base_path = base_path self.object_id = object_id From 6d7620582db12bc7aa81c1d7f6c5da3f470a93b2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 14:16:15 +0200 Subject: [PATCH 0777/1024] run all test suites, if called as main Signed-off-by: Nico Schottelius --- lib/cdist/test/__main__.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/cdist/test/__main__.py b/lib/cdist/test/__main__.py index eba262fa..08e839d1 100644 --- a/lib/cdist/test/__main__.py +++ b/lib/cdist/test/__main__.py @@ -1,4 +1,3 @@ -#c1406:!/usr/bin/env python3 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # @@ -36,16 +35,14 @@ for possible_test in os.listdir(base_dir): if os.path.isfile(mod_path): test_modules.append(possible_test) -print(sys.path) - suites = [] - for test_module in test_modules: - module = imp.find_module(test_module, [base_dir]) - imp.load_module(test_module, *module) + module_parameters = imp.find_module(test_module, [base_dir]) + module = imp.load_module("cdist.test." + test_module, *module_parameters) - print(module) - # module_name = - - suite = unittest.defaultTestLoader.loadTestsFromModule("cdist.test." + test_module) + suite = unittest.defaultTestLoader.loadTestsFromModule(module) + # print("Got suite: " + suite.__str__()) suites.append(suite) + +all_suites = unittest.TestSuite(suites) +unittest.TextTestRunner(verbosity=2).run(all_suites) From 516b172d75c8ca85a6245ec5cc168c09a7a6469c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 14:19:18 +0200 Subject: [PATCH 0778/1024] run new test instance by default if no test is specified Signed-off-by: Nico Schottelius --- build.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index 0464defc..69f0ad92 100755 --- a/build.sh +++ b/build.sh @@ -128,13 +128,13 @@ case "$1" in test) shift # skip t - set -x + export PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib + if [ $# -lt 1 ]; then - set -- cdist.test - fi - PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib \ + python3 -m cdist.test + else python3 -m unittest "$@" - + fi ;; *) From 1db1a3f6a77c994cbfbf6cf2420c860171277c12 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 14:19:38 +0200 Subject: [PATCH 0779/1024] build does not need suffix .sh Signed-off-by: Nico Schottelius --- build.sh => build | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename build.sh => build (100%) diff --git a/build.sh b/build similarity index 100% rename from build.sh rename to build From 62a6617bcd952b157910f876922376bffa807c34 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 14:39:05 +0200 Subject: [PATCH 0780/1024] add old benchmarks Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-04-21.benchmark-eth | 7 + doc/dev/logs/2011-04-27.debug-timing | 1725 ++++++ doc/dev/logs/2011-09-12.benchmark-home | 6960 ++++++++++++++++++++++++ 3 files changed, 8692 insertions(+) create mode 100644 doc/dev/logs/2011-04-21.benchmark-eth create mode 100644 doc/dev/logs/2011-04-27.debug-timing create mode 100644 doc/dev/logs/2011-09-12.benchmark-home diff --git a/doc/dev/logs/2011-04-21.benchmark-eth b/doc/dev/logs/2011-04-21.benchmark-eth new file mode 100644 index 00000000..f1dfa05a --- /dev/null +++ b/doc/dev/logs/2011-04-21.benchmark-eth @@ -0,0 +1,7 @@ +cdist-mass-deploy -p ikq02.ethz.ch; 142 +cdist-mass-deploy -p ikq02.ethz.ch ikq03.ethz.ch; 194 +cdist-mass-deploy -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch; 271 +cdist-mass-deploy -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch ikq05.ethz.ch; 328 +cdist-mass-deploy -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch ikq05.ethz.ch ikq06.ethz.ch; 456 +cdist-mass-deploy -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch ikq05.ethz.ch ikq06.ethz.ch ikq07.ethz.ch; 568 + diff --git a/doc/dev/logs/2011-04-27.debug-timing b/doc/dev/logs/2011-04-27.debug-timing new file mode 100644 index 00000000..e6c99d4d --- /dev/null +++ b/doc/dev/logs/2011-04-27.debug-timing @@ -0,0 +1,1725 @@ +core: cdist 1.6.2: Configuring ikq04.ethz.ch +core: Creating clean directory structure +core: Transferring cdist binaries to the target host +core: Debug: Mit Apr 27 14:17:37 CEST 2011 +core: Debug: Mit Apr 27 14:17:37 CEST 2011 +core: Running global explorers +core: Debug: Mit Apr 27 14:17:38 CEST 2011 +core: Running initial manifest for ikq04.ethz.ch +core: Debug: Mit Apr 27 14:17:39 CEST 2011 +__ethz_systems/singleton: Preparing object +__ethz_systems/singleton: Checking manifest +__ethz_systems/singleton: Executing manifest +__file/etc/cdist-configured: Preparing object +__file/etc/cdist-configured: Transfering explorers for __file +__file/etc/cdist-configured: Running explorers +__file/etc/cdist-configured: Checking manifest +__package/puppet: Preparing object +__package/puppet: Checking manifest +__package/puppet: Executing manifest +__ethz_systems_root_via_ssh/subasui: Preparing object +__ethz_systems_root_via_ssh/subasui: Checking manifest +__ethz_systems_root_via_ssh/subasui: Executing manifest +__ethz_systems_root_via_ssh/blukas: Preparing object +__ethz_systems_root_via_ssh/blukas: Checking manifest +__ethz_systems_root_via_ssh/blukas: Executing manifest +__ethz_systems_root_via_ssh/petfisch: Preparing object +__ethz_systems_root_via_ssh/petfisch: Checking manifest +__ethz_systems_root_via_ssh/petfisch: Executing manifest +__ethz_nullmailer/singleton: Preparing object +__ethz_nullmailer/singleton: Checking manifest +__ethz_nullmailer/singleton: Executing manifest +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__ethz_systems_ldap_krb5_autofs/singleton: Preparing object +__ethz_systems_ldap_krb5_autofs/singleton: Checking manifest +__ethz_systems_ldap_krb5_autofs/singleton: Executing manifest +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__etc_hosts/singleton: Preparing object +__etc_hosts/singleton: Checking manifest +__etc_hosts/singleton: Executing manifest +__directory/local: Preparing object +__directory/local: Transfering explorers for __directory +__directory/local: Running explorers +__directory/local: Checking manifest +__ethz_ntpd/singleton: Preparing object +__ethz_ntpd/singleton: Checking manifest +__ethz_ntpd/singleton: Executing manifest +__ethz_systems_packages/singleton: Preparing object +__ethz_systems_packages/singleton: Checking manifest +__ethz_systems_packages/singleton: Executing manifest +__package_apt/puppet: Preparing object +__package_apt/puppet: Transfering explorers for __package_apt +__package_apt/puppet: Running explorers +__package_apt/puppet: Checking manifest +__addifnosuchline/ssh-root-subasui: Preparing object +__addifnosuchline/ssh-root-subasui: Transfering explorers for __addifnosuchline +__addifnosuchline/ssh-root-subasui: Running explorers +__addifnosuchline/ssh-root-subasui: Checking manifest +__addifnosuchline/ssh-root-blukas: Preparing object +__addifnosuchline/ssh-root-blukas: Running explorers +__addifnosuchline/ssh-root-blukas: Checking manifest +__addifnosuchline/ssh-root-petfisch: Preparing object +__addifnosuchline/ssh-root-petfisch: Running explorers +__addifnosuchline/ssh-root-petfisch: Checking manifest +__ethz_systems_motd/singleton: Preparing object +__ethz_systems_motd/singleton: Checking manifest +__ethz_systems_motd/singleton: Executing manifest +__ethz_systems_sudo/singleton: Preparing object +__ethz_systems_sudo/singleton: Checking manifest +__ethz_systems_sudo/singleton: Executing manifest +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__ethz_sans_syslog/singleton: Preparing object +__ethz_sans_syslog/singleton: Checking manifest +__ethz_sans_syslog/singleton: Executing manifest +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto.pub: Preparing object +__file/etc/ethz/autofs/auto.pub: Running explorers +__file/etc/ethz/autofs/auto.pub: Checking manifest +__file/etc/default/openntpd: Preparing object +__file/etc/default/openntpd: Running explorers +__file/etc/default/openntpd: Checking manifest +__file/etc/hosts: Preparing object +__file/etc/hosts: Running explorers +__file/etc/hosts: Checking manifest +__file/etc/syslog-ng/syslog-ng.conf: Preparing object +__file/etc/syslog-ng/syslog-ng.conf: Running explorers +__file/etc/syslog-ng/syslog-ng.conf: Checking manifest +__file/etc/nullmailer/remotes: Preparing object +__file/etc/nullmailer/remotes: Running explorers +__file/etc/nullmailer/remotes: Checking manifest +__file/etc/openntpd/ntpd.conf: Preparing object +__file/etc/openntpd/ntpd.conf: Running explorers +__file/etc/openntpd/ntpd.conf: Checking manifest +__file/etc/sudoers.d/systems: Preparing object +__file/etc/sudoers.d/systems: Running explorers +__file/etc/sudoers.d/systems: Checking manifest +__link/etc/motd: Preparing object +__link/etc/motd: Checking manifest +__motd/singleton: Preparing object +__motd/singleton: Checking manifest +__motd/singleton: Executing manifest +__package/mc: Preparing object +__package/mc: Checking manifest +__package/mc: Executing manifest +__package/ant: Preparing object +__package/ant: Checking manifest +__package/ant: Executing manifest +__package/gcc: Preparing object +__package/gcc: Checking manifest +__package/gcc: Executing manifest +__package/gdb: Preparing object +__package/gdb: Checking manifest +__package/gdb: Executing manifest +__package/vim: Preparing object +__package/vim: Checking manifest +__package/vim: Executing manifest +__package/git-core: Preparing object +__package/git-core: Checking manifest +__package/git-core: Executing manifest +__package/atop: Preparing object +__package/atop: Checking manifest +__package/atop: Executing manifest +__package/flex: Preparing object +__package/flex: Checking manifest +__package/flex: Executing manifest +__package/gawk: Preparing object +__package/gawk: Checking manifest +__package/gawk: Executing manifest +__package/make: Preparing object +__package/make: Checking manifest +__package/make: Executing manifest +__package/sudo: Preparing object +__package/sudo: Checking manifest +__package/sudo: Executing manifest +__package/swig: Preparing object +__package/swig: Checking manifest +__package/swig: Executing manifest +__package/libreadline5-dev: Preparing object +__package/libreadline5-dev: Checking manifest +__package/libreadline5-dev: Executing manifest +__package/libexpat1-dev: Preparing object +__package/libexpat1-dev: Checking manifest +__package/libexpat1-dev: Executing manifest +__package/libnet-ssleay-perl: Preparing object +__package/libnet-ssleay-perl: Checking manifest +__package/libnet-ssleay-perl: Executing manifest +__package/subversion: Preparing object +__package/subversion: Checking manifest +__package/subversion: Executing manifest +__package/libcurl4-openssl-dev: Preparing object +__package/libcurl4-openssl-dev: Checking manifest +__package/libcurl4-openssl-dev: Executing manifest +__package/bison: Preparing object +__package/bison: Checking manifest +__package/bison: Executing manifest +__package/cmake: Preparing object +__package/cmake: Checking manifest +__package/cmake: Executing manifest +__package/emacs: Preparing object +__package/emacs: Checking manifest +__package/emacs: Executing manifest +__package/xfce4: Preparing object +__package/xfce4: Checking manifest +__package/xfce4: Executing manifest +__package/xterm: Preparing object +__package/xterm: Checking manifest +__package/xterm: Executing manifest +__package/tcl8.4-dev: Preparing object +__package/tcl8.4-dev: Checking manifest +__package/tcl8.4-dev: Executing manifest +__package/libio-socket-ssl-perl: Preparing object +__package/libio-socket-ssl-perl: Checking manifest +__package/libio-socket-ssl-perl: Executing manifest +__package/doxygen: Preparing object +__package/doxygen: Checking manifest +__package/doxygen: Executing manifest +__package/zlib1g-dev: Preparing object +__package/zlib1g-dev: Checking manifest +__package/zlib1g-dev: Executing manifest +__package/autoconf: Preparing object +__package/autoconf: Checking manifest +__package/autoconf: Executing manifest +__package/libtool: Preparing object +__package/libtool: Checking manifest +__package/libtool: Executing manifest +__package/syslog-ng: Preparing object +__package/syslog-ng: Checking manifest +__package/syslog-ng: Executing manifest +__package/traceroute-nanog: Preparing object +__package/traceroute-nanog: Checking manifest +__package/traceroute-nanog: Executing manifest +__package/libncurses5-dev: Preparing object +__package/libncurses5-dev: Checking manifest +__package/libncurses5-dev: Executing manifest +__package/libaio-dev: Preparing object +__package/libaio-dev: Checking manifest +__package/libaio-dev: Executing manifest +__package/libboost-dev: Preparing object +__package/libboost-dev: Checking manifest +__package/libboost-dev: Executing manifest +__package/xtightvncviewer: Preparing object +__package/xtightvncviewer: Checking manifest +__package/xtightvncviewer: Executing manifest +__package/nullmailer: Preparing object +__package/nullmailer: Checking manifest +__package/nullmailer: Executing manifest +__package/libxml2-dev: Preparing object +__package/libxml2-dev: Checking manifest +__package/libxml2-dev: Executing manifest +__package/libtidy-dev: Preparing object +__package/libtidy-dev: Checking manifest +__package/libtidy-dev: Executing manifest +__package/manpages: Preparing object +__package/manpages: Checking manifest +__package/manpages: Executing manifest +__package/gcc-doc: Preparing object +__package/gcc-doc: Checking manifest +__package/gcc-doc: Executing manifest +__package/fluxbox: Preparing object +__package/fluxbox: Checking manifest +__package/fluxbox: Executing manifest +__package/libicu-dev: Preparing object +__package/libicu-dev: Checking manifest +__package/libicu-dev: Executing manifest +__package/libc6-dev-i386: Preparing object +__package/libc6-dev-i386: Checking manifest +__package/libc6-dev-i386: Executing manifest +__package/mercurial: Preparing object +__package/mercurial: Checking manifest +__package/mercurial: Executing manifest +__package/git-doc: Preparing object +__package/git-doc: Checking manifest +__package/git-doc: Executing manifest +__package/git-svn: Preparing object +__package/git-svn: Checking manifest +__package/git-svn: Executing manifest +__package/libnuma-dev: Preparing object +__package/libnuma-dev: Checking manifest +__package/libnuma-dev: Executing manifest +__package/gnuplot: Preparing object +__package/gnuplot: Checking manifest +__package/gnuplot: Executing manifest +__package/screen: Preparing object +__package/screen: Checking manifest +__package/screen: Executing manifest +__package/openntpd: Preparing object +__package/openntpd: Checking manifest +__package/openntpd: Executing manifest +__package/gcc-multilib: Preparing object +__package/gcc-multilib: Checking manifest +__package/gcc-multilib: Executing manifest +__package/libboost-regex-dev: Preparing object +__package/libboost-regex-dev: Checking manifest +__package/libboost-regex-dev: Executing manifest +__package/g++-multilib: Preparing object +__package/g++-multilib: Checking manifest +__package/g++-multilib: Executing manifest +__package/xfonts-base: Preparing object +__package/xfonts-base: Checking manifest +__package/xfonts-base: Executing manifest +__package/rdesktop: Preparing object +__package/rdesktop: Checking manifest +__package/rdesktop: Executing manifest +__package/build-essential: Preparing object +__package/build-essential: Checking manifest +__package/build-essential: Executing manifest +__package/tightvncserver: Preparing object +__package/tightvncserver: Checking manifest +__package/tightvncserver: Executing manifest +__package/python-crypto: Preparing object +__package/python-crypto: Checking manifest +__package/python-crypto: Executing manifest +__package/libc6-dev: Preparing object +__package/libc6-dev: Checking manifest +__package/libc6-dev: Executing manifest +__package/manpages-dev: Preparing object +__package/manpages-dev: Checking manifest +__package/manpages-dev: Executing manifest +__package/ia32-libs: Preparing object +__package/ia32-libs: Checking manifest +__package/ia32-libs: Executing manifest +__package/libxml-checker-perl: Preparing object +__package/libxml-checker-perl: Checking manifest +__package/libxml-checker-perl: Executing manifest +__ethz_pam_krb5/singleton: Preparing object +__ethz_pam_krb5/singleton: Checking manifest +__ethz_pam_krb5/singleton: Executing manifest +__ethz_dinfk_autofs/singleton: Preparing object +__ethz_dinfk_autofs/singleton: Checking manifest +__ethz_dinfk_autofs/singleton: Executing manifest +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__ethz_dinfk_ldap/singleton: Preparing object +__ethz_dinfk_ldap/singleton: Checking manifest +__ethz_dinfk_ldap/singleton: Executing manifest +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__directory/etc/ethz/autofs: Preparing object +__directory/etc/ethz/autofs: Running explorers +__directory/etc/ethz/autofs: Checking manifest +__ethz_krb5/singleton: Preparing object +__ethz_krb5/singleton: Checking manifest +__ethz_krb5/singleton: Executing manifest +__package_apt/mc: Preparing object +__package_apt/mc: Running explorers +__package_apt/mc: Checking manifest +__package_apt/ant: Preparing object +__package_apt/ant: Running explorers +__package_apt/ant: Checking manifest +__package_apt/gcc: Preparing object +__package_apt/gcc: Running explorers +__package_apt/gcc: Checking manifest +__package_apt/gdb: Preparing object +__package_apt/gdb: Running explorers +__package_apt/gdb: Checking manifest +__package_apt/vim: Preparing object +__package_apt/vim: Running explorers +__package_apt/vim: Checking manifest +__package_apt/git-core: Preparing object +__package_apt/git-core: Running explorers +__package_apt/git-core: Checking manifest +__package_apt/atop: Preparing object +__package_apt/atop: Running explorers +__package_apt/atop: Checking manifest +__package_apt/flex: Preparing object +__package_apt/flex: Running explorers +__package_apt/flex: Checking manifest +__package_apt/gawk: Preparing object +__package_apt/gawk: Running explorers +__package_apt/gawk: Checking manifest +__package_apt/make: Preparing object +__package_apt/make: Running explorers +__package_apt/make: Checking manifest +__package_apt/sudo: Preparing object +__package_apt/sudo: Running explorers +__package_apt/sudo: Checking manifest +__package_apt/swig: Preparing object +__package_apt/swig: Running explorers +__package_apt/swig: Checking manifest +__package_apt/libreadline5-dev: Preparing object +__package_apt/libreadline5-dev: Running explorers +__package_apt/libreadline5-dev: Checking manifest +__package_apt/libexpat1-dev: Preparing object +__package_apt/libexpat1-dev: Running explorers +__package_apt/libexpat1-dev: Checking manifest +__package_apt/libnet-ssleay-perl: Preparing object +__package_apt/libnet-ssleay-perl: Running explorers +__package_apt/libnet-ssleay-perl: Checking manifest +__package_apt/subversion: Preparing object +__package_apt/subversion: Running explorers +__package_apt/subversion: Checking manifest +__package_apt/libcurl4-openssl-dev: Preparing object +__package_apt/libcurl4-openssl-dev: Running explorers +__package_apt/libcurl4-openssl-dev: Checking manifest +__package_apt/bison: Preparing object +__package_apt/bison: Running explorers +__package_apt/bison: Checking manifest +__package_apt/cmake: Preparing object +__package_apt/cmake: Running explorers +__package_apt/cmake: Checking manifest +__package_apt/emacs: Preparing object +__package_apt/emacs: Running explorers +__package_apt/emacs: Checking manifest +__package_apt/xfce4: Preparing object +__package_apt/xfce4: Running explorers +__package_apt/xfce4: Checking manifest +__package_apt/xterm: Preparing object +__package_apt/xterm: Running explorers +__package_apt/xterm: Checking manifest +__package_apt/tcl8.4-dev: Preparing object +__package_apt/tcl8.4-dev: Running explorers +__package_apt/tcl8.4-dev: Checking manifest +__package_apt/libio-socket-ssl-perl: Preparing object +__package_apt/libio-socket-ssl-perl: Running explorers +__package_apt/libio-socket-ssl-perl: Checking manifest +__package_apt/doxygen: Preparing object +__package_apt/doxygen: Running explorers +__package_apt/doxygen: Checking manifest +__package_apt/zlib1g-dev: Preparing object +__package_apt/zlib1g-dev: Running explorers +__package_apt/zlib1g-dev: Checking manifest +__package_apt/autoconf: Preparing object +__package_apt/autoconf: Running explorers +__package_apt/autoconf: Checking manifest +__package_apt/libtool: Preparing object +__package_apt/libtool: Running explorers +__package_apt/libtool: Checking manifest +__package_apt/syslog-ng: Preparing object +__package_apt/syslog-ng: Running explorers +__package_apt/syslog-ng: Checking manifest +__package_apt/traceroute-nanog: Preparing object +__package_apt/traceroute-nanog: Running explorers +__package_apt/traceroute-nanog: Checking manifest +__package_apt/libncurses5-dev: Preparing object +__package_apt/libncurses5-dev: Running explorers +__package_apt/libncurses5-dev: Checking manifest +__package_apt/libaio-dev: Preparing object +__package_apt/libaio-dev: Running explorers +__package_apt/libaio-dev: Checking manifest +__package_apt/libboost-dev: Preparing object +__package_apt/libboost-dev: Running explorers +__package_apt/libboost-dev: Checking manifest +__package_apt/xtightvncviewer: Preparing object +__package_apt/xtightvncviewer: Running explorers +__package_apt/xtightvncviewer: Checking manifest +__package_apt/nullmailer: Preparing object +__package_apt/nullmailer: Running explorers +__package_apt/nullmailer: Checking manifest +__package_apt/libxml2-dev: Preparing object +__package_apt/libxml2-dev: Running explorers +__package_apt/libxml2-dev: Checking manifest +__package_apt/libtidy-dev: Preparing object +__package_apt/libtidy-dev: Running explorers +__package_apt/libtidy-dev: Checking manifest +__package_apt/manpages: Preparing object +__package_apt/manpages: Running explorers +__package_apt/manpages: Checking manifest +__package_apt/gcc-doc: Preparing object +__package_apt/gcc-doc: Running explorers +__package_apt/gcc-doc: Checking manifest +__package_apt/fluxbox: Preparing object +__package_apt/fluxbox: Running explorers +__package_apt/fluxbox: Checking manifest +__package_apt/libicu-dev: Preparing object +__package_apt/libicu-dev: Running explorers +__package_apt/libicu-dev: Checking manifest +__package_apt/libc6-dev-i386: Preparing object +__package_apt/libc6-dev-i386: Running explorers +__package_apt/libc6-dev-i386: Checking manifest +__package_apt/mercurial: Preparing object +__package_apt/mercurial: Running explorers +__package_apt/mercurial: Checking manifest +__package_apt/git-doc: Preparing object +__package_apt/git-doc: Running explorers +__package_apt/git-doc: Checking manifest +__package_apt/git-svn: Preparing object +__package_apt/git-svn: Running explorers +__package_apt/git-svn: Checking manifest +__package_apt/libnuma-dev: Preparing object +__package_apt/libnuma-dev: Running explorers +__package_apt/libnuma-dev: Checking manifest +__package_apt/gnuplot: Preparing object +__package_apt/gnuplot: Running explorers +__package_apt/gnuplot: Checking manifest +__package_apt/screen: Preparing object +__package_apt/screen: Running explorers +__package_apt/screen: Checking manifest +__package_apt/openntpd: Preparing object +__package_apt/openntpd: Running explorers +__package_apt/openntpd: Checking manifest +__package_apt/gcc-multilib: Preparing object +__package_apt/gcc-multilib: Running explorers +__package_apt/gcc-multilib: Checking manifest +__package_apt/libboost-regex-dev: Preparing object +__package_apt/libboost-regex-dev: Running explorers +__package_apt/libboost-regex-dev: Checking manifest +__package_apt/g++-multilib: Preparing object +__package_apt/g++-multilib: Running explorers +__package_apt/g++-multilib: Checking manifest +__package_apt/xfonts-base: Preparing object +__package_apt/xfonts-base: Running explorers +__package_apt/xfonts-base: Checking manifest +__package_apt/rdesktop: Preparing object +__package_apt/rdesktop: Running explorers +__package_apt/rdesktop: Checking manifest +__package_apt/build-essential: Preparing object +__package_apt/build-essential: Running explorers +__package_apt/build-essential: Checking manifest +__package_apt/tightvncserver: Preparing object +__package_apt/tightvncserver: Running explorers +__package_apt/tightvncserver: Checking manifest +__package_apt/python-crypto: Preparing object +__package_apt/python-crypto: Running explorers +__package_apt/python-crypto: Checking manifest +__package_apt/libc6-dev: Preparing object +__package_apt/libc6-dev: Running explorers +__package_apt/libc6-dev: Checking manifest +__package_apt/manpages-dev: Preparing object +__package_apt/manpages-dev: Running explorers +__package_apt/manpages-dev: Checking manifest +__package_apt/ia32-libs: Preparing object +__package_apt/ia32-libs: Running explorers +__package_apt/ia32-libs: Checking manifest +__package_apt/libxml-checker-perl: Preparing object +__package_apt/libxml-checker-perl: Running explorers +__package_apt/libxml-checker-perl: Checking manifest +__file/etc/nsswitch.conf: Preparing object +__file/etc/nsswitch.conf: Running explorers +__file/etc/nsswitch.conf: Checking manifest +__file/etc/ethz/autofs/auto_home: Preparing object +__file/etc/ethz/autofs/auto_home: Running explorers +__file/etc/ethz/autofs/auto_home: Checking manifest +__file/etc/auto.master: Preparing object +__file/etc/auto.master: Running explorers +__file/etc/auto.master: Checking manifest +__file/etc/motd.tail: Preparing object +__file/etc/motd.tail: Running explorers +__file/etc/motd.tail: Checking manifest +__file/etc/nslcd.conf: Preparing object +__file/etc/nslcd.conf: Running explorers +__file/etc/nslcd.conf: Checking manifest +__package/python-ldap: Preparing object +__package/python-ldap: Checking manifest +__package/python-ldap: Executing manifest +__package/libnss-ldapd: Preparing object +__package/libnss-ldapd: Checking manifest +__package/libnss-ldapd: Executing manifest +__package/autofs: Preparing object +__package/autofs: Checking manifest +__package/autofs: Executing manifest +__package/libpam-krb5: Preparing object +__package/libpam-krb5: Checking manifest +__package/libpam-krb5: Executing manifest +__package_apt/python-ldap: Preparing object +__package_apt/python-ldap: Running explorers +__package_apt/python-ldap: Checking manifest +__package_apt/libnss-ldapd: Preparing object +__package_apt/libnss-ldapd: Running explorers +__package_apt/libnss-ldapd: Checking manifest +__package_apt/autofs: Preparing object +__package_apt/autofs: Running explorers +__package_apt/autofs: Checking manifest +__package_apt/libpam-krb5: Preparing object +__package_apt/libpam-krb5: Running explorers +__package_apt/libpam-krb5: Checking manifest +__file/etc/krb5.conf: Preparing object +__file/etc/krb5.conf: Running explorers +__file/etc/krb5.conf: Checking manifest +core: Debug: Mit Apr 27 14:18:44 CEST 2011 +__ethz_nullmailer/singleton: Generating local code +__ethz_nullmailer/singleton: Generating remote code +__ethz_nullmailer/singleton: Transferring object +__ethz_nullmailer/singleton: Checking code-local +__ethz_nullmailer/singleton: Executing code-local +__ethz_nullmailer/singleton: Checking code-remote +__ethz_nullmailer/singleton: Executing code-remote +__ethz_systems_ldap_krb5_autofs/singleton: Generating local code +__ethz_systems_ldap_krb5_autofs/singleton: Generating remote code +__ethz_systems_ldap_krb5_autofs/singleton: Transferring object +__ethz_systems_ldap_krb5_autofs/singleton: Checking code-local +__ethz_systems_ldap_krb5_autofs/singleton: Executing code-local +__ethz_systems_ldap_krb5_autofs/singleton: Checking code-remote +__ethz_systems_ldap_krb5_autofs/singleton: Executing code-remote +__etc_hosts/singleton: Generating local code +__etc_hosts/singleton: Generating remote code +__etc_hosts/singleton: Transferring object +__etc_hosts/singleton: Checking code-local +__etc_hosts/singleton: Executing code-local +__etc_hosts/singleton: Checking code-remote +__etc_hosts/singleton: Executing code-remote +__directory/etc/ethz/autofs: Generating local code +__directory/etc/ethz/autofs: Generating remote code +__directory/etc/ethz/autofs: Transferring object +__directory/etc/ethz/autofs: Checking code-local +__directory/etc/ethz/autofs: Executing code-local +__directory/etc/ethz/autofs: Checking code-remote +__directory/etc/ethz/autofs: Executing code-remote +__directory/local: Generating local code +__directory/local: Generating remote code +__directory/local: Transferring object +__directory/local: Checking code-local +__directory/local: Executing code-local +__directory/local: Checking code-remote +__directory/local: Executing code-remote +__ethz_krb5/singleton: Generating local code +__ethz_krb5/singleton: Generating remote code +__ethz_krb5/singleton: Transferring object +__ethz_krb5/singleton: Checking code-local +__ethz_krb5/singleton: Executing code-local +__ethz_krb5/singleton: Checking code-remote +__ethz_krb5/singleton: Executing code-remote +__ethz_ntpd/singleton: Generating local code +__ethz_ntpd/singleton: Generating remote code +__ethz_ntpd/singleton: Transferring object +__ethz_ntpd/singleton: Checking code-local +__ethz_ntpd/singleton: Executing code-local +__ethz_ntpd/singleton: Checking code-remote +__ethz_ntpd/singleton: Executing code-remote +__ethz_systems_packages/singleton: Generating local code +__ethz_systems_packages/singleton: Generating remote code +__ethz_systems_packages/singleton: Transferring object +__ethz_systems_packages/singleton: Checking code-local +__ethz_systems_packages/singleton: Executing code-local +__ethz_systems_packages/singleton: Checking code-remote +__ethz_systems_packages/singleton: Executing code-remote +__package_apt/mc: Generating local code +__package_apt/mc: Generating remote code +__package_apt/mc: Transferring object +__package_apt/mc: Checking code-local +__package_apt/mc: Executing code-local +__package_apt/mc: Checking code-remote +__package_apt/mc: Executing code-remote +__package_apt/ant: Generating local code +__package_apt/ant: Generating remote code +__package_apt/ant: Transferring object +__package_apt/ant: Checking code-local +__package_apt/ant: Executing code-local +__package_apt/ant: Checking code-remote +__package_apt/ant: Executing code-remote +__package_apt/gcc: Generating local code +__package_apt/gcc: Generating remote code +__package_apt/gcc: Transferring object +__package_apt/gcc: Checking code-local +__package_apt/gcc: Executing code-local +__package_apt/gcc: Checking code-remote +__package_apt/gcc: Executing code-remote +__package_apt/gdb: Generating local code +__package_apt/gdb: Generating remote code +__package_apt/gdb: Transferring object +__package_apt/gdb: Checking code-local +__package_apt/gdb: Executing code-local +__package_apt/gdb: Checking code-remote +__package_apt/gdb: Executing code-remote +__package_apt/vim: Generating local code +__package_apt/vim: Generating remote code +__package_apt/vim: Transferring object +__package_apt/vim: Checking code-local +__package_apt/vim: Executing code-local +__package_apt/vim: Checking code-remote +__package_apt/vim: Executing code-remote +__package_apt/git-core: Generating local code +__package_apt/git-core: Generating remote code +__package_apt/git-core: Transferring object +__package_apt/git-core: Checking code-local +__package_apt/git-core: Executing code-local +__package_apt/git-core: Checking code-remote +__package_apt/git-core: Executing code-remote +__package_apt/atop: Generating local code +__package_apt/atop: Generating remote code +__package_apt/atop: Transferring object +__package_apt/atop: Checking code-local +__package_apt/atop: Executing code-local +__package_apt/atop: Checking code-remote +__package_apt/atop: Executing code-remote +__package_apt/flex: Generating local code +__package_apt/flex: Generating remote code +__package_apt/flex: Transferring object +__package_apt/flex: Checking code-local +__package_apt/flex: Executing code-local +__package_apt/flex: Checking code-remote +__package_apt/flex: Executing code-remote +__package_apt/gawk: Generating local code +__package_apt/gawk: Generating remote code +__package_apt/gawk: Transferring object +__package_apt/gawk: Checking code-local +__package_apt/gawk: Executing code-local +__package_apt/gawk: Checking code-remote +__package_apt/gawk: Executing code-remote +__package_apt/make: Generating local code +__package_apt/make: Generating remote code +__package_apt/make: Transferring object +__package_apt/make: Checking code-local +__package_apt/make: Executing code-local +__package_apt/make: Checking code-remote +__package_apt/make: Executing code-remote +__package_apt/sudo: Generating local code +__package_apt/sudo: Generating remote code +__package_apt/sudo: Transferring object +__package_apt/sudo: Checking code-local +__package_apt/sudo: Executing code-local +__package_apt/sudo: Checking code-remote +__package_apt/sudo: Executing code-remote +__package_apt/swig: Generating local code +__package_apt/swig: Generating remote code +__package_apt/swig: Transferring object +__package_apt/swig: Checking code-local +__package_apt/swig: Executing code-local +__package_apt/swig: Checking code-remote +__package_apt/swig: Executing code-remote +__package_apt/libreadline5-dev: Generating local code +__package_apt/libreadline5-dev: Generating remote code +__package_apt/libreadline5-dev: Transferring object +__package_apt/libreadline5-dev: Checking code-local +__package_apt/libreadline5-dev: Executing code-local +__package_apt/libreadline5-dev: Checking code-remote +__package_apt/libreadline5-dev: Executing code-remote +__package_apt/libexpat1-dev: Generating local code +__package_apt/libexpat1-dev: Generating remote code +__package_apt/libexpat1-dev: Transferring object +__package_apt/libexpat1-dev: Checking code-local +__package_apt/libexpat1-dev: Executing code-local +__package_apt/libexpat1-dev: Checking code-remote +__package_apt/libexpat1-dev: Executing code-remote +__package_apt/libnet-ssleay-perl: Generating local code +__package_apt/libnet-ssleay-perl: Generating remote code +__package_apt/libnet-ssleay-perl: Transferring object +__package_apt/libnet-ssleay-perl: Checking code-local +__package_apt/libnet-ssleay-perl: Executing code-local +__package_apt/libnet-ssleay-perl: Checking code-remote +__package_apt/libnet-ssleay-perl: Executing code-remote +__package_apt/subversion: Generating local code +__package_apt/subversion: Generating remote code +__package_apt/subversion: Transferring object +__package_apt/subversion: Checking code-local +__package_apt/subversion: Executing code-local +__package_apt/subversion: Checking code-remote +__package_apt/subversion: Executing code-remote +__package_apt/libcurl4-openssl-dev: Generating local code +__package_apt/libcurl4-openssl-dev: Generating remote code +__package_apt/libcurl4-openssl-dev: Transferring object +__package_apt/libcurl4-openssl-dev: Checking code-local +__package_apt/libcurl4-openssl-dev: Executing code-local +__package_apt/libcurl4-openssl-dev: Checking code-remote +__package_apt/libcurl4-openssl-dev: Executing code-remote +__package_apt/bison: Generating local code +__package_apt/bison: Generating remote code +__package_apt/bison: Transferring object +__package_apt/bison: Checking code-local +__package_apt/bison: Executing code-local +__package_apt/bison: Checking code-remote +__package_apt/bison: Executing code-remote +__package_apt/cmake: Generating local code +__package_apt/cmake: Generating remote code +__package_apt/cmake: Transferring object +__package_apt/cmake: Checking code-local +__package_apt/cmake: Executing code-local +__package_apt/cmake: Checking code-remote +__package_apt/cmake: Executing code-remote +__package_apt/emacs: Generating local code +__package_apt/emacs: Generating remote code +__package_apt/emacs: Transferring object +__package_apt/emacs: Checking code-local +__package_apt/emacs: Executing code-local +__package_apt/emacs: Checking code-remote +__package_apt/emacs: Executing code-remote +__package_apt/xfce4: Generating local code +__package_apt/xfce4: Generating remote code +__package_apt/xfce4: Transferring object +__package_apt/xfce4: Checking code-local +__package_apt/xfce4: Executing code-local +__package_apt/xfce4: Checking code-remote +__package_apt/xfce4: Executing code-remote +__package_apt/xterm: Generating local code +__package_apt/xterm: Generating remote code +__package_apt/xterm: Transferring object +__package_apt/xterm: Checking code-local +__package_apt/xterm: Executing code-local +__package_apt/xterm: Checking code-remote +__package_apt/xterm: Executing code-remote +__package_apt/tcl8.4-dev: Generating local code +__package_apt/tcl8.4-dev: Generating remote code +__package_apt/tcl8.4-dev: Transferring object +__package_apt/tcl8.4-dev: Checking code-local +__package_apt/tcl8.4-dev: Executing code-local +__package_apt/tcl8.4-dev: Checking code-remote +__package_apt/tcl8.4-dev: Executing code-remote +__package_apt/libio-socket-ssl-perl: Generating local code +__package_apt/libio-socket-ssl-perl: Generating remote code +__package_apt/libio-socket-ssl-perl: Transferring object +__package_apt/libio-socket-ssl-perl: Checking code-local +__package_apt/libio-socket-ssl-perl: Executing code-local +__package_apt/libio-socket-ssl-perl: Checking code-remote +__package_apt/libio-socket-ssl-perl: Executing code-remote +__package_apt/doxygen: Generating local code +__package_apt/doxygen: Generating remote code +__package_apt/doxygen: Transferring object +__package_apt/doxygen: Checking code-local +__package_apt/doxygen: Executing code-local +__package_apt/doxygen: Checking code-remote +__package_apt/doxygen: Executing code-remote +__package_apt/zlib1g-dev: Generating local code +__package_apt/zlib1g-dev: Generating remote code +__package_apt/zlib1g-dev: Transferring object +__package_apt/zlib1g-dev: Checking code-local +__package_apt/zlib1g-dev: Executing code-local +__package_apt/zlib1g-dev: Checking code-remote +__package_apt/zlib1g-dev: Executing code-remote +__package_apt/autoconf: Generating local code +__package_apt/autoconf: Generating remote code +__package_apt/autoconf: Transferring object +__package_apt/autoconf: Checking code-local +__package_apt/autoconf: Executing code-local +__package_apt/autoconf: Checking code-remote +__package_apt/autoconf: Executing code-remote +__package_apt/python-ldap: Generating local code +__package_apt/python-ldap: Generating remote code +__package_apt/python-ldap: Transferring object +__package_apt/python-ldap: Checking code-local +__package_apt/python-ldap: Executing code-local +__package_apt/python-ldap: Checking code-remote +__package_apt/python-ldap: Executing code-remote +__package_apt/libtool: Generating local code +__package_apt/libtool: Generating remote code +__package_apt/libtool: Transferring object +__package_apt/libtool: Checking code-local +__package_apt/libtool: Executing code-local +__package_apt/libtool: Checking code-remote +__package_apt/libtool: Executing code-remote +__package_apt/syslog-ng: Generating local code +__package_apt/syslog-ng: Generating remote code +__package_apt/syslog-ng: Transferring object +__package_apt/syslog-ng: Checking code-local +__package_apt/syslog-ng: Executing code-local +__package_apt/syslog-ng: Checking code-remote +__package_apt/syslog-ng: Executing code-remote +__package_apt/traceroute-nanog: Generating local code +__package_apt/traceroute-nanog: Generating remote code +__package_apt/traceroute-nanog: Transferring object +__package_apt/traceroute-nanog: Checking code-local +__package_apt/traceroute-nanog: Executing code-local +__package_apt/traceroute-nanog: Checking code-remote +__package_apt/traceroute-nanog: Executing code-remote +__package_apt/libnss-ldapd: Generating local code +__package_apt/libnss-ldapd: Generating remote code +__package_apt/libnss-ldapd: Transferring object +__package_apt/libnss-ldapd: Checking code-local +__package_apt/libnss-ldapd: Executing code-local +__package_apt/libnss-ldapd: Checking code-remote +__package_apt/libnss-ldapd: Executing code-remote +__package_apt/libncurses5-dev: Generating local code +__package_apt/libncurses5-dev: Generating remote code +__package_apt/libncurses5-dev: Transferring object +__package_apt/libncurses5-dev: Checking code-local +__package_apt/libncurses5-dev: Executing code-local +__package_apt/libncurses5-dev: Checking code-remote +__package_apt/libncurses5-dev: Executing code-remote +__package_apt/libaio-dev: Generating local code +__package_apt/libaio-dev: Generating remote code +__package_apt/libaio-dev: Transferring object +__package_apt/libaio-dev: Checking code-local +__package_apt/libaio-dev: Executing code-local +__package_apt/libaio-dev: Checking code-remote +__package_apt/libaio-dev: Executing code-remote +__package_apt/libboost-dev: Generating local code +__package_apt/libboost-dev: Generating remote code +__package_apt/libboost-dev: Transferring object +__package_apt/libboost-dev: Checking code-local +__package_apt/libboost-dev: Executing code-local +__package_apt/libboost-dev: Checking code-remote +__package_apt/libboost-dev: Executing code-remote +__package_apt/xtightvncviewer: Generating local code +__package_apt/xtightvncviewer: Generating remote code +__package_apt/xtightvncviewer: Transferring object +__package_apt/xtightvncviewer: Checking code-local +__package_apt/xtightvncviewer: Executing code-local +__package_apt/xtightvncviewer: Checking code-remote +__package_apt/xtightvncviewer: Executing code-remote +__package_apt/nullmailer: Generating local code +__package_apt/nullmailer: Generating remote code +__package_apt/nullmailer: Transferring object +__package_apt/nullmailer: Checking code-local +__package_apt/nullmailer: Executing code-local +__package_apt/nullmailer: Checking code-remote +__package_apt/nullmailer: Executing code-remote +__package_apt/libxml2-dev: Generating local code +__package_apt/libxml2-dev: Generating remote code +__package_apt/libxml2-dev: Transferring object +__package_apt/libxml2-dev: Checking code-local +__package_apt/libxml2-dev: Executing code-local +__package_apt/libxml2-dev: Checking code-remote +__package_apt/libxml2-dev: Executing code-remote +__package_apt/libtidy-dev: Generating local code +__package_apt/libtidy-dev: Generating remote code +__package_apt/libtidy-dev: Transferring object +__package_apt/libtidy-dev: Checking code-local +__package_apt/libtidy-dev: Executing code-local +__package_apt/libtidy-dev: Checking code-remote +__package_apt/libtidy-dev: Executing code-remote +__package_apt/manpages: Generating local code +__package_apt/manpages: Generating remote code +__package_apt/manpages: Transferring object +__package_apt/manpages: Checking code-local +__package_apt/manpages: Executing code-local +__package_apt/manpages: Checking code-remote +__package_apt/manpages: Executing code-remote +__package_apt/autofs: Generating local code +__package_apt/autofs: Generating remote code +__package_apt/autofs: Transferring object +__package_apt/autofs: Checking code-local +__package_apt/autofs: Executing code-local +__package_apt/autofs: Checking code-remote +__package_apt/autofs: Executing code-remote +__package_apt/gcc-doc: Generating local code +__package_apt/gcc-doc: Generating remote code +__package_apt/gcc-doc: Transferring object +__package_apt/gcc-doc: Checking code-local +__package_apt/gcc-doc: Executing code-local +__package_apt/gcc-doc: Checking code-remote +__package_apt/gcc-doc: Executing code-remote +__package_apt/fluxbox: Generating local code +__package_apt/fluxbox: Generating remote code +__package_apt/fluxbox: Transferring object +__package_apt/fluxbox: Checking code-local +__package_apt/fluxbox: Executing code-local +__package_apt/fluxbox: Checking code-remote +__package_apt/fluxbox: Executing code-remote +__package_apt/libicu-dev: Generating local code +__package_apt/libicu-dev: Generating remote code +__package_apt/libicu-dev: Transferring object +__package_apt/libicu-dev: Checking code-local +__package_apt/libicu-dev: Executing code-local +__package_apt/libicu-dev: Checking code-remote +__package_apt/libicu-dev: Executing code-remote +__package_apt/libc6-dev-i386: Generating local code +__package_apt/libc6-dev-i386: Generating remote code +__package_apt/libc6-dev-i386: Transferring object +__package_apt/libc6-dev-i386: Checking code-local +__package_apt/libc6-dev-i386: Executing code-local +__package_apt/libc6-dev-i386: Checking code-remote +__package_apt/libc6-dev-i386: Executing code-remote +__package_apt/mercurial: Generating local code +__package_apt/mercurial: Generating remote code +__package_apt/mercurial: Transferring object +__package_apt/mercurial: Checking code-local +__package_apt/mercurial: Executing code-local +__package_apt/mercurial: Checking code-remote +__package_apt/mercurial: Executing code-remote +__package_apt/git-doc: Generating local code +__package_apt/git-doc: Generating remote code +__package_apt/git-doc: Transferring object +__package_apt/git-doc: Checking code-local +__package_apt/git-doc: Executing code-local +__package_apt/git-doc: Checking code-remote +__package_apt/git-doc: Executing code-remote +__package_apt/git-svn: Generating local code +__package_apt/git-svn: Generating remote code +__package_apt/git-svn: Transferring object +__package_apt/git-svn: Checking code-local +__package_apt/git-svn: Executing code-local +__package_apt/git-svn: Checking code-remote +__package_apt/git-svn: Executing code-remote +__package_apt/libnuma-dev: Generating local code +__package_apt/libnuma-dev: Generating remote code +__package_apt/libnuma-dev: Transferring object +__package_apt/libnuma-dev: Checking code-local +__package_apt/libnuma-dev: Executing code-local +__package_apt/libnuma-dev: Checking code-remote +__package_apt/libnuma-dev: Executing code-remote +__package_apt/gnuplot: Generating local code +__package_apt/gnuplot: Generating remote code +__package_apt/gnuplot: Transferring object +__package_apt/gnuplot: Checking code-local +__package_apt/gnuplot: Executing code-local +__package_apt/gnuplot: Checking code-remote +__package_apt/gnuplot: Executing code-remote +__package_apt/puppet: Generating local code +__package_apt/puppet: Generating remote code +__package_apt/puppet: Transferring object +__package_apt/puppet: Checking code-local +__package_apt/puppet: Executing code-local +__package_apt/puppet: Checking code-remote +__package_apt/puppet: Executing code-remote +__package_apt/screen: Generating local code +__package_apt/screen: Generating remote code +__package_apt/screen: Transferring object +__package_apt/screen: Checking code-local +__package_apt/screen: Executing code-local +__package_apt/screen: Checking code-remote +__package_apt/screen: Executing code-remote +__package_apt/openntpd: Generating local code +__package_apt/openntpd: Generating remote code +__package_apt/openntpd: Transferring object +__package_apt/openntpd: Checking code-local +__package_apt/openntpd: Executing code-local +__package_apt/openntpd: Checking code-remote +__package_apt/openntpd: Executing code-remote +__package_apt/gcc-multilib: Generating local code +__package_apt/gcc-multilib: Generating remote code +__package_apt/gcc-multilib: Transferring object +__package_apt/gcc-multilib: Checking code-local +__package_apt/gcc-multilib: Executing code-local +__package_apt/gcc-multilib: Checking code-remote +__package_apt/gcc-multilib: Executing code-remote +__package_apt/libboost-regex-dev: Generating local code +__package_apt/libboost-regex-dev: Generating remote code +__package_apt/libboost-regex-dev: Transferring object +__package_apt/libboost-regex-dev: Checking code-local +__package_apt/libboost-regex-dev: Executing code-local +__package_apt/libboost-regex-dev: Checking code-remote +__package_apt/libboost-regex-dev: Executing code-remote +__package_apt/g++-multilib: Generating local code +__package_apt/g++-multilib: Generating remote code +__package_apt/g++-multilib: Transferring object +__package_apt/g++-multilib: Checking code-local +__package_apt/g++-multilib: Executing code-local +__package_apt/g++-multilib: Checking code-remote +__package_apt/g++-multilib: Executing code-remote +__package_apt/xfonts-base: Generating local code +__package_apt/xfonts-base: Generating remote code +__package_apt/xfonts-base: Transferring object +__package_apt/xfonts-base: Checking code-local +__package_apt/xfonts-base: Executing code-local +__package_apt/xfonts-base: Checking code-remote +__package_apt/xfonts-base: Executing code-remote +__package_apt/rdesktop: Generating local code +__package_apt/rdesktop: Generating remote code +__package_apt/rdesktop: Transferring object +__package_apt/rdesktop: Checking code-local +__package_apt/rdesktop: Executing code-local +__package_apt/rdesktop: Checking code-remote +__package_apt/rdesktop: Executing code-remote +__package_apt/build-essential: Generating local code +__package_apt/build-essential: Generating remote code +__package_apt/build-essential: Transferring object +__package_apt/build-essential: Checking code-local +__package_apt/build-essential: Executing code-local +__package_apt/build-essential: Checking code-remote +__package_apt/build-essential: Executing code-remote +__package_apt/tightvncserver: Generating local code +__package_apt/tightvncserver: Generating remote code +__package_apt/tightvncserver: Transferring object +__package_apt/tightvncserver: Checking code-local +__package_apt/tightvncserver: Executing code-local +__package_apt/tightvncserver: Checking code-remote +__package_apt/tightvncserver: Executing code-remote +__package_apt/python-crypto: Generating local code +__package_apt/python-crypto: Generating remote code +__package_apt/python-crypto: Transferring object +__package_apt/python-crypto: Checking code-local +__package_apt/python-crypto: Executing code-local +__package_apt/python-crypto: Checking code-remote +__package_apt/python-crypto: Executing code-remote +__package_apt/libpam-krb5: Generating local code +__package_apt/libpam-krb5: Generating remote code +__package_apt/libpam-krb5: Transferring object +__package_apt/libpam-krb5: Checking code-local +__package_apt/libpam-krb5: Executing code-local +__package_apt/libpam-krb5: Checking code-remote +__package_apt/libpam-krb5: Executing code-remote +__package_apt/libc6-dev: Generating local code +__package_apt/libc6-dev: Generating remote code +__package_apt/libc6-dev: Transferring object +__package_apt/libc6-dev: Checking code-local +__package_apt/libc6-dev: Executing code-local +__package_apt/libc6-dev: Checking code-remote +__package_apt/libc6-dev: Executing code-remote +__package_apt/manpages-dev: Generating local code +__package_apt/manpages-dev: Generating remote code +__package_apt/manpages-dev: Transferring object +__package_apt/manpages-dev: Checking code-local +__package_apt/manpages-dev: Executing code-local +__package_apt/manpages-dev: Checking code-remote +__package_apt/manpages-dev: Executing code-remote +__package_apt/ia32-libs: Generating local code +__package_apt/ia32-libs: Generating remote code +__package_apt/ia32-libs: Transferring object +__package_apt/ia32-libs: Checking code-local +__package_apt/ia32-libs: Executing code-local +__package_apt/ia32-libs: Checking code-remote +__package_apt/ia32-libs: Executing code-remote +__package_apt/libxml-checker-perl: Generating local code +__package_apt/libxml-checker-perl: Generating remote code +__package_apt/libxml-checker-perl: Transferring object +__package_apt/libxml-checker-perl: Checking code-local +__package_apt/libxml-checker-perl: Executing code-local +__package_apt/libxml-checker-perl: Checking code-remote +__package_apt/libxml-checker-perl: Executing code-remote +__addifnosuchline/ssh-root-subasui: Generating local code +__addifnosuchline/ssh-root-subasui: Generating remote code +__addifnosuchline/ssh-root-subasui: Transferring object +__addifnosuchline/ssh-root-subasui: Checking code-local +__addifnosuchline/ssh-root-subasui: Executing code-local +__addifnosuchline/ssh-root-subasui: Checking code-remote +__addifnosuchline/ssh-root-subasui: Executing code-remote +__addifnosuchline/ssh-root-blukas: Generating local code +__addifnosuchline/ssh-root-blukas: Generating remote code +__addifnosuchline/ssh-root-blukas: Transferring object +__addifnosuchline/ssh-root-blukas: Checking code-local +__addifnosuchline/ssh-root-blukas: Executing code-local +__addifnosuchline/ssh-root-blukas: Checking code-remote +__addifnosuchline/ssh-root-blukas: Executing code-remote +__addifnosuchline/ssh-root-petfisch: Generating local code +__addifnosuchline/ssh-root-petfisch: Generating remote code +__addifnosuchline/ssh-root-petfisch: Transferring object +__addifnosuchline/ssh-root-petfisch: Checking code-local +__addifnosuchline/ssh-root-petfisch: Executing code-local +__addifnosuchline/ssh-root-petfisch: Checking code-remote +__addifnosuchline/ssh-root-petfisch: Executing code-remote +__ethz_systems/singleton: Generating local code +__ethz_systems/singleton: Generating remote code +__ethz_systems/singleton: Transferring object +__ethz_systems/singleton: Checking code-local +__ethz_systems/singleton: Executing code-local +__ethz_systems/singleton: Checking code-remote +__ethz_systems/singleton: Executing code-remote +__file/etc/nsswitch.conf: Resolving requirement __package/libnss-ldapd +__package/libnss-ldapd: Generating local code +__package/libnss-ldapd: Generating remote code +__package/libnss-ldapd: Transferring object +__package/libnss-ldapd: Checking code-local +__package/libnss-ldapd: Executing code-local +__package/libnss-ldapd: Checking code-remote +__package/libnss-ldapd: Executing code-remote +__file/etc/nsswitch.conf: Resolving requirement __file//etc/nslcd.conf +__file//etc/nslcd.conf: Generating local code +__file//etc/nslcd.conf: Generating remote code +__file//etc/nslcd.conf: Transferring object +__file//etc/nslcd.conf: Checking code-local +__file//etc/nslcd.conf: Executing code-local +__file//etc/nslcd.conf: Checking code-remote +__file//etc/nslcd.conf: Executing code-remote +__file/etc/nsswitch.conf: Generating local code +__file/etc/nsswitch.conf: Generating remote code +__file/etc/nsswitch.conf: Transferring object +__file/etc/nsswitch.conf: Checking code-local +__file/etc/nsswitch.conf: Executing code-local +__file/etc/nsswitch.conf: Checking code-remote +__file/etc/nsswitch.conf: Executing code-remote +__file/etc/ethz/autofs/auto.pub: Resolving requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Generating local code +__file/etc/ethz/autofs/auto.pub: Generating remote code +__file/etc/ethz/autofs/auto.pub: Transferring object +__file/etc/ethz/autofs/auto.pub: Checking code-local +__file/etc/ethz/autofs/auto.pub: Executing code-local +__file/etc/ethz/autofs/auto.pub: Checking code-remote +__file/etc/ethz/autofs/auto.pub: Executing code-remote +__file/etc/ethz/autofs/auto_home: Resolving requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Resolving requirement __package/python-ldap +__package/python-ldap: Generating local code +__package/python-ldap: Generating remote code +__package/python-ldap: Transferring object +__package/python-ldap: Checking code-local +__package/python-ldap: Executing code-local +__package/python-ldap: Checking code-remote +__package/python-ldap: Executing code-remote +__file/etc/ethz/autofs/auto_home: Generating local code +__file/etc/ethz/autofs/auto_home: Generating remote code +__file/etc/ethz/autofs/auto_home: Transferring object +__file/etc/ethz/autofs/auto_home: Checking code-local +__file/etc/ethz/autofs/auto_home: Executing code-local +__file/etc/ethz/autofs/auto_home: Checking code-remote +__file/etc/ethz/autofs/auto_home: Executing code-remote +__file/etc/default/openntpd: Generating local code +__file/etc/default/openntpd: Generating remote code +__file/etc/default/openntpd: Transferring object +__file/etc/default/openntpd: Checking code-local +__file/etc/default/openntpd: Executing code-local +__file/etc/default/openntpd: Checking code-remote +__file/etc/default/openntpd: Executing code-remote +__file/etc/auto.master: Resolving requirement __package/autofs +__package/autofs: Generating local code +__package/autofs: Generating remote code +__package/autofs: Transferring object +__package/autofs: Checking code-local +__package/autofs: Executing code-local +__package/autofs: Checking code-remote +__package/autofs: Executing code-remote +__file/etc/auto.master: Generating local code +__file/etc/auto.master: Generating remote code +__file/etc/auto.master: Transferring object +__file/etc/auto.master: Checking code-local +__file/etc/auto.master: Executing code-local +__file/etc/auto.master: Checking code-remote +__file/etc/auto.master: Executing code-remote +__file/etc/hosts: Generating local code +__file/etc/hosts: Generating remote code +__file/etc/hosts: Transferring object +__file/etc/hosts: Checking code-local +__file/etc/hosts: Executing code-local +__file/etc/hosts: Checking code-remote +__file/etc/hosts: Executing code-remote +__file/etc/krb5.conf: Generating local code +__file/etc/krb5.conf: Generating remote code +__file/etc/krb5.conf: Transferring object +__file/etc/krb5.conf: Checking code-local +__file/etc/krb5.conf: Executing code-local +__file/etc/krb5.conf: Checking code-remote +__file/etc/krb5.conf: Executing code-remote +__file/etc/syslog-ng/syslog-ng.conf: Resolving requirement __package/syslog-ng +__package/syslog-ng: Generating local code +__package/syslog-ng: Generating remote code +__package/syslog-ng: Transferring object +__package/syslog-ng: Checking code-local +__package/syslog-ng: Executing code-local +__package/syslog-ng: Checking code-remote +__package/syslog-ng: Executing code-remote +__file/etc/syslog-ng/syslog-ng.conf: Generating local code +__file/etc/syslog-ng/syslog-ng.conf: Generating remote code +__file/etc/syslog-ng/syslog-ng.conf: Transferring object +__file/etc/syslog-ng/syslog-ng.conf: Checking code-local +__file/etc/syslog-ng/syslog-ng.conf: Executing code-local +__file/etc/syslog-ng/syslog-ng.conf: Checking code-remote +__file/etc/syslog-ng/syslog-ng.conf: Executing code-remote +__file/etc/nullmailer/remotes: Resolving requirement __package/nullmailer +__package/nullmailer: Generating local code +__package/nullmailer: Generating remote code +__package/nullmailer: Transferring object +__package/nullmailer: Checking code-local +__package/nullmailer: Executing code-local +__package/nullmailer: Checking code-remote +__package/nullmailer: Executing code-remote +__file/etc/nullmailer/remotes: Generating local code +__file/etc/nullmailer/remotes: Generating remote code +__file/etc/nullmailer/remotes: Transferring object +__file/etc/nullmailer/remotes: Checking code-local +__file/etc/nullmailer/remotes: Executing code-local +__file/etc/nullmailer/remotes: Checking code-remote +__file/etc/nullmailer/remotes: Executing code-remote +__file/etc/cdist-configured: Generating local code +__file/etc/cdist-configured: Generating remote code +__file/etc/cdist-configured: Transferring object +__file/etc/cdist-configured: Checking code-local +__file/etc/cdist-configured: Executing code-local +__file/etc/cdist-configured: Checking code-remote +__file/etc/cdist-configured: Executing code-remote +__file/etc/motd.tail: Generating local code +__file/etc/motd.tail: Generating remote code +__file/etc/motd.tail: Transferring object +__file/etc/motd.tail: Checking code-local +__file/etc/motd.tail: Executing code-local +__file/etc/motd.tail: Checking code-remote +__file/etc/motd.tail: Executing code-remote +__file/etc/openntpd/ntpd.conf: Generating local code +__file/etc/openntpd/ntpd.conf: Generating remote code +__file/etc/openntpd/ntpd.conf: Transferring object +__file/etc/openntpd/ntpd.conf: Checking code-local +__file/etc/openntpd/ntpd.conf: Executing code-local +__file/etc/openntpd/ntpd.conf: Checking code-remote +__file/etc/openntpd/ntpd.conf: Executing code-remote +__file/etc/sudoers.d/systems: Resolving requirement __package/sudo +__package/sudo: Generating local code +__package/sudo: Generating remote code +__package/sudo: Transferring object +__package/sudo: Checking code-local +__package/sudo: Executing code-local +__package/sudo: Checking code-remote +__package/sudo: Executing code-remote +__file/etc/sudoers.d/systems: Generating local code +__file/etc/sudoers.d/systems: Generating remote code +__file/etc/sudoers.d/systems: Transferring object +__file/etc/sudoers.d/systems: Checking code-local +__file/etc/sudoers.d/systems: Executing code-local +__file/etc/sudoers.d/systems: Checking code-remote +__file/etc/sudoers.d/systems: Executing code-remote +__link/etc/motd: Generating local code +__link/etc/motd: Generating remote code +__link/etc/motd: Transferring object +__link/etc/motd: Checking code-local +__link/etc/motd: Executing code-local +__link/etc/motd: Checking code-remote +__link/etc/motd: Executing code-remote +__motd/singleton: Generating local code +__motd/singleton: Generating remote code +__motd/singleton: Transferring object +__motd/singleton: Checking code-local +__motd/singleton: Executing code-local +__motd/singleton: Checking code-remote +__motd/singleton: Executing code-remote +__package/mc: Generating local code +__package/mc: Generating remote code +__package/mc: Transferring object +__package/mc: Checking code-local +__package/mc: Executing code-local +__package/mc: Checking code-remote +__package/mc: Executing code-remote +__package/ant: Generating local code +__package/ant: Generating remote code +__package/ant: Transferring object +__package/ant: Checking code-local +__package/ant: Executing code-local +__package/ant: Checking code-remote +__package/ant: Executing code-remote +__package/gcc: Generating local code +__package/gcc: Generating remote code +__package/gcc: Transferring object +__package/gcc: Checking code-local +__package/gcc: Executing code-local +__package/gcc: Checking code-remote +__package/gcc: Executing code-remote +__package/gdb: Generating local code +__package/gdb: Generating remote code +__package/gdb: Transferring object +__package/gdb: Checking code-local +__package/gdb: Executing code-local +__package/gdb: Checking code-remote +__package/gdb: Executing code-remote +__package/vim: Generating local code +__package/vim: Generating remote code +__package/vim: Transferring object +__package/vim: Checking code-local +__package/vim: Executing code-local +__package/vim: Checking code-remote +__package/vim: Executing code-remote +__package/git-core: Generating local code +__package/git-core: Generating remote code +__package/git-core: Transferring object +__package/git-core: Checking code-local +__package/git-core: Executing code-local +__package/git-core: Checking code-remote +__package/git-core: Executing code-remote +__package/atop: Generating local code +__package/atop: Generating remote code +__package/atop: Transferring object +__package/atop: Checking code-local +__package/atop: Executing code-local +__package/atop: Checking code-remote +__package/atop: Executing code-remote +__package/flex: Generating local code +__package/flex: Generating remote code +__package/flex: Transferring object +__package/flex: Checking code-local +__package/flex: Executing code-local +__package/flex: Checking code-remote +__package/flex: Executing code-remote +__package/gawk: Generating local code +__package/gawk: Generating remote code +__package/gawk: Transferring object +__package/gawk: Checking code-local +__package/gawk: Executing code-local +__package/gawk: Checking code-remote +__package/gawk: Executing code-remote +__package/make: Generating local code +__package/make: Generating remote code +__package/make: Transferring object +__package/make: Checking code-local +__package/make: Executing code-local +__package/make: Checking code-remote +__package/make: Executing code-remote +__package/swig: Generating local code +__package/swig: Generating remote code +__package/swig: Transferring object +__package/swig: Checking code-local +__package/swig: Executing code-local +__package/swig: Checking code-remote +__package/swig: Executing code-remote +__package/libreadline5-dev: Generating local code +__package/libreadline5-dev: Generating remote code +__package/libreadline5-dev: Transferring object +__package/libreadline5-dev: Checking code-local +__package/libreadline5-dev: Executing code-local +__package/libreadline5-dev: Checking code-remote +__package/libreadline5-dev: Executing code-remote +__package/libexpat1-dev: Generating local code +__package/libexpat1-dev: Generating remote code +__package/libexpat1-dev: Transferring object +__package/libexpat1-dev: Checking code-local +__package/libexpat1-dev: Executing code-local +__package/libexpat1-dev: Checking code-remote +__package/libexpat1-dev: Executing code-remote +__package/libnet-ssleay-perl: Generating local code +__package/libnet-ssleay-perl: Generating remote code +__package/libnet-ssleay-perl: Transferring object +__package/libnet-ssleay-perl: Checking code-local +__package/libnet-ssleay-perl: Executing code-local +__package/libnet-ssleay-perl: Checking code-remote +__package/libnet-ssleay-perl: Executing code-remote +__package/subversion: Generating local code +__package/subversion: Generating remote code +__package/subversion: Transferring object +__package/subversion: Checking code-local +__package/subversion: Executing code-local +__package/subversion: Checking code-remote +__package/subversion: Executing code-remote +__package/libcurl4-openssl-dev: Generating local code +__package/libcurl4-openssl-dev: Generating remote code +__package/libcurl4-openssl-dev: Transferring object +__package/libcurl4-openssl-dev: Checking code-local +__package/libcurl4-openssl-dev: Executing code-local +__package/libcurl4-openssl-dev: Checking code-remote +__package/libcurl4-openssl-dev: Executing code-remote +__package/bison: Generating local code +__package/bison: Generating remote code +__package/bison: Transferring object +__package/bison: Checking code-local +__package/bison: Executing code-local +__package/bison: Checking code-remote +__package/bison: Executing code-remote +__package/cmake: Generating local code +__package/cmake: Generating remote code +__package/cmake: Transferring object +__package/cmake: Checking code-local +__package/cmake: Executing code-local +__package/cmake: Checking code-remote +__package/cmake: Executing code-remote +__package/emacs: Generating local code +__package/emacs: Generating remote code +__package/emacs: Transferring object +__package/emacs: Checking code-local +__package/emacs: Executing code-local +__package/emacs: Checking code-remote +__package/emacs: Executing code-remote +__package/xfce4: Generating local code +__package/xfce4: Generating remote code +__package/xfce4: Transferring object +__package/xfce4: Checking code-local +__package/xfce4: Executing code-local +__package/xfce4: Checking code-remote +__package/xfce4: Executing code-remote +__package/xterm: Generating local code +__package/xterm: Generating remote code +__package/xterm: Transferring object +__package/xterm: Checking code-local +__package/xterm: Executing code-local +__package/xterm: Checking code-remote +__package/xterm: Executing code-remote +__package/tcl8.4-dev: Generating local code +__package/tcl8.4-dev: Generating remote code +__package/tcl8.4-dev: Transferring object +__package/tcl8.4-dev: Checking code-local +__package/tcl8.4-dev: Executing code-local +__package/tcl8.4-dev: Checking code-remote +__package/tcl8.4-dev: Executing code-remote +__package/libio-socket-ssl-perl: Generating local code +__package/libio-socket-ssl-perl: Generating remote code +__package/libio-socket-ssl-perl: Transferring object +__package/libio-socket-ssl-perl: Checking code-local +__package/libio-socket-ssl-perl: Executing code-local +__package/libio-socket-ssl-perl: Checking code-remote +__package/libio-socket-ssl-perl: Executing code-remote +__package/doxygen: Generating local code +__package/doxygen: Generating remote code +__package/doxygen: Transferring object +__package/doxygen: Checking code-local +__package/doxygen: Executing code-local +__package/doxygen: Checking code-remote +__package/doxygen: Executing code-remote +__package/zlib1g-dev: Generating local code +__package/zlib1g-dev: Generating remote code +__package/zlib1g-dev: Transferring object +__package/zlib1g-dev: Checking code-local +__package/zlib1g-dev: Executing code-local +__package/zlib1g-dev: Checking code-remote +__package/zlib1g-dev: Executing code-remote +__package/autoconf: Generating local code +__package/autoconf: Generating remote code +__package/autoconf: Transferring object +__package/autoconf: Checking code-local +__package/autoconf: Executing code-local +__package/autoconf: Checking code-remote +__package/autoconf: Executing code-remote +__package/libtool: Generating local code +__package/libtool: Generating remote code +__package/libtool: Transferring object +__package/libtool: Checking code-local +__package/libtool: Executing code-local +__package/libtool: Checking code-remote +__package/libtool: Executing code-remote +__package/traceroute-nanog: Generating local code +__package/traceroute-nanog: Generating remote code +__package/traceroute-nanog: Transferring object +__package/traceroute-nanog: Checking code-local +__package/traceroute-nanog: Executing code-local +__package/traceroute-nanog: Checking code-remote +__package/traceroute-nanog: Executing code-remote +__package/libncurses5-dev: Generating local code +__package/libncurses5-dev: Generating remote code +__package/libncurses5-dev: Transferring object +__package/libncurses5-dev: Checking code-local +__package/libncurses5-dev: Executing code-local +__package/libncurses5-dev: Checking code-remote +__package/libncurses5-dev: Executing code-remote +__package/libaio-dev: Generating local code +__package/libaio-dev: Generating remote code +__package/libaio-dev: Transferring object +__package/libaio-dev: Checking code-local +__package/libaio-dev: Executing code-local +__package/libaio-dev: Checking code-remote +__package/libaio-dev: Executing code-remote +__package/libboost-dev: Generating local code +__package/libboost-dev: Generating remote code +__package/libboost-dev: Transferring object +__package/libboost-dev: Checking code-local +__package/libboost-dev: Executing code-local +__package/libboost-dev: Checking code-remote +__package/libboost-dev: Executing code-remote +__package/xtightvncviewer: Generating local code +__package/xtightvncviewer: Generating remote code +__package/xtightvncviewer: Transferring object +__package/xtightvncviewer: Checking code-local +__package/xtightvncviewer: Executing code-local +__package/xtightvncviewer: Checking code-remote +__package/xtightvncviewer: Executing code-remote +__package/libxml2-dev: Generating local code +__package/libxml2-dev: Generating remote code +__package/libxml2-dev: Transferring object +__package/libxml2-dev: Checking code-local +__package/libxml2-dev: Executing code-local +__package/libxml2-dev: Checking code-remote +__package/libxml2-dev: Executing code-remote +__package/libtidy-dev: Generating local code +__package/libtidy-dev: Generating remote code +__package/libtidy-dev: Transferring object +__package/libtidy-dev: Checking code-local +__package/libtidy-dev: Executing code-local +__package/libtidy-dev: Checking code-remote +__package/libtidy-dev: Executing code-remote +__package/manpages: Generating local code +__package/manpages: Generating remote code +__package/manpages: Transferring object +__package/manpages: Checking code-local +__package/manpages: Executing code-local +__package/manpages: Checking code-remote +__package/manpages: Executing code-remote +__package/gcc-doc: Generating local code +__package/gcc-doc: Generating remote code +__package/gcc-doc: Transferring object +__package/gcc-doc: Checking code-local +__package/gcc-doc: Executing code-local +__package/gcc-doc: Checking code-remote +__package/gcc-doc: Executing code-remote +__package/fluxbox: Generating local code +__package/fluxbox: Generating remote code +__package/fluxbox: Transferring object +__package/fluxbox: Checking code-local +__package/fluxbox: Executing code-local +__package/fluxbox: Checking code-remote +__package/fluxbox: Executing code-remote +__package/libicu-dev: Generating local code +__package/libicu-dev: Generating remote code +__package/libicu-dev: Transferring object +__package/libicu-dev: Checking code-local +__package/libicu-dev: Executing code-local +__package/libicu-dev: Checking code-remote +__package/libicu-dev: Executing code-remote +__package/libc6-dev-i386: Generating local code +__package/libc6-dev-i386: Generating remote code +__package/libc6-dev-i386: Transferring object +__package/libc6-dev-i386: Checking code-local +__package/libc6-dev-i386: Executing code-local +__package/libc6-dev-i386: Checking code-remote +__package/libc6-dev-i386: Executing code-remote +__package/mercurial: Generating local code +__package/mercurial: Generating remote code +__package/mercurial: Transferring object +__package/mercurial: Checking code-local +__package/mercurial: Executing code-local +__package/mercurial: Checking code-remote +__package/mercurial: Executing code-remote +__package/git-doc: Generating local code +__package/git-doc: Generating remote code +__package/git-doc: Transferring object +__package/git-doc: Checking code-local +__package/git-doc: Executing code-local +__package/git-doc: Checking code-remote +__package/git-doc: Executing code-remote +__package/git-svn: Generating local code +__package/git-svn: Generating remote code +__package/git-svn: Transferring object +__package/git-svn: Checking code-local +__package/git-svn: Executing code-local +__package/git-svn: Checking code-remote +__package/git-svn: Executing code-remote +__package/libnuma-dev: Generating local code +__package/libnuma-dev: Generating remote code +__package/libnuma-dev: Transferring object +__package/libnuma-dev: Checking code-local +__package/libnuma-dev: Executing code-local +__package/libnuma-dev: Checking code-remote +__package/libnuma-dev: Executing code-remote +__package/gnuplot: Generating local code +__package/gnuplot: Generating remote code +__package/gnuplot: Transferring object +__package/gnuplot: Checking code-local +__package/gnuplot: Executing code-local +__package/gnuplot: Checking code-remote +__package/gnuplot: Executing code-remote +__package/puppet: Generating local code +__package/puppet: Generating remote code +__package/puppet: Transferring object +__package/puppet: Checking code-local +__package/puppet: Executing code-local +__package/puppet: Checking code-remote +__package/puppet: Executing code-remote +__package/screen: Generating local code +__package/screen: Generating remote code +__package/screen: Transferring object +__package/screen: Checking code-local +__package/screen: Executing code-local +__package/screen: Checking code-remote +__package/screen: Executing code-remote +__package/openntpd: Generating local code +__package/openntpd: Generating remote code +__package/openntpd: Transferring object +__package/openntpd: Checking code-local +__package/openntpd: Executing code-local +__package/openntpd: Checking code-remote +__package/openntpd: Executing code-remote +__package/gcc-multilib: Generating local code +__package/gcc-multilib: Generating remote code +__package/gcc-multilib: Transferring object +__package/gcc-multilib: Checking code-local +__package/gcc-multilib: Executing code-local +__package/gcc-multilib: Checking code-remote +__package/gcc-multilib: Executing code-remote +__package/libboost-regex-dev: Generating local code +__package/libboost-regex-dev: Generating remote code +__package/libboost-regex-dev: Transferring object +__package/libboost-regex-dev: Checking code-local +__package/libboost-regex-dev: Executing code-local +__package/libboost-regex-dev: Checking code-remote +__package/libboost-regex-dev: Executing code-remote +__package/g++-multilib: Generating local code +__package/g++-multilib: Generating remote code +__package/g++-multilib: Transferring object +__package/g++-multilib: Checking code-local +__package/g++-multilib: Executing code-local +__package/g++-multilib: Checking code-remote +__package/g++-multilib: Executing code-remote +__package/xfonts-base: Generating local code +__package/xfonts-base: Generating remote code +__package/xfonts-base: Transferring object +__package/xfonts-base: Checking code-local +__package/xfonts-base: Executing code-local +__package/xfonts-base: Checking code-remote +__package/xfonts-base: Executing code-remote +__package/rdesktop: Generating local code +__package/rdesktop: Generating remote code +__package/rdesktop: Transferring object +__package/rdesktop: Checking code-local +__package/rdesktop: Executing code-local +__package/rdesktop: Checking code-remote +__package/rdesktop: Executing code-remote +__package/build-essential: Generating local code +__package/build-essential: Generating remote code +__package/build-essential: Transferring object +__package/build-essential: Checking code-local +__package/build-essential: Executing code-local +__package/build-essential: Checking code-remote +__package/build-essential: Executing code-remote +__package/tightvncserver: Generating local code +__package/tightvncserver: Generating remote code +__package/tightvncserver: Transferring object +__package/tightvncserver: Checking code-local +__package/tightvncserver: Executing code-local +__package/tightvncserver: Checking code-remote +__package/tightvncserver: Executing code-remote +__package/python-crypto: Generating local code +__package/python-crypto: Generating remote code +__package/python-crypto: Transferring object +__package/python-crypto: Checking code-local +__package/python-crypto: Executing code-local +__package/python-crypto: Checking code-remote +__package/python-crypto: Executing code-remote +__package/libpam-krb5: Generating local code +__package/libpam-krb5: Generating remote code +__package/libpam-krb5: Transferring object +__package/libpam-krb5: Checking code-local +__package/libpam-krb5: Executing code-local +__package/libpam-krb5: Checking code-remote +__package/libpam-krb5: Executing code-remote +__package/libc6-dev: Generating local code +__package/libc6-dev: Generating remote code +__package/libc6-dev: Transferring object +__package/libc6-dev: Checking code-local +__package/libc6-dev: Executing code-local +__package/libc6-dev: Checking code-remote +__package/libc6-dev: Executing code-remote +__package/manpages-dev: Generating local code +__package/manpages-dev: Generating remote code +__package/manpages-dev: Transferring object +__package/manpages-dev: Checking code-local +__package/manpages-dev: Executing code-local +__package/manpages-dev: Checking code-remote +__package/manpages-dev: Executing code-remote +__package/ia32-libs: Generating local code +__package/ia32-libs: Generating remote code +__package/ia32-libs: Transferring object +__package/ia32-libs: Checking code-local +__package/ia32-libs: Executing code-local +__package/ia32-libs: Checking code-remote +__package/ia32-libs: Executing code-remote +__package/libxml-checker-perl: Generating local code +__package/libxml-checker-perl: Generating remote code +__package/libxml-checker-perl: Transferring object +__package/libxml-checker-perl: Checking code-local +__package/libxml-checker-perl: Executing code-local +__package/libxml-checker-perl: Checking code-remote +__package/libxml-checker-perl: Executing code-remote +__ethz_systems_root_via_ssh/subasui: Generating local code +__ethz_systems_root_via_ssh/subasui: Generating remote code +__ethz_systems_root_via_ssh/subasui: Transferring object +__ethz_systems_root_via_ssh/subasui: Checking code-local +__ethz_systems_root_via_ssh/subasui: Executing code-local +__ethz_systems_root_via_ssh/subasui: Checking code-remote +__ethz_systems_root_via_ssh/subasui: Executing code-remote +__ethz_systems_root_via_ssh/blukas: Generating local code +__ethz_systems_root_via_ssh/blukas: Generating remote code +__ethz_systems_root_via_ssh/blukas: Transferring object +__ethz_systems_root_via_ssh/blukas: Checking code-local +__ethz_systems_root_via_ssh/blukas: Executing code-local +__ethz_systems_root_via_ssh/blukas: Checking code-remote +__ethz_systems_root_via_ssh/blukas: Executing code-remote +__ethz_systems_root_via_ssh/petfisch: Generating local code +__ethz_systems_root_via_ssh/petfisch: Generating remote code +__ethz_systems_root_via_ssh/petfisch: Transferring object +__ethz_systems_root_via_ssh/petfisch: Checking code-local +__ethz_systems_root_via_ssh/petfisch: Executing code-local +__ethz_systems_root_via_ssh/petfisch: Checking code-remote +__ethz_systems_root_via_ssh/petfisch: Executing code-remote +__ethz_systems_motd/singleton: Generating local code +__ethz_systems_motd/singleton: Generating remote code +__ethz_systems_motd/singleton: Transferring object +__ethz_systems_motd/singleton: Checking code-local +__ethz_systems_motd/singleton: Executing code-local +__ethz_systems_motd/singleton: Checking code-remote +__ethz_systems_motd/singleton: Executing code-remote +__ethz_systems_sudo/singleton: Generating local code +__ethz_systems_sudo/singleton: Generating remote code +__ethz_systems_sudo/singleton: Transferring object +__ethz_systems_sudo/singleton: Checking code-local +__ethz_systems_sudo/singleton: Executing code-local +__ethz_systems_sudo/singleton: Checking code-remote +__ethz_systems_sudo/singleton: Executing code-remote +__ethz_sans_syslog/singleton: Generating local code +__ethz_sans_syslog/singleton: Generating remote code +__ethz_sans_syslog/singleton: Transferring object +__ethz_sans_syslog/singleton: Checking code-local +__ethz_sans_syslog/singleton: Executing code-local +__ethz_sans_syslog/singleton: Checking code-remote +__ethz_sans_syslog/singleton: Executing code-remote +__ethz_pam_krb5/singleton: Generating local code +__ethz_pam_krb5/singleton: Generating remote code +__ethz_pam_krb5/singleton: Transferring object +__ethz_pam_krb5/singleton: Checking code-local +__ethz_pam_krb5/singleton: Executing code-local +__ethz_pam_krb5/singleton: Checking code-remote +__ethz_pam_krb5/singleton: Executing code-remote +__ethz_dinfk_autofs/singleton: Generating local code +__ethz_dinfk_autofs/singleton: Generating remote code +__ethz_dinfk_autofs/singleton: Transferring object +__ethz_dinfk_autofs/singleton: Checking code-local +__ethz_dinfk_autofs/singleton: Executing code-local +__ethz_dinfk_autofs/singleton: Checking code-remote +__ethz_dinfk_autofs/singleton: Executing code-remote +__ethz_dinfk_ldap/singleton: Generating local code +__ethz_dinfk_ldap/singleton: Generating remote code +__ethz_dinfk_ldap/singleton: Transferring object +__ethz_dinfk_ldap/singleton: Checking code-local +__ethz_dinfk_ldap/singleton: Executing code-local +__ethz_dinfk_ldap/singleton: Checking code-remote +__ethz_dinfk_ldap/singleton: Executing code-remote +core: Debug: Mit Apr 27 14:19:30 CEST 2011 +core: Saving cache to /home/users/nico/oeffentlich/rechner/projekte/cdist-nutzung/cache/ikq04.ethz.ch +core: Debug: Mit Apr 27 14:19:31 CEST 2011 +core: cdist 1.6.2: Successfully finished run diff --git a/doc/dev/logs/2011-09-12.benchmark-home b/doc/dev/logs/2011-09-12.benchmark-home new file mode 100644 index 00000000..8cfc4971 --- /dev/null +++ b/doc/dev/logs/2011-09-12.benchmark-home @@ -0,0 +1,6960 @@ +INFO: Deploying to ikq02.ethz.ch +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq02.ethz.ch in 72.155556 seconds +I should cleanup /home/users/nico/.tmp/tmp013zxv +INFO: Total processing time for 1 hosts: 72.166661 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq03.ethz.ch in 76.556882 seconds +I should cleanup /home/users/nico/.tmp/tmpduad9n +INFO: Finished run of ikq02.ethz.ch in 76.617933 seconds +I should cleanup /home/users/nico/.tmp/tmpjqi6ey +INFO: Total processing time for 2 hosts: 76.633228 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq03.ethz.ch in 75.974003 seconds +I should cleanup /home/users/nico/.tmp/tmpg1dcf2 +INFO: Finished run of ikq04.ethz.ch in 76.961455 seconds +I should cleanup /home/users/nico/.tmp/tmp_bsndy +INFO: Finished run of ikq02.ethz.ch in 77.188361 seconds +I should cleanup /home/users/nico/.tmp/tmp9b0x11 +INFO: Total processing time for 3 host(s): 77.199817 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq04.ethz.ch in 75.857977 seconds +I should cleanup /home/users/nico/.tmp/tmpxhc33m +INFO: Finished run of ikq02.ethz.ch in 76.034966 seconds +I should cleanup /home/users/nico/.tmp/tmp0za5q0 +INFO: Finished run of ikq03.ethz.ch in 77.967854 seconds +I should cleanup /home/users/nico/.tmp/tmp_nt6ju +INFO: Finished run of ikq05.ethz.ch in 94.015012 seconds +I should cleanup /home/users/nico/.tmp/tmpihxpq1 +INFO: Total processing time for 4 host(s): 94.045175 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq03.ethz.ch in 84.249886 seconds +I should cleanup /home/users/nico/.tmp/tmp9pwps4 +INFO: Finished run of ikq04.ethz.ch in 84.70692 seconds +I should cleanup /home/users/nico/.tmp/tmp5q2_ov +INFO: Finished run of ikq06.ethz.ch in 84.831273 seconds +I should cleanup /home/users/nico/.tmp/tmpo5o5fi +INFO: Finished run of ikq02.ethz.ch in 85.648583 seconds +I should cleanup /home/users/nico/.tmp/tmp04au_u +INFO: Finished run of ikq05.ethz.ch in 103.18759 seconds +I should cleanup /home/users/nico/.tmp/tmpw5hgcq +INFO: Total processing time for 5 host(s): 103.226354 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq06.ethz.ch in 88.717419 seconds +I should cleanup /home/users/nico/.tmp/tmp463z4s +INFO: Finished run of ikq04.ethz.ch in 88.791926 seconds +I should cleanup /home/users/nico/.tmp/tmpbdipwj +INFO: Finished run of ikq02.ethz.ch in 89.046225 seconds +I should cleanup /home/users/nico/.tmp/tmpk832sn +INFO: Finished run of ikq03.ethz.ch in 89.067941 seconds +I should cleanup /home/users/nico/.tmp/tmpvmj5rq +INFO: Finished run of ikq07.ethz.ch in 89.412403 seconds +I should cleanup /home/users/nico/.tmp/tmpyljtcf +INFO: Finished run of ikq05.ethz.ch in 107.729915 seconds +I should cleanup /home/users/nico/.tmp/tmpmfc384 +INFO: Total processing time for 6 host(s): 107.76097 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq06.ethz.ch in 85.171819 seconds +I should cleanup /home/users/nico/.tmp/tmpjb2ow1 +INFO: Finished run of ikq02.ethz.ch in 85.507466 seconds +I should cleanup /home/users/nico/.tmp/tmpnql8_x +INFO: Finished run of ikq07.ethz.ch in 85.526465 seconds +I should cleanup /home/users/nico/.tmp/tmpl_34em +INFO: Finished run of ikq04.ethz.ch in 85.759357 seconds +I should cleanup /home/users/nico/.tmp/tmp807dx7 +INFO: Finished run of ikq03.ethz.ch in 85.897374 seconds +I should cleanup /home/users/nico/.tmp/tmpyjynp8 +INFO: Finished run of ikq05.ethz.ch in 101.540372 seconds +I should cleanup /home/users/nico/.tmp/tmpqgnkn1 +INFO: Total processing time for 7 host(s): 101.571705 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq07.ethz.ch in 88.958072 seconds +I should cleanup /home/users/nico/.tmp/tmpj824nd +INFO: Finished run of ikq04.ethz.ch in 89.290431 seconds +I should cleanup /home/users/nico/.tmp/tmpxi0eml +INFO: Finished run of ikq03.ethz.ch in 89.699189 seconds +I should cleanup /home/users/nico/.tmp/tmppx9o9p +INFO: Finished run of ikq06.ethz.ch in 89.807729 seconds +I should cleanup /home/users/nico/.tmp/tmpf3_ow_ +INFO: Finished run of ikq02.ethz.ch in 90.018545 seconds +I should cleanup /home/users/nico/.tmp/tmp6_ozkd +INFO: Finished run of ikr02.ethz.ch in 97.221764 seconds +I should cleanup /home/users/nico/.tmp/tmpsg71wy +INFO: Finished run of ikq05.ethz.ch in 107.564915 seconds +I should cleanup /home/users/nico/.tmp/tmp5zptvo +INFO: Total processing time for 8 host(s): 107.600093 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq02.ethz.ch in 97.849914 seconds +I should cleanup /home/users/nico/.tmp/tmp3nnh2u +INFO: Finished run of ikq07.ethz.ch in 97.975998 seconds +I should cleanup /home/users/nico/.tmp/tmpbb7tm2 +INFO: Finished run of ikq06.ethz.ch in 98.577879 seconds +I should cleanup /home/users/nico/.tmp/tmpz03p9m +INFO: Finished run of ikq03.ethz.ch in 98.676198 seconds +I should cleanup /home/users/nico/.tmp/tmpye5yk9 +INFO: Finished run of ikq04.ethz.ch in 98.671269 seconds +I should cleanup /home/users/nico/.tmp/tmphuyj_f +INFO: Finished run of ikr02.ethz.ch in 109.003609 seconds +I should cleanup /home/users/nico/.tmp/tmpwepj8y +INFO: Finished run of ikr03.ethz.ch in 109.930106 seconds +I should cleanup /home/users/nico/.tmp/tmp6kinml +INFO: Finished run of ikq05.ethz.ch in 116.455232 seconds +I should cleanup /home/users/nico/.tmp/tmpxrp5bs +INFO: Total processing time for 9 host(s): 116.500371 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq04.ethz.ch in 103.832242 seconds +I should cleanup /home/users/nico/.tmp/tmp9o5jfq +INFO: Finished run of ikq02.ethz.ch in 104.073833 seconds +I should cleanup /home/users/nico/.tmp/tmpip0crc +INFO: Finished run of ikq06.ethz.ch in 104.439403 seconds +I should cleanup /home/users/nico/.tmp/tmpcf69h4 +INFO: Finished run of ikq07.ethz.ch in 104.863176 seconds +I should cleanup /home/users/nico/.tmp/tmpg0cr4s +INFO: Finished run of ikq03.ethz.ch in 104.975989 seconds +I should cleanup /home/users/nico/.tmp/tmp086l_6 +INFO: Finished run of ikr05.ethz.ch in 112.545759 seconds +I should cleanup /home/users/nico/.tmp/tmpdtb7q2 +INFO: Finished run of ikr02.ethz.ch in 113.6572 seconds +I should cleanup /home/users/nico/.tmp/tmp8n7m4x +INFO: Finished run of ikr03.ethz.ch in 113.657078 seconds +I should cleanup /home/users/nico/.tmp/tmpcyi98d +INFO: Finished run of ikq05.ethz.ch in 119.403885 seconds +I should cleanup /home/users/nico/.tmp/tmpjow046 +INFO: Total processing time for 10 host(s): 119.445805 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq02.ethz.ch in 107.594849 seconds +I should cleanup /home/users/nico/.tmp/tmpam7130 +INFO: Finished run of ikq04.ethz.ch in 108.012557 seconds +I should cleanup /home/users/nico/.tmp/tmpksan74 +INFO: Finished run of ikq07.ethz.ch in 108.044124 seconds +I should cleanup /home/users/nico/.tmp/tmpbtfim0 +INFO: Finished run of ikq06.ethz.ch in 108.341489 seconds +I should cleanup /home/users/nico/.tmp/tmprweak0 +INFO: Finished run of ikq03.ethz.ch in 108.389863 seconds +I should cleanup /home/users/nico/.tmp/tmp0vl1nl +INFO: Finished run of ikr05.ethz.ch in 118.315184 seconds +I should cleanup /home/users/nico/.tmp/tmpcnj64y +INFO: Finished run of ikr07.ethz.ch in 119.454786 seconds +I should cleanup /home/users/nico/.tmp/tmp5f6dcf +INFO: Finished run of ikr02.ethz.ch in 119.734442 seconds +I should cleanup /home/users/nico/.tmp/tmpgx6lga +INFO: Finished run of ikr03.ethz.ch in 119.813266 seconds +I should cleanup /home/users/nico/.tmp/tmpza8ftn +INFO: Finished run of ikq05.ethz.ch in 123.912563 seconds +I should cleanup /home/users/nico/.tmp/tmpokg3bw +INFO: Total processing time for 11 host(s): 123.944385 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq06.ethz.ch in 112.532755 seconds +I should cleanup /home/users/nico/.tmp/tmpkwi6o4 +INFO: Finished run of ikq03.ethz.ch in 113.655432 seconds +I should cleanup /home/users/nico/.tmp/tmpheiprp +INFO: Finished run of ikq02.ethz.ch in 114.308282 seconds +I should cleanup /home/users/nico/.tmp/tmp1krz1m +INFO: Finished run of ikq07.ethz.ch in 114.580586 seconds +I should cleanup /home/users/nico/.tmp/tmpg23sal +INFO: Finished run of ikq04.ethz.ch in 114.981261 seconds +I should cleanup /home/users/nico/.tmp/tmplged7b +INFO: Finished run of ikr05.ethz.ch in 124.918792 seconds +I should cleanup /home/users/nico/.tmp/tmpsijvc9 +INFO: Finished run of ikr02.ethz.ch in 125.388647 seconds +I should cleanup /home/users/nico/.tmp/tmpw1e4ji +INFO: Finished run of ikr07.ethz.ch in 125.691531 seconds +I should cleanup /home/users/nico/.tmp/tmpx_9iz6 +INFO: Finished run of ikr03.ethz.ch in 126.951817 seconds +I should cleanup /home/users/nico/.tmp/tmpuikakt +INFO: Finished run of ikr09.ethz.ch in 126.947601 seconds +I should cleanup /home/users/nico/.tmp/tmpoyxlah +INFO: Finished run of ikq05.ethz.ch in 130.467261 seconds +I should cleanup /home/users/nico/.tmp/tmpobh15j +INFO: Total processing time for 12 host(s): 130.499098 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq02.ethz.ch in 121.864821 seconds +I should cleanup /home/users/nico/.tmp/tmpfgqxt5 +INFO: Finished run of ikq04.ethz.ch in 121.929722 seconds +I should cleanup /home/users/nico/.tmp/tmps2c8x0 +INFO: Finished run of ikq03.ethz.ch in 122.486316 seconds +I should cleanup /home/users/nico/.tmp/tmpnmea2b +INFO: Finished run of ikq06.ethz.ch in 123.168465 seconds +I should cleanup /home/users/nico/.tmp/tmp_5ns1o +INFO: Finished run of ikq07.ethz.ch in 123.623172 seconds +I should cleanup /home/users/nico/.tmp/tmp86yazu +INFO: Finished run of ikr05.ethz.ch in 131.530627 seconds +I should cleanup /home/users/nico/.tmp/tmp_wjz4q +INFO: Finished run of ikr10.ethz.ch in 132.29461 seconds +I should cleanup /home/users/nico/.tmp/tmpd9b7e6 +INFO: Finished run of ikr02.ethz.ch in 132.860874 seconds +I should cleanup /home/users/nico/.tmp/tmp5ruwiq +INFO: Finished run of ikr07.ethz.ch in 133.120448 seconds +I should cleanup /home/users/nico/.tmp/tmpdg8gnz +INFO: Finished run of ikr09.ethz.ch in 133.144026 seconds +I should cleanup /home/users/nico/.tmp/tmpdqnwj8 +INFO: Finished run of ikr03.ethz.ch in 133.569501 seconds +I should cleanup /home/users/nico/.tmp/tmp0ib7vd +INFO: Finished run of ikq05.ethz.ch in 137.219204 seconds +I should cleanup /home/users/nico/.tmp/tmpjnp_34 +INFO: Total processing time for 13 host(s): 137.250861 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq04.ethz.ch in 137.290435 seconds +I should cleanup /home/users/nico/.tmp/tmp3qrvii +INFO: Finished run of ikq06.ethz.ch in 137.430914 seconds +I should cleanup /home/users/nico/.tmp/tmpbut7j0 +INFO: Finished run of ikq02.ethz.ch in 137.888909 seconds +I should cleanup /home/users/nico/.tmp/tmp4vyy9p +INFO: Finished run of ikq03.ethz.ch in 138.237095 seconds +I should cleanup /home/users/nico/.tmp/tmpfj1yim +INFO: Finished run of ikq07.ethz.ch in 138.392173 seconds +I should cleanup /home/users/nico/.tmp/tmpfw3bx4 +INFO: Finished run of ikr05.ethz.ch in 150.274366 seconds +I should cleanup /home/users/nico/.tmp/tmpyn7rh1 +INFO: Finished run of ikr10.ethz.ch in 150.478504 seconds +I should cleanup /home/users/nico/.tmp/tmpn50v6l +INFO: Finished run of ikr07.ethz.ch in 150.514287 seconds +I should cleanup /home/users/nico/.tmp/tmp_mvlp2 +INFO: Finished run of ikr09.ethz.ch in 151.015286 seconds +I should cleanup /home/users/nico/.tmp/tmpm549_r +INFO: Finished run of ikr03.ethz.ch in 151.541814 seconds +I should cleanup /home/users/nico/.tmp/tmpynae4z +INFO: Finished run of ikr11.ethz.ch in 151.624163 seconds +I should cleanup /home/users/nico/.tmp/tmpyerp4y +INFO: Finished run of ikr02.ethz.ch in 151.81055 seconds +I should cleanup /home/users/nico/.tmp/tmp1t9rdc +INFO: Finished run of ikq05.ethz.ch in 154.945986 seconds +I should cleanup /home/users/nico/.tmp/tmpwxljjr +INFO: Total processing time for 14 host(s): 154.9841 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +Warning: Permanently added 'ikr13.ethz.ch,129.132.186.26' (RSA) to the list of known hosts. +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq03.ethz.ch in 120.523743 seconds +I should cleanup /home/users/nico/.tmp/tmp0_7fgv +INFO: Finished run of ikq02.ethz.ch in 121.060225 seconds +I should cleanup /home/users/nico/.tmp/tmpjxa6qw +INFO: Finished run of ikq04.ethz.ch in 121.754777 seconds +I should cleanup /home/users/nico/.tmp/tmpvnzs7k +INFO: Finished run of ikq07.ethz.ch in 121.782193 seconds +I should cleanup /home/users/nico/.tmp/tmp1o26v7 +INFO: Finished run of ikq06.ethz.ch in 122.575204 seconds +I should cleanup /home/users/nico/.tmp/tmp592kot +INFO: Finished run of ikr10.ethz.ch in 131.920153 seconds +I should cleanup /home/users/nico/.tmp/tmp_iwf_6 +INFO: Finished run of ikr05.ethz.ch in 132.153554 seconds +I should cleanup /home/users/nico/.tmp/tmpbk7wid +INFO: Finished run of ikr02.ethz.ch in 132.330635 seconds +I should cleanup /home/users/nico/.tmp/tmp9n2a4e +INFO: Finished run of ikr09.ethz.ch in 132.486383 seconds +I should cleanup /home/users/nico/.tmp/tmp__xwmz +INFO: Finished run of ikr07.ethz.ch in 136.013244 seconds +I should cleanup /home/users/nico/.tmp/tmp2gdyhj +INFO: Finished run of ikr11.ethz.ch in 136.471268 seconds +I should cleanup /home/users/nico/.tmp/tmphgxzio +INFO: Finished run of ikr03.ethz.ch in 136.565002 seconds +I should cleanup /home/users/nico/.tmp/tmpsdws1m +INFO: Finished run of ikq05.ethz.ch in 139.613692 seconds +I should cleanup /home/users/nico/.tmp/tmpp0lh4k +INFO: Total processing time for 15 host(s): 139.659637 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq06.ethz.ch in 123.802602 seconds +I should cleanup /home/users/nico/.tmp/tmpoag3uo +INFO: Finished run of ikq04.ethz.ch in 125.244272 seconds +I should cleanup /home/users/nico/.tmp/tmpzc8p8r +INFO: Finished run of ikq07.ethz.ch in 126.049417 seconds +I should cleanup /home/users/nico/.tmp/tmpg0wjs1 +INFO: Finished run of ikq02.ethz.ch in 126.635092 seconds +I should cleanup /home/users/nico/.tmp/tmpnhuefm +INFO: Finished run of ikq03.ethz.ch in 126.683252 seconds +I should cleanup /home/users/nico/.tmp/tmp569klp +INFO: Finished run of ikr10.ethz.ch in 135.902786 seconds +I should cleanup /home/users/nico/.tmp/tmp_pepbg +INFO: Finished run of ikr05.ethz.ch in 137.519519 seconds +I should cleanup /home/users/nico/.tmp/tmpog_4d2 +INFO: Finished run of ikr14.ethz.ch in 137.486553 seconds +I should cleanup /home/users/nico/.tmp/tmp35z1n7 +INFO: Finished run of ikr09.ethz.ch in 139.393357 seconds +I should cleanup /home/users/nico/.tmp/tmpa3d3le +INFO: Finished run of ikr11.ethz.ch in 139.367952 seconds +I should cleanup /home/users/nico/.tmp/tmpdyzpgw +INFO: Finished run of ikr03.ethz.ch in 139.772987 seconds +I should cleanup /home/users/nico/.tmp/tmprxzbm6 +INFO: Finished run of ikr02.ethz.ch in 139.962957 seconds +I should cleanup /home/users/nico/.tmp/tmpyrnk23 +INFO: Finished run of ikr07.ethz.ch in 140.554612 seconds +I should cleanup /home/users/nico/.tmp/tmpob7r8v +INFO: Finished run of ikq05.ethz.ch in 142.669111 seconds +I should cleanup /home/users/nico/.tmp/tmp8qcpjv +INFO: Total processing time for 16 host(s): 142.70005 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq03.ethz.ch in 132.945203 seconds +I should cleanup /home/users/nico/.tmp/tmpzot_mg +INFO: Finished run of ikq07.ethz.ch in 132.982484 seconds +I should cleanup /home/users/nico/.tmp/tmpgsp6q2 +INFO: Finished run of ikq02.ethz.ch in 133.229802 seconds +I should cleanup /home/users/nico/.tmp/tmpd4zxn8 +INFO: Finished run of ikq04.ethz.ch in 133.299541 seconds +I should cleanup /home/users/nico/.tmp/tmp4zq45z +INFO: Finished run of ikq06.ethz.ch in 133.802036 seconds +I should cleanup /home/users/nico/.tmp/tmpzwrs5v +INFO: Finished run of ikr14.ethz.ch in 145.03485 seconds +I should cleanup /home/users/nico/.tmp/tmpbqcwz0 +INFO: Finished run of ikr02.ethz.ch in 145.416967 seconds +I should cleanup /home/users/nico/.tmp/tmp1lse41 +INFO: Finished run of ikr10.ethz.ch in 145.693574 seconds +I should cleanup /home/users/nico/.tmp/tmpur3wfv +INFO: Finished run of ikr07.ethz.ch in 145.978708 seconds +I should cleanup /home/users/nico/.tmp/tmpr0an2_ +INFO: Finished run of ikr05.ethz.ch in 146.286686 seconds +I should cleanup /home/users/nico/.tmp/tmpl29did +INFO: Finished run of ikr09.ethz.ch in 146.501529 seconds +I should cleanup /home/users/nico/.tmp/tmpydoin6 +INFO: Finished run of ikr15.ethz.ch in 147.016223 seconds +I should cleanup /home/users/nico/.tmp/tmpbcp5p8 +INFO: Finished run of ikr03.ethz.ch in 147.12484 seconds +I should cleanup /home/users/nico/.tmp/tmpuowz74 +INFO: Finished run of ikr11.ethz.ch in 147.286151 seconds +I should cleanup /home/users/nico/.tmp/tmph25hy8 +INFO: Finished run of ikq05.ethz.ch in 148.506819 seconds +I should cleanup /home/users/nico/.tmp/tmp7brn95 +INFO: Total processing time for 17 host(s): 148.541452 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr16.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq04.ethz.ch in 143.675686 seconds +I should cleanup /home/users/nico/.tmp/tmp82nal9 +INFO: Finished run of ikq06.ethz.ch in 144.765412 seconds +I should cleanup /home/users/nico/.tmp/tmppxbr5e +INFO: Finished run of ikq07.ethz.ch in 144.895368 seconds +I should cleanup /home/users/nico/.tmp/tmp2waolo +INFO: Finished run of ikq03.ethz.ch in 145.051027 seconds +I should cleanup /home/users/nico/.tmp/tmp4984jk +INFO: Finished run of ikq02.ethz.ch in 145.822406 seconds +I should cleanup /home/users/nico/.tmp/tmpaz8a8n +INFO: Finished run of ikr14.ethz.ch in 154.113672 seconds +I should cleanup /home/users/nico/.tmp/tmpxy2kg4 +INFO: Finished run of ikr10.ethz.ch in 156.984583 seconds +I should cleanup /home/users/nico/.tmp/tmp6ppd8k +INFO: Finished run of ikr02.ethz.ch in 157.091568 seconds +I should cleanup /home/users/nico/.tmp/tmpxxou_a +INFO: Finished run of ikr07.ethz.ch in 157.520308 seconds +I should cleanup /home/users/nico/.tmp/tmpow0v1c +INFO: Finished run of ikr09.ethz.ch in 157.634227 seconds +I should cleanup /home/users/nico/.tmp/tmpi3gg17 +INFO: Finished run of ikr03.ethz.ch in 157.85916 seconds +I should cleanup /home/users/nico/.tmp/tmp3aybb1 +INFO: Finished run of ikr05.ethz.ch in 157.896262 seconds +I should cleanup /home/users/nico/.tmp/tmphqwu6l +INFO: Finished run of ikr16.ethz.ch in 158.078375 seconds +I should cleanup /home/users/nico/.tmp/tmptkh_yn +INFO: Finished run of ikr11.ethz.ch in 158.379867 seconds +I should cleanup /home/users/nico/.tmp/tmp1mdfoi +INFO: Finished run of ikr15.ethz.ch in 158.426851 seconds +I should cleanup /home/users/nico/.tmp/tmp4lcx43 +INFO: Finished run of ikq05.ethz.ch in 159.319045 seconds +I should cleanup /home/users/nico/.tmp/tmp2f_gug +INFO: Total processing time for 18 host(s): 159.360809 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr17.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq07.ethz.ch in 151.304278 seconds +I should cleanup /home/users/nico/.tmp/tmpqkb2pc +INFO: Finished run of ikq06.ethz.ch in 156.467966 seconds +I should cleanup /home/users/nico/.tmp/tmp35zxo7 +INFO: Finished run of ikq04.ethz.ch in 157.188747 seconds +I should cleanup /home/users/nico/.tmp/tmpvb0nxt +INFO: Finished run of ikq03.ethz.ch in 157.955866 seconds +I should cleanup /home/users/nico/.tmp/tmp4k7jgo +INFO: Finished run of ikq02.ethz.ch in 158.316461 seconds +I should cleanup /home/users/nico/.tmp/tmpeddhr1 +INFO: Finished run of ikr10.ethz.ch in 167.801774 seconds +I should cleanup /home/users/nico/.tmp/tmpn_7hlf +INFO: Finished run of ikr14.ethz.ch in 167.906681 seconds +I should cleanup /home/users/nico/.tmp/tmpdemdfp +INFO: Finished run of ikr02.ethz.ch in 169.536628 seconds +I should cleanup /home/users/nico/.tmp/tmpcaeatj +INFO: Finished run of ikr17.ethz.ch in 169.68007 seconds +I should cleanup /home/users/nico/.tmp/tmpzz1gwu +INFO: Finished run of ikr05.ethz.ch in 170.014506 seconds +I should cleanup /home/users/nico/.tmp/tmpksj9is +INFO: Finished run of ikr15.ethz.ch in 170.512682 seconds +I should cleanup /home/users/nico/.tmp/tmpdb72hk +INFO: Finished run of ikr09.ethz.ch in 170.696373 seconds +I should cleanup /home/users/nico/.tmp/tmpe3dz9b +INFO: Finished run of ikr07.ethz.ch in 170.923977 seconds +I should cleanup /home/users/nico/.tmp/tmpuvt1ke +INFO: Finished run of ikr11.ethz.ch in 170.89362 seconds +I should cleanup /home/users/nico/.tmp/tmpuk0_7g +INFO: Finished run of ikr03.ethz.ch in 171.598123 seconds +I should cleanup /home/users/nico/.tmp/tmp4i12vh +INFO: Finished run of ikr16.ethz.ch in 171.502924 seconds +I should cleanup /home/users/nico/.tmp/tmp55ix1x +INFO: Finished run of ikq05.ethz.ch in 171.874543 seconds +I should cleanup /home/users/nico/.tmp/tmp417ofh +INFO: Total processing time for 19 host(s): 171.907864 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr17.ethz.ch +INFO: Deploying to ikr19.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq02.ethz.ch in 157.829713 seconds +I should cleanup /home/users/nico/.tmp/tmpqf9wcb +INFO: Finished run of ikq04.ethz.ch in 161.470424 seconds +I should cleanup /home/users/nico/.tmp/tmpaxrqmo +INFO: Finished run of ikq06.ethz.ch in 163.020342 seconds +I should cleanup /home/users/nico/.tmp/tmpt5dwxt +INFO: Finished run of ikq03.ethz.ch in 164.391855 seconds +I should cleanup /home/users/nico/.tmp/tmpd_5zb6 +INFO: Finished run of ikq07.ethz.ch in 165.180659 seconds +I should cleanup /home/users/nico/.tmp/tmp97ikmr +INFO: Finished run of ikr14.ethz.ch in 173.059971 seconds +I should cleanup /home/users/nico/.tmp/tmpefe37g +INFO: Finished run of ikr07.ethz.ch in 173.134127 seconds +I should cleanup /home/users/nico/.tmp/tmp7vam9i +INFO: Finished run of ikr05.ethz.ch in 174.793465 seconds +I should cleanup /home/users/nico/.tmp/tmplu772y +INFO: Finished run of ikr19.ethz.ch in 175.448245 seconds +I should cleanup /home/users/nico/.tmp/tmpkrzksf +INFO: Finished run of ikr02.ethz.ch in 175.624194 seconds +I should cleanup /home/users/nico/.tmp/tmpln5e7p +INFO: Finished run of ikr10.ethz.ch in 177.161247 seconds +I should cleanup /home/users/nico/.tmp/tmp04oa95 +INFO: Finished run of ikr17.ethz.ch in 177.641062 seconds +I should cleanup /home/users/nico/.tmp/tmpuke4jq +INFO: Finished run of ikr03.ethz.ch in 177.805503 seconds +I should cleanup /home/users/nico/.tmp/tmp9m6kgk +INFO: Finished run of ikr09.ethz.ch in 178.068981 seconds +I should cleanup /home/users/nico/.tmp/tmpwsvt18 +INFO: Finished run of ikr11.ethz.ch in 178.26438 seconds +I should cleanup /home/users/nico/.tmp/tmpvsc9oz +INFO: Finished run of ikr15.ethz.ch in 178.416205 seconds +I should cleanup /home/users/nico/.tmp/tmpmzzacs +INFO: Finished run of ikr16.ethz.ch in 178.473477 seconds +I should cleanup /home/users/nico/.tmp/tmplh_80t +INFO: Finished run of ikq05.ethz.ch in 178.735551 seconds +I should cleanup /home/users/nico/.tmp/tmpslnq9v +INFO: Total processing time for 20 host(s): 178.76695 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr17.ethz.ch +INFO: Deploying to ikr19.ethz.ch +INFO: Deploying to ikr20.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq02.ethz.ch in 170.169321 seconds +I should cleanup /home/users/nico/.tmp/tmpdgynh9 +INFO: Finished run of ikq06.ethz.ch in 171.461174 seconds +I should cleanup /home/users/nico/.tmp/tmpwxtd79 +INFO: Finished run of ikq03.ethz.ch in 171.626668 seconds +I should cleanup /home/users/nico/.tmp/tmpiqc3ji +INFO: Finished run of ikq04.ethz.ch in 171.724653 seconds +I should cleanup /home/users/nico/.tmp/tmpdt2og0 +INFO: Finished run of ikq07.ethz.ch in 171.78001 seconds +I should cleanup /home/users/nico/.tmp/tmpl4krs7 +INFO: Finished run of ikr10.ethz.ch in 177.048099 seconds +I should cleanup /home/users/nico/.tmp/tmpne6_s_ +INFO: Finished run of ikr17.ethz.ch in 180.562186 seconds +I should cleanup /home/users/nico/.tmp/tmpl199q5 +INFO: Finished run of ikr19.ethz.ch in 181.223109 seconds +I should cleanup /home/users/nico/.tmp/tmpoky1qz +INFO: Finished run of ikr11.ethz.ch in 182.462812 seconds +I should cleanup /home/users/nico/.tmp/tmp2xfmtx +INFO: Finished run of ikr14.ethz.ch in 182.498966 seconds +I should cleanup /home/users/nico/.tmp/tmpbaa_1v +INFO: Finished run of ikr20.ethz.ch in 182.598193 seconds +I should cleanup /home/users/nico/.tmp/tmp0goxf_ +INFO: Finished run of ikr03.ethz.ch in 183.01005 seconds +I should cleanup /home/users/nico/.tmp/tmpa7d_j6 +INFO: Finished run of ikr15.ethz.ch in 182.994708 seconds +I should cleanup /home/users/nico/.tmp/tmphvktgk +INFO: Finished run of ikr07.ethz.ch in 183.413644 seconds +I should cleanup /home/users/nico/.tmp/tmpxfe884 +INFO: Finished run of ikr02.ethz.ch in 183.470895 seconds +I should cleanup /home/users/nico/.tmp/tmphd7ynb +INFO: Finished run of ikr05.ethz.ch in 183.46156 seconds +I should cleanup /home/users/nico/.tmp/tmpfniywk +INFO: Finished run of ikr16.ethz.ch in 183.371318 seconds +I should cleanup /home/users/nico/.tmp/tmpqsd782 +INFO: Finished run of ikr09.ethz.ch in 183.467264 seconds +I should cleanup /home/users/nico/.tmp/tmph84dh1 +INFO: Finished run of ikq05.ethz.ch in 183.813915 seconds +I should cleanup /home/users/nico/.tmp/tmp_w3anv +INFO: Total processing time for 21 host(s): 183.856671 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr17.ethz.ch +INFO: Deploying to ikr19.ethz.ch +INFO: Deploying to ikr20.ethz.ch +INFO: Deploying to ikr21.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq06.ethz.ch in 169.955614 seconds +I should cleanup /home/users/nico/.tmp/tmplmg5_y +INFO: Finished run of ikq02.ethz.ch in 170.411064 seconds +I should cleanup /home/users/nico/.tmp/tmpwr3ygp +INFO: Finished run of ikq07.ethz.ch in 173.554952 seconds +I should cleanup /home/users/nico/.tmp/tmpso42zx +INFO: Finished run of ikq04.ethz.ch in 173.63845 seconds +I should cleanup /home/users/nico/.tmp/tmpsqgh9o +INFO: Finished run of ikq03.ethz.ch in 173.951844 seconds +I should cleanup /home/users/nico/.tmp/tmp8fjghd +INFO: Finished run of ikr20.ethz.ch in 185.922176 seconds +I should cleanup /home/users/nico/.tmp/tmpt3rtcq +INFO: Finished run of ikr07.ethz.ch in 191.153275 seconds +I should cleanup /home/users/nico/.tmp/tmpr39dmz +INFO: Finished run of ikr10.ethz.ch in 191.982504 seconds +I should cleanup /home/users/nico/.tmp/tmpz_ear7 +INFO: Finished run of ikr14.ethz.ch in 192.653998 seconds +I should cleanup /home/users/nico/.tmp/tmp7wvfhq +INFO: Finished run of ikr17.ethz.ch in 192.652562 seconds +I should cleanup /home/users/nico/.tmp/tmp51k0hh +INFO: Finished run of ikr19.ethz.ch in 192.814789 seconds +I should cleanup /home/users/nico/.tmp/tmp760hc3 +INFO: Finished run of ikr05.ethz.ch in 193.44574 seconds +I should cleanup /home/users/nico/.tmp/tmp73204x +INFO: Finished run of ikr09.ethz.ch in 193.537 seconds +I should cleanup /home/users/nico/.tmp/tmpf4z4q5 +INFO: Finished run of ikr16.ethz.ch in 193.584303 seconds +I should cleanup /home/users/nico/.tmp/tmp12jwnj +INFO: Finished run of ikr11.ethz.ch in 193.668931 seconds +I should cleanup /home/users/nico/.tmp/tmptudl3_ +INFO: Finished run of ikr02.ethz.ch in 193.800381 seconds +I should cleanup /home/users/nico/.tmp/tmpf588if +INFO: Finished run of ikr15.ethz.ch in 193.754252 seconds +I should cleanup /home/users/nico/.tmp/tmpp71hsb +INFO: Finished run of ikr03.ethz.ch in 193.866005 seconds +I should cleanup /home/users/nico/.tmp/tmppevhzu +INFO: Finished run of ikr21.ethz.ch in 193.84791 seconds +I should cleanup /home/users/nico/.tmp/tmpe0umjh +INFO: Finished run of ikq05.ethz.ch in 194.471906 seconds +I should cleanup /home/users/nico/.tmp/tmp6y2zuq +INFO: Total processing time for 22 host(s): 194.504221 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr17.ethz.ch +INFO: Deploying to ikr19.ethz.ch +INFO: Deploying to ikr20.ethz.ch +INFO: Deploying to ikr21.ethz.ch +INFO: Deploying to ikr23.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq06.ethz.ch in 183.331036 seconds +I should cleanup /home/users/nico/.tmp/tmp3zzf35 +INFO: Finished run of ikq04.ethz.ch in 188.245634 seconds +I should cleanup /home/users/nico/.tmp/tmppsfm7g +INFO: Finished run of ikq07.ethz.ch in 189.097252 seconds +I should cleanup /home/users/nico/.tmp/tmpckmmbr +INFO: Finished run of ikq02.ethz.ch in 189.168067 seconds +I should cleanup /home/users/nico/.tmp/tmp_wbxqv +INFO: Finished run of ikq03.ethz.ch in 191.178122 seconds +I should cleanup /home/users/nico/.tmp/tmp4xyb0h +INFO: Finished run of ikr17.ethz.ch in 200.405666 seconds +I should cleanup /home/users/nico/.tmp/tmpwl3901 +INFO: Finished run of ikr20.ethz.ch in 201.125398 seconds +I should cleanup /home/users/nico/.tmp/tmpt4gwst +INFO: Finished run of ikr05.ethz.ch in 204.457668 seconds +I should cleanup /home/users/nico/.tmp/tmpquc21r +INFO: Finished run of ikr19.ethz.ch in 204.61935 seconds +I should cleanup /home/users/nico/.tmp/tmpth2imd +INFO: Finished run of ikr03.ethz.ch in 205.782259 seconds +I should cleanup /home/users/nico/.tmp/tmp5qgmy3 +INFO: Finished run of ikr02.ethz.ch in 206.089122 seconds +I should cleanup /home/users/nico/.tmp/tmp_0yydj +INFO: Finished run of ikr10.ethz.ch in 206.344087 seconds +I should cleanup /home/users/nico/.tmp/tmprppnti +INFO: Finished run of ikr14.ethz.ch in 206.487929 seconds +I should cleanup /home/users/nico/.tmp/tmpg1sm5o +INFO: Finished run of ikr07.ethz.ch in 206.592221 seconds +I should cleanup /home/users/nico/.tmp/tmpz8h8u7 +INFO: Finished run of ikr21.ethz.ch in 206.574162 seconds +I should cleanup /home/users/nico/.tmp/tmp29bf91 +INFO: Finished run of ikr09.ethz.ch in 206.757285 seconds +I should cleanup /home/users/nico/.tmp/tmpkfk0tl +INFO: Finished run of ikr16.ethz.ch in 206.751199 seconds +I should cleanup /home/users/nico/.tmp/tmpjxql2a +INFO: Finished run of ikr15.ethz.ch in 206.951335 seconds +I should cleanup /home/users/nico/.tmp/tmpslol4l +INFO: Finished run of ikq05.ethz.ch in 207.10716 seconds +I should cleanup /home/users/nico/.tmp/tmpryt7ok +INFO: Finished run of ikr23.ethz.ch in 207.047179 seconds +I should cleanup /home/users/nico/.tmp/tmph8jagj +INFO: Finished run of ikr11.ethz.ch in 207.16906 seconds +I should cleanup /home/users/nico/.tmp/tmpl2hbm8 +INFO: Total processing time for 23 host(s): 207.314842 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr19.ethz.ch +INFO: Deploying to ikr17.ethz.ch +INFO: Deploying to ikr20.ethz.ch +INFO: Deploying to ikr21.ethz.ch +INFO: Deploying to ikr23.ethz.ch +INFO: Deploying to ikr24.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq07.ethz.ch in 187.618723 seconds +I should cleanup /home/users/nico/.tmp/tmpyoqguq +INFO: Finished run of ikq03.ethz.ch in 187.750961 seconds +I should cleanup /home/users/nico/.tmp/tmpjwp515 +INFO: Finished run of ikq02.ethz.ch in 196.709864 seconds +I should cleanup /home/users/nico/.tmp/tmpm221lr +INFO: Finished run of ikq06.ethz.ch in 197.81424 seconds +I should cleanup /home/users/nico/.tmp/tmpkyt260 +INFO: Finished run of ikq04.ethz.ch in 198.512346 seconds +I should cleanup /home/users/nico/.tmp/tmpkwgaqh +INFO: Finished run of ikr14.ethz.ch in 208.879349 seconds +I should cleanup /home/users/nico/.tmp/tmpnshneg +INFO: Finished run of ikr19.ethz.ch in 211.066451 seconds +I should cleanup /home/users/nico/.tmp/tmpc0tm26 +INFO: Finished run of ikr20.ethz.ch in 212.537745 seconds +I should cleanup /home/users/nico/.tmp/tmpw16xze +INFO: Finished run of ikr03.ethz.ch in 213.771479 seconds +I should cleanup /home/users/nico/.tmp/tmpa4pj9v +INFO: Finished run of ikr10.ethz.ch in 214.089014 seconds +I should cleanup /home/users/nico/.tmp/tmpbbmh5z +INFO: Finished run of ikr15.ethz.ch in 214.168849 seconds +I should cleanup /home/users/nico/.tmp/tmp_hj_82 +INFO: Finished run of ikr17.ethz.ch in 214.377309 seconds +I should cleanup /home/users/nico/.tmp/tmpvltd85 +INFO: Finished run of ikr21.ethz.ch in 214.424358 seconds +I should cleanup /home/users/nico/.tmp/tmp9fv334 +INFO: Finished run of ikr07.ethz.ch in 214.840774 seconds +I should cleanup /home/users/nico/.tmp/tmpqm165u +INFO: Finished run of ikr05.ethz.ch in 214.906573 seconds +I should cleanup /home/users/nico/.tmp/tmpsjzrd3 +INFO: Finished run of ikr02.ethz.ch in 214.947938 seconds +I should cleanup /home/users/nico/.tmp/tmpdomosr +INFO: Finished run of ikr09.ethz.ch in 214.892808 seconds +I should cleanup /home/users/nico/.tmp/tmpwv5fb2 +INFO: Finished run of ikr11.ethz.ch in 215.352163 seconds +I should cleanup /home/users/nico/.tmp/tmp0_c8kz +INFO: Finished run of ikq05.ethz.ch in 215.460435 seconds +I should cleanup /home/users/nico/.tmp/tmpypqk55 +INFO: Finished run of ikr16.ethz.ch in 215.318416 seconds +I should cleanup /home/users/nico/.tmp/tmpypq7ta +INFO: Finished run of ikr24.ethz.ch in 215.365107 seconds +I should cleanup /home/users/nico/.tmp/tmpri18dz +INFO: Finished run of ikr23.ethz.ch in 215.594156 seconds +I should cleanup /home/users/nico/.tmp/tmpglm4ku +INFO: Total processing time for 24 host(s): 215.846502 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr19.ethz.ch +INFO: Deploying to ikr17.ethz.ch +INFO: Deploying to ikr20.ethz.ch +INFO: Deploying to ikr21.ethz.ch +INFO: Deploying to ikr23.ethz.ch +INFO: Deploying to ikr24.ethz.ch +INFO: Deploying to ikr25.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq07.ethz.ch in 188.442055 seconds +I should cleanup /home/users/nico/.tmp/tmprcj8hv +INFO: Finished run of ikq04.ethz.ch in 188.602631 seconds +I should cleanup /home/users/nico/.tmp/tmpe6svdv +INFO: Finished run of ikq02.ethz.ch in 191.545683 seconds +I should cleanup /home/users/nico/.tmp/tmpw7tyqo +INFO: Finished run of ikq06.ethz.ch in 191.972664 seconds +I should cleanup /home/users/nico/.tmp/tmpc3xcoh +INFO: Finished run of ikq03.ethz.ch in 200.27211 seconds +I should cleanup /home/users/nico/.tmp/tmpej_9wz +INFO: Finished run of ikr17.ethz.ch in 211.689402 seconds +I should cleanup /home/users/nico/.tmp/tmpab2j3n +INFO: Finished run of ikr20.ethz.ch in 213.782377 seconds +I should cleanup /home/users/nico/.tmp/tmpeb5m8a +INFO: Finished run of ikr25.ethz.ch in 214.437128 seconds +I should cleanup /home/users/nico/.tmp/tmpltec25 +INFO: Finished run of ikr10.ethz.ch in 214.723128 seconds +I should cleanup /home/users/nico/.tmp/tmpn3tnws +INFO: Finished run of ikr19.ethz.ch in 214.907271 seconds +I should cleanup /home/users/nico/.tmp/tmpimo16x +INFO: Finished run of ikr14.ethz.ch in 215.026046 seconds +I should cleanup /home/users/nico/.tmp/tmpf6wp_u +INFO: Finished run of ikr05.ethz.ch in 215.731064 seconds +I should cleanup /home/users/nico/.tmp/tmp_67b2k +INFO: Finished run of ikr24.ethz.ch in 215.736746 seconds +I should cleanup /home/users/nico/.tmp/tmpsj8gpp +INFO: Finished run of ikr11.ethz.ch in 216.207536 seconds +I should cleanup /home/users/nico/.tmp/tmpsvg8rs +INFO: Finished run of ikr09.ethz.ch in 216.40167 seconds +I should cleanup /home/users/nico/.tmp/tmpr76lo2 +INFO: Finished run of ikr02.ethz.ch in 216.476902 seconds +I should cleanup /home/users/nico/.tmp/tmpoa5woy +INFO: Finished run of ikr03.ethz.ch in 216.760169 seconds +I should cleanup /home/users/nico/.tmp/tmpoos_8z +INFO: Finished run of ikr23.ethz.ch in 216.673695 seconds +I should cleanup /home/users/nico/.tmp/tmphffunh +INFO: Finished run of ikr15.ethz.ch in 216.889297 seconds +I should cleanup /home/users/nico/.tmp/tmpaesns3 +INFO: Finished run of ikr07.ethz.ch in 217.052298 seconds +I should cleanup /home/users/nico/.tmp/tmpn87am6 +INFO: Finished run of ikr21.ethz.ch in 216.951911 seconds +I should cleanup /home/users/nico/.tmp/tmps2kfri +INFO: Finished run of ikr16.ethz.ch in 217.021147 seconds +I should cleanup /home/users/nico/.tmp/tmpfyxjsx +INFO: Finished run of ikq05.ethz.ch in 217.191655 seconds +I should cleanup /home/users/nico/.tmp/tmpx5i4km +INFO: Total processing time for 25 host(s): 217.223581 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr17.ethz.ch +INFO: Deploying to ikr19.ethz.ch +INFO: Deploying to ikr20.ethz.ch +INFO: Deploying to ikr21.ethz.ch +INFO: Deploying to ikr23.ethz.ch +INFO: Deploying to ikr24.ethz.ch +INFO: Deploying to ikr25.ethz.ch +INFO: Deploying to ikr26.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq06.ethz.ch in 209.543172 seconds +I should cleanup /home/users/nico/.tmp/tmpb51g1n +INFO: Finished run of ikq03.ethz.ch in 210.337092 seconds +I should cleanup /home/users/nico/.tmp/tmpce1qe3 +INFO: Finished run of ikq02.ethz.ch in 210.760602 seconds +I should cleanup /home/users/nico/.tmp/tmpfnduir +INFO: Finished run of ikq07.ethz.ch in 211.315784 seconds +I should cleanup /home/users/nico/.tmp/tmpq3tw15 +INFO: Finished run of ikq04.ethz.ch in 213.717476 seconds +I should cleanup /home/users/nico/.tmp/tmp9b4_69 +INFO: Finished run of ikr03.ethz.ch in 233.40723 seconds +I should cleanup /home/users/nico/.tmp/tmpk_n0av +INFO: Finished run of ikr10.ethz.ch in 233.780751 seconds +I should cleanup /home/users/nico/.tmp/tmp91phvb +INFO: Finished run of ikr07.ethz.ch in 234.993885 seconds +I should cleanup /home/users/nico/.tmp/tmpexumzi +INFO: Finished run of ikr14.ethz.ch in 236.126748 seconds +I should cleanup /home/users/nico/.tmp/tmpyjxqk5 +INFO: Finished run of ikr05.ethz.ch in 236.907114 seconds +I should cleanup /home/users/nico/.tmp/tmp2mfxb9 +INFO: Finished run of ikr19.ethz.ch in 236.805215 seconds +I should cleanup /home/users/nico/.tmp/tmpmlyizv +INFO: Finished run of ikr20.ethz.ch in 237.000427 seconds +I should cleanup /home/users/nico/.tmp/tmpwy_utm +INFO: Finished run of ikr25.ethz.ch in 237.06996 seconds +I should cleanup /home/users/nico/.tmp/tmpgqrsfd +INFO: Finished run of ikr11.ethz.ch in 237.62119 seconds +I should cleanup /home/users/nico/.tmp/tmpwd0a1c +INFO: Finished run of ikr26.ethz.ch in 237.554682 seconds +I should cleanup /home/users/nico/.tmp/tmp7wsaqu +INFO: Finished run of ikr17.ethz.ch in 237.715835 seconds +I should cleanup /home/users/nico/.tmp/tmparrgy1 +INFO: Finished run of ikr15.ethz.ch in 237.961549 seconds +I should cleanup /home/users/nico/.tmp/tmpt74239 +INFO: Finished run of ikq05.ethz.ch in 238.126596 seconds +I should cleanup /home/users/nico/.tmp/tmpvfigmw +INFO: Finished run of ikr02.ethz.ch in 238.134702 seconds +I should cleanup /home/users/nico/.tmp/tmpb7v16x +INFO: Finished run of ikr16.ethz.ch in 238.099716 seconds +I should cleanup /home/users/nico/.tmp/tmpb0x56o +INFO: Finished run of ikr09.ethz.ch in 238.20569 seconds +I should cleanup /home/users/nico/.tmp/tmpl5qoyz +INFO: Finished run of ikr24.ethz.ch in 238.230154 seconds +I should cleanup /home/users/nico/.tmp/tmp93hwbz +INFO: Finished run of ikr21.ethz.ch in 238.300384 seconds +I should cleanup /home/users/nico/.tmp/tmp619s6n +INFO: Finished run of ikr23.ethz.ch in 238.322157 seconds +I should cleanup /home/users/nico/.tmp/tmpvb2kh5 +INFO: Total processing time for 26 host(s): 238.591705 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr17.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr19.ethz.ch +INFO: Deploying to ikr20.ethz.ch +INFO: Deploying to ikr21.ethz.ch +INFO: Deploying to ikr23.ethz.ch +INFO: Deploying to ikr24.ethz.ch +INFO: Deploying to ikr25.ethz.ch +INFO: Deploying to ikr26.ethz.ch +INFO: Deploying to ikr27.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq03.ethz.ch in 215.332411 seconds +I should cleanup /home/users/nico/.tmp/tmpjvsfb6 +INFO: Finished run of ikq02.ethz.ch in 217.196822 seconds +I should cleanup /home/users/nico/.tmp/tmptbx4cl +INFO: Finished run of ikq06.ethz.ch in 217.198258 seconds +I should cleanup /home/users/nico/.tmp/tmpm7ducc +INFO: Finished run of ikq07.ethz.ch in 220.168978 seconds +I should cleanup /home/users/nico/.tmp/tmpzum8_c +INFO: Finished run of ikq04.ethz.ch in 220.311359 seconds +I should cleanup /home/users/nico/.tmp/tmpf8oh_z +E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. +ERROR: Command failed: ssh root@ikr27.ethz.ch /var/lib/cdist/object/__package_apt/collectd/.cdist/code-remote +INFO: Finished run of ikr25.ethz.ch in 231.729276 seconds +I should cleanup /home/users/nico/.tmp/tmpkw4l8y +INFO: Finished run of ikr14.ethz.ch in 235.616386 seconds +I should cleanup /home/users/nico/.tmp/tmpierma3 +INFO: Finished run of ikr26.ethz.ch in 235.793067 seconds +I should cleanup /home/users/nico/.tmp/tmpf9hmfe +INFO: Finished run of ikr02.ethz.ch in 236.019716 seconds +I should cleanup /home/users/nico/.tmp/tmpd1x7cn +INFO: Finished run of ikr17.ethz.ch in 236.038355 seconds +I should cleanup /home/users/nico/.tmp/tmpwla840 +INFO: Finished run of ikr19.ethz.ch in 236.343239 seconds +I should cleanup /home/users/nico/.tmp/tmp16gann +INFO: Finished run of ikr20.ethz.ch in 236.550018 seconds +I should cleanup /home/users/nico/.tmp/tmpmfhiu3 +INFO: Finished run of ikr09.ethz.ch in 236.68465 seconds +I should cleanup /home/users/nico/.tmp/tmpm_jeke +INFO: Finished run of ikr07.ethz.ch in 237.023632 seconds +I should cleanup /home/users/nico/.tmp/tmpwpb50n +INFO: Finished run of ikr10.ethz.ch in 237.252747 seconds +I should cleanup /home/users/nico/.tmp/tmps57avh +INFO: Finished run of ikr05.ethz.ch in 237.343652 seconds +I should cleanup /home/users/nico/.tmp/tmpcz9apl +INFO: Finished run of ikq05.ethz.ch in 237.564124 seconds +I should cleanup /home/users/nico/.tmp/tmpgo8u_q +INFO: Finished run of ikr03.ethz.ch in 237.561235 seconds +I should cleanup /home/users/nico/.tmp/tmp37xbfa +INFO: Finished run of ikr16.ethz.ch in 237.55441 seconds +I should cleanup /home/users/nico/.tmp/tmp_y6cb0 +INFO: Finished run of ikr23.ethz.ch in 237.589377 seconds +I should cleanup /home/users/nico/.tmp/tmpmswsnx +INFO: Finished run of ikr11.ethz.ch in 237.791683 seconds +I should cleanup /home/users/nico/.tmp/tmprlbap0 +INFO: Finished run of ikr24.ethz.ch in 237.819221 seconds +I should cleanup /home/users/nico/.tmp/tmpjywrgt +INFO: Finished run of ikr15.ethz.ch in 238.148722 seconds +I should cleanup /home/users/nico/.tmp/tmpdefzkg +INFO: Finished run of ikr21.ethz.ch in 238.227193 seconds +I should cleanup /home/users/nico/.tmp/tmppsg0pc +INFO: Total processing time for 27 host(s): 238.478493 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr17.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr19.ethz.ch +INFO: Deploying to ikr20.ethz.ch +INFO: Deploying to ikr21.ethz.ch +INFO: Deploying to ikr23.ethz.ch +INFO: Deploying to ikr24.ethz.ch +INFO: Deploying to ikr25.ethz.ch +INFO: Deploying to ikr26.ethz.ch +INFO: Deploying to ikr27.ethz.ch +INFO: Deploying to ikr28.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +ERROR: Command failed: ssh root@ikr17.ethz.ch mkdir -p /var/lib/cdist/conf/type/__package_apt +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq04.ethz.ch in 215.567874 seconds +I should cleanup /home/users/nico/.tmp/tmp99c8j5 +INFO: Finished run of ikq06.ethz.ch in 219.752235 seconds +I should cleanup /home/users/nico/.tmp/tmpb1628u +INFO: Finished run of ikq07.ethz.ch in 221.491529 seconds +I should cleanup /home/users/nico/.tmp/tmpjr3i7w +INFO: Finished run of ikq02.ethz.ch in 222.054742 seconds +I should cleanup /home/users/nico/.tmp/tmpia1edb +INFO: Finished run of ikq03.ethz.ch in 229.509667 seconds +I should cleanup /home/users/nico/.tmp/tmpvdfr2q +INFO: Finished run of ikq05.ethz.ch in 231.337049 seconds +I should cleanup /home/users/nico/.tmp/tmpwz_8tv +E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. +ERROR: Command failed: ssh root@ikr27.ethz.ch /var/lib/cdist/object/__package_apt/collectd/.cdist/code-remote +INFO: Finished run of ikr20.ethz.ch in 239.14496 seconds +I should cleanup /home/users/nico/.tmp/tmpx63vlh +INFO: Finished run of ikr02.ethz.ch in 241.402815 seconds +I should cleanup /home/users/nico/.tmp/tmp_bmfp_ +INFO: Finished run of ikr25.ethz.ch in 241.948038 seconds +I should cleanup /home/users/nico/.tmp/tmpohdpq5 +INFO: Finished run of ikr05.ethz.ch in 243.861596 seconds +I should cleanup /home/users/nico/.tmp/tmpr_vxd_ +INFO: Finished run of ikr19.ethz.ch in 244.322837 seconds +I should cleanup /home/users/nico/.tmp/tmpripuph +INFO: Finished run of ikr10.ethz.ch in 244.439443 seconds +I should cleanup /home/users/nico/.tmp/tmp8wacqr +INFO: Finished run of ikr14.ethz.ch in 244.572394 seconds +I should cleanup /home/users/nico/.tmp/tmpuw2ppx +INFO: Finished run of ikr26.ethz.ch in 244.781803 seconds +I should cleanup /home/users/nico/.tmp/tmpt_4vqo +INFO: Finished run of ikr23.ethz.ch in 244.916033 seconds +I should cleanup /home/users/nico/.tmp/tmp9lgge8 +INFO: Finished run of ikr03.ethz.ch in 245.12315 seconds +I should cleanup /home/users/nico/.tmp/tmpb072wd +INFO: Finished run of ikr16.ethz.ch in 245.353491 seconds +I should cleanup /home/users/nico/.tmp/tmpsq8pj3 +INFO: Finished run of ikr11.ethz.ch in 245.445685 seconds +I should cleanup /home/users/nico/.tmp/tmpsomf09 +INFO: Finished run of ikr07.ethz.ch in 245.47506 seconds +I should cleanup /home/users/nico/.tmp/tmppu7tq2 +INFO: Finished run of ikr09.ethz.ch in 245.576609 seconds +I should cleanup /home/users/nico/.tmp/tmpoliguo +INFO: Finished run of ikr15.ethz.ch in 245.57091 seconds +I should cleanup /home/users/nico/.tmp/tmpic_4ln +INFO: Finished run of ikr28.ethz.ch in 245.673558 seconds +I should cleanup /home/users/nico/.tmp/tmpceanz0 +INFO: Finished run of ikr21.ethz.ch in 245.785506 seconds +I should cleanup /home/users/nico/.tmp/tmphd9b_a +INFO: Finished run of ikr24.ethz.ch in 245.762761 seconds +I should cleanup /home/users/nico/.tmp/tmp6q4lt_ +INFO: Total processing time for 28 host(s): 246.058718 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr17.ethz.ch +INFO: Deploying to ikr19.ethz.ch +INFO: Deploying to ikr20.ethz.ch +INFO: Deploying to ikr21.ethz.ch +INFO: Deploying to ikr23.ethz.ch +INFO: Deploying to ikr24.ethz.ch +INFO: Deploying to ikr25.ethz.ch +INFO: Deploying to ikr26.ethz.ch +INFO: Deploying to ikr27.ethz.ch +INFO: Deploying to ikr28.ethz.ch +INFO: Deploying to ikr29.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq06.ethz.ch in 235.403198 seconds +I should cleanup /home/users/nico/.tmp/tmplh0yub +INFO: Finished run of ikq03.ethz.ch in 237.3758 seconds +I should cleanup /home/users/nico/.tmp/tmpnwzceq +INFO: Finished run of ikq07.ethz.ch in 238.054173 seconds +I should cleanup /home/users/nico/.tmp/tmpezdl2v +INFO: Finished run of ikq02.ethz.ch in 240.123134 seconds +I should cleanup /home/users/nico/.tmp/tmph4zyv1 +INFO: Finished run of ikq04.ethz.ch in 240.240325 seconds +I should cleanup /home/users/nico/.tmp/tmp1hgnqr +INFO: Finished run of ikr07.ethz.ch in 255.212756 seconds +I should cleanup /home/users/nico/.tmp/tmpu4etp8 +E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. +ERROR: Command failed: ssh root@ikr27.ethz.ch /var/lib/cdist/object/__package_apt/collectd/.cdist/code-remote +INFO: Finished run of ikr20.ethz.ch in 257.655047 seconds +I should cleanup /home/users/nico/.tmp/tmpraen0m +INFO: Finished run of ikr26.ethz.ch in 260.095529 seconds +I should cleanup /home/users/nico/.tmp/tmptw0mi2 +INFO: Finished run of ikq05.ethz.ch in 260.533335 seconds +I should cleanup /home/users/nico/.tmp/tmp8d93a8 +INFO: Finished run of ikr14.ethz.ch in 262.082391 seconds +I should cleanup /home/users/nico/.tmp/tmpcq9jn8 +INFO: Finished run of ikr09.ethz.ch in 262.202072 seconds +I should cleanup /home/users/nico/.tmp/tmpdvdnr6 +INFO: Finished run of ikr11.ethz.ch in 262.398554 seconds +I should cleanup /home/users/nico/.tmp/tmp78uy18 +INFO: Finished run of ikr17.ethz.ch in 262.513191 seconds +I should cleanup /home/users/nico/.tmp/tmpr97wjm +INFO: Finished run of ikr25.ethz.ch in 262.614397 seconds +I should cleanup /home/users/nico/.tmp/tmpjc9obd +INFO: Finished run of ikr02.ethz.ch in 263.127853 seconds +I should cleanup /home/users/nico/.tmp/tmpvkl1m9 +INFO: Finished run of ikr05.ethz.ch in 263.338641 seconds +I should cleanup /home/users/nico/.tmp/tmplyywfq +INFO: Finished run of ikr21.ethz.ch in 263.232372 seconds +I should cleanup /home/users/nico/.tmp/tmpatqdlm +INFO: Finished run of ikr15.ethz.ch in 263.457294 seconds +I should cleanup /home/users/nico/.tmp/tmprddqa0 +INFO: Finished run of ikr19.ethz.ch in 263.424671 seconds +I should cleanup /home/users/nico/.tmp/tmpq1ap51 +INFO: Finished run of ikr03.ethz.ch in 263.622373 seconds +I should cleanup /home/users/nico/.tmp/tmp_7rzac +INFO: Finished run of ikr16.ethz.ch in 263.564308 seconds +INFO: Finished run of ikr10.ethz.ch in 263.634145 seconds +I should cleanup /home/users/nico/.tmp/tmpspg21e +I should cleanup /home/users/nico/.tmp/tmpb1swlv +INFO: Finished run of ikr28.ethz.ch in 263.507415 seconds +I should cleanup /home/users/nico/.tmp/tmp54z8g_ +INFO: Finished run of ikr29.ethz.ch in 263.598878 seconds +I should cleanup /home/users/nico/.tmp/tmp2kr9cs +INFO: Finished run of ikr23.ethz.ch in 263.668785 seconds +I should cleanup /home/users/nico/.tmp/tmpxb7jsn +INFO: Finished run of ikr24.ethz.ch in 263.903858 seconds +I should cleanup /home/users/nico/.tmp/tmplikdv8 +INFO: Total processing time for 29 host(s): 264.208372 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr19.ethz.ch +INFO: Deploying to ikr17.ethz.ch +INFO: Deploying to ikr20.ethz.ch +INFO: Deploying to ikr21.ethz.ch +INFO: Deploying to ikr24.ethz.ch +INFO: Deploying to ikr23.ethz.ch +INFO: Deploying to ikr25.ethz.ch +INFO: Deploying to ikr26.ethz.ch +INFO: Deploying to ikr27.ethz.ch +INFO: Deploying to ikr28.ethz.ch +INFO: Deploying to ikr29.ethz.ch +INFO: Deploying to ikr30.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq03.ethz.ch in 229.360922 seconds +I should cleanup /home/users/nico/.tmp/tmplykkga +INFO: Finished run of ikq02.ethz.ch in 231.154059 seconds +I should cleanup /home/users/nico/.tmp/tmppmmhz3 +INFO: Finished run of ikq04.ethz.ch in 233.577996 seconds +I should cleanup /home/users/nico/.tmp/tmppdxzl3 +INFO: Finished run of ikq07.ethz.ch in 237.22933 seconds +I should cleanup /home/users/nico/.tmp/tmpiomb4i +INFO: Finished run of ikq06.ethz.ch in 239.725816 seconds +I should cleanup /home/users/nico/.tmp/tmpqj3pl6 +E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. +ERROR: Command failed: ssh root@ikr27.ethz.ch /var/lib/cdist/object/__package_apt/collectd/.cdist/code-remote +INFO: Finished run of ikr20.ethz.ch in 258.466225 seconds +I should cleanup /home/users/nico/.tmp/tmpve9wdi +INFO: Finished run of ikr14.ethz.ch in 259.177486 seconds +I should cleanup /home/users/nico/.tmp/tmp_d36bl +INFO: Finished run of ikr17.ethz.ch in 260.754277 seconds +I should cleanup /home/users/nico/.tmp/tmpv5frqn +INFO: Finished run of ikr11.ethz.ch in 261.107312 seconds +I should cleanup /home/users/nico/.tmp/tmp5oacup +INFO: Finished run of ikr05.ethz.ch in 261.154726 seconds +I should cleanup /home/users/nico/.tmp/tmpghnptx +INFO: Finished run of ikq05.ethz.ch in 262.048584 seconds +I should cleanup /home/users/nico/.tmp/tmpugqfjj +INFO: Finished run of ikr25.ethz.ch in 262.233978 seconds +I should cleanup /home/users/nico/.tmp/tmppf3xu8 +INFO: Finished run of ikr10.ethz.ch in 262.713893 seconds +I should cleanup /home/users/nico/.tmp/tmpu2nkra +INFO: Finished run of ikr19.ethz.ch in 263.068704 seconds +I should cleanup /home/users/nico/.tmp/tmpi_jrg4 +INFO: Finished run of ikr02.ethz.ch in 264.085429 seconds +I should cleanup /home/users/nico/.tmp/tmpu6hfym +INFO: Finished run of ikr03.ethz.ch in 264.10239 seconds +I should cleanup /home/users/nico/.tmp/tmpzj0tpo +INFO: Finished run of ikr09.ethz.ch in 264.294349 seconds +I should cleanup /home/users/nico/.tmp/tmpkeo6qa +INFO: Finished run of ikr26.ethz.ch in 264.343501 seconds +I should cleanup /home/users/nico/.tmp/tmpofeovc +INFO: Finished run of ikr15.ethz.ch in 264.650148 seconds +I should cleanup /home/users/nico/.tmp/tmp2tooi_ +INFO: Finished run of ikr24.ethz.ch in 264.585275 seconds +I should cleanup /home/users/nico/.tmp/tmpk0vvl3 +INFO: Finished run of ikr07.ethz.ch in 264.743286 seconds +I should cleanup /home/users/nico/.tmp/tmp9lk9_m +INFO: Finished run of ikr30.ethz.ch in 264.505029 seconds +I should cleanup /home/users/nico/.tmp/tmpygy8g0 +INFO: Finished run of ikr23.ethz.ch in 264.681778 seconds +I should cleanup /home/users/nico/.tmp/tmpgd7nqn +INFO: Finished run of ikr29.ethz.ch in 264.590897 seconds +I should cleanup /home/users/nico/.tmp/tmp7m95p2 +INFO: Finished run of ikr16.ethz.ch in 264.863193 seconds +I should cleanup /home/users/nico/.tmp/tmpzqsbdu +INFO: Finished run of ikr21.ethz.ch in 264.933458 seconds +I should cleanup /home/users/nico/.tmp/tmphlqu6i +INFO: Finished run of ikr28.ethz.ch in 265.162021 seconds +I should cleanup /home/users/nico/.tmp/tmplpjyze +INFO: Total processing time for 30 host(s): 265.560685 +INFO: Deploying to ikq02.ethz.ch +INFO: Deploying to ikq03.ethz.ch +INFO: Deploying to ikq04.ethz.ch +INFO: Deploying to ikq05.ethz.ch +INFO: Deploying to ikq07.ethz.ch +INFO: Deploying to ikq06.ethz.ch +INFO: Deploying to ikr01.ethz.ch +INFO: Deploying to ikr02.ethz.ch +INFO: Deploying to ikr03.ethz.ch +INFO: Deploying to ikr05.ethz.ch +INFO: Deploying to ikr07.ethz.ch +INFO: Deploying to ikr09.ethz.ch +INFO: Deploying to ikr10.ethz.ch +INFO: Deploying to ikr11.ethz.ch +INFO: Deploying to ikr13.ethz.ch +INFO: Deploying to ikr14.ethz.ch +INFO: Deploying to ikr15.ethz.ch +INFO: Deploying to ikr16.ethz.ch +INFO: Deploying to ikr17.ethz.ch +INFO: Deploying to ikr19.ethz.ch +INFO: Deploying to ikr20.ethz.ch +INFO: Deploying to ikr21.ethz.ch +INFO: Deploying to ikr23.ethz.ch +INFO: Deploying to ikr24.ethz.ch +INFO: Deploying to ikr25.ethz.ch +INFO: Deploying to ikr27.ethz.ch +INFO: Deploying to ikr26.ethz.ch +INFO: Deploying to ikr28.ethz.ch +INFO: Deploying to ikr29.ethz.ch +INFO: Deploying to ikr30.ethz.ch +INFO: Deploying to ikr31.ethz.ch +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr01.ethz.ch:/var/lib/cdist/conf/explorer +scp: /var/lib/cdist/conf/explorer: No such file or directory +ERROR: Command failed: scp -qr /home/users/nico/p/cdist-nutzung/conf/explorer root@ikr13.ethz.ch:/var/lib/cdist/conf/explorer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/collectd/collectd.conf: Recording requirement __package/collectd +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/nullmailer/remotes: Recording requirement __package/nullmailer +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto.pub: Recording requirement __directory/etc/ethz/autofs +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/openntpd/ntpd.conf: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/default/openntpd_rc_config: Recording requirement __package/openntpd +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/sudoers.d/systems: Recording requirement __package/sudo +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/syslog-ng/syslog-ng.conf: Recording requirement __package/syslog-ng +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __directory/etc/ethz/autofs +__file/etc/ethz/autofs/auto_home: Recording requirement __package/python-ldap +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/auto.master: Recording requirement __package/autofs +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __package/libnss-ldapd +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +__file/etc/nsswitch.conf: Recording requirement __file//etc/nslcd.conf +INFO: Finished run of ikq03.ethz.ch in 245.694879 seconds +I should cleanup /home/users/nico/.tmp/tmp0aaihh +INFO: Finished run of ikq07.ethz.ch in 248.839127 seconds +I should cleanup /home/users/nico/.tmp/tmp4tv23i +INFO: Finished run of ikq04.ethz.ch in 250.96365 seconds +I should cleanup /home/users/nico/.tmp/tmp9oaog8 +INFO: Finished run of ikq02.ethz.ch in 251.910723 seconds +I should cleanup /home/users/nico/.tmp/tmpcy7p6n +INFO: Finished run of ikq06.ethz.ch in 252.163352 seconds +I should cleanup /home/users/nico/.tmp/tmp74it6k +E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. +ERROR: Command failed: ssh root@ikr27.ethz.ch /var/lib/cdist/object/__package_apt/collectd/.cdist/code-remote +E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. +ERROR: Command failed: ssh root@ikr31.ethz.ch /var/lib/cdist/object/__package_apt/collectd/.cdist/code-remote +INFO: Finished run of ikr05.ethz.ch in 277.210317 seconds +I should cleanup /home/users/nico/.tmp/tmp34x6v6 +INFO: Finished run of ikr10.ethz.ch in 277.482534 seconds +I should cleanup /home/users/nico/.tmp/tmprellu1 +INFO: Finished run of ikr14.ethz.ch in 279.009467 seconds +I should cleanup /home/users/nico/.tmp/tmpxxp654 +INFO: Finished run of ikr20.ethz.ch in 279.292188 seconds +I should cleanup /home/users/nico/.tmp/tmpw5ck4p +INFO: Finished run of ikr21.ethz.ch in 279.423259 seconds +I should cleanup /home/users/nico/.tmp/tmpe94eay +INFO: Finished run of ikr25.ethz.ch in 279.533419 seconds +I should cleanup /home/users/nico/.tmp/tmpbdgd2g +INFO: Finished run of ikq05.ethz.ch in 279.9565 seconds +I should cleanup /home/users/nico/.tmp/tmp5opdkg +INFO: Finished run of ikr07.ethz.ch in 280.496576 seconds +I should cleanup /home/users/nico/.tmp/tmpmqujdo +INFO: Finished run of ikr26.ethz.ch in 280.333344 seconds +I should cleanup /home/users/nico/.tmp/tmp63f8d8 +INFO: Finished run of ikr29.ethz.ch in 280.291517 seconds +I should cleanup /home/users/nico/.tmp/tmpnqfqpz +INFO: Finished run of ikr15.ethz.ch in 281.228734 seconds +I should cleanup /home/users/nico/.tmp/tmp42p3g5 +INFO: Finished run of ikr17.ethz.ch in 281.222566 seconds +I should cleanup /home/users/nico/.tmp/tmpn97co2 +INFO: Finished run of ikr19.ethz.ch in 281.258219 seconds +I should cleanup /home/users/nico/.tmp/tmpdc5pcf +INFO: Finished run of ikr30.ethz.ch in 281.333785 seconds +I should cleanup /home/users/nico/.tmp/tmp8t0k25 +INFO: Finished run of ikr11.ethz.ch in 281.610303 seconds +I should cleanup /home/users/nico/.tmp/tmph9g41k +INFO: Finished run of ikr28.ethz.ch in 281.513334 seconds +I should cleanup /home/users/nico/.tmp/tmpj44fq4 +INFO: Finished run of ikr02.ethz.ch in 281.870902 seconds +I should cleanup /home/users/nico/.tmp/tmprmqa8b +INFO: Finished run of ikr24.ethz.ch in 281.668327 seconds +I should cleanup /home/users/nico/.tmp/tmpcglj4f +INFO: Finished run of ikr03.ethz.ch in 282.150378 seconds +INFO: Finished run of ikr16.ethz.ch in 282.022936 seconds +I should cleanup /home/users/nico/.tmp/tmpa5nbnv +I should cleanup /home/users/nico/.tmp/tmpkpwd2x +INFO: Finished run of ikr23.ethz.ch in 281.993304 seconds +I should cleanup /home/users/nico/.tmp/tmpw0ts8q +INFO: Finished run of ikr09.ethz.ch in 282.136105 seconds +I should cleanup /home/users/nico/.tmp/tmp882egu +INFO: Total processing time for 31 host(s): 282.264488 From 525fb7aa312f905a21970a42d8bc9916cf74613b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 14:42:06 +0200 Subject: [PATCH 0781/1024] +links of existing articles on slashdot without publishing Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-04-20.slashdot-articles | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 doc/dev/logs/2011-04-20.slashdot-articles diff --git a/doc/dev/logs/2011-04-20.slashdot-articles b/doc/dev/logs/2011-04-20.slashdot-articles new file mode 100644 index 00000000..24b3baf0 --- /dev/null +++ b/doc/dev/logs/2011-04-20.slashdot-articles @@ -0,0 +1,2 @@ +http://slashdot.org/submission/1533922/cdist-162---usable-configuration-management +http://slashdot.org/submission/1522134/Cdist-Configuration-management-that-makes-fun# From e715dbb8017de2401a85c105abe2a701cc00eaa6 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 15:50:10 +0200 Subject: [PATCH 0782/1024] update test: dont return command output by default Signed-off-by: Steven Armstrong --- lib/cdist/test/exec/local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/test/exec/local.py b/lib/cdist/test/exec/local.py index 8585f87a..f19bf55c 100644 --- a/lib/cdist/test/exec/local.py +++ b/lib/cdist/test/exec/local.py @@ -114,7 +114,7 @@ class LocalTestCase(unittest.TestCase): fd = open(script, "w") fd.writelines(["#!/bin/sh\n", "echo foobar"]) fd.close() - self.assertEqual(self.local.run_script(script), "foobar\n") + self.assertEqual(self.local.run_script(script, return_output=True), "foobar\n") def test_mkdir(self): temp_dir = self.mkdtemp(dir=self.temp_dir) From ab1d3d16f16c94e42174ccdcedd791c69bb970c8 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 15:51:00 +0200 Subject: [PATCH 0783/1024] implement: dont return command output by default Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index bef44e21..56c29cb7 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -87,7 +87,7 @@ class Local(object): # FIXME: dont set mode here, fix unittest mkdtemp instead os.makedirs(path, mode=0o700, exist_ok=True) - def run(self, command, env=None): + def run(self, command, env=None, return_output=False): """Run the given command with the given environment. Return the output as a string. @@ -95,13 +95,16 @@ class Local(object): assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command self.log.debug("Local run: %s", command) try: - return subprocess.check_output(command, env=env).decode() + if return_output: + return subprocess.check_output(command, env=env).decode() + else: + subprocess.check_call(command, env=env) except subprocess.CalledProcessError: raise cdist.Error("Command failed: " + " ".join(command)) except OSError as error: raise cdist.Error(" ".join(*args) + ": " + error.args[1]) - def run_script(self, script, env=None): + def run_script(self, script, env=None, return_output=False): """Run the given script with the given environment. Return the output as a string. @@ -114,7 +117,10 @@ class Local(object): self.log.debug("Local run script env: %s", env) try: - return subprocess.check_output(command, env=env).decode() + if return_output: + return subprocess.check_output(command, env=env).decode() + else: + subprocess.check_call(command, env=env) except subprocess.CalledProcessError as error: script_content = self.run(["cat", script]) self.log.error("Code that raised the error:\n%s", script_content) From 86cb65cd9ce81ba24ccfc420c7e80d6a3a6aefec Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 15:51:40 +0200 Subject: [PATCH 0784/1024] update test: dont return command output by default Signed-off-by: Steven Armstrong --- lib/cdist/test/exec/remote.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/test/exec/remote.py b/lib/cdist/test/exec/remote.py index ea9a17aa..f5151156 100644 --- a/lib/cdist/test/exec/remote.py +++ b/lib/cdist/test/exec/remote.py @@ -92,7 +92,7 @@ class RemoteTestCase(unittest.TestCase): fd = open(script, "w") fd.writelines(["#!/bin/sh\n", "echo foobar"]) fd.close() - self.assertEqual(self.remote.run_script(script), "foobar\n") + self.assertEqual(self.remote.run_script(script, return_output=True), "foobar\n") def test_mkdir(self): temp_dir = self.mkdtemp(dir=self.temp_dir) From 829b0b2d0b3faa10366d2c8fcd95b01f01093b74 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 15:52:16 +0200 Subject: [PATCH 0785/1024] implement: dont return command output by default Signed-off-by: Steven Armstrong --- lib/cdist/exec/remote.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index 2ffc73fd..2de16426 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -85,7 +85,7 @@ class Remote(object): command.extend(["-r", source, self.target_host + ":" + destination]) self.run_command(command) - def run(self, command, env=None): + def run(self, command, env=None, return_output=False): """Run the given command with the given environment on the remote side. Return the output as a string. @@ -94,9 +94,9 @@ class Remote(object): cmd = self._exec.split() cmd.append(self.target_host) cmd.extend(command) - return self.run_command(cmd, env=env) + return self.run_command(cmd, env=env, return_output=return_output) - def run_command(self, command, env=None): + def run_command(self, command, env=None, return_output=False): """Run the given command with the given environment. Return the output as a string. @@ -113,13 +113,16 @@ class Remote(object): self.log.debug("Remote run: %s", command) try: - return subprocess.check_output(cmd).decode() + if return_output: + return subprocess.check_output(command, env=env).decode() + else: + subprocess.check_call(command, env=env) except subprocess.CalledProcessError: raise cdist.Error("Command failed: " + " ".join(command)) except OSError as error: raise cdist.Error(" ".join(*args) + ": " + error.args[1]) - def run_script(self, script, env=None): + def run_script(self, script, env=None, return_output=False): """Run the given script with the given environment on the remote side. Return the output as a string. @@ -140,7 +143,10 @@ class Remote(object): self.log.debug("Remote run script env: %s", env) try: - return subprocess.check_output(command).decode() + if return_output: + return subprocess.check_output(command, env=env).decode() + else: + subprocess.check_call(command, env=env) except subprocess.CalledProcessError as error: script_content = self.run(["cat", script]) self.log.error("Code that raised the error:\n%s", script_content) From 1e622f91280c57174db8eabfc00cbf0d61737404 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 15:52:53 +0200 Subject: [PATCH 0786/1024] raise IllegalRequirementError if requirements object_id starts with a / Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index f37c3169..0b303b23 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -28,6 +28,16 @@ from cdist import core log = logging.getLogger(__name__) + +class IllegalRequirementError(cdist.Error): + def __init__(self, requirement, message=None): + self.requirement = requirement + self.message = message or 'Illegal requirement' + + def __str__(self): + return '%s: %s' % (self.message, self.requirement) + + def run(argv): """Emulate type commands (i.e. __file and co)""" global_path = os.environ['__global'] @@ -116,7 +126,7 @@ def run(argv): # no object id, must be singleton requirement_object_id = 'singleton' if requirement_object_id.startswith('/'): - raise core.IllegalObjectIdError(requirement_object_id, requirement_type_name, 'object_id may not start with /') + raise IllegalRequirementError(requirement, 'requirements object_id may not start with /') log.debug("Recording requirement: %s -> %s" % (cdist_object.path, requirement)) cdist_object.requirements.append(requirement) From 63ad8825127cfa75f0ae74c25cf5538b596aab93 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 15:58:42 +0200 Subject: [PATCH 0787/1024] update test: run_code* should no longer return output Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index 0d7aec75..f661ad24 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -105,33 +105,11 @@ class CodeTestCase(unittest.TestCase): destination = os.path.join(self.remote.object_path, self.cdist_object.code_remote_path) self.assertTrue(os.path.isfile(destination)) - def test_run_code_local_environment(self): + def test_run_code_local(self): self.cdist_object.code_local = self.code.run_gencode_local(self.cdist_object) - output_string = self.code.run_code_local(self.cdist_object) - output_dict = {} - for line in output_string.split('\n'): - if line: - key,value = line.split(': ') - output_dict[key] = value - self.assertEqual(output_dict['__target_host'], self.local.target_host) - self.assertEqual(output_dict['__global'], self.local.out_path) - self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path) - self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) - self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) - self.assertEqual(output_dict['__object_fq'], self.cdist_object.path) + self.code.run_code_local(self.cdist_object) def test_run_code_remote_environment(self): self.cdist_object.code_remote = self.code.run_gencode_remote(self.cdist_object) self.code.transfer_code_remote(self.cdist_object) - output_string = self.code.run_code_remote(self.cdist_object) - output_dict = {} - for line in output_string.split('\n'): - if line: - key,value = line.split(': ') - output_dict[key] = value - self.assertEqual(output_dict['__target_host'], self.local.target_host) - self.assertEqual(output_dict['__global'], self.local.out_path) - self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path) - self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) - self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) - self.assertEqual(output_dict['__object_fq'], self.cdist_object.path) + self.code.run_code_remote(self.cdist_object) From c9bb10551820c4b2f8017ea290791d500d34716a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 15:59:58 +0200 Subject: [PATCH 0788/1024] run_code* no longer returns output Signed-off-by: Steven Armstrong --- lib/cdist/core/code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index af756263..e81f7954 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -104,7 +104,7 @@ class Code(object): '__object_id': cdist_object.object_id, '__object_fq': cdist_object.path, }) - return self.local.run_script(script, env=env) + return self.local.run_script(script, env=env, return_output=True) def run_gencode_local(self, cdist_object): """Run the gencode-local script for the given cdist object.""" From bbef928a6d02a43efb11a855b0951fd4db3d6381 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 16:04:55 +0200 Subject: [PATCH 0789/1024] --copy paste error Signed-off-by: Steven Armstrong --- lib/cdist/exec/remote.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index 2de16426..e1d9f920 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -114,9 +114,9 @@ class Remote(object): self.log.debug("Remote run: %s", command) try: if return_output: - return subprocess.check_output(command, env=env).decode() + return subprocess.check_output(command).decode() else: - subprocess.check_call(command, env=env) + subprocess.check_call(command) except subprocess.CalledProcessError: raise cdist.Error("Command failed: " + " ".join(command)) except OSError as error: @@ -144,9 +144,9 @@ class Remote(object): try: if return_output: - return subprocess.check_output(command, env=env).decode() + return subprocess.check_output(command).decode() else: - subprocess.check_call(command, env=env) + subprocess.check_call(command) except subprocess.CalledProcessError as error: script_content = self.run(["cat", script]) self.log.error("Code that raised the error:\n%s", script_content) From c30e112e4a2773bee50bc440e1a740fbc2465fff Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 16:07:50 +0200 Subject: [PATCH 0790/1024] explorer: make tests pass again Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index ee1008fe..46230bcd 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -88,7 +88,7 @@ class Explorer(object): def run_global_explorer(self, explorer): """Run the given global explorer and return it's output.""" script = os.path.join(self.remote.global_explorer_path, explorer) - return self.remote.run_script(script, env=self.env) + return self.remote.run_script(script, env=self.env, return_output=True) ### type @@ -126,4 +126,4 @@ class Explorer(object): '__type_explorer': os.path.join(self.remote.type_path, cdist_type.explorer_path) }) script = os.path.join(self.remote.type_path, cdist_type.explorer_path, explorer) - return self.remote.run_script(script, env=env) + return self.remote.run_script(script, env=env, return_output=True) From d1930e983cb3d0f32d08c10813974e886680d364 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 16:14:04 +0200 Subject: [PATCH 0791/1024] update test: run_*_manifest should no longer return output Signed-off-by: Steven Armstrong --- lib/cdist/test/manifest/__init__.py | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index 341f4893..879c4c1a 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -63,33 +63,9 @@ class ManifestTestCase(unittest.TestCase): def test_initial_manifest_environment(self): initial_manifest = os.path.join(self.local.manifest_path, "dump_environment") - output_string = self.manifest.run_initial_manifest(initial_manifest) - output_dict = {} - for line in output_string.split('\n'): - if line: - key,value = line.split(': ') - output_dict[key] = value - self.assertTrue(output_dict['PATH'].startswith(self.local.bin_path)) - self.assertEqual(output_dict['__target_host'], self.local.target_host) - self.assertEqual(output_dict['__global'], self.local.out_path) - self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_path) - self.assertEqual(output_dict['__manifest'], self.local.manifest_path) + self.manifest.run_initial_manifest(initial_manifest) def test_type_manifest_environment(self): cdist_type = core.Type(self.local.type_path, '__dump_environment') cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') - - output_string = self.manifest.run_type_manifest(cdist_object) - output_dict = {} - for line in output_string.split('\n'): - if line: - key,value = line.split(': ') - output_dict[key] = value - self.assertTrue(output_dict['PATH'].startswith(self.local.bin_path)) - self.assertEqual(output_dict['__target_host'], self.local.target_host) - self.assertEqual(output_dict['__global'], self.local.out_path) - self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_path) - self.assertEqual(output_dict['__type'], cdist_type.absolute_path) - self.assertEqual(output_dict['__object'], cdist_object.absolute_path) - self.assertEqual(output_dict['__object_id'], cdist_object.object_id) - self.assertEqual(output_dict['__object_fq'], cdist_object.path) + self.manifest.run_type_manifest(cdist_object) From f723bede109b3352f099179d0a4bc61df5090c99 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 16:14:39 +0200 Subject: [PATCH 0792/1024] no longer return output from run_*_manifest Signed-off-by: Steven Armstrong --- lib/cdist/core/manifest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index 93eb6f2d..3eca166c 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -80,7 +80,7 @@ class Manifest(object): env.update(self.env) env['__manifest'] = self.local.manifest_path env['__cdist_manifest'] = script - return self.local.run_script(script, env=env) + self.local.run_script(script, env=env) def run_type_manifest(self, cdist_object): script = os.path.join(self.local.type_path, cdist_object.type.manifest_path) @@ -94,4 +94,4 @@ class Manifest(object): '__type': cdist_object.type.absolute_path, '__cdist_manifest': script, }) - return self.local.run_script(script, env=env) + self.local.run_script(script, env=env) From eac3cc31c46d26a0a0d3e5f786ba266a29268c17 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 16:33:56 +0200 Subject: [PATCH 0793/1024] export __debug in environment Signed-off-by: Steven Armstrong --- lib/cdist/context.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index cf314409..ed1fd31d 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -41,6 +41,8 @@ class Context(object): debug=False): self.debug = debug + if self.debug: + os.environ['__debug'] = 'yes' self.target_host = target_host From c24b20de0871eab0b6e2334a2479898db4dbef2d Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 16:42:14 +0200 Subject: [PATCH 0794/1024] make nico happy Signed-off-by: Steven Armstrong --- lib/cdist/context.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index ed1fd31d..cf314409 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -41,8 +41,6 @@ class Context(object): debug=False): self.debug = debug - if self.debug: - os.environ['__debug'] = 'yes' self.target_host = target_host From 92ff7e630da8882cf1c67e043ff5eef89c3e9ea4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 21:50:16 +0200 Subject: [PATCH 0795/1024] add banner to tests again Signed-off-by: Nico Schottelius --- .../test_banner.py => lib/cdist/test/banner/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename other/tests_reintegrate/test_banner.py => lib/cdist/test/banner/__init__.py (100%) diff --git a/other/tests_reintegrate/test_banner.py b/lib/cdist/test/banner/__init__.py similarity index 100% rename from other/tests_reintegrate/test_banner.py rename to lib/cdist/test/banner/__init__.py From 422800ab9898332f7f9ef7e88579b03425770fe6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 22:45:23 +0200 Subject: [PATCH 0796/1024] get back some constants needed for testing Signed-off-by: Nico Schottelius --- lib/cdist/test/__init__.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/cdist/test/__init__.py b/lib/cdist/test/__init__.py index e69de29b..2c6abd36 100644 --- a/lib/cdist/test/__init__.py +++ b/lib/cdist/test/__init__.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# +# 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 . +# +# + +import os + +cdist_base_path = os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../")) + +cdist_exec_path = os.path.join(cdist_base_path, "bin/cdist") From dd05a9b0d75196f5b7154a46a2ea6f23febded8d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:02:47 +0200 Subject: [PATCH 0797/1024] add test to verify code setups debug env Signed-off-by: Nico Schottelius --- lib/cdist/test/code/__init__.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index f661ad24..c9761a4b 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -24,6 +24,7 @@ import tempfile import unittest import shutil import getpass +import logging import cdist from cdist import core @@ -46,25 +47,27 @@ class CodeTestCase(unittest.TestCase): return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) def setUp(self): - target_host = 'localhost' + self.target_host = 'localhost' self.local_base_path = local_base_path self.out_path = self.mkdtemp() - self.local = local.Local(target_host, self.local_base_path, self.out_path) + self.local = local.Local(self.target_host, self.local_base_path, self.out_path) self.local.create_directories() 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(target_host, self.remote_base_path, remote_exec, remote_copy) + self.remote = remote.Remote(self.target_host, self.remote_base_path, remote_exec, remote_copy) - self.code = code.Code(target_host, self.local, self.remote) + self.code = code.Code(self.target_host, self.local, self.remote) self.cdist_type = core.Type(self.local.type_path, '__dump_environment') self.cdist_object = core.Object(self.cdist_type, self.local.object_path, 'whatever') self.cdist_object.create() + self.log = logging.getLogger("cdist") + def tearDown(self): shutil.rmtree(self.out_path) shutil.rmtree(self.remote_base_path) @@ -108,8 +111,13 @@ class CodeTestCase(unittest.TestCase): def test_run_code_local(self): self.cdist_object.code_local = self.code.run_gencode_local(self.cdist_object) self.code.run_code_local(self.cdist_object) - + def test_run_code_remote_environment(self): self.cdist_object.code_remote = self.code.run_gencode_remote(self.cdist_object) self.code.transfer_code_remote(self.cdist_object) self.code.run_code_remote(self.cdist_object) + + def test_debug_env_setup(self): + self.log.setLevel(logging.DEBUG) + code = cdist.core.code.Code(self.target_host, self.local, self.remote) + self.assertTrue("__debug" in code.env) From bc85237eaab020ee71e44b31822693b5312e0871 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:04:19 +0200 Subject: [PATCH 0798/1024] make code setup debug env Signed-off-by: Nico Schottelius --- doc/man/cdist-reference.text.sh | 2 +- lib/cdist/core/code.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 7196c3b3..57dbde4a 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -170,7 +170,7 @@ __debug:: If this variable is setup, cdist runs in debug mode. You can use this information, to only output stuff in debug mode as well. - Available for: initial manifest, type manifest + Available for: initial manifest, type manifest, gencode, code __explorer:: Directory that contains all global explorers. Available for: explorer diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index e81f7954..0f2591b3 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -92,6 +92,9 @@ class Code(object): '__global': self.local.out_path, } + if log.getEffectiveLevel() == logging.DEBUG: + self.env.update({'__debug': "yes" }) + def _run_gencode(self, cdist_object, which): cdist_type = cdist_object.type script = os.path.join(self.local.type_path, getattr(cdist_type, 'gencode_%s_path' % which)) From db04ec0473eab51115ee31cbac6a936b940633b1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:11:57 +0200 Subject: [PATCH 0799/1024] test whether debug is setup in explorer env Signed-off-by: Nico Schottelius --- lib/cdist/test/explorer/__init__.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index 3b3a7e98..a3a0c9f8 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -24,6 +24,7 @@ import tempfile import unittest import shutil import getpass +import logging import cdist from cdist import core @@ -46,20 +47,22 @@ class ExplorerClassTestCase(unittest.TestCase): return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) def setUp(self): - target_host = 'localhost' + self.target_host = 'localhost' self.local_base_path = local_base_path self.out_path = self.mkdtemp() - self.local = local.Local(target_host, self.local_base_path, self.out_path) + self.local = local.Local(self.target_host, self.local_base_path, self.out_path) self.local.create_directories() 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(target_host, self.remote_base_path, remote_exec, remote_copy) + self.remote = remote.Remote(self.target_host, self.remote_base_path, remote_exec, remote_copy) - self.explorer = explorer.Explorer(target_host, self.local, self.remote) + self.explorer = explorer.Explorer(self.target_host, self.local, self.remote) + + self.log = logging.getLogger("cdist") def tearDown(self): shutil.rmtree(self.out_path) @@ -109,3 +112,7 @@ class ExplorerClassTestCase(unittest.TestCase): output = self.explorer.run_type_explorer('world', cdist_object) self.assertEqual(output, 'hello\n') + def test_debug_env_setup(self): + self.log.setLevel(logging.DEBUG) + explorer = cdist.core.explorer.Explorer(self.target_host, self.local, self.remote) + self.assertTrue("__debug" in explorer.env) From 02934055e749ea2fe3406842b8ef6d76351a6ab4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:14:05 +0200 Subject: [PATCH 0800/1024] make debug test work for explorer Signed-off-by: Nico Schottelius --- lib/cdist/core/explorer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index 46230bcd..9dd5d210 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -73,6 +73,8 @@ class Explorer(object): '__target_host': self.target_host, '__explorer': self.remote.global_explorer_path, } + if log.getEffectiveLevel() == logging.DEBUG: + self.env.update({'__debug': "yes" }) ### global From f80520090bad3968742974d0607e3a7c82ad1d98 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:14:49 +0200 Subject: [PATCH 0801/1024] remove obsolete global_explorer Signed-off-by: Nico Schottelius --- lib/cdist/core/global_explorer.py | 59 ------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 lib/cdist/core/global_explorer.py diff --git a/lib/cdist/core/global_explorer.py b/lib/cdist/core/global_explorer.py deleted file mode 100644 index fe0ea018..00000000 --- a/lib/cdist/core/global_explorer.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -import io -import logging -import os -#import stat -#import shutil -#import sys -#import tempfile -#import time -# -#import cdist.exec - -import cdist - -log = logging.getLogger(__name__) - -class GlobalExplorer(object): - def __init__(self, local_path, remote_path): - self.local_path = local_path - self.remote_path = remote_path - - def run(self): - """Run global explorers""" - log.info("Running global explorers") - - outputs = {} - for explorer in os.listdir(src_path): - outputs[explorer] = io.StringIO() - cmd = [] - cmd.append("__explorer=" + remote_dst_path) - cmd.append(os.path.join(remote_dst_path, explorer)) - cdist.exec.run_or_fail(cmd, stdout=outputs[explorer], remote_prefix=True) - - def transfer(self): - """Transfer the global explorers""" - self.remote_mkdir(self.remote_global_explorer_path) - self.transfer_path(self.global_explorer_path, - self.remote_global_explorer_path) From df8be73c109499f406ac0f6d1a4d1fb91f0f5257 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:18:58 +0200 Subject: [PATCH 0802/1024] test for debug in manifest Signed-off-by: Nico Schottelius --- lib/cdist/test/manifest/__init__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index 879c4c1a..86885a59 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -26,9 +26,7 @@ import getpass import shutil import string import random - -#import logging -#logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s') +import logging import cdist from cdist.exec import local @@ -51,12 +49,13 @@ class ManifestTestCase(unittest.TestCase): def setUp(self): self.temp_dir = self.mkdtemp() - target_host = 'localhost' + self.target_host = 'localhost' out_path = self.temp_dir - self.local = local.Local(target_host, local_base_path, out_path) + 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.manifest = manifest.Manifest(target_host, self.local) + self.manifest = manifest.Manifest(self.target_host, self.local) + self.log = logging.getLogger("cdist") def tearDown(self): shutil.rmtree(self.temp_dir) @@ -69,3 +68,8 @@ class ManifestTestCase(unittest.TestCase): cdist_type = core.Type(self.local.type_path, '__dump_environment') cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') self.manifest.run_type_manifest(cdist_object) + + def test_debug_env_setup(self): + self.log.setLevel(logging.DEBUG) + manifest = cdist.core.manifest.Manifest(self.target_host, self.local) + self.assertTrue("__debug" in manifest.env) From ba59339f67efda5f8f2a81870e25a99b6153146d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:21:22 +0200 Subject: [PATCH 0803/1024] fixup code and manifest Signed-off-by: Nico Schottelius --- lib/cdist/core/manifest.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index 3eca166c..f031ac35 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -74,6 +74,9 @@ class Manifest(object): '__global': self.local.out_path, '__cdist_type_base_path': self.local.type_path, # for use in type emulator } + if log.getEffectiveLevel() == logging.DEBUG: + self.env.update({'__debug': "yes" }) + def run_initial_manifest(self, script): env = os.environ.copy() From 57f4aae2a1c427417f6eb68bde11dc469b651e7b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:23:44 +0200 Subject: [PATCH 0804/1024] --obsolete files Signed-off-by: Nico Schottelius --- lib/cdist/exec.py | 96 ------------- lib/cdist/manifest.py | 272 ------------------------------------- lib/cdist/type_explorer.py | 118 ---------------- 3 files changed, 486 deletions(-) delete mode 100644 lib/cdist/exec.py delete mode 100644 lib/cdist/manifest.py delete mode 100644 lib/cdist/type_explorer.py diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py deleted file mode 100644 index a2282347..00000000 --- a/lib/cdist/exec.py +++ /dev/null @@ -1,96 +0,0 @@ -# -*- coding: utf-8 -*- -# -# 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 . -# -# - -import logging -import subprocess - -import cdist - - -class Wrapper(object): - def __init__(self, target_host, remote_exec, remote_copy): - self.target_host = target_host - self.remote_exec = remote_exec - self.remote_copy = remote_copy - self.log = logging.getLogger(self.target_host) - - def remote_mkdir(self, directory): - """Create directory on remote side""" - self.run_or_fail(["mkdir", "-p", directory], remote=True) - - def remove_remote_path(self, destination): - """Ensure path on remote side vanished""" - self.run_or_fail(["rm", "-rf", destination], remote=True) - - def transfer_path(self, source, destination): - """Transfer directory and previously delete the remote destination""" - self.remove_remote_path(destination) - self.run_or_fail(self.remote_copy.split() + - ["-r", source, self.target_host + ":" + destination]) - - def shell_run_or_debug_fail(self, script, *args, remote=False, **kargs): - # Manually execute /bin/sh, because sh -e does what we want - # and sh -c -e does not exit if /bin/false called - args[0][:0] = [ "/bin/sh", "-e" ] - - if remote: - remote_prefix = self.remote_exec.split() - remote_prefix.append(self.target_host) - args[0][:0] = remote_prefix - - self.log.debug("Shell exec cmd: %s", args) - - if 'env' in kargs: - self.log.debug("Shell exec env: %s", kargs['env']) - - try: - subprocess.check_call(*args, **kargs) - except subprocess.CalledProcessError: - self.log.error("Code that raised the error:\n") - - if remote: - self.run_or_fail(["cat", script], remote=remote) - - else: - try: - script_fd = open(script) - print(script_fd.read()) - script_fd.close() - except IOError as error: - raise cdist.Error(str(error)) - - raise cdist.Error("Command failed (shell): " + " ".join(*args)) - except OSError as error: - raise cdist.Error(" ".join(*args) + ": " + error.args[1]) - - def run_or_fail(self, *args, remote=False, **kargs): - if remote: - remote_prefix = self.remote_exec.split() - remote_prefix.append(self.target_host) - args[0][:0] = remote_prefix - - self.log.debug("Exec: " + " ".join(*args)) - try: - subprocess.check_call(*args, **kargs) - except subprocess.CalledProcessError: - raise cdist.Error("Command failed: " + " ".join(*args)) - except OSError as error: - raise cdist.Error(" ".join(*args) + ": " + error.args[1]) diff --git a/lib/cdist/manifest.py b/lib/cdist/manifest.py deleted file mode 100644 index ab5f7284..00000000 --- a/lib/cdist/manifest.py +++ /dev/null @@ -1,272 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -import logging -import os -import stat -import shutil -import sys -import tempfile -import time - -import cdist.core -import cdist.exec - -CODE_HEADER = "#!/bin/sh -e\n" - -class ConfigInstall: - """Cdist main class to hold arbitrary data""" - - def __init__(self, - target_host, - initial_manifest=False, - base_path=False, - exec_path=sys.argv[0], - debug=False): - - self.context = cdist.context.Context( - target_host=target_host, - initial_manifest=initial_manifest, - base_path=base_path, - exec_path=sys.argv[0], - debug=debug) - - - - self.exec_wrapper = cdist.exec.Wrapper( - targe_host = self.target_host, - remote_exec=os.environ['__remote_exec'].split(), - remote_copy=os.environ['__remote_copy'].split() - ) - - self.log = logging.getLogger(self.context.target_host) - - # Setup env to be used by others - FIXME - self.__init_env() - - # Create directories - self.__init_local_paths() - self.__init_remote_paths() - - def __init_remote_paths(self): - """Initialise remote directory structure""" - self.remove_remote_path(self.context.remote_base_path) - self.remote_mkdir(self.context.remote_base_path) - self.remote_mkdir(self.context.remote_conf_path) - - def __init_local_paths(self): - """Initialise local directory structure""" - - # Create base dir, if user supplied and not existing - if not os.path.isdir(self.context.base_path): - os.mkdir(self.context.base_path) - - # FIXME: raise more beautiful exception / Steven: handle exception - os.mkdir(self.out_path) - os.mkdir(self.global_explorer_out_path) - os.mkdir(self.bin_path) - - # FIXME: remove this function, only expose ENV - # explicitly! - def __init_env(self): - """Environment usable for other stuff""" - os.environ['__target_host'] = self.target_host - if self.debug: - os.environ['__debug'] = "yes" - - def cleanup(self): - self.context.cleanup() - - def run_initial_manifest(self): - """Run the initial manifest""" - log.info("Running initial manifest %s", self.initial_manifest) - env = { "__manifest" : self.manifest_path } - self.run_manifest(self.initial_manifest, extra_env=env) - - def run_type_manifest(self, cdist_object): - """Run manifest for a specific object""" - cdist_type = cdist_object.type - manifest_path = os.path.join(self.type_base_path, - cdist_type.manifest_path) - - log.debug("%s: Running %s", cdist_object.name, manifest_path) - if os.path.exists(manifest_path): - env = { "__object" : os.path.join(self.object_base_path, - cdist_object.path), - "__object_id": cdist_object.object_id, - "__object_fq": cdist_object.name, - "__type": os.path.join(self.type_base_path, - cdist_type.path) - } - self.run_manifest(manifest_path, extra_env=env) - - def run_manifest(self, manifest_path, extra_env=None): - """Run a manifest""" - log.debug("Running manifest %s, env=%s", manifest_path, extra_env) - env = os.environ.copy() - env['PATH'] = self.bin_path + ":" + env['PATH'] - - # Information required in every manifest - env['__target_host'] = self.target_host - env['__global'] = self.out_path - - # Required for recording source in emulator - env['__cdist_manifest'] = manifest_path - - # Required to find types in emulator - env['__cdist_type_base_path'] = self.type_base_path - - # Other environment stuff - if extra_env: - env.update(extra_env) - - cdist.exec.shell_run_or_debug_fail(manifest_path, [manifest_path], env=env) - - def object_prepare(self, cdist_object): - """Prepare object: Run type explorer + manifest""" - log.debug("Preparing object: " + cdist_object.name) - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - cdist_object.prepared = True - - def object_run(self, cdist_object): - """Run gencode and code for an object""" - log.debug("Running object %s", cdist_object) - - # Catch requirements, which re-call us - if cdist_object.ran: - return - - cdist_type = cdist_object.type - - for requirement in cdist_object.requirements: - log.debug("Object %s requires %s", cdist_object, requirement) - self.object_run(requirement) - - # - # Setup env Variable: - # - env = os.environ.copy() - env['__target_host'] = self.target_host - env['__global'] = self.out_path - env["__object"] = os.path.join(self.object_base_path, cdist_object.path) - env["__object_id"] = cdist_object.object_id - env["__object_fq"] = cdist_object.name - env["__type"] = cdist_type.name - - # gencode - for cmd in ["local", "remote"]: - bin = os.path.join(self.type_base_path, - getattr(cdist_type, "gencode_" + cmd + "_path")) - - if os.path.isfile(bin): - outfile = os.path.join(self.object_base_path, - getattr(cdist_object, "code_" + cmd + "_path")) - - outfile_fd = open(outfile, "w") - - # Need to flush to ensure our write is done before stdout write - # FIXME: code header still needed? - outfile_fd.write(CODE_HEADER) - outfile_fd.flush() - - cdist.exec.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd) - outfile_fd.close() - - status = os.stat(outfile) - - # Remove output if empty, else make it executable - if status.st_size == len(CODE_HEADER): - os.unlink(outfile) - else: - # Add header and make executable - identically to 0o700 - os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) - cdist_object.changed=True - - # code local - code_local = cdist_object.code_local_path - if os.path.isfile(code_local): - cdist.exec.run_or_fail([code_local]) - - # code remote - local_remote_code = os.path.join(self.object_base_path, - cdist_object.code_remote_path) - remote_remote_code = os.path.join(self.remote_object_path, - cdist_object.code_remote_path) - if os.path.isfile(local_remote_code): - self.transfer_path(local_remote_code, remote_remote_code) - cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True) - - cdist_object.ran = True - - def link_emulator(self): - """Link emulator to types""" - src = os.path.abspath(self.exec_path) - for cdist_type in cdist.core.Type.list_types(self.type_base_path): - dst = os.path.join(self.bin_path, cdist_type.name) - log.debug("Linking emulator: %s to %s", src, dst) - - # FIXME: handle exception / make it more beautiful / Steven: raise except :-) - os.symlink(src, dst) - - def deploy_to(self): - """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.target_host) - self.stage_prepare() - self.stage_run() - - def deploy_and_cleanup(self): - """Do what is most often done: deploy & cleanup""" - start_time = time.time() - self.deploy_to() - self.cleanup() - log.info("Finished run of %s in %s seconds", - self.target_host, time.time() - start_time) - - def stage_prepare(self): - """Do everything for a deploy, minus the actual code stage""" - self.link_emulator() - self.run_global_explorers() - self.run_initial_manifest() - - log.info("Running object manifests and type explorers") - - # Continue process until no new objects are created anymore - new_objects_created = True - while new_objects_created: - new_objects_created = False - for cdist_object in cdist.core.Object.list_objects(self.object_base_path, - self.type_base_path): - if cdist_object.prepared: - log.debug("Skipping rerun of object %s", cdist_object) - continue - else: - self.object_prepare(cdist_object) - new_objects_created = True - - def stage_run(self): - """The final (and real) step of deployment""" - log.info("Generating and executing code") - for cdist_object in cdist.core.Object.list_objects(self.object_base_path, - self.type_base_path): - log.debug("Run object: %s", cdist_object) - self.object_run(cdist_object) diff --git a/lib/cdist/type_explorer.py b/lib/cdist/type_explorer.py deleted file mode 100644 index 9e3c99bf..00000000 --- a/lib/cdist/type_explorer.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -import io -import logging -import os -#import stat -#import shutil -#import sys -#import tempfile -#import time -# -#import cdist.exec - -import cdist - -# FIXME: Logging with hostname -log = logging.getLogger(__name__) - -class TypeExplorer(object): - def __init__(self, - remote_global_explorer_path, - object_base_path, - type_base_path, - remote_object_base_path, - remote_type_base_path - ): - - self.object_base_path = object_base_path - self.global_explorer_path = global_explorer_path - self.type_base_path = type_base_path - self.remote_type_base_path = remote_type_base_path - self.remote_object_path = remote_object_path - - def run(self, cdist_object): - """Run type specific explorers for objects""" - - cdist_type = cdist_object.type - - cmd = [] - cmd.append("__explorer=" + self.remote_global_explorer_path) - cmd.append("__type_explorer=" + os.path.join( - self.remote_type_path, - cdist_type.explorer_path)) - cmd.append("__object=" + os.path.join( - self.remote_object_base_path, - cdist_object.path)) - cmd.append("__object_id=" + cdist_object.object_id) - cmd.append("__object_fq=" + cdist_object.name) - - outputs = {} - for explorer in cdist_type.explorers: - remote_cmd = cmd + [os.path.join(self.remote_type_path, - cdist_type.explorer_path, explorer)] - outputs[explorer] = io.StringIO() - log.debug("%s exploring %s using %s storing to %s", - cdist_object, explorer, remote_cmd, output) - - # FIXME: change to new style - cdist.exec.run_or_fail(remote_cmd, stdout=outputs[explorer], - remote_prefix=True) - - return outputs - - def transfer_object_parameter(self, cdist_object): - """Transfer the object parameter to the remote destination""" - src = os.path.join(self.object_base_path, - cdist_object.parameter_path) - dst = os.path.join(self.remote_object_base_path, - cdist_object.parameter_path) - - # FIXME: new style - # Synchronise parameter dir afterwards - self.remote_mkdir(dst) - self.transfer_path(src, dst) - - def transfer_type_explorers(self, cdist_type): - """Transfer explorers of a type, but only once""" - if cdist_type.transferred_explorers: - log.debug("Skipping retransfer for explorers of %s", cdist_type) - return - else: - log.debug("Ensure no retransfer for %s", cdist_type) - # Do not retransfer - cdist_type.transferred_explorers = True - - explorers = cdist_type.explorers - - if len(explorers) > 0: - rel_path = cdist_type.explorer_path - src = os.path.join(self.type_base_path, rel_path) - dst = os.path.join(self.remote_type_path, rel_path) - - # Ensure full path until type exists: - # /var/lib/cdist/conf/type/__directory/explorer - # /var/lib/cdist/conf/type/__directory may not exist, - # but remote_mkdir uses -p to fix this - self.remote_mkdir(dst) - self.transfer_path(src, dst) From 2a0f7512b7c689ae11a5dfc18dbbe9787ea5fad9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:27:55 +0200 Subject: [PATCH 0805/1024] add full output of error Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-14.error-output | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 doc/dev/logs/2011-10-14.error-output diff --git a/doc/dev/logs/2011-10-14.error-output b/doc/dev/logs/2011-10-14.error-output new file mode 100644 index 00000000..4414de13 --- /dev/null +++ b/doc/dev/logs/2011-10-14.error-output @@ -0,0 +1,46 @@ +[23:24] brief:cdist% ./bin/cdist config -c ~/p/cdist-nutzung -v ikq04.ethz.ch +INFO: ikq04.ethz.ch: Deploying to ikq04.ethz.ch +INFO: ikq04.ethz.ch: Running object manifests and type explorers +cat: /home/users/nico/.tmp/tmpf969y2/out/object/__addifnosuchline/ssh-root-blukas/.cdist/parameter/line: No such file or directory +#!/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 + +regex=$(cat "$__object/parameter/line") +if [ -f "$file" ]; then + grep -q "^$regex\$" "$file" + if [ $? -eq 1 ]; then + echo "NOTFOUND" + else + echo "FOUND" + fi +else + echo "NOTFOUND" +fi +ERROR: ikq04.ethz.ch: Code that raised the error: +None +ERROR: Remote script execution failed: /var/lib/cdist/conf/type/__addifnosuchline/explorer/findline ['ssh', '-o', 'User=root', '-q', 'ikq04.ethz.ch', '__explorer=/var/lib/cdist/conf/explorer', '__object_fq=__addifnosuchline/ssh-root-blukas/.cdist', '__target_host=ikq04.ethz.ch', '__object_id=ssh-root-blukas', '__type_explorer=/var/lib/cdist/conf/type/__addifnosuchline/explorer', '__object=/home/users/nico/.tmp/tmpf969y2/out/object/__addifnosuchline/ssh-root-blukas/.cdist', '/bin/sh', '-e', '/var/lib/cdist/conf/type/__addifnosuchline/explorer/findline'] +[23:25] brief:cdist% From c38959699f5cbd23809e6e6516a8eac3d4982cfc Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 23:42:16 +0200 Subject: [PATCH 0806/1024] test for: transfer_type_explorers_only_once Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index a3a0c9f8..e6858812 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -95,6 +95,20 @@ class ExplorerClassTestCase(unittest.TestCase): destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) self.assertEqual(os.listdir(source), os.listdir(destination)) + def test_transfer_type_explorers_only_once(self): + cdist_type = core.Type(self.local.type_path, '__test_type') + # first transfer + self.explorer.transfer_type_explorers(cdist_type) + source = os.path.join(self.local.type_path, cdist_type.explorer_path) + destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) + self.assertEqual(os.listdir(source), os.listdir(destination)) + # nuke destination folder content, but recreate directory + shutil.rmtree(destination) + os.makedirs(destination) + # second transfer, should not happen + self.explorer.transfer_type_explorers(cdist_type) + self.assertFalse(os.listdir(destination)) + def test_transfer_object_parameters(self): cdist_type = core.Type(self.local.type_path, '__test_type') cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') From 814b46f0c7f5a26a200b8fe01a8a292b127da02c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 23:44:27 +0200 Subject: [PATCH 0807/1024] /transfered_explorers/explorers_transferred/ Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index 8cf21ce7..6c3cd757 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -67,7 +67,7 @@ class Type(object): self.gencode_remote_path = os.path.join(self.name, "gencode-remote") self.manifest_path = os.path.join(self.name, "manifest") - self.transferred_explorers = False + self.explorers_transferred = False self.__explorers = None self.__required_parameters = None From 325a13088cfc80765644e30eebbe77b8087aacdc Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 23:47:05 +0200 Subject: [PATCH 0808/1024] implement that type explorers are only transfered once Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index 9dd5d210..7a868b31 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -105,10 +105,14 @@ class Explorer(object): def transfer_type_explorers(self, cdist_type): """Transfer the type explorers for the given type to the remote side.""" if cdist_type.explorers: - source = os.path.join(self.local.type_path, cdist_type.explorer_path) - destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) - self.remote.mkdir(destination) - self.remote.transfer(source, destination) + if cdist_type.explorers_transferred: + log.debug("Skipping retransfer of type explorers for: %s", cdist_type) + else: + source = os.path.join(self.local.type_path, cdist_type.explorer_path) + destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) + self.remote.mkdir(destination) + self.remote.transfer(source, destination) + cdist_type.explorers_transferred = True def transfer_object_parameters(self, cdist_object): """Transfer the parameters for the given object to the remote side.""" From 1e31721ad995144f03614a261517ce8156f9a9bb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:50:31 +0200 Subject: [PATCH 0809/1024] BUGFIX: remote path for explorer in __object variable Signed-off-by: Nico Schottelius --- lib/cdist/core/explorer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index 9dd5d210..14a66ff4 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -122,7 +122,7 @@ class Explorer(object): cdist_type = cdist_object.type env = self.env.copy() env.update({ - '__object': cdist_object.absolute_path, + '__object': os.path.join(self.remote.object_path, cdist_object.path), '__object_id': cdist_object.object_id, '__object_fq': cdist_object.path, '__type_explorer': os.path.join(self.remote.type_path, cdist_type.explorer_path) From 9223663136f8b9a90d20eb58a9b67ae2f4cf1c5a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:51:01 +0200 Subject: [PATCH 0810/1024] CLEANUP: return flat name, not python list to user Signed-off-by: Nico Schottelius --- lib/cdist/exec/local.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index 56c29cb7..59f1ee4d 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -40,7 +40,8 @@ class LocalScriptError(cdist.Error): self.script_content = script_content def __str__(self): - return "Local script execution failed: %s %s" % (self.script, self.command) + plain_command = " ".join(self.command) + return "Local script execution failed: %s %s" % (self.script, plain_command) class Local(object): From b5b7d8e7271602e0289fe392bfd831be9b3dd38e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 14 Oct 2011 23:52:05 +0200 Subject: [PATCH 0811/1024] add missing return_output=True argument when fetching script content Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 2 +- lib/cdist/exec/remote.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index 56c29cb7..679d847b 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -122,7 +122,7 @@ class Local(object): else: subprocess.check_call(command, env=env) except subprocess.CalledProcessError as error: - script_content = self.run(["cat", script]) + script_content = self.run(["cat", script], return_output=True) self.log.error("Code that raised the error:\n%s", script_content) raise LocalScriptError(script, command, script_content) except EnvironmentError as error: diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index e1d9f920..9610290b 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -148,7 +148,7 @@ class Remote(object): else: subprocess.check_call(command) except subprocess.CalledProcessError as error: - script_content = self.run(["cat", script]) + script_content = self.run(["cat", script], return_output=True) self.log.error("Code that raised the error:\n%s", script_content) raise RemoteScriptError(script, command, script_content) except EnvironmentError as error: From ef1ebbd0b747e8495422e50c510ce83469f1945e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:56:33 +0200 Subject: [PATCH 0812/1024] remove senseless message superseeded by new logging prefix Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 72ff7c6c..f843167b 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -62,7 +62,6 @@ class ConfigInstall(object): def deploy_to(self): """Mimic the old deploy to: Deploy to one host""" - self.log.info("Deploying to " + self.context.target_host) self.stage_prepare() self.stage_run() From 85c9c3e28339c1b84d71c4981c53afed58e419b5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Oct 2011 23:57:58 +0200 Subject: [PATCH 0813/1024] more changes for next release Signed-off-by: Nico Schottelius --- doc/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/changelog b/doc/changelog index 3540498e..04679bec 100644 --- a/doc/changelog +++ b/doc/changelog @@ -2,6 +2,9 @@ * Improved logging, added --verbose, by more quiet by default * Bugfix __user: Correct quoting (Steven Armstrong) * Bugfix requirements: Restore original require="" behaviour + * Feature requirements: Check for broken object_ids and abort + * Massive refactoring and unittesting introduced (Steven Armstrong) + * Feature: Initial undocumented support for replacing the remote exec and remote copy commands * Feature: Initial undocumented support for installations in core From 3f76f03239b6fd9aca43e5a1b0714994ae0fb77b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 00:10:35 +0200 Subject: [PATCH 0814/1024] return full command only in local mode Signed-off-by: Nico Schottelius --- lib/cdist/exec/local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index ad31a909..6157c0bc 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -41,7 +41,7 @@ class LocalScriptError(cdist.Error): def __str__(self): plain_command = " ".join(self.command) - return "Local script execution failed: %s %s" % (self.script, plain_command) + return "Local script execution failed: %s" % plain_command class Local(object): From 0d441eb378af97c4d4a73c8f024cba4d582caa58 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 00:12:08 +0200 Subject: [PATCH 0815/1024] report info when running initial manifest (it may take some time) Signed-off-by: Nico Schottelius --- lib/cdist/core/manifest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index f031ac35..8f9903a5 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -83,6 +83,7 @@ class Manifest(object): env.update(self.env) env['__manifest'] = self.local.manifest_path env['__cdist_manifest'] = script + log.info("Running initial manifest " + self.local.manifest_path) self.local.run_script(script, env=env) def run_type_manifest(self, cdist_object): From db6fdeebfe7db928e69a8297ee418ad863eec6b0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 00:14:25 +0200 Subject: [PATCH 0816/1024] log.info for global explorers (may also take some time) Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index f843167b..ce7c5736 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -97,6 +97,7 @@ class ConfigInstall(object): def run_global_explorers(self): """Run global explorers and save output""" # FIXME: move to explorer, pass global_explorer_out_path as argument + self.log.info("Running global explorers") self.explorer.transfer_global_explorers() for explorer in self.explorer.list_global_explorer_names(): output = self.explorer.run_global_explorer(explorer) From cba202186e70d17f15eb62a571d7ba52675df6f5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 00:16:34 +0200 Subject: [PATCH 0817/1024] missing prefix documented Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-15.prefix-output-missing | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 doc/dev/logs/2011-10-15.prefix-output-missing diff --git a/doc/dev/logs/2011-10-15.prefix-output-missing b/doc/dev/logs/2011-10-15.prefix-output-missing new file mode 100644 index 00000000..05788fd5 --- /dev/null +++ b/doc/dev/logs/2011-10-15.prefix-output-missing @@ -0,0 +1,10 @@ +Prefix is missing in some parts for a run, they all need to include +the hostname (required for clean parallel processing) + +[0:13] brief:cdist% ./bin/cdist config -c ~/p/cdist-nutzung -v ikq04.ethz.ch +INFO: ikq04.ethz.ch: Running global explorers +INFO: Running initial manifest /home/users/nico/p/cdist-nutzung/conf/manifest +INFO: ikq04.ethz.ch: Running object manifests and type explorers +ERROR: requirements object_id may not start with /: __file//etc/nslcd.conf +ERROR: ikq04.ethz.ch: Code that raised the error: + From c64ab97f2a592ed782cee0d888c3341fef10d14a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 00:25:55 +0200 Subject: [PATCH 0818/1024] irrrrrrgs, ugly output Signed-off-by: Nico Schottelius --- ...011-10-15.ugly-output-on-breaking-explorer | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 doc/dev/logs/2011-10-15.ugly-output-on-breaking-explorer diff --git a/doc/dev/logs/2011-10-15.ugly-output-on-breaking-explorer b/doc/dev/logs/2011-10-15.ugly-output-on-breaking-explorer new file mode 100644 index 00000000..921f0c90 --- /dev/null +++ b/doc/dev/logs/2011-10-15.ugly-output-on-breaking-explorer @@ -0,0 +1,43 @@ +[0:15] brief:cdist% ./bin/cdist config -c ~/p/cdist-nutzung -v ikq04.ethz.ch +INFO: ikq04.ethz.ch: Running global explorers +INFO: Running initial manifest /home/users/nico/p/cdist-nutzung/conf/manifest +INFO: ikq04.ethz.ch: Running object manifests and type explorers +/var/lib/cdist/conf/type/__file/explorer/.exists.swp: 1: Syntax error: ")" unexpected +Traceback (most recent call last): + File "/home/users/nico/oeffentlich/rechner/projekte/cdist/lib/cdist/exec/remote.py", line 147, in run_script + return subprocess.check_output(command).decode() + File "/usr/lib/python3.2/subprocess.py", line 518, in check_output + raise CalledProcessError(retcode, cmd, output=output) +subprocess.CalledProcessError: Command '['ssh', '-o', 'User=root', '-q', 'ikq04.ethz.ch', '__explorer=/var/lib/cdist/conf/explorer', '__object_fq=__file/etc/cdist-configured/.cdist', '__target_host=ikq04.ethz.ch', '__object_id=etc/cdist-configured', '__type_explorer=/var/lib/cdist/conf/type/__file/explorer', '__object=/var/lib/cdist/object/__file/etc/cdist-configured/.cdist', '/bin/sh', '-e', '/var/lib/cdist/conf/type/__file/explorer/.exists.swp']' returned non-zero exit status 2 + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "./bin/cdist", line 161, in + commandline() + File "./bin/cdist", line 103, in commandline + args.func(args) + File "./bin/cdist", line 106, in config + configinstall(args, mode=cdist.config.Config) + File "./bin/cdist", line 133, in configinstall + c.deploy_and_cleanup() + File "/home/users/nico/oeffentlich/rechner/projekte/cdist/lib/cdist/config_install.py", line 71, in deploy_and_cleanup + self.deploy_to() + File "/home/users/nico/oeffentlich/rechner/projekte/cdist/lib/cdist/config_install.py", line 65, in deploy_to + self.stage_prepare() + File "/home/users/nico/oeffentlich/rechner/projekte/cdist/lib/cdist/config_install.py", line 94, in stage_prepare + self.object_prepare(cdist_object) + File "/home/users/nico/oeffentlich/rechner/projekte/cdist/lib/cdist/config_install.py", line 122, in object_prepare + self.run_type_explorers(cdist_object) + File "/home/users/nico/oeffentlich/rechner/projekte/cdist/lib/cdist/config_install.py", line 115, in run_type_explorers + output = self.explorer.run_type_explorer(explorer, cdist_object) + File "/home/users/nico/oeffentlich/rechner/projekte/cdist/lib/cdist/core/explorer.py", line 135, in run_type_explorer + return self.remote.run_script(script, env=env, return_output=True) + File "/home/users/nico/oeffentlich/rechner/projekte/cdist/lib/cdist/exec/remote.py", line 151, in run_script + script_content = self.run(["cat", script], return_output=True) + File "/home/users/nico/oeffentlich/rechner/projekte/cdist/lib/cdist/exec/remote.py", line 97, in run + return self.run_command(cmd, env=env, return_output=return_output) + File "/home/users/nico/oeffentlich/rechner/projekte/cdist/lib/cdist/exec/remote.py", line 117, in run_command + return subprocess.check_output(command).decode() +UnicodeDecodeError: 'utf8' codec can't decode byte 0xb6 in position 17: invalid start byte + From d83de257749c7b5d080f8c0bf1fba0496319afd0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Sat, 15 Oct 2011 00:26:00 +0200 Subject: [PATCH 0819/1024] Stripp leading slash from requirements object_id Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 0b303b23..f861dfda 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -125,8 +125,10 @@ def run(argv): except IndexError: # no object id, must be singleton requirement_object_id = 'singleton' + # strip leading slash from object_id if requirement_object_id.startswith('/'): - raise IllegalRequirementError(requirement, 'requirements object_id may not start with /') + log.debug("Stripping leading slash from requirements object_id: %s", requirement) + requirement_object_id = requirement_object_id.lstrip('/') log.debug("Recording requirement: %s -> %s" % (cdist_object.path, requirement)) cdist_object.requirements.append(requirement) From 889e6c23cba937eef5106554521def5e5a486f77 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Sat, 15 Oct 2011 00:44:54 +0200 Subject: [PATCH 0820/1024] Explorer tracks which type explorers have been transferred instad of Type Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 5 +++-- lib/cdist/core/type.py | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index 90201072..f2bfc153 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -75,6 +75,7 @@ class Explorer(object): } if log.getEffectiveLevel() == logging.DEBUG: self.env.update({'__debug': "yes" }) + self._type_explorers_transferred = [] ### global @@ -105,14 +106,14 @@ class Explorer(object): def transfer_type_explorers(self, cdist_type): """Transfer the type explorers for the given type to the remote side.""" if cdist_type.explorers: - if cdist_type.explorers_transferred: + if cdist_type.name in self._type_explorers_transferred: log.debug("Skipping retransfer of type explorers for: %s", cdist_type) else: source = os.path.join(self.local.type_path, cdist_type.explorer_path) destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) self.remote.mkdir(destination) self.remote.transfer(source, destination) - cdist_type.explorers_transferred = True + self._type_explorers_transferred.append(cdist_type.name) def transfer_object_parameters(self, cdist_object): """Transfer the parameters for the given object to the remote side.""" diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index 6c3cd757..ce37769e 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -54,6 +54,7 @@ class Type(object): if not name in cls._instances: instance = super(Type, cls).__new__(cls) cls._instances[name] = instance + # return instance so __init__ is called return cls._instances[name] def __init__(self, base_path, name): @@ -67,8 +68,6 @@ class Type(object): self.gencode_remote_path = os.path.join(self.name, "gencode-remote") self.manifest_path = os.path.join(self.name, "manifest") - self.explorers_transferred = False - self.__explorers = None self.__required_parameters = None self.__optional_parameters = None From ad1e51cb2e75799831ed8d89ce1c2bc2bb8ac43a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 01:11:54 +0200 Subject: [PATCH 0821/1024] catch unicodedecodeerror Signed-off-by: Nico Schottelius --- lib/cdist/exec/remote.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index 9610290b..c876adf1 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -40,6 +40,13 @@ class RemoteScriptError(cdist.Error): def __str__(self): return "Remote script execution failed: %s %s" % (self.script, self.command) +class DecodeError(cdist.Error): + def __init__(self, command): + self.command = command + + def __str__(self): + return "Cannot decode output of " + " ".join(self.command) + class Remote(object): """Execute commands remotely. @@ -121,6 +128,8 @@ class Remote(object): raise cdist.Error("Command failed: " + " ".join(command)) except OSError as error: raise cdist.Error(" ".join(*args) + ": " + error.args[1]) + except UnicodeDecodeError: + raise DecodeError(command) def run_script(self, script, env=None, return_output=False): """Run the given script with the given environment on the remote side. From 67b109471257b11dc3d5c2b6bc844d0bcc2bb2c8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 01:25:57 +0200 Subject: [PATCH 0822/1024] flatten error message in remotescripterror as well Signed-off-by: Nico Schottelius --- lib/cdist/exec/remote.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index c876adf1..943b8992 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -38,7 +38,8 @@ class RemoteScriptError(cdist.Error): self.script_content = script_content def __str__(self): - return "Remote script execution failed: %s %s" % (self.script, self.command) + plain_command = " ".join(self.command) + return "Remote script execution failed: %s" % plain_command class DecodeError(cdist.Error): def __init__(self, command): From a415cc4b91e531ac6eb5a53c578403fd878d480c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 01:38:22 +0200 Subject: [PATCH 0823/1024] add correct logger in manifest Signed-off-by: Nico Schottelius --- lib/cdist/core/manifest.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index 8f9903a5..50964fdc 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -25,9 +25,6 @@ import os import cdist -log = logging.getLogger(__name__) - - ''' common: runs only locally, does not need remote @@ -68,13 +65,16 @@ class Manifest(object): def __init__(self, target_host, local): self.target_host = target_host self.local = local + + self.log = logging.getLogger(self.target_host) + self.env = { 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), '__target_host': self.target_host, '__global': self.local.out_path, '__cdist_type_base_path': self.local.type_path, # for use in type emulator } - if log.getEffectiveLevel() == logging.DEBUG: + if self.log.getEffectiveLevel() == logging.DEBUG: self.env.update({'__debug': "yes" }) @@ -83,7 +83,7 @@ class Manifest(object): env.update(self.env) env['__manifest'] = self.local.manifest_path env['__cdist_manifest'] = script - log.info("Running initial manifest " + self.local.manifest_path) + self.log.info("Running initial manifest " + self.local.manifest_path) self.local.run_script(script, env=env) def run_type_manifest(self, cdist_object): From 00a1f1eeb9b7c718eb451e366d7d42a8ecc9c6c0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 01:41:11 +0200 Subject: [PATCH 0824/1024] ++ more host prefixing log code Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 4 ++-- lib/cdist/core/explorer.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index ce7c5736..a71998f7 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -70,8 +70,8 @@ class ConfigInstall(object): start_time = time.time() self.deploy_to() self.cleanup() - self.log.info("Finished run of %s in %s seconds", - self.context.target_host, time.time() - start_time) + self.log.info("Finished run in %s seconds", + time.time() - start_time) def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index 90201072..b4f8531e 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -25,9 +25,6 @@ import os import cdist -log = logging.getLogger(__name__) - - ''' common: runs only remotely, needs local and remote to construct paths @@ -67,13 +64,16 @@ class Explorer(object): """ def __init__(self, target_host, local, remote): self.target_host = target_host + + self.log = logging.getLogger(target_host) + self.local = local self.remote = remote self.env = { '__target_host': self.target_host, '__explorer': self.remote.global_explorer_path, } - if log.getEffectiveLevel() == logging.DEBUG: + if self.log.getEffectiveLevel() == logging.DEBUG: self.env.update({'__debug': "yes" }) ### global @@ -106,7 +106,7 @@ class Explorer(object): """Transfer the type explorers for the given type to the remote side.""" if cdist_type.explorers: if cdist_type.explorers_transferred: - log.debug("Skipping retransfer of type explorers for: %s", cdist_type) + self.log.debug("Skipping retransfer of type explorers for: %s", cdist_type) else: source = os.path.join(self.local.type_path, cdist_type.explorer_path) destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) From e002710c4c8170a8a5e144b3bf559b3ba8eb4a91 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 02:31:40 +0200 Subject: [PATCH 0825/1024] rewrite emulator to class based approach for better logging Signed-off-by: Nico Schottelius --- bin/cdist | 7 +- lib/cdist/emulator.py | 191 ++++++++++++++++++++++++------------------ 2 files changed, 116 insertions(+), 82 deletions(-) diff --git a/bin/cdist b/bin/cdist index 88cdf399..4d93842e 100755 --- a/bin/cdist +++ b/bin/cdist @@ -145,6 +145,10 @@ def configinstall(args, mode): log.info("Total processing time for %s host(s): %s", len(args.host), (time_end - time_start)) +def emulator(): + """Prepare and run emulator""" + emulator = cdist.emulator.Emulator(sys.argv) + emulator.run() if __name__ == "__main__": try: @@ -152,7 +156,8 @@ if __name__ == "__main__": if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): import cdist.emulator - cdist.emulator.run(sys.argv) + + emulator() else: import cdist.banner import cdist.config diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 0b303b23..edf7ab1c 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -26,8 +26,6 @@ import os import cdist from cdist import core -log = logging.getLogger(__name__) - class IllegalRequirementError(cdist.Error): def __init__(self, requirement, message=None): @@ -37,100 +35,131 @@ class IllegalRequirementError(cdist.Error): def __str__(self): return '%s: %s' % (self.message, self.requirement) +class Emulator(object): + def __init__(self, argv): + self.argv = argv + self.object_id = False -def run(argv): - """Emulate type commands (i.e. __file and co)""" - global_path = os.environ['__global'] - object_source = os.environ['__cdist_manifest'] - target_host = os.environ['__target_host'] - type_name = os.path.basename(argv[0]) + self.global_path = os.environ['__global'] + self.object_source = os.environ['__cdist_manifest'] + self.target_host = os.environ['__target_host'] + self.type_base_path = os.environ['__cdist_type_base_path'] + + self.object_base_path = os.path.join(self.global_path, "object") - # Logsetup - FIXME: add object_fq as soon as setup! - #id = target_host + ": " + cdist_type + '/' + object_id - id = target_host + ": " - # logformat = '%(levelname)s: ' + target_host + ": " + cdist_type + '/' + object_id + ': %(message)s' - logformat = '%(levelname)s: ' + id + ': %(message)s' - logging.basicConfig(format=logformat) + self.type_name = os.path.basename(argv[0]) + self.cdist_type = core.Type(self.type_base_path, self.type_name) - if '__debug' in os.environ: - logging.root.setLevel(logging.DEBUG) - else: - logging.root.setLevel(logging.INFO) + self.__init_log() - object_base_path = os.path.join(global_path, "object") - type_base_path = os.environ['__cdist_type_base_path'] - cdist_type = core.Type(type_base_path, type_name) + def filter(self, record): + """Add hostname and object to logs via logging Filter""" - if '__install' in os.environ: - if not cdist_type.is_install: - log.debug("Running in install mode, ignoring non install type") - return True + prefix = self.target_host + ": " - parser = argparse.ArgumentParser(add_help=False) + if self.object_id: + prefix = prefix + self.type_name + "/" + self.object_id - for parameter in cdist_type.optional_parameters: - argument = "--" + parameter - parser.add_argument(argument, action='store', required=False) - for parameter in cdist_type.required_parameters: - argument = "--" + parameter - parser.add_argument(argument, action='store', required=True) + record.msg = prefix + ": " + record.msg - # If not singleton support one positional parameter - if not cdist_type.is_singleton: - parser.add_argument("object_id", nargs=1) + return True - # And finally verify parameter - args = parser.parse_args(argv[1:]) + def run(self): + """Emulate type commands (i.e. __file and co)""" - # Setup object_id - if cdist_type.is_singleton: - object_id = "singleton" - else: - object_id = args.object_id[0] - del args.object_id + if '__install' in os.environ: + if not self.cdist_type.is_install: + self.log.debug("Running in install mode, ignoring non install type") + return True - # strip leading slash from object_id - object_id = object_id.lstrip('/') + self.commandline() + self.setup_object() + self.record_requirements() + self.log.debug("Finished %s %s" % (self.cdist_object.path, self.parameters)) - # Instantiate the cdist object whe are defining - cdist_object = core.Object(cdist_type, object_base_path, object_id) + def __init_log(self): + """Setup logging facility""" + logformat = '%(levelname)s: %(message)s' + logging.basicConfig(format=logformat) - # FIXME: verify object id - log.debug('#### emulator args: %s' % args) + if '__debug' in os.environ: + logging.root.setLevel(logging.DEBUG) + else: + logging.root.setLevel(logging.INFO) - # Create object with given parameters - parameters = {} - for key,value in vars(args).items(): - if value is not None: - parameters[key] = value - - if cdist_object.exists: - if cdist_object.parameters != parameters: - raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s" - % (cdist_object, " ".join(cdist_object.source), cdist_object.parameters, object_source, parameters) + self.log = logging.getLogger(__name__) + self.log.addFilter(self) + + def commandline(self): + """Parse command line""" + + parser = argparse.ArgumentParser(add_help=False) + + for parameter in self.cdist_type.optional_parameters: + argument = "--" + parameter + parser.add_argument(argument, action='store', required=False) + for parameter in self.cdist_type.required_parameters: + argument = "--" + parameter + parser.add_argument(argument, action='store', required=True) + + # If not singleton support one positional parameter + if not self.cdist_type.is_singleton: + parser.add_argument("object_id", nargs=1) + + # And finally parse/verify parameter + self.args = parser.parse_args(self.argv[1:]) + self.log.debug('Emulator args: %s' % self.args) + + + def setup_object(self): + # FIXME: verify object id + + # Setup object_id + if self.cdist_type.is_singleton: + self.object_id = "singleton" + else: + self.object_id = self.args.object_id[0] + del self.args.object_id + + # strip leading slash from object_id + self.object_id = self.object_id.lstrip('/') + + # Instantiate the cdist object we are defining + self.cdist_object = core.Object(self.cdist_type, self.object_base_path, self.object_id) + + # Create object with given parameters + self.parameters = {} + for key,value in vars(self.args).items(): + if value is not None: + self.parameters[key] = value + + if self.cdist_object.exists: + if cdist_object.parameters != self.parameters: + raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s" + % (self.cdist_object, " ".join(self.cdist_object.source), self.cdist_object.parameters, self.object_source, self.parameters) ) - else: - cdist_object.create() - cdist_object.parameters = parameters + else: + self.cdist_object.create() + self.cdist_object.parameters = self.parameters - # Record requirements - if "require" in os.environ: - requirements = os.environ['require'] - for requirement in requirements.split(" "): - requirement_parts = requirement.split(os.sep, 1) - requirement_parts.reverse() - requirement_type_name = requirement_parts.pop() - try: - requirement_object_id = requirement_parts.pop() - except IndexError: - # no object id, must be singleton - requirement_object_id = 'singleton' - if requirement_object_id.startswith('/'): - raise IllegalRequirementError(requirement, 'requirements object_id may not start with /') - log.debug("Recording requirement: %s -> %s" % (cdist_object.path, requirement)) - cdist_object.requirements.append(requirement) + def record_requirements(self): + """record requirements""" - # Record / Append source - cdist_object.source.append(object_source) + if "require" in os.environ: + requirements = os.environ['require'] + for requirement in requirements.split(" "): + requirement_parts = requirement.split(os.sep, 1) + requirement_parts.reverse() + requirement_type_name = requirement_parts.pop() + try: + requirement_object_id = requirement_parts.pop() + except IndexError: + # no object id, must be singleton + requirement_object_id = 'singleton' + if requirement_object_id.startswith('/'): + raise IllegalRequirementError(requirement, 'requirements object_id may not start with /') + self.log.debug("Recording requirement: %s -> %s" % (self.cdist_object.path, requirement)) + self.cdist_object.requirements.append(requirement) - log.debug("Finished %s %s" % (cdist_object.path, parameters)) + # Record / Append source + self.cdist_object.source.append(self.object_source) From a7a3ee6f1908575dbe5d06b9ced6432acd7ffdea Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 02:36:33 +0200 Subject: [PATCH 0826/1024] adjust prefix Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index edf7ab1c..a5e9d306 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -55,10 +55,10 @@ class Emulator(object): def filter(self, record): """Add hostname and object to logs via logging Filter""" - prefix = self.target_host + ": " + prefix = self.target_host + ": (emulator)" if self.object_id: - prefix = prefix + self.type_name + "/" + self.object_id + prefix = prefix + " " + self.type_name + "/" + self.object_id record.msg = prefix + ": " + record.msg @@ -108,7 +108,7 @@ class Emulator(object): # And finally parse/verify parameter self.args = parser.parse_args(self.argv[1:]) - self.log.debug('Emulator args: %s' % self.args) + self.log.debug('Args: %s' % self.args) def setup_object(self): From 0dd38f75c28a8745259b1086a5e46e7d040edfc5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 02:46:28 +0200 Subject: [PATCH 0827/1024] remove leading / from object_id of requirement Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index a5e9d306..3aa8ab14 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -156,8 +156,8 @@ class Emulator(object): except IndexError: # no object id, must be singleton requirement_object_id = 'singleton' - if requirement_object_id.startswith('/'): - raise IllegalRequirementError(requirement, 'requirements object_id may not start with /') + + requirement_object_id = requirement_object_id.lstrip('/') self.log.debug("Recording requirement: %s -> %s" % (self.cdist_object.path, requirement)) self.cdist_object.requirements.append(requirement) From ee1c568c7bf832806e8201f1b0a15c4a7ce7eb52 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 02:54:54 +0200 Subject: [PATCH 0828/1024] almost finish correct requirement loading, but need sleep Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 7 ++- other/tests_reintegrate/test_exec.py | 79 ---------------------------- 2 files changed, 5 insertions(+), 81 deletions(-) delete mode 100644 other/tests_reintegrate/test_exec.py diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 3aa8ab14..70f491ac 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -148,8 +148,12 @@ class Emulator(object): if "require" in os.environ: requirements = os.environ['require'] for requirement in requirements.split(" "): + self.log.debug("Recording requirement: " + requirement) requirement_parts = requirement.split(os.sep, 1) - requirement_parts.reverse() + # FIXME: continue here + FAILHERE,PLEASE()[]! + print(requirement) + print(requirement_parts) requirement_type_name = requirement_parts.pop() try: requirement_object_id = requirement_parts.pop() @@ -158,7 +162,6 @@ class Emulator(object): requirement_object_id = 'singleton' requirement_object_id = requirement_object_id.lstrip('/') - self.log.debug("Recording requirement: %s -> %s" % (self.cdist_object.path, requirement)) self.cdist_object.requirements.append(requirement) # Record / Append source diff --git a/other/tests_reintegrate/test_exec.py b/other/tests_reintegrate/test_exec.py deleted file mode 100644 index c2bb52f6..00000000 --- a/other/tests_reintegrate/test_exec.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# 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 . -# -# - - -import os -import shutil -import tempfile -import unittest - -import cdist.exec - - -class ExecTestCase(unittest.TestCase): - def setUp(self): - """Create shell code and co.""" - - self.temp_dir = tempfile.mkdtemp() - self.shell_false = os.path.join(self.temp_dir, "shell_false") - self.shell_true = os.path.join(self.temp_dir, "shell_true") - - true_fd = open(self.shell_true, "w") - true_fd.writelines(["#!/bin/sh\n", "/bin/true"]) - true_fd.close() - - false_fd = open(self.shell_false, "w") - false_fd.writelines(["#!/bin/sh\n", "/bin/false"]) - false_fd.close() - - target_host = "does.not.exist" - remote_exec = "ssh -o User=root -q" - remote_copy = "scp -o User=root -q" - self.wrapper = cdist.exec.Wrapper(target_host, remote_exec, remote_copy) - - def tearDown(self): - shutil.rmtree(self.temp_dir) - - def test_local_success_shell(self): - try: - self.wrapper.shell_run_or_debug_fail(self.shell_true, [self.shell_true]) - except cdist.Error: - failed = True - else: - failed = False - self.assertFalse(failed) - - def test_local_fail_shell(self): - self.assertRaises(cdist.Error, self.wrapper.shell_run_or_debug_fail, - self.shell_false, [self.shell_false]) - - def test_local_success(self): - try: - self.wrapper.run_or_fail(["/bin/true"]) - except cdist.Error: - failed = True - else: - failed = False - self.assertFalse(failed) - - def test_local_fail(self): - self.assertRaises(cdist.Error, self.wrapper.run_or_fail, ["/bin/false"]) From 053903bb694043607cc540d972c5ecfd5b483a84 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 12:00:46 +0200 Subject: [PATCH 0829/1024] use instance logger in explorer Signed-off-by: Nico Schottelius --- lib/cdist/core/explorer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index 0ca7188b..2e13cc78 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -107,7 +107,7 @@ class Explorer(object): """Transfer the type explorers for the given type to the remote side.""" if cdist_type.explorers: if cdist_type.name in self._type_explorers_transferred: - log.debug("Skipping retransfer of type explorers for: %s", cdist_type) + self.log.debug("Skipping retransfer of type explorers for: %s", cdist_type) else: source = os.path.join(self.local.type_path, cdist_type.explorer_path) destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) From 92de3d2f101db1bfd3828b33b29c806c7bf90d0d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 23:23:30 +0200 Subject: [PATCH 0830/1024] need cdist module for various constens Signed-off-by: Nico Schottelius --- bin/cdist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/cdist b/bin/cdist index 4d93842e..5ea6c6ce 100755 --- a/bin/cdist +++ b/bin/cdist @@ -33,6 +33,8 @@ log = logging.getLogger("cdist") sys.path.insert(0, os.path.abspath( os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) +import cdist + TYPE_PREFIX = "__" def commandline(): From 5a72223ae3bf95518b23ab605be8e5fbca68cb46 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 23:23:57 +0200 Subject: [PATCH 0831/1024] strip away / in emulator in requirements Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index e94060eb..875d3153 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -147,21 +147,24 @@ class Emulator(object): if "require" in os.environ: requirements = os.environ['require'] + self.log.debug("reqs = " + requirements) for requirement in requirements.split(" "): + # Ignore empty fields - probably the only field anyway + if len(requirement) == 0: + continue + self.log.debug("Recording requirement: " + requirement) requirement_parts = requirement.split(os.sep, 1) - requirement_parts.reverse() - # FIXME: continue here - FAILHERE,PLEASE()[]! - print(requirement) - print(requirement_parts) - requirement_type_name = requirement_parts.pop() - try: - requirement_object_id = requirement_parts.pop() - except IndexError: - # no object id, must be singleton - requirement_object_id = 'singleton' + requirement_type_name = requirement_parts[0] + requirement_object_id = requirement_parts[1] + # FIXME: Add support for omitted object id == singleton + #if len(requirement_parts) == 1: + #except IndexError: + # # no object id, must be singleton + # requirement_object_id = 'singleton' + + # Remove / if existent in object id requirement_object_id = requirement_object_id.lstrip('/') self.cdist_object.requirements.append(requirement) From 42e1c21f430d6298b7263ad0dccba8a04224e7b8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 23:26:54 +0200 Subject: [PATCH 0832/1024] print progress output in info level for object prepare Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index a71998f7..0c1b6a6f 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -91,6 +91,7 @@ class ConfigInstall(object): self.log.debug("Skipping rerun of object %s", cdist_object) continue else: + self.log.info("Running manifest and explorer for " + cdist_object.name) self.object_prepare(cdist_object) new_objects_created = True From 950424d4781209ebdccba916c8fe8e4d3d99db54 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 23:29:27 +0200 Subject: [PATCH 0833/1024] move log output into correct function, also log object code run/gencode Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 0c1b6a6f..fe705b95 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -91,7 +91,6 @@ class ConfigInstall(object): self.log.debug("Skipping rerun of object %s", cdist_object) continue else: - self.log.info("Running manifest and explorer for " + cdist_object.name) self.object_prepare(cdist_object) new_objects_created = True @@ -119,14 +118,14 @@ class ConfigInstall(object): def object_prepare(self, cdist_object): """Prepare object: Run type explorer + manifest""" - self.log.debug("Preparing object: " + cdist_object.name) + self.log.info("Running manifest and explorers for " + cdist_object.name) self.run_type_explorers(cdist_object) self.manifest.run_type_manifest(cdist_object) cdist_object.prepared = True def object_run(self, cdist_object): """Run gencode and code for an object""" - self.log.debug("Running object %s", cdist_object) + self.log.info("Running gencode and code for " + cdist_object.name) # Catch requirements, which re-call us if cdist_object.ran: From 3c31b4f9a33ba9089a10caa6d91b7919be2689ea Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 15 Oct 2011 23:40:11 +0200 Subject: [PATCH 0834/1024] and finally also adjust the requirement itself Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 875d3153..ddd9dfdb 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -166,6 +166,9 @@ class Emulator(object): # Remove / if existent in object id requirement_object_id = requirement_object_id.lstrip('/') + + # Construct cleaned up requirement with only one / :-) + requirement = requirement_type_name + '/' + requirement_object_id self.cdist_object.requirements.append(requirement) # Record / Append source From 3883fe4247c4cbae5c6d9d4cfa8eef9a794f95db Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 00:12:32 +0200 Subject: [PATCH 0835/1024] raise cdist error instead of oserror Signed-off-by: Nico Schottelius --- lib/cdist/exec/local.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index 6157c0bc..264279a2 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -136,5 +136,7 @@ class Local(object): dst = os.path.join(self.bin_path, cdist_type.name) self.log.debug("Linking emulator: %s to %s", src, dst) - # FIXME: handle exceptions - os.symlink(src, dst) + try: + os.symlink(src, dst) + except OSError as e: + raise cdist.Error("Linking emulator from " + src + " to " + dst + " failed: " + e.__str__()) From 72687b5aeb1fd80f21874013e62c085c58aa45d1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 00:12:51 +0200 Subject: [PATCH 0836/1024] create new method to encapsulate configinstall run of one host Signed-off-by: Nico Schottelius --- bin/cdist | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/bin/cdist b/bin/cdist index 5ea6c6ce..5179734d 100755 --- a/bin/cdist +++ b/bin/cdist @@ -22,6 +22,7 @@ import argparse import logging +import multiprocessing import os import re import sys @@ -116,37 +117,44 @@ def configinstall(args, mode): time_start = time.time() - import cdist.context - for host in args.host: - context = cdist.context.Context( - target_host=host, - initial_manifest=args.manifest, - base_path=args.cdist_home, - exec_path=sys.argv[0], - debug=args.debug) - - c = mode(context) if args.parallel: log.debug("Creating child process for %s", host) - process[host] = multiprocessing.Process(target=c.deploy_and_cleanup) + process[host] = multiprocessing.Process(target=configinstall_onehost, args=(host, args, mode)) process[host].start() else: - c.deploy_and_cleanup() - - context.cleanup() + configinstall_onehost(host, args, mode) + # FIXME: error handling for parallel mode! if args.parallel: for p in process.keys(): log.debug("Joining process %s", p) process[p].join() - # FIXME: error handling for parallel mode! time_end = time.time() log.info("Total processing time for %s host(s): %s", len(args.host), (time_end - time_start)) + +def configinstall_onehost(host, args, mode): + """Configure or install remote system""" + process = {} + + import cdist.context + + context = cdist.context.Context( + target_host=host, + 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() + + def emulator(): """Prepare and run emulator""" emulator = cdist.emulator.Emulator(sys.argv) @@ -168,6 +176,7 @@ if __name__ == "__main__": commandline() except KeyboardInterrupt: + # FIXME: catch children if in parallel mode sys.exit(0) except cdist.Error as e: log.error(e) From 15ae422cb28bd7db918b7b96a2ebbaede6c21dc2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 00:15:41 +0200 Subject: [PATCH 0837/1024] catch cdist errors in emulator or config install, not in main, because catching there does not work in multiprocess env Signed-off-by: Nico Schottelius --- bin/cdist | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/bin/cdist b/bin/cdist index 5179734d..7ff19943 100755 --- a/bin/cdist +++ b/bin/cdist @@ -40,6 +40,10 @@ TYPE_PREFIX = "__" def commandline(): """Parse command line""" + import cdist.banner + import cdist.config + import cdist.install + # Construct parser others can reuse parser = {} # Options _all_ parsers have in common @@ -141,43 +145,44 @@ def configinstall_onehost(host, args, mode): """Configure or install remote system""" process = {} - import cdist.context + try: + import cdist.context - context = cdist.context.Context( - target_host=host, - initial_manifest=args.manifest, - base_path=args.cdist_home, - exec_path=sys.argv[0], - debug=args.debug) + context = cdist.context.Context( + target_host=host, + 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() + c = mode(context) + c.deploy_and_cleanup() + context.cleanup() + except cdist.Error as e: + log.error(e) + sys.exit(1) def emulator(): """Prepare and run emulator""" - emulator = cdist.emulator.Emulator(sys.argv) - emulator.run() + try: + import cdist.emulator + emulator = cdist.emulator.Emulator(sys.argv) + emulator.run() + + except cdist.Error as e: + log.error(e) + sys.exit(1) if __name__ == "__main__": try: logging.basicConfig(format='%(levelname)s: %(message)s') if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): - import cdist.emulator - emulator() else: - import cdist.banner - import cdist.config - import cdist.install - commandline() except KeyboardInterrupt: # FIXME: catch children if in parallel mode sys.exit(0) - except cdist.Error as e: - log.error(e) - sys.exit(1) From 46fdc5ca6e63a5c641393091ea5fca5f74948a48 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 00:21:24 +0200 Subject: [PATCH 0838/1024] ugly output on random ctrl-c actions Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-16keyboardirqoutputs | 76 +++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 doc/dev/logs/2011-10-16keyboardirqoutputs diff --git a/doc/dev/logs/2011-10-16keyboardirqoutputs b/doc/dev/logs/2011-10-16keyboardirqoutputs new file mode 100644 index 00000000..187487de --- /dev/null +++ b/doc/dev/logs/2011-10-16keyboardirqoutputs @@ -0,0 +1,76 @@ +1) + +[0:19] brief:~% ./p/cdist/bin/cdist config -v localhost +INFO: localhost: Running global explorers +INFO: localhost: Running initial manifest /home/users/nico/oeffentlich/rechner/projekte/cdist/conf/manifest +^Chandling in config +Traceback (most recent call last): + File "/usr/lib/python3.2/functools.py", line 176, in wrapper + result = cache[key] +KeyError: (, '[ \\f\\t]*(\\\\\\r?\\n[ \\f\\t]*)*(#[^\\r\\n]*)?((([0-9]+[jJ]|(([0-9]+\\.[0-9]*|\\.[0-9]+)([eE][-+]?[0-9]+)?|[0-9]+[eE][-+]?[0-9]+)[jJ])|(([0-9]+\\.[0-9]*|\\.[0-9]+)([eE][-+]?[0-9]+)?|[0-9]+[eE][-+]?[0-9]+)|(0[xX][0-9a-fA-F]+|0[bB][01]+|0[oO][0-7]+|(?:0+|[1-9][0-9]*)))|((\\*\\*=?|>>=?|<<=?|!=|//=?|->|[+\\-*/%&|^=<>]=?|~)|[][(){}]|(\\r?\\n|\\.\\.\\.|[:;.,@]))|([bB]?[rR]?\'[^\\n\'\\\\]*(?:\\\\.[^\\n\'\\\\]*)*\'|[bB]?[rR]?"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*")|\\w+)', 32) + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/usr/lib/python3.2/site.py", line 58, in + import traceback + File "/usr/lib/python3.2/traceback.py", line 3, in + import linecache + File "/usr/lib/python3.2/linecache.py", line 10, in + import tokenize + File "/usr/lib/python3.2/tokenize.py", line 118, in + _compile, (Token, PseudoToken, Single3, Double3)) + File "/usr/lib/python3.2/tokenize.py", line 115, in _compile + return re.compile(expr, re.UNICODE) + File "/usr/lib/python3.2/re.py", line 206, in compile + return _compile(pattern, flags) + File "/usr/lib/python3.2/re.py", line 255, in _compile + return _compile_typed(type(pattern), pattern, flags) + File "/usr/lib/python3.2/functools.py", line 180, in wrapper + result = user_function(*args, **kwds) + File "/usr/lib/python3.2/re.py", line 267, in _compile_typed + return sre_compile.compile(pattern, flags) + File "/usr/lib/python3.2/sre_compile.py", line 495, in compile + code = _code(p, flags) + File "/usr/lib/python3.2/sre_compile.py", line 477, in _code + _compile_info(code, p, flags) + File "/usr/lib/python3.2/sre_compile.py", line 366, in _compile_info +[0:19] brief:~% lo, hi = pattern.getwidth() + File "/usr/lib/python3.2/sre_parse.py", line 163, in getwidth + i, j = av[1].getwidth() + File "/usr/lib/python3.2/sre_parse.py", line 153, in getwidth + l, h = av.getwidth() + File "/usr/lib/python3.2/sre_parse.py", line 163, in getwidth + i, j = av[1].getwidth() + File "/usr/lib/python3.2/sre_parse.py", line 153, in getwidth + l, h = av.getwidth() + File "/usr/lib/python3.2/sre_parse.py", line 163, in getwidth + i, j = av[1].getwidth() + File "/usr/lib/python3.2/sre_parse.py", line 153, in getwidth + l, h = av.getwidth() + File "/usr/lib/python3.2/sre_parse.py", line 163, in getwidth + i, j = av[1].getwidth() + File "/usr/lib/python3.2/sre_parse.py", line 153, in getwidth + l, h = av.getwidth() + File "/usr/lib/python3.2/sre_parse.py", line 163, in getwidth + i, j = av[1].getwidth() + File "/usr/lib/python3.2/sre_parse.py", line 148, in getwidth + for op, av in self.data: +KeyboardInterrupt + +2) +[0:19] brief:~% ./p/cdist/bin/cdist config -v localhost +INFO: localhost: Running global explorers +INFO: localhost: Running initial manifest /home/users/nico/oeffentlich/rechner/projekte/cdist/conf/manifest +^CFatal Python error: Py_Initialize: can't initialize sys standard streams +Traceback (most recent call last): + File "/usr/lib/python3.2/io.py", line 60, in +handling in config + import _io + File "/usr/lib/python3.2/os.py", line 26, in +[0:19] brief:~% import sys, errno +KeyboardInterrupt +/home/users/nico/oeffentlich/rechner/projekte/cdist/conf/manifest/init: line 6: 8370 Aborted __directory /tmp/foo/bar --parents yes --owner nico --group postdrop --recursive yes + +[0:19] brief:~% + From e8a81551f8408623ac07da9ba6ce8ada0b022f53 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 00:31:52 +0200 Subject: [PATCH 0839/1024] implement error reporting for failed hosts at the end Signed-off-by: Nico Schottelius --- bin/cdist | 50 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/bin/cdist b/bin/cdist index 7ff19943..ad2cb858 100755 --- a/bin/cdist +++ b/bin/cdist @@ -117,28 +117,45 @@ def install(args): def configinstall(args, mode): """Configure or install remote system""" - process = {} + try: + process = {} + failed_hosts = [] + time_start = time.time() - 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)) + process[host].start() + else: + configinstall_onehost(host, args, mode) - 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)) - process[host].start() - else: - configinstall_onehost(host, args, mode) + for p in process.keys(): + log.debug("Joining process %s", p) + process[p].join() - # FIXME: error handling for parallel mode! - if args.parallel: - for p in process.keys(): - log.debug("Joining process %s", p) - process[p].join() + if not process[p].exitcode == 0: + failed_hosts.append(p) + if len(failed_hosts) > 0: + log.warn("Failed to deploy to the following hosts: " + + " ".join(failed_hosts)) - time_end = time.time() - log.info("Total processing time for %s host(s): %s", len(args.host), - (time_end - time_start)) + time_end = time.time() + log.info("Total processing time for %s host(s): %s", len(args.host), + (time_end - time_start)) + + except KeyboardInterrupt: + print("handling in config") + if args.parallel: + for p in process.keys(): + log.debug("Terminating process %s", p) + # FIXME: check whether alive or just terminate? + process[p].terminate() + + # FIXME: catch children if in parallel mode + sys.exit(0) def configinstall_onehost(host, args, mode): @@ -185,4 +202,5 @@ if __name__ == "__main__": except KeyboardInterrupt: # FIXME: catch children if in parallel mode + print("handling in main") sys.exit(0) From 84e102eb29466f3cab0f8c5a1595923d7e0c5af1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 00:45:37 +0200 Subject: [PATCH 0840/1024] also report failed hosts in sequential mode, terminate processes on interrupt, continue deploy even if one or more hosts failed Signed-off-by: Nico Schottelius --- bin/cdist | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/bin/cdist b/bin/cdist index ad2cb858..650ad853 100755 --- a/bin/cdist +++ b/bin/cdist @@ -128,7 +128,8 @@ def configinstall(args, mode): process[host] = multiprocessing.Process(target=configinstall_onehost, args=(host, args, mode)) process[host].start() else: - configinstall_onehost(host, args, mode) + if not configinstall_onehost(host, args, mode): + failed_hosts.append(host) if args.parallel: for p in process.keys(): @@ -147,20 +148,16 @@ def configinstall(args, mode): (time_end - time_start)) except KeyboardInterrupt: - print("handling in config") if args.parallel: for p in process.keys(): - log.debug("Terminating process %s", p) - # FIXME: check whether alive or just terminate? + log.warn("Terminating deploy " + p + "(" + p.pid + ")") process[p].terminate() - # FIXME: catch children if in parallel mode sys.exit(0) def configinstall_onehost(host, args, mode): - """Configure or install remote system""" - process = {} + """Configure or install ONE remote system""" try: import cdist.context @@ -178,7 +175,9 @@ def configinstall_onehost(host, args, mode): except cdist.Error as e: log.error(e) - sys.exit(1) + return False + + return True def emulator(): """Prepare and run emulator""" @@ -201,6 +200,6 @@ if __name__ == "__main__": commandline() except KeyboardInterrupt: - # FIXME: catch children if in parallel mode - print("handling in main") sys.exit(0) + + sys.exit(0) From 7b770b7b357071cd62746ce0367c5cbacc92469d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 00:49:04 +0200 Subject: [PATCH 0841/1024] correctly report pid when killing subprocess Signed-off-by: Nico Schottelius --- bin/cdist | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 650ad853..9786960c 100755 --- a/bin/cdist +++ b/bin/cdist @@ -150,7 +150,8 @@ def configinstall(args, mode): except KeyboardInterrupt: if args.parallel: for p in process.keys(): - log.warn("Terminating deploy " + p + "(" + p.pid + ")") + pid = process[p].pid.__str__() + log.warn("Terminating deploy " + p + " (" + pid + ")") process[p].terminate() sys.exit(0) From a587975a99373e0c1c79940e95fc9d9104f41380 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 01:05:47 +0200 Subject: [PATCH 0842/1024] catch keyboardirq in parallel mode, so it's not raised into multiprocess Signed-off-by: Nico Schottelius --- bin/cdist | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index 9786960c..c00bb73a 100755 --- a/bin/cdist +++ b/bin/cdist @@ -125,10 +125,10 @@ def configinstall(args, mode): 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)) + process[host] = multiprocessing.Process(target=configinstall_onehost, args=(host, args, mode, True)) process[host].start() else: - if not configinstall_onehost(host, args, mode): + if not configinstall_onehost(host, args, mode, parallel=False): failed_hosts.append(host) if args.parallel: @@ -157,7 +157,7 @@ def configinstall(args, mode): sys.exit(0) -def configinstall_onehost(host, args, mode): +def configinstall_onehost(host, args, mode, parallel): """Configure or install ONE remote system""" try: @@ -177,6 +177,10 @@ def configinstall_onehost(host, args, mode): except cdist.Error as e: log.error(e) return False + except KeyboardInterrupt: + # Do not care in sequential mode, catch in parallel mode + if not parallel: + raise return True From 1d1bff88b7e0af70447eae1f0b859ffce1a1e2c3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 01:06:33 +0200 Subject: [PATCH 0843/1024] just as a marker: return false, so in theory even multiprocess noticed that we did something stuped Signed-off-by: Nico Schottelius --- bin/cdist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/cdist b/bin/cdist index c00bb73a..a07763f9 100755 --- a/bin/cdist +++ b/bin/cdist @@ -181,6 +181,8 @@ def configinstall_onehost(host, args, mode, parallel): # Do not care in sequential mode, catch in parallel mode if not parallel: raise + else: + return False return True From ede8fd7518ef228aac1737118cc32783882aff44 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 01:14:17 +0200 Subject: [PATCH 0844/1024] ++output errors Signed-off-by: Nico Schottelius --- ...qoutputs => 2011-10-16.keyboardirqoutputs} | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) rename doc/dev/logs/{2011-10-16keyboardirqoutputs => 2011-10-16.keyboardirqoutputs} (52%) diff --git a/doc/dev/logs/2011-10-16keyboardirqoutputs b/doc/dev/logs/2011-10-16.keyboardirqoutputs similarity index 52% rename from doc/dev/logs/2011-10-16keyboardirqoutputs rename to doc/dev/logs/2011-10-16.keyboardirqoutputs index 187487de..5d843dac 100644 --- a/doc/dev/logs/2011-10-16keyboardirqoutputs +++ b/doc/dev/logs/2011-10-16.keyboardirqoutputs @@ -74,3 +74,70 @@ KeyboardInterrupt [0:19] brief:~% +3) + +[1:12] brief:cdist% ./bin/cdist config -vp -c ~/p/cdist-nutzung ikq05.ethz.ch ikq06.ethz.ch ikq07.ethz.ch +INFO: ikq06.ethz.ch: Running global explorers +INFO: ikq05.ethz.ch: Running global explorers +INFO: ikq07.ethz.ch: Running global explorers +INFO: ikq07.ethz.ch: Running initial manifest /home/users/nico/p/cdist-nutzung/conf/manifest +INFO: ikq06.ethz.ch: Running initial manifest /home/users/nico/p/cdist-nutzung/conf/manifest +INFO: ikq05.ethz.ch: Running initial manifest /home/users/nico/p/cdist-nutzung/conf/manifest +INFO: ikq07.ethz.ch: Running object manifests and type explorers +INFO: ikq07.ethz.ch: Running manifest and explorers for __ethz_collectd/singleton +INFO: ikq05.ethz.ch: Running object manifests and type explorers +INFO: ikq05.ethz.ch: Running manifest and explorers for __ethz_collectd/singleton +^Ccatch, ikq05.ethz.ch +catch, ikq07.ethz.ch +[1:12] brief:cdist% ./bin/cdist config -vp -c ~/p/cdist-nutzung ikq05.ethz.ch ikq06.ethz.ch ikq07.ethz.ch +INFO: ikq05.ethz.ch: Running global explorers +INFO: ikq06.ethz.ch: Running global explorers +INFO: ikq07.ethz.ch: Running global explorers +INFO: ikq05.ethz.ch: Running initial manifest /home/users/nico/p/cdist-nutzung/conf/manifest +INFO: ikq06.ethz.ch: Running initial manifest /home/users/nico/p/cdist-nutzung/conf/manifest +INFO: ikq07.ethz.ch: Running initial manifest /home/users/nico/p/cdist-nutzung/conf/manifest +^CTraceback (most recent call last): + File "/usr/lib/python3.2/site.py", line 529, in +catch, ikq05.ethz.ch +Fatal Python error: Py_Initialize: can't initialize sys standard streams +Traceback (most recent call last): + File "/usr/lib/python3.2/io.py", line 60, in +catch, ikq07.ethz.ch + main() + File "/usr/lib/python3.2/site.py", line 517, in main +catch, ikq06.ethz.ch + known_paths = addusersitepackages(known_paths) + File "/usr/lib/python3.2/site.py", line 263, in addusersitepackages +Fatal Python error: Py_Initialize: can't initialize sys standard streams +Traceback (most recent call last): + File "/usr/lib/python3.2/io.py", line 60, in + user_site = getusersitepackages() + File "/usr/lib/python3.2/site.py", line 238, in getusersitepackages + user_base = getuserbase() # this will also set USER_BASE + File "/usr/lib/python3.2/site.py", line 228, in getuserbase + USER_BASE = get_config_var('userbase') + File "/usr/lib/python3.2/sysconfig.py", line 577, in get_config_var + return get_config_vars().get(name) + File "/usr/lib/python3.2/sysconfig.py", line 474, in get_config_vars + _init_posix(_CONFIG_VARS) + File "/usr/lib/python3.2/sysconfig.py", line 344, in _init_posix + parse_config_h(f, vars) + File "/usr/lib/python3.2/sysconfig.py", line 386, in parse_config_h + line = fp.readline() + File "/usr/lib/python3.2/codecs.py", line 302, in decode + self.buffer = data[consumed:] +KeyboardInterrupt + import _io + File "/usr/lib/python3.2/os.py", line 49, in + import posixpath as path + File "/usr/lib/python3.2/posixpath.py", line 11, in + import _io + File "/usr/lib/python3.2/os.py", line 44, in + """ from posix import * +KeyboardInterrupt +/home/users/nico/p/cdist-nutzung/conf/manifest/init: line 10: 19830 Aborted __ethz_systems_root_via_ssh $ik --state present + +KeyboardInterrupt +[1:12] brief:cdist% /home/users/nico/p/cdist-nutzung/conf/manifest/init: line 10: 19829 Aborted __ethz_systems_root_via_ssh $ik --state present + + From dbdf036787a00c16919b2cfdbad9ef7bb01614c0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 12:04:04 +0200 Subject: [PATCH 0845/1024] do not need to use terminate()/SIGTERM Signed-off-by: Nico Schottelius --- bin/cdist | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index a07763f9..14cff65a 100755 --- a/bin/cdist +++ b/bin/cdist @@ -150,9 +150,12 @@ def configinstall(args, mode): except KeyboardInterrupt: if args.parallel: for p in process.keys(): - pid = process[p].pid.__str__() - log.warn("Terminating deploy " + p + " (" + pid + ")") - process[p].terminate() + # NOT needed: KeyBoardInterrupet (aka SIGINT) + # is forwarded to processes spawned by multiprocess! + # pid = process[p].pid.__str__() + #log.warn("Terminating deploy " + p + " (" + pid + ")") + # process[p].terminate() + pass sys.exit(0) @@ -182,6 +185,7 @@ def configinstall_onehost(host, args, mode, parallel): if not parallel: raise else: + # Catch here, above does not need to know about our errors return False return True From 32b2c49d32c5d4ad7f2b53062dc3e19ee0d5761a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 12:39:06 +0200 Subject: [PATCH 0846/1024] found 2 bugs in transfer_code_remote Signed-off-by: Nico Schottelius --- lib/cdist/core/code.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index 0f2591b3..2505925c 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -121,6 +121,10 @@ class Code(object): """Transfer the code_remote script for the given object to the remote side.""" source = os.path.join(self.local.object_path, cdist_object.code_remote_path) destination = os.path.join(self.remote.object_path, cdist_object.code_remote_path) + # FIXME: BUG: do not create destination, but top level of destination! + # FIXME: BUG2: we are called AFTER the code-remote has been transferred already: + # mkdir: cannot create directory `/var/lib/cdist/object/__directory/etc/acpi/actions/.cdist/code-remote': File exists + # OR: this is from previous run -> cleanup missing! self.remote.mkdir(destination) self.remote.transfer(source, destination) From 420b6aeae7ac700870951c75ba9a4cd5130b56d4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 15:08:00 +0200 Subject: [PATCH 0847/1024] ensure object is not ran twice Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index fe705b95..fa5cf2b0 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -88,7 +88,7 @@ class ConfigInstall(object): for cdist_object in core.Object.list_objects(self.local.object_path, self.local.type_path): if cdist_object.prepared: - self.log.debug("Skipping rerun of object %s", cdist_object) + self.log.debug("Skipping re-prepare of object %s", cdist_object) continue else: self.object_prepare(cdist_object) @@ -128,8 +128,11 @@ class ConfigInstall(object): self.log.info("Running gencode and code for " + cdist_object.name) # Catch requirements, which re-call us + # FIXME: change .ran to running if cdist_object.ran: return + else: + cdist_object.ran = True cdist_type = cdist_object.type From 69293efd0053a25ca4d8c7182b88c720c162c595 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 15:27:03 +0200 Subject: [PATCH 0848/1024] --todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 520128cc..8f5c6e4f 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,6 +1,5 @@ 2.0.3: -- fix emulator / require - sanity checks: implement tests stage_run() From eb7234df51c947091bd9c86e7703be4cb432d6ad Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 16:05:58 +0200 Subject: [PATCH 0849/1024] also publish to sourceforge Signed-off-by: Nico Schottelius --- build | 1 + 1 file changed, 1 insertion(+) diff --git a/build b/build index 69f0ad92..9e9fbf21 100755 --- a/build +++ b/build @@ -114,6 +114,7 @@ case "$1" in p|pu|pub) git push --mirror git push --mirror github + git push --mirror sf ;; clean) From 4e6c3ee686e83b67b958ffb93440a4a704b064c2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 16:11:22 +0200 Subject: [PATCH 0850/1024] ++mirror Signed-off-by: Nico Schottelius --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 3dff690f..91f1efa1 100644 --- a/README +++ b/README @@ -171,6 +171,7 @@ may vanish at any point. To select a specific branch use ### Mirrors * git://github.com/telmich/cdist.git ([github](https://github.com/telmich/cdist)) + * git://git.code.sf.net/p/cdist/code ([sourceforge](https://sourceforge.net/p/cdist/code) ## Update From 65a82b517cc58792ad0c89cb177ace2afb718c1c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 16:20:35 +0200 Subject: [PATCH 0851/1024] --typo Signed-off-by: Nico Schottelius --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 91f1efa1..1c2139cc 100644 --- a/README +++ b/README @@ -171,7 +171,7 @@ may vanish at any point. To select a specific branch use ### Mirrors * git://github.com/telmich/cdist.git ([github](https://github.com/telmich/cdist)) - * git://git.code.sf.net/p/cdist/code ([sourceforge](https://sourceforge.net/p/cdist/code) + * git://git.code.sf.net/p/cdist/code ([sourceforge](https://sourceforge.net/p/cdist/code)) ## Update From 03ea7787d2bf55212e33e077fe7d4970f50b1422 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 18:38:22 +0200 Subject: [PATCH 0852/1024] +self Signed-off-by: Nico Schottelius --- lib/cdist/emulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index ddd9dfdb..103ea8c0 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -134,7 +134,7 @@ class Emulator(object): self.parameters[key] = value if self.cdist_object.exists: - if cdist_object.parameters != self.parameters: + if self.cdist_object.parameters != self.parameters: raise cdist.Error("Object %s already exists with conflicting parameters:\n%s: %s\n%s: %s" % (self.cdist_object, " ".join(self.cdist_object.source), self.cdist_object.parameters, self.object_source, self.parameters) ) From 0700fc6bc9f737211a83167273f264b762f641d1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 18:43:52 +0200 Subject: [PATCH 0853/1024] cleanup needed here as well Signed-off-by: Nico Schottelius --- .../nico/conf/type/__nico_afs/files/afs/CellServDB | 0 .../nico/conf/type/__nico_afs/files/afs/ThisCell | 0 .../nico/conf/type/__nico_afs/files/krb5/krb5.conf | 0 .../nico/conf/type/__nico_afs/files/ssh/JAS.pub | 0 .../nico/conf/type/__nico_afs/files/ssh/bugblue.pub | 0 .../nico/conf/type/__nico_afs/files/ssh/docsteel.pub | 0 .../nico/conf/type/__nico_afs/files/ssh/downhill.pub | 0 .../nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub | 0 .../nico/conf/type/__nico_afs/manifest | 0 .../nico/conf/type/__nico_afs/singleton | 0 .../nico/conf/type/__nico_desktop/files/hostname | 0 .../nico/conf/type/__nico_desktop/files/slim-preseed | 0 .../nico/conf/type/__nico_desktop/manifest | 0 .../nico/conf/type/__nico_desktop/parameter/required | 0 .../nico/conf/type/__nico_desktop/singleton | 0 .../nico/conf/type/__nico_mpd/files/slim-preseed | 0 .../nico/conf/type/__nico_mpd/manifest | 0 .../nico/conf/type/__nico_mpd/parameter/required | 0 .../nico/conf/type/__nico_mpd/singleton | 0 .../nico/conf/type/__nico_network/files/interfaces-eth0 | 0 .../nico/conf/type/__nico_network/files/interfaces-wlan0 | 0 .../nico/conf/type/__nico_network/manifest | 0 .../nico/conf/type/__nico_network/parameter/required | 0 .../nico/conf/type/__nico_network/singleton | 0 .../nico/conf/type/__nico_nfs_client/files/slim-preseed | 0 .../nico/conf/type/__nico_nfs_client/manifest | 0 .../nico/conf/type/__nico_nfs_client/singleton | 0 .../nico/conf/type/__nico_notebook/manifest | 0 .../nico/conf/type/__nico_notebook/singleton | 0 .../nico/conf/type/__nico_packages/manifest | 0 .../nico/conf/type/__nico_packages/singleton | 0 .../nico/conf/type/__nico_sudo/files/sudo-nico | 0 .../nico/conf/type/__nico_sudo/manifest | 0 .../nico/conf/type/__nico_sudo/parameter/gencode | 0 .../nico/conf/type/__nico_sudo/parameter/manifest | 0 .../nico/conf/type/__nico_sudo/parameter/optional | 0 .../nico/conf/type/__nico_sudo/parameter/required | 0 .../nico/conf/type/__nico_sudo/singleton | 0 .../nico/conf/type/__nico_tee/files/99-apt-nico | 0 .../nico/conf/type/__nico_tee/files/hostname | 0 .../nico/conf/type/__nico_tee/manifest | 0 .../nico/conf/type/__nico_tee/singleton | 0 42 files changed, 0 insertions(+), 0 deletions(-) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_afs/files/afs/CellServDB (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_afs/files/afs/ThisCell (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_afs/files/krb5/krb5.conf (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_afs/files/ssh/JAS.pub (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_afs/files/ssh/bugblue.pub (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_afs/files/ssh/docsteel.pub (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_afs/files/ssh/downhill.pub (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_afs/manifest (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_afs/singleton (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_desktop/files/hostname (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_desktop/files/slim-preseed (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_desktop/manifest (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_desktop/parameter/required (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_desktop/singleton (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_mpd/files/slim-preseed (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_mpd/manifest (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_mpd/parameter/required (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_mpd/singleton (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_network/files/interfaces-eth0 (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_network/files/interfaces-wlan0 (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_network/manifest (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_network/parameter/required (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_network/singleton (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_nfs_client/files/slim-preseed (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_nfs_client/manifest (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_nfs_client/singleton (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_notebook/manifest (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_notebook/singleton (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_packages/manifest (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_packages/singleton (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_sudo/files/sudo-nico (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_sudo/manifest (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_sudo/parameter/gencode (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_sudo/parameter/manifest (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_sudo/parameter/optional (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_sudo/parameter/required (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_sudo/singleton (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_tee/files/99-apt-nico (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_tee/files/hostname (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_tee/manifest (100%) rename other/{examples => examples_needing_cleanup}/nico/conf/type/__nico_tee/singleton (100%) diff --git a/other/examples/nico/conf/type/__nico_afs/files/afs/CellServDB b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/afs/CellServDB similarity index 100% rename from other/examples/nico/conf/type/__nico_afs/files/afs/CellServDB rename to other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/afs/CellServDB diff --git a/other/examples/nico/conf/type/__nico_afs/files/afs/ThisCell b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/afs/ThisCell similarity index 100% rename from other/examples/nico/conf/type/__nico_afs/files/afs/ThisCell rename to other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/afs/ThisCell diff --git a/other/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/krb5/krb5.conf similarity index 100% rename from other/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf rename to other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/krb5/krb5.conf diff --git a/other/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/JAS.pub similarity index 100% rename from other/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub rename to other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/JAS.pub diff --git a/other/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/bugblue.pub similarity index 100% rename from other/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub rename to other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/bugblue.pub diff --git a/other/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/docsteel.pub similarity index 100% rename from other/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub rename to other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/docsteel.pub diff --git a/other/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/downhill.pub similarity index 100% rename from other/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub rename to other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/downhill.pub diff --git a/other/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub similarity index 100% rename from other/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub rename to other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub diff --git a/other/examples/nico/conf/type/__nico_afs/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/manifest similarity index 100% rename from other/examples/nico/conf/type/__nico_afs/manifest rename to other/examples_needing_cleanup/nico/conf/type/__nico_afs/manifest diff --git a/other/examples/nico/conf/type/__nico_afs/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/singleton similarity index 100% rename from other/examples/nico/conf/type/__nico_afs/singleton rename to other/examples_needing_cleanup/nico/conf/type/__nico_afs/singleton diff --git a/other/examples/nico/conf/type/__nico_desktop/files/hostname b/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/files/hostname similarity index 100% rename from other/examples/nico/conf/type/__nico_desktop/files/hostname rename to other/examples_needing_cleanup/nico/conf/type/__nico_desktop/files/hostname diff --git a/other/examples/nico/conf/type/__nico_desktop/files/slim-preseed b/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/files/slim-preseed similarity index 100% rename from other/examples/nico/conf/type/__nico_desktop/files/slim-preseed rename to other/examples_needing_cleanup/nico/conf/type/__nico_desktop/files/slim-preseed diff --git a/other/examples/nico/conf/type/__nico_desktop/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/manifest similarity index 100% rename from other/examples/nico/conf/type/__nico_desktop/manifest rename to other/examples_needing_cleanup/nico/conf/type/__nico_desktop/manifest diff --git a/other/examples/nico/conf/type/__nico_desktop/parameter/required b/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/parameter/required similarity index 100% rename from other/examples/nico/conf/type/__nico_desktop/parameter/required rename to other/examples_needing_cleanup/nico/conf/type/__nico_desktop/parameter/required diff --git a/other/examples/nico/conf/type/__nico_desktop/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/singleton similarity index 100% rename from other/examples/nico/conf/type/__nico_desktop/singleton rename to other/examples_needing_cleanup/nico/conf/type/__nico_desktop/singleton diff --git a/other/examples/nico/conf/type/__nico_mpd/files/slim-preseed b/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/files/slim-preseed similarity index 100% rename from other/examples/nico/conf/type/__nico_mpd/files/slim-preseed rename to other/examples_needing_cleanup/nico/conf/type/__nico_mpd/files/slim-preseed diff --git a/other/examples/nico/conf/type/__nico_mpd/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/manifest similarity index 100% rename from other/examples/nico/conf/type/__nico_mpd/manifest rename to other/examples_needing_cleanup/nico/conf/type/__nico_mpd/manifest diff --git a/other/examples/nico/conf/type/__nico_mpd/parameter/required b/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/parameter/required similarity index 100% rename from other/examples/nico/conf/type/__nico_mpd/parameter/required rename to other/examples_needing_cleanup/nico/conf/type/__nico_mpd/parameter/required diff --git a/other/examples/nico/conf/type/__nico_mpd/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/singleton similarity index 100% rename from other/examples/nico/conf/type/__nico_mpd/singleton rename to other/examples_needing_cleanup/nico/conf/type/__nico_mpd/singleton diff --git a/other/examples/nico/conf/type/__nico_network/files/interfaces-eth0 b/other/examples_needing_cleanup/nico/conf/type/__nico_network/files/interfaces-eth0 similarity index 100% rename from other/examples/nico/conf/type/__nico_network/files/interfaces-eth0 rename to other/examples_needing_cleanup/nico/conf/type/__nico_network/files/interfaces-eth0 diff --git a/other/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 b/other/examples_needing_cleanup/nico/conf/type/__nico_network/files/interfaces-wlan0 similarity index 100% rename from other/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 rename to other/examples_needing_cleanup/nico/conf/type/__nico_network/files/interfaces-wlan0 diff --git a/other/examples/nico/conf/type/__nico_network/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_network/manifest similarity index 100% rename from other/examples/nico/conf/type/__nico_network/manifest rename to other/examples_needing_cleanup/nico/conf/type/__nico_network/manifest diff --git a/other/examples/nico/conf/type/__nico_network/parameter/required b/other/examples_needing_cleanup/nico/conf/type/__nico_network/parameter/required similarity index 100% rename from other/examples/nico/conf/type/__nico_network/parameter/required rename to other/examples_needing_cleanup/nico/conf/type/__nico_network/parameter/required diff --git a/other/examples/nico/conf/type/__nico_network/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_network/singleton similarity index 100% rename from other/examples/nico/conf/type/__nico_network/singleton rename to other/examples_needing_cleanup/nico/conf/type/__nico_network/singleton diff --git a/other/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed b/other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/files/slim-preseed similarity index 100% rename from other/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed rename to other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/files/slim-preseed diff --git a/other/examples/nico/conf/type/__nico_nfs_client/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/manifest similarity index 100% rename from other/examples/nico/conf/type/__nico_nfs_client/manifest rename to other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/manifest diff --git a/other/examples/nico/conf/type/__nico_nfs_client/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/singleton similarity index 100% rename from other/examples/nico/conf/type/__nico_nfs_client/singleton rename to other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/singleton diff --git a/other/examples/nico/conf/type/__nico_notebook/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_notebook/manifest similarity index 100% rename from other/examples/nico/conf/type/__nico_notebook/manifest rename to other/examples_needing_cleanup/nico/conf/type/__nico_notebook/manifest diff --git a/other/examples/nico/conf/type/__nico_notebook/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_notebook/singleton similarity index 100% rename from other/examples/nico/conf/type/__nico_notebook/singleton rename to other/examples_needing_cleanup/nico/conf/type/__nico_notebook/singleton diff --git a/other/examples/nico/conf/type/__nico_packages/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_packages/manifest similarity index 100% rename from other/examples/nico/conf/type/__nico_packages/manifest rename to other/examples_needing_cleanup/nico/conf/type/__nico_packages/manifest diff --git a/other/examples/nico/conf/type/__nico_packages/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_packages/singleton similarity index 100% rename from other/examples/nico/conf/type/__nico_packages/singleton rename to other/examples_needing_cleanup/nico/conf/type/__nico_packages/singleton diff --git a/other/examples/nico/conf/type/__nico_sudo/files/sudo-nico b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/files/sudo-nico similarity index 100% rename from other/examples/nico/conf/type/__nico_sudo/files/sudo-nico rename to other/examples_needing_cleanup/nico/conf/type/__nico_sudo/files/sudo-nico diff --git a/other/examples/nico/conf/type/__nico_sudo/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/manifest similarity index 100% rename from other/examples/nico/conf/type/__nico_sudo/manifest rename to other/examples_needing_cleanup/nico/conf/type/__nico_sudo/manifest diff --git a/other/examples/nico/conf/type/__nico_sudo/parameter/gencode b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/gencode similarity index 100% rename from other/examples/nico/conf/type/__nico_sudo/parameter/gencode rename to other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/gencode diff --git a/other/examples/nico/conf/type/__nico_sudo/parameter/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/manifest similarity index 100% rename from other/examples/nico/conf/type/__nico_sudo/parameter/manifest rename to other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/manifest diff --git a/other/examples/nico/conf/type/__nico_sudo/parameter/optional b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/optional similarity index 100% rename from other/examples/nico/conf/type/__nico_sudo/parameter/optional rename to other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/optional diff --git a/other/examples/nico/conf/type/__nico_sudo/parameter/required b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/required similarity index 100% rename from other/examples/nico/conf/type/__nico_sudo/parameter/required rename to other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/required diff --git a/other/examples/nico/conf/type/__nico_sudo/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/singleton similarity index 100% rename from other/examples/nico/conf/type/__nico_sudo/singleton rename to other/examples_needing_cleanup/nico/conf/type/__nico_sudo/singleton diff --git a/other/examples/nico/conf/type/__nico_tee/files/99-apt-nico b/other/examples_needing_cleanup/nico/conf/type/__nico_tee/files/99-apt-nico similarity index 100% rename from other/examples/nico/conf/type/__nico_tee/files/99-apt-nico rename to other/examples_needing_cleanup/nico/conf/type/__nico_tee/files/99-apt-nico diff --git a/other/examples/nico/conf/type/__nico_tee/files/hostname b/other/examples_needing_cleanup/nico/conf/type/__nico_tee/files/hostname similarity index 100% rename from other/examples/nico/conf/type/__nico_tee/files/hostname rename to other/examples_needing_cleanup/nico/conf/type/__nico_tee/files/hostname diff --git a/other/examples/nico/conf/type/__nico_tee/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_tee/manifest similarity index 100% rename from other/examples/nico/conf/type/__nico_tee/manifest rename to other/examples_needing_cleanup/nico/conf/type/__nico_tee/manifest diff --git a/other/examples/nico/conf/type/__nico_tee/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_tee/singleton similarity index 100% rename from other/examples/nico/conf/type/__nico_tee/singleton rename to other/examples_needing_cleanup/nico/conf/type/__nico_tee/singleton From 74920d53a674f4c33e98877c0562af4b19c6e1a7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 18:44:36 +0200 Subject: [PATCH 0854/1024] ++cleanup Signed-off-by: Nico Schottelius --- other/{tests_reintegrate => tests_needing_cleanup}/nico_ui.py | 0 other/{tests_reintegrate => tests_needing_cleanup}/test_config.py | 0 .../{tests_reintegrate => tests_needing_cleanup}/test_install.py | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename other/{tests_reintegrate => tests_needing_cleanup}/nico_ui.py (100%) rename other/{tests_reintegrate => tests_needing_cleanup}/test_config.py (100%) rename other/{tests_reintegrate => tests_needing_cleanup}/test_install.py (100%) diff --git a/other/tests_reintegrate/nico_ui.py b/other/tests_needing_cleanup/nico_ui.py similarity index 100% rename from other/tests_reintegrate/nico_ui.py rename to other/tests_needing_cleanup/nico_ui.py diff --git a/other/tests_reintegrate/test_config.py b/other/tests_needing_cleanup/test_config.py similarity index 100% rename from other/tests_reintegrate/test_config.py rename to other/tests_needing_cleanup/test_config.py diff --git a/other/tests_reintegrate/test_install.py b/other/tests_needing_cleanup/test_install.py similarity index 100% rename from other/tests_reintegrate/test_install.py rename to other/tests_needing_cleanup/test_install.py From bd13fbab3a99ff83712d3a2d3b3628cf26292770 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 18:45:09 +0200 Subject: [PATCH 0855/1024] remove old tests from config install and co. Signed-off-by: Nico Schottelius --- other/tests_needing_cleanup/nico_ui.py | 45 ------- other/tests_needing_cleanup/test_config.py | 101 --------------- other/tests_needing_cleanup/test_install.py | 131 -------------------- 3 files changed, 277 deletions(-) delete mode 100644 other/tests_needing_cleanup/nico_ui.py delete mode 100644 other/tests_needing_cleanup/test_config.py delete mode 100644 other/tests_needing_cleanup/test_install.py diff --git a/other/tests_needing_cleanup/nico_ui.py b/other/tests_needing_cleanup/nico_ui.py deleted file mode 100644 index 8ce98043..00000000 --- a/other/tests_needing_cleanup/nico_ui.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# 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 . -# -# - - -import os -import subprocess -import unittest - -cdist_commands=["banner", "config", "install"] - -cdist_exec_path = os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), "../bin/cdist")) - -class UI(unittest.TestCase): - def test_banner(self): - self.assertEqual(subprocess.call([cdist_exec_path, "banner"]), 0) - - def test_help(self): - for cmd in cdist_commands: - self.assertEqual(subprocess.call([cdist_exec_path, cmd, "-h"]), 0) - - # FIXME: mockup needed - def test_config_localhost(self): - for cmd in cdist_commands: - self.assertEqual(subprocess.call([cdist_exec_path, "config", "localhost"]), 0) - diff --git a/other/tests_needing_cleanup/test_config.py b/other/tests_needing_cleanup/test_config.py deleted file mode 100644 index 0632ebcc..00000000 --- a/other/tests_needing_cleanup/test_config.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# 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 . -# -# - -import os -import sys -import tempfile -import unittest - -sys.path.insert(0, os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) - -import cdist.config - -cdist_exec_path = os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin/cdist")) - - -class Config(unittest.TestCase): - def setUp(self): - self.temp_dir = tempfile.mkdtemp() - self.init_manifest = os.path.join(self.temp_dir, "manifest") - self.config = cdist.config.Config("localhost", - initial_manifest=self.init_manifest, - exec_path=cdist_exec_path) - self.config.link_emulator() - - def test_initial_manifest_different_parameter(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + " --mode 0700\n", - "__file " + self.temp_dir + " --mode 0600\n", - ]) - manifest_fd.close() - - self.assertRaises(cdist.Error, self.config.run_initial_manifest) - - def test_initial_manifest_parameter_added(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + '\n', - "__file " + self.temp_dir + " --mode 0600\n", - ]) - manifest_fd.close() - - self.assertRaises(cdist.Error, self.config.run_initial_manifest) - - def test_initial_manifest_parameter_removed(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + " --mode 0600\n", - "__file " + self.temp_dir + "\n", - ]) - manifest_fd.close() - - self.assertRaises(cdist.Error, self.config.run_initial_manifest) - - def test_initial_manifest_non_existent_command(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "thereisdefinitelynosuchcommend"]) - manifest_fd.close() - - self.assertRaises(cdist.Error, self.config.run_initial_manifest) - - def test_initial_manifest_parameter_twice(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + " --mode 0600\n", - "__file " + self.temp_dir + " --mode 0600\n", - ]) - manifest_fd.close() - - try: - self.config.run_initial_manifest() - except cdist.Error: - failed = True - else: - failed = False - - self.assertFalse(failed) - - diff --git a/other/tests_needing_cleanup/test_install.py b/other/tests_needing_cleanup/test_install.py deleted file mode 100644 index d6502b46..00000000 --- a/other/tests_needing_cleanup/test_install.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# 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 . -# -# - -import os -import sys -import tempfile -import unittest - -sys.path.insert(0, os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) - -import cdist.config -import cdist.test - -class Install(unittest.TestCase): - def setUp(self): - self.temp_dir = tempfile.mkdtemp() - self.init_manifest = os.path.join(self.temp_dir, "manifest") - - os.environ['__remote_exec'] = "ssh -o User=root -q" - os.environ['__remote_copy'] = "scp -o User=root -q" - - self.config = cdist.config.Config("localhost", - initial_manifest=self.init_manifest, - exec_path=cdist.test.cdist_exec_path) - self.config.link_emulator() - - -### NEW FOR INSTALL ############################################################ - - def test_explorer_ran(self): - """Check that all explorers returned a result""" - self.config.run_global_explores() - explorers = self.config.path.list_global_explorers() - - for explorer in explorers: - output = self.config.path.global_explorer_output_path(explorer) - self.assertTrue(os.path.isfile(output)) - - def test_manifest_uses_install_types_only(self): - """Check that objects created from manifest are only of install type""" - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + " --mode 0700\n", - "__partition_msdos /dev/null --type 82\n", - ]) - manifest_fd.close() - - self.config.run_initial_manifest() - - # FIXME: check that only __partition_msdos objects are created! - - self.assertFalse(failed) - - -### OLD FROM CONFIG ############################################################ - def test_initial_manifest_different_parameter(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + " --mode 0700\n", - "__file " + self.temp_dir + " --mode 0600\n", - ]) - manifest_fd.close() - - self.assertRaises(cdist.Error, self.config.run_initial_manifest) - - def test_initial_manifest_parameter_added(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + '\n', - "__file " + self.temp_dir + " --mode 0600\n", - ]) - manifest_fd.close() - - self.assertRaises(cdist.Error, self.config.run_initial_manifest) - - def test_initial_manifest_parameter_removed(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + " --mode 0600\n", - "__file " + self.temp_dir + "\n", - ]) - manifest_fd.close() - - self.assertRaises(cdist.Error, self.config.run_initial_manifest) - - def test_initial_manifest_non_existent_command(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "thereisdefinitelynosuchcommend"]) - manifest_fd.close() - - self.assertRaises(cdist.Error, self.config.run_initial_manifest) - - def test_initial_manifest_parameter_twice(self): - manifest_fd = open(self.init_manifest, "w") - manifest_fd.writelines(["#!/bin/sh\n", - "__file " + self.temp_dir + " --mode 0600\n", - "__file " + self.temp_dir + " --mode 0600\n", - ]) - manifest_fd.close() - - try: - self.config.run_initial_manifest() - except cdist.Error: - failed = True - else: - failed = False - - self.assertFalse(failed) - - From a69069f28cfc3ea9b348e8a42ca9bec7420da69c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 18:45:36 +0200 Subject: [PATCH 0856/1024] make unfinished examples disappear Signed-off-by: Nico Schottelius --- .../conf/type/__nico_afs/files/afs/CellServDB | 2 - .../conf/type/__nico_afs/files/afs/ThisCell | 1 - .../conf/type/__nico_afs/files/krb5/krb5.conf | 28 ----------- .../conf/type/__nico_afs/files/ssh/JAS.pub | 1 - .../type/__nico_afs/files/ssh/bugblue.pub | 1 - .../type/__nico_afs/files/ssh/docsteel.pub | 1 - .../type/__nico_afs/files/ssh/downhill.pub | 1 - .../type/__nico_afs/files/ssh/sur5r@samsa.pub | 1 - .../nico/conf/type/__nico_afs/manifest | 45 ------------------ .../nico/conf/type/__nico_afs/singleton | 0 .../conf/type/__nico_desktop/files/hostname | 1 - .../type/__nico_desktop/files/slim-preseed | 4 -- .../nico/conf/type/__nico_desktop/manifest | 47 ------------------- .../type/__nico_desktop/parameter/required | 1 - .../nico/conf/type/__nico_desktop/singleton | 0 .../conf/type/__nico_mpd/files/slim-preseed | 4 -- .../nico/conf/type/__nico_mpd/manifest | 24 ---------- .../conf/type/__nico_mpd/parameter/required | 1 - .../nico/conf/type/__nico_mpd/singleton | 0 .../type/__nico_network/files/interfaces-eth0 | 6 --- .../__nico_network/files/interfaces-wlan0 | 11 ----- .../nico/conf/type/__nico_network/manifest | 43 ----------------- .../type/__nico_network/parameter/required | 1 - .../nico/conf/type/__nico_network/singleton | 0 .../type/__nico_nfs_client/files/slim-preseed | 4 -- .../nico/conf/type/__nico_nfs_client/manifest | 47 ------------------- .../conf/type/__nico_nfs_client/singleton | 0 .../nico/conf/type/__nico_notebook/manifest | 38 --------------- .../nico/conf/type/__nico_notebook/singleton | 0 .../nico/conf/type/__nico_packages/manifest | 33 ------------- .../nico/conf/type/__nico_packages/singleton | 0 .../conf/type/__nico_sudo/files/sudo-nico | 13 ----- .../nico/conf/type/__nico_sudo/manifest | 27 ----------- .../conf/type/__nico_sudo/parameter/gencode | 31 ------------ .../conf/type/__nico_sudo/parameter/manifest | 31 ------------ .../conf/type/__nico_sudo/parameter/optional | 0 .../conf/type/__nico_sudo/parameter/required | 0 .../nico/conf/type/__nico_sudo/singleton | 0 .../conf/type/__nico_tee/files/99-apt-nico | 2 - .../nico/conf/type/__nico_tee/files/hostname | 1 - .../nico/conf/type/__nico_tee/manifest | 28 ----------- .../nico/conf/type/__nico_tee/singleton | 0 42 files changed, 479 deletions(-) delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/afs/CellServDB delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/afs/ThisCell delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/krb5/krb5.conf delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/JAS.pub delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/bugblue.pub delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/docsteel.pub delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/downhill.pub delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub delete mode 100755 other/examples_needing_cleanup/nico/conf/type/__nico_afs/manifest delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_afs/singleton delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_desktop/files/hostname delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_desktop/files/slim-preseed delete mode 100755 other/examples_needing_cleanup/nico/conf/type/__nico_desktop/manifest delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_desktop/parameter/required delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_desktop/singleton delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_mpd/files/slim-preseed delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_mpd/manifest delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_mpd/parameter/required delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_mpd/singleton delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_network/files/interfaces-eth0 delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_network/files/interfaces-wlan0 delete mode 100755 other/examples_needing_cleanup/nico/conf/type/__nico_network/manifest delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_network/parameter/required delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_network/singleton delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/files/slim-preseed delete mode 100755 other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/manifest delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/singleton delete mode 100755 other/examples_needing_cleanup/nico/conf/type/__nico_notebook/manifest delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_notebook/singleton delete mode 100755 other/examples_needing_cleanup/nico/conf/type/__nico_packages/manifest delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_packages/singleton delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_sudo/files/sudo-nico delete mode 100755 other/examples_needing_cleanup/nico/conf/type/__nico_sudo/manifest delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/gencode delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/manifest delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/optional delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/required delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_sudo/singleton delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_tee/files/99-apt-nico delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_tee/files/hostname delete mode 100755 other/examples_needing_cleanup/nico/conf/type/__nico_tee/manifest delete mode 100644 other/examples_needing_cleanup/nico/conf/type/__nico_tee/singleton diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/afs/CellServDB b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/afs/CellServDB deleted file mode 100644 index dbd238d7..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/afs/CellServDB +++ /dev/null @@ -1,2 +0,0 @@ ->eof -129.132.186.89 # sgv-afs-sur5r diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/afs/ThisCell b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/afs/ThisCell deleted file mode 100644 index 37fb719b..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/afs/ThisCell +++ /dev/null @@ -1 +0,0 @@ -eof diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/krb5/krb5.conf b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/krb5/krb5.conf deleted file mode 100644 index 3b8259cb..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/krb5/krb5.conf +++ /dev/null @@ -1,28 +0,0 @@ -[libdefaults] - default_realm = EOF - -# The following krb5.conf variables are only for MIT Kerberos. - krb4_config = /etc/krb.conf - krb4_realms = /etc/krb.realms - kdc_timesync = 1 - ccache_type = 4 - forwardable = true - proxiable = true - allow_weak_crypto = true - -[realms] - EOF = { - kdc = sgv-afs-sur5r.ethz.ch - admin_server = sgv-afs-sur5r.ethz.ch - } - - -[login] - krb4_convert = true - krb4_get_tickets = false - -[logging] - default = FILE:/var/log/krb5.log - kdc = FILE:/var/log/krb5kdc/kdc.log - admin_server = FILE:/var/log/krb5kdc/kadmin.log - diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/JAS.pub b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/JAS.pub deleted file mode 100644 index 222410d5..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/JAS.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/Gbl64LT3VD5hsVtk1w670S2gue1OaW9XLg/Vk/iBqsYYrLGZh+TXJsAsXOSF1sZH6QSdNlpzTPsno9KFCTQTNlYe0IrWPGRrFGw1or3M6OugJrMeSiMYQ5nhH6HMjhzCFHH8Xh4Yku8fgi3ejPpySW8umx7nBL7ndiEJ9Y+lixNWMirEPLpz9YufFm9u8GX6bPrmjIBz6EhfxaqJ2N/N6gQB+4PmNopzqWHm+n4LToA9N8qwetSfhgEg7DVaD9SrJNjNTGSgii6CritT9sF8ZBq5CZG58DTyrxCndhhHte5OCGMb5ENgO4OBHA0MrD56unHrdAZCCosa9rI+pIll abr@cltHome03 diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/bugblue.pub b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/bugblue.pub deleted file mode 100644 index cccbe02f..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/bugblue.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA17fnWJMTAuIvWcdnsasdfEkBabeXEhYaR03Qc/KBpS+iToSeUzlc5SeXoAczqSMsC0uYpDnhll9q3aAN82Xo06RI2ytd7TeXvFcVwzvXB+sNUsvtyPZ5Uyx7d2WTI87bm169KhGTJCaww8p+qa2UhkjOOaXZwMGjkHlvZ3WSZr5mLar9O3r4PG8SIqoFF0m+tcc2fcWIK3df3jWIk8g6j/jTaoIa18qsK/rtO90Ql20FMQJOZTKGKjHIOx2FLnXY5WKrXmXyyffgFpqi1rUAkCkjCKnm65fDjecn6FplzSUuZo/IB2GnHGNQVnNkU/18/G8KQKu9clkMxuUl8DYJBQ== bugblue@jabber.eof.name diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/docsteel.pub b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/docsteel.pub deleted file mode 100644 index 4b40d089..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/docsteel.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1xfKoN8D3I0uGvc66E2cpnutdgALbSVIIWy0SBGV1ZLA4CehAL5BpMO0EI1TfH4LGgpjg+CnLXOSMd+bnvWjPTxGUbGcmK45UYCyn1LzSAfVKi9Mr06wbvQj0h5w1zEAwDqt63SHGjGOHO4TeCSrPxEROPMbZ1mP1ECsb4f+3WLWE5icbzOb/QMx2zNDd29rVvFJiJMOg4AiIs7pl/T7Qxg2yN6YlDIXSXLiE2i98O26kBNWRgAFcTNBqoUs5AkZ2F4LPUGbyuLpV+wtlpYcQXOUTLoRlKw+ovBQH3L6ae9n6+rFTIEEAS08C0MOzQPC3QjmfRMC8mxVkn22XnpHbQ== default diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/downhill.pub b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/downhill.pub deleted file mode 100644 index bde07c29..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/downhill.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-dss AAAAB3NzaC1kc3MAAAIBAMiYvUWD0Yq3vm2Dp6xJCGvRGcGIyiT8+07FQJvAWUAzudyhA9r+h58gm4uCUJTV5W33Npf70Id5LSxyZJA7LcdTXTuMxhVfERURcT/GgtxCrs+aMguitNvf7QVuiKBrvuBmBPMV/6k8UEwf/7eCQRjoXE4jxEYKUT9SW8X94wuH0HUqOqBRD2F21uMrmLgDkb12RK/9yFRV3c7waOSQU/QtO+VFwPvBNDqUTqBL0LOJJif449vMxboOZ1noS94K0Lyfz9yOGEwBYck11c2UzH4KXbv8qNpYgtuCmDjZFM2J8dnhWJgkmThZtmyfnNFbHlW0HZItVvkqLZMPDlCIqR77J9OC4lawjrX2FFKhAzcrJuw7WXr2PcFKQUh/TiypcM5f6zuU3fs2+8ZYQdwvU6j/QNW4A/zqud7v/hjAMYCVe0EIWf2Qt0SS/nFLh7dZRGV21nK9Vq0zDncVPTgDl7/L62TYieO/j/1X3HjEp2JbR+mjBWsfKM7WYZDP16xiQzBuhr0vItnKMyN9V4AbDthjqesezKuXIhv0jP1z40MppM9mr40FJpgRSY3hyt3cZQKoO2vVJevnJMuufLheocAxo037f2PUpmSiJDOF1dLywmS2Gqk4GgzNN40IPrOcz0umtKjMAtXeU6MeapfmmEbwk+2zOo75gUt6SWU8UiFhAAAAFQC/Fm0V7OYGdazrUNuyn7mcPknZhQAAAgBzO496WPYnn7/H336kdMOUoue4Kgr9shpgjyyTJ8K9UsFwm+IEh9iS0QKPgGnj54AY1FpspfrbCmRI0tma+pj2QlnRRwIGcHd7eh2nCOmr+DSD/36VmoRPvGZaJDSTVotN+qgyjddNhCGx0417fqHXSKypbASphBqyvcKwkpk8S7o5nkMeOhufeCNdTHYsenKha4W+p8srGBsIZBISNeaGAsESIK4LuaShuolciTXtT7Nsqo123EXmjdHrT7DHQuwKI+jJpvHcz/UrissLs1JD+lFLOE07lkHPDc4KKK6IDUjm/DzsVTlTWdrcn8wUZ7fhUTt7e8UDNHs6bMlnhtVkXEsHS3sbYRsbF9179jufUumXKLKkjLzpTZwni8D6GxnjUn51hQ9Ifb9UOlSlkRq+cqOU+TRQd5aQSdiXy5Ymao719MHBrAhH1aLbi9pk4VO3GGFNy/w54ZY2LRIXZsGMBgFTXzHyzqv1ejeQtOuQZw9xOzt9IZU3WuMKVGGR9D61rsgxbGI1aWGaDlyhMSL9LYyqkmEqVqnAyydAVmhpSxhoXjbDrwE/IRdjJwjlK/6NxUck9g7Ekc9pHrow0OmqH9k6SCd2npXBUybTXPYqwHUjY/KccJsW0Ia2OECGN6KgNWdSfFeAGJBrv2ct78laSyNgIguM+0MNOZQSr6QfSQAAAgEAqkHqwfmEtrlc7hKtvenEf4Dkgt6H33U7MJILNOo9qrn/StDeuuO1snbO2wbd8weJop7gnp29zJGRKYcs/p2T3YjOd9R6aRGLOlT+jEZjP1RMPeuT7W4UFajP34SezYc1MAMeT9wkABEBQyj6s+4CvC2tKJWoirziAvkSPfkYdOc3u9I1LuXHu21tP+Lky3K9KylsbnHDG6vw05GH3HbeXIa6LtxAkXiPp/+r0dABO5NzglHS36uaD4mbQGh2dIzWPm4j8mLrjg911R8XnLPdTgT2EB9mvXksLjWEEq7qzTSdacFG0127O+i4Be3h1+5wG5HM8ST1n5hTOX8tTywF3DJL5HbLNHdDQo/YlT6l/wk6HbnYdcZHviVHi6va3/lFTdhoTEPz5sgDYQp5/0vobiMyIRHSZwzcYmswHumpf6Wql/phff8xigJBDAbGdFgx1Jk2OoOVGNWEchZuzlXyfgQpatnzBcR9CAAJvAfQLPqcHb8jGyBINuoNY/0OsAbsQDDzSjOLkBEBVgBTVZbykcik2n7kBQFeNj8zAUeLQCnQcEGIGY7OkPoxaAHBGKh4+e5Wymz0fryKTJ9io78qLHTmc6xs/ep4UwlO4Ee/e9p7cGb2pOl98jGFCWUklqyzeksBTOQcfKZBPV5dYap4m6nrw59XYpVbV9yPRJ/yMhE= downhill@downhill.homelinux.net diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub deleted file mode 100644 index a1fcba83..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAABAEApDTX05FmMS1ArryWL6MmgcQeRFRU6E4Rgg+cPTeBuHCtBnnUoCUw7lhD2OICHIzQnfyMQasJOHH/4PnsrAxyO1Lm4KtK3zsdSdA5auunxAy0n7PZwaRKDTXCgpfXvi7ZAlzA+Mq/OjqtltfqdJgToYKxWoehwmltlwibuU1fke2v85VcTbCQRAttc6+0Y+3fToyTWecZM+X0uCsz1B5s07CLrMddo3lPVAlhYStSCbHflsM6C+NQAbxlsjkVFavii7WDYMYOd5FU0jIJt2Fy6u7Lx0ubY6hgGsP+mDOCCaRGA0JdjvWctBruj227CLswtAnYIFxvPi82R/okfx2X4YPtbqUPyLaUbr0G93g+raJEr/uXbour+wRd0TewOLq4VstwOsDfj9pm0wMFyIbsY2y97k6UZc0TE5pu3USGyW9/ainy5zD4TK4Al8lMkDHil6eItlud66KDZ4p5n5gzwuBj+ZOpOcBD5ZqLqDKst3YlHx6EuA1ddObBTrfy/nGphYYhWl1rbJ9+XOhSD8f/LIr5mjLEpSta6rHS/3dpLpSRGIy8ReG0RLbfay/fS74Iw0rEGOe/XgrfNDT0VwsgJMNV81sReepk27DaFD/vES/iPAymbbId8e8IQ7kDbhV0yK0yTkCZ5capqa9HXcut0SFRVJYGxzGT+ji5o/DcyAcaQHK9IW5i89sp04aVtZO+KZZDd2GmcDy+v9+fmBsSx2AFsoOQSXX31jJVdAXNw8idTNb88/3XDZIIEl+1KJ8Pv4UFXBW72RArpOxOrsDZYQjtaLQ4ZjTP3h823ZrBh4W3osb1znS7x4MmWBLPkmLCS0zmN8nbqhKi5EsTmSheCjCzySGShkyeqSGRIRGFk5PUsgh7hYvE+f7BhWD6x8MHbuUp9y0ODQonp022Dc4WzTc6Aa023MSNRuwV373tOqPYveuoPXDTS6vzV3IjXfv9a844HIkUTZbErxkavGBN5TEMgrALJkc8LS6M6Zg8odou8N2vWoNaKPn/DC5+H+FxJ2PSrK93hfzRMgvFvPSFzzDnixUFJClSqxf1Wvx9OW2pUuePAXBlcuFhAAnWV6w7fkmII8+qGk3m438dt2Sq6owmItzqIeJ6bohMsb9ejxeDyfk9DAQwmjS7S+BY47bYgAfsesZNRnlbeffp4rP0MAx4KoUXoNzb8tl1Jljulq58C0e5+EzRILqOYLM7WytY3+giqxN4zQJsqDp3mgSUaZ5SEHnA8JVi77MvABSoVclrEaujSLVEkxTBOiR252SFUWp3lWbxpGzBjd7gX4JAiytJql5xr+o4+nCy2O2laE6c2xS7en6SVEgC7jWflCsbDfvy9U+w1qOxa0j9fXE9Rw== sur5r@samsa diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/manifest deleted file mode 100755 index 7b4cc493..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/manifest +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - - -__directory /root/.ssh --mode 0700 - -__file /root/.ssh/authorized_keys --mode 0600 - -cd "$__type/files/ssh" -for key in *; do - require="__directory/root/.ssh" \ - __addifnosuchline ssh-$key --file /root/.ssh/authorized_keys \ - --line "$(cat "$key")" -done - -for pkg in openafs-client openafs-krb5 krb5-user; do - __package $pkg --state installed -done - -# Kerberos Config -__file /etc/krb5.conf --source "$__type/files/krb5/krb5.conf" - -# AFS config -cd "$__type/files/afs" -for afsconf in *; do - __file /etc/openafs/$afsconf --source "$__type/files/afs/$afsconf" -done diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_afs/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_afs/singleton deleted file mode 100644 index e69de29b..00000000 diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/files/hostname b/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/files/hostname deleted file mode 100644 index a4df6242..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/files/hostname +++ /dev/null @@ -1 +0,0 @@ -scheibe diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/files/slim-preseed b/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/files/slim-preseed deleted file mode 100644 index 01448d74..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/files/slim-preseed +++ /dev/null @@ -1,4 +0,0 @@ -# Use slim, not gdm, if both are available -# Setup for slim, but value is available for gdm as well: -# gdm shared/default-x-display-manager select slim -slim shared/default-x-display-manager select slim diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/manifest deleted file mode 100755 index 7fbbe70f..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/manifest +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -# -# Ensure hostname is setup -# -__file /etc/hostname --source "$__object/parameter/hostname" - -# All Linux distros have those -for pkg in dvdbackup mplayer x11vnc xfmpc; do - __package $pkg --state installed -done - -case "$(cat "$__global/explorer/os")" in - debian|ubuntu) - require="__package/zsh" __user lyni --uid 1000 --shell /bin/zsh - - for pkg in chromium-browser xfce4 xtightvncviewer; do - __package $pkg --state installed - done - - # Make slim default desktop on Debian/Ubuntu - __debconf_set_selections slim --file "$__type/files/slim-preseed" - require="__debconf_set_selections/slim" __package_apt slim --state installed - ;; -esac - -# Including gaming fun - not within examples, too big for core inclusion :-p -# __nico_dosbox diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/parameter/required b/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/parameter/required deleted file mode 100644 index ecd88aee..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/parameter/required +++ /dev/null @@ -1 +0,0 @@ -hostname diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_desktop/singleton deleted file mode 100644 index e69de29b..00000000 diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/files/slim-preseed b/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/files/slim-preseed deleted file mode 100644 index 01448d74..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/files/slim-preseed +++ /dev/null @@ -1,4 +0,0 @@ -# Use slim, not gdm, if both are available -# Setup for slim, but value is available for gdm as well: -# gdm shared/default-x-display-manager select slim -slim shared/default-x-display-manager select slim diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/manifest deleted file mode 100644 index d339bdf3..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/manifest +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -__package mpd --state installed - -require="__package/mpd" __file /etc/mpd.conf --source "$__type/files/mpd.conf" diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/parameter/required b/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/parameter/required deleted file mode 100644 index ecd88aee..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/parameter/required +++ /dev/null @@ -1 +0,0 @@ -hostname diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_mpd/singleton deleted file mode 100644 index e69de29b..00000000 diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_network/files/interfaces-eth0 b/other/examples_needing_cleanup/nico/conf/type/__nico_network/files/interfaces-eth0 deleted file mode 100644 index 2a92eade..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_network/files/interfaces-eth0 +++ /dev/null @@ -1,6 +0,0 @@ -# generated by cdist -auto lo eth0 - -iface lo inet loopback - -iface eth0 inet dhcp diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_network/files/interfaces-wlan0 b/other/examples_needing_cleanup/nico/conf/type/__nico_network/files/interfaces-wlan0 deleted file mode 100644 index 49508eb2..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_network/files/interfaces-wlan0 +++ /dev/null @@ -1,11 +0,0 @@ -# This file describes the network interfaces available on your system -# and how to activate them. For more information, see interfaces(5). - -# The loopback network interface -auto lo -iface lo inet loopback - -auto wlan0 -iface wlan0 inet dhcp - wpa-ssid undef - wpa-psk rotrussland diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_network/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_network/manifest deleted file mode 100755 index 012c47f7..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_network/manifest +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -case "$(cat "$__global/explorer/os")" in - debian|ubuntu) - - interface="$(cat $__object/parameter/interface)" - - # - # Only Debian and alike supported currently - # - destination=/etc/network/interfaces - case "$interface" in - eth0|wlan0) - source="$__type/files/interfaces-${interface}" - ;; - *) - echo "Unknown interface: $interface" >&2 - exit 1 - ;; - esac - - __file "$destination" --source "$source" - ;; -esac diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_network/parameter/required b/other/examples_needing_cleanup/nico/conf/type/__nico_network/parameter/required deleted file mode 100644 index b529896a..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_network/parameter/required +++ /dev/null @@ -1 +0,0 @@ -interface diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_network/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_network/singleton deleted file mode 100644 index e69de29b..00000000 diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/files/slim-preseed b/other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/files/slim-preseed deleted file mode 100644 index 01448d74..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/files/slim-preseed +++ /dev/null @@ -1,4 +0,0 @@ -# Use slim, not gdm, if both are available -# Setup for slim, but value is available for gdm as well: -# gdm shared/default-x-display-manager select slim -slim shared/default-x-display-manager select slim diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/manifest deleted file mode 100755 index ed1a872b..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/manifest +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -__directory /home/services - -for nfsshare in audio video; do - dir="/home/services/$nfsshare" - __addifnosuchline nfs-$nfsshare --file /etc/fstab \ - --line "192.168.42.1:$dir $dir nfs defaults 0 0" - require="__directory/home/services" __directory $dir -done - -__directory /home/services/eingehend -for nfsshare in bibliothek buch spiegel; do - dir="/home/services/eingehend/$nfsshare" - __addifnosuchline nfs-$nfsshare --file /etc/fstab \ - --line "192.168.42.1:$dir $dir nfs defaults,noauto 0 0" - require="__directory/home/services" __directory $dir -done - -case "$(cat "$__global/explorer/os")" in - debian|ubuntu) - __package nfs-common --state installed - ;; - - fedora|archlinux) - __package nfs-utils --state installed - ;; -esac diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_nfs_client/singleton deleted file mode 100644 index e69de29b..00000000 diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_notebook/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_notebook/manifest deleted file mode 100755 index 7b010230..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_notebook/manifest +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -require="__package/zsh" __user nico --uid 1000 --shell /bin/zsh - -# -# Backup HD -# -for hd in usbhd eth-usbhd; do - dir="/home/services/$hd" - __addifnosuchline hd-$hd --file /etc/fstab \ - --line "/dev/mapper/$hd $dir auto defaults,noauto 0 0" - __directory $dir -done - -# -# Standard everywhere packages -# -__nico_packages -__motd diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_notebook/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_notebook/singleton deleted file mode 100644 index e69de29b..00000000 diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_packages/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_packages/manifest deleted file mode 100755 index a1e663f7..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_packages/manifest +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -for pkg in atop screen vim wget zsh; do - __package "$pkg" --state installed -done - -case "$(cat "$__global/explorer/os")" in - fedora) - __package nc --state installed - ;; - *) - __package netcat --state installed - ;; -esac diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_packages/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_packages/singleton deleted file mode 100644 index e69de29b..00000000 diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/files/sudo-nico b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/files/sudo-nico deleted file mode 100644 index d904c319..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/files/sudo-nico +++ /dev/null @@ -1,13 +0,0 @@ -# -# Cdist managed file -# - -# Personal one: nico, shared one: lyni -User_Alias NICO = nico, lyni - -Defaults timestamp_timeout=5 -Defaults !tty_tickets - -# Give out permissions -NICO ALL=(ALL) ALL -NICO ALL=(ALL) NOPASSWD: /usr/sbin/pm-suspend diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/manifest deleted file mode 100755 index 59315313..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/manifest +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -destination=/etc/sudoers.d/nico -source="$__type/files/sudo-nico" - -require="__package/sudo" __file "$destination" --source "$source" --mode 0440 - -__package sudo --state installed diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/gencode b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/gencode deleted file mode 100644 index 74792abf..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/gencode +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# USEFUL DESCRIPTION -# - -# -# This file should generate code on stdout, which will be collected by cdist -# and run on the target. -# -# To tell cdist to make use of it, you need to make it executable (chmod +x) -# -# - diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/manifest deleted file mode 100644 index c696eda6..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/manifest +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# USEFUL DESCRIPTION -# - -# -# This is the manifest, which can be used to create other objects like this: -# __file /path/to/destination --source /from/where/ -# -# To tell cdist to make use of it, you need to make it executable (chmod +x) -# -# - diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/optional b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/optional deleted file mode 100644 index e69de29b..00000000 diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/required b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/parameter/required deleted file mode 100644 index e69de29b..00000000 diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_sudo/singleton deleted file mode 100644 index e69de29b..00000000 diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_tee/files/99-apt-nico b/other/examples_needing_cleanup/nico/conf/type/__nico_tee/files/99-apt-nico deleted file mode 100644 index 8d6d7c82..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_tee/files/99-apt-nico +++ /dev/null @@ -1,2 +0,0 @@ -APT::Periodic::Update-Package-Lists "1"; -APT::Periodic::Unattended-Upgrade "1"; diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_tee/files/hostname b/other/examples_needing_cleanup/nico/conf/type/__nico_tee/files/hostname deleted file mode 100644 index a4df6242..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_tee/files/hostname +++ /dev/null @@ -1 +0,0 @@ -scheibe diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_tee/manifest b/other/examples_needing_cleanup/nico/conf/type/__nico_tee/manifest deleted file mode 100755 index 4c614027..00000000 --- a/other/examples_needing_cleanup/nico/conf/type/__nico_tee/manifest +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - - - -__package unattended-upgrades --state installed - -__file /etc/apt/apt.conf.d/99-apt-nico \ - --source "$__type/files/99-apt-nico" \ - --mode 0644 diff --git a/other/examples_needing_cleanup/nico/conf/type/__nico_tee/singleton b/other/examples_needing_cleanup/nico/conf/type/__nico_tee/singleton deleted file mode 100644 index e69de29b..00000000 From 8adb467304f5e124c13ec5620a74498065926996 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 18:47:51 +0200 Subject: [PATCH 0857/1024] +readme Signed-off-by: Nico Schottelius --- other/examples/types/README | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 other/examples/types/README diff --git a/other/examples/types/README b/other/examples/types/README new file mode 100644 index 00000000..f6ea90d6 --- /dev/null +++ b/other/examples/types/README @@ -0,0 +1,3 @@ +This directory contains examples types as being used in real world. + +If you'd like to see your type here, just submit it for inclusion. From 4849149af5e40b4b466401d7d7ee38cc17bf72d8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 18:49:41 +0200 Subject: [PATCH 0858/1024] add example type Signed-off-by: Nico Schottelius --- .../__nico_acpi_supend_on_lid_close/README | 3 ++ .../files/lid.sh | 5 +++ .../files/lid_event | 2 + .../__nico_acpi_supend_on_lid_close/manifest | 43 +++++++++++++++++++ .../__nico_acpi_supend_on_lid_close/singleton | 0 5 files changed, 53 insertions(+) create mode 100644 other/examples/types/__nico_acpi_supend_on_lid_close/README create mode 100755 other/examples/types/__nico_acpi_supend_on_lid_close/files/lid.sh create mode 100644 other/examples/types/__nico_acpi_supend_on_lid_close/files/lid_event create mode 100644 other/examples/types/__nico_acpi_supend_on_lid_close/manifest create mode 100644 other/examples/types/__nico_acpi_supend_on_lid_close/singleton diff --git a/other/examples/types/__nico_acpi_supend_on_lid_close/README b/other/examples/types/__nico_acpi_supend_on_lid_close/README new file mode 100644 index 00000000..b1924140 --- /dev/null +++ b/other/examples/types/__nico_acpi_supend_on_lid_close/README @@ -0,0 +1,3 @@ +This type is used on notebooks to ensure they suspend when the lid is closed. + +It is tested on Archlinux. diff --git a/other/examples/types/__nico_acpi_supend_on_lid_close/files/lid.sh b/other/examples/types/__nico_acpi_supend_on_lid_close/files/lid.sh new file mode 100755 index 00000000..929fbffb --- /dev/null +++ b/other/examples/types/__nico_acpi_supend_on_lid_close/files/lid.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# Nico Schottelius, 20111016 +# Just suspend, my wife does not like to enter a password + +/usr/sbin/pm-suspend diff --git a/other/examples/types/__nico_acpi_supend_on_lid_close/files/lid_event b/other/examples/types/__nico_acpi_supend_on_lid_close/files/lid_event new file mode 100644 index 00000000..294f6d78 --- /dev/null +++ b/other/examples/types/__nico_acpi_supend_on_lid_close/files/lid_event @@ -0,0 +1,2 @@ +event=button/lid.* +action=/etc/acpi/actions/lid.sh "%e" diff --git a/other/examples/types/__nico_acpi_supend_on_lid_close/manifest b/other/examples/types/__nico_acpi_supend_on_lid_close/manifest new file mode 100644 index 00000000..3ef4e971 --- /dev/null +++ b/other/examples/types/__nico_acpi_supend_on_lid_close/manifest @@ -0,0 +1,43 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +__package acpid --state installed +__package pm-utils --state installed + +event_dir=/etc/acpi/events +event_file="$event_dir/lid" + +action_dir=/etc/acpi/actions +action_file="$action_dir/lid.sh" + +__directory "$event_dir" --owner root --group root \ + --mode 0755 --parents yes + +__directory "$action_dir" --owner root --group root \ + --mode 0755 --parents yes + +require="__directory/$event_dir" __file "$event_file" \ + --owner root --group root --mode 0644 \ + --source "$__type/files/lid_event" + +require="__directory/$action_dir" __file "$action_file" \ + --owner root --group root --mode 0755 \ + --source "$__type/files/lid.sh" diff --git a/other/examples/types/__nico_acpi_supend_on_lid_close/singleton b/other/examples/types/__nico_acpi_supend_on_lid_close/singleton new file mode 100644 index 00000000..e69de29b From 1e4de3521ac7c611a5e25e8e68acce7f58d90645 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 19:38:50 +0200 Subject: [PATCH 0859/1024] skip errer detection in findline explorer Signed-off-by: Nico Schottelius --- conf/type/__addifnosuchline/explorer/findline | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/conf/type/__addifnosuchline/explorer/findline b/conf/type/__addifnosuchline/explorer/findline index c1633626..ac69a827 100755 --- a/conf/type/__addifnosuchline/explorer/findline +++ b/conf/type/__addifnosuchline/explorer/findline @@ -1,6 +1,7 @@ #!/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. # @@ -27,6 +28,9 @@ fi regex=$(cat "$__object/parameter/line") 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" From e64f46ba4eaf67def2f41d4646a6862dffa6eed7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 16 Oct 2011 19:40:02 +0200 Subject: [PATCH 0860/1024] document bugfix for next version Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 04679bec..bc527304 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,6 +1,7 @@ 2.0.3: * Improved logging, added --verbose, by more quiet by default * Bugfix __user: Correct quoting (Steven Armstrong) + * Bugfix __addifnosuchline: Falsely exited * Bugfix requirements: Restore original require="" behaviour * Feature requirements: Check for broken object_ids and abort * Massive refactoring and unittesting introduced (Steven Armstrong) From 71b6616d1e873aef7b1f3cdc58cf4f1809c02f9e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 17 Oct 2011 09:30:22 +0200 Subject: [PATCH 0861/1024] --todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 5 ----- 1 file changed, 5 deletions(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 90040ad6..0bba2132 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -14,11 +14,6 @@ logging: [2] http://blog.ooz.ie/2011/03/python-logging-extending-standard.html -exec local & remote: - - don't capture output by default - - add new mechanism to capture output explicitly - - config_install: - move code for running global and type explorer run to cdist.core.explorer From 22a599185c0228996fc44aa71f94ad942d01f7bd Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 17 Oct 2011 09:33:34 +0200 Subject: [PATCH 0862/1024] todo++ Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 0bba2132..ede09083 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,3 +1,18 @@ +metaparameters: + - steal the metaparameters from puppet: + + # if I change, tell the other one about it + __file /etc/ssh/sshd_config \ + --notify __init_script/etc/rc.d/sshd + + # whenever the other one changes, I want to know + __init_script /etc/rc.d/sshd \ + --subscribe __file/etc/ssh/sshd_config + + ? how does a type react to a received 'event' + + + logging: - logging from type emulator without clobbering stdout maybe implement logging server as described here [1] From 4dd74687257bcf988957a8624b174eab2a6fe465 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 17 Oct 2011 09:49:33 +0200 Subject: [PATCH 0863/1024] todo++ Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index ede09083..ba18b34c 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,6 +1,14 @@ metaparameters: - steal the metaparameters from puppet: + # I have to be there before the other one + __directory /etc/ssh \ + --before __file/etc/ssh/sshd_config + + # the other one has to be there before me + __file /etc/ssh/sshd_config \ + --after __directory/etc/ssh + # if I change, tell the other one about it __file /etc/ssh/sshd_config \ --notify __init_script/etc/rc.d/sshd From 077a04b89e9c11575deedbe0f3f1d95c0315f0db Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 17 Oct 2011 13:52:45 +0200 Subject: [PATCH 0864/1024] todo++ Signed-off-by: Steven Armstrong --- doc/dev/todo/install | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/dev/todo/install diff --git a/doc/dev/todo/install b/doc/dev/todo/install new file mode 100644 index 00000000..f0e7a040 --- /dev/null +++ b/doc/dev/todo/install @@ -0,0 +1,8 @@ +missing types: + __bootloader + __taball_get + __mount + __mount-point-create + __fstab + - run user postinstall script + - for e.g. reboot, chroot && start sshd From a1b9bec8ce72f1d093ce0182cd78652041c2619f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 09:55:30 +0200 Subject: [PATCH 0865/1024] changes for 2.0.3 Signed-off-by: Nico Schottelius --- doc/changelog | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/changelog b/doc/changelog index bc527304..aae0e04a 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,4 +1,4 @@ -2.0.3: +2.0.3: 2011-10-18 * Improved logging, added --verbose, by more quiet by default * Bugfix __user: Correct quoting (Steven Armstrong) * Bugfix __addifnosuchline: Falsely exited @@ -6,10 +6,6 @@ * Feature requirements: Check for broken object_ids and abort * Massive refactoring and unittesting introduced (Steven Armstrong) - * Feature: Initial undocumented support for replacing - the remote exec and remote copy commands - * Feature: Initial undocumented support for installations in core - 2.0.2: 2011-09-27 * Add support for detection of OpenWall Linux (Matthias Teege) * Add support for __debug variable in manifests From 50cb8807bfaaf9bf8295b00a5edde64539396a20 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 09:57:50 +0200 Subject: [PATCH 0866/1024] fix tests to work (not code :-) Signed-off-by: Nico Schottelius --- lib/cdist/test/explorer/__init__.py | 3 ++- lib/cdist/test/manifest/__init__.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index e6858812..fe23b7e2 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2011 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -62,7 +63,7 @@ class ExplorerClassTestCase(unittest.TestCase): self.explorer = explorer.Explorer(self.target_host, self.local, self.remote) - self.log = logging.getLogger("cdist") + self.log = logging.getLogger(self.target_host) def tearDown(self): shutil.rmtree(self.out_path) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index 86885a59..efda5b0a 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -55,7 +55,7 @@ class ManifestTestCase(unittest.TestCase): self.local.create_directories() self.local.link_emulator(cdist.test.cdist_exec_path) self.manifest = manifest.Manifest(self.target_host, self.local) - self.log = logging.getLogger("cdist") + self.log = logging.getLogger(self.target_host) def tearDown(self): shutil.rmtree(self.temp_dir) From 10114dccee00299063f41966750ebc9d09b15476 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 10:44:09 +0200 Subject: [PATCH 0867/1024] add traceback output, uncaught Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-18.traceback-gencode | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 doc/dev/logs/2011-10-18.traceback-gencode diff --git a/doc/dev/logs/2011-10-18.traceback-gencode b/doc/dev/logs/2011-10-18.traceback-gencode new file mode 100644 index 00000000..3de967c1 --- /dev/null +++ b/doc/dev/logs/2011-10-18.traceback-gencode @@ -0,0 +1,28 @@ +[...] +INFO: sgv-sysadmin-01: Running gencode and code for __director/home/services/nfs +Traceback (most recent call last): + File "./bin/cdist", line 211, in + commandline() + File "./bin/cdist", line 110, in commandline + args.func(args) + File "./bin/cdist", line 113, in config + configinstall(args, mode=cdist.config.Config) + File "./bin/cdist", line 131, in configinstall + if not configinstall_onehost(host, args, mode, parallel=False): + File "./bin/cdist", line 177, in configinstall_onehost + c.deploy_and_cleanup() + File "/home/users/nico/oeffentlich/rechner/projekte/cdist-nutzung/lib/cdist/config_install.py", line 71, in deploy_and_cleanup + self.deploy_to() + File "/home/users/nico/oeffentlich/rechner/projekte/cdist-nutzung/lib/cdist/config_install.py", line 66, in deploy_to + self.stage_run() + File "/home/users/nico/oeffentlich/rechner/projekte/cdist-nutzung/lib/cdist/config_install.py", line 164, in stage_run + self.object_run(cdist_object) + File "/home/users/nico/oeffentlich/rechner/projekte/cdist-nutzung/lib/cdist/config_install.py", line 143, in object_run + self.object_run(required_object) + File "/home/users/nico/oeffentlich/rechner/projekte/cdist-nutzung/lib/cdist/config_install.py", line 135, in object_run + cdist_object.ran = True + File "/home/users/nico/oeffentlich/rechner/projekte/cdist-nutzung/lib/cdist/util/fsproperty.py", line 237, in __set__ + open(path, "w").close() +IOError: [Errno 2] No such file or directory: '/home/users/nico/.tmp/tmp2gau4p/out/object/__director/home/services/nfs/.cdist/ran' +[10:43] brief:cdist-nutzung% + From fc3382f976cf3eb581dcead2bea280064d29556f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 12:24:47 +0200 Subject: [PATCH 0868/1024] add log for requirement for non-existent type bug Signed-off-by: Nico Schottelius --- doc/dev/logs/2011-10-18.requirement-object | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 doc/dev/logs/2011-10-18.requirement-object diff --git a/doc/dev/logs/2011-10-18.requirement-object b/doc/dev/logs/2011-10-18.requirement-object new file mode 100644 index 00000000..7e064ef0 --- /dev/null +++ b/doc/dev/logs/2011-10-18.requirement-object @@ -0,0 +1,6 @@ +require="__broken_type/foo" breaks too late + +- always catch OSError/IOError: (check all occurences) +- type __director does not exist, abort in emulator + - if called type is not existing + - if required type is not existing From 16ab49462899bb8a076860f72fc6c180704a24de Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 12:39:36 +0200 Subject: [PATCH 0869/1024] doc++ Signed-off-by: Steven Armstrong --- doc/dev/logs/2011-10-18.requirement-object | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/dev/logs/2011-10-18.requirement-object b/doc/dev/logs/2011-10-18.requirement-object index 7e064ef0..47873aa4 100644 --- a/doc/dev/logs/2011-10-18.requirement-object +++ b/doc/dev/logs/2011-10-18.requirement-object @@ -4,3 +4,5 @@ require="__broken_type/foo" breaks too late - type __director does not exist, abort in emulator - if called type is not existing - if required type is not existing +- type constructor fails if type does not exist +- test type emulator with non existent types -> should raise NoSuchTypeError From bd81045caff97395c98629482b61e40c90813082 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 12:43:14 +0200 Subject: [PATCH 0870/1024] test for nonexistent type Signed-off-by: Steven Armstrong --- lib/cdist/test/type/__init__.py | 56 ++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/lib/cdist/test/type/__init__.py b/lib/cdist/test/type/__init__.py index 42234069..dee9d7a6 100644 --- a/lib/cdist/test/type/__init__.py +++ b/lib/cdist/test/type/__init__.py @@ -22,7 +22,7 @@ import os import unittest -import cdist.core +from cdist import core import os.path as op my_dir = op.abspath(op.dirname(__file__)) @@ -33,113 +33,117 @@ class TypeTestCase(unittest.TestCase): def test_list_type_names(self): base_path = op.join(fixtures, 'list_types') - type_names = cdist.core.Type.list_type_names(base_path) + type_names = core.Type.list_type_names(base_path) self.assertEqual(type_names, ['__first', '__second', '__third']) def test_list_types(self): base_path = op.join(fixtures, 'list_types') - types = list(cdist.core.Type.list_types(base_path)) + types = list(core.Type.list_types(base_path)) types_expected = [ - cdist.core.Type(base_path, '__first'), - cdist.core.Type(base_path, '__second'), - cdist.core.Type(base_path, '__third'), + core.Type(base_path, '__first'), + core.Type(base_path, '__second'), + core.Type(base_path, '__third'), ] self.assertEqual(types, types_expected) def test_only_one_instance(self): base_path = fixtures - cdist_type1 = cdist.core.Type(base_path, '__name_path') - cdist_type2 = cdist.core.Type(base_path, '__name_path') + cdist_type1 = core.Type(base_path, '__name_path') + cdist_type2 = core.Type(base_path, '__name_path') self.assertEqual(id(cdist_type1), id(cdist_type2)) + def test_nonexistent_type(self): + base_path = fixtures + self.assertRaises(core.NoSuchTypeError, core.Type, base_path, '__i-dont-exist') + def test_name(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') + cdist_type = core.Type(base_path, '__name_path') self.assertEqual(cdist_type.name, '__name_path') def test_path(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') + cdist_type = core.Type(base_path, '__name_path') self.assertEqual(cdist_type.path, '__name_path') def test_base_path(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') + cdist_type = core.Type(base_path, '__name_path') self.assertEqual(cdist_type.base_path, base_path) def test_absolute_path(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') + cdist_type = core.Type(base_path, '__name_path') self.assertEqual(cdist_type.absolute_path, os.path.join(base_path, '__name_path')) def test_manifest_path(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') + cdist_type = core.Type(base_path, '__name_path') self.assertEqual(cdist_type.manifest_path, os.path.join('__name_path', 'manifest')) def test_explorer_path(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') + cdist_type = core.Type(base_path, '__name_path') self.assertEqual(cdist_type.explorer_path, os.path.join('__name_path', 'explorer')) def test_gencode_local_path(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') + cdist_type = core.Type(base_path, '__name_path') self.assertEqual(cdist_type.gencode_local_path, os.path.join('__name_path', 'gencode-local')) def test_gencode_remote_path(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__name_path') + cdist_type = core.Type(base_path, '__name_path') self.assertEqual(cdist_type.gencode_remote_path, os.path.join('__name_path', 'gencode-remote')) def test_singleton_is_singleton(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__singleton') + cdist_type = core.Type(base_path, '__singleton') self.assertTrue(cdist_type.is_singleton) def test_not_singleton_is_singleton(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__not_singleton') + cdist_type = core.Type(base_path, '__not_singleton') self.assertFalse(cdist_type.is_singleton) def test_install_is_install(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__install') + cdist_type = core.Type(base_path, '__install') self.assertTrue(cdist_type.is_install) def test_not_install_is_install(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__not_install') + cdist_type = core.Type(base_path, '__not_install') self.assertFalse(cdist_type.is_install) def test_with_explorers(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__with_explorers') + cdist_type = core.Type(base_path, '__with_explorers') self.assertEqual(cdist_type.explorers, ['whatever']) def test_without_explorers(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__without_explorers') + cdist_type = core.Type(base_path, '__without_explorers') self.assertEqual(cdist_type.explorers, []) def test_with_required_parameters(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__with_required_parameters') + cdist_type = core.Type(base_path, '__with_required_parameters') self.assertEqual(cdist_type.required_parameters, ['required1', 'required2']) def test_without_required_parameters(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__without_required_parameters') + cdist_type = core.Type(base_path, '__without_required_parameters') self.assertEqual(cdist_type.required_parameters, []) def test_with_optional_parameters(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__with_optional_parameters') + cdist_type = core.Type(base_path, '__with_optional_parameters') self.assertEqual(cdist_type.optional_parameters, ['optional1', 'optional2']) def test_without_optional_parameters(self): base_path = fixtures - cdist_type = cdist.core.Type(base_path, '__without_optional_parameters') + cdist_type = core.Type(base_path, '__without_optional_parameters') self.assertEqual(cdist_type.optional_parameters, []) ''' From a0a4a7382d27cf79d111fc7efcc1f6892c3bccb0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 12:44:07 +0200 Subject: [PATCH 0871/1024] import NoSuchTypeError into cdist.core namespace Signed-off-by: Steven Armstrong --- lib/cdist/core/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/core/__init__.py b/lib/cdist/core/__init__.py index 507082a3..ac5bbf2f 100644 --- a/lib/cdist/core/__init__.py +++ b/lib/cdist/core/__init__.py @@ -20,6 +20,7 @@ # from cdist.core.type import Type +from cdist.core.type import NoSuchTypeError from cdist.core.object import Object from cdist.core.object import IllegalObjectIdError from cdist.core.explorer import Explorer From 95a858c35085ae2218058de73ca589410977d213 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 12:46:06 +0200 Subject: [PATCH 0872/1024] implement: fail if type does not exist on the filesystem Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index ce37769e..678120aa 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -25,6 +25,15 @@ import os import cdist +class NoSuchTypeError(cdist.Error): + def __init__(self, type_path, type_absolute_path): + self.type_path = type_path + self.type_absolute_path = type_absolute_path + + def __str__(self): + return "Type '%' does not exist at %s" % (self.type_path, self.type_absolute_path) + + class Type(object): """Represents a cdist type. @@ -62,6 +71,8 @@ class Type(object): self.name = name self.path = self.name self.absolute_path = os.path.join(self.base_path, self.path) + if not os.path.isdir(self.absolute_path): + raise NoSuchTypeError(self.path, self.absolute_path) self.manifest_path = os.path.join(self.name, "manifest") self.explorer_path = os.path.join(self.name, "explorer") self.gencode_local_path = os.path.join(self.name, "gencode-local") From 4975b4643a7a16203d5ddb2ef6923fa04d4d973c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 13:11:53 +0200 Subject: [PATCH 0873/1024] --typo Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index 678120aa..02648b76 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -31,7 +31,7 @@ class NoSuchTypeError(cdist.Error): self.type_absolute_path = type_absolute_path def __str__(self): - return "Type '%' does not exist at %s" % (self.type_path, self.type_absolute_path) + return "Type '%s' does not exist at %s" % (self.type_path, self.type_absolute_path) class Type(object): From 64edfc464038215bbf969ef7a5c775b4524f08af Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 13:19:37 +0200 Subject: [PATCH 0874/1024] add tests for emulator Signed-off-by: Steven Armstrong --- lib/cdist/test/emulator/__init__.py | 75 +++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 lib/cdist/test/emulator/__init__.py diff --git a/lib/cdist/test/emulator/__init__.py b/lib/cdist/test/emulator/__init__.py new file mode 100644 index 00000000..66e7918a --- /dev/null +++ b/lib/cdist/test/emulator/__init__.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# +# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import os +import tempfile +import unittest +import shutil + +from cdist import test +from cdist.exec import local +from cdist import emulator +from cdist import core + +local_base_path = test.cdist_base_path + + +class EmulatorTestCase(unittest.TestCase): + + def mkdtemp(self, **kwargs): + return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) + + def mkstemp(self, **kwargs): + return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) + + def setUp(self): + self.orig_environ = os.environ + os.environ = os.environ.copy() + self.temp_dir = self.mkdtemp() + handle, self.script = self.mkstemp(dir=self.temp_dir) + 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.env = { + 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), + '__target_host': self.target_host, + '__global': self.local.out_path, + '__cdist_type_base_path': self.local.type_path, # for use in type emulator + '__manifest': self.local.manifest_path, + '__cdist_manifest': self.script, + } + + def tearDown(self): + os.environ = self.orig_environ + shutil.rmtree(self.temp_dir) + + def test_nonexistent_type_exec(self): + argv = ['__does-not-exist'] + os.environ.update(self.env) + self.assertRaises(core.NoSuchTypeError, emulator.Emulator, argv) + + def test_nonexistent_type_requirement(self): + argv = ['__file', '/tmp/foobar'] + os.environ.update(self.env) + os.environ['require'] = '__does-not-exist/some-id' + emu = emulator.Emulator(argv) + self.assertRaises(core.NoSuchTypeError, emu.run) From e9a0aa186328c034af0ba0ec253d666657c0d859 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 13:20:14 +0200 Subject: [PATCH 0875/1024] fail if requirements type does not exist Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 103ea8c0..b5682342 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -158,6 +158,9 @@ class Emulator(object): requirement_type_name = requirement_parts[0] requirement_object_id = requirement_parts[1] + # Instantiate type which fails if type does not exist + requirement_type = core.Type(self.type_base_path, requirement_type_name) + # FIXME: Add support for omitted object id == singleton #if len(requirement_parts) == 1: #except IndexError: From 91c1215566004e0fdb3420a5f36165f190fafea0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 13:27:44 +0200 Subject: [PATCH 0876/1024] wrap exceptions in cdist.Error Signed-off-by: Steven Armstrong --- lib/cdist/util/fsproperty.py | 48 ++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index 5b8aa708..5c95d1b4 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -64,9 +64,13 @@ class FileList(collections.MutableSequence): return lines def __write(self, lines): - with open(self.path, 'w') as fd: - for line in lines: - fd.write(str(line) + '\n') + try: + with open(self.path, 'w') as fd: + for line in lines: + fd.write(str(line) + '\n') + except EnvironmentError as e: + # should never happen + raise cdist.Error(str(e)) def __repr__(self): return repr(list(self)) @@ -106,9 +110,12 @@ class DirectoryDict(collections.MutableMapping): if not os.path.isabs(path): raise AbsolutePathRequiredError(path) self.path = path - # create directory if it doesn't exist - if not os.path.isdir(self.path): - os.mkdir(self.path) + try: + # create directory if it doesn't exist + if not os.path.isdir(self.path): + os.mkdir(self.path) + except EnvironmentError as e: + raise cdist.Error(str(e)) if initial is not None: self.update(initial) if kwargs: @@ -125,8 +132,11 @@ class DirectoryDict(collections.MutableMapping): raise KeyError(key) def __setitem__(self, key, value): - with open(os.path.join(self.path, key), "w") as fd: - fd.write(str(value)) + try: + with open(os.path.join(self.path, key), "w") as fd: + fd.write(str(value)) + except EnvironmentError as e: + raise cdist.Error(str(e)) def __delitem__(self, key): try: @@ -135,10 +145,16 @@ class DirectoryDict(collections.MutableMapping): raise KeyError(key) def __iter__(self): - return iter(os.listdir(self.path)) + try: + return iter(os.listdir(self.path)) + except EnvironmentError as e: + raise cdist.Error(str(e)) def __len__(self): - return len(os.listdir(self.path)) + try: + return len(os.listdir(self.path)) + except EnvironmentError as e: + raise cdist.Error(str(e)) class FileBasedProperty(object): @@ -234,7 +250,10 @@ class FileBooleanProperty(FileBasedProperty): def __set__(self, instance, value): path = self._get_path(instance) if value: - open(path, "w").close() + try: + open(path, "w").close() + except EnvironmentError as e: + raise cdist.Error(str(e)) else: try: os.remove(path) @@ -262,8 +281,11 @@ class FileStringProperty(FileBasedProperty): def __set__(self, instance, value): path = self._get_path(instance) if value: - with open(path, "w") as fd: - fd.write(str(value)) + try: + with open(path, "w") as fd: + fd.write(str(value)) + except EnvironmentError as e: + raise cdist.Error(str(e)) else: try: os.remove(path) From 71606370148a0b20ab34d9c15af7f0612cb5ede3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 13:29:44 +0200 Subject: [PATCH 0877/1024] remove trailing whitespace: :%s/ *$//g Signed-off-by: Nico Schottelius --- lib/cdist/util/fsproperty.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index 5c95d1b4..55428c4d 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -77,7 +77,7 @@ class FileList(collections.MutableSequence): def __getitem__(self, index): return self.__read()[index] - + def __setitem__(self, index, value): lines = self.__read() lines[index] = value @@ -134,7 +134,7 @@ class DirectoryDict(collections.MutableMapping): def __setitem__(self, key, value): try: with open(os.path.join(self.path, key), "w") as fd: - fd.write(str(value)) + fd.write(str(value)) except EnvironmentError as e: raise cdist.Error(str(e)) From 7bb81e2f188148902ecfe2424e81c25e63c5186f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 13:32:36 +0200 Subject: [PATCH 0878/1024] Whitespace does not not weigh anything - remove - sed -i 's/ *$//g' *py */*py Signed-off-by: Nico Schottelius --- lib/cdist/__init__.py | 2 +- lib/cdist/config_install.py | 6 +++--- lib/cdist/context.py | 2 +- lib/cdist/core/manifest.py | 2 +- lib/cdist/core/object.py | 2 +- lib/cdist/core/type.py | 2 +- lib/cdist/emulator.py | 4 ++-- lib/cdist/exec/local.py | 4 ++-- lib/cdist/exec/remote.py | 6 +++--- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index a3dc01cc..abdadf62 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -19,7 +19,7 @@ # # -BANNER = """ +BANNER = """ .. . .x+=:. s dF @88> z` ^% :8 '88bu. %8P . Date: Tue, 18 Oct 2011 14:23:06 +0200 Subject: [PATCH 0879/1024] verify manifest environment Signed-off-by: Steven Armstrong --- lib/cdist/test/manifest/__init__.py | 41 +++++++++++++++++++ .../fixtures/conf/manifest/dump_environment | 12 +++--- .../conf/type/__dump_environment/manifest | 19 +++++---- 3 files changed, 59 insertions(+), 13 deletions(-) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index efda5b0a..f091e494 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -27,6 +27,8 @@ import shutil import string import random import logging +import io +import sys import cdist from cdist.exec import local @@ -48,6 +50,8 @@ class ManifestTestCase(unittest.TestCase): return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) def setUp(self): + self.orig_environ = os.environ + os.environ = os.environ.copy() self.temp_dir = self.mkdtemp() self.target_host = 'localhost' out_path = self.temp_dir @@ -58,17 +62,54 @@ class ManifestTestCase(unittest.TestCase): self.log = logging.getLogger(self.target_host) def tearDown(self): + os.environ = self.orig_environ shutil.rmtree(self.temp_dir) def test_initial_manifest_environment(self): initial_manifest = os.path.join(self.local.manifest_path, "dump_environment") + handle, output_file = self.mkstemp(dir=self.temp_dir) + os.environ['__cdist_test_out'] = output_file self.manifest.run_initial_manifest(initial_manifest) + with open(output_file, 'r') as fd: + output_string = fd.read() + print("output_string: %s" % output_string) + output_dict = {} + for line in output_string.split('\n'): + if line: + key,value = line.split(': ') + output_dict[key] = value + self.assertTrue(output_dict['PATH'].startswith(self.local.bin_path)) + self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__global'], self.local.out_path) + self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_path) + self.assertEqual(output_dict['__manifest'], self.local.manifest_path) + def test_type_manifest_environment(self): cdist_type = core.Type(self.local.type_path, '__dump_environment') cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') + handle, output_file = self.mkstemp(dir=self.temp_dir) + os.environ['__cdist_test_out'] = output_file self.manifest.run_type_manifest(cdist_object) + with open(output_file, 'r') as fd: + output_string = fd.read() + print("output_string: %s" % output_string) + output_dict = {} + for line in output_string.split('\n'): + if line: + key,value = line.split(': ') + output_dict[key] = value + self.assertTrue(output_dict['PATH'].startswith(self.local.bin_path)) + self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__global'], self.local.out_path) + self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_path) + self.assertEqual(output_dict['__type'], cdist_type.absolute_path) + self.assertEqual(output_dict['__object'], cdist_object.absolute_path) + self.assertEqual(output_dict['__self'], cdist_object.path) + self.assertEqual(output_dict['__object_id'], cdist_object.object_id) + self.assertEqual(output_dict['__object_fq'], cdist_object.path) + def test_debug_env_setup(self): self.log.setLevel(logging.DEBUG) manifest = cdist.core.manifest.Manifest(self.target_host, self.local) diff --git a/lib/cdist/test/manifest/fixtures/conf/manifest/dump_environment b/lib/cdist/test/manifest/fixtures/conf/manifest/dump_environment index 1abe7755..7ce983ab 100755 --- a/lib/cdist/test/manifest/fixtures/conf/manifest/dump_environment +++ b/lib/cdist/test/manifest/fixtures/conf/manifest/dump_environment @@ -1,7 +1,9 @@ #!/bin/sh -echo "PATH: $PATH" -echo "__target_host: $__target_host" -echo "__global: $__global" -echo "__cdist_type_base_path: $__cdist_type_base_path" -echo "__manifest: $__manifest" +cat > $__cdist_test_out << DONE +PATH: $PATH +__target_host: $__target_host +__global: $__global +__cdist_type_base_path: $__cdist_type_base_path +__manifest: $__manifest +DONE diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest b/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest index 92f533a8..212de64d 100755 --- a/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest +++ b/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest @@ -1,10 +1,13 @@ #!/bin/sh -echo "PATH: $PATH" -echo "__target_host: $__target_host" -echo "__global: $__global" -echo "__cdist_type_base_path: $__cdist_type_base_path" -echo "__type: $__type" -echo "__object: $__object" -echo "__object_id: $__object_id" -echo "__object_fq: $__object_fq" +cat > $__cdist_test_out << DONE +PATH: $PATH +__target_host: $__target_host +__global: $__global +__cdist_type_base_path: $__cdist_type_base_path +__type: $__type +__self: $__self +__object: $__object +__object_id: $__object_id +__object_fq: $__object_fq +DONE From 1805c16fd4cd94372f6ec33466e5185a5ac56f83 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 14:23:46 +0200 Subject: [PATCH 0880/1024] --debug Signed-off-by: Steven Armstrong --- lib/cdist/test/manifest/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index f091e494..45902477 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -73,7 +73,6 @@ class ManifestTestCase(unittest.TestCase): with open(output_file, 'r') as fd: output_string = fd.read() - print("output_string: %s" % output_string) output_dict = {} for line in output_string.split('\n'): if line: @@ -94,7 +93,6 @@ class ManifestTestCase(unittest.TestCase): with open(output_file, 'r') as fd: output_string = fd.read() - print("output_string: %s" % output_string) output_dict = {} for line in output_string.split('\n'): if line: From e58b52592b36120a21969690a1da9f1350224eba Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 14:24:52 +0200 Subject: [PATCH 0881/1024] add missing environment variable __self Signed-off-by: Steven Armstrong --- lib/cdist/core/manifest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index 50964fdc..84092892 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -92,6 +92,7 @@ class Manifest(object): env = os.environ.copy() env.update(self.env) env.update({ + '__self': cdist_object.path, '__object': cdist_object.absolute_path, '__object_id': cdist_object.object_id, '__object_fq': cdist_object.path, From af367a76f8f1c9c2ea838b5f8f28db3d6e4e2d6f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 14:41:38 +0200 Subject: [PATCH 0882/1024] test for: .cdist may not be used in object_id Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 9a13f524..84d2cf8f 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -53,12 +53,18 @@ class ObjectClassTestCase(unittest.TestCase): class ObjectIdTestCase(unittest.TestCase): - def test_illegal_object_id(self): + def test_object_id_starts_with_slash(self): cdist_type = core.Type(type_base_path, '__third') illegal_object_id = '/object_id/may/not/start/with/slash' with self.assertRaises(core.IllegalObjectIdError): core.Object(cdist_type, object_base_path, illegal_object_id) + def test_object_id_contains_dotcdist(self): + cdist_type = core.Type(type_base_path, '__third') + illegal_object_id = 'object_id/may/not/contain/.cdist/anywhere' + with self.assertRaises(core.IllegalObjectIdError): + core.Object(cdist_type, object_base_path, illegal_object_id) + class ObjectTestCase(unittest.TestCase): From 030d5919e621cc696ba647d571a73373c3d92664 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 14:42:57 +0200 Subject: [PATCH 0883/1024] raise exception if object_id contains .cdist Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index eeb5799b..f22c206a 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -88,8 +88,11 @@ class Object(object): return self.__class__(self.type.__class__(type_path, type_name), object_path, object_id=object_id) def __init__(self, cdist_type, base_path, object_id=None): - if object_id and object_id.startswith('/'): - raise IllegalObjectIdError(object_id, 'object_id may not start with /') + if object_id: + if object_id.startswith('/'): + raise IllegalObjectIdError(object_id, 'object_id may not start with /') + if '.cdist' in object_id: + raise IllegalObjectIdError(object_id, 'object_id may not contain \'.cdist\'') self.type = cdist_type # instance of Type self.base_path = base_path self.object_id = object_id From 2a5465c03cac30523f8fa5159e738e655f8ebe66 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 14:48:06 +0200 Subject: [PATCH 0884/1024] test that emulator fails if requirement has illegal object_id Signed-off-by: Steven Armstrong --- lib/cdist/test/emulator/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cdist/test/emulator/__init__.py b/lib/cdist/test/emulator/__init__.py index 66e7918a..ccdda265 100644 --- a/lib/cdist/test/emulator/__init__.py +++ b/lib/cdist/test/emulator/__init__.py @@ -73,3 +73,10 @@ class EmulatorTestCase(unittest.TestCase): os.environ['require'] = '__does-not-exist/some-id' emu = emulator.Emulator(argv) self.assertRaises(core.NoSuchTypeError, emu.run) + + def test_illegal_object_id_requirement(self): + argv = ['__file', '/tmp/foobar'] + os.environ.update(self.env) + os.environ['require'] = '__file/bad/id/with/.cdist/inside' + emu = emulator.Emulator(argv) + self.assertRaises(core.IllegalObjectIdError, emu.run) From 2246b7496ba8c21ecca5737dff5dbe0d963fe4c2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 14:50:28 +0200 Subject: [PATCH 0885/1024] fails if requirement has illegal object_id Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index b5682342..10c2dbaa 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -158,9 +158,6 @@ class Emulator(object): requirement_type_name = requirement_parts[0] requirement_object_id = requirement_parts[1] - # Instantiate type which fails if type does not exist - requirement_type = core.Type(self.type_base_path, requirement_type_name) - # FIXME: Add support for omitted object id == singleton #if len(requirement_parts) == 1: #except IndexError: @@ -170,6 +167,11 @@ class Emulator(object): # Remove / if existent in object id requirement_object_id = requirement_object_id.lstrip('/') + # Instantiate type which fails if type does not exist + requirement_type = core.Type(self.type_base_path, requirement_type_name) + # Instantiate object which fails if the object_id is illegal + requirement_object = core.Object(requirement_type, self.object_base_path, requirement_object_id) + # Construct cleaned up requirement with only one / :-) requirement = requirement_type_name + '/' + requirement_object_id self.cdist_object.requirements.append(requirement) From 205cd7b28ad4396cafe59d4e492e8e9a2a4503aa Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 14:55:20 +0200 Subject: [PATCH 0886/1024] fix the test Signed-off-by: Steven Armstrong --- lib/cdist/test/manifest/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index 45902477..14d6be8a 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -104,7 +104,7 @@ class ManifestTestCase(unittest.TestCase): self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_path) self.assertEqual(output_dict['__type'], cdist_type.absolute_path) self.assertEqual(output_dict['__object'], cdist_object.absolute_path) - self.assertEqual(output_dict['__self'], cdist_object.path) + self.assertEqual(output_dict['__self'], cdist_object.name) self.assertEqual(output_dict['__object_id'], cdist_object.object_id) self.assertEqual(output_dict['__object_fq'], cdist_object.path) From d427e3f5856df6bb87e8f349c998805dcaf1845d Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 18 Oct 2011 14:56:35 +0200 Subject: [PATCH 0887/1024] __self should not contain .cdist Signed-off-by: Steven Armstrong --- lib/cdist/core/manifest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index 84092892..bae44ebc 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -92,10 +92,10 @@ class Manifest(object): env = os.environ.copy() env.update(self.env) env.update({ - '__self': cdist_object.path, + '__self': cdist_object.name, '__object': cdist_object.absolute_path, '__object_id': cdist_object.object_id, - '__object_fq': cdist_object.path, + '__object_fq': cdist_object.name, '__type': cdist_object.type.absolute_path, '__cdist_manifest': script, }) From 837489ce8546806ae765fcc96eca0795a016a0bb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 15:54:08 +0200 Subject: [PATCH 0888/1024] remove obsolete preseed code from __package_apt Signed-off-by: Nico Schottelius --- conf/type/__package_apt/gencode-remote | 7 ------- 1 file changed, 7 deletions(-) diff --git a/conf/type/__package_apt/gencode-remote b/conf/type/__package_apt/gencode-remote index df8fd823..a5384ee3 100755 --- a/conf/type/__package_apt/gencode-remote +++ b/conf/type/__package_apt/gencode-remote @@ -27,13 +27,6 @@ else name="$__object_id" fi -# Check for preseeding and add preseed as here document -if [ -f "$__object/parameter/preseed" ]; then - echo "debconf-set-selections << __file-eof" - cat "$(cat "$__object/parameter/preseed")" - echo "__file-eof" -fi - state="$(cat "$__object/parameter/state")" is_installed="$(grep "^Status: install ok installed" "$__object/explorer/pkg_status" || true)" From 27fd9cd61be398d9cabe14ee09ee66a73d89a381 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 16:05:47 +0200 Subject: [PATCH 0889/1024] add sudo example Signed-off-by: Nico Schottelius --- other/examples/types/__nico_sudo/README | 2 ++ .../types/__nico_sudo/files/sudo-nico | 13 ++++++++ other/examples/types/__nico_sudo/manifest | 30 ++++++++++++++++++ .../types/__nico_sudo/parameter/gencode | 31 +++++++++++++++++++ .../types/__nico_sudo/parameter/manifest | 31 +++++++++++++++++++ .../types/__nico_sudo/parameter/optional | 0 .../types/__nico_sudo/parameter/required | 0 other/examples/types/__nico_sudo/singleton | 0 8 files changed, 107 insertions(+) create mode 100644 other/examples/types/__nico_sudo/README create mode 100644 other/examples/types/__nico_sudo/files/sudo-nico create mode 100755 other/examples/types/__nico_sudo/manifest create mode 100644 other/examples/types/__nico_sudo/parameter/gencode create mode 100644 other/examples/types/__nico_sudo/parameter/manifest create mode 100644 other/examples/types/__nico_sudo/parameter/optional create mode 100644 other/examples/types/__nico_sudo/parameter/required create mode 100644 other/examples/types/__nico_sudo/singleton diff --git a/other/examples/types/__nico_sudo/README b/other/examples/types/__nico_sudo/README new file mode 100644 index 00000000..5e4cf0d3 --- /dev/null +++ b/other/examples/types/__nico_sudo/README @@ -0,0 +1,2 @@ +Configure sudoers file to be included. Different types may do so, +this one simply uses the "nico" file to store the configuration. diff --git a/other/examples/types/__nico_sudo/files/sudo-nico b/other/examples/types/__nico_sudo/files/sudo-nico new file mode 100644 index 00000000..d904c319 --- /dev/null +++ b/other/examples/types/__nico_sudo/files/sudo-nico @@ -0,0 +1,13 @@ +# +# Cdist managed file +# + +# Personal one: nico, shared one: lyni +User_Alias NICO = nico, lyni + +Defaults timestamp_timeout=5 +Defaults !tty_tickets + +# Give out permissions +NICO ALL=(ALL) ALL +NICO ALL=(ALL) NOPASSWD: /usr/sbin/pm-suspend diff --git a/other/examples/types/__nico_sudo/manifest b/other/examples/types/__nico_sudo/manifest new file mode 100755 index 00000000..5de33973 --- /dev/null +++ b/other/examples/types/__nico_sudo/manifest @@ -0,0 +1,30 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +destination=/etc/sudoers.d/nico +source="$__type/files/sudo-nico" + +__package sudo --state installed +__directory /etc/sudoers.d --parents yes + +require="__directory/etc/sudoers.d" \ + __file "$destination" --source "$source" --mode 0440 + diff --git a/other/examples/types/__nico_sudo/parameter/gencode b/other/examples/types/__nico_sudo/parameter/gencode new file mode 100644 index 00000000..74792abf --- /dev/null +++ b/other/examples/types/__nico_sudo/parameter/gencode @@ -0,0 +1,31 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# USEFUL DESCRIPTION +# + +# +# This file should generate code on stdout, which will be collected by cdist +# and run on the target. +# +# To tell cdist to make use of it, you need to make it executable (chmod +x) +# +# + diff --git a/other/examples/types/__nico_sudo/parameter/manifest b/other/examples/types/__nico_sudo/parameter/manifest new file mode 100644 index 00000000..c696eda6 --- /dev/null +++ b/other/examples/types/__nico_sudo/parameter/manifest @@ -0,0 +1,31 @@ +#!/bin/sh +# +# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# USEFUL DESCRIPTION +# + +# +# This is the manifest, which can be used to create other objects like this: +# __file /path/to/destination --source /from/where/ +# +# To tell cdist to make use of it, you need to make it executable (chmod +x) +# +# + diff --git a/other/examples/types/__nico_sudo/parameter/optional b/other/examples/types/__nico_sudo/parameter/optional new file mode 100644 index 00000000..e69de29b diff --git a/other/examples/types/__nico_sudo/parameter/required b/other/examples/types/__nico_sudo/parameter/required new file mode 100644 index 00000000..e69de29b diff --git a/other/examples/types/__nico_sudo/singleton b/other/examples/types/__nico_sudo/singleton new file mode 100644 index 00000000..e69de29b From e3f3c48b220180fcfe61af953abe4c6610675444 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 20:34:35 +0200 Subject: [PATCH 0890/1024] wrap the whole program in the try...except KeyboardInterrupt block Signed-off-by: Nico Schottelius --- bin/cdist | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/bin/cdist b/bin/cdist index 14cff65a..78893b60 100755 --- a/bin/cdist +++ b/bin/cdist @@ -20,26 +20,10 @@ # # -import argparse -import logging -import multiprocessing -import os -import re -import sys -import time - -log = logging.getLogger("cdist") - -# 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'))) - -import cdist - -TYPE_PREFIX = "__" - def commandline(): """Parse command line""" + import argparse + import cdist.banner import cdist.config import cdist.install @@ -203,6 +187,23 @@ def emulator(): if __name__ == "__main__": try: + import logging + import multiprocessing + import os + import re + import sys + import time + + log = logging.getLogger("cdist") + + # 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'))) + + import cdist + + TYPE_PREFIX = "__" + logging.basicConfig(format='%(levelname)s: %(message)s') if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): @@ -214,3 +215,5 @@ if __name__ == "__main__": sys.exit(0) sys.exit(0) + + From 0344796d31f4cfdf5305b09b3e85d0aa162f3cfb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 20:36:35 +0200 Subject: [PATCH 0891/1024] restructure imports Signed-off-by: Nico Schottelius --- bin/cdist | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/cdist b/bin/cdist index 78893b60..0705f5bd 100755 --- a/bin/cdist +++ b/bin/cdist @@ -101,6 +101,9 @@ def install(args): def configinstall(args, mode): """Configure or install remote system""" + import multiprocessing + import time + try: process = {} failed_hosts = [] @@ -188,11 +191,9 @@ def emulator(): if __name__ == "__main__": try: import logging - import multiprocessing import os import re import sys - import time log = logging.getLogger("cdist") From 8b9e6780b8ec8de7781da3024fbb4eb18c16cbd8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 20:42:09 +0200 Subject: [PATCH 0892/1024] no need for a constant that's used two lines below Signed-off-by: Nico Schottelius --- bin/cdist | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/cdist b/bin/cdist index 0705f5bd..6a7a2d6d 100755 --- a/bin/cdist +++ b/bin/cdist @@ -195,19 +195,17 @@ if __name__ == "__main__": import re import sys + import cdist + log = logging.getLogger("cdist") # 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'))) - import cdist - - TYPE_PREFIX = "__" - logging.basicConfig(format='%(levelname)s: %(message)s') - if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): + if re.match("__", os.path.basename(sys.argv[0])): emulator() else: commandline() From 68d87c3023f280b5d017d5082c0c17939afefde8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 22:34:51 +0200 Subject: [PATCH 0893/1024] reference new and old variable, remove reference to cdist-config Signed-off-by: Nico Schottelius --- doc/man/cdist-reference.text.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 57dbde4a..a80a6ce3 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -133,7 +133,6 @@ out/object//explorers:: tmp_dir:: A tempdir and a tempfile is used by cdist internally, which will be removed when the scripts end automatically. - See cdist-config(1). TYPES ----- @@ -186,6 +185,7 @@ __object:: __object_id:: The type unique object id. Available for: type manifest, type explorer, type gencode +__self:: __object_fq:: The full qualified name of the current object. Available for: type manifest, type explorer, type gencode From 7d749540d83d4fb1417fc4798bb5b31322e403cf Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 22:40:17 +0200 Subject: [PATCH 0894/1024] changes for 2.0.4 Signed-off-by: Nico Schottelius --- doc/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/changelog b/doc/changelog index aae0e04a..7403b466 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,3 +1,6 @@ +2.0.4: + * Bugfix core: Remove traceback when sending SIGINT (aka Ctrl-C) + 2.0.3: 2011-10-18 * Improved logging, added --verbose, by more quiet by default * Bugfix __user: Correct quoting (Steven Armstrong) From b7fdfb12e6952d6a047307b159999252339cd89b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 22:40:29 +0200 Subject: [PATCH 0895/1024] cleanups Signed-off-by: Nico Schottelius --- bin/cdist | 2 -- build | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index 6a7a2d6d..0f37db2e 100755 --- a/bin/cdist +++ b/bin/cdist @@ -214,5 +214,3 @@ if __name__ == "__main__": sys.exit(0) sys.exit(0) - - diff --git a/build b/build index 9e9fbf21..38fdac07 100755 --- a/build +++ b/build @@ -144,8 +144,9 @@ case "$1" in echo '' echo 'Here are the possible targets:' echo '' - echo ' man: Build manpages (requires Asciidoc)' echo ' clean: Remove build stuff' + echo ' man: Build manpages (requires Asciidoc)' + echo ' test: Run tests' echo '' echo '' echo "Unknown target, \"$1\"" >&2 From 3814dcd7287eaffdfdf6241c46d517dcffea8cf7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 18 Oct 2011 23:12:35 +0200 Subject: [PATCH 0896/1024] remove old test ideas from todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 54 ------------------------------------------- 1 file changed, 54 deletions(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 8f5c6e4f..cb5b9158 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -2,60 +2,6 @@ - sanity checks: implement tests - stage_run() - - ensure that for every object in - cdist.core.Object.list_objects() is passed into - self.object_run() - - instantiate + overwrite + test - - object_prepare(): - - calls (in this order): - self.run_type_explorer(cdist_object) - self.run_type_manifest(cdist_object) - cdist_object.prepared = True - - object is prepared after function call - - - stage_prepare(): - - calls (in this order): - self.link_emulator() - self.run_global_explorers() - self.run_initial_manifest() - - - ensure that all objects are created :-) - - as defined in inital manifest + type manifests - - deploy_to() - - ensure self.stage_prepare() and self.stage_run() are - run. [ORDER] - - instantiate + overwrite + test - - deploy_and_cleanup() - - ensure self.deploy_to() + self.cleanup() are are run - run. [ORDER] - - instantiate + overwrite + test - - transfer_object_parameter() - - check that object parameters are transferred - - paths are setup correctly - - test via mock of remote_mkdir and transfer_path - - ensure self.remote_mkdir, self.transfer_path are run. [ORDER] - - instantiate + overwrite + test - - transfer_global_explorers() - - paths are setup correctly - - test via mock of self.remote_mkdir() and self.transfer_path() - - ensure self.remote_mkdir, self.transfer_path are run. [ORDER] - - instantiate + overwrite + test - - transfer_type_explorers(): - - Explorers are not transferred twice - - paths are setup correctly - - test via mock of self.remote_mkdir() and self.transfer_path() - - Explorers are transferred - - test via mock of self.remote_mkdir() and self.transfer_path() - - -------------------------------------------------------------------------------- - insert prefix into logger to distinguish between modules From 02de3969059430fe4520957f318cb3bf72fc6666 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 14:50:16 +0200 Subject: [PATCH 0897/1024] tests for Object state Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 84d2cf8f..7064b34d 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -79,6 +79,7 @@ class ObjectTestCase(unittest.TestCase): self.cdist_object.source = [] self.cdist_object.code_local = '' self.cdist_object.code_remote = '' + self.cdist_object.state = '' def test_name(self): self.assertEqual(self.cdist_object.name, '__third/moon') @@ -163,6 +164,21 @@ class ObjectTestCase(unittest.TestCase): self.cdist_object.ran = True self.assertTrue(self.cdist_object.ran) + def test_state(self): + self.assertEqual(self.cdist_object.state, '') + + def test_state_ran(self): + self.cdist_object.state = core.Object.STATE_RAN + self.assertEqual(self.cdist_object.state, core.Object.STATE_RAN) + + def test_state_running(self): + self.cdist_object.state = core.Object.STATE_RUNNING + self.assertEqual(self.cdist_object.state, core.Object.STATE_RUNNING) + + def test_state_prepared(self): + self.cdist_object.state = core.Object.STATE_PREPARED + self.assertEqual(self.cdist_object.state, core.Object.STATE_PREPARED) + def test_source(self): self.assertEqual(list(self.cdist_object.source), []) From 4f398a834fbd0095bad54bda0f14c43416951c52 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 14:53:06 +0200 Subject: [PATCH 0898/1024] /ran/done/ Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 7064b34d..c5e9e2dd 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -167,17 +167,17 @@ class ObjectTestCase(unittest.TestCase): def test_state(self): self.assertEqual(self.cdist_object.state, '') - def test_state_ran(self): - self.cdist_object.state = core.Object.STATE_RAN - self.assertEqual(self.cdist_object.state, core.Object.STATE_RAN) + def test_state_prepared(self): + self.cdist_object.state = core.Object.STATE_PREPARED + self.assertEqual(self.cdist_object.state, core.Object.STATE_PREPARED) def test_state_running(self): self.cdist_object.state = core.Object.STATE_RUNNING self.assertEqual(self.cdist_object.state, core.Object.STATE_RUNNING) - def test_state_prepared(self): - self.cdist_object.state = core.Object.STATE_PREPARED - self.assertEqual(self.cdist_object.state, core.Object.STATE_PREPARED) + def test_state_done(self): + self.cdist_object.state = core.Object.STATE_DONE + self.assertEqual(self.cdist_object.state, core.Object.STATE_DONE) def test_source(self): self.assertEqual(list(self.cdist_object.source), []) From 022b17d70067c933505925c3c5b5920ed664be6f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 14:53:31 +0200 Subject: [PATCH 0899/1024] implement Object state Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 8cecfe6d..a35182d2 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -51,6 +51,11 @@ class Object(object): """ + # Constants for use with Object.state + STATE_PREPARED = "prepared" + STATE_RUNNING = "running" + STATE_DONE = "done" + @classmethod def list_objects(cls, object_base_path, type_base_path): """Return a list of object instances""" @@ -127,6 +132,7 @@ class Object(object): changed = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "changed")) prepared = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "prepared")) ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran")) + state = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "state")) source = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, "source")) code_local = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_local_path)) code_remote = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_remote_path)) From ff2192f6dea1a6899fb662e8e355ae0b92bfc689 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 14:54:15 +0200 Subject: [PATCH 0900/1024] remove legacy attributes: ran, prepared Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index a35182d2..5157d86a 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -130,8 +130,6 @@ class Object(object): parameters = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.parameter_path)) explorers = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.explorer_path)) changed = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "changed")) - prepared = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "prepared")) - ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran")) state = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "state")) source = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, "source")) code_local = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_local_path)) From f732220e7794cd4bbf568d58816c2aba940db7b7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 14:54:38 +0200 Subject: [PATCH 0901/1024] remove legacy tests Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index c5e9e2dd..ab05c7af 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -150,20 +150,6 @@ class ObjectTestCase(unittest.TestCase): self.cdist_object.changed = True self.assertTrue(self.cdist_object.changed) - def test_prepared(self): - self.assertFalse(self.cdist_object.prepared) - - def test_prepared_after_changing(self): - self.cdist_object.prepared = True - self.assertTrue(self.cdist_object.prepared) - - def test_ran(self): - self.assertFalse(self.cdist_object.ran) - - def test_ran_after_changing(self): - self.cdist_object.ran = True - self.assertTrue(self.cdist_object.ran) - def test_state(self): self.assertEqual(self.cdist_object.state, '') From c621af1e9f354e24b4dd1c00d60a3a29c796a7fc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 19 Oct 2011 14:55:16 +0200 Subject: [PATCH 0902/1024] begin tutorial sections Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-tutorial.text | 91 ++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/doc/man/man7/cdist-tutorial.text b/doc/man/man7/cdist-tutorial.text index 80135da9..c547b3e5 100644 --- a/doc/man/man7/cdist-tutorial.text +++ b/doc/man/man7/cdist-tutorial.text @@ -6,6 +6,97 @@ Nico Schottelius NAME ---- cdist-tutorial - a guided introduction into cdist + + + +YOUR FIRST CONFIGURATION +------------------------ + + +DEFINE STATE IN THE INITAL MANIFEST +----------------------------------- + +The initial manifest is used to map +configurations to a host. + +USING SOME BASIC TYPES +---------------------- +what is a type, how to use it, + + +CREATING YOUR FIRST OWN TYPE +---------------------------- + + + +USE A TYPE TO BUNDLE FUNCTIONALITY +---------------------------------- + + +USING EXPLORERS +--------------- +global, type explorer + + +DEBUGGING YOUR TYPES +-------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + INTRODUCTION From ef5eb34274c6770810abeb5f0c7b5b13b2cb3a67 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 14:57:32 +0200 Subject: [PATCH 0903/1024] update test for upcomming change: /__debug/__cdist_debug/ Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 2 +- lib/cdist/test/explorer/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index c9761a4b..514acb4a 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -120,4 +120,4 @@ class CodeTestCase(unittest.TestCase): def test_debug_env_setup(self): self.log.setLevel(logging.DEBUG) code = cdist.core.code.Code(self.target_host, self.local, self.remote) - self.assertTrue("__debug" in code.env) + self.assertTrue("__cdist_debug" in code.env) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index fe23b7e2..341371cd 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -130,4 +130,4 @@ class ExplorerClassTestCase(unittest.TestCase): def test_debug_env_setup(self): self.log.setLevel(logging.DEBUG) explorer = cdist.core.explorer.Explorer(self.target_host, self.local, self.remote) - self.assertTrue("__debug" in explorer.env) + self.assertTrue("__cdist_debug" in explorer.env) From 1fb96c0fc20448c9c13f90839c6cc8c1d600908f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 14:58:25 +0200 Subject: [PATCH 0904/1024] update test for upcomming change: /__debug/__cdist_debug/ Signed-off-by: Steven Armstrong --- lib/cdist/test/manifest/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index 14d6be8a..bf573a9c 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -111,4 +111,4 @@ class ManifestTestCase(unittest.TestCase): def test_debug_env_setup(self): self.log.setLevel(logging.DEBUG) manifest = cdist.core.manifest.Manifest(self.target_host, self.local) - self.assertTrue("__debug" in manifest.env) + self.assertTrue("__cdist_debug" in manifest.env) From 07ef08938b25f0fd1f3af2de2fa6fc666df9ff67 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 19 Oct 2011 15:01:55 +0200 Subject: [PATCH 0905/1024] remove __debug, should not be setup by cdist Signed-off-by: Nico Schottelius --- doc/man/cdist-reference.text.sh | 5 ----- doc/man/man7/cdist-tutorial.text | 6 +++++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index a80a6ce3..257ca36e 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -165,11 +165,6 @@ changed:: ENVIRONMENT VARIABLES --------------------- -__debug:: - If this variable is setup, cdist runs in debug mode. - You can use this information, to only output stuff in debug - mode as well. - Available for: initial manifest, type manifest, gencode, code __explorer:: Directory that contains all global explorers. Available for: explorer diff --git a/doc/man/man7/cdist-tutorial.text b/doc/man/man7/cdist-tutorial.text index c547b3e5..71bf18c0 100644 --- a/doc/man/man7/cdist-tutorial.text +++ b/doc/man/man7/cdist-tutorial.text @@ -40,7 +40,11 @@ global, type explorer DEBUGGING YOUR TYPES -------------------- - +__debug:: + If this variable is setup, cdist runs in debug mode. + You can use this information, to only output stuff in debug + mode as well. + Available for: initial manifest, type manifest, gencode, code From eb5b80d132fd7a9acb30b546e7491392b7352ee1 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:02:17 +0200 Subject: [PATCH 0906/1024] remove legacy tests Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 5 ----- lib/cdist/test/explorer/__init__.py | 5 ----- 2 files changed, 10 deletions(-) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index 514acb4a..c177f49c 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -116,8 +116,3 @@ class CodeTestCase(unittest.TestCase): self.cdist_object.code_remote = self.code.run_gencode_remote(self.cdist_object) self.code.transfer_code_remote(self.cdist_object) self.code.run_code_remote(self.cdist_object) - - def test_debug_env_setup(self): - self.log.setLevel(logging.DEBUG) - code = cdist.core.code.Code(self.target_host, self.local, self.remote) - self.assertTrue("__cdist_debug" in code.env) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index 341371cd..42b83ee8 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -126,8 +126,3 @@ class ExplorerClassTestCase(unittest.TestCase): self.explorer.transfer_type_explorers(cdist_type) output = self.explorer.run_type_explorer('world', cdist_object) self.assertEqual(output, 'hello\n') - - def test_debug_env_setup(self): - self.log.setLevel(logging.DEBUG) - explorer = cdist.core.explorer.Explorer(self.target_host, self.local, self.remote) - self.assertTrue("__cdist_debug" in explorer.env) From dc3ed07153543a58c24a9bf31f93b3c4ec781e89 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:03:47 +0200 Subject: [PATCH 0907/1024] /__debug/__cdist_debug/ Signed-off-by: Steven Armstrong --- lib/cdist/core/manifest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index f7b08c20..38d2ee98 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -75,7 +75,7 @@ class Manifest(object): '__cdist_type_base_path': self.local.type_path, # for use in type emulator } if self.log.getEffectiveLevel() == logging.DEBUG: - self.env.update({'__debug': "yes" }) + self.env.update({'__cdist_debug': "yes" }) def run_initial_manifest(self, script): From 8f306a748484b5151098cb233260a22fd0c42045 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:04:14 +0200 Subject: [PATCH 0908/1024] /__debug/__cdist_debug/ Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 7e7e12b4..4880c6e6 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -82,7 +82,7 @@ class Emulator(object): logformat = '%(levelname)s: %(message)s' logging.basicConfig(format=logformat) - if '__debug' in os.environ: + if '__cdist_debug' in os.environ: logging.root.setLevel(logging.DEBUG) else: logging.root.setLevel(logging.INFO) From b56925d24a7cfd197df358d9226f830f78900dd2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:15:05 +0200 Subject: [PATCH 0909/1024] /__object_fq/__object_name/ Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 6 ++++-- .../fixtures/conf/type/__dump_environment/gencode-local | 3 ++- lib/cdist/test/manifest/__init__.py | 4 ++-- .../manifest/fixtures/conf/type/__dump_environment/manifest | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index c177f49c..68e8a41d 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -85,7 +85,8 @@ class CodeTestCase(unittest.TestCase): self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path) self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) - self.assertEqual(output_dict['__object_fq'], self.cdist_object.path) + 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) @@ -100,7 +101,8 @@ class CodeTestCase(unittest.TestCase): self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path) self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) - self.assertEqual(output_dict['__object_fq'], self.cdist_object.path) + 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/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local index ac292546..ed1265c9 100755 --- a/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local +++ b/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local @@ -5,4 +5,5 @@ echo "echo __global: $__global" echo "echo __type: $__type" echo "echo __object: $__object" echo "echo __object_id: $__object_id" -echo "echo __object_fq: $__object_fq" +echo "echo __object_name: $__object_name" +echo "echo __self: $__self" diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index bf573a9c..257311d7 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -104,9 +104,9 @@ class ManifestTestCase(unittest.TestCase): self.assertEqual(output_dict['__cdist_type_base_path'], self.local.type_path) self.assertEqual(output_dict['__type'], cdist_type.absolute_path) self.assertEqual(output_dict['__object'], cdist_object.absolute_path) - self.assertEqual(output_dict['__self'], cdist_object.name) self.assertEqual(output_dict['__object_id'], cdist_object.object_id) - self.assertEqual(output_dict['__object_fq'], cdist_object.path) + 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/type/__dump_environment/manifest b/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest index 212de64d..e135de35 100755 --- a/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest +++ b/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest @@ -9,5 +9,5 @@ __type: $__type __self: $__self __object: $__object __object_id: $__object_id -__object_fq: $__object_fq +__object_name: $__object_name DONE From d6cf85e6f6407c7b9b5fec96c55a7799da4c0db7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:17:45 +0200 Subject: [PATCH 0910/1024] implement /__object_fq/__object_name/ Signed-off-by: Steven Armstrong --- lib/cdist/core/code.py | 3 ++- lib/cdist/core/manifest.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index 2505925c..51912559 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -105,7 +105,8 @@ class Code(object): '__type': cdist_object.type.absolute_path, '__object': cdist_object.absolute_path, '__object_id': cdist_object.object_id, - '__object_fq': cdist_object.path, + '__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/manifest.py b/lib/cdist/core/manifest.py index 38d2ee98..704a3978 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -92,10 +92,10 @@ class Manifest(object): env = os.environ.copy() env.update(self.env) env.update({ - '__self': cdist_object.name, '__object': cdist_object.absolute_path, '__object_id': cdist_object.object_id, - '__object_fq': cdist_object.name, + '__object_name': cdist_object.name, + '__self': cdist_object.name, '__type': cdist_object.type.absolute_path, '__cdist_manifest': script, }) From 28614b3dd408ad7e5119188da3d68a173d84e30d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 19 Oct 2011 15:19:08 +0200 Subject: [PATCH 0911/1024] DEPRECATE __self environment variable, use __object_name (documentation) Signed-off-by: Nico Schottelius --- doc/changelog | 3 +++ doc/man/cdist-reference.text.sh | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index 7403b466..aad067b7 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,5 +1,8 @@ 2.0.4: * Bugfix core: Remove traceback when sending SIGINT (aka Ctrl-C) + * Cleanup: __object_fq variable removed (never used) + * Cleanup: Environment variable __self DEPRECATED, use __object_name instead + * Cleanup: Environment variable __self scheduled for removal in cdist 2.1 2.0.3: 2011-10-18 * Improved logging, added --verbose, by more quiet by default diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 257ca36e..9127096c 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -181,7 +181,8 @@ __object_id:: The type unique object id. Available for: type manifest, type explorer, type gencode __self:: -__object_fq:: + DEPRECATED: Same as __object_name, do not use anymore, use __object_name instead. +__object_name:: The full qualified name of the current object. Available for: type manifest, type explorer, type gencode __target_host:: From ba6371c5849ca847f5ef3dd33b70721ed5e5852a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 19 Oct 2011 15:20:53 +0200 Subject: [PATCH 0912/1024] fix import error... stupid one Signed-off-by: Nico Schottelius --- bin/cdist | 8 +++++--- doc/dev/todo/niconext | 9 --------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/bin/cdist b/bin/cdist index 0f37db2e..466604fa 100755 --- a/bin/cdist +++ b/bin/cdist @@ -195,13 +195,15 @@ if __name__ == "__main__": import re import sys + # 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") - # 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'))) logging.basicConfig(format='%(levelname)s: %(message)s') diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index cb5b9158..2f9bb844 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,12 +1,3 @@ -2.0.3: - -- sanity checks: implement tests - --------------------------------------------------------------------------------- - -- insert prefix into logger to distinguish between modules - - in debug/info only? - - Fix / rewrite cdist-quickstart - write tutorial!!!!!!!!! From 0e7c532870f60f3edc19fab58d4d65ef71a263a2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 19 Oct 2011 15:32:06 +0200 Subject: [PATCH 0913/1024] add new state code, begin to detect circular dependencies Signed-off-by: Nico Schottelius --- bin/cdist | 1 - lib/cdist/config_install.py | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bin/cdist b/bin/cdist index 466604fa..ffda3e42 100755 --- a/bin/cdist +++ b/bin/cdist @@ -204,7 +204,6 @@ if __name__ == "__main__": log = logging.getLogger("cdist") - logging.basicConfig(format='%(levelname)s: %(message)s') if re.match("__", os.path.basename(sys.argv[0])): diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 2d921aaf..7ba8be75 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -87,7 +87,7 @@ class ConfigInstall(object): new_objects_created = False for cdist_object in core.Object.list_objects(self.local.object_path, self.local.type_path): - if cdist_object.prepared: + if cdist_object.state == cdist.core.object.STATE_PREPARED: self.log.debug("Skipping re-prepare of object %s", cdist_object) continue else: @@ -121,18 +121,18 @@ class ConfigInstall(object): self.log.info("Running manifest and explorers for " + cdist_object.name) self.run_type_explorers(cdist_object) self.manifest.run_type_manifest(cdist_object) - cdist_object.prepared = True + cdist_object.state = cdist.core.object.STATE_PREPARED def object_run(self, cdist_object): """Run gencode and code for an object""" self.log.info("Running gencode and code for " + cdist_object.name) - # Catch requirements, which re-call us - # FIXME: change .ran to running - if cdist_object.ran: + if cdist_object.state == cdist.core.object.STATE_RUNNING: + raise cdist.Error("Detected circular dependency in " + cdist_object.__str__()) + elif cdist_object.state == cdist.core.object.STATE_DONE: return else: - cdist_object.ran = True + cdist_object.state = cdist.core.object.STATE_RUNNING cdist_type = cdist_object.type From e98272e0c5bc68de623748d90fa509aea113d366 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 19 Oct 2011 15:34:24 +0200 Subject: [PATCH 0914/1024] move log.info down Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 7ba8be75..9c2b6e4c 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -125,8 +125,7 @@ class ConfigInstall(object): def object_run(self, cdist_object): """Run gencode and code for an object""" - self.log.info("Running gencode and code for " + cdist_object.name) - + self.log.info("" + cdist_object.name) if cdist_object.state == cdist.core.object.STATE_RUNNING: raise cdist.Error("Detected circular dependency in " + cdist_object.__str__()) elif cdist_object.state == cdist.core.object.STATE_DONE: @@ -142,6 +141,8 @@ class ConfigInstall(object): required_object = cdist_object.object_from_name(requirement) self.object_run(required_object) + self.log.info("Running gencode and code for " + cdist_object.name) + # Generate cdist_object.code_local = self.code.run_gencode_local(cdist_object) cdist_object.code_remote = self.code.run_gencode_remote(cdist_object) From 6734ff693f88f0ba6dfa6d76a75a9014fa53794f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:39:38 +0200 Subject: [PATCH 0915/1024] fix object_prepare to use object.state Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 9c2b6e4c..74412f96 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -87,7 +87,7 @@ class ConfigInstall(object): new_objects_created = False for cdist_object in core.Object.list_objects(self.local.object_path, self.local.type_path): - if cdist_object.state == cdist.core.object.STATE_PREPARED: + if cdist_object.state == core.Object.STATE_PREPARED: self.log.debug("Skipping re-prepare of object %s", cdist_object) continue else: @@ -121,7 +121,7 @@ class ConfigInstall(object): self.log.info("Running manifest and explorers for " + cdist_object.name) self.run_type_explorers(cdist_object) self.manifest.run_type_manifest(cdist_object) - cdist_object.state = cdist.core.object.STATE_PREPARED + cdist_object.state = core.Object.STATE_PREPARED def object_run(self, cdist_object): """Run gencode and code for an object""" From 8cfc16cd76a1b4cda5bf834a8bd63e60f1050181 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:48:22 +0200 Subject: [PATCH 0916/1024] finish migration to cdist_object.state Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 74412f96..c95b9f27 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -125,20 +125,21 @@ class ConfigInstall(object): def object_run(self, cdist_object): """Run gencode and code for an object""" - self.log.info("" + cdist_object.name) - if cdist_object.state == cdist.core.object.STATE_RUNNING: - raise cdist.Error("Detected circular dependency in " + cdist_object.__str__()) - elif cdist_object.state == cdist.core.object.STATE_DONE: + self.log.info("Starting run of " + cdist_object.name) + if cdist_object.state == core.Object.STATE_RUNNING: + raise cdist.Error("Detected circular dependency in " + cdist_object.name) + elif cdist_object.state == core.Object.STATE_DONE: + self.log.debug("Ignoring run of already finished object %s", cdist_object) return else: - cdist_object.state = cdist.core.object.STATE_RUNNING + cdist_object.state = core.Object.STATE_RUNNING cdist_type = cdist_object.type for requirement in cdist_object.requirements: self.log.debug("Object %s requires %s", cdist_object, requirement) - # FIXME: requirement is a string, need to create object here required_object = cdist_object.object_from_name(requirement) + self.log.info("Resolving dependency %s for %s" % (required_object.name, cdist_object.name)) self.object_run(required_object) self.log.info("Running gencode and code for " + cdist_object.name) @@ -156,6 +157,9 @@ class ConfigInstall(object): self.code.transfer_code_remote(cdist_object) self.code.run_code_remote(cdist_object) + # Mark this object as done + cdist_object.state == core.Object.STATE_DONE + def stage_run(self): """The final (and real) step of deployment""" self.log.info("Generating and executing code") From 50eead577c5934a9531cfb9d2ea0640a6571ee1c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:49:32 +0200 Subject: [PATCH 0917/1024] +missing import Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index c95b9f27..fd704135 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -28,6 +28,7 @@ import sys import tempfile import time +import cdist from cdist import core From 24bf7369d940c6c9981fa6ab6085eca814baff5a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 15:54:26 +0200 Subject: [PATCH 0918/1024] ++info Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index fd704135..cfd7e4c9 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -159,6 +159,7 @@ class ConfigInstall(object): self.code.run_code_remote(cdist_object) # Mark this object as done + self.log.info("Finishing run of " + cdist_object.name) cdist_object.state == core.Object.STATE_DONE def stage_run(self): From c45c9cd702098a22693ed24c5ad9b68a6db42034 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 16:07:13 +0200 Subject: [PATCH 0919/1024] dont re-run already fulfilled requirements Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index cfd7e4c9..cdb76ccd 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -140,8 +140,11 @@ class ConfigInstall(object): for requirement in cdist_object.requirements: self.log.debug("Object %s requires %s", cdist_object, requirement) required_object = cdist_object.object_from_name(requirement) - self.log.info("Resolving dependency %s for %s" % (required_object.name, cdist_object.name)) - self.object_run(required_object) + if required_object.state == core.Object.STATE_DONE: + self.log.debug("Skipping fulfilled dependency %s for %s", required_object, cdist_object) + else: + self.log.info("Resolving dependency %s for %s" % (required_object.name, cdist_object.name)) + self.object_run(required_object) self.log.info("Running gencode and code for " + cdist_object.name) From 9156d2f5ac56ded6ad1a43e9209e403c5da18d5e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 16:15:52 +0200 Subject: [PATCH 0920/1024] trust in telmich we do (or should) Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index cdb76ccd..cfd7e4c9 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -140,11 +140,8 @@ class ConfigInstall(object): for requirement in cdist_object.requirements: self.log.debug("Object %s requires %s", cdist_object, requirement) required_object = cdist_object.object_from_name(requirement) - if required_object.state == core.Object.STATE_DONE: - self.log.debug("Skipping fulfilled dependency %s for %s", required_object, cdist_object) - else: - self.log.info("Resolving dependency %s for %s" % (required_object.name, cdist_object.name)) - self.object_run(required_object) + self.log.info("Resolving dependency %s for %s" % (required_object.name, cdist_object.name)) + self.object_run(required_object) self.log.info("Running gencode and code for " + cdist_object.name) From de8a09b45dd8d6f1549526953c2247693afcd57e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 16:16:52 +0200 Subject: [PATCH 0921/1024] ++FIXME Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index cfd7e4c9..7dd001c6 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -128,6 +128,7 @@ class ConfigInstall(object): """Run gencode and code for an object""" self.log.info("Starting run of " + cdist_object.name) if cdist_object.state == core.Object.STATE_RUNNING: + # FIXME: resolve dependency circle raise cdist.Error("Detected circular dependency in " + cdist_object.name) elif cdist_object.state == core.Object.STATE_DONE: self.log.debug("Ignoring run of already finished object %s", cdist_object) From e9541b2a2a6b1e35e735b2f718adb23b7b188e7a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 16:29:30 +0200 Subject: [PATCH 0922/1024] == is not = :-/ Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 7dd001c6..59cd9f55 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -160,8 +160,8 @@ class ConfigInstall(object): self.code.run_code_remote(cdist_object) # Mark this object as done - self.log.info("Finishing run of " + cdist_object.name) - cdist_object.state == core.Object.STATE_DONE + self.log.debug("Finishing run of " + cdist_object.name) + cdist_object.state = core.Object.STATE_DONE def stage_run(self): """The final (and real) step of deployment""" From ca1ef28fe1319dd0273d117a27cc3b04eb4bddd8 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 16:42:14 +0200 Subject: [PATCH 0923/1024] change order of log.info Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 59cd9f55..dae2a029 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -144,15 +144,15 @@ class ConfigInstall(object): self.log.info("Resolving dependency %s for %s" % (required_object.name, cdist_object.name)) self.object_run(required_object) - self.log.info("Running gencode and code for " + cdist_object.name) - # Generate + self.log.info("Generating code for " + cdist_object.name) cdist_object.code_local = self.code.run_gencode_local(cdist_object) cdist_object.code_remote = self.code.run_gencode_remote(cdist_object) if cdist_object.code_local or cdist_object.code_remote: cdist_object.changed = True # Execute + self.log.info("Executing code for " + cdist_object.name) if cdist_object.code_local: self.code.run_code_local(cdist_object) if cdist_object.code_remote: From c189bd9daf7ed4be810563f0c4dfd0ece7598159 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 19 Oct 2011 16:47:52 +0200 Subject: [PATCH 0924/1024] resort output in object_run Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index dae2a029..8bc8adf5 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -126,7 +126,7 @@ class ConfigInstall(object): def object_run(self, cdist_object): """Run gencode and code for an object""" - self.log.info("Starting run of " + cdist_object.name) + self.log.debug("Trying to run object " + cdist_object.name) if cdist_object.state == core.Object.STATE_RUNNING: # FIXME: resolve dependency circle raise cdist.Error("Detected circular dependency in " + cdist_object.name) @@ -141,18 +141,16 @@ class ConfigInstall(object): for requirement in cdist_object.requirements: self.log.debug("Object %s requires %s", cdist_object, requirement) required_object = cdist_object.object_from_name(requirement) - self.log.info("Resolving dependency %s for %s" % (required_object.name, cdist_object.name)) self.object_run(required_object) # Generate - self.log.info("Generating code for " + cdist_object.name) + self.log.info("Generating and executing code for " + cdist_object.name) cdist_object.code_local = self.code.run_gencode_local(cdist_object) cdist_object.code_remote = self.code.run_gencode_remote(cdist_object) if cdist_object.code_local or cdist_object.code_remote: cdist_object.changed = True # Execute - self.log.info("Executing code for " + cdist_object.name) if cdist_object.code_local: self.code.run_code_local(cdist_object) if cdist_object.code_remote: From 56787617d05965d27ddbda6e6831a17570bc82f8 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 17:44:30 +0200 Subject: [PATCH 0925/1024] ++todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index ba18b34c..b6e07eac 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -17,7 +17,15 @@ metaparameters: __init_script /etc/rc.d/sshd \ --subscribe __file/etc/ssh/sshd_config - ? how does a type react to a received 'event' + - how does a type react to a received 'event'? + - maybe something like: + __some_type/ + manifest + ... + gencode-refresh + ... + - gencode-refresh -> code-refresh -> ssh $target sh -e code-refresh + From 97ab6effa486c25c04d6c2fd8c7169b524c3bf88 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 17:59:21 +0200 Subject: [PATCH 0926/1024] introduce new cdist.test.CdistTestCase base class which handles common tasks Signed-off-by: Steven Armstrong --- lib/cdist/test/__init__.py | 11 +++++++++++ lib/cdist/test/code/__init__.py | 10 +--------- lib/cdist/test/emulator/__init__.py | 10 +--------- lib/cdist/test/exec/local.py | 11 ++--------- lib/cdist/test/exec/remote.py | 10 +--------- lib/cdist/test/explorer/__init__.py | 10 +--------- lib/cdist/test/manifest/__init__.py | 11 ++--------- lib/cdist/test/object/__init__.py | 9 ++++----- lib/cdist/test/type/__init__.py | 12 ++---------- 9 files changed, 25 insertions(+), 69 deletions(-) diff --git a/lib/cdist/test/__init__.py b/lib/cdist/test/__init__.py index 2c6abd36..faa9dc2d 100644 --- a/lib/cdist/test/__init__.py +++ b/lib/cdist/test/__init__.py @@ -20,8 +20,19 @@ # import os +import unittest +import tempfile cdist_base_path = os.path.abspath( os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../")) cdist_exec_path = os.path.join(cdist_base_path, "bin/cdist") + + +class CdistTestCase(unittest.TestCase): + + def mkdtemp(self, **kwargs): + return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) + + def mkstemp(self, **kwargs): + return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index 68e8a41d..2f061086 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -20,8 +20,6 @@ # import os -import tempfile -import unittest import shutil import getpass import logging @@ -38,13 +36,7 @@ my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') local_base_path = fixtures -class CodeTestCase(unittest.TestCase): - - def mkdtemp(self, **kwargs): - return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) - - def mkstemp(self, **kwargs): - return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) +class CodeTestCase(test.CdistTestCase): def setUp(self): self.target_host = 'localhost' diff --git a/lib/cdist/test/emulator/__init__.py b/lib/cdist/test/emulator/__init__.py index ccdda265..386969e5 100644 --- a/lib/cdist/test/emulator/__init__.py +++ b/lib/cdist/test/emulator/__init__.py @@ -20,8 +20,6 @@ # import os -import tempfile -import unittest import shutil from cdist import test @@ -32,13 +30,7 @@ from cdist import core local_base_path = test.cdist_base_path -class EmulatorTestCase(unittest.TestCase): - - def mkdtemp(self, **kwargs): - return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) - - def mkstemp(self, **kwargs): - return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) +class EmulatorTestCase(test.CdistTestCase): def setUp(self): self.orig_environ = os.environ diff --git a/lib/cdist/test/exec/local.py b/lib/cdist/test/exec/local.py index f19bf55c..d73aa079 100644 --- a/lib/cdist/test/exec/local.py +++ b/lib/cdist/test/exec/local.py @@ -19,9 +19,7 @@ # # -import unittest import os -import tempfile import getpass import shutil import string @@ -31,6 +29,7 @@ import random #logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s') import cdist +from cdist import test from cdist.exec import local import os.path as op @@ -39,13 +38,7 @@ fixtures = op.join(my_dir, 'fixtures') local_base_path = fixtures -class LocalTestCase(unittest.TestCase): - - def mkdtemp(self, **kwargs): - return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) - - def mkstemp(self, **kwargs): - return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) +class LocalTestCase(test.CdistTestCase): def setUp(self): self.temp_dir = self.mkdtemp() diff --git a/lib/cdist/test/exec/remote.py b/lib/cdist/test/exec/remote.py index f5151156..191cbd43 100644 --- a/lib/cdist/test/exec/remote.py +++ b/lib/cdist/test/exec/remote.py @@ -19,9 +19,7 @@ # # -import unittest import os -import tempfile import getpass import shutil import string @@ -31,13 +29,7 @@ import cdist from cdist.exec import remote -class RemoteTestCase(unittest.TestCase): - - def mkdtemp(self, **kwargs): - return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) - - def mkstemp(self, **kwargs): - return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) +class RemoteTestCase(test.CdistTestCase): def setUp(self): self.temp_dir = self.mkdtemp() diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index 42b83ee8..18815f07 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -21,8 +21,6 @@ # import os -import tempfile -import unittest import shutil import getpass import logging @@ -39,13 +37,7 @@ my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') local_base_path = fixtures -class ExplorerClassTestCase(unittest.TestCase): - - def mkdtemp(self, **kwargs): - return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) - - def mkstemp(self, **kwargs): - return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) +class ExplorerClassTestCase(test.CdistTestCase): def setUp(self): self.target_host = 'localhost' diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index 257311d7..00789aec 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -19,9 +19,7 @@ # # -import unittest import os -import tempfile import getpass import shutil import string @@ -31,6 +29,7 @@ import io import sys import cdist +from cdist import test from cdist.exec import local from cdist import core from cdist.core import manifest @@ -41,13 +40,7 @@ fixtures = op.join(my_dir, 'fixtures') local_base_path = fixtures -class ManifestTestCase(unittest.TestCase): - - def mkdtemp(self, **kwargs): - return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) - - def mkstemp(self, **kwargs): - return tempfile.mkstemp(prefix='tmp.cdist.test.', **kwargs) +class ManifestTestCase(test.CdistTestCase): def setUp(self): self.orig_environ = os.environ diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index ab05c7af..6681c916 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -20,10 +20,9 @@ # import os -import tempfile -import unittest import shutil +from cdist import test from cdist import core import os.path as op @@ -32,7 +31,7 @@ fixtures = op.join(my_dir, 'fixtures') object_base_path = op.join(fixtures, 'object') type_base_path = op.join(fixtures, 'type') -class ObjectClassTestCase(unittest.TestCase): +class ObjectClassTestCase(test.CdistTestCase): def test_list_object_names(self): object_names = list(core.Object.list_object_names(object_base_path)) @@ -52,7 +51,7 @@ class ObjectClassTestCase(unittest.TestCase): self.assertEqual(objects, objects_expected) -class ObjectIdTestCase(unittest.TestCase): +class ObjectIdTestCase(test.CdistTestCase): def test_object_id_starts_with_slash(self): cdist_type = core.Type(type_base_path, '__third') illegal_object_id = '/object_id/may/not/start/with/slash' @@ -66,7 +65,7 @@ class ObjectIdTestCase(unittest.TestCase): core.Object(cdist_type, object_base_path, illegal_object_id) -class ObjectTestCase(unittest.TestCase): +class ObjectTestCase(test.CdistTestCase): def setUp(self): self.cdist_type = core.Type(type_base_path, '__third') diff --git a/lib/cdist/test/type/__init__.py b/lib/cdist/test/type/__init__.py index dee9d7a6..7bb8654c 100644 --- a/lib/cdist/test/type/__init__.py +++ b/lib/cdist/test/type/__init__.py @@ -20,8 +20,8 @@ # import os -import unittest +from cdist import test from cdist import core import os.path as op @@ -29,7 +29,7 @@ my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') -class TypeTestCase(unittest.TestCase): +class TypeTestCase(test.CdistTestCase): def test_list_type_names(self): base_path = op.join(fixtures, 'list_types') @@ -145,11 +145,3 @@ class TypeTestCase(unittest.TestCase): base_path = fixtures cdist_type = core.Type(base_path, '__without_optional_parameters') self.assertEqual(cdist_type.optional_parameters, []) - -''' -suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) - -def suite(): - tests = [] - return unittest.TestSuite(map(ObjectTestCase, tests)) -''' From 6f82aef7048fa33c25130970147af312de55caff Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 20 Oct 2011 10:55:11 +0200 Subject: [PATCH 0927/1024] add test for Explorer run_global_explorers Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 8 +++++++- lib/cdist/test/explorer/fixtures/conf/explorer/foobar | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100755 lib/cdist/test/explorer/fixtures/conf/explorer/foobar diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index 18815f07..6743ee26 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -62,7 +62,7 @@ class ExplorerClassTestCase(test.CdistTestCase): shutil.rmtree(self.remote_base_path) def test_list_global_explorer_names(self): - expected = ['global'] + expected = ['foobar', 'global'] self.assertEqual(self.explorer.list_global_explorer_names(), expected) def test_transfer_global_explorers(self): @@ -76,6 +76,12 @@ class ExplorerClassTestCase(test.CdistTestCase): output = self.explorer.run_global_explorer('global') self.assertEqual(output, 'global\n') + def test_run_global_explorers(self): + out_path = self.mkdtemp() + self.explorer.run_global_explorers(out_path) + self.assertEqual(os.listdir(out_path), ['foobar', 'global']) + shutil.rmtree(out_path) + def test_list_type_explorer_names(self): cdist_type = core.Type(self.local.type_path, '__test_type') expected = cdist_type.explorers diff --git a/lib/cdist/test/explorer/fixtures/conf/explorer/foobar b/lib/cdist/test/explorer/fixtures/conf/explorer/foobar new file mode 100755 index 00000000..33533edd --- /dev/null +++ b/lib/cdist/test/explorer/fixtures/conf/explorer/foobar @@ -0,0 +1,2 @@ +#!/bin/sh +echo foobar From 40971208f24fe0377ce353c1acc8131b80c0decb Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 20 Oct 2011 11:04:41 +0200 Subject: [PATCH 0928/1024] add test for Explorer run_type_explorers Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index 6743ee26..1f7a2e35 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -124,3 +124,10 @@ class ExplorerClassTestCase(test.CdistTestCase): self.explorer.transfer_type_explorers(cdist_type) output = self.explorer.run_type_explorer('world', cdist_object) self.assertEqual(output, 'hello\n') + + def test_run_type_explorers(self): + cdist_type = core.Type(self.local.type_path, '__test_type') + cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') + cdist_object.create() + self.explorer.run_type_explorers(cdist_object) + self.assertEqual(cdist_object.explorers, {'world': 'hello'}) From 60c4e21981390676deec431b3884332a7c7e39b9 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 20 Oct 2011 11:05:50 +0200 Subject: [PATCH 0929/1024] implement Explorer run_global_explorers and run_type_explorers Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index 2e13cc78..0a8c6986 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -83,6 +83,19 @@ class Explorer(object): """Return a list of global explorer names.""" return os.listdir(self.local.global_explorer_path) + def run_global_explorers(self, out_path): + """Run global explorers and save output to files in the given + out_path directory. + + """ + self.log.info("Running global explorers") + self.transfer_global_explorers() + for explorer in self.list_global_explorer_names(): + output = self.run_global_explorer(explorer) + path = os.path.join(out_path, explorer) + with open(path, 'w') as fd: + fd.write(output) + def transfer_global_explorers(self): """Transfer the global explorers to the remote side.""" self.remote.mkdir(self.remote.global_explorer_path) @@ -103,6 +116,20 @@ class Explorer(object): except EnvironmentError: return [] + def run_type_explorers(self, cdist_object): + """Run the type explorers for the given object and save their output + in the object. + + """ + self.log.debug("Transfering type explorers for type: %s", cdist_object.type) + self.transfer_type_explorers(cdist_object.type) + self.log.debug("Transfering object parameters for object: %s", cdist_object.name) + self.transfer_object_parameters(cdist_object) + for explorer in self.list_type_explorer_names(cdist_object.type): + output = self.run_type_explorer(explorer, cdist_object) + self.log.debug("Running type explorer '%s' for object '%s'", explorer, cdist_object.name) + cdist_object.explorers[explorer] = output + def transfer_type_explorers(self, cdist_type): """Transfer the type explorers for the given type to the remote side.""" if cdist_type.explorers: From 6223402b9ecb26d974e71e529e7aa2b63e1cfdf3 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 20 Oct 2011 11:07:48 +0200 Subject: [PATCH 0930/1024] bugfix: only attempt to transfer object parameters it their are any Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index 2e13cc78..86926c27 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -117,10 +117,11 @@ class Explorer(object): def transfer_object_parameters(self, cdist_object): """Transfer the parameters for the given object to the remote side.""" - source = os.path.join(self.local.object_path, cdist_object.parameter_path) - destination = os.path.join(self.remote.object_path, cdist_object.parameter_path) - self.remote.mkdir(destination) - self.remote.transfer(source, destination) + if cdist_object.parameters: + source = os.path.join(self.local.object_path, cdist_object.parameter_path) + destination = os.path.join(self.remote.object_path, cdist_object.parameter_path) + self.remote.mkdir(destination) + self.remote.transfer(source, destination) def run_type_explorer(self, explorer, cdist_object): """Run the given type explorer for the given object and return it's output.""" From 81e4c0a418c1e9cee3f30d14133c013bc919847c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 20 Oct 2011 11:10:30 +0200 Subject: [PATCH 0931/1024] move run_*_explorers from config_install to core.explorer Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 8bc8adf5..75b07e78 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -77,7 +77,7 @@ 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.run_global_explorers() + self.explorer.run_global_explorers(self.local.global_explorer_out_path) self.manifest.run_initial_manifest(self.context.initial_manifest) self.log.info("Running object manifests and type explorers") @@ -95,32 +95,10 @@ class ConfigInstall(object): self.object_prepare(cdist_object) new_objects_created = True - def run_global_explorers(self): - """Run global explorers and save output""" - # FIXME: move to explorer, pass global_explorer_out_path as argument - self.log.info("Running global explorers") - self.explorer.transfer_global_explorers() - for explorer in self.explorer.list_global_explorer_names(): - output = self.explorer.run_global_explorer(explorer) - path = os.path.join(self.local.global_explorer_out_path, explorer) - with open(path, 'w') as fd: - fd.write(output) - - def run_type_explorers(self, cdist_object): - """Run type explorers and save output in object.""" - self.log.debug("Transfering type explorers for type: %s", cdist_object.type) - self.explorer.transfer_type_explorers(cdist_object.type) - self.log.debug("Transfering object parameters for object: %s", cdist_object.name) - self.explorer.transfer_object_parameters(cdist_object) - for explorer in self.explorer.list_type_explorer_names(cdist_object.type): - output = self.explorer.run_type_explorer(explorer, cdist_object) - self.log.debug("Running type explorer '%s' for object '%s'", explorer, cdist_object.name) - cdist_object.explorers[explorer] = output - def object_prepare(self, cdist_object): """Prepare object: Run type explorer + manifest""" self.log.info("Running manifest and explorers for " + cdist_object.name) - self.run_type_explorers(cdist_object) + self.explorer.run_type_explorers(cdist_object) self.manifest.run_type_manifest(cdist_object) cdist_object.state = core.Object.STATE_PREPARED From a2cda1ccce87d62fc93cff291a61427134ee242b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 20 Oct 2011 11:16:38 +0200 Subject: [PATCH 0932/1024] --todo Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 7 ------- 1 file changed, 7 deletions(-) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index b6e07eac..f8e13a45 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -45,13 +45,6 @@ logging: [2] http://blog.ooz.ie/2011/03/python-logging-extending-standard.html -config_install: - - move code for running global and type explorer run to cdist.core.explorer - -tests: - - aufraeumen - - test suite - tests: From 1e354387f98b0767561507c96cdbf02f4a3f52af Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 21 Oct 2011 14:48:47 +0200 Subject: [PATCH 0933/1024] add missing import Signed-off-by: Steven Armstrong --- lib/cdist/test/exec/remote.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cdist/test/exec/remote.py b/lib/cdist/test/exec/remote.py index 191cbd43..92b68d06 100644 --- a/lib/cdist/test/exec/remote.py +++ b/lib/cdist/test/exec/remote.py @@ -26,6 +26,7 @@ import string import random import cdist +from cdist import test from cdist.exec import remote @@ -33,12 +34,12 @@ class RemoteTestCase(test.CdistTestCase): def setUp(self): self.temp_dir = self.mkdtemp() - target_host = 'localhost' + self.target_host = 'localhost' self.base_path = self.temp_dir user = getpass.getuser() remote_exec = "ssh -o User=%s -q" % user remote_copy = "scp -o User=%s -q" % user - self.remote = remote.Remote(target_host, self.base_path, remote_exec, remote_copy) + self.remote = remote.Remote(self.target_host, self.base_path, remote_exec, remote_copy) def tearDown(self): shutil.rmtree(self.temp_dir) From 8e2b9e4337cbc55996a2b626855dbcaa652b9cbf Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 21 Oct 2011 15:10:41 +0200 Subject: [PATCH 0934/1024] add test for: __target_host exported to remote exec Signed-off-by: Steven Armstrong --- lib/cdist/test/exec/remote.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/cdist/test/exec/remote.py b/lib/cdist/test/exec/remote.py index 92b68d06..1334e330 100644 --- a/lib/cdist/test/exec/remote.py +++ b/lib/cdist/test/exec/remote.py @@ -118,3 +118,16 @@ class RemoteTestCase(test.CdistTestCase): self.remote.create_directories() self.assertTrue(os.path.isdir(self.remote.base_path)) self.assertTrue(os.path.isdir(self.remote.conf_path)) + + def test_run_script_target_host_in_env(self): + handle, remote_exec_path = self.mkstemp(dir=self.temp_dir) + with os.fdopen(handle, 'w') as fd: + fd.writelines(["#!/bin/sh\n", "echo $__target_host"]) + os.chmod(remote_exec_path, 0o755) + remote_exec = remote_exec_path + remote_copy = "echo" + r = remote.Remote(self.target_host, self.base_path, remote_exec, remote_copy) + handle, script = self.mkstemp(dir=self.temp_dir) + with os.fdopen(handle, "w") as fd: + fd.writelines(["#!/bin/sh\n", "echo foobar"]) + self.assertEqual(r.run_script(script, return_output=True), "%s\n" % self.target_host) From 16b118b38e541edc3256bf9f08566ca9b0cc34cb Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 21 Oct 2011 15:16:38 +0200 Subject: [PATCH 0935/1024] add test for: __target_host exported to remote exec run Signed-off-by: Steven Armstrong --- lib/cdist/test/exec/remote.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/cdist/test/exec/remote.py b/lib/cdist/test/exec/remote.py index 1334e330..a09a334f 100644 --- a/lib/cdist/test/exec/remote.py +++ b/lib/cdist/test/exec/remote.py @@ -119,6 +119,16 @@ class RemoteTestCase(test.CdistTestCase): self.assertTrue(os.path.isdir(self.remote.base_path)) self.assertTrue(os.path.isdir(self.remote.conf_path)) + def test_run_target_host_in_env(self): + handle, remote_exec_path = self.mkstemp(dir=self.temp_dir) + with os.fdopen(handle, 'w') as fd: + fd.writelines(["#!/bin/sh\n", "echo $__target_host"]) + os.chmod(remote_exec_path, 0o755) + remote_exec = remote_exec_path + remote_copy = "echo" + r = remote.Remote(self.target_host, self.base_path, remote_exec, remote_copy) + self.assertEqual(r.run('/bin/true', return_output=True), "%s\n" % self.target_host) + def test_run_script_target_host_in_env(self): handle, remote_exec_path = self.mkstemp(dir=self.temp_dir) with os.fdopen(handle, 'w') as fd: @@ -129,5 +139,5 @@ class RemoteTestCase(test.CdistTestCase): r = remote.Remote(self.target_host, self.base_path, remote_exec, remote_copy) handle, script = self.mkstemp(dir=self.temp_dir) with os.fdopen(handle, "w") as fd: - fd.writelines(["#!/bin/sh\n", "echo foobar"]) + fd.writelines(["#!/bin/sh\n", "/bin/true"]) self.assertEqual(r.run_script(script, return_output=True), "%s\n" % self.target_host) From 17e76426158069ab4ba16d765f4b988d64dedb4f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 21 Oct 2011 15:17:19 +0200 Subject: [PATCH 0936/1024] implement: export __target_host in remote exec Signed-off-by: Steven Armstrong --- lib/cdist/exec/remote.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index 2847d89c..259f72d8 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -111,6 +111,10 @@ class Remote(object): """ assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command + # export target_host for use in __remote_{exec,copy} scripts + os_environ = os.environ.copy() + os_environ['__target_host'] = self.target_host + # can't pass environment to remote side, so prepend command with # variable declarations if env: @@ -122,7 +126,7 @@ class Remote(object): self.log.debug("Remote run: %s", command) try: if return_output: - return subprocess.check_output(command).decode() + return subprocess.check_output(command, env=os_environ).decode() else: subprocess.check_call(command) except subprocess.CalledProcessError: @@ -140,6 +144,10 @@ class Remote(object): command = self._exec.split() command.append(self.target_host) + # export target_host for use in __remote_{exec,copy} scripts + os_environ = os.environ.copy() + os_environ['__target_host'] = self.target_host + # can't pass environment to remote side, so prepend command with # variable declarations if env: @@ -154,7 +162,7 @@ class Remote(object): try: if return_output: - return subprocess.check_output(command).decode() + return subprocess.check_output(command, env=os_environ).decode() else: subprocess.check_call(command) except subprocess.CalledProcessError as error: From d4e715f0520c8699fe5bebc8cf85d7c6a5830a98 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 21 Oct 2011 15:26:27 +0200 Subject: [PATCH 0937/1024] close file handles opened with tempfile.mkstemp Signed-off-by: Steven Armstrong --- lib/cdist/test/emulator/__init__.py | 1 + lib/cdist/test/exec/local.py | 15 ++++++--------- lib/cdist/test/exec/remote.py | 17 ++++++++--------- lib/cdist/test/manifest/__init__.py | 2 ++ lib/cdist/test/util/__init__.py | 0 lib/cdist/test/util/fsproperty.py | 0 6 files changed, 17 insertions(+), 18 deletions(-) create mode 100644 lib/cdist/test/util/__init__.py create mode 100644 lib/cdist/test/util/fsproperty.py diff --git a/lib/cdist/test/emulator/__init__.py b/lib/cdist/test/emulator/__init__.py index 386969e5..91150334 100644 --- a/lib/cdist/test/emulator/__init__.py +++ b/lib/cdist/test/emulator/__init__.py @@ -37,6 +37,7 @@ class EmulatorTestCase(test.CdistTestCase): os.environ = os.environ.copy() self.temp_dir = self.mkdtemp() handle, self.script = self.mkstemp(dir=self.temp_dir) + os.close(handle) self.target_host = 'localhost' out_path = self.temp_dir self.local = local.Local(self.target_host, local_base_path, out_path) diff --git a/lib/cdist/test/exec/local.py b/lib/cdist/test/exec/local.py index d73aa079..e6f2c2b0 100644 --- a/lib/cdist/test/exec/local.py +++ b/lib/cdist/test/exec/local.py @@ -90,23 +90,20 @@ class LocalTestCase(test.CdistTestCase): def test_run_script_success(self): handle, script = self.mkstemp(dir=self.temp_dir) - fd = open(script, "w") - fd.writelines(["#!/bin/sh\n", "/bin/true"]) - fd.close() + with os.fdopen(handle, "w") as fd: + fd.writelines(["#!/bin/sh\n", "/bin/true"]) self.local.run_script(script) def test_run_script_fail(self): handle, script = self.mkstemp(dir=self.temp_dir) - fd = open(script, "w") - fd.writelines(["#!/bin/sh\n", "/bin/false"]) - fd.close() + with os.fdopen(handle, "w") as fd: + fd.writelines(["#!/bin/sh\n", "/bin/false"]) self.assertRaises(local.LocalScriptError, self.local.run_script, script) def test_run_script_get_output(self): handle, script = self.mkstemp(dir=self.temp_dir) - fd = open(script, "w") - fd.writelines(["#!/bin/sh\n", "echo foobar"]) - fd.close() + with os.fdopen(handle, "w") as fd: + fd.writelines(["#!/bin/sh\n", "echo foobar"]) self.assertEqual(self.local.run_script(script, return_output=True), "foobar\n") def test_mkdir(self): diff --git a/lib/cdist/test/exec/remote.py b/lib/cdist/test/exec/remote.py index 92b68d06..e111a302 100644 --- a/lib/cdist/test/exec/remote.py +++ b/lib/cdist/test/exec/remote.py @@ -68,23 +68,20 @@ class RemoteTestCase(test.CdistTestCase): def test_run_script_success(self): handle, script = self.mkstemp(dir=self.temp_dir) - fd = open(script, "w") - fd.writelines(["#!/bin/sh\n", "/bin/true"]) - fd.close() + with os.fdopen(handle, "w") as fd: + fd.writelines(["#!/bin/sh\n", "/bin/true"]) self.remote.run_script(script) def test_run_script_fail(self): handle, script = self.mkstemp(dir=self.temp_dir) - fd = open(script, "w") - fd.writelines(["#!/bin/sh\n", "/bin/false"]) - fd.close() + with os.fdopen(handle, "w") as fd: + fd.writelines(["#!/bin/sh\n", "/bin/false"]) self.assertRaises(remote.RemoteScriptError, self.remote.run_script, script) def test_run_script_get_output(self): handle, script = self.mkstemp(dir=self.temp_dir) - fd = open(script, "w") - fd.writelines(["#!/bin/sh\n", "echo foobar"]) - fd.close() + with os.fdopen(handle, "w") as fd: + fd.writelines(["#!/bin/sh\n", "echo foobar"]) self.assertEqual(self.remote.run_script(script, return_output=True), "foobar\n") def test_mkdir(self): @@ -100,6 +97,7 @@ class RemoteTestCase(test.CdistTestCase): def test_transfer_file(self): handle, source = self.mkstemp(dir=self.temp_dir) + os.close(handle) target = self.mkdtemp(dir=self.temp_dir) self.remote.transfer(source, target) self.assertTrue(os.path.isfile(target)) @@ -108,6 +106,7 @@ class RemoteTestCase(test.CdistTestCase): source = self.mkdtemp(dir=self.temp_dir) # put a file in the directory as payload handle, source_file = self.mkstemp(dir=source) + os.close(handle) source_file_name = os.path.split(source_file)[-1] target = self.mkdtemp(dir=self.temp_dir) self.remote.transfer(source, target) diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index 00789aec..2383adf7 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -61,6 +61,7 @@ class ManifestTestCase(test.CdistTestCase): def test_initial_manifest_environment(self): initial_manifest = os.path.join(self.local.manifest_path, "dump_environment") handle, output_file = self.mkstemp(dir=self.temp_dir) + os.close(handle) os.environ['__cdist_test_out'] = output_file self.manifest.run_initial_manifest(initial_manifest) @@ -81,6 +82,7 @@ class ManifestTestCase(test.CdistTestCase): cdist_type = core.Type(self.local.type_path, '__dump_environment') cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') handle, output_file = self.mkstemp(dir=self.temp_dir) + os.close(handle) os.environ['__cdist_test_out'] = output_file self.manifest.run_type_manifest(cdist_object) diff --git a/lib/cdist/test/util/__init__.py b/lib/cdist/test/util/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/util/fsproperty.py b/lib/cdist/test/util/fsproperty.py new file mode 100644 index 00000000..e69de29b From c29c419f61e40311ee273088bad40a716dac655c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 21 Oct 2011 15:50:19 +0200 Subject: [PATCH 0938/1024] also export __target_host to check_call Signed-off-by: Steven Armstrong --- lib/cdist/exec/remote.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index 259f72d8..433f4cbc 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -128,7 +128,7 @@ class Remote(object): if return_output: return subprocess.check_output(command, env=os_environ).decode() else: - subprocess.check_call(command) + subprocess.check_call(command, env=os_environ) except subprocess.CalledProcessError: raise cdist.Error("Command failed: " + " ".join(command)) except OSError as error: @@ -164,7 +164,7 @@ class Remote(object): if return_output: return subprocess.check_output(command, env=os_environ).decode() else: - subprocess.check_call(command) + subprocess.check_call(command, env=os_environ) except subprocess.CalledProcessError as error: script_content = self.run(["cat", script], return_output=True) self.log.error("Code that raised the error:\n%s", script_content) From 18f08d893cdffc498725358dc8f9ed6948156263 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 21 Oct 2011 15:59:39 +0200 Subject: [PATCH 0939/1024] export defaults for __remote_{exec,copy} Signed-off-by: Steven Armstrong --- lib/cdist/context.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index 77a6028f..ab8677a7 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -72,8 +72,8 @@ class Context(object): # Remote self.remote_base_path = os.environ.get('__cdist_remote_out_dir', "/var/lib/cdist") - self.remote_exec = os.environ.get('__remote_exec', "ssh -o User=root -q") - self.remote_copy = os.environ.get('__remote_copy', "scp -o User=root -q") + self.remote_exec = os.environ.setdefault('__remote_exec', "ssh -o User=root -q") + self.remote_copy = os.environ.setdefault('__remote_copy', "scp -o User=root -q") self.remote = remote.Remote(self.target_host, self.remote_base_path, self.remote_exec, self.remote_copy) From 4775c93a6e08bac9c6b8cd6a3528f99396d31760 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 21 Oct 2011 16:01:39 +0200 Subject: [PATCH 0940/1024] use __remote_copy in __file type Signed-off-by: Steven Armstrong --- conf/type/__file/gencode-local | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/conf/type/__file/gencode-local b/conf/type/__file/gencode-local index 1168919e..0c6c249d 100755 --- a/conf/type/__file/gencode-local +++ b/conf/type/__file/gencode-local @@ -31,11 +31,7 @@ if [ -f "$__object/parameter/source" ]; then remote_cksum="$(cat "$__object/explorer/cksum")" if [ "$local_cksum" != "$remote_cksum" ]; then - # FIXME: The username is ugly and hardcoded, replace after 1.0! - # Probably a better aproach is to have the user configured - # ~/.ssh/config to contain the right username - # Probably describe it in cdist-quickstart... - echo scp "$source" "root@${__target_host}:${destination}" + echo "$__remote_copy" "$source" "${__target_host}:${destination}" fi else echo "Source \"$source\" does not exist." >&2 From 9fedf314cfd84f9b77629b42acd0586fc98f8be2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 31 Oct 2011 11:09:42 +0100 Subject: [PATCH 0941/1024] add explorers for lsb_* Signed-off-by: Steven Armstrong --- conf/explorer/lsb_codename | 24 ++++++++++++++++++++++++ conf/explorer/lsb_description | 24 ++++++++++++++++++++++++ conf/explorer/lsb_id | 24 ++++++++++++++++++++++++ conf/explorer/lsb_release | 24 ++++++++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100755 conf/explorer/lsb_codename create mode 100755 conf/explorer/lsb_description create mode 100755 conf/explorer/lsb_id create mode 100755 conf/explorer/lsb_release diff --git a/conf/explorer/lsb_codename b/conf/explorer/lsb_codename new file mode 100755 index 00000000..eec12710 --- /dev/null +++ b/conf/explorer/lsb_codename @@ -0,0 +1,24 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +lsb_release=$(which lsb_release) +[ -x $lsb_release ] && $lsb_release --short --codename \ +|| echo lsb not supported diff --git a/conf/explorer/lsb_description b/conf/explorer/lsb_description new file mode 100755 index 00000000..7349ddeb --- /dev/null +++ b/conf/explorer/lsb_description @@ -0,0 +1,24 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +lsb_release=$(which lsb_release) +[ -x $lsb_release ] && $lsb_release --short --description \ +|| echo lsb not supported diff --git a/conf/explorer/lsb_id b/conf/explorer/lsb_id new file mode 100755 index 00000000..eac173cd --- /dev/null +++ b/conf/explorer/lsb_id @@ -0,0 +1,24 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +lsb_release=$(which lsb_release) +[ -x $lsb_release ] && $lsb_release --short --id \ +|| echo lsb not supported diff --git a/conf/explorer/lsb_release b/conf/explorer/lsb_release new file mode 100755 index 00000000..b3ac4093 --- /dev/null +++ b/conf/explorer/lsb_release @@ -0,0 +1,24 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +lsb_release=$(which lsb_release) +[ -x $lsb_release ] && $lsb_release --short --release \ +|| echo lsb not supported From 7641c04438e01408ac685879f1363f1cea562c69 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 31 Oct 2011 13:40:39 +0100 Subject: [PATCH 0942/1024] +fancy-ideas Signed-off-by: Steven Armstrong --- doc/dev/fancy-ideas | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 doc/dev/fancy-ideas diff --git a/doc/dev/fancy-ideas b/doc/dev/fancy-ideas new file mode 100644 index 00000000..f125a884 --- /dev/null +++ b/doc/dev/fancy-ideas @@ -0,0 +1,7 @@ +== types with namespaces == +- allow types to have namespaces, e.g. + __path/my/type +implemented as a proof of concept at: +https://github.com/asteven/cdist/tree/type-namespaces + + From de84542579d410ef268941f26a4be993c0cbc59f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 31 Oct 2011 14:36:58 +0100 Subject: [PATCH 0943/1024] no lsb_release -> no output Signed-off-by: Steven Armstrong --- conf/explorer/lsb_codename | 3 +-- conf/explorer/lsb_description | 3 +-- conf/explorer/lsb_id | 3 +-- conf/explorer/lsb_release | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/conf/explorer/lsb_codename b/conf/explorer/lsb_codename index eec12710..a8cb2cc4 100755 --- a/conf/explorer/lsb_codename +++ b/conf/explorer/lsb_codename @@ -20,5 +20,4 @@ # lsb_release=$(which lsb_release) -[ -x $lsb_release ] && $lsb_release --short --codename \ -|| echo lsb not supported +[ -x $lsb_release ] && $lsb_release --short --codename diff --git a/conf/explorer/lsb_description b/conf/explorer/lsb_description index 7349ddeb..da0dd74d 100755 --- a/conf/explorer/lsb_description +++ b/conf/explorer/lsb_description @@ -20,5 +20,4 @@ # lsb_release=$(which lsb_release) -[ -x $lsb_release ] && $lsb_release --short --description \ -|| echo lsb not supported +[ -x $lsb_release ] && $lsb_release --short --description diff --git a/conf/explorer/lsb_id b/conf/explorer/lsb_id index eac173cd..44eb7eaa 100755 --- a/conf/explorer/lsb_id +++ b/conf/explorer/lsb_id @@ -20,5 +20,4 @@ # lsb_release=$(which lsb_release) -[ -x $lsb_release ] && $lsb_release --short --id \ -|| echo lsb not supported +[ -x $lsb_release ] && $lsb_release --short --id diff --git a/conf/explorer/lsb_release b/conf/explorer/lsb_release index b3ac4093..6e0d3a8a 100755 --- a/conf/explorer/lsb_release +++ b/conf/explorer/lsb_release @@ -20,5 +20,4 @@ # lsb_release=$(which lsb_release) -[ -x $lsb_release ] && $lsb_release --short --release \ -|| echo lsb not supported +[ -x $lsb_release ] && $lsb_release --short --release From b38262f858077f8f57781d60e4439ad07b0be0ab Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 31 Oct 2011 16:07:33 +0100 Subject: [PATCH 0944/1024] implement reading initial manifest from stdin Signed-off-by: Steven Armstrong --- bin/cdist | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index ffda3e42..4d9cd8a2 100755 --- a/bin/cdist +++ b/bin/cdist @@ -60,7 +60,7 @@ def commandline(): help='Change cdist home (default: .. from bin directory)', action='store') parser['configinstall'].add_argument('-i', '--initial-manifest', - help='Path to a cdist 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', @@ -104,6 +104,17 @@ def configinstall(args, mode): import multiprocessing import time + initial_manifest_tempfile = None + if args.manifest == '-': + # read initial manifest from stdin + import tempfile + handle, initial_manifest_temp_path = tempfile.mkstemp(prefix='cdist.stdin.') + with os.fdopen(handle, 'w') as fd: + fd.write(sys.stdin.read()) + args.manifest = initial_manifest_temp_path + import atexit + atexit.register(lambda: os.remove(initial_manifest_temp_path)) + try: process = {} failed_hosts = [] From d4aa04f35d6745fd48852c381057dcee2a93d419 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 31 Oct 2011 16:16:10 +0100 Subject: [PATCH 0945/1024] dont fail if lsb_release does not exist Signed-off-by: Steven Armstrong --- conf/explorer/lsb_codename | 6 ++++-- conf/explorer/lsb_description | 6 ++++-- conf/explorer/lsb_id | 6 ++++-- conf/explorer/lsb_release | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/conf/explorer/lsb_codename b/conf/explorer/lsb_codename index a8cb2cc4..08bf75be 100755 --- a/conf/explorer/lsb_codename +++ b/conf/explorer/lsb_codename @@ -19,5 +19,7 @@ # # -lsb_release=$(which lsb_release) -[ -x $lsb_release ] && $lsb_release --short --codename +lsb_release=$(which lsb_release 2>/dev/null) +if [ -x "$lsb_release" ]; then + $lsb_release --short --codename +fi diff --git a/conf/explorer/lsb_description b/conf/explorer/lsb_description index da0dd74d..14e59e76 100755 --- a/conf/explorer/lsb_description +++ b/conf/explorer/lsb_description @@ -19,5 +19,7 @@ # # -lsb_release=$(which lsb_release) -[ -x $lsb_release ] && $lsb_release --short --description +lsb_release=$(which lsb_release 2>/dev/null) +if [ -x "$lsb_release" ]; then + $lsb_release --short --description +fi diff --git a/conf/explorer/lsb_id b/conf/explorer/lsb_id index 44eb7eaa..10d6ce52 100755 --- a/conf/explorer/lsb_id +++ b/conf/explorer/lsb_id @@ -19,5 +19,7 @@ # # -lsb_release=$(which lsb_release) -[ -x $lsb_release ] && $lsb_release --short --id +lsb_release=$(which lsb_release 2>/dev/null) +if [ -x "$lsb_release" ]; then + $lsb_release --short --id +fi diff --git a/conf/explorer/lsb_release b/conf/explorer/lsb_release index 6e0d3a8a..2139c2e6 100755 --- a/conf/explorer/lsb_release +++ b/conf/explorer/lsb_release @@ -19,5 +19,7 @@ # # -lsb_release=$(which lsb_release) -[ -x $lsb_release ] && $lsb_release --short --release +lsb_release=$(which lsb_release 2>/dev/null) +if [ -x "$lsb_release" ]; then + $lsb_release --short --release +fi From 5ac857a87ce69f79aa260f7589cdf90829a560c8 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 31 Oct 2011 16:20:48 +0100 Subject: [PATCH 0946/1024] realy, dont fail if lsb_release does not exist Signed-off-by: Steven Armstrong --- conf/explorer/lsb_codename | 1 + conf/explorer/lsb_description | 1 + conf/explorer/lsb_id | 1 + conf/explorer/lsb_release | 1 + 4 files changed, 4 insertions(+) diff --git a/conf/explorer/lsb_codename b/conf/explorer/lsb_codename index 08bf75be..bc742cf7 100755 --- a/conf/explorer/lsb_codename +++ b/conf/explorer/lsb_codename @@ -19,6 +19,7 @@ # # +set +e lsb_release=$(which lsb_release 2>/dev/null) if [ -x "$lsb_release" ]; then $lsb_release --short --codename diff --git a/conf/explorer/lsb_description b/conf/explorer/lsb_description index 14e59e76..f6c30322 100755 --- a/conf/explorer/lsb_description +++ b/conf/explorer/lsb_description @@ -19,6 +19,7 @@ # # +set +e lsb_release=$(which lsb_release 2>/dev/null) if [ -x "$lsb_release" ]; then $lsb_release --short --description diff --git a/conf/explorer/lsb_id b/conf/explorer/lsb_id index 10d6ce52..6cb2359b 100755 --- a/conf/explorer/lsb_id +++ b/conf/explorer/lsb_id @@ -19,6 +19,7 @@ # # +set +e lsb_release=$(which lsb_release 2>/dev/null) if [ -x "$lsb_release" ]; then $lsb_release --short --id diff --git a/conf/explorer/lsb_release b/conf/explorer/lsb_release index 2139c2e6..5787b71f 100755 --- a/conf/explorer/lsb_release +++ b/conf/explorer/lsb_release @@ -19,6 +19,7 @@ # # +set +e lsb_release=$(which lsb_release 2>/dev/null) if [ -x "$lsb_release" ]; then $lsb_release --short --release From d6d4d374bd11136287e987c438d76bad74883fd5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 31 Oct 2011 18:26:36 +0100 Subject: [PATCH 0947/1024] remove unecessary whitespace :-) Signed-off-by: Nico Schottelius --- conf/explorer/lsb_release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/explorer/lsb_release b/conf/explorer/lsb_release index 5787b71f..a96ac50b 100755 --- a/conf/explorer/lsb_release +++ b/conf/explorer/lsb_release @@ -23,4 +23,4 @@ set +e lsb_release=$(which lsb_release 2>/dev/null) if [ -x "$lsb_release" ]; then $lsb_release --short --release -fi +fi From bf1b995908823fb7e29401d169c4e76a73b953f9 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 1 Nov 2011 22:20:46 +0100 Subject: [PATCH 0948/1024] implement __lt__ and __eq__ to support sorting a list of types Signed-off-by: Steven Armstrong --- lib/cdist/core/type.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/cdist/core/type.py b/lib/cdist/core/type.py index e9cb375a..20365b8d 100644 --- a/lib/cdist/core/type.py +++ b/lib/cdist/core/type.py @@ -86,6 +86,12 @@ class Type(object): def __repr__(self): return '' % self.name + def __eq__(self, other): + return isinstance(other, self.__class__) and self.name == other.name + + def __lt__(self, other): + return isinstance(other, self.__class__) and self.name < other.name + @property def is_singleton(self): """Check whether a type is a singleton.""" From 70ee0f1681b2495bc429d3ff9af3b947408e4b70 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 1 Nov 2011 22:46:46 +0100 Subject: [PATCH 0949/1024] implement __lt__ to support sorting a list of objects Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 5157d86a..29dc16e9 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -115,6 +115,10 @@ class Object(object): """define equality as 'attributes are the same'""" return self.__dict__ == other.__dict__ + def __lt__(self, other): + return isinstance(other, self.__class__) and self.name < other.name + + # FIXME: still needed? @property def explorer_path(self): From afba5e92804e537b372b8548aca0d619aa66488b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 2 Nov 2011 07:52:08 +0100 Subject: [PATCH 0950/1024] add utilitly method to split an object name into its type name and object_id Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 29dc16e9..b62417b7 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -60,9 +60,7 @@ class Object(object): def list_objects(cls, object_base_path, type_base_path): """Return a list of object instances""" for object_name in cls.list_object_names(object_base_path): - type_name = object_name.split(os.sep)[0] - # FIXME: allow object without object_id? e.g. for singleton - object_id = os.sep.join(object_name.split(os.sep)[1:]) + type_name, object_id = cls.split_name(object_name) yield cls(cdist.core.Type(type_base_path, type_name), object_base_path, object_id=object_id) @classmethod @@ -77,20 +75,17 @@ class Object(object): if DOT_CDIST in dirs: yield os.path.relpath(path, object_base_path) - def object_from_name(self, object_name): - """Convenience method for creating an object instance from an object name. + @staticmethod + def split_name(object_name): + """split_name('__type_name/the/object_id') -> ('__type_name', 'the/object_id') - Mainly intended to create objects when resolving requirements. - - e.g: - .object_from_name('__other/object') -> + Split the given object name into it's type and object_id parts. """ - type_path = self.type.base_path - object_path = self.base_path type_name = object_name.split(os.sep)[0] + # FIXME: allow object without object_id? e.g. for singleton object_id = os.sep.join(object_name.split(os.sep)[1:]) - return self.__class__(self.type.__class__(type_path, type_name), object_path, object_id=object_id) + return type_name, object_id def __init__(self, cdist_type, base_path, object_id=None): if object_id: @@ -118,6 +113,19 @@ class Object(object): def __lt__(self, other): return isinstance(other, self.__class__) and self.name < other.name + def object_from_name(self, object_name): + """Convenience method for creating an object instance from an object name. + + Mainly intended to create objects when resolving requirements. + + e.g: + .object_from_name('__other/object') -> + + """ + type_path = self.type.base_path + object_path = self.base_path + type_name, object_id = self.split_name(object_name) + return self.__class__(self.type.__class__(type_path, type_name), object_path, object_id=object_id) # FIXME: still needed? @property From 792ddf0a5bf2b26139373586200550f442994dbe Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 2 Nov 2011 09:13:23 +0100 Subject: [PATCH 0951/1024] add utility method to join object name from type and object_id Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index b62417b7..778bebe8 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -87,6 +87,15 @@ class Object(object): object_id = os.sep.join(object_name.split(os.sep)[1:]) return type_name, object_id + @staticmethod + def join_name(type_name, object_id): + """join_name('__type_name', 'the/object_id') -> __type_name/the/object_id' + + Join the given type_name and object_id into an object name. + + """ + return os.path.join(type_name, object_id) + def __init__(self, cdist_type, base_path, object_id=None): if object_id: if object_id.startswith('/'): @@ -96,7 +105,7 @@ class Object(object): self.type = cdist_type # instance of Type self.base_path = base_path self.object_id = object_id - self.name = os.path.join(self.type.name, self.object_id) + self.name = self.join_name(self.type.name, self.object_id) self.path = os.path.join(self.type.path, self.object_id, DOT_CDIST) self.absolute_path = os.path.join(self.base_path, self.path) self.code_local_path = os.path.join(self.path, "code-local") From e36e538f819b4991291a24455ece844180497c50 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 2 Nov 2011 09:15:44 +0100 Subject: [PATCH 0952/1024] sort lists before testing for equality Signed-off-by: Steven Armstrong --- lib/cdist/test/explorer/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cdist/test/explorer/__init__.py b/lib/cdist/test/explorer/__init__.py index 1f7a2e35..cafe34fc 100644 --- a/lib/cdist/test/explorer/__init__.py +++ b/lib/cdist/test/explorer/__init__.py @@ -69,7 +69,7 @@ class ExplorerClassTestCase(test.CdistTestCase): self.explorer.transfer_global_explorers() source = self.local.global_explorer_path destination = self.remote.global_explorer_path - self.assertEqual(os.listdir(source), os.listdir(destination)) + self.assertEqual(sorted(os.listdir(source)), sorted(os.listdir(destination))) def test_run_global_explorer(self): self.explorer.transfer_global_explorers() @@ -79,7 +79,7 @@ class ExplorerClassTestCase(test.CdistTestCase): def test_run_global_explorers(self): out_path = self.mkdtemp() self.explorer.run_global_explorers(out_path) - self.assertEqual(os.listdir(out_path), ['foobar', 'global']) + self.assertEqual(sorted(os.listdir(out_path)), sorted(['foobar', 'global'])) shutil.rmtree(out_path) def test_list_type_explorer_names(self): @@ -116,7 +116,7 @@ class ExplorerClassTestCase(test.CdistTestCase): self.explorer.transfer_object_parameters(cdist_object) source = os.path.join(self.local.object_path, cdist_object.parameter_path) destination = os.path.join(self.remote.object_path, cdist_object.parameter_path) - self.assertEqual(os.listdir(source), os.listdir(destination)) + self.assertEqual(sorted(os.listdir(source)), sorted(os.listdir(destination))) def test_run_type_explorer(self): cdist_type = core.Type(self.local.type_path, '__test_type') From e195eb46c495d42562607bfcf128563412732312 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 2 Nov 2011 16:30:35 +0100 Subject: [PATCH 0953/1024] new type __cron: installs and manages cron jobs Signed-off-by: Steven Armstrong --- conf/type/__cron/explorer/entry | 39 +++++++++++++++++ conf/type/__cron/gencode-remote | 63 +++++++++++++++++++++++++++ conf/type/__cron/man.text | 61 ++++++++++++++++++++++++++ conf/type/__cron/manifest | 66 +++++++++++++++++++++++++++++ conf/type/__cron/parameter/optional | 6 +++ conf/type/__cron/parameter/required | 2 + 6 files changed, 237 insertions(+) create mode 100755 conf/type/__cron/explorer/entry create mode 100755 conf/type/__cron/gencode-remote create mode 100644 conf/type/__cron/man.text create mode 100755 conf/type/__cron/manifest create mode 100644 conf/type/__cron/parameter/optional create mode 100644 conf/type/__cron/parameter/required diff --git a/conf/type/__cron/explorer/entry b/conf/type/__cron/explorer/entry new file mode 100755 index 00000000..362c96fe --- /dev/null +++ b/conf/type/__cron/explorer/entry @@ -0,0 +1,39 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +name="$__object_id" +user="$(cat "$__object/parameter/user")" + +prefix="#cdist:__cron/$name" +suffix="#/cdist:__cron/$name" + +crontab -u $user -l | awk -v prefix="$prefix" -v suffix="$suffix" ' +{ + if (index($0,prefix)) { + triggered=1 + } + if (triggered) { + if (index($0,suffix)) { + triggered=0 + } + print + } +} +' diff --git a/conf/type/__cron/gencode-remote b/conf/type/__cron/gencode-remote new file mode 100755 index 00000000..90b53451 --- /dev/null +++ b/conf/type/__cron/gencode-remote @@ -0,0 +1,63 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +user="$(cat "$__object/parameter/user")" +state_should="$(cat "$__object/parameter/state")" +state_is=$(cmp --quiet "$__object/parameter/entry" "$__object/explorer/entry" \ + && echo present \ + || echo absent +) + +if [ "$state_is" != "$state_should" ]; then + case "$state_should" in + present) + cat << DONE +tmp=\$(mktemp) +crontab -u $user -l > \$tmp +cat >> \$tmp << EOC +$(cat "$__object/parameter/entry")" +EOC +crontab -u $user \$tmp +rm \$tmp +DONE + ;; + absent) + # defined in type manifest + prefix="$(cat "$__object/parameter/prefix")" + suffix="$(cat "$__object/parameter/suffix")" + cat << DONE +crontab -u $user -l | awk -v prefix="$prefix" -v suffix="$suffix" ' +{ + if (index(\$0,prefix)) { + triggered=1 + } + if (triggered) { + if (index(\$0,suffix)) { + triggered=0 + } + } else { + print + } +} +' | crontab -u $user - +DONE + ;; + esac +fi diff --git a/conf/type/__cron/man.text b/conf/type/__cron/man.text new file mode 100644 index 00000000..c4852b7f --- /dev/null +++ b/conf/type/__cron/man.text @@ -0,0 +1,61 @@ +cdist-type__cron(7) +=================== +Steven Armstrong + + +NAME +---- +cdist-type__cron - installs and manages cron jobs + + +DESCRIPTION +----------- +This cdist type allows you to manage entries in a users crontab. + + +REQUIRED PARAMETERS +------------------- +user:: + The user who's crontab is edited +command:: + The command to run. + + +OPTIONAL PARAMETERS +------------------- +state:: + Either present or absent. Defaults to present. +minute:: + See crontab(5). Defaults to * +hour:: + See crontab(5). Defaults to * +day_of_month:: + See crontab(5). Defaults to * +month:: + See crontab(5). Defaults to * +day_of_week:: + See crontab(5). Defaults to * + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# add cronjob +__cron some-id --user root --command "/path/to/script" + +# remove cronjob +__cron some-id --user root --command "/path/to/script" --state absent +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- crontab(5) + + +COPYING +------- +Copyright \(C) 2011 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__cron/manifest b/conf/type/__cron/manifest new file mode 100755 index 00000000..01c4358c --- /dev/null +++ b/conf/type/__cron/manifest @@ -0,0 +1,66 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +name="$__object_id" +user="$(cat "$__object/parameter/user")" +command="$(cat "$__object/parameter/command")" + +# set defaults +if [ ! -f "$__object/parameter/state" ]; then + echo "present" > "$__object/parameter/state" +fi +if [ -f "$__object/parameter/minute" ]; then + minute="$(cat "$__object/parameter/minute")" +else + minute="*" + echo "$minute" > "$__object/parameter/minute" +fi +if [ -f "$__object/parameter/hour" ]; then + hour="$(cat "$__object/parameter/hour")" +else + hour="*" + echo "$hour" > "$__object/parameter/hour" +fi +if [ -f "$__object/parameter/day_of_month" ]; then + day_of_month="$(cat "$__object/parameter/day_of_month")" +else + day_of_month="*" + echo "$day_of_month" > "$__object/parameter/day_of_month" +fi +if [ -f "$__object/parameter/month" ]; then + month="$(cat "$__object/parameter/month")" +else + month="*" + echo "$month" > "$__object/parameter/month" +fi +if [ -f "$__object/parameter/day_of_week" ]; then + day_of_week="$(cat "$__object/parameter/day_of_week")" +else + day_of_week="*" + echo "$day_of_week" > "$__object/parameter/day_of_week" +fi + +# NOTE: if changed, also change in explorers +prefix="#cdist:__cron/$name" +suffix="#/cdist:__cron/$name" +echo "$prefix" | tee "$__object/parameter/prefix" > "$__object/parameter/entry" +echo "$minute $hour $day_of_month $month $day_of_week $command" >> "$__object/parameter/entry" +echo "$suffix" | tee "$__object/parameter/suffix" >> "$__object/parameter/entry" + diff --git a/conf/type/__cron/parameter/optional b/conf/type/__cron/parameter/optional new file mode 100644 index 00000000..1a4aae3d --- /dev/null +++ b/conf/type/__cron/parameter/optional @@ -0,0 +1,6 @@ +state +minute +hour +day_of_month +month +day_of_week diff --git a/conf/type/__cron/parameter/required b/conf/type/__cron/parameter/required new file mode 100644 index 00000000..711a59ab --- /dev/null +++ b/conf/type/__cron/parameter/required @@ -0,0 +1,2 @@ +user +command From f42dbb91036ac7d060d44ea1812b063d6e415a92 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 2 Nov 2011 16:39:52 +0100 Subject: [PATCH 0954/1024] --todo Signed-off-by: Steven Armstrong --- doc/dev/todo/TAKEME | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 4cdb6fcf..7974ef7d 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -43,7 +43,6 @@ TYPES - __file_edit - regexp replace (can probably cover all?) -> aka sed. -- __cron - __user add option to include --create-home From 77b1c676ca08d66ee654a373d44ef555aec75f7c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 2 Nov 2011 16:41:56 +0100 Subject: [PATCH 0955/1024] +/- todo Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 5 ++--- doc/man/man7/cdist-tutorial.text | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 4cdb6fcf..a96b3684 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -5,9 +5,8 @@ Feel free to pick one! CORE ---- -- probably remove or improve cdist-type-template -- allow cdist to run without $PATH setup: ./bin/cdist-deploy-to -- support non-ssh access? +- Add subcommand to create template of a type with working manpage + (cdist type-template or so) TESTS ----- diff --git a/doc/man/man7/cdist-tutorial.text b/doc/man/man7/cdist-tutorial.text index 71bf18c0..65f3811c 100644 --- a/doc/man/man7/cdist-tutorial.text +++ b/doc/man/man7/cdist-tutorial.text @@ -9,6 +9,28 @@ cdist-tutorial - a guided introduction into cdist +PREPARING YOUR MACHINE / SETUP +------------------------------ + +- ensure sshd is running on the target host: + +ssh target_host + +- ensure you can login as root + +ssh root@target host + +- ensure login as root works without keys +(see ssh... manpage) + +cdist will do a lot of requests to the target +host, thus you'll have to enter your password +many times, if you don't do this :-) + +- speedup processing with ControlMaster option of +ssh + + YOUR FIRST CONFIGURATION ------------------------ From fa95291cbcc16f48430ada0b018749d128ecb305 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 2 Nov 2011 16:46:50 +0100 Subject: [PATCH 0956/1024] use diff instad of cmp Signed-off-by: Steven Armstrong --- conf/type/__cron/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__cron/gencode-remote b/conf/type/__cron/gencode-remote index 90b53451..947c75ae 100755 --- a/conf/type/__cron/gencode-remote +++ b/conf/type/__cron/gencode-remote @@ -20,7 +20,7 @@ user="$(cat "$__object/parameter/user")" state_should="$(cat "$__object/parameter/state")" -state_is=$(cmp --quiet "$__object/parameter/entry" "$__object/explorer/entry" \ +state_is=$(diff -q "$__object/parameter/entry" "$__object/explorer/entry" \ && echo present \ || echo absent ) From 6e7ebf6de1c221446ec5dbe1cc569230792c7e29 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 2 Nov 2011 17:54:03 +0100 Subject: [PATCH 0957/1024] todo++ Signed-off-by: Steven Armstrong --- doc/dev/todo/steven | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index f8e13a45..2aacaa42 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -1,3 +1,10 @@ +autorequire: + - objects defined in type manifests should be automatically prerequisites of the current object + - __foo/some-id + __other other-id --state present + => require="__other/other-id" __foo/some-id + + metaparameters: - steal the metaparameters from puppet: From 0d05e61b85cb6a82ea9f15a068b4deb4d763e70a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 2 Nov 2011 23:57:13 +0100 Subject: [PATCH 0958/1024] tests and fixtures for emulator autorequire Signed-off-by: Steven Armstrong --- lib/cdist/test/emulator/__init__.py | 31 ++++++++++++++++++- .../test/emulator/fixtures/conf/manifest/init | 3 ++ .../fixtures/conf/type/__moon/manifest | 8 +++++ .../conf/type/__moon/parameter/optional | 1 + .../conf/type/__moon/parameter/required | 1 + .../fixtures/conf/type/__planet/manifest | 8 +++++ .../conf/type/__planet/parameter/optional | 1 + .../fixtures/conf/type/__saturn/manifest | 4 +++ .../fixtures/conf/type/__saturn/singleton | 0 9 files changed, 56 insertions(+), 1 deletion(-) create mode 100755 lib/cdist/test/emulator/fixtures/conf/manifest/init create mode 100755 lib/cdist/test/emulator/fixtures/conf/type/__moon/manifest create mode 100644 lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/optional create mode 100644 lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/required create mode 100755 lib/cdist/test/emulator/fixtures/conf/type/__planet/manifest create mode 100644 lib/cdist/test/emulator/fixtures/conf/type/__planet/parameter/optional create mode 100755 lib/cdist/test/emulator/fixtures/conf/type/__saturn/manifest create mode 100644 lib/cdist/test/emulator/fixtures/conf/type/__saturn/singleton diff --git a/lib/cdist/test/emulator/__init__.py b/lib/cdist/test/emulator/__init__.py index 91150334..7b30fba1 100644 --- a/lib/cdist/test/emulator/__init__.py +++ b/lib/cdist/test/emulator/__init__.py @@ -22,6 +22,7 @@ import os import shutil +import cdist from cdist import test from cdist.exec import local from cdist import emulator @@ -29,7 +30,6 @@ from cdist import core local_base_path = test.cdist_base_path - class EmulatorTestCase(test.CdistTestCase): def setUp(self): @@ -73,3 +73,32 @@ class EmulatorTestCase(test.CdistTestCase): os.environ['require'] = '__file/bad/id/with/.cdist/inside' emu = emulator.Emulator(argv) self.assertRaises(core.IllegalObjectIdError, emu.run) + + +import os.path as op +my_dir = op.abspath(op.dirname(__file__)) +fixtures = op.join(my_dir, 'fixtures') + +class AutoRequireEmulatorTestCase(test.CdistTestCase): + + def setUp(self): + 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.manifest = core.Manifest(self.target_host, self.local) + + def tearDown(self): + shutil.rmtree(self.temp_dir) + + def test_autorequire(self): + initial_manifest = os.path.join(self.local.manifest_path, "init") + self.manifest.run_initial_manifest(initial_manifest) + cdist_type = core.Type(self.local.type_path, '__saturn') + cdist_object = core.Object(cdist_type, self.local.object_path, 'singleton') + self.manifest.run_type_manifest(cdist_object) + expected = ['__planet/Saturn', '__moon/Prometheus'] + self.assertEqual(sorted(cdist_object.requirements), sorted(expected)) diff --git a/lib/cdist/test/emulator/fixtures/conf/manifest/init b/lib/cdist/test/emulator/fixtures/conf/manifest/init new file mode 100755 index 00000000..9fa1aa53 --- /dev/null +++ b/lib/cdist/test/emulator/fixtures/conf/manifest/init @@ -0,0 +1,3 @@ +#!/bin/sh + +__saturn diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__moon/manifest b/lib/cdist/test/emulator/fixtures/conf/type/__moon/manifest new file mode 100755 index 00000000..362be5a1 --- /dev/null +++ b/lib/cdist/test/emulator/fixtures/conf/type/__moon/manifest @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ -f "$__object/parameter/name" ]; then + name="(cat "$__object/parameter/name")" +else + name="$__object_id" + echo "$name" > "$__object/parameter/name" +fi diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/optional b/lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/optional new file mode 100644 index 00000000..f121bdbf --- /dev/null +++ b/lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/optional @@ -0,0 +1 @@ +name diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/required b/lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/required new file mode 100644 index 00000000..729a5167 --- /dev/null +++ b/lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/required @@ -0,0 +1 @@ +planet diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__planet/manifest b/lib/cdist/test/emulator/fixtures/conf/type/__planet/manifest new file mode 100755 index 00000000..362be5a1 --- /dev/null +++ b/lib/cdist/test/emulator/fixtures/conf/type/__planet/manifest @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ -f "$__object/parameter/name" ]; then + name="(cat "$__object/parameter/name")" +else + name="$__object_id" + echo "$name" > "$__object/parameter/name" +fi diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__planet/parameter/optional b/lib/cdist/test/emulator/fixtures/conf/type/__planet/parameter/optional new file mode 100644 index 00000000..f121bdbf --- /dev/null +++ b/lib/cdist/test/emulator/fixtures/conf/type/__planet/parameter/optional @@ -0,0 +1 @@ +name diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__saturn/manifest b/lib/cdist/test/emulator/fixtures/conf/type/__saturn/manifest new file mode 100755 index 00000000..38b8cbf3 --- /dev/null +++ b/lib/cdist/test/emulator/fixtures/conf/type/__saturn/manifest @@ -0,0 +1,4 @@ +#!/bin/sh + +__planet Saturn +require="__planet/Saturn" __moon Prometheus --planet Saturn diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__saturn/singleton b/lib/cdist/test/emulator/fixtures/conf/type/__saturn/singleton new file mode 100644 index 00000000..e69de29b From 7d0238682b1f9eac6ad8ce3b4d0e636433f93eae Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 2 Nov 2011 23:58:18 +0100 Subject: [PATCH 0959/1024] implement autorequire in emulator Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 4880c6e6..5b842a91 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -75,6 +75,7 @@ class Emulator(object): self.commandline() self.setup_object() self.record_requirements() + self.record_auto_requirements() self.log.debug("Finished %s %s" % (self.cdist_object.path, self.parameters)) def __init_log(self): @@ -178,3 +179,12 @@ class Emulator(object): # Record / Append source self.cdist_object.source.append(self.object_source) + + def record_auto_requirements(self): + """An object shall automatically depend on all objects that it defined in it's type manifest. + """ + # __object_name is the name of the object whose type manifest is currenlty executed + __object_name = os.environ.get('__object_name', None) + if __object_name: + _object = self.cdist_object.object_from_name(__object_name) + _object.requirements.append(self.cdist_object.name) From c58ec7e4efbf700309c60277baf8a3c91c408a09 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 3 Nov 2011 00:25:06 +0100 Subject: [PATCH 0960/1024] prevent circular dependencies Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 5b842a91..481e734a 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -187,4 +187,6 @@ class Emulator(object): __object_name = os.environ.get('__object_name', None) if __object_name: _object = self.cdist_object.object_from_name(__object_name) - _object.requirements.append(self.cdist_object.name) + # prevent circular dependencies + if not _object.name in self.cdist_object.requirements: + _object.requirements.append(self.cdist_object.name) From ddebf5b1537e6c3203383927a80390dbb4b14868 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 3 Nov 2011 10:37:10 +0100 Subject: [PATCH 0961/1024] __cron for 2.0.4 Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index aad067b7..7217a6f2 100644 --- a/doc/changelog +++ b/doc/changelog @@ -3,6 +3,7 @@ * Cleanup: __object_fq variable removed (never used) * Cleanup: Environment variable __self DEPRECATED, use __object_name instead * Cleanup: Environment variable __self scheduled for removal in cdist 2.1 + * New Type: __cron (Steven Armstrong) 2.0.3: 2011-10-18 * Improved logging, added --verbose, by more quiet by default From efedfbf47c2cd184d8827c050ba23ffb4b5cb227 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 3 Nov 2011 15:44:12 +0100 Subject: [PATCH 0962/1024] test for singleton requirement Signed-off-by: Steven Armstrong --- lib/cdist/test/emulator/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/cdist/test/emulator/__init__.py b/lib/cdist/test/emulator/__init__.py index 91150334..8f1b9776 100644 --- a/lib/cdist/test/emulator/__init__.py +++ b/lib/cdist/test/emulator/__init__.py @@ -73,3 +73,18 @@ class EmulatorTestCase(test.CdistTestCase): os.environ['require'] = '__file/bad/id/with/.cdist/inside' emu = emulator.Emulator(argv) self.assertRaises(core.IllegalObjectIdError, emu.run) + + def test_missing_object_id_requirement(self): + argv = ['__file', '/tmp/foobar'] + os.environ.update(self.env) + os.environ['require'] = '__file' + emu = emulator.Emulator(argv) + self.assertRaises(emulator.IllegalRequirementError, emu.run) + + def test_singleton_object_requirement(self): + argv = ['__file', '/tmp/foobar'] + os.environ.update(self.env) + os.environ['require'] = '__issue' + emu = emulator.Emulator(argv) + emu.run() + # if we get here all is fine From d0123acc2a6f7f2db05f25b4e63abce2f22a8649 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 3 Nov 2011 15:44:51 +0100 Subject: [PATCH 0963/1024] implement singleton as requirement Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 4880c6e6..7ae89294 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -156,19 +156,22 @@ class Emulator(object): self.log.debug("Recording requirement: " + requirement) requirement_parts = requirement.split(os.sep, 1) requirement_type_name = requirement_parts[0] - requirement_object_id = requirement_parts[1] - - # FIXME: Add support for omitted object id == singleton - #if len(requirement_parts) == 1: - #except IndexError: - # # no object id, must be singleton - # requirement_object_id = 'singleton' - - # Remove / if existent in object id + try: + requirement_object_id = requirement_parts[1] + except IndexError: + # no object id, assume singleton + requirement_object_id = 'singleton' + + # Remove leading / from object id requirement_object_id = requirement_object_id.lstrip('/') # Instantiate type which fails if type does not exist requirement_type = core.Type(self.type_base_path, requirement_type_name) + + if requirement_object_id == 'singleton' \ + and not requirement_type.is_singleton: + raise IllegalRequirementError(requirement, "Missing object_id and type is not a singleton.") + # Instantiate object which fails if the object_id is illegal requirement_object = core.Object(requirement_type, self.object_base_path, requirement_object_id) From 360a03a34940b59fdf2fa449f184f225d059a6fd Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 3 Nov 2011 17:21:14 +0100 Subject: [PATCH 0964/1024] add examples for __remote_{copy,exec} scripts Signed-off-by: Steven Armstrong --- other/examples/remote/README | 2 ++ other/examples/remote/chroot/copy | 28 +++++++++++++++++++++++++ other/examples/remote/chroot/exec | 35 +++++++++++++++++++++++++++++++ other/examples/remote/ssh/copy | 10 +++++++++ other/examples/remote/ssh/exec | 10 +++++++++ 5 files changed, 85 insertions(+) create mode 100644 other/examples/remote/README create mode 100755 other/examples/remote/chroot/copy create mode 100755 other/examples/remote/chroot/exec create mode 100755 other/examples/remote/ssh/copy create mode 100755 other/examples/remote/ssh/exec diff --git a/other/examples/remote/README b/other/examples/remote/README new file mode 100644 index 00000000..288fc293 --- /dev/null +++ b/other/examples/remote/README @@ -0,0 +1,2 @@ +Some examples of using alternative __remote_copy and __remote_exec prefixes. +This allows you to change how cdist interacts with the target host (or directory, or whatever :-) diff --git a/other/examples/remote/chroot/copy b/other/examples/remote/chroot/copy new file mode 100755 index 00000000..eb284ced --- /dev/null +++ b/other/examples/remote/chroot/copy @@ -0,0 +1,28 @@ +#!/bin/sh +# +# __remote_copy script to run cdist against a local chroot instead of via ssh +# to a remote target host. +# +# Usage: +# __remote_copy="/path/to/this/script /path/to/your/chroot" cdist config target-id +# + +log() { + #echo "$@" | logger -t "cdist-chroot-copy" + : +} + +chroot="$1"; shift +target_host="$__target_host" + +# replace target_host with chroot location +code="$(echo "$@" | sed "s|$target_host:|$chroot|g")" + +log "$@" +log "target_host: $target_host" +log "$code" + +# copy files into chroot +cp $code + +log "-----" diff --git a/other/examples/remote/chroot/exec b/other/examples/remote/chroot/exec new file mode 100755 index 00000000..21efe421 --- /dev/null +++ b/other/examples/remote/chroot/exec @@ -0,0 +1,35 @@ +#!/bin/sh +# +# __remote_exec script to run cdist against a local chroot instead of via ssh +# on a remote target host. +# +# Usage: +# __remote_exec="/path/to/this/script /path/to/your/chroot" cdist config target-id +# + +log() { + #echo "$@" | logger -t "cdist-chroot-exec" + : +} + +chroot="$1"; shift +target_host="$1"; shift +script=$(mktemp "${chroot}/tmp/chroot-${0##*/}.XXXXXXXXXX") +trap cleanup INT TERM EXIT +cleanup() { + [ $__cdist_debug ] || rm "$script" +} + +log "$script" +log "$@" +echo "#!/bin/sh -l" > "$script" +echo "$@" >> "$script" +chmod +x "$script" + +relative_script="${script#$chroot}" +log "relative_script: $relative_script" + +# run in chroot +chroot "$chroot" "$relative_script" + +log "-----" diff --git a/other/examples/remote/ssh/copy b/other/examples/remote/ssh/copy new file mode 100755 index 00000000..76c0b2c8 --- /dev/null +++ b/other/examples/remote/ssh/copy @@ -0,0 +1,10 @@ +#!/bin/sh +# +# same as cdist default +# +# Usage: +# __remote_copy="/path/to/this/script" cdist config target_host +# + +#echo "$@" | logger -t "cdist-ssh-copy" +scp -o User=root -q $@ diff --git a/other/examples/remote/ssh/exec b/other/examples/remote/ssh/exec new file mode 100755 index 00000000..63994973 --- /dev/null +++ b/other/examples/remote/ssh/exec @@ -0,0 +1,10 @@ +#!/bin/sh +# +# same as cdist default +# +# Usage: +# __remote_exec="/path/to/this/script" cdist config target_host +# + +#echo "$@" | logger -t "cdist-ssh-exec" +ssh -o User=root -q $@ From f864d307be95aec568a05a401784822ae21923e6 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 3 Nov 2011 22:35:06 +0100 Subject: [PATCH 0965/1024] +licence, +logging Signed-off-by: Steven Armstrong --- other/examples/remote/chroot/copy | 21 ++++++++++++++++++++- other/examples/remote/chroot/exec | 24 ++++++++++++++++++++++-- other/examples/remote/ssh/copy | 18 ++++++++++++++++++ other/examples/remote/ssh/exec | 18 ++++++++++++++++++ 4 files changed, 78 insertions(+), 3 deletions(-) diff --git a/other/examples/remote/chroot/copy b/other/examples/remote/chroot/copy index eb284ced..528a5faf 100755 --- a/other/examples/remote/chroot/copy +++ b/other/examples/remote/chroot/copy @@ -1,5 +1,23 @@ #!/bin/sh # +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# # __remote_copy script to run cdist against a local chroot instead of via ssh # to a remote target host. # @@ -18,8 +36,9 @@ target_host="$__target_host" # replace target_host with chroot location code="$(echo "$@" | sed "s|$target_host:|$chroot|g")" -log "$@" log "target_host: $target_host" +log "chroot: $chroot" +log "$@" log "$code" # copy files into chroot diff --git a/other/examples/remote/chroot/exec b/other/examples/remote/chroot/exec index 21efe421..19e76b0e 100755 --- a/other/examples/remote/chroot/exec +++ b/other/examples/remote/chroot/exec @@ -1,5 +1,23 @@ #!/bin/sh # +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# # __remote_exec script to run cdist against a local chroot instead of via ssh # on a remote target host. # @@ -14,14 +32,16 @@ log() { chroot="$1"; shift target_host="$1"; shift + script=$(mktemp "${chroot}/tmp/chroot-${0##*/}.XXXXXXXXXX") trap cleanup INT TERM EXIT cleanup() { [ $__cdist_debug ] || rm "$script" } -log "$script" -log "$@" +log "target_host: $target_host" +log "script: $script" +log "@: $@" echo "#!/bin/sh -l" > "$script" echo "$@" >> "$script" chmod +x "$script" diff --git a/other/examples/remote/ssh/copy b/other/examples/remote/ssh/copy index 76c0b2c8..0ecd8c52 100755 --- a/other/examples/remote/ssh/copy +++ b/other/examples/remote/ssh/copy @@ -1,5 +1,23 @@ #!/bin/sh # +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# # same as cdist default # # Usage: diff --git a/other/examples/remote/ssh/exec b/other/examples/remote/ssh/exec index 63994973..b597a47f 100755 --- a/other/examples/remote/ssh/exec +++ b/other/examples/remote/ssh/exec @@ -1,5 +1,23 @@ #!/bin/sh # +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# # same as cdist default # # Usage: From dad14af100453d467ded44647196d538a5cf9959 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 3 Nov 2011 22:37:05 +0100 Subject: [PATCH 0966/1024] add example for __remote_{copy,exec} scripts using schroot over ssh on remote host Signed-off-by: Steven Armstrong --- other/examples/remote/schroot/copy | 50 ++++++++++++++++++++++++++++++ other/examples/remote/schroot/exec | 45 +++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100755 other/examples/remote/schroot/copy create mode 100755 other/examples/remote/schroot/exec diff --git a/other/examples/remote/schroot/copy b/other/examples/remote/schroot/copy new file mode 100755 index 00000000..3587a4f2 --- /dev/null +++ b/other/examples/remote/schroot/copy @@ -0,0 +1,50 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# __remote_copy script to run cdist against a chroot on the target host over ssh. +# +# Usage: +# __remote_copy="/path/to/this/script schroot-chroot-name" cdist config target_host +# + +log() { + #echo "$@" | logger -t "cdist-schroot-copy" + : +} + +chroot_name="$1"; shift +target_host="$__target_host" + +# get directory for given chroot_name +chroot="$(ssh -o User=root -q $target_host schroot $chroot_name --config | awk -F = '/directory=/ {print $2}')" + +# prefix destination with chroot +code="$(echo "$@" | sed "s|$target_host:|$target_host:$chroot|g")" + +log "target_host: $target_host" +log "chroot_name: $chroot_name" +log "chroot: $chroot" +log "@: $@" +log "code: $code" + +# copy files into remote chroot +scp -o User=root -q $code + +log "-----" diff --git a/other/examples/remote/schroot/exec b/other/examples/remote/schroot/exec new file mode 100755 index 00000000..5b561de0 --- /dev/null +++ b/other/examples/remote/schroot/exec @@ -0,0 +1,45 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# __remote_exec script to run cdist against a chroot on the target host over ssh. +# +# Usage: +# __remote_exec="/path/to/this/script schroot-chroot-name" cdist config target_host +# + +log() { + #echo "$@" | logger -t "cdist-schroot-exec" + : +} + +chroot_name="$1"; shift +target_host="$1"; shift + +code="ssh -o User=root -q $target_host schroot -c $chroot_name -- $@" + +log "target_host: $target_host" +log "chroot_name: $chroot_name" +log "@: $@" +log "code: $code" + +# run in remote chroot +$code + +log "-----" From e18bd97c862af7e9f683a349ddbd0418a75667d6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 8 Nov 2011 08:28:04 +0100 Subject: [PATCH 0967/1024] SUCESSFUL is very helpful to grep for :-) Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 75b07e78..c109e131 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -71,7 +71,7 @@ class ConfigInstall(object): start_time = time.time() self.deploy_to() self.cleanup() - self.log.info("Finished run in %s seconds", + self.log.info("Finished successful run in %s seconds", time.time() - start_time) def stage_prepare(self): From 45c9f629ae2cccae44c2dd790ff44352a837ab6b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 8 Nov 2011 13:29:11 +0100 Subject: [PATCH 0968/1024] another more complete __remote_{copy,exec} example, including usage instructions for dispatching in .../manifest/init Signed-off-by: Steven Armstrong --- other/examples/remote/schroot-uri | 132 ++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100755 other/examples/remote/schroot-uri diff --git a/other/examples/remote/schroot-uri b/other/examples/remote/schroot-uri new file mode 100755 index 00000000..06dce369 --- /dev/null +++ b/other/examples/remote/schroot-uri @@ -0,0 +1,132 @@ +#!/bin/sh -e +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# __remote_{exec,copy} script to run cdist against a schroot target uri +# +# Usage: +# __remote_exec="/path/to/this/script exec" cdist config target_uri +# __remote_copy="/path/to/this/script copy" cdist config target_uri +# +# # target_uri examples: +# schroot:///chroot-name +# schroot://foo.ethz.ch/chroot-name +# schroot://user-name@foo.ethz.ch/chroot-name +# +# # and how to match them in .../manifest/init +# case "$target_host" in +# schroot://*) +# # any schroot +# ;; +# schroot://foo.ethz.ch/*) +# # any schroot on specific host +# ;; +# schroot://foo.ethz.ch/chroot-name) +# # specific schroot on specific host +# ;; +# schroot:///chroot-name) +# # specific schroot on localhost +# ;; +# esac + +my_name="${0##*/}" +mode="$1"; shift + +log() { + #echo "$@" | logger -t "cdist-$my_name-$mode" + : +} + +die() { + echo "$@" >&2 + exit 1 +} + + +uri="$__target_host" + +scheme="${uri%%:*}"; rest="${uri#$scheme:}"; rest="${rest#//}" +authority="${rest%%/*}"; rest="${rest#$authority}" +path="${rest%\?*}"; rest="${rest#$path}" +schroot_name="${path#/}" + +[ "$scheme" = "schroot" ] || die "Failed to parse scheme from __target_host ($__target_host). Expected 'schroot', got '$scheme'" +[ -n "$schroot_name" ] || die "Failed to parse schroot name from __target_host: $__target_host" + +case "$authority" in + '') + # authority is empty, neither user nor host given + user="" + host="" + ;; + *@*) + # authority contains @, take user from authority + user="${authority%@*}" + host="${authority#*@}" + ;; + *) + # no user in authority, default to root + user="root" + host="$authority" + ;; +esac + +log "mode: $mode" +log "@: $@" +log "uri: $uri" +log "scheme: $scheme" +log "authority: $authority" +log "user: $user" +log "host: $host" +log "path: $path" +log "schroot_name: $schroot_name" + +exec_prefix="" +copy_prefix="" +if [ -n "$host" ]; then + # we are working on a remote host + exec_prefix="ssh -o User=$user -q $host" + copy_prefix="scp -o User=$user -q" + copy_destination_prefix="$host:" +else + # working on local machine + copy_prefix="cp" + copy_destination_prefix="" +fi + +case "$mode" in + exec) + code="$exec_prefix schroot -c $schroot_name -- $@" + ;; + copy) + # get directory for given chroot_name + schroot_directory="$($exec_prefix schroot $chroot_name --config | awk -F = '/directory=/ {print $2}')" + [ -n "$schroot_directory" ] || die "Failed to retreive schroot directory for schroot: $schroot_name" + # prefix destination with chroot + code="$copy_prefix $(echo "$@" | sed "s|$uri:|${copy_destination_prefix}${schroot_directory}|g")" + ;; + *) die "Unknown mode: $mode";; +esac + +log "code: $code" + +# Run the code +$code + +log "-----" From b3337a18b9718fbaf4cda2424589d1bbfe49fe17 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 9 Nov 2011 18:30:12 +0100 Subject: [PATCH 0969/1024] in theory catch error when requiring an undefined object (in practise not) Error message trying to fix: ERROR: [Errno 2] No such file or directory: '/home/users/nico/.tmp/tmptvy1ic/out/object/__localch_yum_repos/singleton/.cdist/state' Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index c109e131..055a3b89 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -106,7 +106,7 @@ class ConfigInstall(object): """Run gencode and code for an object""" self.log.debug("Trying to run object " + cdist_object.name) if cdist_object.state == core.Object.STATE_RUNNING: - # FIXME: resolve dependency circle + # FIXME: resolve dependency circle / show problem source raise cdist.Error("Detected circular dependency in " + cdist_object.name) elif cdist_object.state == core.Object.STATE_DONE: self.log.debug("Ignoring run of already finished object %s", cdist_object) @@ -119,6 +119,13 @@ class ConfigInstall(object): for requirement in cdist_object.requirements: self.log.debug("Object %s requires %s", cdist_object, requirement) required_object = cdist_object.object_from_name(requirement) + + # The user may have created dependencies without satisfying them + if not required_object.exists(): + raise cdist.Error(cdist_object.name + " requires non-existing " + requirement.name) + else + self.log.debug("Required object %s exists", requirement.name) + self.object_run(required_object) # Generate From c7d0d581b1bf044d42d5ffadea64a1ce840e6c0e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 9 Nov 2011 18:41:46 +0100 Subject: [PATCH 0970/1024] we pass base_path, not object_path (clearification) Signed-off-by: Nico Schottelius --- lib/cdist/core/object.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 778bebe8..db818f11 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -132,9 +132,9 @@ class Object(object): """ type_path = self.type.base_path - object_path = self.base_path + base_path = self.base_path type_name, object_id = self.split_name(object_name) - return self.__class__(self.type.__class__(type_path, type_name), object_path, object_id=object_id) + return self.__class__(self.type.__class__(type_path, type_name), base_path, object_id=object_id) # FIXME: still needed? @property From f95ee8062f6584d40eb0c54ee0397c554e8a411f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 9 Nov 2011 20:28:04 +0100 Subject: [PATCH 0971/1024] --SyntaxError Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 055a3b89..0391dbc5 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -123,7 +123,7 @@ class ConfigInstall(object): # The user may have created dependencies without satisfying them if not required_object.exists(): raise cdist.Error(cdist_object.name + " requires non-existing " + requirement.name) - else + else: self.log.debug("Required object %s exists", requirement.name) self.object_run(required_object) From ae23f1576f8ce8fa93d88a0b73820538c7d573c4 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 9 Nov 2011 20:28:51 +0100 Subject: [PATCH 0972/1024] --TypeError Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 0391dbc5..fbb863c3 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -121,7 +121,7 @@ class ConfigInstall(object): required_object = cdist_object.object_from_name(requirement) # The user may have created dependencies without satisfying them - if not required_object.exists(): + if not required_object.exists: raise cdist.Error(cdist_object.name + " requires non-existing " + requirement.name) else: self.log.debug("Required object %s exists", requirement.name) From e1cf8d094b0ee74f62613ab5b81d1f08767986a0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 9 Nov 2011 20:29:36 +0100 Subject: [PATCH 0973/1024] --AttributeError Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index fbb863c3..3b347eb1 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -122,7 +122,7 @@ class ConfigInstall(object): # The user may have created dependencies without satisfying them if not required_object.exists: - raise cdist.Error(cdist_object.name + " requires non-existing " + requirement.name) + raise cdist.Error(cdist_object.name + " requires non-existing " + required_object.name) else: self.log.debug("Required object %s exists", requirement.name) From b92ea62f72ad26a54c4a17dcfac688d714c1eb3a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 9 Nov 2011 20:36:40 +0100 Subject: [PATCH 0974/1024] export OBJECT_MARKER for use in tests Signed-off-by: Steven Armstrong --- lib/cdist/core/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/core/__init__.py b/lib/cdist/core/__init__.py index ac5bbf2f..c61c659b 100644 --- a/lib/cdist/core/__init__.py +++ b/lib/cdist/core/__init__.py @@ -23,6 +23,7 @@ from cdist.core.type import Type from cdist.core.type import NoSuchTypeError from cdist.core.object import Object from cdist.core.object import IllegalObjectIdError +from cdist.core.object import OBJECT_MARKER from cdist.core.explorer import Explorer from cdist.core.manifest import Manifest from cdist.core.code import Code From 1729516414715d95ac71ac5c645ecd1683f6d279 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 9 Nov 2011 20:38:22 +0100 Subject: [PATCH 0975/1024] allow .cdist (OBJECT_MARKER) inside file names but not as _the_ file/folder name Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 10 +++++----- lib/cdist/test/object/__init__.py | 10 ++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index db818f11..9abb11eb 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -30,7 +30,7 @@ from cdist.util import fsproperty log = logging.getLogger(__name__) -DOT_CDIST = '.cdist' +OBJECT_MARKER = '.cdist' class IllegalObjectIdError(cdist.Error): @@ -72,7 +72,7 @@ class Object(object): def list_object_names(cls, object_base_path): """Return a list of object names""" for path, dirs, files in os.walk(object_base_path): - if DOT_CDIST in dirs: + if OBJECT_MARKER in dirs: yield os.path.relpath(path, object_base_path) @staticmethod @@ -100,13 +100,13 @@ class Object(object): if object_id: if object_id.startswith('/'): raise IllegalObjectIdError(object_id, 'object_id may not start with /') - if '.cdist' in object_id: - raise IllegalObjectIdError(object_id, 'object_id may not contain \'.cdist\'') + if OBJECT_MARKER in object_id.split(os.sep): + raise IllegalObjectIdError(object_id, 'object_id may not contain \'%s\'' % OBJECT_MARKER) self.type = cdist_type # instance of Type self.base_path = base_path self.object_id = object_id self.name = self.join_name(self.type.name, self.object_id) - self.path = os.path.join(self.type.path, self.object_id, DOT_CDIST) + self.path = os.path.join(self.type.path, self.object_id, OBJECT_MARKER) self.absolute_path = os.path.join(self.base_path, self.path) self.code_local_path = os.path.join(self.path, "code-local") self.code_remote_path = os.path.join(self.path, "code-remote") diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 6681c916..f199ffb5 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -58,12 +58,18 @@ class ObjectIdTestCase(test.CdistTestCase): with self.assertRaises(core.IllegalObjectIdError): core.Object(cdist_type, object_base_path, illegal_object_id) - def test_object_id_contains_dotcdist(self): + def test_object_id_contains_object_marker(self): cdist_type = core.Type(type_base_path, '__third') - illegal_object_id = 'object_id/may/not/contain/.cdist/anywhere' + illegal_object_id = 'object_id/may/not/contain/%s/anywhere' % core.OBJECT_MARKER with self.assertRaises(core.IllegalObjectIdError): core.Object(cdist_type, object_base_path, illegal_object_id) + def test_object_id_contains_object_marker_string(self): + cdist_type = core.Type(type_base_path, '__third') + illegal_object_id = 'object_id/may/contain_%s_in_filename' % core.OBJECT_MARKER + core.Object(cdist_type, object_base_path, illegal_object_id) + # if we get here, the test passed + class ObjectTestCase(test.CdistTestCase): From 6dd1465aa8b43a31915002ddfbfc9dd79c3f536e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 14 Nov 2011 15:29:07 +0100 Subject: [PATCH 0976/1024] --AttributeError Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3b347eb1..2d2ab949 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -124,7 +124,7 @@ class ConfigInstall(object): if not required_object.exists: raise cdist.Error(cdist_object.name + " requires non-existing " + required_object.name) else: - self.log.debug("Required object %s exists", requirement.name) + self.log.debug("Required object %s exists", required_object.name) self.object_run(required_object) From b9301c8194e5a2fcf153ac5e27d04047773ac64e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 14 Nov 2011 23:05:13 +0100 Subject: [PATCH 0977/1024] bugfix: process names dont start with slash Signed-off-by: Steven Armstrong --- conf/type/__process/explorer/runs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__process/explorer/runs b/conf/type/__process/explorer/runs index 2bfa8f84..240ebef9 100755 --- a/conf/type/__process/explorer/runs +++ b/conf/type/__process/explorer/runs @@ -24,7 +24,7 @@ if [ -f "$__object/parameter/name" ]; then name="$(cat "$__object/parameter/name")" else - name="/$__object_id" + name="$__object_id" fi pgrep -x -f "$name" || true From d7623fcf217e5872ab60794b567c97068566b6df Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 14 Nov 2011 23:18:44 +0100 Subject: [PATCH 0978/1024] pgrep -x -f is to restrictive -> impossible to guess/match Signed-off-by: Steven Armstrong --- conf/type/__process/explorer/runs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__process/explorer/runs b/conf/type/__process/explorer/runs index 240ebef9..3ac9ce2f 100755 --- a/conf/type/__process/explorer/runs +++ b/conf/type/__process/explorer/runs @@ -27,4 +27,4 @@ else name="$__object_id" fi -pgrep -x -f "$name" || true +pgrep -x "$name" || true From 98ff723b2406f8cef902d5fab87c794092e42904 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Nov 2011 09:20:27 +0100 Subject: [PATCH 0979/1024] add another example for __process Signed-off-by: Nico Schottelius --- conf/type/__process/man.text | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/conf/type/__process/man.text b/conf/type/__process/man.text index fd3bcf49..065beeef 100644 --- a/conf/type/__process/man.text +++ b/conf/type/__process/man.text @@ -50,6 +50,10 @@ __process /usr/sbin/sshd --state stopped --stop "/etc/rc.d/sshd stop" # Ensure cups is running, which runs with -C ...: __process cups --start "/etc/rc.d/cups start" --state running \ --name "/usr/sbin/cupsd -C /etc/cups/cupsd.conf" + +# Ensure rpc.statd is running (which usually runs with -L) using a regexp +__process rpcstatd --state running --start "/etc/init.d/statd start" \ + --name "rpc.statd.*" -------------------------------------------------------------------------------- From 7d10560a6145f2e6fe8baf2330fd941a92e1689a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 15 Nov 2011 09:21:07 +0100 Subject: [PATCH 0980/1024] Revert "pgrep -x -f is to restrictive -> impossible to guess/match" It's not, regexp are your friends :-) This reverts commit d7623fcf217e5872ab60794b567c97068566b6df. --- conf/type/__process/explorer/runs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__process/explorer/runs b/conf/type/__process/explorer/runs index 3ac9ce2f..240ebef9 100755 --- a/conf/type/__process/explorer/runs +++ b/conf/type/__process/explorer/runs @@ -27,4 +27,4 @@ else name="$__object_id" fi -pgrep -x "$name" || true +pgrep -x -f "$name" || true From d706e8ef03eb45cc13f3161598ecf227290718b7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Nov 2011 08:07:19 +0100 Subject: [PATCH 0981/1024] more changes for 2.0.4 Signed-off-by: Nico Schottelius --- doc/changelog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index 7217a6f2..87fad8c0 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,9 +1,10 @@ -2.0.4: +2.0.4: 2011-11-16 * Bugfix core: Remove traceback when sending SIGINT (aka Ctrl-C) * Cleanup: __object_fq variable removed (never used) * Cleanup: Environment variable __self DEPRECATED, use __object_name instead * Cleanup: Environment variable __self scheduled for removal in cdist 2.1 * New Type: __cron (Steven Armstrong) + * Documentation: Many examples for use of __remote_* (Steven Armstrong) 2.0.3: 2011-10-18 * Improved logging, added --verbose, by more quiet by default From ff5fb5dbdb60f76db62e48ae94e3eb279311d326 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 16 Nov 2011 08:10:50 +0100 Subject: [PATCH 0982/1024] remove obsolete cdist video link (to be replaced with new video) Signed-off-by: Nico Schottelius --- README | 2 -- build | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README b/README index 1c2139cc..c3105e26 100644 --- a/README +++ b/README @@ -53,8 +53,6 @@ UNIX, simplicity, familar environment | cdist is configured in POSIX shell The cdist documentation is included as manpages in the distribution. * You can [browse the documentation of the latest version online](man) as well. - * Or you can watch the youtube **video** -[cdist installation and first usage in less than 60 seconds][http://www.youtube.com/watch?v=PRMjzy48eTI). * Have a look at the [given speeches](speeches) ### OS support diff --git a/build b/build index 38fdac07..919360ae 100755 --- a/build +++ b/build @@ -26,13 +26,16 @@ # exit on any error #set -e +version=$(git describe) + # Manpage and HTML A2XM="a2x -f manpage --no-xmllint -a encoding=UTF-8" A2XH="a2x -f xhtml --no-xmllint -a encoding=UTF-8" # Developer webbase WEBDIR=$HOME/niconetz -WEBBASE=software/cdist +WEBBASE=$WEBDIR/software/cdist +WEBDOCBASE=$WEBBASE/$version WEBPAGE=${WEBBASE}.mdwn # Documentation From 56d783f612e03bc4bc570112fc9711953c5c2ffa Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 17 Nov 2011 13:03:56 +0100 Subject: [PATCH 0983/1024] tests and fixtures for type parameters with dashes Signed-off-by: Steven Armstrong --- lib/cdist/test/emulator/__init__.py | 39 +++++++++++++++++++ .../parameter/required | 1 + 2 files changed, 40 insertions(+) create mode 100644 lib/cdist/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required diff --git a/lib/cdist/test/emulator/__init__.py b/lib/cdist/test/emulator/__init__.py index 8f1b9776..5c920770 100644 --- a/lib/cdist/test/emulator/__init__.py +++ b/lib/cdist/test/emulator/__init__.py @@ -88,3 +88,42 @@ class EmulatorTestCase(test.CdistTestCase): emu = emulator.Emulator(argv) emu.run() # if we get here all is fine + + +import os.path as op +my_dir = op.abspath(op.dirname(__file__)) +fixtures = op.join(my_dir, 'fixtures') + +class ArgumentsWithDashesTestCase(test.CdistTestCase): + + def setUp(self): + self.temp_dir = self.mkdtemp() + self.target_host = 'localhost' + 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.env = { + 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), + '__target_host': self.target_host, + '__global': self.local.out_path, + '__cdist_type_base_path': self.local.type_path, # for use in type emulator + '__manifest': self.local.manifest_path, + '__cdist_manifest': self.script, + } + + def tearDown(self): + shutil.rmtree(self.temp_dir) + + def test_arguments_with_dashes(self): + argv = ['__arguments_with_dashes', 'some-id', '--with-dash', 'some value'] + os.environ.update(self.env) + emu = emulator.Emulator(argv) + emu.run() + + cdist_type = core.Type(self.local.type_path, '__arguments_with_dashes') + cdist_object = core.Object(cdist_type, self.local.object_path, 'some-id') + self.assertTrue('with-dash' in cdist_object.parameters) diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required b/lib/cdist/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required new file mode 100644 index 00000000..02fabce1 --- /dev/null +++ b/lib/cdist/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required @@ -0,0 +1 @@ +with-dash From 68f66af21a2ed23f36d926dde0e7d24e54bc7346 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 17 Nov 2011 13:04:39 +0100 Subject: [PATCH 0984/1024] implement: accept parameters with dashes Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 7ae89294..8fd03d4d 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -97,10 +97,10 @@ class Emulator(object): for parameter in self.cdist_type.optional_parameters: argument = "--" + parameter - parser.add_argument(argument, action='store', required=False) + parser.add_argument(argument, dest=parameter, action='store', required=False) for parameter in self.cdist_type.required_parameters: argument = "--" + parameter - parser.add_argument(argument, action='store', required=True) + parser.add_argument(argument, dest=parameter, action='store', required=True) # If not singleton support one positional parameter if not self.cdist_type.is_singleton: From 79c1f4cb4d018a5c72ef566f2743dea0fdee9af3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 17 Nov 2011 13:25:47 +0100 Subject: [PATCH 0985/1024] document - support Signed-off-by: Nico Schottelius --- build | 8 ++++---- doc/changelog | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build b/build index 919360ae..085bcdf1 100755 --- a/build +++ b/build @@ -35,7 +35,7 @@ A2XH="a2x -f xhtml --no-xmllint -a encoding=UTF-8" # Developer webbase WEBDIR=$HOME/niconetz WEBBASE=$WEBDIR/software/cdist -WEBDOCBASE=$WEBBASE/$version +WEBMAN=$WEBBASE/man/$version WEBPAGE=${WEBBASE}.mdwn # Documentation @@ -98,9 +98,9 @@ case "$1" in ;; web) - cp README ${WEBDIR}/${WEBPAGE} - rm -rf ${WEBDIR}/${WEBBASE}/man - mkdir -p ${WEBDIR}/${WEBBASE}/man/man1 ${WEBDIR}/${WEBBASE}/man/man7 + cp README ${WEBPAGE} + rm -rf ${WEBMAN} + mkdir -p ${WEBMAN}/man1 ${WEBMAN}/man7 rm -rf ${WEBDIR}/${WEBBASE}/speeches && mkdir ${WEBDIR}/${WEBBASE}/speeches diff --git a/doc/changelog b/doc/changelog index 87fad8c0..e0841f67 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,10 +1,11 @@ -2.0.4: 2011-11-16 +2.0.4: * Bugfix core: Remove traceback when sending SIGINT (aka Ctrl-C) + * Bugfix core: Accept parameters with - in the name (Steven Armstrong) * Cleanup: __object_fq variable removed (never used) * Cleanup: Environment variable __self DEPRECATED, use __object_name instead * Cleanup: Environment variable __self scheduled for removal in cdist 2.1 - * New Type: __cron (Steven Armstrong) * Documentation: Many examples for use of __remote_* (Steven Armstrong) + * New Type: __cron (Steven Armstrong) 2.0.3: 2011-10-18 * Improved logging, added --verbose, by more quiet by default From e380cdf7de5b981b3fa0c80df05be2775652d68e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 17 Nov 2011 15:30:21 +0100 Subject: [PATCH 0986/1024] build.sh is old Signed-off-by: Nico Schottelius --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index c3105e26..ff1293e8 100644 --- a/README +++ b/README @@ -131,7 +131,7 @@ To install cdist, execute the following commands: export PATH=$PATH:$(pwd -P)/bin # If you want the manpages - ./build.sh man + ./build man export MANPATH=$MANPATH:$(pwd -P)/doc/man @@ -178,7 +178,7 @@ To upgrade cdist in the current branch use git pull # Also update the manpages - ./build.sh man + ./build man export MANPATH=$MANPATH:$(pwd -P)/doc/man If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break. From cbfcd01d4fff773e1e2824cc526869e682915d85 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 17 Nov 2011 21:51:50 +0100 Subject: [PATCH 0987/1024] ++bugfix Signed-off-by: Steven Armstrong --- other/examples/remote/schroot-uri | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/other/examples/remote/schroot-uri b/other/examples/remote/schroot-uri index 06dce369..a23277ec 100755 --- a/other/examples/remote/schroot-uri +++ b/other/examples/remote/schroot-uri @@ -49,7 +49,7 @@ my_name="${0##*/}" mode="$1"; shift log() { - #echo "$@" | logger -t "cdist-$my_name-$mode" + echo "$@" | logger -t "cdist-$my_name-$mode" : } @@ -112,7 +112,9 @@ fi case "$mode" in exec) - code="$exec_prefix schroot -c $schroot_name -- $@" + # In exec mode the first argument is the __target_host which we already got from env. Get rid of it. + shift + code="$exec_prefix schroot -c $schroot_name -- sh -c '$@'" ;; copy) # get directory for given chroot_name From c59b2839cd2be04b7c7ebb4873a3e3a390ec597a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 18 Nov 2011 08:56:29 +0100 Subject: [PATCH 0988/1024] Export target_host so remote_copy script has access to it Signed-off-by: Steven Armstrong --- conf/type/__file/gencode-local | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conf/type/__file/gencode-local b/conf/type/__file/gencode-local index 0c6c249d..ae8625b5 100755 --- a/conf/type/__file/gencode-local +++ b/conf/type/__file/gencode-local @@ -31,6 +31,8 @@ if [ -f "$__object/parameter/source" ]; then remote_cksum="$(cat "$__object/explorer/cksum")" if [ "$local_cksum" != "$remote_cksum" ]; then + # Export target_host so remote_copy script has access to it + echo "export __target_host=\"$__target_host\"" echo "$__remote_copy" "$source" "${__target_host}:${destination}" fi else From d76d013b3c280d9641697bffe28441a30b14b107 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 10:39:21 +0100 Subject: [PATCH 0989/1024] check env [TODO] Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index f424a81d..14a643ea 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -13,6 +13,8 @@ TESTS - multiple defines of object: - fail if different parameters - succeed if same parameters +- verify that all env variables in doc/man/cdist-reference.text.sh + exist in the right stages USER INTERFACE -------------- From df258cf330cb015ac233a09fda0c863190582942 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 11:10:32 +0100 Subject: [PATCH 0990/1024] +__target_user comment Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 14a643ea..de043a07 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -16,6 +16,8 @@ TESTS - verify that all env variables in doc/man/cdist-reference.text.sh exist in the right stages + __target_user - unneeded? + USER INTERFACE -------------- - add support $__tmp? From 7c8f9e8b9873f5324eff0cbe8d8b00b80136c018 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 14:05:26 +0100 Subject: [PATCH 0991/1024] remove reference to __target_user - has never been used and is not implemented anymore Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 2 -- doc/man/cdist-reference.text.sh | 3 --- 2 files changed, 5 deletions(-) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index de043a07..14a643ea 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -16,8 +16,6 @@ TESTS - verify that all env variables in doc/man/cdist-reference.text.sh exist in the right stages - __target_user - unneeded? - USER INTERFACE -------------- - add support $__tmp? diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 9127096c..0a7b551e 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -188,9 +188,6 @@ __object_name:: __target_host:: The host we are deploying to. Available for: initial manifest, type manifest, type gencode -__target_user:: - User to use for authentication on remote host. - Currently static in core. __type:: Path to the current type. Available for: type manifest, type gencode From 31403722ce240e9a42518639987eaa80b4afdf25 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 18 Nov 2011 14:36:51 +0100 Subject: [PATCH 0992/1024] todo++ Signed-off-by: Steven Armstrong --- doc/dev/todo/TAKEME | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 14a643ea..be76b040 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -15,6 +15,8 @@ TESTS - succeed if same parameters - verify that all env variables in doc/man/cdist-reference.text.sh exist in the right stages +- test DependencyResolver + USER INTERFACE -------------- From 654e19f28bf1d78b84d30bf3b616c4e75c2b258d Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 18 Nov 2011 14:40:25 +0100 Subject: [PATCH 0993/1024] mark _run_command as private Signed-off-by: Steven Armstrong --- conf/type/__file/gencode-local | 2 -- lib/cdist/exec/remote.py | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/conf/type/__file/gencode-local b/conf/type/__file/gencode-local index ae8625b5..0c6c249d 100755 --- a/conf/type/__file/gencode-local +++ b/conf/type/__file/gencode-local @@ -31,8 +31,6 @@ if [ -f "$__object/parameter/source" ]; then remote_cksum="$(cat "$__object/explorer/cksum")" if [ "$local_cksum" != "$remote_cksum" ]; then - # Export target_host so remote_copy script has access to it - echo "export __target_host=\"$__target_host\"" echo "$__remote_copy" "$source" "${__target_host}:${destination}" fi else diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index 433f4cbc..87db7273 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -91,7 +91,7 @@ class Remote(object): self.rmdir(destination) command = self._copy.split() command.extend(["-r", source, self.target_host + ":" + destination]) - self.run_command(command) + self._run_command(command) def run(self, command, env=None, return_output=False): """Run the given command with the given environment on the remote side. @@ -102,9 +102,9 @@ class Remote(object): cmd = self._exec.split() cmd.append(self.target_host) cmd.extend(command) - return self.run_command(cmd, env=env, return_output=return_output) + return self._run_command(cmd, env=env, return_output=return_output) - def run_command(self, command, env=None, return_output=False): + def _run_command(self, command, env=None, return_output=False): """Run the given command with the given environment. Return the output as a string. From 98dec302a603c599a9300f0259166854e96d32d1 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 18 Nov 2011 14:44:32 +0100 Subject: [PATCH 0994/1024] export __target_host for use in __remote_{copy,exec} scripts Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index 41094faa..0b67c747 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -95,6 +95,12 @@ class Local(object): """ assert isinstance(command, (list, tuple)), "list or tuple argument expected, got: %s" % command self.log.debug("Local run: %s", command) + + if env is None: + env = {} + # Export __target_host for use in __remote_{copy,exec} scripts + env['__target_host'] = self.target_host + try: if return_output: return subprocess.check_output(command, env=env).decode() @@ -114,8 +120,13 @@ class Local(object): command.append(script) self.log.debug("Local run script: %s", command) - if env: - self.log.debug("Local run script env: %s", env) + + if env is None: + env = {} + # Export __target_host for use in __remote_{copy,exec} scripts + env['__target_host'] = self.target_host + + self.log.debug("Local run script env: %s", env) try: if return_output: From bf133253039a409479463902cb2c9fb74ceb59e0 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 18 Nov 2011 14:56:59 +0100 Subject: [PATCH 0995/1024] if env is not given, os.environ is used -> need to also do that Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index 0b67c747..613f5cf2 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -97,7 +97,7 @@ class Local(object): self.log.debug("Local run: %s", command) if env is None: - env = {} + env = os.environ.copy() # Export __target_host for use in __remote_{copy,exec} scripts env['__target_host'] = self.target_host @@ -122,7 +122,7 @@ class Local(object): self.log.debug("Local run script: %s", command) if env is None: - env = {} + env = os.environ.copy() # Export __target_host for use in __remote_{copy,exec} scripts env['__target_host'] = self.target_host From be29ce0f2e8453621ab339dc04b477c04695692e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 15:26:10 +0100 Subject: [PATCH 0996/1024] 2.0.4 has autorequire enabled Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index e0841f67..91b21259 100644 --- a/doc/changelog +++ b/doc/changelog @@ -5,6 +5,7 @@ * Cleanup: Environment variable __self DEPRECATED, use __object_name instead * Cleanup: Environment variable __self scheduled for removal in cdist 2.1 * Documentation: Many examples for use of __remote_* (Steven Armstrong) + * Feature: Automatically require all used objects (Steven Armstrong) * New Type: __cron (Steven Armstrong) 2.0.3: 2011-10-18 From 3c823c9192e00fddf908b6505640f32e05775502 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 15:36:31 +0100 Subject: [PATCH 0997/1024] setup release date Signed-off-by: Nico Schottelius --- doc/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index 91b21259..7e17a75c 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,4 +1,4 @@ -2.0.4: +2.0.4: 2011-11-18 * Bugfix core: Remove traceback when sending SIGINT (aka Ctrl-C) * Bugfix core: Accept parameters with - in the name (Steven Armstrong) * Cleanup: __object_fq variable removed (never used) From 092a9aa5b89ad072cdb3f3bbecd7de999f53ef24 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 15:37:53 +0100 Subject: [PATCH 0998/1024] update version in lib/ Signed-off-by: Nico Schottelius --- lib/cdist/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index abdadf62..85892fec 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -34,7 +34,7 @@ BANNER = """ "P' "" "" """ DOT_CDIST = ".cdist" -VERSION = "2.0.3" +VERSION = "2.0.4" import os From 6b0935c2074cd4b4a3f8901735499901de87e381 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 18 Nov 2011 15:43:06 +0100 Subject: [PATCH 0999/1024] /__self/__object_name/ Signed-off-by: Steven Armstrong --- conf/type/__apt_ppa/manifest | 2 +- conf/type/__autofs_map/manifest | 2 +- conf/type/__autofs_master/manifest | 2 +- conf/type/__package/manifest | 2 +- conf/type/__partition_msdos/manifest | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conf/type/__apt_ppa/manifest b/conf/type/__apt_ppa/manifest index 5aa84931..04c66ce0 100755 --- a/conf/type/__apt_ppa/manifest +++ b/conf/type/__apt_ppa/manifest @@ -27,4 +27,4 @@ require="__package/python-software-properties" \ --source "$__type/files/remove-apt-repository" \ --mode 0755 -require="$__self" __apt_update_index +require="$__object_name" __apt_update_index diff --git a/conf/type/__autofs_map/manifest b/conf/type/__autofs_map/manifest index 74672e46..d86ea799 100755 --- a/conf/type/__autofs_map/manifest +++ b/conf/type/__autofs_map/manifest @@ -38,5 +38,5 @@ if [ -f "$__object/parameter/comment" ]; then fi echo "$entry" >> "$__object/parameter/entry" -require="$__self" __autofs_master +require="$__object_name" __autofs_master diff --git a/conf/type/__autofs_master/manifest b/conf/type/__autofs_master/manifest index e37a5d34..e429842e 100755 --- a/conf/type/__autofs_master/manifest +++ b/conf/type/__autofs_master/manifest @@ -24,7 +24,7 @@ if [ ! -f "$__object/parameter/header" ]; then fi [ -d "$__object/files" ] || mkdir "$__object/files" -require="$__self" __file /etc/auto.master --source "$__object/files/auto.master" \ +require="$__object_name" __file /etc/auto.master --source "$__object/files/auto.master" \ --mode 644 \ --owner root \ --group root diff --git a/conf/type/__package/manifest b/conf/type/__package/manifest index b331d32d..765ece36 100755 --- a/conf/type/__package/manifest +++ b/conf/type/__package/manifest @@ -49,4 +49,4 @@ for property in $(ls .); do fi done -require="$__self" __package_$type "$@" +require="$__object_name" __package_$type "$@" diff --git a/conf/type/__partition_msdos/manifest b/conf/type/__partition_msdos/manifest index 0d73c405..21e43856 100755 --- a/conf/type/__partition_msdos/manifest +++ b/conf/type/__partition_msdos/manifest @@ -38,4 +38,4 @@ if [ ! -f "$__object/parameter/size" ]; then fi # pull in the type that actually does something with the above parameters -require="$__self" __partition_msdos_apply +require="$__object_name" __partition_msdos_apply From 32fa32bd52520cfad49d1887066ef5a1f8593df8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 15:45:59 +0100 Subject: [PATCH 1000/1024] improve release script Signed-off-by: Nico Schottelius --- doc/dev/releasechecklist | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/doc/dev/releasechecklist b/doc/dev/releasechecklist index fef1f53b..6bc0a77c 100755 --- a/doc/dev/releasechecklist +++ b/doc/dev/releasechecklist @@ -1,25 +1,32 @@ -#!/bin/sh -e +#!/bin/sh +# Nico Schottelius -files="bin/cdist-config doc/changelog" +files="doc/changelog lib/cdist/__init__.py" # Stuff to take care of when doing a release echo "Preparing next release" # Ensure documentation builds cleanly -./build.sh clean && ./build.sh man +echo "Testing documentation..." +./build clean && ./build man || exit 1 + +echo "Ensure you fixed/prepared version files: $files" +read wait # get version -version=$(awk -F'=' '/^__cdist_version/ { print $2 }' bin/cdist-config | sed 's/"//g') +lib_version=$(grep ^VERSION lib/cdist/__init__.py | sed -e 's/.*= //' -e 's/"//g') +changelog_version=$(head -n1 doc/changelog | sed 's/:.*//') +git_version=$(git describe) + +if [ "$lib_version" != "$changelog_version -o "$changelog_version" != "$git_version" ]; then + echo "Messed up versions, not releasing" + exit 1 +fi +version=$git_version # get target branch branch=${version%.?} -# adjust version and release date -vi $files - -# Commit stuff -git commit $files - # add tag printf "Enter description for %s>" "$version" read tagmessage @@ -31,5 +38,5 @@ git merge master git checkout master # Publish manpages and sourcecode -./build.sh web -./build.sh pub +./build web +./build pub From 6495bc872f27f4ba2b59cceafd12041b6447aa2f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 15:48:36 +0100 Subject: [PATCH 1001/1024] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 2f9bb844..f8c2d6da 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -1,6 +1,10 @@ +- check speech publishing + - and speeches, which may be outdated as well + +- write tutorial + - Fix / rewrite cdist-quickstart -- write tutorial!!!!!!!!! - like ccollect! - include ssh control master! - add local/ hint (and add to git) From ee7f30c052ebb46ab90a3f2ecca4233071942025 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 15:51:18 +0100 Subject: [PATCH 1002/1024] more version support for documentation Signed-off-by: Nico Schottelius --- build | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build b/build index 085bcdf1..e3a6e7f9 100755 --- a/build +++ b/build @@ -102,13 +102,14 @@ case "$1" in rm -rf ${WEBMAN} mkdir -p ${WEBMAN}/man1 ${WEBMAN}/man7 - rm -rf ${WEBDIR}/${WEBBASE}/speeches && mkdir ${WEBDIR}/${WEBBASE}/speeches + # 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 ${WEBDIR}/${WEBBASE}/man/man1 - cp ${MAN7DSTDIR}/*.html ${WEBDIR}/${WEBBASE}/man/man7 - cp ${SPEECHESDIR}/*.pdf ${WEBDIR}/${WEBBASE}/speeches + cp ${MAN1DSTDIR}/*.html ${WEBMAN}/man1 + cp ${MAN7DSTDIR}/*.html ${WEBMAN}/man7 - git describe > ${WEBDIR}/${WEBBASE}/man/VERSION cd ${WEBDIR} && git add ${WEBBASE} cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} cd ${WEBDIR} && make pub From e33000289986cff3e04dce0ad14f189a3ba49664 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 15:58:26 +0100 Subject: [PATCH 1003/1024] more verbose, add git tag during release, check lib and changelog Signed-off-by: Nico Schottelius --- doc/dev/releasechecklist | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/doc/dev/releasechecklist b/doc/dev/releasechecklist index 6bc0a77c..cf7d2df8 100755 --- a/doc/dev/releasechecklist +++ b/doc/dev/releasechecklist @@ -10,33 +10,38 @@ echo "Preparing next release" echo "Testing documentation..." ./build clean && ./build man || exit 1 +# get version +changelog_version=$(head -n1 doc/changelog | sed 's/:.*//') +#git_version=$(git describe) +lib_version=$(grep ^VERSION lib/cdist/__init__.py | sed -e 's/.*= //' -e 's/"//g') + echo "Ensure you fixed/prepared version files: $files" +echo "changelog: $changelog_version" +#echo "git: $git_version" +echo "lib: $lib_version" read wait -# get version -lib_version=$(grep ^VERSION lib/cdist/__init__.py | sed -e 's/.*= //' -e 's/"//g') -changelog_version=$(head -n1 doc/changelog | sed 's/:.*//') -git_version=$(git describe) - -if [ "$lib_version" != "$changelog_version -o "$changelog_version" != "$git_version" ]; then +if [ "$lib_version" != "$changelog_version ]; then echo "Messed up versions, not releasing" exit 1 fi -version=$git_version +version=$lib_version # get target branch branch=${version%.?} # add tag -printf "Enter description for %s>" "$version" +printf "Enter tag description for %s>" "$version" read tagmessage git tag "$version" -m "$tagmessage" # Import into current version branch +echo "git merge into $branch" git checkout $branch git merge master git checkout master # Publish manpages and sourcecode +echo "publising doc/ and code/" ./build web ./build pub From 3605e478e613be1e7e45e619b55a83bdd2ee4234 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 15:59:36 +0100 Subject: [PATCH 1004/1024] -typo Signed-off-by: Nico Schottelius --- doc/dev/releasechecklist | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/dev/releasechecklist b/doc/dev/releasechecklist index cf7d2df8..188ce474 100755 --- a/doc/dev/releasechecklist +++ b/doc/dev/releasechecklist @@ -19,12 +19,13 @@ echo "Ensure you fixed/prepared version files: $files" echo "changelog: $changelog_version" #echo "git: $git_version" echo "lib: $lib_version" -read wait -if [ "$lib_version" != "$changelog_version ]; then +if [ "$lib_version" != "$changelog_version" ]; then echo "Messed up versions, not releasing" exit 1 fi +echo "Press enter to continue" +read wait version=$lib_version # get target branch From 55ec36b562d40cfbb4163fe1d4cfcad0a0d922d7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 16:04:19 +0100 Subject: [PATCH 1005/1024] beautify release script Signed-off-by: Nico Schottelius --- doc/dev/releasechecklist | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/dev/releasechecklist b/doc/dev/releasechecklist index 188ce474..1ef36703 100755 --- a/doc/dev/releasechecklist +++ b/doc/dev/releasechecklist @@ -23,6 +23,8 @@ echo "lib: $lib_version" if [ "$lib_version" != "$changelog_version" ]; then echo "Messed up versions, not releasing" exit 1 +else + echo "Version are sane, continuing" fi echo "Press enter to continue" read wait @@ -32,7 +34,7 @@ version=$lib_version branch=${version%.?} # add tag -printf "Enter tag description for %s>" "$version" +printf "Enter tag description for %s> " "$version" read tagmessage git tag "$version" -m "$tagmessage" From dd588016a0ba5805474dd4fc190775605b96d9c9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Nov 2011 16:11:51 +0100 Subject: [PATCH 1006/1024] plural... Signed-off-by: Nico Schottelius --- doc/dev/releasechecklist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/dev/releasechecklist b/doc/dev/releasechecklist index 1ef36703..55d6221b 100755 --- a/doc/dev/releasechecklist +++ b/doc/dev/releasechecklist @@ -24,7 +24,7 @@ if [ "$lib_version" != "$changelog_version" ]; then echo "Messed up versions, not releasing" exit 1 else - echo "Version are sane, continuing" + echo "Versions are sane, continuing" fi echo "Press enter to continue" read wait From b0e25e8784e2cb528140dc4ffe3d5d070d30721c Mon Sep 17 00:00:00 2001 From: "Christian G. Warden" Date: Wed, 4 Jan 2012 07:58:51 -0800 Subject: [PATCH 1007/1024] fix typo --- conf/explorer/os | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/explorer/os b/conf/explorer/os index e59301e7..1aafb468 100755 --- a/conf/explorer/os +++ b/conf/explorer/os @@ -49,7 +49,7 @@ if grep -q ^Fedora /etc/redhat-release 2>/dev/null; then exit 0 fi -# CentOS is also based on Redhat, this return before redhat! +# CentOS is also based on Redhat, thus return before redhat! if grep -q ^CentOS /etc/redhat-release 2>/dev/null; then echo centos exit 0 From bdafb4ffef39b38721e8c27ff1f1735f6fde396f Mon Sep 17 00:00:00 2001 From: "Christian G. Warden" Date: Wed, 4 Jan 2012 10:08:45 -0800 Subject: [PATCH 1008/1024] A new type for managing luarocks packages The __package_luarocks type manages the installation of Lua modules distribued using LuaRocks. It is based on __package_rubygem. --- .../__package_luarocks/explorer/pkg_status | 31 +++++++++++ conf/type/__package_luarocks/gencode-remote | 52 +++++++++++++++++++ conf/type/__package_luarocks/man.text | 49 +++++++++++++++++ conf/type/__package_luarocks/manifest | 23 ++++++++ .../__package_luarocks/parameter/optional | 1 + .../__package_luarocks/parameter/required | 1 + 6 files changed, 157 insertions(+) create mode 100755 conf/type/__package_luarocks/explorer/pkg_status create mode 100755 conf/type/__package_luarocks/gencode-remote create mode 100644 conf/type/__package_luarocks/man.text create mode 100644 conf/type/__package_luarocks/manifest create mode 100644 conf/type/__package_luarocks/parameter/optional create mode 100644 conf/type/__package_luarocks/parameter/required diff --git a/conf/type/__package_luarocks/explorer/pkg_status b/conf/type/__package_luarocks/explorer/pkg_status new file mode 100755 index 00000000..3eb73298 --- /dev/null +++ b/conf/type/__package_luarocks/explorer/pkg_status @@ -0,0 +1,31 @@ +#!/bin/sh +# +# 2012 SwellPath, Inc. +# Christian G. Warden +# +# 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 . +# +# Retrieve the status of a rock +# + +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name="$__object_id" +fi + +# Accept luarocks failing if package is not known/installed +luarocks list "$name" | egrep -A1 "^$name$" || exit 0 diff --git a/conf/type/__package_luarocks/gencode-remote b/conf/type/__package_luarocks/gencode-remote new file mode 100755 index 00000000..179022b1 --- /dev/null +++ b/conf/type/__package_luarocks/gencode-remote @@ -0,0 +1,52 @@ +#!/bin/sh +# +# 2012 SwellPath, Inc. +# Christian G. Warden +# +# 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 . +# +# +# Manage LuaRocks packages +# + + +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name="$__object_id" +fi + +state="$(cat "$__object/parameter/state")" +is_installed="$(grep "(installed)" "$__object/explorer/pkg_status" || true)" + +case "$state" in + installed) + # Install only if non-existent + if [ -z "$is_installed" ]; then + echo luarocks install \"$name\" + fi + ;; + removed) + # Remove only if existent + if [ -n "$is_installed" ]; then + echo luarocks remove \"$name\" + fi + ;; + *) + echo "Unknown state: $state" >&2 + exit 1 + ;; +esac diff --git a/conf/type/__package_luarocks/man.text b/conf/type/__package_luarocks/man.text new file mode 100644 index 00000000..6c1e6734 --- /dev/null +++ b/conf/type/__package_luarocks/man.text @@ -0,0 +1,49 @@ +cdist-type__package_luarocks(7) +============================== +Christian G. Warden + + +NAME +---- +cdist-type__package_luarocks - Manage luarocks packages + + +DESCRIPTION +----------- +LuaRocks is a deployment and management system for Lua modules. + + +REQUIRED PARAMETERS +------------------- +state:: + Either "installed" or "removed". + + +OPTIONAL PARAMETERS +------------------- +name:: + If supplied, use the name and not the object id as the package name. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Ensure luasocket is installed +__package_luarocks luasocket --state installed + +# Remove package +__package_luarocks luasocket --state removed +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- cdist-type__package(7) + + +COPYING +------- +Copyright \(C) 2012 SwellPath, Inc. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__package_luarocks/manifest b/conf/type/__package_luarocks/manifest new file mode 100644 index 00000000..8e626714 --- /dev/null +++ b/conf/type/__package_luarocks/manifest @@ -0,0 +1,23 @@ +#!/bin/sh +# +# 2012 SwellPath, Inc. +# Christian G. Warden +# +# 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 . +# + +__package luarocks --state installed +__package make --state installed diff --git a/conf/type/__package_luarocks/parameter/optional b/conf/type/__package_luarocks/parameter/optional new file mode 100644 index 00000000..f121bdbf --- /dev/null +++ b/conf/type/__package_luarocks/parameter/optional @@ -0,0 +1 @@ +name diff --git a/conf/type/__package_luarocks/parameter/required b/conf/type/__package_luarocks/parameter/required new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/conf/type/__package_luarocks/parameter/required @@ -0,0 +1 @@ +state From 745cf47e43837478026a141a321d4f3307f2c16b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 4 Jan 2012 20:40:53 +0100 Subject: [PATCH 1009/1024] changes: +type __package_luarocks (thanks Christian) Signed-off-by: Nico Schottelius --- doc/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/changelog b/doc/changelog index 7e17a75c..81d78662 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,3 +1,6 @@ +2.0.5: + * New Type: __package_luarocks (Christian G. Warden) + 2.0.4: 2011-11-18 * Bugfix core: Remove traceback when sending SIGINT (aka Ctrl-C) * Bugfix core: Accept parameters with - in the name (Steven Armstrong) From 6d55d7ae82fde29c943cde649cc8b9c767ceea14 Mon Sep 17 00:00:00 2001 From: "phrawzty (dan)" Date: Thu, 5 Jan 2012 11:08:16 +0100 Subject: [PATCH 1010/1024] --regex to make __addifnosuchline more flexible --- conf/type/__addifnosuchline/explorer/findline | 10 ++++++++-- conf/type/__addifnosuchline/parameter/optional | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/conf/type/__addifnosuchline/explorer/findline b/conf/type/__addifnosuchline/explorer/findline index ac69a827..b45bd6ea 100755 --- a/conf/type/__addifnosuchline/explorer/findline +++ b/conf/type/__addifnosuchline/explorer/findline @@ -26,12 +26,18 @@ else file="/$__object_id" fi -regex=$(cat "$__object/parameter/line") +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" + grep -q "$regex" "$file" if [ $? -eq 1 ]; then echo "NOTFOUND" else diff --git a/conf/type/__addifnosuchline/parameter/optional b/conf/type/__addifnosuchline/parameter/optional index f73f3093..7ecfcde9 100644 --- a/conf/type/__addifnosuchline/parameter/optional +++ b/conf/type/__addifnosuchline/parameter/optional @@ -1 +1,2 @@ file +regex From 7cbc49430188836c706d0cca2970b67c701d86a1 Mon Sep 17 00:00:00 2001 From: "phrawzty (dan)" Date: Thu, 5 Jan 2012 11:13:30 +0100 Subject: [PATCH 1011/1024] Add --regex to manual --- conf/type/__addifnosuchline/man.text | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conf/type/__addifnosuchline/man.text b/conf/type/__addifnosuchline/man.text index 722a3080..3051ff36 100644 --- a/conf/type/__addifnosuchline/man.text +++ b/conf/type/__addifnosuchline/man.text @@ -25,7 +25,9 @@ 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 -------- From 0f768040c2c19209ef5ce3c9bca5185a34aed5b4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 5 Jan 2012 11:59:15 +0100 Subject: [PATCH 1012/1024] document --regexp in changes Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 81d78662..1f192304 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,5 +1,6 @@ 2.0.5: * New Type: __package_luarocks (Christian G. Warden) + * Feature: __addifnosuchline supports matching on regular expressions (dan) 2.0.4: 2011-11-18 * Bugfix core: Remove traceback when sending SIGINT (aka Ctrl-C) From 99099162577dce88429d04bbb2829f20403add4d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 5 Jan 2012 13:41:32 +0100 Subject: [PATCH 1013/1024] add real life template example Signed-off-by: Nico Schottelius --- other/examples/types/__ethz_dinfk_ldap/README | 2 + .../files/nslcd.conf.template | 46 +++++++++++++++++++ .../__ethz_dinfk_ldap/files/nsswitch.conf | 22 +++++++++ .../examples/types/__ethz_dinfk_ldap/manifest | 39 ++++++++++++++++ .../__ethz_dinfk_ldap/parameter/required | 1 + .../types/__ethz_dinfk_ldap/singleton | 0 6 files changed, 110 insertions(+) create mode 100644 other/examples/types/__ethz_dinfk_ldap/README create mode 100755 other/examples/types/__ethz_dinfk_ldap/files/nslcd.conf.template create mode 100644 other/examples/types/__ethz_dinfk_ldap/files/nsswitch.conf create mode 100755 other/examples/types/__ethz_dinfk_ldap/manifest create mode 100644 other/examples/types/__ethz_dinfk_ldap/parameter/required create mode 100644 other/examples/types/__ethz_dinfk_ldap/singleton diff --git a/other/examples/types/__ethz_dinfk_ldap/README b/other/examples/types/__ethz_dinfk_ldap/README new file mode 100644 index 00000000..18c1574b --- /dev/null +++ b/other/examples/types/__ethz_dinfk_ldap/README @@ -0,0 +1,2 @@ +This type is used in production in the ETH and utilises a template to generate +the config file. diff --git a/other/examples/types/__ethz_dinfk_ldap/files/nslcd.conf.template b/other/examples/types/__ethz_dinfk_ldap/files/nslcd.conf.template new file mode 100755 index 00000000..d5b41c24 --- /dev/null +++ b/other/examples/types/__ethz_dinfk_ldap/files/nslcd.conf.template @@ -0,0 +1,46 @@ +#!/bin/sh +cat << DONE +# +# D-INFK SANS MANAGED FILE +# ======================== +# +# Do not change this file. Changes will be overwritten. +# + +# /etc/nslcd.conf +# nslcd configuration file. See nslcd.conf(5) +# for details. + +# The user and group nslcd should run as. +uid nslcd +gid nslcd + +# The location at which the LDAP server(s) should be reachable. +uri ldaps://ldaps01.ethz.ch +uri ldaps://ldaps02.ethz.ch +uri ldaps://ldaps03.ethz.ch + + +# The search base +base ou=${ou},ou=inf,ou=auth,o=ethz,c=ch +base passwd ou=users,ou=${ou},ou=inf,ou=auth,o=ethz,c=ch +base group ou=Group,ou=inf,ou=auth,o=ethz,c=ch +base netgroup ou=netgroup,ou=inf,ou=auth,o=ethz,c=ch + +binddn cn=REPLACE,ou=ME,ou=WITH,ou=YOUR,o=DETAILS,c=ch +bindpw VERYSECRETPASSWORD + +# The LDAP protocol version to use. +#ldap_version 3 + +# The DN to bind with for normal lookups. +#binddn cn=annonymous,dc=example,dc=net +#bindpw secret + +# SSL options +ssl on +tls_reqcert never + +# The search scope. +#scope sub +DONE diff --git a/other/examples/types/__ethz_dinfk_ldap/files/nsswitch.conf b/other/examples/types/__ethz_dinfk_ldap/files/nsswitch.conf new file mode 100644 index 00000000..f4185a86 --- /dev/null +++ b/other/examples/types/__ethz_dinfk_ldap/files/nsswitch.conf @@ -0,0 +1,22 @@ +# +# D-INFK SANS MANAGED FILE +# ======================== +# +# Do not change this file. Changes will be overwritten. +# +# /etc/nsswitch.conf +# + +passwd: files ldap +group: files ldap +shadow: files ldap + +hosts: files dns +networks: files + +services: db files +protocols: db files +rpc: db files +ethers: db files + +netgroup: files ldap diff --git a/other/examples/types/__ethz_dinfk_ldap/manifest b/other/examples/types/__ethz_dinfk_ldap/manifest new file mode 100755 index 00000000..c31d765d --- /dev/null +++ b/other/examples/types/__ethz_dinfk_ldap/manifest @@ -0,0 +1,39 @@ +#!/bin/sh +# +# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Configure nss_ldap for a machine at DINFK. +# + +ou="$(cat "$__object/parameter/ou")" + +ldap_config="/etc/nslcd.conf" +ldap_package="libnss-ldapd" + +# Install required packages +__package "$ldap_package" --state installed + +# Generate nss-ldap config file from template +mkdir "$__object/files" +. "$__type/files/nslcd.conf.template" > "$__object/files/nslcd.conf" +__file "$ldap_config" --source "$__object/files/nslcd.conf" + +# Configure nsswitch to use ldap +require="__package/$ldap_package __file/$ldap_config" \ + __file /etc/nsswitch.conf --source "$__type/files/nsswitch.conf" diff --git a/other/examples/types/__ethz_dinfk_ldap/parameter/required b/other/examples/types/__ethz_dinfk_ldap/parameter/required new file mode 100644 index 00000000..d96c19d8 --- /dev/null +++ b/other/examples/types/__ethz_dinfk_ldap/parameter/required @@ -0,0 +1 @@ +ou diff --git a/other/examples/types/__ethz_dinfk_ldap/singleton b/other/examples/types/__ethz_dinfk_ldap/singleton new file mode 100644 index 00000000..e69de29b From 2df42ebd910158bc772b18e5c8e8bd453f0156ff Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 5 Jan 2012 14:43:35 +0100 Subject: [PATCH 1014/1024] rewrite/rephrase/check quick start section in tutorial Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-tutorial.text | 161 +++++++++++++++++-------------- 1 file changed, 91 insertions(+), 70 deletions(-) diff --git a/doc/man/man7/cdist-tutorial.text b/doc/man/man7/cdist-tutorial.text index 65f3811c..24e665b5 100644 --- a/doc/man/man7/cdist-tutorial.text +++ b/doc/man/man7/cdist-tutorial.text @@ -8,9 +8,100 @@ NAME cdist-tutorial - a guided introduction into cdist +INTRODUCTION +------------ +This tutorial is aimed at people learning cdist and shows +typical approaches as well as gives an easy start into +the world of configuration management. + +This tutorial assumes you are configuring **localhost**, because +it is always available. Just replace **localhost** with your target +host for real life usage. + + + +QUICK START - GET YOUR HANDS DIRTY NOW +-------------------------------------- +For those who just want to configure a system with the +cdist configuration management and do not need (or want) +to understand everything. + +Cdist uses **ssh** for communication and transportation +and usually logs into the **target host** as the +**root** user. So you need to configure the **ssh server** +of the target host to allow root logins: Edit +the file **/etc/ssh/sshd_config** and add one of the following +lines: + +-------------------------------------------------------------------------------- +# Allow login only via public key +PermitRootLogin without-password + +# Allow login via password and public key +PermitRootLogin yes +-------------------------------------------------------------------------------- + +As cdist uses ssh intensively, it is recommended to setup authentication +with public keys: + +-------------------------------------------------------------------------------- +# Generate pubkey pair as a normal user +ssh-keygen + +# Copy pubkey over to target host +ssh-copy-id root@localhost +-------------------------------------------------------------------------------- + +Have a look at ssh-agent(1) and ssh-add(1) on how to cache the password for +your public key. Usually it looks like this: + +-------------------------------------------------------------------------------- +# Start agent and export variables +eval `ssh-agent` + +# Add keys (requires password for every identity file) +ssh-add +-------------------------------------------------------------------------------- + +At this point you should be able to ***ssh root@localhost*** without +re-entering the password. If something failed until here, ensure that +all steps went successfully and you have read and understood the +documentation. + +As soon as you are able to login without passwort to the target host, +we can use cdist to configure it. You can copy and paste the following +code into your shell to get started and configure localhost: + +-------------------------------------------------------------------------------- +# Get cdist +git clone git://git.schottelius.org/cdist + +# Create manifest (maps configuration to host(s) +cd cdist +echo '__file /etc/cdist-configured' > conf/manifest/init + +# Configure localhost in verbose mode +./bin/cdist config -v localhost + +# Find out that cdist created /etc/cdist-configured +ls -l /etc/cdist-configured +-------------------------------------------------------------------------------- + +That's it, you've successfully used cdist to configure your first host! +Continue reading the next sections, to understand what you did and how +to create a more sophisticated configuration. + +The file 'conf/manifest/init' is usually the entry point for cdist, +to find out what to configure on which host. All manifests are +essentially shell scripts. Every manifest can use the types known to +cdist, which are usually underline prefixed (__). + + + PREPARING YOUR MACHINE / SETUP ------------------------------ +Before you actually - ensure sshd is running on the target host: @@ -123,76 +214,6 @@ __debug:: - - -INTRODUCTION ------------- -This tutorial is aimed at people learning cdist and shows -typical approaches as well as gives an easy start into -the world of configuration management. - -This tutorial assumes you are configuring **localhost**, because -it is always available. Just repace **localhost** with your target -host for real life usage. - - - -QUICK START ------------ -For those who just want to configure a system with the -cdist configuration management and do not need (or want) -to understand everything. - -Cdist uses **ssh** for communication and transportation -and usually logs into the **target host** as the -**root** user. So you need to configure the **ssh server** -of the target host to allow root logins: Edit -the file **/etc/ssh/sshd_config** and add one of the following -lines: - --------------------------------------------------------------------------------- -# Allow login only via public key -PermitRootLogin without-password - -# Allow login via password and public key -PermitRootLogin yes --------------------------------------------------------------------------------- - -As cdist uses ssh intensively, it is recommended to setup authentication -with public keys: - --------------------------------------------------------------------------------- -# Generate pubkey pair as a normal user -ssh-keygen - -# Copy pubkey over to target host -ssh-copy-id root@localhost --------------------------------------------------------------------------------- - -As soon as you are able to login without passwort to the target host, -we can use cdist, to configure it. You can copy and paste the following -code into your shell to get started and configure localhost: - --------------------------------------------------------------------------------- -# Get cdist -git clone git://git.schottelius.org/cdist - -# Create manifest (maps configuration to host(s) -cd cdist -echo '__file /etc/cdist-configured' > conf/manifest/init -chmod 0700 conf/manifest/init - -# Configure localhost -./bin/cdist config localhost - -# Find out that cdist created /etc/cdist-configured -ls -l /etc/cdist-configured --------------------------------------------------------------------------------- - -The file 'conf/manifest/init' is usually the entry point for cdist, -to find out what to configure on which host. All manifests are -essentially shell scripts. Every manifest can use the types known to -cdist, which are usually underline prefixed (__). SEE ALSO From 46b23c507b22ce33869de36a7ca5b12af2089446 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 5 Jan 2012 14:44:12 +0100 Subject: [PATCH 1015/1024] tutorial will be included in the next release Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 1f192304..7164e939 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,6 +1,7 @@ 2.0.5: * New Type: __package_luarocks (Christian G. Warden) * Feature: __addifnosuchline supports matching on regular expressions (dan) + * Documentation: (Re)write of the tutorial 2.0.4: 2011-11-18 * Bugfix core: Remove traceback when sending SIGINT (aka Ctrl-C) From f9d6ce349dacd5b2eb54ff038caa620c55a4500b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 5 Jan 2012 17:50:50 +0100 Subject: [PATCH 1016/1024] begin section about the initial manifest Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-tutorial.text | 94 +++++--------------------------- 1 file changed, 15 insertions(+), 79 deletions(-) diff --git a/doc/man/man7/cdist-tutorial.text b/doc/man/man7/cdist-tutorial.text index 24e665b5..91b5fdee 100644 --- a/doc/man/man7/cdist-tutorial.text +++ b/doc/man/man7/cdist-tutorial.text @@ -98,40 +98,20 @@ cdist, which are usually underline prefixed (__). +DEFINE STATE IN THE INITIAL MANIFEST +------------------------------------ +The **initial manifest** is the entry point for cdist to find out, which +**objects** to configure on the selected host. Objects are instances of +**types**, like in object orientated programming. An object is represented +by the type + slash + object name: ***__file/etc/cdist-configured*** is an +object of the type ***__file*** with the name ***etc/cdist-configured***. -PREPARING YOUR MACHINE / SETUP ------------------------------- -Before you actually - -- ensure sshd is running on the target host: - -ssh target_host - -- ensure you can login as root - -ssh root@target host - -- ensure login as root works without keys -(see ssh... manpage) - -cdist will do a lot of requests to the target -host, thus you'll have to enter your password -many times, if you don't do this :-) - -- speedup processing with ControlMaster option of -ssh +Cdist searches for the initial manifest at **conf/manifest/init** and +executes it as a shell script using **/bin/sh -e**. -YOUR FIRST CONFIGURATION ------------------------- -DEFINE STATE IN THE INITAL MANIFEST ------------------------------------ - -The initial manifest is used to map -configurations to a host. - USING SOME BASIC TYPES ---------------------- what is a type, how to use it, @@ -162,58 +142,14 @@ __debug:: +BRANCHES IN HERE? +------------ +TUNING CDIST +------------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- speedup processing with ControlMaster option of +ssh SEE ALSO From 33763b72dd76be9c45acc97321f12c604ac77cc4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 5 Jan 2012 18:13:25 +0100 Subject: [PATCH 1017/1024] more description on the initial manifest Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-tutorial.text | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/doc/man/man7/cdist-tutorial.text b/doc/man/man7/cdist-tutorial.text index 91b5fdee..577d633a 100644 --- a/doc/man/man7/cdist-tutorial.text +++ b/doc/man/man7/cdist-tutorial.text @@ -109,7 +109,35 @@ object of the type ***__file*** with the name ***etc/cdist-configured***. Cdist searches for the initial manifest at **conf/manifest/init** and executes it as a shell script using **/bin/sh -e**. +Within this initial manifest, you define, which objects should be +created on which host. To distinguish between hosts, you can use the +environment variable **__target_host**. Let's have a look at a simple +example: +-------------------------------------------------------------------------------- +__file /etc/cdist-configured + +case "$__target_host" in + localhost) + __directory /home/services/kvm-vm --parents yes + ;; +esac +-------------------------------------------------------------------------------- + +This manifest says: Independent of the host, always create the (empty) file +***/etc/cdist-configured***, but create the directory ***/home/services/kvm-vm***, +including all parent directories, only on the host ***localhost***. + +As you can see, there is no magic involved, the manifest is simple shell code that +utilises cdist types. + + +PARTS BELOW HERE ARE TO-BE-DONE + + +MORE ABOUT TYPES AND OBJECTS +---------------------------- +All available types in cdist can be called like normal executables. USING SOME BASIC TYPES From 5cd0ca6f8e43c1795aabadd39a71a472cec46baf Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 5 Jan 2012 18:13:52 +0100 Subject: [PATCH 1018/1024] big D Signed-off-by: Nico Schottelius --- doc/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index 7164e939..4488c443 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,6 +1,6 @@ 2.0.5: * New Type: __package_luarocks (Christian G. Warden) - * Feature: __addifnosuchline supports matching on regular expressions (dan) + * Feature: __addifnosuchline supports matching on regular expressions (Dan) * Documentation: (Re)write of the tutorial 2.0.4: 2011-11-18 From 196a94f8cfd0fbac37160b99595c04df68390b20 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 5 Jan 2012 18:49:37 +0100 Subject: [PATCH 1019/1024] add full name of author Signed-off-by: Nico Schottelius --- doc/changelog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index 4488c443..211cdcec 100644 --- a/doc/changelog +++ b/doc/changelog @@ -1,6 +1,7 @@ 2.0.5: * New Type: __package_luarocks (Christian G. Warden) - * Feature: __addifnosuchline supports matching on regular expressions (Dan) + * Feature: __addifnosuchline supports matching on + regular expressions (Daniel Maher) * Documentation: (Re)write of the tutorial 2.0.4: 2011-11-18 From e1b2b9e65f1b1fc1ff006bacb86813e198aef5bb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 6 Jan 2012 13:17:16 +0100 Subject: [PATCH 1020/1024] CentOS and XenServer are also supported by cdist Signed-off-by: Nico Schottelius --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index ff1293e8..35a25099 100644 --- a/README +++ b/README @@ -61,12 +61,14 @@ cdist was tested or is know to run on at least * [Archlinux](http://www.archlinux.org/) * [Debian](http://www.debian.org/) + * [CentOS](http://www.centos.org/) * [Fedora](http://fedoraproject.org/) * [Gentoo](http://www.gentoo.org/) * [Mac OS X](http://www.apple.com/macosx/) * [OpenBSD](http://www.openbsd.org) * [Redhat](http://www.redhat.com/) * [Ubuntu](http://www.ubuntu.com/) + * [XenServer](http://www.citrix.com/xenserver/) ## Requirements From 81660b5d644f873d902142a1f18fde37983537c1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 6 Jan 2012 13:17:35 +0100 Subject: [PATCH 1021/1024] explicitly require python 3.2 on source host Signed-off-by: Nico Schottelius --- bin/cdist | 6 ++++++ doc/changelog | 1 + 2 files changed, 7 insertions(+) diff --git a/bin/cdist b/bin/cdist index 4d9cd8a2..06e82cc9 100755 --- a/bin/cdist +++ b/bin/cdist @@ -206,6 +206,12 @@ if __name__ == "__main__": import re import sys + cdistpythonversion = '3.2' + if sys.version < cdistpythonversion: + print('Cdist requires Python >= ' + cdistpythonversion + + ' on the source host.') + sys.exit(1) + # 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'))) diff --git a/doc/changelog b/doc/changelog index 211cdcec..3e1bed97 100644 --- a/doc/changelog +++ b/doc/changelog @@ -3,6 +3,7 @@ * Feature: __addifnosuchline supports matching on regular expressions (Daniel Maher) * Documentation: (Re)write of the tutorial + * Cleanup: Explicitly require Python >= 3.2 (do not fail implicitly) 2.0.4: 2011-11-18 * Bugfix core: Remove traceback when sending SIGINT (aka Ctrl-C) From 1a2ef4fcb0139cfbeefeb7dc708900e618ab9cfe Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 6 Jan 2012 14:39:50 +0100 Subject: [PATCH 1022/1024] python3 support in linux distros Signed-off-by: Nico Schottelius --- doc/dev/logs/2012-01-06.python3-in-distros | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 doc/dev/logs/2012-01-06.python3-in-distros diff --git a/doc/dev/logs/2012-01-06.python3-in-distros b/doc/dev/logs/2012-01-06.python3-in-distros new file mode 100644 index 00000000..8bae04e9 --- /dev/null +++ b/doc/dev/logs/2012-01-06.python3-in-distros @@ -0,0 +1,39 @@ +Any: [supported everywhere [tm]] + Python 3.2.2 (via source) + => solution for distros with python < 3.2 + +Arch: [supported] + python 3.2.2-2 + +CentOS: [no python 3] + Python 2.6.6 + +Debian: [supported in testing] + Package python3 + squeeze (stable) (python): interactive high-level object-oriented language (default python3 version) 3.1.3-12: all + wheezy (testing) (python): interactive high-level object-oriented language (default python3 version) 3.2.2~rc1-2: all + sid (unstable) (python): interactive high-level object-oriented language (default python3 version) 3.2.2~rc1-2: all + +Fedora: [supported since 2011-05-24] + 14: python3-3.1.2-14.fc14 + 15: python3-3.2-1.fc15 + 16: python3-3.2.1-1.fc16 + 17: python3-3.2.2-8.fc17 + +OpenSuse [supported since 2011-11] + 11.4: python3-3.1.3-3.3.x86_64.rpm + 12.1: python3-3.2.1-5.1.3.x86_64.rpm + +Redhat 6: [no python 3] + See Centos 6 + +Slackware: [no python 3] + python-2.6.6-i486-1.txz + +Ubuntu: [>= natty, supported since 2011-04] + Package python3 + lucid (python): An interactive high-level object-oriented language (default python3 version) 3.1.2-0ubuntu1: all + maverick (python): interactive high-level object-oriented language (default python3 version) 3.1.3-3ubuntu5~really3.1.2: all + natty (python): interactive high-level object-oriented language (default python3 version) 3.2-1ubuntu1: all + oneiric (python): interactive high-level object-oriented language (default python3 version) 3.2.2-0ubuntu2: all + precise (python): interactive high-level object-oriented language (default python3 version) 3.2.2-0ubuntu2: all From 9de5f4c35725daa8f6bca26fadabdb8f269a6024 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 6 Jan 2012 14:52:35 +0100 Subject: [PATCH 1023/1024] +bsds +gentoo Signed-off-by: Nico Schottelius --- doc/dev/logs/2012-01-06.python3-in-distros | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/dev/logs/2012-01-06.python3-in-distros b/doc/dev/logs/2012-01-06.python3-in-distros index 8bae04e9..81f7b844 100644 --- a/doc/dev/logs/2012-01-06.python3-in-distros +++ b/doc/dev/logs/2012-01-06.python3-in-distros @@ -20,6 +20,18 @@ Fedora: [supported since 2011-05-24] 16: python3-3.2.1-1.fc16 17: python3-3.2.2-8.fc17 +FreeBSD: + python32 - 3.2.2 + +Gentoo: + python 3.2.2 + +NetBSD: + python 3.1.4 + +OpenBSD: + python 3.2? (empty ports dir) + OpenSuse [supported since 2011-11] 11.4: python3-3.1.3-3.3.x86_64.rpm 12.1: python3-3.2.1-5.1.3.x86_64.rpm From dbf0767c4e0631364d4de909e3eb630c095a27f2 Mon Sep 17 00:00:00 2001 From: "phrawzty (dan)" Date: Fri, 6 Jan 2012 16:58:58 +0100 Subject: [PATCH 1024/1024] Add type __cdistmarker. --- conf/type/__cdistmarker/gencode-remote | 37 +++++++++++++++ conf/type/__cdistmarker/man.text | 55 ++++++++++++++++++++++ conf/type/__cdistmarker/parameter/optional | 2 + conf/type/__cdistmarker/singleton | 0 4 files changed, 94 insertions(+) create mode 100755 conf/type/__cdistmarker/gencode-remote create mode 100644 conf/type/__cdistmarker/man.text create mode 100644 conf/type/__cdistmarker/parameter/optional create mode 100644 conf/type/__cdistmarker/singleton diff --git a/conf/type/__cdistmarker/gencode-remote b/conf/type/__cdistmarker/gencode-remote new file mode 100755 index 00000000..e332df38 --- /dev/null +++ b/conf/type/__cdistmarker/gencode-remote @@ -0,0 +1,37 @@ +#!/bin/sh +# +# Copyright (C) 2011 Daniel Maher (phrawzty+cdist at gmail.com) +# +# This file is part of cdist (https://github.com/telmich/cdist/). +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +# The marker file is established in the docs, but it isn't obligatory. +if [ -f "$__object/parameter/destination" ]; then + destination="$(cat "$__object/parameter/destination")" +else + destination='/etc/cdist-configured' +fi + +# The basic output of date is usually good enough, but variety is the +# spice of life... +if [ -f "$__object/parameter/format" ]; then + format="$(cat "$__object/parameter/format")" +else + format='-u' +fi + +# Dump the timestamp in UTC to the marker +echo "date $format > $destination" diff --git a/conf/type/__cdistmarker/man.text b/conf/type/__cdistmarker/man.text new file mode 100644 index 00000000..360598d8 --- /dev/null +++ b/conf/type/__cdistmarker/man.text @@ -0,0 +1,55 @@ +cdist-type__cdistmarker(7) +========================== +Daniel Maher + + +NAME +---- +cdist-type__cdistmarker - Add a timestamped cdist marker. + + +DESCRIPTION +----------- +This type is used to add a common marker file which indicates that a given +machine is being managed by cdist. The contents of this file consist of a +timestamp, which can be used to determine the most recent time at which cdist +was run against the machine in question. + + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +destination:: + The path and filename of the marker. + Default: /etc/cdist-configured + +format:: + The format of the timestamp. This is passed directly to system 'date'. + Default: -u + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Creates the marker as normal. +__cdistmarker + +# Creates the marker differently. +__cdistmarker --file /tmp/cdist_marker --format '+%s' +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2011 Daniel Maher. Free use of this software is granted under +the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__cdistmarker/parameter/optional b/conf/type/__cdistmarker/parameter/optional new file mode 100644 index 00000000..c8e637c0 --- /dev/null +++ b/conf/type/__cdistmarker/parameter/optional @@ -0,0 +1,2 @@ +destination +format diff --git a/conf/type/__cdistmarker/singleton b/conf/type/__cdistmarker/singleton new file mode 100644 index 00000000..e69de29b