From d5b015b268280470602d70dd8814a7ae4bc5a26b Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Fri, 17 Feb 2012 14:13:55 -0500 Subject: [PATCH 001/412] Initial commit. Placeholder files. --- conf/type/__jail/gencode-remote | 0 conf/type/__jail/man.text | 0 conf/type/__jail/parameter/optional | 0 conf/type/__jail/parameter/required | 0 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 conf/type/__jail/gencode-remote create mode 100644 conf/type/__jail/man.text create mode 100644 conf/type/__jail/parameter/optional create mode 100644 conf/type/__jail/parameter/required diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote new file mode 100644 index 00000000..e69de29b diff --git a/conf/type/__jail/man.text b/conf/type/__jail/man.text new file mode 100644 index 00000000..e69de29b diff --git a/conf/type/__jail/parameter/optional b/conf/type/__jail/parameter/optional new file mode 100644 index 00000000..e69de29b diff --git a/conf/type/__jail/parameter/required b/conf/type/__jail/parameter/required new file mode 100644 index 00000000..e69de29b From d082815c811ba53cb096198d1199f5c35e11f269 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Sun, 19 Feb 2012 14:09:36 -0500 Subject: [PATCH 002/412] Created explorers, man page, jailbase placeholder. Began initial development of gencode-remote. --- conf/type/__jail/explorer/present | 27 +++++++++++++++ conf/type/__jail/explorer/status | 28 +++++++++++++++ conf/type/__jail/files/jailbase | 1 + conf/type/__jail/gencode-remote | 44 +++++++++++++++++++++++ conf/type/__jail/man.text | 54 +++++++++++++++++++++++++++++ conf/type/__jail/manifest | 31 +++++++++++++++++ conf/type/__jail/parameter/optional | 1 + conf/type/__jail/parameter/required | 1 + 8 files changed, 187 insertions(+) create mode 100755 conf/type/__jail/explorer/present create mode 100755 conf/type/__jail/explorer/status create mode 100644 conf/type/__jail/files/jailbase mode change 100644 => 100755 conf/type/__jail/gencode-remote create mode 100755 conf/type/__jail/manifest diff --git a/conf/type/__jail/explorer/present b/conf/type/__jail/explorer/present new file mode 100755 index 00000000..c559cf65 --- /dev/null +++ b/conf/type/__jail/explorer/present @@ -0,0 +1,27 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# See if the requested jail exists +# + +name=$__object_id + +[ -d "/usr/jail/$name" ] && echo "EXISTS" + diff --git a/conf/type/__jail/explorer/status b/conf/type/__jail/explorer/status new file mode 100755 index 00000000..19b57672 --- /dev/null +++ b/conf/type/__jail/explorer/status @@ -0,0 +1,28 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# See if the requested jail is started +# + +name=$__object_id + +jls_output=$(jls | grep "[ ]\/usr\/jail\/$name\$") +[ -n "$jls_output" ] && echo "STARTED" + diff --git a/conf/type/__jail/files/jailbase b/conf/type/__jail/files/jailbase new file mode 100644 index 00000000..defb739a --- /dev/null +++ b/conf/type/__jail/files/jailbase @@ -0,0 +1 @@ +Create a tarball jailbase.tgz in this directory containing the base filesystem for a jail. diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote old mode 100644 new mode 100755 index e69de29b..264ce111 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -0,0 +1,44 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# The __jail type creates, configures, and deletes FreeBSD jails for use as +# virtual machines. +# + +jaildir="/usr/jail" +present="$(cat "$__object/explorer/present")" +status="$(cat "$__object/explorer/status")" +state="$(cat "$__object/parameter/state")" +name="$__object_id" + +if [ -f "$__object/parameter/started" ]; then + started="$(cat "$__object/parameter/started")" +fi + +# + +if [ "$present" = "EXISTS" ]; then +# blah +fi + +if [ "$status" = "STARTED" ]; then +# blah +fi + diff --git a/conf/type/__jail/man.text b/conf/type/__jail/man.text index e69de29b..b2e49468 100644 --- a/conf/type/__jail/man.text +++ b/conf/type/__jail/man.text @@ -0,0 +1,54 @@ +cdist-type__jail(7) +========================== +Jake Guffey + + +NAME +---- +cdist-type__jail - Manage FreeBSD jails + + +DESCRIPTION +----------- +This type is used on FreeBSD to manage jails. + + +REQUIRED PARAMETERS +------------------- +state:: + Either "present" or "absent." + + +OPTIONAL PARAMETERS +------------------- +started:: + Either "true" or "false." + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Create a jail called www +__jail www --state present + +# Remove the jail called www +__jail www --state absent + +# Ensure that the jail called www is started +__jail www --state present --started true + +# Use the name variable explicitly +__jail thisjail --state present --name www +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2012 Jake Guffey. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__jail/manifest b/conf/type/__jail/manifest new file mode 100755 index 00000000..81fcd65b --- /dev/null +++ b/conf/type/__jail/manifest @@ -0,0 +1,31 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# The __jail type creates, configures, and deletes FreeBSD jails for use as +# virtual machines. +# + +#FIXME: /usr/jail should never be hardcoded in this type +#FIXME: jailbase.tgz should not be hardcoded in this file + +jailbase="/usr/jail/jailbase.tgz" + +__rsyncer "$jailbase" --source "$__object/files/jailbase.tgz" + diff --git a/conf/type/__jail/parameter/optional b/conf/type/__jail/parameter/optional index e69de29b..c06c82c7 100644 --- a/conf/type/__jail/parameter/optional +++ b/conf/type/__jail/parameter/optional @@ -0,0 +1 @@ +started diff --git a/conf/type/__jail/parameter/required b/conf/type/__jail/parameter/required index e69de29b..ff72b5c7 100644 --- a/conf/type/__jail/parameter/required +++ b/conf/type/__jail/parameter/required @@ -0,0 +1 @@ +state From 2e4e291449af87d1aafaed9e604766ff28e35aa0 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Mon, 20 Feb 2012 14:20:55 -0500 Subject: [PATCH 003/412] Added gencode-local to sync jailbase with remote side, added .gitignore to keep from syncing jailbase.tgz with github, new explorer basepresent to look for /usr/jail/{base,jailbase.tgz} --- conf/type/__jail/.gitignore | 1 + conf/type/__jail/explorer/basepresent | 42 +++++++++++++++++++++++++++ conf/type/__jail/gencode-local | 34 ++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 conf/type/__jail/.gitignore create mode 100755 conf/type/__jail/explorer/basepresent create mode 100755 conf/type/__jail/gencode-local diff --git a/conf/type/__jail/.gitignore b/conf/type/__jail/.gitignore new file mode 100644 index 00000000..e0471be4 --- /dev/null +++ b/conf/type/__jail/.gitignore @@ -0,0 +1 @@ +files/jailbase.tgz diff --git a/conf/type/__jail/explorer/basepresent b/conf/type/__jail/explorer/basepresent new file mode 100755 index 00000000..7c21fc08 --- /dev/null +++ b/conf/type/__jail/explorer/basepresent @@ -0,0 +1,42 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# See if the jailbase.tgz or /usr/jail/base dir exists +# + +name="base:jailbase.tgz" +exists=0 + +save_IFS="$IFS" +IFS=":" +for cur in $name; do + if [ -e "/usr/jail/$cur" ]; then + echo -n "$cur:" + let exists="$exists+1" 2>&1 >&- + fi +done +IFS="$save_IFS" + +if [ "$exists" -eq "0" ]; then + echo "NONE" +else + echo "$exists" +fi + diff --git a/conf/type/__jail/gencode-local b/conf/type/__jail/gencode-local new file mode 100755 index 00000000..6ad476e6 --- /dev/null +++ b/conf/type/__jail/gencode-local @@ -0,0 +1,34 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# The __jail type creates, configures, and deletes FreeBSD jails for use as +# virtual machines. +# + +#FIXME: /usr/jail should never be hardcoded in this type +#FIXME: jailbase.tgz should not be hardcoded in this file + +jailbase="/usr/jail/jailbase.tgz" +basepresent="$(cat "$__object/explorer/basepresent")" + +if [ "$basepresent" = "NONE" ]; then + __file "$jailbase" --source "$__object/files/jailbase.tgz" +fi + From b9c757b78a095fb344c2043cea843333f2447fe8 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Tue, 21 Feb 2012 15:59:19 -0500 Subject: [PATCH 004/412] Filled out man page, created gencode-local to copy jailbase to __target_host, filled out parameter list, made explorers useful, created basic layout within gencode-remote. --- conf/type/__jail/explorer/present | 6 +- conf/type/__jail/explorer/status | 6 +- conf/type/__jail/gencode-local | 2 +- conf/type/__jail/gencode-remote | 118 +++++++++++++++++++++++++--- conf/type/__jail/man.text | 52 ++++++++++-- conf/type/__jail/manifest | 31 -------- conf/type/__jail/parameter/optional | 7 ++ 7 files changed, 173 insertions(+), 49 deletions(-) delete mode 100755 conf/type/__jail/manifest diff --git a/conf/type/__jail/explorer/present b/conf/type/__jail/explorer/present index c559cf65..9338fd56 100755 --- a/conf/type/__jail/explorer/present +++ b/conf/type/__jail/explorer/present @@ -21,7 +21,11 @@ # See if the requested jail exists # -name=$__object_id +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name=$__object_id +fi [ -d "/usr/jail/$name" ] && echo "EXISTS" diff --git a/conf/type/__jail/explorer/status b/conf/type/__jail/explorer/status index 19b57672..3fe22adc 100755 --- a/conf/type/__jail/explorer/status +++ b/conf/type/__jail/explorer/status @@ -21,7 +21,11 @@ # See if the requested jail is started # -name=$__object_id +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name=$__object_id +fi jls_output=$(jls | grep "[ ]\/usr\/jail\/$name\$") [ -n "$jls_output" ] && echo "STARTED" diff --git a/conf/type/__jail/gencode-local b/conf/type/__jail/gencode-local index 6ad476e6..2d4415e3 100755 --- a/conf/type/__jail/gencode-local +++ b/conf/type/__jail/gencode-local @@ -29,6 +29,6 @@ jailbase="/usr/jail/jailbase.tgz" basepresent="$(cat "$__object/explorer/basepresent")" if [ "$basepresent" = "NONE" ]; then - __file "$jailbase" --source "$__object/files/jailbase.tgz" + echo "$__remote_copy" "$__object/files/jailbase.tgz" "${target_host}:${jailbase}" fi diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 264ce111..038daa14 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -22,23 +22,121 @@ # virtual machines. # +# Debug +#exec >&2 +#set -x + +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name="$__object_id" +fi + +state="$(cat "$__object/parameter/state")" + +if [ -f "$__object/parameter/started" ]; then + started="$(cat "$__object/parameter/started")" +else + started="true" +fi + +if [ -f "$__object/parameter/ip" ]; then + ip="$(cat "$__object/parameter/ip")" +else +# IP is an optional param when $state=absent, but +# when $state=present, it's required. Enforce this. + if [ "$state" = "present" ]; then + exec >&2 + echo "If --state is 'present,' --ip must be given\!" + exit 1 + fi +fi + +if [ -f "$__object/parameter/hostname" ]; then + hostname="$(cat "$__object/parameter/hostname")" +else + hostname="$name" +fi + +if [ -f "$__object/parameter/interface" ]; then + interface="$(cat "$__object/parameter/interface")" +fi + +if [ -f "$__object/parameter/devfs-enable" ]; then + devfsenable="$(cat "$__object/parameter/devfs-enable")" +else + devfsenable="true" +fi + +if [ -f "$__object/parameter/devfs-ruleset" ]; then + devfsruleset="$(cat "$__object/parameter/devfs-ruleset")" +else + devfsruleset="jailrules" +fi + +# devfs_ruleset being defined without devfs_enable being true +# is pointless. Treat this as an error. +if [ -n "$devfsrules" -a "$devfsenable" = "false" ]; then + exec >&2 + echo "Can't have --devfs-ruleset defined without --devfs-enable true." + exit 1 +fi + +if [ -f "$__object/parameter/onboot" ]; then + onboot="$(cat "$__object/parameter/onboot")" +fi + jaildir="/usr/jail" present="$(cat "$__object/explorer/present")" status="$(cat "$__object/explorer/status")" -state="$(cat "$__object/parameter/state")" -name="$__object_id" -if [ -f "$__object/parameter/started" ]; then - started="$(cat "$__object/parameter/started")" +# Defining a jail as absent and started at the same time +# makes no sense. Treat this as an error. +if [ "$started" = "true" -a "$state" = "absent" ]; then + exec >&2 + echo "Can't have --state absent and --started true together\!" + exit 1 fi -# +stopJail() { +# Check $status before issuing command + [ "$status" = "STARTED" ] && echo "/etc/rc.d/jail stop ${name}" +} -if [ "$present" = "EXISTS" ]; then -# blah +startJail() { +# Check $status before issuing command + [ ! "$status" = "STARTED" ] && echo "/etc/rc.d/jail start ${name}" +} + +deleteJail() { +} + +createJail() { +} + +if [ "$present" = "EXISTS" ]; then # The jail currently exists + if [ "$state" = "present" ]; then # The jail is supposed to exist + if [ "$started" = "true" ]; then # The jail is supposed to be started + startJail + else # The jail is not supposed to be started + stopJail + fi + exit 0 + else # The jail is not supposed to exist + stopJail + deleteJail + exit 0 + fi +else # The jail does not currently exist + if [ "$state" = "absent" ]; then # The jail is not supposed to be present + exit 0 + else # The jail is supposed to exist + createJail + [ "$started" = "true" ] && startJail + exit 0 + fi fi -if [ "$status" = "STARTED" ]; then -# blah -fi +# Debug +#set +x diff --git a/conf/type/__jail/man.text b/conf/type/__jail/man.text index b2e49468..e6256975 100644 --- a/conf/type/__jail/man.text +++ b/conf/type/__jail/man.text @@ -21,25 +21,67 @@ state:: OPTIONAL PARAMETERS ------------------- -started:: - Either "true" or "false." +name:: + The name of the jail. Default is to use the object_id as the jail name. +started:: + Either "true" or "false." Defaults to true. + +ip:: + The ifconfig style IP/netmask combination to use for the jail guest. If + the state parameter is "present," this parameter is required. + +hostname:: + The FQDN to use for the jail guest. Defaults to the name parameter. + +interface:: + The name of the physical interface on the jail server to bind the jail to. + +devfs-enable:: + Whether to allow devfs mounting within the jail. Must be "true" or "false." + Defaults to true. + +devfs-ruleset:: + The name of the devfs ruleset to associate with the jail. Defaults to + "jailrules." This ruleset must be copied to the server via another type. + To use this option, devfs-enable must be "true." + +onboot:: + Whether to add the jail to rc.conf's jail_list variable. Must be either + "true" or "false." Defaults to false. + + +CAVEATS +------- +This type does not currently support modification of jail options. If, for +example a jail needs to have its IP address or netmask changed, the jail must +be removed then re-added with the correct IP address/netmask or the appropriate +line (jail__ip="...") modified within rc.conf through some alternate +means. EXAMPLES -------- -------------------------------------------------------------------------------- # Create a jail called www -__jail www --state present +__jail www --state present --ip "192.168.1.2 netmask 255.255.255.0" # Remove the jail called www __jail www --state absent # Ensure that the jail called www is started -__jail www --state present --started true +__jail www --state present --started true \ + --ip "192.168.1.2 netmask 255.255.255.0" # Use the name variable explicitly -__jail thisjail --state present --name www +__jail thisjail --state present --name www \ + --ip "192.168.1.2 netmask 255.255.255.0" + +# Go nuts +__jail lotsofoptions --state present --name testjail --started true \ + --ip "192.168.1.100 netmask 255.255.255.0" \ + --hostname "testjail.example.com" --interface "em0" \ + --onboot yes -------------------------------------------------------------------------------- diff --git a/conf/type/__jail/manifest b/conf/type/__jail/manifest deleted file mode 100755 index 81fcd65b..00000000 --- a/conf/type/__jail/manifest +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# 2012 Jake Guffey (jake.guffey at eprotex.com) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# -# The __jail type creates, configures, and deletes FreeBSD jails for use as -# virtual machines. -# - -#FIXME: /usr/jail should never be hardcoded in this type -#FIXME: jailbase.tgz should not be hardcoded in this file - -jailbase="/usr/jail/jailbase.tgz" - -__rsyncer "$jailbase" --source "$__object/files/jailbase.tgz" - diff --git a/conf/type/__jail/parameter/optional b/conf/type/__jail/parameter/optional index c06c82c7..85b94270 100644 --- a/conf/type/__jail/parameter/optional +++ b/conf/type/__jail/parameter/optional @@ -1 +1,8 @@ +name started +ip +hostname +interface +devfs-enable +devfs-ruleset +onboot From 18c0e947aa6cf57f0dbe01e61b860298b20fcb17 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Tue, 21 Feb 2012 18:34:21 -0500 Subject: [PATCH 005/412] Created initial createJail function. Script still can't delete jails yet. --- conf/type/__jail/gencode-remote | 95 ++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 038daa14..5e1bdc02 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -76,7 +76,7 @@ fi # devfs_ruleset being defined without devfs_enable being true # is pointless. Treat this as an error. -if [ -n "$devfsrules" -a "$devfsenable" = "false" ]; then +if [ -n "$devfsruleset" -a "$devfsenable" = "false" ]; then exec >&2 echo "Can't have --devfs-ruleset defined without --devfs-enable true." exit 1 @@ -109,9 +109,102 @@ startJail() { } deleteJail() { +# If the jail's mountpoints are mounted, unmount them +# Remove the jail's rw mountpoints +# Remove the jail's ro mountpoint +# Remove the jail directory +# If the jail's devfs rules are custom (!="jailrules"), remove them +# Remove jail_$name_* lines from rc.conf +# Remove " $name " from jail_list if it's there } createJail() { +# Create the jail directory +echo <<-EOF + mkdir -p ${jaildir}/${name} + if [ ! -d "${jaildir}/base" ]; then + mkdir "${jaildir}/base" + tar -xzf "${jaildir}/jailbase.tgz" -C "${jaildir}/base" + if [ ! -d "${jaildir}/base/usr/local" ]; then + mkdir -p "${jaildir}/base/usr/local" + fi + if [ ! -d "${jaildir}/base/usr/home" ]; then + mkdir -p "${jaildir}/base/usr/home" + fi + fi + if [ ! -d "${jaildir}/rw" ]; then + mkdir "${jaildir}/rw" + fi + mkdir -p "${jaildir}/rw/${name}/etc" + cp -r ${jaildir}/base/etc/* "${jaildir}/rw/${name}/etc/" + mkdir "${jaildir}/rw/${name}/local" + mkdir "${jaildir}/rw/${name}/db" + if [ -d "${jaildir}/base/var/db" ]; then + cp -r ${jaildir}/base/var/db/* "${jaildir}/rw/${name}/db/" + fi + mkdir "${jaildir}/rw/${name}/home" + if [ -d "${jaildir}/base/usr/home" ]; then + cp -r ${jaildir}/base/usr/home/* "${jaildir}/rw/${name}/home/" + fi + mkdir "${jaildir}/rw/${name}/tmp" +EOF + +# Create the ro+rw mountpoint entries in fstab +echo <<-EOF + echo >/etc/fstab.${name} <<-END + /usr/jail/base /usr/jail/${name} nullfs ro 0 0 + /usr/jail/rw/${name}/etc /usr/jail/${name}/etc nullfs rw 0 0 + /usr/jail/rw/${name}/local /usr/jail/${name}/usr/local nullfs rw 0 0 + /usr/jail/rw/${name}/db /usr/jail/${name}/var/db nullfs rw 0 0 + /usr/jail/rw/${name}/home /usr/jail/${name}/usr/home nullfs rw 0 0 + /usr/jail/rw/${name}/tmp /usr/jail/${name}/var/tmp nullfs rw 0 0 + END +EOF + +# Add the jail_$name_* lines to rc.conf +echo <<-EOF + echo >>/etc/rc.conf <<-END + jail_${name}_rootdir="${jaildir}/${name}" + jail_${name}_hostname="${hostname}" + jail_${name}_ip="${ip}" + jail_${name}_devfs_enable="${devfsenable}" + jail_${name}_mount_enable="YES" + jail_${name}_fstab="/etc/fstab.$name" + END +EOF + +if [ -n "$interface" ]; then + echo <<-EOF + echo >>/etc/rc.conf <<-END + jail_${name}_interface="${interface}" + END +EOF +fi + +if [ "$devfsenable" = "true" ]; then + echo <<-EOF + echo >>/etc/rc.conf <<-END + jail_${name}_devfs_ruleset="$devfsruleset" + END +EOF +fi + +# Add $name to jail_list if $onboot=true +if [ "$onboot" = "true" ]; then + echo <<-EOF + eval $(grep '^jail_list=' /etc/rc.conf) + jail_list="${jail_list} ${name}" + sed -i "s/^jail_list=\".*\"/jail_list=\"${jail_list}\"/" /etc/rc.conf + unset jail_list +EOF +fi + +# Add the normal entries into the jail's rc.conf +echo "echo hostname=\"${hostname}\"" >>"${jaildir}/rw/${name}/etc/rc.conf" +echo 'echo sendmail_enable=\"NONE\"' >>"${jaildir}/rw/${name}/etc/rc.conf" +echo 'echo syslogd_enable=\"YES\"' >>"${jaildir}/rw/${name}/etc/rc.conf" +echo 'echo syslogd_flags=\"-ss\"' >>"${jaildir}/rw/${name}/etc/rc.conf" + } if [ "$present" = "EXISTS" ]; then # The jail currently exists From 446f497c4c911929ecb6a54d531bb06a82142926 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 22 Feb 2012 12:13:20 -0500 Subject: [PATCH 006/412] Created deleteJail function. Ready to begin debugging. --- conf/type/__jail/gencode-remote | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 5e1bdc02..37aa8d56 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -109,13 +109,31 @@ startJail() { } deleteJail() { -# If the jail's mountpoints are mounted, unmount them # Remove the jail's rw mountpoints -# Remove the jail's ro mountpoint + echo "rm -rf /usr/jail/rw/${name}" +# Remove the jail's fstab + echo "rm -f /etc/fstab.${name}" # Remove the jail directory -# If the jail's devfs rules are custom (!="jailrules"), remove them + echo "rm -rf /usr/jail/${name}" # Remove jail_$name_* lines from rc.conf + echo <<-EOF + sed -i '.bak' "/^jail_${name}_/d" /etc/rc.conf +EOF # Remove " $name " from jail_list if it's there + echo <<-EOF + eval $(grep '^jail_list=' /etc/rc.conf) + + for JAIL in ${jail_list}; do + if [ ! "${JAIL}" = "${name}" ]; then + new_list="${new_list} ${JAIL}" + fi + done + jail_list="${new_list}" + + sed -i '.bak' "s/^jail_list=\".*\"/jail_list=\"${jail_list}\"/" /etc/rc.conf + unset jail_list + rm -f /etc/rc.conf.bak +EOF } createJail() { @@ -194,8 +212,9 @@ if [ "$onboot" = "true" ]; then echo <<-EOF eval $(grep '^jail_list=' /etc/rc.conf) jail_list="${jail_list} ${name}" - sed -i "s/^jail_list=\".*\"/jail_list=\"${jail_list}\"/" /etc/rc.conf + sed -i '.bak' "s/^jail_list=\".*\"/jail_list=\"${jail_list}\"/" /etc/rc.conf unset jail_list + rm -f /etc/rc.conf.bak EOF fi From 3ebda62f04342ea362d05d88c13500d4a3f6f040 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 22 Feb 2012 12:41:45 -0500 Subject: [PATCH 007/412] bugfix -- needed to pass '-r' to ${add_cmd} to retreive package from remote repository. --- conf/type/__package_pkg_freebsd/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__package_pkg_freebsd/gencode-remote b/conf/type/__package_pkg_freebsd/gencode-remote index fa962970..ef6632c0 100755 --- a/conf/type/__package_pkg_freebsd/gencode-remote +++ b/conf/type/__package_pkg_freebsd/gencode-remote @@ -107,7 +107,7 @@ if [ -n "$curr_version" ]; then # PKG *is* installed assert "! ${version} = ${curr_version}" $LINENO cmd="${rm_cmd} ${name}-${curr_version}" execcmd "remove" "${cmd}" - cmd="${add_cmd} ${name}-${version}" + cmd="${add_cmd} -r ${name}-${version}" execcmd "add" "${cmd}" fi else # Don't care what version to use From 0515fd84831f76d31a7689e38931d4d76b55deae Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Thu, 23 Feb 2012 17:17:30 -0500 Subject: [PATCH 008/412] Various bugfixes. Needed to use '|| true' on subshell variable assignments in case of empty return Added default status (started=true or false) Added default devfs rules Replaced <<- HEREDOC usage with << Added escapes where necessary within quoted strings or HEREDOCs --- conf/type/__jail/explorer/basepresent | 16 ++- conf/type/__jail/explorer/present | 8 +- conf/type/__jail/explorer/status | 18 ++- conf/type/__jail/gencode-remote | 153 +++++++++++++++++--------- 4 files changed, 132 insertions(+), 63 deletions(-) diff --git a/conf/type/__jail/explorer/basepresent b/conf/type/__jail/explorer/basepresent index 7c21fc08..aa155b03 100755 --- a/conf/type/__jail/explorer/basepresent +++ b/conf/type/__jail/explorer/basepresent @@ -21,22 +21,28 @@ # See if the jailbase.tgz or /usr/jail/base dir exists # +# Debug +#exec >&2 +#set -x + name="base:jailbase.tgz" -exists=0 +out="" save_IFS="$IFS" IFS=":" for cur in $name; do if [ -e "/usr/jail/$cur" ]; then - echo -n "$cur:" - let exists="$exists+1" 2>&1 >&- + out="${out}:${cur}" fi done IFS="$save_IFS" -if [ "$exists" -eq "0" ]; then +if [ -z "$out" ]; then echo "NONE" else - echo "$exists" + echo "${out}" fi +# Debug +#set +x + diff --git a/conf/type/__jail/explorer/present b/conf/type/__jail/explorer/present index 9338fd56..a1f44302 100755 --- a/conf/type/__jail/explorer/present +++ b/conf/type/__jail/explorer/present @@ -21,11 +21,17 @@ # See if the requested jail exists # +# Debug +#exec >&2 +#set -x + if [ -f "$__object/parameter/name" ]; then name="$(cat "$__object/parameter/name")" else name=$__object_id fi -[ -d "/usr/jail/$name" ] && echo "EXISTS" +[ -d "/usr/jail/$name" ] && echo "EXISTS" || echo "NOTEXIST" + +#set +x diff --git a/conf/type/__jail/explorer/status b/conf/type/__jail/explorer/status index 3fe22adc..5f95f406 100755 --- a/conf/type/__jail/explorer/status +++ b/conf/type/__jail/explorer/status @@ -21,12 +21,24 @@ # See if the requested jail is started # +# Debug +#exec >&2 +#set -x + if [ -f "$__object/parameter/name" ]; then name="$(cat "$__object/parameter/name")" else - name=$__object_id + name="$__object_id" fi -jls_output=$(jls | grep "[ ]\/usr\/jail\/$name\$") -[ -n "$jls_output" ] && echo "STARTED" +jls_output="$(jls | grep "[ ^I]\/usr\/jail\/${name}\$")" || true + +if [ -n "${jls_output}" ]; then + echo "STARTED" +else + echo "NOTSTART" +fi + +# Debug +#set +x diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 37aa8d56..3dfec9ad 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -37,7 +37,11 @@ state="$(cat "$__object/parameter/state")" if [ -f "$__object/parameter/started" ]; then started="$(cat "$__object/parameter/started")" else - started="true" + if [ ! "$state" = "present" ]; then + started="false" + else + started="true" + fi fi if [ -f "$__object/parameter/ip" ]; then @@ -100,45 +104,71 @@ fi stopJail() { # Check $status before issuing command - [ "$status" = "STARTED" ] && echo "/etc/rc.d/jail stop ${name}" + if [ "$status" = "STARTED" ]; then + echo "/etc/rc.d/jail stop ${name}" + fi } startJail() { # Check $status before issuing command - [ ! "$status" = "STARTED" ] && echo "/etc/rc.d/jail start ${name}" + if [ "$status" = "NOTSTART" ]; then + echo "/etc/rc.d/jail start ${name}" + fi } deleteJail() { +# Unmount the jail's mountpoints if necessary + cat <=1 rw mount is mounted still + for DIR in "${output}"; do + umount -F "/etc/fstab.${name}" "\$(echo "${DIR}" | awk '{print $3}')" + done + fi + output="\$(mount | grep "\/${name} (")" || true + if [ -n "\${output}" ]; then # ro mount is mounted still + umount -F "/etc/fstab.${name}" "\$(echo "${output}" | awk '{print $3}')" + fi +EOF # Remove the jail's rw mountpoints - echo "rm -rf /usr/jail/rw/${name}" -# Remove the jail's fstab - echo "rm -f /etc/fstab.${name}" + echo "rm -rf \"/usr/jail/rw/${name}\"" # Remove the jail directory - echo "rm -rf /usr/jail/${name}" + echo "rm -rf \"/usr/jail/${name}\"" +# Remove the jail's fstab + echo "rm -f \"/etc/fstab.${name}\"" # Remove jail_$name_* lines from rc.conf - echo <<-EOF + cat </etc/fstab.${name} <<-END - /usr/jail/base /usr/jail/${name} nullfs ro 0 0 - /usr/jail/rw/${name}/etc /usr/jail/${name}/etc nullfs rw 0 0 - /usr/jail/rw/${name}/local /usr/jail/${name}/usr/local nullfs rw 0 0 - /usr/jail/rw/${name}/db /usr/jail/${name}/var/db nullfs rw 0 0 - /usr/jail/rw/${name}/home /usr/jail/${name}/usr/home nullfs rw 0 0 - /usr/jail/rw/${name}/tmp /usr/jail/${name}/var/tmp nullfs rw 0 0 - END +cat </etc/fstab.${name} <>/etc/rc.conf <<-END - jail_${name}_rootdir="${jaildir}/${name}" - jail_${name}_hostname="${hostname}" - jail_${name}_ip="${ip}" - jail_${name}_devfs_enable="${devfsenable}" - jail_${name}_mount_enable="YES" - jail_${name}_fstab="/etc/fstab.$name" - END +cat <>/etc/rc.conf <>/etc/rc.conf <<-END - jail_${name}_interface="${interface}" - END + cat <>/etc/rc.conf <>/etc/rc.conf <<-END - jail_${name}_devfs_ruleset="$devfsruleset" - END + cat <>/etc/rc.conf <&- >&- + # add default ruleset + cat >>/etc/devfs.rules <>"${jaildir}/rw/${name}/etc/rc.conf" -echo 'echo sendmail_enable=\"NONE\"' >>"${jaildir}/rw/${name}/etc/rc.conf" -echo 'echo syslogd_enable=\"YES\"' >>"${jaildir}/rw/${name}/etc/rc.conf" -echo 'echo syslogd_flags=\"-ss\"' >>"${jaildir}/rw/${name}/etc/rc.conf" - +echo "echo hostname=\"${hostname}\" >>\"${jaildir}/rw/${name}/etc/rc.conf\"" +echo "echo sendmail_enable=\"NONE\" >>\"${jaildir}/rw/${name}/etc/rc.conf\"" +echo "echo syslogd_enable=\"YES\" >>\"${jaildir}/rw/${name}/etc/rc.conf\"" +echo "echo syslogd_flags=\"-ss\" >>\"${jaildir}/rw/${name}/etc/rc.conf\"" } if [ "$present" = "EXISTS" ]; then # The jail currently exists From 20a3538e72ee6182edc7f12abe6e5bcd5dcf2df4 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Tue, 28 Feb 2012 11:21:23 -0500 Subject: [PATCH 009/412] Fixed echoing entries Entries weren't being properly echoed into /usr/jail/rw/${name}/etc/rc.conf --- conf/type/__jail/gencode-remote | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 3dfec9ad..dc18312b 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -265,10 +265,11 @@ EOF fi # Add the normal entries into the jail's rc.conf -echo "echo hostname=\"${hostname}\" >>\"${jaildir}/rw/${name}/etc/rc.conf\"" -echo "echo sendmail_enable=\"NONE\" >>\"${jaildir}/rw/${name}/etc/rc.conf\"" -echo "echo syslogd_enable=\"YES\" >>\"${jaildir}/rw/${name}/etc/rc.conf\"" -echo "echo syslogd_flags=\"-ss\" >>\"${jaildir}/rw/${name}/etc/rc.conf\"" +echo "echo hostname=\\\"${hostname}\\\" >\\\"${jaildir}/rw/${name}/etc/rc.conf\\\"" +echo "echo sshd_enable=\\\"YES\\\" >>\\\"${jaildir}/rw/${name}/etc/rc.conf\\\"" +echo "echo sendmail_enable=\\\"NONE\\\" >>\\\"${jaildir}/rw/${name}/etc/rc.conf\\\"" +echo "echo syslogd_enable=\\\"YES\\\" >>\\\"${jaildir}/rw/${name}/etc/rc.conf\\\"" +echo "echo syslogd_flags=\\\"-ss\\\" >>\\\"${jaildir}/rw/${name}/etc/rc.conf\\\"" } if [ "$present" = "EXISTS" ]; then # The jail currently exists From 46b916c0e18f145a5229e5c8cdf4fe655c433346 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Tue, 28 Feb 2012 16:39:08 -0500 Subject: [PATCH 010/412] Various bugfixes Added logic to ensure that /etc/resolv.conf exists within a jail Replaced /var/db, /var/tmp mountpoints with /var mountpoint in jail Added logic to ensure that every jail is bound to an interface Modified how information is inserted into the jail's rc.conf Added ListenAddress directive for SSHd Updated manpage to reflect these changes --- conf/type/__jail/gencode-remote | 38 +++++++++++++++++++++++---------- conf/type/__jail/man.text | 5 +++-- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index dc18312b..c0a35784 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -185,16 +185,18 @@ cat <>/etc/rc.conf <\\\"${jaildir}/rw/${name}/etc/rc.conf\\\"" -echo "echo sshd_enable=\\\"YES\\\" >>\\\"${jaildir}/rw/${name}/etc/rc.conf\\\"" -echo "echo sendmail_enable=\\\"NONE\\\" >>\\\"${jaildir}/rw/${name}/etc/rc.conf\\\"" -echo "echo syslogd_enable=\\\"YES\\\" >>\\\"${jaildir}/rw/${name}/etc/rc.conf\\\"" -echo "echo syslogd_flags=\\\"-ss\\\" >>\\\"${jaildir}/rw/${name}/etc/rc.conf\\\"" +cat <"${jaildir}/rw/${name}/etc/rc.conf" +echo sshd_enable=\"YES\" >>"${jaildir}/rw/${name}/etc/rc.conf" +echo sendmail_enable=\"NONE\" >>"${jaildir}/rw/${name}/etc/rc.conf" +echo syslogd_enable=\"YES\" >>"${jaildir}/rw/${name}/etc/rc.conf" +echo syslogd_flags=\"-ss\" >>"${jaildir}/rw/${name}/etc/rc.conf" + +EOF +# Configure SSHd's listening address +cat < Date: Mon, 5 Mar 2012 14:57:37 -0500 Subject: [PATCH 011/412] Bugfix Modified pipeline to determine ${name}'s version if it's installed. --- conf/type/__package_pkg_freebsd/explorer/pkg_version | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conf/type/__package_pkg_freebsd/explorer/pkg_version b/conf/type/__package_pkg_freebsd/explorer/pkg_version index 4bca24b6..1335ba79 100755 --- a/conf/type/__package_pkg_freebsd/explorer/pkg_version +++ b/conf/type/__package_pkg_freebsd/explorer/pkg_version @@ -30,6 +30,10 @@ fi # Don't produce "no pkgs installed" output -- breaks things PKG_OUTPUT=$(pkg_info 2>&1) if [ ! "$PKG_OUTPUT" = "pkg_info: no packages installed" ]; then - echo "$(echo "$PKG_OUTPUT" | grep "^$name-" | cut '-d ' -f1 | sed "s/$name-//g")" + echo -n "$(echo "$PKG_OUTPUT" \ + | awk '{print $1}' \ + | sed 's/^\(.*\)-\([^-]*\)$/name:\1 ver:\2/g' \ + | grep "name:$name ver:" \ + | sed 's/^.*ver:\(.*\)/\1/g')" fi From 9682ce7ebba04cabca5bbc69a8d8a55df88ecd4b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 18 Mar 2012 09:44:44 +0100 Subject: [PATCH 012/412] ++todo Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 502810f7..9626a608 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -3,6 +3,10 @@ UNASSIGNED TODOS The following list of todos has not been assigned to any developer. Feel free to pick one! +CORE +---- +- support default parameter + TESTS ----- - multiple defines of object: From 59f05ca4add14bfbe445a98cc00b3c357bc419b6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 21 Mar 2012 10:39:47 +0100 Subject: [PATCH 013/412] add old logfile Signed-off-by: Nico Schottelius --- doc/dev/logs/2012-02-20.debug-jake-deps | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/dev/logs/2012-02-20.debug-jake-deps diff --git a/doc/dev/logs/2012-02-20.debug-jake-deps b/doc/dev/logs/2012-02-20.debug-jake-deps new file mode 100644 index 00000000..2ae39f50 --- /dev/null +++ b/doc/dev/logs/2012-02-20.debug-jake-deps @@ -0,0 +1,8 @@ +require="__package/pkg-config" \ + __package libxml2 --version "2.7.8_1" --state installed --pkgsite http://192.168.196.70 + +Kein + INFO: www: Generating and executing code for __package_pkg_freebsd/libxml2 + +für + __package/libxml2 From fe4074b27052dbc76b22615c391a36afb9bfc82a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 21 Mar 2012 10:42:43 +0100 Subject: [PATCH 014/412] +update README Signed-off-by: Nico Schottelius --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 965138c4..e514df91 100644 --- a/README +++ b/README @@ -38,6 +38,7 @@ 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 +Fast development | Batteries included: A lot of requirements can be solved using standard types Modern Programming Language | cdist is written in Python Requirements, Scalability | No central server needed, cdist operates in push mode and can be run from any computer Requirements, Scalability, Upgrade | cdist only needs to be updated on the master, not on the target hosts From 9832512bfd2936ea1ec25df106a664f5abdef1a5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 26 Mar 2012 18:12:06 +0200 Subject: [PATCH 015/412] ++todos :-) Signed-off-by: Nico Schottelius --- doc/dev/todo/TAKEME | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 9626a608..1dd73d87 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -44,3 +44,6 @@ TYPES - Merge __addifnosuchline and __removeline into __line + --state present|absent - __cron: Support --file to be used instead of user cron (probably direct support of /etc/cron.d) + +- Support uci from openwrt? + - http://wiki.openwrt.org/doc/uci From f3efa1e74db49b0701ca4b761ae85f04aea5c095 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 30 Mar 2012 09:14:25 +0200 Subject: [PATCH 016/412] enable __start_on_boot on amazon linux Signed-off-by: Nico Schottelius --- conf/type/__start_on_boot/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index cefdc385..974abb30 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -43,7 +43,7 @@ case "$state_should" in # echo rc-update add \"$name\" default # ;; - centos|fedora|owl|redhat) + amazon|centos|fedora|owl|redhat) echo chkconfig \"$name\" on ;; From e540502830e7ce54c081e97504347e22c5ae6ac8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 3 Apr 2012 05:59:24 +0200 Subject: [PATCH 017/412] Missing cat in __package_yum Signed-off-by: Nico Schottelius --- conf/type/__package_yum/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__package_yum/gencode-remote b/conf/type/__package_yum/gencode-remote index a10e60dd..df2bf405 100755 --- a/conf/type/__package_yum/gencode-remote +++ b/conf/type/__package_yum/gencode-remote @@ -22,7 +22,7 @@ # if [ -f "$__object/parameter/name" ]; then - name="$__object/parameter/name" + name="$(cat "$__object/parameter/name")" else name="$__object_id" fi From 941e89f950d0c121cfbd06cbd2cfec24bd80f0ab Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 3 Apr 2012 06:00:00 +0200 Subject: [PATCH 018/412] ++changes(2.0.10) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index ce9f798b..127b33ee 100644 --- a/doc/changelog +++ b/doc/changelog @@ -7,6 +7,7 @@ Changelog 2.0.10: * Cleanup __group: No getent gshadow in old Redhat, use groupmod -g (Matt Coddington) + * Bugfix __package_yum: Missing cat 2.0.9: 2012-03-12 * Cleanup documentation: Fix environment variable list to be properly From 386c12f2512b45a197450fd7ece6bb8a634004ab Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 3 Apr 2012 17:52:58 +0200 Subject: [PATCH 019/412] nested quotes should not be escaped Signed-off-by: Steven Armstrong --- conf/type/__start_on_boot/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index 974abb30..b9e26815 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -32,7 +32,7 @@ case "$state_should" in present) case "$os" in archlinux) - echo "sed -i /etc/rc.conf \'s/^\\(DAEMONS=.*\\))/\\1 $name)/\'" + echo "sed -i /etc/rc.conf 's/^\\(DAEMONS=.*\\))/\\1 $name)/'" ;; debian|ubuntu) echo "update-rc.d \"$name\" defaults >/dev/null" From 18a25dc65bf8b00a41ad805efcc2941aa2e61829 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 3 Apr 2012 17:53:28 +0200 Subject: [PATCH 020/412] file must be last argument Signed-off-by: Steven Armstrong --- conf/type/__start_on_boot/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index b9e26815..a64c1096 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -32,7 +32,7 @@ case "$state_should" in present) case "$os" in archlinux) - echo "sed -i /etc/rc.conf 's/^\\(DAEMONS=.*\\))/\\1 $name)/'" + echo "sed -i 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf" ;; debian|ubuntu) echo "update-rc.d \"$name\" defaults >/dev/null" From ffcf57ee45783145451484ae94f8edc25e6a9195 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 4 Apr 2012 00:08:23 +0200 Subject: [PATCH 021/412] implement --state exists Signed-off-by: Steven Armstrong --- conf/type/__file/gencode-local | 3 +++ conf/type/__file/man.text | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/conf/type/__file/gencode-local b/conf/type/__file/gencode-local index d9839a19..a55cfc2b 100755 --- a/conf/type/__file/gencode-local +++ b/conf/type/__file/gencode-local @@ -23,6 +23,9 @@ destination="/$__object_id" state_should="$(cat "$__object/parameter/state")" +exists="$(cat "$__object/explorer/exists")" + +[ "$state_should" = "exists" -a "$exists" = "yes" ] && exit 0 # nothing to do if [ "$state_should" = "present" ]; then if [ -f "$__object/parameter/source" ]; then diff --git a/conf/type/__file/man.text b/conf/type/__file/man.text index 5e91599f..db20d857 100644 --- a/conf/type/__file/man.text +++ b/conf/type/__file/man.text @@ -21,7 +21,11 @@ None. OPTIONAL PARAMETERS ------------------- state:: - 'present' or 'absent', defaults to 'present' + 'present', 'absent' or 'exists', defaults to 'present' + where: + present: the file is exactly the one from source + absent: the file does not exist + exists: the file from source but only if it doesn't already exist group:: Group to chgrp to. From e3f767f5a1cfba53cf8ba5dc6a7490de02bf1eb4 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 4 Apr 2012 09:37:18 +0200 Subject: [PATCH 022/412] += example Signed-off-by: Steven Armstrong --- conf/type/__file/man.text | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/conf/type/__file/man.text b/conf/type/__file/man.text index db20d857..0215027a 100644 --- a/conf/type/__file/man.text +++ b/conf/type/__file/man.text @@ -59,6 +59,11 @@ __file /etc/issue --source "$__type/files/archlinux" --state present __file /etc/shadow --source "$__type/files/shadow" \ --owner root --group shadow --mode 0640 \ --state present + +# Provide a default file, but let the user change it +__file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \ + --state exists \ + --owner frodo --mode 0600 -------------------------------------------------------------------------------- From 9da25ca4eaa7ca2a5be27d4f871d90ecc08b904d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 4 Apr 2012 09:44:57 +0200 Subject: [PATCH 023/412] ++changes(2.0.10) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 127b33ee..08232af6 100644 --- a/doc/changelog +++ b/doc/changelog @@ -8,6 +8,7 @@ Changelog * Cleanup __group: No getent gshadow in old Redhat, use groupmod -g (Matt Coddington) * Bugfix __package_yum: Missing cat + * Feature __file: Support for --state exists (Steven Armstrong) 2.0.9: 2012-03-12 * Cleanup documentation: Fix environment variable list to be properly From 689acb4c2167a42574645b4d03bfae16f0b5c784 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 4 Apr 2012 09:47:52 +0200 Subject: [PATCH 024/412] ++changes(2.0.10) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 08232af6..0bd00135 100644 --- a/doc/changelog +++ b/doc/changelog @@ -8,6 +8,7 @@ Changelog * Cleanup __group: No getent gshadow in old Redhat, use groupmod -g (Matt Coddington) * Bugfix __package_yum: Missing cat + * Bugfix __start_on_boot: Correctly use sed and quotes (Steven Armstrong) * Feature __file: Support for --state exists (Steven Armstrong) 2.0.9: 2012-03-12 From 7d2799d958ce90769f19d54f74359f4b4db7fba6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 4 Apr 2012 17:21:54 +0200 Subject: [PATCH 025/412] Make __manifest usable in type manifests Signed-off-by: Nico Schottelius --- doc/changelog | 1 + doc/man/cdist-reference.text.sh | 2 +- lib/cdist/core/manifest.py | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index 0bd00135..e3f7d1a5 100644 --- a/doc/changelog +++ b/doc/changelog @@ -10,6 +10,7 @@ Changelog * Bugfix __package_yum: Missing cat * Bugfix __start_on_boot: Correctly use sed and quotes (Steven Armstrong) * Feature __file: Support for --state exists (Steven Armstrong) + * Feature core: Make variable __manifest available to type manifests 2.0.9: 2012-03-12 * Cleanup documentation: Fix environment variable list to be properly diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 6bd5f1b8..2aa87aa1 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -173,7 +173,7 @@ __explorer:: Available for: explorer, type explorer __manifest:: Directory that contains the initial manifest. - Available for: initial manifest + Available for: initial manifest, type manifest __global:: Directory that contains generic output like explorer. Available for: initial manifest, type manifest, type gencode diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index 8b784229..4b798883 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({ + '__manifest': self.local.manifest_path, '__object': cdist_object.absolute_path, '__object_id': cdist_object.object_id, '__object_name': cdist_object.name, From 0e11583b1e563a8afa53fae185942efaaf14d2af Mon Sep 17 00:00:00 2001 From: pestaa Date: Thu, 5 Apr 2012 23:21:11 +0200 Subject: [PATCH 026/412] Fix sed argumenting on FreeBSD. While specifying -i flag is optional on GNU sed, it is mandatory on non-GNU variants. In order to keep behavior backward-compatible, the backup file is always removed. --- conf/type/__key_value/gencode-remote | 6 ++++-- conf/type/__rvm/gencode-remote | 3 ++- conf/type/__start_on_boot/gencode-remote | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/conf/type/__key_value/gencode-remote b/conf/type/__key_value/gencode-remote index 0846dca1..0b02adf2 100755 --- a/conf/type/__key_value/gencode-remote +++ b/conf/type/__key_value/gencode-remote @@ -34,7 +34,8 @@ fi case "$state_should" in absent) # remove lines starting with key - echo "sed -i '/^$key\($delimiter\+\)/d' \"$file\"" + echo "sed -i cdist-backup '/^$key\($delimiter\+\)/d' \"$file\"" + echo "rm -f \"$file.cdist-backup\"" ;; present) case "$state_is" in @@ -44,7 +45,8 @@ case "$state_should" in ;; wrongvalue) # change exisiting value - echo "sed -i \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\"" + echo "sed -i cdist-backup \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\"" + echo "rm -f \"$file.cdist-backup\"" ;; *) echo "Unknown explorer state: $state_is" >&2 diff --git a/conf/type/__rvm/gencode-remote b/conf/type/__rvm/gencode-remote index f306979a..ec39acac 100755 --- a/conf/type/__rvm/gencode-remote +++ b/conf/type/__rvm/gencode-remote @@ -32,7 +32,8 @@ DONE removed) cat << DONE su - $user -c "rm -Rf \"\\\$HOME/.rvm\"; -sed -i '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\"" +sed -i cdist-backup '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\"" +rm -f \"\\\$HOME/.bashrc.cdist-backup\"" DONE ;; esac diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index a64c1096..a6ecf032 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -32,7 +32,8 @@ case "$state_should" in present) case "$os" in archlinux) - echo "sed -i 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf" + echo "sed -i cdist-backup 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf" + echo "rm -f /etc/rc.conf.cdist-backup" ;; debian|ubuntu) echo "update-rc.d \"$name\" defaults >/dev/null" @@ -66,7 +67,8 @@ case "$state_should" in archlinux) # Replace a) at the beginning b) in the middle c) end d) only # Support @name as well...makes it more ugly, but well... - echo "sed -i /etc/rc.conf -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)@\\{0,1\\}$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) @\\{0,1\\}$name)/\\1)/' -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name)/\\1)/'" + echo "sed -i cdist-backup /etc/rc.conf -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)@\\{0,1\\}$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) @\\{0,1\\}$name)/\\1)/' -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name)/\\1)/'" + echo "rm -f /etc/rc.conf.cdist-backup" ;; debian|ubuntu) echo update-rc.d -f \"$name\" remove From cb47a7d56f2e89e5433ea3f4b1ad1009445fed88 Mon Sep 17 00:00:00 2001 From: Istvan Beregszaszi Date: Fri, 6 Apr 2012 00:29:14 +0300 Subject: [PATCH 027/412] Fix indenting. --- conf/type/__start_on_boot/gencode-remote | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index a6ecf032..ffd30f7f 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -33,7 +33,7 @@ case "$state_should" in case "$os" in archlinux) echo "sed -i cdist-backup 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf" - echo "rm -f /etc/rc.conf.cdist-backup" + echo "rm -f /etc/rc.conf.cdist-backup" ;; debian|ubuntu) echo "update-rc.d \"$name\" defaults >/dev/null" @@ -68,7 +68,7 @@ case "$state_should" in # Replace a) at the beginning b) in the middle c) end d) only # Support @name as well...makes it more ugly, but well... echo "sed -i cdist-backup /etc/rc.conf -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)@\\{0,1\\}$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) @\\{0,1\\}$name)/\\1)/' -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name)/\\1)/'" - echo "rm -f /etc/rc.conf.cdist-backup" + echo "rm -f /etc/rc.conf.cdist-backup" ;; debian|ubuntu) echo update-rc.d -f \"$name\" remove From f9c945cc86fcf96b048313f8ea239f36f2629d16 Mon Sep 17 00:00:00 2001 From: pestaa Date: Fri, 6 Apr 2012 11:15:06 +0200 Subject: [PATCH 028/412] Changed tactics. Sed's -i flag is not cross-platform. --- conf/type/__key_value/gencode-remote | 6 ++---- conf/type/__rvm/gencode-remote | 3 +-- conf/type/__start_on_boot/gencode-remote | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/conf/type/__key_value/gencode-remote b/conf/type/__key_value/gencode-remote index 0b02adf2..84ea6430 100755 --- a/conf/type/__key_value/gencode-remote +++ b/conf/type/__key_value/gencode-remote @@ -34,8 +34,7 @@ fi case "$state_should" in absent) # remove lines starting with key - echo "sed -i cdist-backup '/^$key\($delimiter\+\)/d' \"$file\"" - echo "rm -f \"$file.cdist-backup\"" + echo "sed '/^$key\($delimiter\+\)/d' \"$file\" | tee \"$file\" > /dev/null" ;; present) case "$state_is" in @@ -45,8 +44,7 @@ case "$state_should" in ;; wrongvalue) # change exisiting value - echo "sed -i cdist-backup \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\"" - echo "rm -f \"$file.cdist-backup\"" + echo "sed \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\" | tee \"$file\" > /dev/null" ;; *) echo "Unknown explorer state: $state_is" >&2 diff --git a/conf/type/__rvm/gencode-remote b/conf/type/__rvm/gencode-remote index ec39acac..cc527678 100755 --- a/conf/type/__rvm/gencode-remote +++ b/conf/type/__rvm/gencode-remote @@ -32,8 +32,7 @@ DONE removed) cat << DONE su - $user -c "rm -Rf \"\\\$HOME/.rvm\"; -sed -i cdist-backup '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\"" -rm -f \"\\\$HOME/.bashrc.cdist-backup\"" +sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" | tee \"\\\$HOME/.bashrc\" > /dev/null" DONE ;; esac diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index a6ecf032..f6036dc1 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -32,8 +32,7 @@ case "$state_should" in present) case "$os" in archlinux) - echo "sed -i cdist-backup 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf" - echo "rm -f /etc/rc.conf.cdist-backup" + echo "sed 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf | tee /etc/rc.conf > /dev/null" ;; debian|ubuntu) echo "update-rc.d \"$name\" defaults >/dev/null" @@ -67,8 +66,7 @@ case "$state_should" in archlinux) # Replace a) at the beginning b) in the middle c) end d) only # Support @name as well...makes it more ugly, but well... - echo "sed -i cdist-backup /etc/rc.conf -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)@\\{0,1\\}$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) @\\{0,1\\}$name)/\\1)/' -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name)/\\1)/'" - echo "rm -f /etc/rc.conf.cdist-backup" + echo "sed /etc/rc.conf -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)@\\{0,1\\}$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) @\\{0,1\\}$name)/\\1)/' -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name)/\\1)/' | tee /etc/rc.conf > /dev/null" ;; debian|ubuntu) echo update-rc.d -f \"$name\" remove From deafcc60e8ffaec0338e306062c24749a3d72049 Mon Sep 17 00:00:00 2001 From: pestaa Date: Fri, 6 Apr 2012 18:55:35 +0200 Subject: [PATCH 029/412] Workound lack of pipeline's integrity guarantee. --- conf/type/__key_value/gencode-remote | 6 ++++-- conf/type/__rvm/gencode-remote | 4 +++- conf/type/__start_on_boot/gencode-remote | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/conf/type/__key_value/gencode-remote b/conf/type/__key_value/gencode-remote index 84ea6430..b3ffeb46 100755 --- a/conf/type/__key_value/gencode-remote +++ b/conf/type/__key_value/gencode-remote @@ -34,7 +34,8 @@ fi case "$state_should" in absent) # remove lines starting with key - echo "sed '/^$key\($delimiter\+\)/d' \"$file\" | tee \"$file\" > /dev/null" + echo "sed '/^$key\($delimiter\+\)/d' \"$file\" > \"$file.cdist-tmp\"" + echo "mv \"$file.cdist-tmp\" \"$file\"" ;; present) case "$state_is" in @@ -44,7 +45,8 @@ case "$state_should" in ;; wrongvalue) # change exisiting value - echo "sed \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\" | tee \"$file\" > /dev/null" + echo "sed \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\" > \"$file.cdist-tmp\"" + echo "mv \"$file.cdist-tmp\" \"$file\"" ;; *) echo "Unknown explorer state: $state_is" >&2 diff --git a/conf/type/__rvm/gencode-remote b/conf/type/__rvm/gencode-remote index cc527678..1ba1d499 100755 --- a/conf/type/__rvm/gencode-remote +++ b/conf/type/__rvm/gencode-remote @@ -32,7 +32,9 @@ DONE removed) cat << DONE su - $user -c "rm -Rf \"\\\$HOME/.rvm\"; -sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" | tee \"\\\$HOME/.bashrc\" > /dev/null" +sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" > \"\\\$HOME/.bashrc.cdist-tmp\" +mv \"\\\$HOME/.bashrc.cdist-tmp\" \"\\\$HOME/.bashrc\"" + DONE ;; esac diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index f6036dc1..78a82de3 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -32,7 +32,8 @@ case "$state_should" in present) case "$os" in archlinux) - echo "sed 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf | tee /etc/rc.conf > /dev/null" + echo "sed 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf > /etc/rc.conf.cdist-tmp" + echo "mv /etc/rc.conf.cdist-tmp /etc/rc.conf" ;; debian|ubuntu) echo "update-rc.d \"$name\" defaults >/dev/null" @@ -66,7 +67,8 @@ case "$state_should" in archlinux) # Replace a) at the beginning b) in the middle c) end d) only # Support @name as well...makes it more ugly, but well... - echo "sed /etc/rc.conf -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)@\\{0,1\\}$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) @\\{0,1\\}$name)/\\1)/' -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name)/\\1)/' | tee /etc/rc.conf > /dev/null" + echo "sed /etc/rc.conf -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)@\\{0,1\\}$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) @\\{0,1\\}$name)/\\1)/' -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name)/\\1)/' > /etc/rc.conf.cdist-tmp" + echo "mv /etc/rc.conf.cdist-tmp /etc/rc.conf" ;; debian|ubuntu) echo update-rc.d -f \"$name\" remove From f5437ccce6dba44723327738b185be132b714c89 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Fri, 6 Apr 2012 13:32:59 -0400 Subject: [PATCH 030/412] Bugfix for jail_list If jail_list wasn't already defined in /etc/rc.conf, gencode-remote wasn't adding the variable to the file. --- conf/type/__jail/gencode-remote | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index c0a35784..d32ea7d6 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -266,7 +266,12 @@ if [ "$onboot" = "true" ]; then cat <>/etc/rc.conf + fi unset jail_list rm -f /etc/rc.conf.bak EOF From 847fc9d8c168d0395d1f29458005e30f6f9e922d Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 11 Apr 2012 14:53:28 -0400 Subject: [PATCH 031/412] Multiple bugfixes fixed remote copy command fixed problem with code-remote when jail_enable wasn't in rc.conf fixed problem with code-remote when jail_list wasn't in rc.conf added check to see if /etc/devfs.rules exists before trying to use it added dependency on __directory/usr/jail --- conf/type/__jail/gencode-local | 2 +- conf/type/__jail/gencode-remote | 30 +++++++++++++++++++++------- conf/type/__jail/manifest | 35 +++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 8 deletions(-) create mode 100755 conf/type/__jail/manifest diff --git a/conf/type/__jail/gencode-local b/conf/type/__jail/gencode-local index 2d4415e3..6a66c658 100755 --- a/conf/type/__jail/gencode-local +++ b/conf/type/__jail/gencode-local @@ -29,6 +29,6 @@ jailbase="/usr/jail/jailbase.tgz" basepresent="$(cat "$__object/explorer/basepresent")" if [ "$basepresent" = "NONE" ]; then - echo "$__remote_copy" "$__object/files/jailbase.tgz" "${target_host}:${jailbase}" + echo "$__remote_copy" "$__type/files/jailbase.tgz" "$__target_host:${jailbase}" fi diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index d32ea7d6..56fe9b9a 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -212,6 +212,16 @@ EOF # Add the jail_$name_* lines to rc.conf cat <>/etc/rc.conf + elif [ ! "\$(echo \$jail_enable | tr '[a-z]' '[A-Z]')" = "YES" ]; then # jail_enable="NO" + sed -i '.bak' 's/^jail_enable=.*$/jail_enable="YES"/g' /etc/rc.conf # fix this -^ + rm -f /etc/rc.conf.bak + fi cat >>/etc/rc.conf <>/etc/rc.conf else - echo jail_list=\"\${jail_list}\" >>/etc/rc.conf + jail_list="\${jail_list} ${name}" + sed -i '.bak' "s/^jail_list=\".*\"/jail_list=\"\${jail_list}\"/" /etc/rc.conf + rm -f /etc/rc.conf.bak fi unset jail_list - rm -f /etc/rc.conf.bak EOF fi diff --git a/conf/type/__jail/manifest b/conf/type/__jail/manifest new file mode 100755 index 00000000..fc3d2ac7 --- /dev/null +++ b/conf/type/__jail/manifest @@ -0,0 +1,35 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# The __jail type creates, configures, and deletes FreeBSD jails for use as +# virtual machines. +# + +# Debug +#exec >&2 +#set -x + +jaildir="/usr/jail" + +__directory ${jaildir} --parents yes + +# Debug +#set +x + From 32d6cbb7a123683843eef903f0c616f6a7019c5a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 22 Apr 2012 01:20:32 +0200 Subject: [PATCH 032/412] ++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 1dd73d87..11235f8a 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -6,6 +6,8 @@ Feel free to pick one! CORE ---- - support default parameter +- document and add paremeters for remote-copy and remote-exec! + - remove hack, make a feature of it TESTS ----- From bc1a2d769dbbe2b7eac314343c90107efd58fdd9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 22 Apr 2012 01:20:44 +0200 Subject: [PATCH 033/412] ++title line Signed-off-by: Nico Schottelius --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index e514df91..73e5c210 100644 --- a/README +++ b/README @@ -288,7 +288,7 @@ Interesting information are for instance * What are the pros/cons you see in cdist? * General comments/critics -### Nico Schottelius, Systems Group ETH Zurich and privately +### Nico Schottelius, Systems Group ETH Zurich, local.ch and privately Yes, I'm actually eating my own dogfood and currently managing From d39821782d989b194c436b5669bdb76a0037bf1f Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Mon, 23 Apr 2012 13:43:27 -0400 Subject: [PATCH 034/412] Copy /root to $jailbase/rw/$name/root Copies /root to ${jailbase}/rw/${name}/root Adds /root to /etc/fstab.${name} --- conf/type/__jail/gencode-remote | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 56fe9b9a..23e8debc 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -197,6 +197,11 @@ cat < Date: Mon, 23 Apr 2012 14:39:26 -0400 Subject: [PATCH 035/412] Added jail_${name}_flags variable To make future work, such as resource limiting (rctl(8)) easier, added "-n ${name}" to jail_flags for each jail. --- conf/type/__jail/gencode-remote | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 23e8debc..9b91bd50 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -198,8 +198,8 @@ cat < Date: Wed, 25 Apr 2012 17:18:16 +0200 Subject: [PATCH 036/412] inherit dependencies from defining object when setting up implicit dependencies through autorequire Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index c4b84feb..99b34554 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -160,10 +160,19 @@ class Emulator(object): 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 is the name of the object whose type manifest is currently executed __object_name = os.environ.get('__object_name', None) if __object_name: - _object = self.cdist_object.object_from_name(__object_name) - # prevent circular dependencies - if not _object.name in self.cdist_object.requirements: - _object.requirements.append(self.cdist_object.name) + # The object whose type manifest is currently run + parent = self.cdist_object.object_from_name(__object_name) + # The object currently being defined + current_object = self.cdist_object + # current_object shall have all dependencies that it's parent has + for req in parent.requirements: + if req not in current_object.requirements: + current_object.requirements.append(req) + # As parent defined current_object it shall automatically depend on it. + # But only if the user hasn't said otherwise. + # Must prevent circular dependencies. + if not parent.name in current_object.requirements: + parent.requirements.append(current_object.name) From 75aea916434c63681634be27c6d63f654739e5cb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 27 Apr 2012 11:39:08 +0200 Subject: [PATCH 037/412] ++changes(2.0.10) Signed-off-by: Nico Schottelius --- doc/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/changelog b/doc/changelog index e3f7d1a5..267be9e7 100644 --- a/doc/changelog +++ b/doc/changelog @@ -11,6 +11,8 @@ Changelog * Bugfix __start_on_boot: Correctly use sed and quotes (Steven Armstrong) * Feature __file: Support for --state exists (Steven Armstrong) * Feature core: Make variable __manifest available to type manifests + * Feature core: Correct parent dependency handling (Steven Armstrong) + * Bugfix several types: Fix sed for FreeBSD (Istvan Beregszaszi) 2.0.9: 2012-03-12 * Cleanup documentation: Fix environment variable list to be properly From 14e851341a7230eb50ac74565ea97a2d9b514d3c Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Fri, 27 Apr 2012 11:45:34 -0400 Subject: [PATCH 038/412] Implemented Nico's suggestions Parameterized {jailbase,jaildir} Replaced all usages of /usr/jail with $jaildir Explicitly fail if $os isn't FreeBSD Removed $__type/files/ as it is pointless to have now Updated man page --- conf/type/__jail/explorer/basepresent | 10 ++++++++-- conf/type/__jail/explorer/present | 8 +++++++- conf/type/__jail/explorer/status | 10 +++++++++- conf/type/__jail/files/jailbase | 1 - conf/type/__jail/gencode-local | 13 +++++++++---- conf/type/__jail/gencode-remote | 23 ++++++++++++++--------- conf/type/__jail/man.text | 19 ++++++++++++++----- conf/type/__jail/manifest | 13 ++++++++++++- conf/type/__jail/parameter/optional | 1 + conf/type/__jail/parameter/required | 1 + 10 files changed, 75 insertions(+), 24 deletions(-) delete mode 100644 conf/type/__jail/files/jailbase diff --git a/conf/type/__jail/explorer/basepresent b/conf/type/__jail/explorer/basepresent index aa155b03..f167a19c 100755 --- a/conf/type/__jail/explorer/basepresent +++ b/conf/type/__jail/explorer/basepresent @@ -18,20 +18,26 @@ # along with cdist. If not, see . # # -# See if the jailbase.tgz or /usr/jail/base dir exists +# See if the jailbase.tgz or $jaildir/base dir exists # # Debug #exec >&2 #set -x +if [ -f "$__object/parameter/jaildir" ]; then + jaildir="$(cat "$__object/parameter/name")" +else + jaildir="/usr/jail" +fi + name="base:jailbase.tgz" out="" save_IFS="$IFS" IFS=":" for cur in $name; do - if [ -e "/usr/jail/$cur" ]; then + if [ -e "${jaildir}/$cur" ]; then out="${out}:${cur}" fi done diff --git a/conf/type/__jail/explorer/present b/conf/type/__jail/explorer/present index a1f44302..2ba3b2af 100755 --- a/conf/type/__jail/explorer/present +++ b/conf/type/__jail/explorer/present @@ -31,7 +31,13 @@ else name=$__object_id fi -[ -d "/usr/jail/$name" ] && echo "EXISTS" || echo "NOTEXIST" +if [ -f "$__object/parameter/jaildir" ]; then + jaildir="$(cat "$__object/parameter/name")" +else + jaildir="/usr/jail" +fi + +[ -d "${jaildir}/$name" ] && echo "EXISTS" || echo "NOTEXIST" #set +x diff --git a/conf/type/__jail/explorer/status b/conf/type/__jail/explorer/status index 5f95f406..fe81eaf7 100755 --- a/conf/type/__jail/explorer/status +++ b/conf/type/__jail/explorer/status @@ -31,7 +31,15 @@ else name="$__object_id" fi -jls_output="$(jls | grep "[ ^I]\/usr\/jail\/${name}\$")" || true +if [ -f "$__object/parameter/jaildir" ]; then + jaildir="$(cat "$__object/parameter/name")" +else + jaildir="/usr/jail" +fi +# backslash-escaped $jaildir +sjaildir="$(echo ${jaildir} | sed 's#/#\\/#g')" + +jls_output="$(jls | grep "[ ^I]${sjaildir}\/${name}\$")" || true if [ -n "${jls_output}" ]; then echo "STARTED" diff --git a/conf/type/__jail/files/jailbase b/conf/type/__jail/files/jailbase deleted file mode 100644 index defb739a..00000000 --- a/conf/type/__jail/files/jailbase +++ /dev/null @@ -1 +0,0 @@ -Create a tarball jailbase.tgz in this directory containing the base filesystem for a jail. diff --git a/conf/type/__jail/gencode-local b/conf/type/__jail/gencode-local index 6a66c658..6292d943 100755 --- a/conf/type/__jail/gencode-local +++ b/conf/type/__jail/gencode-local @@ -22,13 +22,18 @@ # virtual machines. # -#FIXME: /usr/jail should never be hardcoded in this type -#FIXME: jailbase.tgz should not be hardcoded in this file +if [ -f "$__object/parameter/jaildir" ]; then + jaildir="$(cat "$__object/parameter/name")" +else + jaildir="/usr/jail" +fi -jailbase="/usr/jail/jailbase.tgz" +jailbase="$(cat "$__object/parameter/jailbase")" + +remotebase="${jaildir}/jailbase.tgz" basepresent="$(cat "$__object/explorer/basepresent")" if [ "$basepresent" = "NONE" ]; then - echo "$__remote_copy" "$__type/files/jailbase.tgz" "$__target_host:${jailbase}" + echo "$__remote_copy" "${jailbase}" "$__target_host:${remotebase}" fi diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 9b91bd50..b52eb572 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -90,7 +90,12 @@ if [ -f "$__object/parameter/onboot" ]; then onboot="$(cat "$__object/parameter/onboot")" fi -jaildir="/usr/jail" +if [ -f "$__object/parameter/jaildir" ]; then + jaildir="$(cat "$__object/parameter/name")" +else + jaildir="/usr/jail" +fi + present="$(cat "$__object/explorer/present")" status="$(cat "$__object/explorer/status")" @@ -135,9 +140,9 @@ deleteJail() { fi EOF # Remove the jail's rw mountpoints - echo "rm -rf \"/usr/jail/rw/${name}\"" + echo "rm -rf \"${jailbase}/rw/${name}\"" # Remove the jail directory - echo "rm -rf \"/usr/jail/${name}\"" + echo "rm -rf \"${jailbase}/${name}\"" # Remove the jail's fstab echo "rm -f \"/etc/fstab.${name}\"" # Remove jail_$name_* lines from rc.conf @@ -207,12 +212,12 @@ EOF # Create the ro+rw mountpoint entries in fstab cat </etc/fstab.${name} <&2 #set -x -jaildir="/usr/jail" +# Can only be used on FreeBSD +os="$(cat "$__global/explorer/os")" +if [ ! "$os" = "freebsd" ]; then + echo "__jail can only be used on FreeBSD targets!" >&2 + exit 1 +fi + +if [ -f "$__object/parameter/jaildir" ]; then + jaildir="$(cat "$__object/parameter/name")" +else + jaildir="/usr/jail" +fi __directory ${jaildir} --parents yes diff --git a/conf/type/__jail/parameter/optional b/conf/type/__jail/parameter/optional index 85b94270..53b8895f 100644 --- a/conf/type/__jail/parameter/optional +++ b/conf/type/__jail/parameter/optional @@ -6,3 +6,4 @@ interface devfs-enable devfs-ruleset onboot +jaildir diff --git a/conf/type/__jail/parameter/required b/conf/type/__jail/parameter/required index ff72b5c7..29797ee6 100644 --- a/conf/type/__jail/parameter/required +++ b/conf/type/__jail/parameter/required @@ -1 +1,2 @@ state +jailbase From 4b11a6172dee9026558361de054b1b23131b8c5c Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Mon, 30 Apr 2012 17:29:08 -0400 Subject: [PATCH 039/412] Fixed variable naming in /etc/fstab.$name had referenced $jailbase when meaning to reference $jaildir --- conf/type/__jail/gencode-remote | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index b52eb572..7ebe26eb 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -140,9 +140,9 @@ deleteJail() { fi EOF # Remove the jail's rw mountpoints - echo "rm -rf \"${jailbase}/rw/${name}\"" + echo "rm -rf \"${jaildir}/rw/${name}\"" # Remove the jail directory - echo "rm -rf \"${jailbase}/${name}\"" + echo "rm -rf \"${jaildir}/${name}\"" # Remove the jail's fstab echo "rm -f \"/etc/fstab.${name}\"" # Remove jail_$name_* lines from rc.conf @@ -212,12 +212,12 @@ EOF # Create the ro+rw mountpoint entries in fstab cat </etc/fstab.${name} < Date: Wed, 2 May 2012 15:54:25 +0200 Subject: [PATCH 040/412] ++changes(2.0.10) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 267be9e7..980e0cdf 100644 --- a/doc/changelog +++ b/doc/changelog @@ -13,6 +13,7 @@ Changelog * Feature core: Make variable __manifest available to type manifests * Feature core: Correct parent dependency handling (Steven Armstrong) * Bugfix several types: Fix sed for FreeBSD (Istvan Beregszaszi) + * New Type: __jail (Jake Guffey) 2.0.9: 2012-03-12 * Cleanup documentation: Fix environment variable list to be properly From 7d61b777088c5b254c1cfad6a615bc619c79eab6 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 3 May 2012 10:16:08 +0200 Subject: [PATCH 041/412] fix autorequire dependency handling - inherit explicit requirements that the user defined himself - but _not_ implicit requirements that cdist added for autorequire Changes: - added new .autorequire property to CdistObject to keep track of implicit autorequire dependencies - Emulator appends implicit requirements to this .autorequire property - DependencyResolver preprocess these .autorequire properties before resolving normal dependencies - refactored and documented DependencyResolver so it's clearer what happens and easier to use from tests - update test cases to match new DependencyResolver behaviour Signed-off-by: Steven Armstrong --- lib/cdist/config_install.py | 2 +- lib/cdist/core/cdist_object.py | 1 + lib/cdist/emulator.py | 6 +- lib/cdist/resolver.py | 80 +++++++++++++------ lib/cdist/test/autorequire/__init__.py | 78 ++++++++++++++++++ .../autorequire/fixtures/conf/explorer/.keep | 0 .../conf/manifest/circular_dependency | 2 + .../conf/manifest/implicit_dependencies | 3 + .../conf/type/__addifnosuchline/.keep | 0 .../fixtures/conf/type/__directory/.keep | 0 .../conf/type/__nfsroot_client/manifest | 3 + .../fixtures/conf/type/__package/manifest | 1 + .../conf/type/__package_special/.keep | 0 .../type/__root_ssh_authorized_key/manifest | 4 + .../fixtures/conf/type/__top/manifest | 2 + .../fixtures/conf/type/__user/.keep | 0 lib/cdist/test/emulator/__init__.py | 5 +- lib/cdist/test/resolver/__init__.py | 6 +- 18 files changed, 156 insertions(+), 37 deletions(-) create mode 100644 lib/cdist/test/autorequire/__init__.py create mode 100644 lib/cdist/test/autorequire/fixtures/conf/explorer/.keep create mode 100755 lib/cdist/test/autorequire/fixtures/conf/manifest/circular_dependency create mode 100755 lib/cdist/test/autorequire/fixtures/conf/manifest/implicit_dependencies create mode 100644 lib/cdist/test/autorequire/fixtures/conf/type/__addifnosuchline/.keep create mode 100644 lib/cdist/test/autorequire/fixtures/conf/type/__directory/.keep create mode 100755 lib/cdist/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest create mode 100755 lib/cdist/test/autorequire/fixtures/conf/type/__package/manifest create mode 100644 lib/cdist/test/autorequire/fixtures/conf/type/__package_special/.keep create mode 100755 lib/cdist/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest create mode 100755 lib/cdist/test/autorequire/fixtures/conf/type/__top/manifest create mode 100644 lib/cdist/test/autorequire/fixtures/conf/type/__user/.keep diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 7cce240e..3aadca86 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -141,7 +141,7 @@ class ConfigInstall(object): self.local.type_path) dependency_resolver = resolver.DependencyResolver(objects) - self.log.debug(pprint.pformat(dependency_resolver.graph)) + self.log.debug(pprint.pformat(dependency_resolver.dependencies)) for cdist_object in dependency_resolver: self.log.debug("Run object: %s", cdist_object) diff --git a/lib/cdist/core/cdist_object.py b/lib/cdist/core/cdist_object.py index e12bcfbd..90a21e59 100644 --- a/lib/cdist/core/cdist_object.py +++ b/lib/cdist/core/cdist_object.py @@ -186,6 +186,7 @@ class CdistObject(object): return os.path.join(self.path, "explorer") requirements = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'require')) + autorequire = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'autorequire')) parameters = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.parameter_path)) explorers = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.explorer_path)) changed = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "changed")) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 99b34554..39d8ca40 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -167,12 +167,8 @@ class Emulator(object): parent = self.cdist_object.object_from_name(__object_name) # The object currently being defined current_object = self.cdist_object - # current_object shall have all dependencies that it's parent has - for req in parent.requirements: - if req not in current_object.requirements: - current_object.requirements.append(req) # As parent defined current_object it shall automatically depend on it. # But only if the user hasn't said otherwise. # Must prevent circular dependencies. if not parent.name in current_object.requirements: - parent.requirements.append(current_object.name) + parent.autorequire.append(current_object.name) diff --git a/lib/cdist/resolver.py b/lib/cdist/resolver.py index 368c9eb8..7e3a1a68 100644 --- a/lib/cdist/resolver.py +++ b/lib/cdist/resolver.py @@ -50,36 +50,41 @@ class DependencyResolver(object): """Cdist's dependency resolver. Usage: - resolver = DependencyResolver(list_of_objects) - from pprint import pprint - pprint(resolver.graph) - - for cdist_object in resolver: - do_something_with(cdist_object) - + >> resolver = DependencyResolver(list_of_objects) + # Easy access to the objects we are working with + >> resolver.objects['__some_type/object_id'] + + # Easy access to a specific objects dependencies + >> resolver.dependencies['__some_type/object_id'] + [, ] + # Pretty print the dependency graph + >> from pprint import pprint + >> pprint(resolver.dependencies) + # Iterate over all existing objects in the correct order + >> for cdist_object in resolver: + >> do_something_with(cdist_object) """ def __init__(self, objects, logger=None): - self.objects = list(objects) # make sure we store as list, not generator - self._object_index = dict((o.name, o) for o in self.objects) - self._graph = None + self.objects = dict((o.name, o) for o in objects) + self._dependencies = None self.log = logger or log @property - def graph(self): + def dependencies(self): """Build the dependency graph. Returns a dict where the keys are the object names and the values are lists of all dependencies including the key object itself. """ - if self._graph is None: - graph = {} - for o in self.objects: + if self._dependencies is None: + self._dependencies = d = {} + self._preprocess_requirements() + for name,cdist_object in self.objects.items(): resolved = [] unresolved = [] - self.resolve_object_dependencies(o, resolved, unresolved) - graph[o.name] = resolved - self._graph = graph - return self._graph + self._resolve_object_dependencies(cdist_object, resolved, unresolved) + d[name] = resolved + return self._dependencies def find_requirements_by_name(self, requirements): """Takes a list of requirement patterns and returns a list of matching object instances. @@ -89,21 +94,44 @@ class DependencyResolver(object): find_requirements_by_name(['__type/object_id', '__other_type/*']) -> [, , ] """ - object_names = self._object_index.keys() + object_names = self.objects.keys() for pattern in requirements: found = False for requirement in fnmatch.filter(object_names, pattern): found = True - yield self._object_index[requirement] + yield self.objects[requirement] if not found: # FIXME: get rid of the singleton object_id, it should be invisible to the code -> hide it in Object singleton = os.path.join(pattern, 'singleton') - if singleton in self._object_index: - yield self._object_index[singleton] + if singleton in self.objects: + yield self.objects[singleton] else: raise RequirementNotFoundError(pattern) - def resolve_object_dependencies(self, cdist_object, resolved, unresolved): + def _preprocess_requirements(self): + """Find all autorequire dependencies and merge them to be just requirements + for further processing. + """ + for cdist_object in self.objects.values(): + if cdist_object.autorequire: + # The objects (children) that this cdist_object (parent) defined + # in it's type manifest shall inherit all explicit requirements + # that the parent has so that user defined requirements are + # fullfilled and processed in the expected order. + for auto_requirement in self.find_requirements_by_name(cdist_object.autorequire): + for requirement in cdist_object.requirements: + if requirement not in auto_requirement.requirements: + auto_requirement.requirements.append(requirement) + # On the other hand the parent shall depend on all the children + # it created so that the user can setup dependencies on it as a + # whole without having to know anything about the parents + # internals. + cdist_object.requirements.extend(cdist_object.autorequire) + # As we changed the object on disc, we have to ensure it is not + # preprocessed again if someone would call us multiple times. + cdist_object.autorequire = [] + + def _resolve_object_dependencies(self, cdist_object, resolved, unresolved): """Resolve all dependencies for the given cdist_object and store them in the list which is passed as the 'resolved' arguments. @@ -121,16 +149,16 @@ class DependencyResolver(object): if required_object not in resolved: if required_object in unresolved: raise CircularReferenceError(cdist_object, required_object) - self.resolve_object_dependencies(required_object, resolved, unresolved) + self._resolve_object_dependencies(required_object, resolved, unresolved) resolved.append(cdist_object) unresolved.remove(cdist_object) except RequirementNotFoundError as e: raise cdist.CdistObjectError(cdist_object, "requires non-existing " + e.requirement) def __iter__(self): - """Iterate over all unique objects while resolving dependencies. + """Iterate over all unique objects and yield them in the correct order. """ - iterable = itertools.chain(*self.graph.values()) + iterable = itertools.chain(*self.dependencies.values()) # Keep record of objects that have already been seen seen = set() seen_add = seen.add diff --git a/lib/cdist/test/autorequire/__init__.py b/lib/cdist/test/autorequire/__init__.py new file mode 100644 index 00000000..2263cbf9 --- /dev/null +++ b/lib/cdist/test/autorequire/__init__.py @@ -0,0 +1,78 @@ +# -*- 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 shutil + +import cdist +from cdist import test +from cdist.exec import local +from cdist import core +from cdist.core import manifest +from cdist import resolver +from cdist import config +import cdist.context + +import os.path as op +my_dir = op.abspath(op.dirname(__file__)) +fixtures = op.join(my_dir, 'fixtures') +local_base_path = fixtures + + +class AutorequireTestCase(test.CdistTestCase): + + def setUp(self): + self.orig_environ = os.environ + os.environ = os.environ.copy() + self.target_host = 'localhost' + self.temp_dir = self.mkdtemp() + os.environ['__cdist_out_dir'] = self.temp_dir + + self.context = cdist.context.Context( + target_host=self.target_host, + base_path=local_base_path, + exec_path=test.cdist_exec_path, + debug=False) + self.config = config.Config(self.context) + + def tearDown(self): + os.environ = self.orig_environ + shutil.rmtree(self.temp_dir) + + def test_implicit_dependencies(self): + self.context.initial_manifest = os.path.join(self.config.local.manifest_path, 'implicit_dependencies') + self.config.stage_prepare() + + objects = core.CdistObject.list_objects(self.config.local.object_path, self.config.local.type_path) + dependency_resolver = resolver.DependencyResolver(objects) + expected_dependencies = [ + dependency_resolver.objects['__package_special/b'], + dependency_resolver.objects['__package/b'], + dependency_resolver.objects['__package_special/a'] + ] + resolved_dependencies = dependency_resolver.dependencies['__package_special/a'] + self.assertEqual(resolved_dependencies, expected_dependencies) + + def test_circular_dependency(self): + self.context.initial_manifest = os.path.join(self.config.local.manifest_path, 'circular_dependency') + self.config.stage_prepare() + # raises CircularDependecyError + self.config.stage_run() diff --git a/lib/cdist/test/autorequire/fixtures/conf/explorer/.keep b/lib/cdist/test/autorequire/fixtures/conf/explorer/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/autorequire/fixtures/conf/manifest/circular_dependency b/lib/cdist/test/autorequire/fixtures/conf/manifest/circular_dependency new file mode 100755 index 00000000..6ea308d1 --- /dev/null +++ b/lib/cdist/test/autorequire/fixtures/conf/manifest/circular_dependency @@ -0,0 +1,2 @@ +# this has triggered CircularReferenceError +__nfsroot_client test diff --git a/lib/cdist/test/autorequire/fixtures/conf/manifest/implicit_dependencies b/lib/cdist/test/autorequire/fixtures/conf/manifest/implicit_dependencies new file mode 100755 index 00000000..7d68aed2 --- /dev/null +++ b/lib/cdist/test/autorequire/fixtures/conf/manifest/implicit_dependencies @@ -0,0 +1,3 @@ +# this creates implicit dependencies through autorequire. +# this failed because autorequired dependencies where not aware of their anchestors dependencies +__top test diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__addifnosuchline/.keep b/lib/cdist/test/autorequire/fixtures/conf/type/__addifnosuchline/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__directory/.keep b/lib/cdist/test/autorequire/fixtures/conf/type/__directory/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest b/lib/cdist/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest new file mode 100755 index 00000000..f6cb7833 --- /dev/null +++ b/lib/cdist/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest @@ -0,0 +1,3 @@ +__user root +__root_ssh_authorized_key john +__root_ssh_authorized_key frank diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__package/manifest b/lib/cdist/test/autorequire/fixtures/conf/type/__package/manifest new file mode 100755 index 00000000..6f70e627 --- /dev/null +++ b/lib/cdist/test/autorequire/fixtures/conf/type/__package/manifest @@ -0,0 +1 @@ +__package_special "$__object_id" diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__package_special/.keep b/lib/cdist/test/autorequire/fixtures/conf/type/__package_special/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest b/lib/cdist/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest new file mode 100755 index 00000000..6224629f --- /dev/null +++ b/lib/cdist/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest @@ -0,0 +1,4 @@ +user="$__object_id" +__directory /root/.ssh +require="__directory/root/.ssh" \ + __addifnosuchline "ssh-root-$user" diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__top/manifest b/lib/cdist/test/autorequire/fixtures/conf/type/__top/manifest new file mode 100755 index 00000000..d6968c25 --- /dev/null +++ b/lib/cdist/test/autorequire/fixtures/conf/type/__top/manifest @@ -0,0 +1,2 @@ +__package b +require="__package/b" __package a diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__user/.keep b/lib/cdist/test/autorequire/fixtures/conf/type/__user/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/emulator/__init__.py b/lib/cdist/test/emulator/__init__.py index 370d3d82..077ea111 100644 --- a/lib/cdist/test/emulator/__init__.py +++ b/lib/cdist/test/emulator/__init__.py @@ -114,7 +114,8 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase): self.manifest = core.Manifest(self.target_host, self.local) def tearDown(self): - shutil.rmtree(self.temp_dir) + pass + #shutil.rmtree(self.temp_dir) def test_autorequire(self): initial_manifest = os.path.join(self.local.manifest_path, "init") @@ -123,7 +124,7 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase): cdist_object = core.CdistObject(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)) + self.assertEqual(sorted(cdist_object.autorequire), sorted(expected)) class ArgumentsTestCase(test.CdistTestCase): diff --git a/lib/cdist/test/resolver/__init__.py b/lib/cdist/test/resolver/__init__.py index ae8f6915..baae26de 100644 --- a/lib/cdist/test/resolver/__init__.py +++ b/lib/cdist/test/resolver/__init__.py @@ -69,7 +69,7 @@ class ResolverTestCase(test.CdistTestCase): first_man.requirements = [second_on_the.name] second_on_the.requirements = [third_moon.name] self.assertEqual( - self.dependency_resolver.graph['__first/man'], + self.dependency_resolver.dependencies['__first/man'], [third_moon, second_on_the, first_man] ) @@ -79,10 +79,10 @@ class ResolverTestCase(test.CdistTestCase): first_man.requirements = [first_woman.name] first_woman.requirements = [first_man.name] with self.assertRaises(resolver.CircularReferenceError): - self.dependency_resolver.graph + self.dependency_resolver.dependencies def test_requirement_not_found(self): first_man = self.object_index['__first/man'] first_man.requirements = ['__does/not/exist'] with self.assertRaises(cdist.Error): - self.dependency_resolver.graph + self.dependency_resolver.dependencies From 69badd6f2d5f7cd7a885acce06e4fc53f774df6d Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Thu, 10 May 2012 15:51:22 +0000 Subject: [PATCH 042/412] s/nows about/knows about/ Signed-off-by: Chris Lamb --- doc/man/man7/cdist-manifest.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/man/man7/cdist-manifest.text b/doc/man/man7/cdist-manifest.text index 1f0e253d..b9dfe655 100644 --- a/doc/man/man7/cdist-manifest.text +++ b/doc/man/man7/cdist-manifest.text @@ -47,7 +47,7 @@ on given conditions. INITIAL AND TYPE MANIFESTS -------------------------- -Cdist nows about two types of manifests: The initial manifest and type +Cdist knows about two types of manifests: The initial manifest and type manifests. The initial manifest is used to define, which configurations to apply to which hosts. The type manifests are used to create objects from types. More about manifests in types can be found in cdist-type(7). From 1557630e91bdd4823522310284707ece25ffa65e Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Thu, 10 May 2012 16:20:43 +0000 Subject: [PATCH 043/412] s/specifiend/specified/ Signed-off-by: Chris Lamb --- conf/type/__addifnosuchline/man.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__addifnosuchline/man.text b/conf/type/__addifnosuchline/man.text index 3051ff36..ba3825ff 100644 --- a/conf/type/__addifnosuchline/man.text +++ b/conf/type/__addifnosuchline/man.text @@ -33,7 +33,7 @@ EXAMPLES -------- -------------------------------------------------------------------------------- -# Creates or appends the line specifiend in "include_www" to the file "lighttpd.conf" +# Creates or appends the line specified in "include_www" to the file "lighttpd.conf" __addifnosuchline www --file /etc/lighttpd.conf --line include_www # Adds the line "include_git" to the file "lighttpd.conf" From 42bcbc532b60672f4e208cde1c19d5d8055a3bcb Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Mon, 14 May 2012 16:00:02 +0100 Subject: [PATCH 044/412] Freenode.net, not freenode.org. Signed-off-by: Chris Lamb --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 73e5c210..abd38401 100644 --- a/README +++ b/README @@ -259,7 +259,7 @@ need to replace **\_\_file** calls in your manifests: ### IRC You can join the development ***IRC channel*** -[#cstar on irc.freenode.org](irc://irc.freenode.org/#cstar). +[#cstar on irc.freenode.net](irc://irc.freenode.org/#cstar). ### Mailing list From b2c21e24a95c1eed82fade6c2fe3381cf72332ff Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 14 May 2012 18:32:45 +0200 Subject: [PATCH 045/412] publishing more verbose Signed-off-by: Nico Schottelius --- build | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build b/build index b209e1c2..bec7f5a9 100755 --- a/build +++ b/build @@ -126,11 +126,11 @@ case "$1" in rm -f latest && ln -sf "$version" latest" ;; - p|pu|pub) - git push --mirror - git push --mirror github - git push --mirror sf - git push --mirror ethz + p|pu|pub) + for remote in "" github sf ethz; do + echo "Pushing to $remote" + git push --mirror $remote + done ;; clean) From d02a1374dd5817c15ef328d013e110d359aacae0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 14 May 2012 18:32:55 +0200 Subject: [PATCH 046/412] ++changes(2.0.10) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 980e0cdf..4ec97ab1 100644 --- a/doc/changelog +++ b/doc/changelog @@ -14,6 +14,7 @@ Changelog * Feature core: Correct parent dependency handling (Steven Armstrong) * Bugfix several types: Fix sed for FreeBSD (Istvan Beregszaszi) * New Type: __jail (Jake Guffey) + * Various smaller bugfixes (Chris Lamb) 2.0.9: 2012-03-12 * Cleanup documentation: Fix environment variable list to be properly From f1e8bfb8a766035d2556066b5522c6a51a3df9d1 Mon Sep 17 00:00:00 2001 From: Evax Software Date: Tue, 15 May 2012 09:58:45 +0200 Subject: [PATCH 047/412] improve version printing when run from a checkout --- lib/cdist/__init__.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index bd8e6483..3bde31ad 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -19,7 +19,17 @@ # # -VERSION = "2.0.9" +import os +import subprocess + +try: + with open(os.devnull, 'w') as devnull: + here = os.path.dirname(os.path.realpath(__file__)) + VERSION = subprocess.check_output( + 'cd "%s" && git describe' % here, + stderr=devnull, shell=True).decode('utf-8') +except: + VERSION = "2.0.9" BANNER = """ .. . .x+=:. s @@ -38,8 +48,6 @@ BANNER = """ DOT_CDIST = ".cdist" -import os - class Error(Exception): """Base exception class for this project""" pass From dfd60ca837c65c22391f9d70f5a93b782de5dc69 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 May 2012 10:08:19 +0200 Subject: [PATCH 048/412] __package uses present/absent Signed-off-by: Nico Schottelius --- conf/type/__rvm/manifest | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/type/__rvm/manifest b/conf/type/__rvm/manifest index 8e63a2c5..482c0d17 100755 --- a/conf/type/__rvm/manifest +++ b/conf/type/__rvm/manifest @@ -19,7 +19,7 @@ # # rvm core dependencies -__package bash --state installed -__package curl --state installed -__package git-core --state installed -__package patch --state installed +__package bash --state present +__package curl --state present +__package git-core --state present +__package patch --state present From 196fb7e656b69db5bd37245cc4ecee66a726b89f Mon Sep 17 00:00:00 2001 From: Evax Software Date: Fri, 18 May 2012 10:43:39 +0200 Subject: [PATCH 049/412] use new rvm install command (fixes #67) --- conf/type/__rvm/gencode-remote | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/type/__rvm/gencode-remote b/conf/type/__rvm/gencode-remote index 1ba1d499..fe9cc5f8 100755 --- a/conf/type/__rvm/gencode-remote +++ b/conf/type/__rvm/gencode-remote @@ -25,8 +25,7 @@ if [ "$state_is" != "$state_should" ]; then case "$state_should" in installed) cat << DONE -su - $user -c "bash -s stable < <(curl -s \ -https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)" +su - $user -c "curl -L get.rvm.io | bash -s stable" DONE ;; removed) From 5c700184119e0fbc1cade425f8dda5b551683e9a Mon Sep 17 00:00:00 2001 From: Evax Software Date: Fri, 18 May 2012 10:55:28 +0200 Subject: [PATCH 050/412] switch the __rvm type to the new present/absent state scheme --- conf/type/__rvm/explorer/state | 4 ++-- conf/type/__rvm/gencode-remote | 4 ++-- conf/type/__rvm/man.text | 6 +++--- conf/type/__rvm_gem/explorer/state | 6 +++--- conf/type/__rvm_gem/gencode-remote | 4 ++-- conf/type/__rvm_gem/man.text | 8 ++++---- conf/type/__rvm_gem/manifest | 6 +++--- conf/type/__rvm_gemset/explorer/state | 6 +++--- conf/type/__rvm_gemset/gencode-remote | 4 ++-- conf/type/__rvm_gemset/man.text | 8 ++++---- conf/type/__rvm_gemset/manifest | 4 ++-- conf/type/__rvm_ruby/explorer/state | 6 +++--- conf/type/__rvm_ruby/gencode-remote | 4 ++-- conf/type/__rvm_ruby/man.text | 8 ++++---- conf/type/__rvm_ruby/manifest | 4 ++-- 15 files changed, 41 insertions(+), 41 deletions(-) diff --git a/conf/type/__rvm/explorer/state b/conf/type/__rvm/explorer/state index 92fa6e07..d0da0d86 100755 --- a/conf/type/__rvm/explorer/state +++ b/conf/type/__rvm/explorer/state @@ -20,7 +20,7 @@ user="$__object_id" if su - $user -c "[ -d \"\$HOME/.rvm\" ]" ; then - echo "installed" + echo "present" else - echo "removed" + echo "absent" fi diff --git a/conf/type/__rvm/gencode-remote b/conf/type/__rvm/gencode-remote index fe9cc5f8..6c661302 100755 --- a/conf/type/__rvm/gencode-remote +++ b/conf/type/__rvm/gencode-remote @@ -23,12 +23,12 @@ state_is="$(cat "$__object/explorer/state")" state_should="$(cat "$__object/parameter/state")" if [ "$state_is" != "$state_should" ]; then case "$state_should" in - installed) + present) cat << DONE su - $user -c "curl -L get.rvm.io | bash -s stable" DONE ;; - removed) + absent) cat << DONE su - $user -c "rm -Rf \"\\\$HOME/.rvm\"; sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" > \"\\\$HOME/.bashrc.cdist-tmp\" diff --git a/conf/type/__rvm/man.text b/conf/type/__rvm/man.text index d54e2d1b..0a355dc6 100644 --- a/conf/type/__rvm/man.text +++ b/conf/type/__rvm/man.text @@ -16,7 +16,7 @@ RVM is the Ruby enVironment Manager for the Ruby programming language. REQUIRED PARAMETERS ------------------- state:: - Either "installed" or "removed". + Either "present" or "absent". EXAMPLES @@ -24,10 +24,10 @@ EXAMPLES -------------------------------------------------------------------------------- # Install rvm for user billie -__rvm billie --state installed +__rvm billie --state present # Remove rvm -__rvm billie --state removed +__rvm billie --state absent -------------------------------------------------------------------------------- diff --git a/conf/type/__rvm_gem/explorer/state b/conf/type/__rvm_gem/explorer/state index b0232985..09509a2e 100755 --- a/conf/type/__rvm_gem/explorer/state +++ b/conf/type/__rvm_gem/explorer/state @@ -24,7 +24,7 @@ ruby="$(echo "$gemset" | cut -d '@' -f 1)" gemsetname="$(echo "$gemset" | cut -d '@' -f2)" user="$(cat "$__object/parameter/user")" if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then - echo "removed" + echo "absent" exit 0 fi if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\" @@ -32,8 +32,8 @@ rvm list | grep -q $ruby"; then if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\" rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname && rvm use $gemset > /dev/null && gem list | grep -q $gem"; then - echo "installed" + echo "present" exit 0 fi fi -echo "removed" +echo "absent" diff --git a/conf/type/__rvm_gem/gencode-remote b/conf/type/__rvm_gem/gencode-remote index 80e1becf..34a69624 100755 --- a/conf/type/__rvm_gem/gencode-remote +++ b/conf/type/__rvm_gem/gencode-remote @@ -27,13 +27,13 @@ user="$(cat "$__object/parameter/user")" state_should="$(cat "$__object/parameter/state")" if [ "$state_is" != "$state_should" ]; then case "$state_should" in - installed) + present) cat << DONE su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" rvm use $gemset; gem install $gem" DONE ;; - removed) + absent) cat << DONE su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" rvm use $gemset; gem uninstall $gem" diff --git a/conf/type/__rvm_gem/man.text b/conf/type/__rvm_gem/man.text index 27b16053..85b52d65 100644 --- a/conf/type/__rvm_gem/man.text +++ b/conf/type/__rvm_gem/man.text @@ -20,7 +20,7 @@ user:: gemset:: The gemset to use state:: - Either "installed" or "removed". + Either "present" or "absent". OPTIONAL PARAMETERS ------------------- @@ -32,14 +32,14 @@ EXAMPLES -------------------------------------------------------------------------------- # Install the rails gem in gemset ruby-1.9.3-p0@myset for user bill -__rvm_gemset rails --gemset ruby-1.9.3-p0@myset --user bill --state installed +__rvm_gemset rails --gemset ruby-1.9.3-p0@myset --user bill --state present # Do the same and also make ruby-1.9.3-p0@myset the default gemset __rvm_gemset rails --gemset ruby-1.9.3-p0@myset --user bill \ - --state installed --default yes + --state present --default yes # Remove it -__rvm_ruby rails --gemset ruby-1.9.3-p0@myset --user bill --state removed +__rvm_ruby rails --gemset ruby-1.9.3-p0@myset --user bill --state absent -------------------------------------------------------------------------------- diff --git a/conf/type/__rvm_gem/manifest b/conf/type/__rvm_gem/manifest index 245c865d..a551472d 100755 --- a/conf/type/__rvm_gem/manifest +++ b/conf/type/__rvm_gem/manifest @@ -31,8 +31,8 @@ else echo $default > "$__object/parameter/default" fi -__rvm "$user" --state installed +__rvm "$user" --state present require="__rvm/$user" \ - __rvm_ruby $ruby --user "$user" --state installed --default $default + __rvm_ruby $ruby --user "$user" --state present --default $default require="__rvm_ruby/$ruby" \ - __rvm_gemset $gemset --user "$user" --state installed --default $default + __rvm_gemset $gemset --user "$user" --state present --default $default diff --git a/conf/type/__rvm_gemset/explorer/state b/conf/type/__rvm_gemset/explorer/state index b33f570e..fbf11830 100755 --- a/conf/type/__rvm_gemset/explorer/state +++ b/conf/type/__rvm_gemset/explorer/state @@ -23,15 +23,15 @@ ruby="$(echo "$gemset" | cut -d '@' -f 1)" gemsetname="$(echo "$gemset" | cut -d '@' -f2)" user="$(cat "$__object/parameter/user")" if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then - echo "removed" + echo "absent" exit 0 fi if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\" rvm list | grep -q $ruby"; then if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\" rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname"; then - echo "installed" + echo "present" exit 0 fi fi -echo "removed" +echo "absent" diff --git a/conf/type/__rvm_gemset/gencode-remote b/conf/type/__rvm_gemset/gencode-remote index 0e240462..75cc833a 100755 --- a/conf/type/__rvm_gemset/gencode-remote +++ b/conf/type/__rvm_gemset/gencode-remote @@ -27,7 +27,7 @@ default="$(cat "$__object/parameter/default")" state_should="$(cat "$__object/parameter/state")" if [ "$state_is" != "$state_should" ]; then case "$state_should" in - installed) + present) cat << DONE su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" rvm $gemset --create" @@ -43,7 +43,7 @@ DONE ;; esac ;; - removed) + absent) cat << DONE su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" rvm use $ruby; rvm --force gemset delete $gemsetname" diff --git a/conf/type/__rvm_gemset/man.text b/conf/type/__rvm_gemset/man.text index f1e3f2bf..10b6b411 100644 --- a/conf/type/__rvm_gemset/man.text +++ b/conf/type/__rvm_gemset/man.text @@ -18,7 +18,7 @@ REQUIRED PARAMETERS user:: The remote user account to use state:: - Either "installed" or "removed". + Either "present" or "absent". OPTIONAL PARAMETERS ------------------- @@ -30,13 +30,13 @@ EXAMPLES -------------------------------------------------------------------------------- # Install the gemset @myset for user charles on based on ruby-1.9.3-0 -__rvm_gemset ruby-1.9.3-p0@myset --user charles --state installed +__rvm_gemset ruby-1.9.3-p0@myset --user charles --state present # Do the same and make ruby-1.9.3-p0@myset the default gemset -__rvm_gemset ruby-1.9.3-p0@myset --user charles --state installed --default yes +__rvm_gemset ruby-1.9.3-p0@myset --user charles --state present --default yes # Remove the gemset @myset for user john -__rvm_ruby ruby-1.9.3-p0@myset --user john --state removed +__rvm_ruby ruby-1.9.3-p0@myset --user john --state absent -------------------------------------------------------------------------------- diff --git a/conf/type/__rvm_gemset/manifest b/conf/type/__rvm_gemset/manifest index 4fdf9cb1..b69395ea 100755 --- a/conf/type/__rvm_gemset/manifest +++ b/conf/type/__rvm_gemset/manifest @@ -30,7 +30,7 @@ else echo $default > "$__object/parameter/default" fi -__rvm "$user" --state installed +__rvm "$user" --state present require="__rvm/$user" \ - __rvm_ruby $ruby --user "$user" --state installed --default $default + __rvm_ruby $ruby --user "$user" --state present --default $default diff --git a/conf/type/__rvm_ruby/explorer/state b/conf/type/__rvm_ruby/explorer/state index 71d682be..43dafd4f 100755 --- a/conf/type/__rvm_ruby/explorer/state +++ b/conf/type/__rvm_ruby/explorer/state @@ -21,12 +21,12 @@ ruby="$__object_id" user="$(cat "$__object/parameter/user")" if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then - echo "removed" + echo "absent" exit 0 fi if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\" rvm list | grep -q $ruby"; then - echo "installed" + echo "present" else - echo "removed" + echo "absent" fi diff --git a/conf/type/__rvm_ruby/gencode-remote b/conf/type/__rvm_ruby/gencode-remote index a3bcf318..b25b4fe9 100755 --- a/conf/type/__rvm_ruby/gencode-remote +++ b/conf/type/__rvm_ruby/gencode-remote @@ -25,7 +25,7 @@ default="$(cat "$__object/parameter/default")" state_should="$(cat "$__object/parameter/state")" if [ "$state_is" != "$state_should" ]; then case "$state_should" in - installed) + present) echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\ "rvm install $ruby\"" case "$default" in @@ -37,7 +37,7 @@ if [ "$state_is" != "$state_should" ]; then ;; esac ;; - removed) + absent) echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\ "rvm remove $ruby\"" ;; diff --git a/conf/type/__rvm_ruby/man.text b/conf/type/__rvm_ruby/man.text index c3183a7b..c558cfe3 100644 --- a/conf/type/__rvm_ruby/man.text +++ b/conf/type/__rvm_ruby/man.text @@ -18,7 +18,7 @@ REQUIRED PARAMETERS user:: The remote user account to use state:: - Either "installed" or "removed". + Either "present" or "absent". OPTIONAL PARAMETERS ------------------- @@ -30,13 +30,13 @@ EXAMPLES -------------------------------------------------------------------------------- # Install ruby 1.9.3 through rvm for user thelonious -__rvm_ruby ruby-1.9.3-p0 --user thelonious --state installed +__rvm_ruby ruby-1.9.3-p0 --user thelonious --state present # Install ruby 1.9.3 through rvm for user ornette and make it the default -__rvm_ruby ruby-1.9.3-p0 --user ornette --state installed --default yes +__rvm_ruby ruby-1.9.3-p0 --user ornette --state present --default yes # Remove ruby 1.9.3 for user john -__rvm_ruby ruby-1.9.3-p0 --user john --state removed +__rvm_ruby ruby-1.9.3-p0 --user john --state absent -------------------------------------------------------------------------------- diff --git a/conf/type/__rvm_ruby/manifest b/conf/type/__rvm_ruby/manifest index c6e31244..581e98a8 100755 --- a/conf/type/__rvm_ruby/manifest +++ b/conf/type/__rvm_ruby/manifest @@ -78,6 +78,6 @@ case "$ruby" in ;; esac deps=$(eval echo \$$deps_list) -for p in $deps; do __package_${type} $p --state installed; done +for p in $deps; do __package_${type} $p --state present; done -__rvm "$user" --state installed +__rvm "$user" --state present From dee266aca00a728045b3f5a70ede57e058366b4e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 May 2012 16:39:13 +0200 Subject: [PATCH 051/412] ignore "no crontab for ..." message Signed-off-by: Nico Schottelius --- conf/type/__cron/explorer/entry | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__cron/explorer/entry b/conf/type/__cron/explorer/entry index 362c96fe..1b4bec42 100755 --- a/conf/type/__cron/explorer/entry +++ b/conf/type/__cron/explorer/entry @@ -24,7 +24,7 @@ user="$(cat "$__object/parameter/user")" prefix="#cdist:__cron/$name" suffix="#/cdist:__cron/$name" -crontab -u $user -l | awk -v prefix="$prefix" -v suffix="$suffix" ' +crontab -u $user -l 2>/dev/null | awk -v prefix="$prefix" -v suffix="$suffix" ' { if (index($0,prefix)) { triggered=1 From f873f12d77323516912ecbb165406d0da8178138 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 May 2012 16:39:55 +0200 Subject: [PATCH 052/412] ++changes(2.0.10) Signed-off-by: Nico Schottelius --- doc/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/changelog b/doc/changelog index 4ec97ab1..958da987 100644 --- a/doc/changelog +++ b/doc/changelog @@ -14,6 +14,8 @@ Changelog * Feature core: Correct parent dependency handling (Steven Armstrong) * Bugfix several types: Fix sed for FreeBSD (Istvan Beregszaszi) * New Type: __jail (Jake Guffey) + * Change Type: __rvm*: --state present/absent not installed/remvoed (Evax Software) + * Bugfix Type: __cron: Hide error output from crontab * Various smaller bugfixes (Chris Lamb) 2.0.9: 2012-03-12 From cd79d2b1eb1959cb91629629c6b11d827d096d08 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 May 2012 16:41:51 +0200 Subject: [PATCH 053/412] ++version 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 bd8e6483..0817a1cb 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -19,7 +19,7 @@ # # -VERSION = "2.0.9" +VERSION = "2.0.10" BANNER = """ .. . .x+=:. s From ab53f471f8915607314bdbf786d33b4c49d5b04c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 May 2012 16:42:14 +0200 Subject: [PATCH 054/412] ++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 958da987..63fcb6b0 100644 --- a/doc/changelog +++ b/doc/changelog @@ -4,7 +4,7 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -2.0.10: +2.0.10: 2012-05-18 * Cleanup __group: No getent gshadow in old Redhat, use groupmod -g (Matt Coddington) * Bugfix __package_yum: Missing cat From c7fbdc8195f781d3affe82538f09ccb9b9759ae5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 May 2012 12:40:38 +0200 Subject: [PATCH 055/412] add --remote-exec and --remote-copy to command line args Signed-off-by: Nico Schottelius --- bin/cdist | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/cdist b/bin/cdist index c6467477..897ddbfc 100755 --- a/bin/cdist +++ b/bin/cdist @@ -68,6 +68,12 @@ def commandline(): parser['configinstall'].add_argument('-s', '--sequential', help='Operate on multiple hosts sequentially (default)', action='store_false', dest='parallel') + parser['configinstall'].add_argument('--remote-exec', + help='Command to use for remote execution (should behave like ssh)', + action='store_true', dest='remote_exec') + parser['configinstall'].add_argument('--remote-copy', + help='Command to use for remote copy (should behave like scp)', + action='store_true', dest='remote_copy') # Config parser['config'] = parser['sub'].add_parser('config', From 108283bbebb8319bcc99946eb58262e275f34cb6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 May 2012 13:01:31 +0200 Subject: [PATCH 056/412] add default values in argparse Signed-off-by: Nico Schottelius --- bin/cdist | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index 897ddbfc..e011ec6d 100755 --- a/bin/cdist +++ b/bin/cdist @@ -68,12 +68,15 @@ def commandline(): parser['configinstall'].add_argument('-s', '--sequential', help='Operate on multiple hosts sequentially (default)', action='store_false', dest='parallel') - parser['configinstall'].add_argument('--remote-exec', - help='Command to use for remote execution (should behave like ssh)', - action='store_true', dest='remote_exec') + parser['configinstall'].add_argument('--remote-copy', help='Command to use for remote copy (should behave like scp)', - action='store_true', dest='remote_copy') + action='store', dest='remote_copy', + default="scp -o User=root -q") + parser['configinstall'].add_argument('--remote-exec', + help='Command to use for remote execution (should behave like ssh)', + action='store', dest='remote_exec', + default="ssh -o User=root -q") # Config parser['config'] = parser['sub'].add_parser('config', @@ -165,6 +168,8 @@ def configinstall_onehost(host, args, mode, parallel): context = cdist.context.Context( target_host=host, + remote_copy=args.remote_copy, + remote_exec=args.remote_exec, initial_manifest=args.manifest, base_path=args.cdist_home, exec_path=sys.argv[0], From 9f319ae1213caf8b36ceaf3708d20981442f4f2e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 May 2012 14:55:11 +0200 Subject: [PATCH 057/412] support passing remote_{exec, copy} to context Signed-off-by: Nico Schottelius --- lib/cdist/context.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/cdist/context.py b/lib/cdist/context.py index ab8677a7..c38d6b94 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -35,6 +35,8 @@ class Context(object): def __init__(self, target_host, + remote_copy, + remote_exec, initial_manifest=False, base_path=False, exec_path=sys.argv[0], @@ -70,10 +72,18 @@ class Context(object): self.initial_manifest = (initial_manifest or os.path.join(self.local.manifest_path, "init")) - # Remote + _init_remote(remote_copy, remote_exec) + + # Remote stuff + def _init_remote(self, remote_copy, remote_exec): + self.remote_base_path = os.environ.get('__cdist_remote_out_dir', "/var/lib/cdist") - 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_copy = remote_copy + self.remote_exec = remote_exec + + os.environ['__remote_copy'] = self.remote_copy + os.environ['__remote_exec'] = self.remote_exec + self.remote = remote.Remote(self.target_host, self.remote_base_path, self.remote_exec, self.remote_copy) From 26d7eab852bae2eb43de9bcd4b615fc2ca0fa31e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 May 2012 15:06:04 +0200 Subject: [PATCH 058/412] document change + manpage Signed-off-by: Nico Schottelius --- doc/changelog | 3 +++ doc/man/man1/cdist.text | 29 ++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/doc/changelog b/doc/changelog index 63fcb6b0..966e876e 100644 --- a/doc/changelog +++ b/doc/changelog @@ -4,6 +4,9 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius +2.0.11: + * Add support for --remote-exec and --remote-copy parameters + 2.0.10: 2012-05-18 * Cleanup __group: No getent gshadow in old Redhat, use groupmod -g (Matt Coddington) diff --git a/doc/man/man1/cdist.text b/doc/man/man1/cdist.text index e46e84a3..b92fba18 100644 --- a/doc/man/man1/cdist.text +++ b/doc/man/man1/cdist.text @@ -41,23 +41,29 @@ CONFIG Configure a system -h, --help:: - Show the help screen + Show the help screen -c CDIST_HOME, --cdist-home CDIST_HOME:: - Instead of using the parent of the bin directory as cdist home, - use the specified directory + Instead of using the parent of the bin directory as cdist home, + use the specified directory -d, --debug:: - Enable debug output + Enable debug output -i MANIFEST, --initial-manifest MANIFEST:: - Path to a cdist manifest or - to read from stdin + Path to a cdist manifest or - to read from stdin -p, --parallel:: - Operate on multiple hosts in parallel + Operate on multiple hosts in parallel -s, --sequential:: - Operate on multiple hosts sequentially + Operate on multiple hosts sequentially + +--remote-copy REMOTE_COPY: + Command to use for remote copy (should behave like scp) + +--remote-exec REMOTE_EXEC: + Command to use for remote execution (should behave like ssh) EXAMPLES @@ -69,7 +75,12 @@ cdist config -d ikq05.ethz.ch # Configure hosts in parallel and use a different home directory cdist config -c ~/p/cdist-nutzung \ - -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch + -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch + +# Use custom remote exec / copy commands +cdist config --remote-exec /path/to/my/remote/exec \ + --remote-copy /path/to/my/remote/copy \ + -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch # Display banner cdist banner @@ -98,7 +109,7 @@ The following exit values shall be returned: 0:: Successful completion 1:: - One or more host configuration failed. + One or more host configurations failed SEE ALSO From 02bd4fdf3fb75b118a767d6a99288e1a3f2ab1d9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 May 2012 15:10:02 +0200 Subject: [PATCH 059/412] add template for tutorial for remote-exec-copy Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-remote-exec-copy.text | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 doc/man/man7/cdist-remote-exec-copy.text diff --git a/doc/man/man7/cdist-remote-exec-copy.text b/doc/man/man7/cdist-remote-exec-copy.text new file mode 100644 index 00000000..6010907a --- /dev/null +++ b/doc/man/man7/cdist-remote-exec-copy.text @@ -0,0 +1,35 @@ +cdist-remote-exec-copy(7) +========================= +Nico Schottelius +STEVEN HERE + + +NAME +---- +cdist-remote-exec-copy - How to get use remote exec and copy + + +INTRO +------- +What it is, how it works + + +EXAMPLES +-------------- +nfsroot, sudo (?), what exists + + +HACKER INFORMATION +------------------ +Not sure if needed, but may be helpful to explain how it +works internally + +SEE ALSO +-------- +- cdist(7) + + +COPYING +------- +Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). From 67a95b50aae82d818b32fef3f1ca022158f12345 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 May 2012 16:01:03 +0200 Subject: [PATCH 060/412] cool solution for variable sending 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 11235f8a..87fc91c5 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -9,6 +9,8 @@ CORE - document and add paremeters for remote-copy and remote-exec! - remove hack, make a feature of it +- remove var=foo calls on remote side. Use -o SendEnv (yeah, see ssh_config(5)) + TESTS ----- - multiple defines of object: From 1b8b54f84fe6a23e531eb7a55528677b1fb18054 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 May 2012 17:21:58 +0200 Subject: [PATCH 061/412] use os.umask locally 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 d3c6a0ce..8c9ef209 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -60,6 +60,9 @@ class Local(object): self.log = logging.getLogger(self.target_host) + # Setup file permissions using umask + os.umask(0o700) + def create_directories(self): self.mkdir(self.out_path) self.mkdir(self.global_explorer_out_path) @@ -73,8 +76,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) + os.makedirs(path, exist_ok=True) def run(self, command, env=None, return_output=False): """Run the given command with the given environment. From e05c5e699c4b36ec7db99a7322f357a984c6bfaa Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 May 2012 17:24:58 +0200 Subject: [PATCH 062/412] always call umask 077 before doing stuff on the remote side Signed-off-by: Nico Schottelius --- lib/cdist/exec/remote.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index 11b8c78e..173d1984 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -105,6 +105,9 @@ class Remote(object): cmd = self._exec.split() cmd.append(self.target_host) + # Always call umask before actual call to ensure proper file permissions + cmd.append("umask 077;") + # can't pass environment to remote side, so prepend command with # variable declarations if env: From 612fb4cb7b070f0a4d988db08751c1db0a7b285b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 May 2012 17:27:38 +0200 Subject: [PATCH 063/412] fix type and add fixme Signed-off-by: Nico Schottelius --- lib/cdist/exec/local.py | 2 +- lib/cdist/exec/remote.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index 8c9ef209..e510a8fb 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -61,7 +61,7 @@ class Local(object): self.log = logging.getLogger(self.target_host) # Setup file permissions using umask - os.umask(0o700) + os.umask(0o077) def create_directories(self): self.mkdir(self.out_path) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index 173d1984..fb90939d 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -108,6 +108,7 @@ class Remote(object): # Always call umask before actual call to ensure proper file permissions cmd.append("umask 077;") + # FIXME: replace this by -o SendEnv name -o SendEnv name ... to ssh? # can't pass environment to remote side, so prepend command with # variable declarations if env: From 4017667952ad663b5c63a900f2ad93acd95ca7c5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 22 May 2012 17:28:38 +0200 Subject: [PATCH 064/412] ++changes(2.0.11) Signed-off-by: Nico Schottelius --- doc/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/changelog b/doc/changelog index 63fcb6b0..d3202c70 100644 --- a/doc/changelog +++ b/doc/changelog @@ -4,6 +4,9 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius +2.0.11: + * Fix insecure file/directory creation: Use umask 077 + 2.0.10: 2012-05-18 * Cleanup __group: No getent gshadow in old Redhat, use groupmod -g (Matt Coddington) From cfc20ce4eed5b556b72bcc0747432a2a95ff98c5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 23 May 2012 14:17:05 +0200 Subject: [PATCH 065/412] match on new version location in releasescript 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 eba81dc0..92c603d6 100755 --- a/doc/dev/releasechecklist +++ b/doc/dev/releasechecklist @@ -13,7 +13,7 @@ echo "Testing documentation..." # get version changelog_version=$(grep '^[[:digit:]]' doc/changelog | head -n1 | sed 's/:.*//') #git_version=$(git describe) -lib_version=$(grep ^VERSION lib/cdist/__init__.py | sed -e 's/.*= //' -e 's/"//g') +lib_version=$(grep ^ VERSION lib/cdist/__init__.py | sed -e 's/.*= //' -e 's/"//g') # get date date_today="$(date +%Y-%m-%d)" From d2fbd1565529207e9e98a5c8a023c825d670ece1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 23 May 2012 14:17:49 +0200 Subject: [PATCH 066/412] ++version=2.0.11 Signed-off-by: Nico Schottelius --- doc/changelog | 2 +- lib/cdist/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/changelog b/doc/changelog index d3202c70..e2605009 100644 --- a/doc/changelog +++ b/doc/changelog @@ -4,7 +4,7 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -2.0.11: +2.0.11: 2012-05-23 * Fix insecure file/directory creation: Use umask 077 2.0.10: 2012-05-18 diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index b9289911..35dc72c7 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -29,7 +29,7 @@ try: 'cd "%s" && git describe' % here, stderr=devnull, shell=True).decode('utf-8') except: - VERSION = "2.0.10" + VERSION = "2.0.11" BANNER = """ .. . .x+=:. s From 7c7a6218759329618cec0919f30177e6c4d22bbb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 23 May 2012 14:19:58 +0200 Subject: [PATCH 067/412] fix manpage compile error Signed-off-by: Nico Schottelius --- conf/type/__jail/man.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__jail/man.text b/conf/type/__jail/man.text index b6725bde..8682effe 100644 --- a/conf/type/__jail/man.text +++ b/conf/type/__jail/man.text @@ -1,5 +1,5 @@ cdist-type__jail(7) -========================== +=================== Jake Guffey From a1879ebe0c7076c6345efdd4f0a6e7a78811ca2a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 23 May 2012 14:34:21 +0200 Subject: [PATCH 068/412] ++ quotes 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 92c603d6..410c988e 100755 --- a/doc/dev/releasechecklist +++ b/doc/dev/releasechecklist @@ -13,7 +13,7 @@ echo "Testing documentation..." # get version changelog_version=$(grep '^[[:digit:]]' doc/changelog | head -n1 | sed 's/:.*//') #git_version=$(git describe) -lib_version=$(grep ^ VERSION lib/cdist/__init__.py | sed -e 's/.*= //' -e 's/"//g') +lib_version=$(grep "^ VERSION" lib/cdist/__init__.py | sed -e 's/.*= //' -e 's/"//g') # get date date_today="$(date +%Y-%m-%d)" From 995e2c44eea7fe714bbcd71fbaff5aeae963e955 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 23 May 2012 14:39:41 +0200 Subject: [PATCH 069/412] correctly create branch variable Signed-off-by: Nico Schottelius --- doc/dev/releasechecklist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/dev/releasechecklist b/doc/dev/releasechecklist index 410c988e..71f2979e 100755 --- a/doc/dev/releasechecklist +++ b/doc/dev/releasechecklist @@ -41,7 +41,7 @@ read wait version=$lib_version # get target branch -branch=${version%.?} +branch=${version%\.*} # add tag printf "Enter tag description for %s> " "$version" @@ -49,7 +49,7 @@ read tagmessage git tag "$version" -m "$tagmessage" # Import into current version branch -printf "Press enter to git merge into $branch > " +printf "Press enter to git merge into branch \"$branch\" > " read prompt git checkout $branch git merge master From f2c71aab2ee109c44e65377b58794f3ade984618 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 23 May 2012 14:54:32 +0200 Subject: [PATCH 070/412] update description Signed-off-by: Nico Schottelius --- README | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README b/README index abd38401..ce494906 100644 --- a/README +++ b/README @@ -19,6 +19,9 @@ ## Introduction +cdist is a usable configuration management system. It adheres to +the KISS principle and is being used in small up to enterprise grade +environments. cdist is an alternative to other configuration management systems like [cfengine](http://www.cfengine.org/), [bcfg2](http://trac.mcs.anl.gov/projects/bcfg2), From f795b83c8e1af77208c0d610ddf578c271668b5c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 24 May 2012 15:15:38 +0200 Subject: [PATCH 071/412] prevent a hen/egg problem when handling unsupported python versions Signed-off-by: Steven Armstrong --- bin/cdist | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/cdist b/bin/cdist index c6467477..8d0dfc76 100755 --- a/bin/cdist +++ b/bin/cdist @@ -194,6 +194,13 @@ if __name__ == "__main__": # Sys is needed for sys.exit() import sys + cdistpythonversion = '3.2' + if sys.version < cdistpythonversion: + print('Cdist requires Python >= ' + cdistpythonversion + + ' on the source host.', file=sys.stderr) + sys.exit(1) + + exit_code = 0 try: @@ -201,11 +208,6 @@ if __name__ == "__main__": import os import re - cdistpythonversion = '3.2' - if sys.version < cdistpythonversion: - raise cdist.Error('Cdist requires Python >= ' + cdistpythonversion + - ' on the source host.') - # 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'))) From 2e930d5f25d0b7ac2811eea8ea026f6be3d210c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Thu, 24 May 2012 15:45:20 +0200 Subject: [PATCH 072/412] Add python3.2 for Debian squeezy how-to. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Gross --- README | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README b/README index ce494906..4521f80e 100644 --- a/README +++ b/README @@ -112,6 +112,21 @@ For Debian >= wheezy: For older Debian versions, installing python 3.2 manually is required. +On squeeze you can add following line in **/etc/apt/sources.list** + + deb http://ftp.debian.org/debian wheezy main + +And don't forget the pinning entry in **/etc/apt/preferences.d/wheezy**: + + Package: * + Pin: release n=wheezy + Pin-Priority: 1 + +Please be aware that both **openssh-server** and **openssh-client** might be +removed on **pyhton3.2** installation. You surely want to reinstall them: + + apt-get install -t wheezy openssh-server openssh-client + #### Fedora For Fedora >= 15: From 67bf4d15830f0fedf02dc18da17695c971cd5772 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 May 2012 15:50:31 +0200 Subject: [PATCH 073/412] Fix typos Signed-off-by: Nico Schottelius --- README | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README b/README index 4521f80e..932375c4 100644 --- a/README +++ b/README @@ -110,23 +110,24 @@ For Debian >= wheezy: aptitude install python3 -For older Debian versions, installing python 3.2 manually is required. - On squeeze you can add following line in **/etc/apt/sources.list** deb http://ftp.debian.org/debian wheezy main -And don't forget the pinning entry in **/etc/apt/preferences.d/wheezy**: +And add pinning entry in **/etc/apt/preferences.d/wheezy**: Package: * Pin: release n=wheezy Pin-Priority: 1 Please be aware that both **openssh-server** and **openssh-client** might be -removed on **pyhton3.2** installation. You surely want to reinstall them: +removed on **python3.2** installation. You surely want to reinstall them: apt-get install -t wheezy openssh-server openssh-client +For older Debian versions, installing python 3.2 manually is required. + + #### Fedora For Fedora >= 15: From 3013f6c96a1062c03f0903c859b99ff0efe3ea19 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 May 2012 15:51:28 +0200 Subject: [PATCH 074/412] ++changes(2.0.12) Signed-off-by: Nico Schottelius --- doc/changelog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/changelog b/doc/changelog index e2605009..0e10533b 100644 --- a/doc/changelog +++ b/doc/changelog @@ -4,6 +4,10 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius +2.0.12: + * Core: Correctly raise error on Python < 3.2 (Steven Armtrong) + * Documentation: Debian Squeeze hints (Sébastien Gross) + 2.0.11: 2012-05-23 * Fix insecure file/directory creation: Use umask 077 From b92621cad710dccd132ae4c79de3256b8d04db74 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 May 2012 15:53:53 +0200 Subject: [PATCH 075/412] add a way on how to add workaround for older pythor versions Signed-off-by: Nico Schottelius --- doc/dev/logs/2012-05-24.makedirs.py-python3.1 | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 doc/dev/logs/2012-05-24.makedirs.py-python3.1 diff --git a/doc/dev/logs/2012-05-24.makedirs.py-python3.1 b/doc/dev/logs/2012-05-24.makedirs.py-python3.1 new file mode 100644 index 00000000..5ad82b29 --- /dev/null +++ b/doc/dev/logs/2012-05-24.makedirs.py-python3.1 @@ -0,0 +1,27 @@ +# From curl http://armstrong.cc/~steven/tmp/makedirs.py: + +#!/usr/bin/env python2 + +import os + +def makedirs(path, mode=0o777, exist_ok=False): + try: + os.makedirs(path, mode=mode, exist_ok=exist_ok) + except TypeError: + try: + os.makedirs(path, mode=mode) + except OSError as e: + if exist_ok and e.errno == 17: # File exists + pass + else: + raise + + +makedirs('/tmp/python/makedirs') + +try: + makedirs('/tmp/python/makedirs') +except OSError as e: + print(e) + +makedirs('/tmp/python/makedirs', exist_ok=True) From 4b33177d5476eacdae4a1640fdeee264c1060034 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 25 May 2012 17:07:59 +0200 Subject: [PATCH 076/412] remove install command for now Signed-off-by: Steven Armstrong --- bin/cdist | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index 8d0dfc76..b04f2eb2 100755 --- a/bin/cdist +++ b/bin/cdist @@ -75,9 +75,10 @@ def commandline(): parser['config'].set_defaults(func=config) # Install - parser['install'] = parser['sub'].add_parser('install', - parents=[parser['loglevel'], parser['configinstall']]) - parser['install'].set_defaults(func=install) + # 20120525/sar: commented until it actually does something + #parser['install'] = parser['sub'].add_parser('install', + # parents=[parser['loglevel'], parser['configinstall']]) + #parser['install'].set_defaults(func=install) for p in parser: parser[p].epilog = "Get cdist at http://www.nico.schottelius.org/software/cdist/" From eea9a72676c1ed9cf7fc7e910938bb7231e5b5a3 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 29 May 2012 09:29:01 +0200 Subject: [PATCH 077/412] bugfix: tell schroot which chroot to use Signed-off-by: Steven Armstrong --- other/examples/remote/schroot-uri | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/other/examples/remote/schroot-uri b/other/examples/remote/schroot-uri index a23277ec..9819c5a5 100755 --- a/other/examples/remote/schroot-uri +++ b/other/examples/remote/schroot-uri @@ -1,6 +1,6 @@ #!/bin/sh -e # -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -49,7 +49,8 @@ my_name="${0##*/}" mode="$1"; shift log() { - echo "$@" | logger -t "cdist-$my_name-$mode" + # uncomment me for debugging + #echo "$@" | logger -t "cdist-$my_name-$mode" : } @@ -109,6 +110,9 @@ else copy_prefix="cp" copy_destination_prefix="" fi +log "exec_prefix: $exec_prefix" +log "copy_prefix: $copy_prefix" +log "copy_destination_prefix: $copy_destination_prefix" case "$mode" in exec) @@ -118,8 +122,9 @@ case "$mode" in ;; copy) # get directory for given chroot_name - schroot_directory="$($exec_prefix schroot $chroot_name --config | awk -F = '/directory=/ {print $2}')" + schroot_directory="$($exec_prefix schroot -c $schroot_name --config | awk -F = '/directory=/ {print $2}')" [ -n "$schroot_directory" ] || die "Failed to retreive schroot directory for schroot: $schroot_name" + log "schroot_directory: $schroot_directory" # prefix destination with chroot code="$copy_prefix $(echo "$@" | sed "s|$uri:|${copy_destination_prefix}${schroot_directory}|g")" ;; From 21b85e410e203a86dbd3cbc592ca3c4c1cab9441 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 29 May 2012 10:12:00 +0200 Subject: [PATCH 078/412] bugfix: its a method, not a function Signed-off-by: Steven Armstrong --- 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 c38d6b94..8b468739 100644 --- a/lib/cdist/context.py +++ b/lib/cdist/context.py @@ -72,7 +72,7 @@ class Context(object): self.initial_manifest = (initial_manifest or os.path.join(self.local.manifest_path, "init")) - _init_remote(remote_copy, remote_exec) + self._init_remote(remote_copy, remote_exec) # Remote stuff def _init_remote(self, remote_copy, remote_exec): From 5edf39f1114be85fe3b8d1b772f5625e3177a14f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 29 May 2012 11:02:23 +0200 Subject: [PATCH 079/412] no special case for rsync in core. handle implementation specific details in remote-copy script instead Signed-off-by: Steven Armstrong --- lib/cdist/exec/remote.py | 7 +------ other/examples/remote/rsync/copy | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/cdist/exec/remote.py b/lib/cdist/exec/remote.py index fb90939d..487beea3 100644 --- a/lib/cdist/exec/remote.py +++ b/lib/cdist/exec/remote.py @@ -77,12 +77,7 @@ class Remote(object): self.log.debug("Remote transfer: %s -> %s", source, destination) self.rmdir(destination) command = self._copy.split() - # support rsync by appending a "/" to the source if it's a directory - if os.path.isdir(source): - command.extend(["-r", source + "/", self.target_host + ":" + destination]) - else: - command.extend(["-r", source, self.target_host + ":" + destination]) - + command.extend(["-r", source, self.target_host + ":" + destination]) self._run_command(command) def run_script(self, script, env=None, return_output=False): diff --git a/other/examples/remote/rsync/copy b/other/examples/remote/rsync/copy index f6b93c5c..96d3f3de 100755 --- a/other/examples/remote/rsync/copy +++ b/other/examples/remote/rsync/copy @@ -24,7 +24,24 @@ # at /etc/passwd~cdist. # # Usage: -# __remote_copy="/path/to/this/script" cdist config target_host +# cdist config --remote-copy /path/to/this/script target_host # +# second last argument is the source +source_index=$(($#-1)) +index=0 +for arg in $@; do + if [ $index -eq 0 ]; then + # reset $@ + set -- + fi + index=$((index+=1)) + if [ $index -eq $source_index -a -d "$arg" ]; then + echo "directory: $arg" | logger + # if the source is a directory, it has to end with "/" for rsync to do the right thing + arg="${arg%/}/" + fi + set -- "$@" "$arg" +done + rsync --backup --suffix=~cdist -e 'ssh -o User=root' $@ From d052e2d510f3ec4506400bb35a4e81596660dcc7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 29 May 2012 11:03:15 +0200 Subject: [PATCH 080/412] --debug Signed-off-by: Steven Armstrong --- other/examples/remote/rsync/copy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/other/examples/remote/rsync/copy b/other/examples/remote/rsync/copy index 96d3f3de..0d4bd165 100755 --- a/other/examples/remote/rsync/copy +++ b/other/examples/remote/rsync/copy @@ -33,11 +33,10 @@ index=0 for arg in $@; do if [ $index -eq 0 ]; then # reset $@ - set -- + set -- fi index=$((index+=1)) if [ $index -eq $source_index -a -d "$arg" ]; then - echo "directory: $arg" | logger # if the source is a directory, it has to end with "/" for rsync to do the right thing arg="${arg%/}/" fi From fc8ff292893e060a13e456e50454299f13e27f7e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 29 May 2012 11:14:21 +0200 Subject: [PATCH 081/412] update comments to work with arguments vs environment variables: /__remote_{exec,copy}/--remote-{exec,copy}/ Signed-off-by: Steven Armstrong --- other/examples/remote/chroot/copy | 2 +- other/examples/remote/chroot/exec | 2 +- other/examples/remote/schroot-uri | 6 ++++-- other/examples/remote/schroot/copy | 2 +- other/examples/remote/schroot/exec | 2 +- other/examples/remote/ssh/copy | 2 +- other/examples/remote/ssh/exec | 2 +- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/other/examples/remote/chroot/copy b/other/examples/remote/chroot/copy index 528a5faf..8f8cb680 100755 --- a/other/examples/remote/chroot/copy +++ b/other/examples/remote/chroot/copy @@ -22,7 +22,7 @@ # to a remote target host. # # Usage: -# __remote_copy="/path/to/this/script /path/to/your/chroot" cdist config target-id +# cdist config --remote-copy "/path/to/this/script /path/to/your/chroot" target-id # log() { diff --git a/other/examples/remote/chroot/exec b/other/examples/remote/chroot/exec index 19e76b0e..4637f918 100755 --- a/other/examples/remote/chroot/exec +++ b/other/examples/remote/chroot/exec @@ -22,7 +22,7 @@ # on a remote target host. # # Usage: -# __remote_exec="/path/to/this/script /path/to/your/chroot" cdist config target-id +# cdist config --remote-exec "/path/to/this/script /path/to/your/chroot" target-id # log() { diff --git a/other/examples/remote/schroot-uri b/other/examples/remote/schroot-uri index 9819c5a5..5b50a195 100755 --- a/other/examples/remote/schroot-uri +++ b/other/examples/remote/schroot-uri @@ -21,8 +21,10 @@ # __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 +# cdist config \ +# --remote-exec "/path/to/this/script exec" \ +# --remote-copy "/path/to/this/script copy" \ +# target_uri # # # target_uri examples: # schroot:///chroot-name diff --git a/other/examples/remote/schroot/copy b/other/examples/remote/schroot/copy index 3587a4f2..cbd45573 100755 --- a/other/examples/remote/schroot/copy +++ b/other/examples/remote/schroot/copy @@ -21,7 +21,7 @@ # __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 +# cdist config --remote-copy "/path/to/this/script schroot-chroot-name" target_host # log() { diff --git a/other/examples/remote/schroot/exec b/other/examples/remote/schroot/exec index 5b561de0..2510fd22 100755 --- a/other/examples/remote/schroot/exec +++ b/other/examples/remote/schroot/exec @@ -21,7 +21,7 @@ # __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 +# cdist config --remote-exec "/path/to/this/script schroot-chroot-name" target_host # log() { diff --git a/other/examples/remote/ssh/copy b/other/examples/remote/ssh/copy index 0ecd8c52..5b0ed324 100755 --- a/other/examples/remote/ssh/copy +++ b/other/examples/remote/ssh/copy @@ -21,7 +21,7 @@ # same as cdist default # # Usage: -# __remote_copy="/path/to/this/script" cdist config target_host +# cdist config --remote-copy "/path/to/this/script" target_host # #echo "$@" | logger -t "cdist-ssh-copy" diff --git a/other/examples/remote/ssh/exec b/other/examples/remote/ssh/exec index b597a47f..2875c3fc 100755 --- a/other/examples/remote/ssh/exec +++ b/other/examples/remote/ssh/exec @@ -21,7 +21,7 @@ # same as cdist default # # Usage: -# __remote_exec="/path/to/this/script" cdist config target_host +# cdist config --remote-exec "/path/to/this/script" target_host # #echo "$@" | logger -t "cdist-ssh-exec" From d34ea9a9c968f8923ef0388a235458e529fbcf8a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 29 May 2012 12:00:03 +0200 Subject: [PATCH 082/412] add missing -c argument Signed-off-by: Steven Armstrong --- other/examples/remote/schroot/copy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/other/examples/remote/schroot/copy b/other/examples/remote/schroot/copy index cbd45573..d995055e 100755 --- a/other/examples/remote/schroot/copy +++ b/other/examples/remote/schroot/copy @@ -33,7 +33,7 @@ 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}')" +chroot="$(ssh -o User=root -q $target_host schroot -c $chroot_name --config | awk -F = '/directory=/ {print $2}')" # prefix destination with chroot code="$(echo "$@" | sed "s|$target_host:|$target_host:$chroot|g")" From 9d09407cc476993cc94380469b97fd350a8ec332 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 29 May 2012 12:04:35 +0200 Subject: [PATCH 083/412] ++doc Signed-off-by: Steven Armstrong --- other/examples/remote/rsync/copy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/other/examples/remote/rsync/copy b/other/examples/remote/rsync/copy index 0d4bd165..76217caf 100755 --- a/other/examples/remote/rsync/copy +++ b/other/examples/remote/rsync/copy @@ -1,6 +1,7 @@ #!/bin/sh # # 2012 Matt Coddington (mcoddington at gmail.com) +# 2012 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -27,6 +28,9 @@ # cdist config --remote-copy /path/to/this/script target_host # +# For rsync to do the right thing, the source has to end with "/" if it is +# a directory. The below preprocessor loop takes care of that. + # second last argument is the source source_index=$(($#-1)) index=0 @@ -37,7 +41,6 @@ for arg in $@; do fi index=$((index+=1)) if [ $index -eq $source_index -a -d "$arg" ]; then - # if the source is a directory, it has to end with "/" for rsync to do the right thing arg="${arg%/}/" fi set -- "$@" "$arg" From cf980f2985f0fb4f4103155e05831dd259c327b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Tue, 29 May 2012 13:11:42 +0200 Subject: [PATCH 084/412] List all network interfaces in explorer/ifaces. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Gross --- conf/explorer/ifaces | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 conf/explorer/ifaces diff --git a/conf/explorer/ifaces b/conf/explorer/ifaces new file mode 100755 index 00000000..e5fd8a45 --- /dev/null +++ b/conf/explorer/ifaces @@ -0,0 +1,38 @@ +#!/bin/sh +# +# 2012 Sébastien Gross +# +# 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 all network interfaces in explorer/ifaces. One interface per line. +# + +uname_s="$(uname -s)" + +case "$uname_s" in + Linux) + ifconfig | sed -n 's/^\([^[:space:]]\+\)[[:space:]].*/\1/p' + exit 0 + ;; + Darwin|*BSD) + ifconfig | sed -n 's/^\([^:]*\): flags.*/\1/p' + exit 0 + ;; +esac + +echo "Unknown OS" >&2 +exit 1 From 8e9e0a862a1fcb00c1b26bacacfdc870cd78bb76 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 29 May 2012 13:33:22 +0200 Subject: [PATCH 085/412] document how remote exec/copy is used Signed-off-by: Steven Armstrong --- doc/man/man7/cdist-remote-exec-copy.text | 31 ++++++++++++++++-------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/doc/man/man7/cdist-remote-exec-copy.text b/doc/man/man7/cdist-remote-exec-copy.text index 6010907a..d789b12d 100644 --- a/doc/man/man7/cdist-remote-exec-copy.text +++ b/doc/man/man7/cdist-remote-exec-copy.text @@ -1,29 +1,40 @@ cdist-remote-exec-copy(7) ========================= Nico Schottelius -STEVEN HERE NAME ---- -cdist-remote-exec-copy - How to get use remote exec and copy +cdist-remote-exec-copy - How to use remote exec and copy INTRO -------- -What it is, how it works +----- +Cdist interacts with the target host in two ways: +- it executes code (__remote_exec) +- and it copies files (__remote_copy) + +By default this is accomplished with ssh and scp respectively. +The default implementations used by cdist are: +__remote_exec: ssh -o User=root -q +__remote_copy: scp -o User=root -q + +The user can override these defaults by providing custom implementations and +passing them to cdist with the --remote-exec and/or --remote-copy arguments. + +For __remote_exec, the custom implementation must behave as if it where ssh. +For __remote_copy, it must behave like scp. + +With this simple interface the user can take total control of how cdist +interacts with the target when required, while the default implementation +remains as simple as possible. EXAMPLES -------------- -nfsroot, sudo (?), what exists +See cdist/other/examples/remote/ for some example implementations. -HACKER INFORMATION ------------------- -Not sure if needed, but may be helpful to explain how it -works internally - SEE ALSO -------- - cdist(7) From 78181f2a4db09ae367b8960c78168d5044c59351 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 29 May 2012 15:53:31 +0200 Subject: [PATCH 086/412] reorder changes for 2.0.12 Signed-off-by: Nico Schottelius --- doc/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog b/doc/changelog index 3546fe46..5ba9ff1c 100644 --- a/doc/changelog +++ b/doc/changelog @@ -6,11 +6,11 @@ Changelog 2.0.12: * Core: Correctly raise error on Python < 3.2 (Steven Armtrong) + * Core: Add support for --remote-exec and --remote-copy parameters * Documentation: Debian Squeeze hints (Sébastien Gross) 2.0.11: 2012-05-23 * Fix insecure file/directory creation: Use umask 077 - * Add support for --remote-exec and --remote-copy parameters 2.0.10: 2012-05-18 * Cleanup __group: No getent gshadow in old Redhat, use groupmod -g From c4aa68cfc18e83b39f9f113d275783ec02761a53 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 29 May 2012 15:53:57 +0200 Subject: [PATCH 087/412] ++version 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 35dc72c7..38a5f602 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -29,7 +29,7 @@ try: 'cd "%s" && git describe' % here, stderr=devnull, shell=True).decode('utf-8') except: - VERSION = "2.0.11" + VERSION = "2.0.12" BANNER = """ .. . .x+=:. s From bcacea46d72565df5f5d0b9d0b78aa88f1589cdf Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 29 May 2012 15:57:38 +0200 Subject: [PATCH 088/412] ++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 5ba9ff1c..0b6ed4a1 100644 --- a/doc/changelog +++ b/doc/changelog @@ -4,7 +4,7 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -2.0.12: +2.0.12: 2012-05-29 * Core: Correctly raise error on Python < 3.2 (Steven Armtrong) * Core: Add support for --remote-exec and --remote-copy parameters * Documentation: Debian Squeeze hints (Sébastien Gross) From 3cb85fc3f33a87e9f7855143a9debbc6db536239 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 30 May 2012 15:57:44 +0200 Subject: [PATCH 089/412] Bugfix __addifnosuchline: Missing quotes Signed-off-by: Nico Schottelius --- conf/type/__addifnosuchline/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__addifnosuchline/gencode-remote b/conf/type/__addifnosuchline/gencode-remote index f97789ae..1276e5d0 100755 --- a/conf/type/__addifnosuchline/gencode-remote +++ b/conf/type/__addifnosuchline/gencode-remote @@ -29,5 +29,5 @@ result=$(cat "$__object/explorer/findline") if [ "$result" = "NOTFOUND" ]; then line=$(cat "$__object/parameter/line") - echo "echo $line >> $file" + echo "echo \"$line\" >> $file" fi From 9d74696e62c434ba68f85158dcfaf3ff50043fa4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 30 May 2012 16:00:31 +0200 Subject: [PATCH 090/412] ++changes(2.0.13) Signed-off-by: Nico Schottelius --- doc/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/changelog b/doc/changelog index 0b6ed4a1..c3ececa4 100644 --- a/doc/changelog +++ b/doc/changelog @@ -4,6 +4,9 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius +2.0.13: + * Bugfix __addifnosuchline: Fixed quotes/interpolation bug ("a b" became "a b") + 2.0.12: 2012-05-29 * Core: Correctly raise error on Python < 3.2 (Steven Armtrong) * Core: Add support for --remote-exec and --remote-copy parameters From 4f303ecb27967c8fcd1a1c16236beee4dd50ddd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Wed, 30 May 2012 17:46:46 +0200 Subject: [PATCH 091/412] Fix ifconfig output parsing against various OSes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Gross --- conf/explorer/ifaces | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/conf/explorer/ifaces b/conf/explorer/ifaces index e5fd8a45..64ab8aa7 100755 --- a/conf/explorer/ifaces +++ b/conf/explorer/ifaces @@ -20,19 +20,22 @@ # # List all network interfaces in explorer/ifaces. One interface per line. # +# If your OS is not supported please provide a ifconfig output +# uname_s="$(uname -s)" -case "$uname_s" in - Linux) - ifconfig | sed -n 's/^\([^[:space:]]\+\)[[:space:]].*/\1/p' - exit 0 - ;; - Darwin|*BSD) - ifconfig | sed -n 's/^\([^:]*\): flags.*/\1/p' - exit 0 - ;; -esac +REGEXP='s/^(.*)(:[[:space:]]*flags=|Link encap).*/\1/p' -echo "Unknown OS" >&2 -exit 1 +case "$uname_s" in + Darwin) + ifconfig -a | sed -n -E "$REGEXP" + ;; + Linux|*BSD) + ifconfig -a | sed -n -r "$REGEXP" + ;; + *) + echo "Unsupported ifconfig output for $uname_s" >&2 + exit 1 + ;; +esac From dd3b96edffd39c8eae055bcb84706816f3a5d670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Wed, 30 May 2012 17:56:48 +0200 Subject: [PATCH 092/412] Add some ifconfig -a outputs for example. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Gross --- doc/dev/logs/2012-05-30.ifconfig-outputs | 177 +++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 doc/dev/logs/2012-05-30.ifconfig-outputs diff --git a/doc/dev/logs/2012-05-30.ifconfig-outputs b/doc/dev/logs/2012-05-30.ifconfig-outputs new file mode 100644 index 00000000..c314cce8 --- /dev/null +++ b/doc/dev/logs/2012-05-30.ifconfig-outputs @@ -0,0 +1,177 @@ +Here are some "ifconfig -a" outputs that help for the explorer/ifaces parser. + +The current regexp is 's/^(.*)(:[[:space:]]*flags=|Link encap).*/\1/p' + + +You should get the interface list when you run: + + ifconfig -a | sed -n -r 's/^(.*)(:[[:space:]]*flags=|Link encap).*/\1/p' + +If you don't maybe try to replace the sed -r option by -E (works on Darwin). + + +If you still don't get any output, the regexp might be wrong. + + + +On Archlinux: +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- +lo: flags=73 mtu 16436 metric 1 + inet 127.0.0.1 netmask 255.0.0.0 + inet6 ::1 prefixlen 128 scopeid 0x10 + loop txqueuelen 0 (Local Loopback) + RX packets 300081 bytes 49637437 (47.3 MiB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 300081 bytes 49637437 (47.3 MiB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +wlan0: flags=4163 mtu 1500 metric 1 + inet 192.168.1.38 netmask 255.255.255.0 broadcast 192.168.1.255 + inet6 fe80::ba8d:12ff:fe15:fdfa prefixlen 64 scopeid 0x20 + ether b8:8d:12:15:fd:fa txqueuelen 1000 (Ethernet) + RX packets 421381 bytes 442228597 (421.7 MiB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 319266 bytes 41111233 (39.2 MiB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- + +On Debian Linux: +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- +eth0 Link encap:Ethernet HWaddr 00:16:17:55:2d:00 + inet addr:172.16.5.2 Bcast:172.16.255.255 Mask:255.255.0.0 + inet6 addr: fe80::216:17ff:fe55:2d00/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:2854022168 errors:5 dropped:0 overruns:0 frame:4 + TX packets:2200088072 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:2708386800354 (2.4 TiB) TX bytes:531552070314 (495.0 GiB) + Base address:0x3000 Memory:d0120000-d0140000 + +eth0:1 Link encap:Ethernet HWaddr 00:16:17:55:2d:00 + inet addr:172.16.5.1 Bcast:172.16.255.255 Mask:255.255.0.0 + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + Base address:0x3000 Memory:d0120000-d0140000 + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:36487087 errors:0 dropped:0 overruns:0 frame:0 + TX packets:36487087 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:3388870184 (3.1 GiB) TX bytes:3388870184 (3.1 GiB) + +sit0 Link encap:IPv6-in-IPv4 + NOARP MTU:1480 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) + +tap0 Link encap:Ethernet HWaddr 16:db:17:fb:a1:4a + inet addr:10.254.0.1 Bcast:10.254.255.255 Mask:255.255.0.0 + inet6 addr: fe80::14db:17ff:fefb:a14a/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0.0 B) TX bytes:468 (468.0 B) + +bond0 Link encap:Ethernet HWaddr 00:13:72:3c:bf:57 + inet6 addr: fe80::213:72ff:fe3c:bf57/64 Scope:Link + UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 + RX packets:6930494799 errors:0 dropped:38584515 overruns:0 frame:17 + TX packets:1678579772 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:10006832472618 (9.1 TiB) TX bytes:168031719693 (156.4 GiB) + +bond0.123 Link encap:Ethernet HWaddr 00:13:72:3c:bf:57 + inet addr:10.73.38.250 Bcast:10.73.38.255 Mask:255.255.255.0 + inet6 addr: fe80::213:72ff:fe3c:bf57/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:12382478 errors:0 dropped:5777 overruns:0 frame:0 + TX packets:564 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:586071334 (558.9 MiB) TX bytes:64180 (62.6 KiB) + +tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 + inet addr:172.31.255.9 P-t-P:172.31.255.10 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 + RX packets:9655 errors:0 dropped:0 overruns:0 frame:0 + TX packets:15118 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:1760236 (1.6 MiB) TX bytes:14929984 (14.2 MiB) +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- + +On OpenBSD: +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- +lo0: flags=8049 mtu 33160 + priority: 0 + groups: lo + inet6 ::1 prefixlen 128 + inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 + inet 127.0.0.1 netmask 0xff000000 +em0: flags=8843 mtu 1500 + lladdr 00:50:56:b3:00:15 + priority: 0 + groups: egress + media: Ethernet autoselect (1000baseT full-duplex,master) + status: active + inet6 XXXX::XXX:XXXX:XXXX:XX%em0 prefixlen 64 scopeid 0x1 + inet6 XXXX:XXX:XXX:XX::XXX prefixlen 64 + inet XXX.XXX.XXX.XXX netmask 0xffffffc0 broadcast XXX.XXX.XXX.XXX +enc0: flags=0<> + priority: 0 + groups: enc + status: active +pflog0: flags=141 mtu 33160 + priority: 0 + groups: pflog +tun1: flags=8051 mtu 1500 + priority: 0 + groups: tun + status: active + inet 172.31.255.13 --> 172.31.255.14 netmask 0xffffffff +tun2: flags=8011 mtu 1500 + priority: 0 + groups: tun + status: down + inet 172.31.253.1 --> 172.31.253.2 netmask 0xffffffff +tun0: flags=8051 mtu 1500 + priority: 0 + groups: tun + status: active + inet 172.31.254.1 --> 172.31.254.2 netmask 0xffffffff +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- + +On Darwin: +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- +lo0: flags=8049 mtu 16384 + inet6 ::1 prefixlen 128 + inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 + inet 127.0.0.1 netmask 0xff000000 +gif0: flags=8010 mtu 1280 +stf0: flags=0<> mtu 1280 +en0: flags=8863 mtu 1500 + ether 34:15:9e:2e:8b:aa + inet6 fe80::3615:9eff:fe2e:8baa%en0 prefixlen 64 scopeid 0x4 + inet 192.168.1.102 netmask 0xffffff00 broadcast 192.168.1.255 + media: autoselect (100baseTX ) + status: active +en1: flags=8863 mtu 1500 + ether 7c:6d:62:a3:6f:57 + inet6 fe80::7e6d:62ff:fea3:6f57%en1 prefixlen 64 scopeid 0x5 + inet 192.168.2.105 netmask 0xffffff00 broadcast 192.168.2.255 + media: autoselect + status: active +fw0: flags=8863 mtu 4078 + lladdr 34:15:9e:ff:fe:2e:8b:aa + media: autoselect + status: inactive +tun0: flags=8851 mtu 1500 + inet 172.31.255.29 --> 172.31.255.30 netmask 0xffffffff + open (pid 24727) +tun1: flags=8851 mtu 1500 + inet 172.31.254.25 --> 172.31.254.26 netmask 0xffffffff + open (pid 24757) +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- From a306ebc0c85197a1e7ab46f0a3a263e7e9550308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Wed, 30 May 2012 17:56:48 +0200 Subject: [PATCH 093/412] Add some ifconfig -a outputs for example. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Gross --- doc/dev/logs/2012-05-30.ifconfig-outputs | 177 +++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 doc/dev/logs/2012-05-30.ifconfig-outputs diff --git a/doc/dev/logs/2012-05-30.ifconfig-outputs b/doc/dev/logs/2012-05-30.ifconfig-outputs new file mode 100644 index 00000000..c314cce8 --- /dev/null +++ b/doc/dev/logs/2012-05-30.ifconfig-outputs @@ -0,0 +1,177 @@ +Here are some "ifconfig -a" outputs that help for the explorer/ifaces parser. + +The current regexp is 's/^(.*)(:[[:space:]]*flags=|Link encap).*/\1/p' + + +You should get the interface list when you run: + + ifconfig -a | sed -n -r 's/^(.*)(:[[:space:]]*flags=|Link encap).*/\1/p' + +If you don't maybe try to replace the sed -r option by -E (works on Darwin). + + +If you still don't get any output, the regexp might be wrong. + + + +On Archlinux: +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- +lo: flags=73 mtu 16436 metric 1 + inet 127.0.0.1 netmask 255.0.0.0 + inet6 ::1 prefixlen 128 scopeid 0x10 + loop txqueuelen 0 (Local Loopback) + RX packets 300081 bytes 49637437 (47.3 MiB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 300081 bytes 49637437 (47.3 MiB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +wlan0: flags=4163 mtu 1500 metric 1 + inet 192.168.1.38 netmask 255.255.255.0 broadcast 192.168.1.255 + inet6 fe80::ba8d:12ff:fe15:fdfa prefixlen 64 scopeid 0x20 + ether b8:8d:12:15:fd:fa txqueuelen 1000 (Ethernet) + RX packets 421381 bytes 442228597 (421.7 MiB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 319266 bytes 41111233 (39.2 MiB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- + +On Debian Linux: +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- +eth0 Link encap:Ethernet HWaddr 00:16:17:55:2d:00 + inet addr:172.16.5.2 Bcast:172.16.255.255 Mask:255.255.0.0 + inet6 addr: fe80::216:17ff:fe55:2d00/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:2854022168 errors:5 dropped:0 overruns:0 frame:4 + TX packets:2200088072 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:2708386800354 (2.4 TiB) TX bytes:531552070314 (495.0 GiB) + Base address:0x3000 Memory:d0120000-d0140000 + +eth0:1 Link encap:Ethernet HWaddr 00:16:17:55:2d:00 + inet addr:172.16.5.1 Bcast:172.16.255.255 Mask:255.255.0.0 + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + Base address:0x3000 Memory:d0120000-d0140000 + +lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:36487087 errors:0 dropped:0 overruns:0 frame:0 + TX packets:36487087 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:3388870184 (3.1 GiB) TX bytes:3388870184 (3.1 GiB) + +sit0 Link encap:IPv6-in-IPv4 + NOARP MTU:1480 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) + +tap0 Link encap:Ethernet HWaddr 16:db:17:fb:a1:4a + inet addr:10.254.0.1 Bcast:10.254.255.255 Mask:255.255.0.0 + inet6 addr: fe80::14db:17ff:fefb:a14a/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:0 (0.0 B) TX bytes:468 (468.0 B) + +bond0 Link encap:Ethernet HWaddr 00:13:72:3c:bf:57 + inet6 addr: fe80::213:72ff:fe3c:bf57/64 Scope:Link + UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 + RX packets:6930494799 errors:0 dropped:38584515 overruns:0 frame:17 + TX packets:1678579772 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:10006832472618 (9.1 TiB) TX bytes:168031719693 (156.4 GiB) + +bond0.123 Link encap:Ethernet HWaddr 00:13:72:3c:bf:57 + inet addr:10.73.38.250 Bcast:10.73.38.255 Mask:255.255.255.0 + inet6 addr: fe80::213:72ff:fe3c:bf57/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:12382478 errors:0 dropped:5777 overruns:0 frame:0 + TX packets:564 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:586071334 (558.9 MiB) TX bytes:64180 (62.6 KiB) + +tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 + inet addr:172.31.255.9 P-t-P:172.31.255.10 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 + RX packets:9655 errors:0 dropped:0 overruns:0 frame:0 + TX packets:15118 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:100 + RX bytes:1760236 (1.6 MiB) TX bytes:14929984 (14.2 MiB) +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- + +On OpenBSD: +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- +lo0: flags=8049 mtu 33160 + priority: 0 + groups: lo + inet6 ::1 prefixlen 128 + inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 + inet 127.0.0.1 netmask 0xff000000 +em0: flags=8843 mtu 1500 + lladdr 00:50:56:b3:00:15 + priority: 0 + groups: egress + media: Ethernet autoselect (1000baseT full-duplex,master) + status: active + inet6 XXXX::XXX:XXXX:XXXX:XX%em0 prefixlen 64 scopeid 0x1 + inet6 XXXX:XXX:XXX:XX::XXX prefixlen 64 + inet XXX.XXX.XXX.XXX netmask 0xffffffc0 broadcast XXX.XXX.XXX.XXX +enc0: flags=0<> + priority: 0 + groups: enc + status: active +pflog0: flags=141 mtu 33160 + priority: 0 + groups: pflog +tun1: flags=8051 mtu 1500 + priority: 0 + groups: tun + status: active + inet 172.31.255.13 --> 172.31.255.14 netmask 0xffffffff +tun2: flags=8011 mtu 1500 + priority: 0 + groups: tun + status: down + inet 172.31.253.1 --> 172.31.253.2 netmask 0xffffffff +tun0: flags=8051 mtu 1500 + priority: 0 + groups: tun + status: active + inet 172.31.254.1 --> 172.31.254.2 netmask 0xffffffff +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- + +On Darwin: +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- +lo0: flags=8049 mtu 16384 + inet6 ::1 prefixlen 128 + inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 + inet 127.0.0.1 netmask 0xff000000 +gif0: flags=8010 mtu 1280 +stf0: flags=0<> mtu 1280 +en0: flags=8863 mtu 1500 + ether 34:15:9e:2e:8b:aa + inet6 fe80::3615:9eff:fe2e:8baa%en0 prefixlen 64 scopeid 0x4 + inet 192.168.1.102 netmask 0xffffff00 broadcast 192.168.1.255 + media: autoselect (100baseTX ) + status: active +en1: flags=8863 mtu 1500 + ether 7c:6d:62:a3:6f:57 + inet6 fe80::7e6d:62ff:fea3:6f57%en1 prefixlen 64 scopeid 0x5 + inet 192.168.2.105 netmask 0xffffff00 broadcast 192.168.2.255 + media: autoselect + status: active +fw0: flags=8863 mtu 4078 + lladdr 34:15:9e:ff:fe:2e:8b:aa + media: autoselect + status: inactive +tun0: flags=8851 mtu 1500 + inet 172.31.255.29 --> 172.31.255.30 netmask 0xffffffff + open (pid 24727) +tun1: flags=8851 mtu 1500 + inet 172.31.254.25 --> 172.31.254.26 netmask 0xffffffff + open (pid 24757) +--8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- From d7f180c99fd4540ef8cd924af5f7bc526e55fb72 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 30 May 2012 18:34:14 +0200 Subject: [PATCH 094/412] rename ifaces => interfaces (more explicit) Signed-off-by: Nico Schottelius --- conf/explorer/{ifaces => interfaces} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename conf/explorer/{ifaces => interfaces} (100%) diff --git a/conf/explorer/ifaces b/conf/explorer/interfaces similarity index 100% rename from conf/explorer/ifaces rename to conf/explorer/interfaces From 9291fd743660d9fc89ddf5cf23105a15ab26879a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 30 May 2012 18:34:47 +0200 Subject: [PATCH 095/412] ++changes(2.0.12) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index c3ececa4..4da583f7 100644 --- a/doc/changelog +++ b/doc/changelog @@ -6,6 +6,7 @@ Changelog 2.0.13: * Bugfix __addifnosuchline: Fixed quotes/interpolation bug ("a b" became "a b") + * New Explorer: interfaces (Sébastien Gross) 2.0.12: 2012-05-29 * Core: Correctly raise error on Python < 3.2 (Steven Armtrong) From 4b1c604e47a958627ad59b35b3b1cdcbc2b149b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Thu, 31 May 2012 00:23:28 +0200 Subject: [PATCH 096/412] Fix type authors for manpage generation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Gross --- conf/type/__cdistmarker/man.text | 2 +- conf/type/__ssh_authorized_key/man.text | 2 +- conf/type/__timezone/man.text | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/type/__cdistmarker/man.text b/conf/type/__cdistmarker/man.text index 360598d8..1e9079f5 100644 --- a/conf/type/__cdistmarker/man.text +++ b/conf/type/__cdistmarker/man.text @@ -1,6 +1,6 @@ cdist-type__cdistmarker(7) ========================== -Daniel Maher +Daniel Maher NAME diff --git a/conf/type/__ssh_authorized_key/man.text b/conf/type/__ssh_authorized_key/man.text index af0c2017..b372b354 100644 --- a/conf/type/__ssh_authorized_key/man.text +++ b/conf/type/__ssh_authorized_key/man.text @@ -1,6 +1,6 @@ cdist-type__ssh_authorized_key(7) ================================= -Aurélien Bondis - aurelien.bondis AT gmail DOT com +Aurélien Bondis NAME diff --git a/conf/type/__timezone/man.text b/conf/type/__timezone/man.text index 89136855..6f0c5101 100644 --- a/conf/type/__timezone/man.text +++ b/conf/type/__timezone/man.text @@ -1,6 +1,6 @@ cdist-type__timezone(7) ======================= -Ramon Salvadó - rsalvado at gnuine dot com +Ramon Salvadó NAME From fc6a54b3bd1cdcd140cea87be3e05a27805f88a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Thu, 31 May 2012 00:28:32 +0200 Subject: [PATCH 097/412] Fix email address. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Gross --- conf/type/__cdistmarker/man.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__cdistmarker/man.text b/conf/type/__cdistmarker/man.text index 1e9079f5..ca5611a7 100644 --- a/conf/type/__cdistmarker/man.text +++ b/conf/type/__cdistmarker/man.text @@ -1,6 +1,6 @@ cdist-type__cdistmarker(7) ========================== -Daniel Maher +Daniel Maher NAME From 8564785f664d208e42ae6a6b633aac6013df32a9 Mon Sep 17 00:00:00 2001 From: contradict Date: Wed, 30 May 2012 17:21:19 -0700 Subject: [PATCH 098/412] Ensure __ssh_authorized_key sets proper group When --dstuser is specified, use an explorer to retrieve the group name and specify the group name on all created directories and files. --- .../__ssh_authorized_key/explorer/dstuser_group | 15 +++++++++++++++ conf/type/__ssh_authorized_key/manifest | 16 ++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 conf/type/__ssh_authorized_key/explorer/dstuser_group diff --git a/conf/type/__ssh_authorized_key/explorer/dstuser_group b/conf/type/__ssh_authorized_key/explorer/dstuser_group new file mode 100644 index 00000000..c79f8d9f --- /dev/null +++ b/conf/type/__ssh_authorized_key/explorer/dstuser_group @@ -0,0 +1,15 @@ +#!/bin/sh + +# Get option dstuser if defined +if [ -f "$__object/parameter/dstuser" ]; then + dstuser=`cat "$__object/parameter/dstuser"` +else + dstuser="root" +fi + +if id $dstuser >/dev/null 2>&1 ; then + id -ng $dstuser +else + echo "$__object_id: Destination user $dstuser does not exist" >&2 + exit 1 +fi diff --git a/conf/type/__ssh_authorized_key/manifest b/conf/type/__ssh_authorized_key/manifest index efadc3f6..d9db9c78 100755 --- a/conf/type/__ssh_authorized_key/manifest +++ b/conf/type/__ssh_authorized_key/manifest @@ -29,8 +29,13 @@ fi # Get option dstuser if defined if [ -f "$__object/parameter/dstuser" ]; then dstuser=`cat "$__object/parameter/dstuser"` +else + dstuser="root" fi +# retrieve destination group +dstgroup=$(cat "$__object/explorer/dstuser_group") + # if a source user is defined, use it's public key if [ "$srcuser" ]; then srcrsa="/home/${srcuser}/.ssh/id_rsa.pub" @@ -46,9 +51,16 @@ else sshpath="/root/.ssh" fi rsa=`cat $srcrsa` -__directory $sshpath +__directory $sshpath \ + --owner $dstuser \ + --group $dstgroup \ + --mode 700 # the file authorized_keys depends on the .ssh folder -require="__directory${sshpath}" __file "$sshpath/authorized_keys" --mode 640 +require="__directory${sshpath}" \ + __file "$sshpath/authorized_keys" \ + --mode 640 \ + --owner $dstuser \ + --group $dstgroup # the line added depends on authorized_keys existence require="__file${sshpath}/authorized_keys" __addifnosuchline sshkey --file \ "$sshpath/authorized_keys" --line "$rsa" From 5ad0805fa941958569a9ccdd9c94f0472a54e846 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 31 May 2012 19:25:17 +0200 Subject: [PATCH 099/412] ++changes(2.0.13) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 4da583f7..bbf4d5a1 100644 --- a/doc/changelog +++ b/doc/changelog @@ -5,6 +5,7 @@ Changelog * Exception: No braces means author == Nico Schottelius 2.0.13: + * Bugfix __ssh_authorized_key: Ensure it sets proper group (contradict) * Bugfix __addifnosuchline: Fixed quotes/interpolation bug ("a b" became "a b") * New Explorer: interfaces (Sébastien Gross) From f087057c9812655fb0d7faabff5008dda7314a4e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 31 May 2012 19:30:51 +0200 Subject: [PATCH 100/412] use iproute2's ip, if available Signed-off-by: Nico Schottelius --- conf/explorer/interfaces | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/conf/explorer/interfaces b/conf/explorer/interfaces index 64ab8aa7..76ff32bb 100755 --- a/conf/explorer/interfaces +++ b/conf/explorer/interfaces @@ -23,8 +23,13 @@ # If your OS is not supported please provide a ifconfig output # -uname_s="$(uname -s)" +# Use ip, if available +if which ip >/dev/null 2>&1; then + ip -o link show | sed -n 's/^[0-9]\+: \(.\+\): <.*/\1/p' + exit 0 +fi +uname_s="$(uname -s)" REGEXP='s/^(.*)(:[[:space:]]*flags=|Link encap).*/\1/p' case "$uname_s" in From 3e502bbe88cfc2b01233348fd989d5f32ca907cb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 31 May 2012 19:37:06 +0200 Subject: [PATCH 101/412] note about csh Signed-off-by: Nico Schottelius --- doc/dev/logs/2012-05-31.csh-compatibilty | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 doc/dev/logs/2012-05-31.csh-compatibilty diff --git a/doc/dev/logs/2012-05-31.csh-compatibilty b/doc/dev/logs/2012-05-31.csh-compatibilty new file mode 100644 index 00000000..b653a826 --- /dev/null +++ b/doc/dev/logs/2012-05-31.csh-compatibilty @@ -0,0 +1,10 @@ +If root's shell is csh or other non-sh compatible, we have problems. +See https://github.com/telmich/cdist/issues/54. + +Stuff to try out: + + - "-o SendEnv name" [may break remote exec/copy] + - cat * | /bin/sh -s could also work, needs testing though + +Somebody who is affected should give this a try, especially the 2nd +variant. From 06649d3478fa67220bbc3b24dde478e6e79dc028 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 4 Jun 2012 14:11:34 +0200 Subject: [PATCH 102/412] new feature: capture and forward stdin to types Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 24 +++++++++ lib/cdist/test/emulator/__init__.py | 52 ++++++++++++++++++- .../emulator/fixtures/conf/explorer/.keep | 0 .../test/emulator/fixtures/conf/type/__file | 1 + .../conf/type/__file_from_stdin/manifest | 4 ++ .../type/__file_from_stdin/parameter/required | 1 + 6 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 lib/cdist/test/emulator/fixtures/conf/explorer/.keep create mode 120000 lib/cdist/test/emulator/fixtures/conf/type/__file create mode 100755 lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/manifest create mode 100644 lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 39d8ca40..5bde16b9 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) +# 2012 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -22,6 +23,7 @@ import argparse import logging import os +import sys import cdist from cdist import core @@ -67,6 +69,7 @@ class Emulator(object): self.commandline() self.setup_object() + self.save_stdin() self.record_requirements() self.record_auto_requirements() self.log.debug("Finished %s %s" % (self.cdist_object.path, self.parameters)) @@ -137,6 +140,27 @@ class Emulator(object): # Record / Append source self.cdist_object.source.append(self.object_source) + chunk_size = 8192 + def _read_stdin(self): + return sys.stdin.buffer.read(self.chunk_size) + def save_stdin(self): + """If something is written to stdin, save it in the object as + $__object/stdin so it can be accessed in manifest and gencode-* + scripts. + """ + if not sys.stdin.isatty(): + try: + # go directly to file instead of using CdistObject's api + # as that does not support streaming + path = os.path.join(self.cdist_object.absolute_path, 'stdin') + with open(path, 'wb') as fd: + chunk = self._read_stdin() + while chunk: + fd.write(chunk) + chunk = self._read_stdin() + except EnvironmentError as e: + raise cdist.Error('Failed to read from stdin: %s' % e) + def record_requirements(self): """record requirements""" diff --git a/lib/cdist/test/emulator/__init__.py b/lib/cdist/test/emulator/__init__.py index 077ea111..ff18fe87 100644 --- a/lib/cdist/test/emulator/__init__.py +++ b/lib/cdist/test/emulator/__init__.py @@ -21,12 +21,17 @@ import os import shutil +import string +import filecmp +import random import cdist from cdist import test from cdist.exec import local from cdist import emulator from cdist import core +from cdist import config +import cdist.context local_base_path = test.cdist_base_path @@ -114,8 +119,7 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase): self.manifest = core.Manifest(self.target_host, self.local) def tearDown(self): - pass - #shutil.rmtree(self.temp_dir) + shutil.rmtree(self.temp_dir) def test_autorequire(self): initial_manifest = os.path.join(self.local.manifest_path, "init") @@ -216,3 +220,47 @@ class ArgumentsTestCase(test.CdistTestCase): self.assertTrue('optional1' in cdist_object.parameters) self.assertFalse('optional2' in cdist_object.parameters) self.assertEqual(cdist_object.parameters['optional1'], value) + + +class StdinTestCase(test.CdistTestCase): + + def setUp(self): + self.orig_environ = os.environ + os.environ = os.environ.copy() + self.target_host = 'localhost' + self.temp_dir = self.mkdtemp() + os.environ['__cdist_out_dir'] = self.temp_dir + local_base_path = fixtures + + self.context = cdist.context.Context( + target_host=self.target_host, + remote_copy='scp -o User=root -q', + remote_exec='ssh -o User=root -q', + base_path=local_base_path, + exec_path=test.cdist_exec_path, + debug=False) + self.config = config.Config(self.context) + + def tearDown(self): + os.environ = self.orig_environ + shutil.rmtree(self.temp_dir) + + def test_file_from_stdin(self): + handle, destination = self.mkstemp(dir=self.temp_dir) + os.close(handle) + source_handle, source = self.mkstemp(dir=self.temp_dir) + candidates = string.ascii_letters+string.digits + with os.fdopen(source_handle, 'w') as fd: + for x in range(100): + fd.write(''.join(random.sample(candidates, len(candidates)))) + + handle, initial_manifest = self.mkstemp(dir=self.temp_dir) + with os.fdopen(handle, 'w') as fd: + fd.write('__file_from_stdin %s --source %s\n' % (destination, source)) + self.context.initial_manifest = initial_manifest + self.config.stage_prepare() + + cdist_type = core.CdistType(self.config.local.type_path, '__file') + cdist_object = core.CdistObject(cdist_type, self.config.local.object_path, destination) + # Test weither stdin has been stored correctly + self.assertTrue(filecmp.cmp(source, os.path.join(cdist_object.absolute_path, 'stdin'))) diff --git a/lib/cdist/test/emulator/fixtures/conf/explorer/.keep b/lib/cdist/test/emulator/fixtures/conf/explorer/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__file b/lib/cdist/test/emulator/fixtures/conf/type/__file new file mode 120000 index 00000000..c57c4134 --- /dev/null +++ b/lib/cdist/test/emulator/fixtures/conf/type/__file @@ -0,0 +1 @@ +../../../../../../../conf/type/__file \ No newline at end of file diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/manifest b/lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/manifest new file mode 100755 index 00000000..b4908cbf --- /dev/null +++ b/lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/manifest @@ -0,0 +1,4 @@ +#!/bin/sh + +source="$(cat "$__object/parameter/source")" +cat "$source" | __file "/$__object_id" --source /dev/null diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required b/lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required new file mode 100644 index 00000000..5a18cd2f --- /dev/null +++ b/lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required @@ -0,0 +1 @@ +source From 7ae1a2bc524565a3e38d4d2ecb90ef4d7f2af17f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 4 Jun 2012 14:17:42 +0200 Subject: [PATCH 103/412] allow __file to read source file from stdin Signed-off-by: Steven Armstrong --- conf/type/__file/gencode-local | 3 +++ conf/type/__file/man.text | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/conf/type/__file/gencode-local b/conf/type/__file/gencode-local index a55cfc2b..b74893fb 100755 --- a/conf/type/__file/gencode-local +++ b/conf/type/__file/gencode-local @@ -30,6 +30,9 @@ exists="$(cat "$__object/explorer/exists")" if [ "$state_should" = "present" ]; then if [ -f "$__object/parameter/source" ]; then source="$(cat "$__object/parameter/source")" + if [ "$source" = "-" ]; then + source="$__object/stdin" + fi if [ -f "$source" ]; then local_cksum="$(cksum < "$source")" diff --git a/conf/type/__file/man.text b/conf/type/__file/man.text index 0215027a..1c61fd51 100644 --- a/conf/type/__file/man.text +++ b/conf/type/__file/man.text @@ -39,6 +39,7 @@ owner:: source:: If supplied, copy this file from the host running cdist to the target. If not supplied, an empty file or directory will be created. + If source is '-' (dash), take what was written to stdin as the file content. EXAMPLES @@ -64,6 +65,12 @@ __file /etc/shadow --source "$__type/files/shadow" \ __file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \ --state exists \ --owner frodo --mode 0600 + +# Take file content from stdin +__file /tmp/whatever --owner root --group root --mode 644 --source - << DONE +Here goes the content for /tmp/whatever +DONE + -------------------------------------------------------------------------------- From 56222d1f856a9770383c9c9dfa99d785a50121c5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 4 Jun 2012 16:14:28 +0200 Subject: [PATCH 104/412] document stdin reading Signed-off-by: Nico Schottelius --- doc/man/man7/cdist-type.text | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/doc/man/man7/cdist-type.text b/doc/man/man7/cdist-type.text index 92a2b36d..ed114aff 100644 --- a/doc/man/man7/cdist-type.text +++ b/doc/man/man7/cdist-type.text @@ -111,6 +111,33 @@ fi -------------------------------------------------------------------------------- +INPUT FROM STDIN +----------------- +Every type can access what has been written on stdin when it has been called. +The result is saved into the ***stdin*** file in the object directory. + +Example use of a type: (e.g. in conf/type/__archlinux_hostname) +-------------------------------------------------------------------------------- +__file /etc/rc.conf --source - << eof +... +HOSTNAME="$__target_host" +... +eof +-------------------------------------------------------------------------------- +If you have not seen this syntax (<< eof) before, it may help you to read +about "here documents". + +In the __file type, stdin is used as source for the file, if - is used for source: +-------------------------------------------------------------------------------- + if [ -f "$__object/parameter/source" ]; then + source="$(cat "$__object/parameter/source")" + if [ "$source" = "-" ]; then + source="$__object/stdin" + fi + .... +-------------------------------------------------------------------------------- + + WRITING THE MANIFEST -------------------- In the manifest of a type you can use other types, so your type extends From 27073fc2f0c3352594c5efdf65c1d5640a222688 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 4 Jun 2012 16:15:36 +0200 Subject: [PATCH 105/412] changes(2.0.13) += stdin reading Signed-off-by: Nico Schottelius --- doc/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/changelog b/doc/changelog index bbf4d5a1..9eff3efa 100644 --- a/doc/changelog +++ b/doc/changelog @@ -8,6 +8,8 @@ Changelog * Bugfix __ssh_authorized_key: Ensure it sets proper group (contradict) * Bugfix __addifnosuchline: Fixed quotes/interpolation bug ("a b" became "a b") * New Explorer: interfaces (Sébastien Gross) + * Feature core: Support reading from stdin in types (Steven Armstrong) + * Feature __file: Support reading from stdin with - syntax (Steven Armstrong) 2.0.12: 2012-05-29 * Core: Correctly raise error on Python < 3.2 (Steven Armtrong) From 36513997d9aba2b39dde1b448a127b25e73c4444 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 4 Jun 2012 22:01:32 +0200 Subject: [PATCH 106/412] =?UTF-8?q?implement=20multiple=20parameters=20bas?= =?UTF-8?q?ed=20on=20https://github.com/telmich/cdist/pull/71=20by=20S?= =?UTF-8?q?=C3=A9bastien=20Gross?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Steven Armstrong --- doc/man/man7/cdist-type.text | 19 ++++++++++++++++--- lib/cdist/core/cdist_type.py | 34 ++++++++++++++++++++++++++++++++++ lib/cdist/emulator.py | 12 +++++++++--- lib/cdist/util/fsproperty.py | 6 +++++- 4 files changed, 64 insertions(+), 7 deletions(-) diff --git a/doc/man/man7/cdist-type.text b/doc/man/man7/cdist-type.text index 92a2b36d..725c583e 100644 --- a/doc/man/man7/cdist-type.text +++ b/doc/man/man7/cdist-type.text @@ -74,14 +74,19 @@ DEFINING PARAMETERS ------------------- Every type consists of required, optional and boolean parameters, which must be created in a newline seperated file in ***parameter/required***, -***parameter/optional*** and ***parameter/boolean***. If either is missing, -the type will have no required, no optional, no boolean or no parameters at -all. +***parameter/required_multiple***, ***parameter/optional***, +***parameter/optional_multiple*** and ***parameter/boolean***. +Parameters which are allowed multiple times should be listed in +required_multiple or optional_multiple respectively. For all other parameters +the standard unix behaviour of the last given wins is applied. +If either is missing, the type will have no required, no optional, no boolean +or no parameters at all. Example: -------------------------------------------------------------------------------- echo servername >> conf/type/__nginx_vhost/parameter/required echo logdirectory >> conf/type/__nginx_vhost/parameter/optional +echo server_alias >> conf/type/__nginx_vhost/parameter/optional_multiple echo use_ssl >> conf/type/__nginx_vhost/parameter/boolean -------------------------------------------------------------------------------- @@ -108,6 +113,14 @@ if [ -f "$__object/parameter/use_ssl" ]; then # file exists -> True # do some fancy ssl stuff fi + +# parameter with multiple values +if [ -f "$__object/parameter/server_alias" ]; then + for alias in $(cat "$__object/parameter/server_alias"); do + echo $alias > /some/where/usefull + done +fi + -------------------------------------------------------------------------------- diff --git a/lib/cdist/core/cdist_type.py b/lib/cdist/core/cdist_type.py index 1d2472c4..86f3ced1 100644 --- a/lib/cdist/core/cdist_type.py +++ b/lib/cdist/core/cdist_type.py @@ -81,7 +81,9 @@ class CdistType(object): self.__explorers = None self.__required_parameters = None + self.__required_multiple_parameters = None self.__optional_parameters = None + self.__optional_multiple_parameters = None self.__boolean_parameters = None def __repr__(self): @@ -130,6 +132,22 @@ class CdistType(object): self.__required_parameters = parameters return self.__required_parameters + @property + def required_multiple_parameters(self): + """Return a list of required multiple parameters""" + if not self.__required_multiple_parameters: + parameters = [] + try: + with open(os.path.join(self.absolute_path, "parameter", "required_multiple")) as fd: + for line in fd: + parameters.append(line.strip()) + except EnvironmentError: + # error ignored + pass + finally: + self.__required_multiple_parameters = parameters + return self.__required_multiple_parameters + @property def optional_parameters(self): """Return a list of optional parameters""" @@ -146,6 +164,22 @@ class CdistType(object): self.__optional_parameters = parameters return self.__optional_parameters + @property + def optional_multiple_parameters(self): + """Return a list of optional multiple parameters""" + if not self.__optional_multiple_parameters: + parameters = [] + try: + with open(os.path.join(self.absolute_path, "parameter", "optional_multiple")) as fd: + for line in fd: + parameters.append(line.strip()) + except EnvironmentError: + # error ignored + pass + finally: + self.__optional_multiple_parameters = parameters + return self.__optional_multiple_parameters + @property def boolean_parameters(self): """Return a list of boolean parameters""" diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 39d8ca40..95f29a7b 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -89,12 +89,18 @@ class Emulator(object): parser = argparse.ArgumentParser(add_help=False, argument_default=argparse.SUPPRESS) - for parameter in self.cdist_type.optional_parameters: - argument = "--" + parameter - parser.add_argument(argument, dest=parameter, action='store', required=False) for parameter in self.cdist_type.required_parameters: argument = "--" + parameter parser.add_argument(argument, dest=parameter, action='store', required=True) + for parameter in self.cdist_type.required_multiple_parameters: + argument = "--" + parameter + parser.add_argument(argument, dest=parameter, action='append', required=True) + for parameter in self.cdist_type.optional_parameters: + argument = "--" + parameter + parser.add_argument(argument, dest=parameter, action='store', required=False) + for parameter in self.cdist_type.optional_multiple_parameters: + argument = "--" + parameter + parser.add_argument(argument, dest=parameter, action='append', required=False) for parameter in self.cdist_type.boolean_parameters: argument = "--" + parameter parser.add_argument(argument, dest=parameter, action='store_const', const='') diff --git a/lib/cdist/util/fsproperty.py b/lib/cdist/util/fsproperty.py index 55428c4d..5814b2b4 100644 --- a/lib/cdist/util/fsproperty.py +++ b/lib/cdist/util/fsproperty.py @@ -134,7 +134,11 @@ 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)) + if type(value) == type([]): + for v in value: + fd.write(str(v) + '\n') + else: + fd.write(str(value)) except EnvironmentError as e: raise cdist.Error(str(e)) From 06c87f92477c62b7e0315e1f790596f277dbee72 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Jun 2012 18:28:47 +0200 Subject: [PATCH 107/412] changes(2.0.13) += multiple parameter support Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 9eff3efa..0d44af54 100644 --- a/doc/changelog +++ b/doc/changelog @@ -9,6 +9,7 @@ Changelog * Bugfix __addifnosuchline: Fixed quotes/interpolation bug ("a b" became "a b") * New Explorer: interfaces (Sébastien Gross) * Feature core: Support reading from stdin in types (Steven Armstrong) + * Feature core: Support multiple parameters for types (Steven Armstrong) * Feature __file: Support reading from stdin with - syntax (Steven Armstrong) 2.0.12: 2012-05-29 From 365b320e7cf5714a9386fcd6a8a11d36692c2d03 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 5 Jun 2012 18:32:09 +0200 Subject: [PATCH 108/412] ++version = 2.0.13 Signed-off-by: Nico Schottelius --- doc/changelog | 2 +- lib/cdist/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/changelog b/doc/changelog index 0d44af54..60b21f90 100644 --- a/doc/changelog +++ b/doc/changelog @@ -4,7 +4,7 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -2.0.13: +2.0.13: 2012-06-05 * Bugfix __ssh_authorized_key: Ensure it sets proper group (contradict) * Bugfix __addifnosuchline: Fixed quotes/interpolation bug ("a b" became "a b") * New Explorer: interfaces (Sébastien Gross) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index 38a5f602..02df2f2f 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -29,7 +29,7 @@ try: 'cd "%s" && git describe' % here, stderr=devnull, shell=True).decode('utf-8') except: - VERSION = "2.0.12" + VERSION = "2.0.13" BANNER = """ .. . .x+=:. s From 8fd1053bef2814a79fdeb7ef1aacdbb26034175e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 6 Jun 2012 15:00:11 +0200 Subject: [PATCH 109/412] +wikipedia entry Signed-off-by: Nico Schottelius --- doc/dev/logs/2012-06-06.wikipedia | 99 +++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 doc/dev/logs/2012-06-06.wikipedia diff --git a/doc/dev/logs/2012-06-06.wikipedia b/doc/dev/logs/2012-06-06.wikipedia new file mode 100644 index 00000000..696082e7 --- /dev/null +++ b/doc/dev/logs/2012-06-06.wikipedia @@ -0,0 +1,99 @@ +{{Infobox software +|name = cdist +|logo = +|screenshot = +|caption = +|collapsible = +|author = Nico Schottelius, Steven Armstrong +|developer = +|released = 2010 +|latest release version = 2.0.13 +|latest release date = 05-Jun-2012 +|frequently updated = +|programming language = [[Python_(programming_language)|Python]], [[Bourne shell]] +|operating system = [[GNU/Linux]], [[Unix-like]] +|platform = +|size = +|language = +|status = +|genre = [[Configuration management]] +|license = [[GPLv3]]. +|website = http://www.nico.schottelius.org/software/cdist/ +}} + +'''cdist''' is a usable configuration management system. It adheres to the KISS principle and is being used in small up to enterprise grade environments. cdist is an alternative to other configuration management systems like cfengine, bcfg2, chef and puppet. + +Its core is written in [[Python (programming language)|Python]] and the types are +written in [[Bourne Shell]]. Cdist is released under the [[GNU General Public License|GPL]]. +cdist has been a no. 1 topic on Hackernews for some time.cdist on hackernews https://news.ycombinator.com/item?id=3422678 + +cdist is actively being developed in Switzerland by the two main developer Nico Schottelius and Steven Armstrong. + + +==Architecture== + +cdist is being used to configure small to a large number of hosts in a scalable manner. +In cdist the user describes at a central position (the **initial manifest**), +what the target state of a system should be. So called **types** are being used to realise +the appropriate functionality on hosts. + +In comparison to other configuration management software, cdist + +* does not have any requirements on the target host besides SSH and a bourne shell +* operates in push based approach (a server pushes to the clients, clients usually do not poll) +* is highly scalable by design +** If configuring more hosts in parallel than possible on one host is needed, adding more CPUs or more configurations servers to scale out is supported. + + +== Configuration DSL == + +All user configurable parts are contained in manifests or gencode-scripts, which are shell scripts. +The idea behind shell scripts is to give the System Administrators a simple way DSL, that is known to them. +Although the core is written in Python, a user does not need to know any Python at all. + +When using the types in cdist, they are called like normal programs in manifests and can make use of +advanced parameter parsing as well as reading from stdin: + +
+# Provide a default file, but let the user change it
+__file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \
+   --state exists \
+   --owner frodo --mode 0600
+
+# Take file content from stdin
+__file /tmp/whatever --owner root --group root --mode 644 --source - << DONE
+Here goes the content for /tmp/whatever
+DONE
+
+ +Access to paths and files within types is given by environment variables like $__object. + +==Platform support== + +cdist is known to be running on a variety of Unix flavors, but can in theory also run on Windows. This has not been tested though. + + +==Users== + +cdist is being used at various companies in Switzerland (for instance at [[ETH Zurich]]), the USA, Germany and France. +cdist is being watched on github by more than 100 people and has more than 30 forks.Github project page https://github.com/telmich/cdist + + +== See also == +{{Portal|Free software}} +* [[Comparison of open source configuration management software]] + +== References == +{{reflist}} + +== External links == +* [http://www.nico.schottelius.org/software/cdist/ cdist Website] +* [https://github.com/telmich/cdist Github home] +* [http://l.schottelius.org/mailman/listinfo/cdist cdist mailinglist] +* [https://freecode.com/projects/cdist cdist on freencode] + + +[[Category:Configuration management]] +[[Category:Free software programmed in Python]] +[[Category:2010 software]] + From a68efb59afcdb97801348ffcd87d0215bed12859 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 6 Jun 2012 15:18:02 +0200 Subject: [PATCH 110/412] add logo with subtitle Signed-off-by: Nico Schottelius --- doc/gfx/cdist-logo-cm.png | Bin 0 -> 2960 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 doc/gfx/cdist-logo-cm.png diff --git a/doc/gfx/cdist-logo-cm.png b/doc/gfx/cdist-logo-cm.png new file mode 100644 index 0000000000000000000000000000000000000000..7d988cdcb8474c1cd21de4b4da614a724a59cf06 GIT binary patch literal 2960 zcmZWpc{~&T8=or?9n{FznIp#>$xSLpt{h_sUn6IR9JyNNR?9KDGq;7A7!_hRA{|s@ zm@j5>M2@-1Fu&^i-}m>tUeEFRJg?Vty+6<`CT zf62|CuqVG1SFowmJpkYY|8Hgipo;{5J#vPbSsHUr96QE)MtPGA&idt3HZ!^oi5goe z9?x2mV>7h_vHCr@mIr0ca46%)Uo)q)8oOyzasoURUI&yDbYUnV^mm1 zwPxox&5o3`W@)}mrSBxZqaT;SjV!3zzTzX|i%-bjpQlb7YqN-0qL`fORFi})Vz)g( zh6?@R@Q3F2Lu2t&Xu{mV#^15ggZN8OMVpczV@pD3pO|?V6$cnq691$wd#HYqFs~P5 zpZ>uKUprA9-J{>K?g&UPoLmeIq#v&w}-O$$UcC`;>DHwwtIaGd0 zu&g2 z9{JA%+6pN-8)TUUX8&}kVJtU^f@SKc=Rr&UK6|S}yf5eZ6%u$5DPOLsYTWgwMxfhW z%_1>H@L4%ZSSge7nxn?4&h3GS8mELpGBWq}(OoEflpbrjaDw&r(aFYjOy~gE3d@da z8*+a!FC4?^)&qVJE#4K(kT)#tvZ!1R_))8b@bm_grgEQ#tge8%{R^rEt$J39WV*MT zUp{R)QmNi?N8{U)3_Nv;JR6Qgq42;=w z)M{|yp#AKpgJewV#&s$VcxeJoDxIm-w#RKtIQlKyjP1AoXWjkwA1ZASC&^ahtNJlC*UY*~EN~k%Hs)%=w{S^<5+ZZ0 zlX=-+|FQOLiKM&($M2@%RJ(#kXx|SXC7dPT1N^{El?N^>m!DXa>M>hDRjUL(^8_)? z^V(R@*YWWew)S|bIY*qMS|ubM1hp;*Lz=IxxGiD>@TU_viI!L^E+hJ`z3vvg&>_M_ zpGjxF$qg)ZAdBs(*P|_4P&#tW7MsEqwlPF_QwpWYaJ>qxvCZ3e`s+sJ$sYLdDca1N z#6!%`jb8kj{`a5^Z+Gp{g^Y_O>^z8AHII_VZwoZp%H`CNj}kvMe_!NsTVcHSh04Xg zVnSMDxvyLw1rq{wztRsl=AiMhMiXrV)3&Y=GW<53W@e>A|NZP+T zs$&vzv5&!pyOD6Q?#GIzqP602G+k)OYv`b^3#unB680QFuct^S0&4uEDumHKt>h{3~AcKsTSLQwTSUzXm#j4x&Q-v%nq`=;QD2zK1+Sjrzw=$DI3-am8tepL z`sAl+h5!9C1k{0&FAVd8qe&?}1PZu^teu!yKBWU&^U8vv?~%OtI^mu|{C{p?-1)|+ zi-*m%bDp6FUKVOE&!(;ueV*4`PY5P>Wi_+T*tcG|FmWay$Jt6rQy0LB{;NjWj#VgmcnhngDeh|TK&_2Q9?(=Q z*g1_qv^`gGprszTsA&FRn4iHas}K7&%gG-{a1qUSU6c$OOvmW>Y6ZLik*YV0bopf! zKZ2@(Q8L-}{n~8bnrt&}i)_1#glBv4{Q(#dCqNdCtJd7UYAVx2I|K)XN$F0c`ttf~ zBwsl_myc&(A7lfQm{fAC*sAp8B^#MQ?uvu&g3A?V?t5<(x31_}HAL_r&djAok({g- z^jo8Ul_@Z~e425gH(x%{(i;0uVd;Q?xH(Tpp`f4%M?A~>u;%8uw^5NMP0v{Spb^y)F+BJMxxsSa`R}b6U<1ea8Xr@P_yp=*m9^eI zc`A3;e06#h!yPVAm?PQS(l`oIw^z)VA_fdOqE=9{u>#(EICbi*G>g$5a-&C-rG?xH zHKZ-gFLlrSZLB72FSljsKNc-?rQ*Qe(2b~pyKmSOT-l%;Q!7%jjV+qfHAjsI7`&}F z+V&om6I-r&gA-M6B9I=EkQoQ*>Mv-?J}EYmjw|PI-d`h2(`Rox|>oAaY$K>m&(r65}rD0PIC$_{4H- z`=>;XlSCBkWzy&CTXqi<2J0dsnm6++XPFo1^6e=3eW1sZ;|=psAS zvk|bjkhp=0-p2hEK0b!fBN9r&da3@PRWlx+{k(iYGY68zhJ;AIYc)6&_pAw8=o`OW z*rou*2~5oK=-X!EEoO3Q1GUO&JGyxqyQ-oVx`Qet-RXUO$#-*1ihP*k#r=eKr>-*H z9~Jra#|gOQtlrRNuIpAgA~$6$(}tpYkUAF2oPYkGxQb${A`3NdN~it+`kHD5^F&e9 z7f{ZSvG+bYyLYmkQY8>KO^Pp-V|ppI9+&l1XToG^0t0RXNl|`tJcmPH3D2+BmQmL@|R9(RbTpdseI7l1zhw%ScqUMu7(359z7jp zC2DHL*|eHcIYVm`RTXONFjHlv{-?d=9|=ZTbAaLH;Y_tfVx} z8nsJQ#w3tSm#Dyf-8J<)u7&#S4JucKnD<1XXJ@g~KMfr|IS0S?EMo3pwg|_lsVY2z zVBeAm}NS-HcYobrB~R`+TQ zI&*&(cn=~IZU?dJwFxm#zTvKd~N94}po)805iO&|8+&I}o^($+|k9zc_C5gw5MaTwO+FHmq&LHo%& fp#P!(h+8;dyP9_*fO%c4{ Date: Thu, 14 Jun 2012 10:41:04 -0400 Subject: [PATCH 111/412] bugfix was filling jail_list with $jail_enable --- conf/type/__jail/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 7ebe26eb..2db3fac0 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -293,7 +293,7 @@ if [ "$onboot" = "true" ]; then # if necessary cat <>/etc/rc.conf else From a772b33abd86893b7570fea8f565e3370a2d1103 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 14 Jun 2012 17:01:59 +0200 Subject: [PATCH 112/412] changes(2.0.14)++ Signed-off-by: Nico Schottelius --- doc/changelog | 3 ++ doc/dev/logs/2012-06-06.wikipedia | 89 +++++++++++++++++++++---------- 2 files changed, 65 insertions(+), 27 deletions(-) diff --git a/doc/changelog b/doc/changelog index 60b21f90..45e20a58 100644 --- a/doc/changelog +++ b/doc/changelog @@ -4,6 +4,9 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius +2.0.14: + * Bugfix Type: __jail: Use correct variable (Jake Guffey) + 2.0.13: 2012-06-05 * Bugfix __ssh_authorized_key: Ensure it sets proper group (contradict) * Bugfix __addifnosuchline: Fixed quotes/interpolation bug ("a b" became "a b") diff --git a/doc/dev/logs/2012-06-06.wikipedia b/doc/dev/logs/2012-06-06.wikipedia index 696082e7..a9654f1b 100644 --- a/doc/dev/logs/2012-06-06.wikipedia +++ b/doc/dev/logs/2012-06-06.wikipedia @@ -1,3 +1,4 @@ +{{db-spam}} {{Infobox software |name = cdist |logo = @@ -21,35 +22,69 @@ |website = http://www.nico.schottelius.org/software/cdist/ }} -'''cdist''' is a usable configuration management system. It adheres to the KISS principle and is being used in small up to enterprise grade environments. cdist is an alternative to other configuration management systems like cfengine, bcfg2, chef and puppet. +'''cdist''' is a configuration management system, which adheres to the [[KISS_principle]]. It is being used in small up to enterprise grade environments. +cdist is an alternative to other configuration management systems [[CFEngine]], [[Bcfg2]], [[Chef (software)|Chef]] and [[Puppet (software)|Puppet]]. +cdist development started in 2010 at [[ETH Zurich]] and is actively being developed by a lot of [[FOSS]] contributors +and maintained by the two main developers Nico Schottelius and +Steven Armstrong. cdist is being watched on github by more than 100 people and has more than 30 forks.cdist development at https://github.com/telmich/cdist +The major part of the discussion about cdist happens on the mailinglistcdist mailinglist http://l.schottelius.org/mailman/listinfo/cdist +and on the IRC channel #cstar in the [[Freenode]] network. cdist is being used at various companies in Switzerland (for instance at [[ETH Zurich]]), the USA, Germany and France. + Its core is written in [[Python (programming language)|Python]] and the types are written in [[Bourne Shell]]. Cdist is released under the [[GNU General Public License|GPL]]. -cdist has been a no. 1 topic on Hackernews for some time.cdist on hackernews https://news.ycombinator.com/item?id=3422678 - -cdist is actively being developed in Switzerland by the two main developer Nico Schottelius and Steven Armstrong. +cdist has been a no. 1 topic on [[Hacker News]] for some time.cdist on [[Hacker News]] https://news.ycombinator.com/item?id=3422678 -==Architecture== +== Architecture == -cdist is being used to configure small to a large number of hosts in a scalable manner. -In cdist the user describes at a central position (the **initial manifest**), -what the target state of a system should be. So called **types** are being used to realise -the appropriate functionality on hosts. +cdist is split into two components: -In comparison to other configuration management software, cdist +* The core +* The configuration -* does not have any requirements on the target host besides SSH and a bourne shell -* operates in push based approach (a server pushes to the clients, clients usually do not poll) -* is highly scalable by design -** If configuring more hosts in parallel than possible on one host is needed, adding more CPUs or more configurations servers to scale out is supported. +=== Core === +The core of cdist is implemented in Python 3 and provides the executables to configure target hosts. The core operates in a push model: It connects +from the source host '''to''' the target hosts and configures the machines. For communication and file transfer [[SSH]] is being used. +To allow parallel configuration of hosts, the core supports a parallel mode in which it creates a child process for every connection. +This model allows cdist to scale horizontally with the available computing resources: If at a certain limit is reached and the capacity of the +available CPUs has been used, adding another CPU or distributing cdist to multiple hosts allows to configure more hosts in parallel. + +=== Configuration === + +The configuration is written in [[Bourne Shell]] and consists of + +* The initial manifest (which defines which host is assigned which types) +* Global Explorers (to gain information about the target system) +* Types (which provide all functionality and consist of a manifest, type explorers and gencode scripts) + +Although all of these are written in Shell script, the order of execution in the manifests does not matter: cdist employs a idempotent +configuration. + +=== Comparison === + +In comparison to most other configuration management software, cdist does not have any requirements on the target host besides SSH and a bourne shell. +It requires Python 3.2 on the source host, though.Why cdist requires Python 3.2 on the source host - http://www.nico.schottelius.org/blog/cdist-python-3.2-requirement/ +cdist operates in push based approach, in which a server pushes configurations to the client and the clients do not poll for updates. == Configuration DSL == All user configurable parts are contained in manifests or gencode-scripts, which are shell scripts. -The idea behind shell scripts is to give the System Administrators a simple way DSL, that is known to them. -Although the core is written in Python, a user does not need to know any Python at all. +Shell scripts were chosen, because Unix System Administrators are usually profound in reading +and writing shell scripts. + +cdist reads its configuration from the initial manifest ('''conf/manifest/init'''), in which hosts are mapped to +types: + +
+case "$__target_host" in
+    myhostname)
+        __package zsh --state present
+        __addifnosuchline /tmp/cdist-welcome --line "Welcome to cdist"
+    ;;
+esac
+
When using the types in cdist, they are called like normal programs in manifests and can make use of advanced parameter parsing as well as reading from stdin: @@ -66,18 +101,14 @@ Here goes the content for /tmp/whatever DONE +Dependencies are expressed by setting up the '''require''' environment variable: +
+      __directory /tmp/foobar
+      require="__directory//tmp/foobar" __file /tmp/foobar/baz
+
+ Access to paths and files within types is given by environment variables like $__object. -==Platform support== - -cdist is known to be running on a variety of Unix flavors, but can in theory also run on Windows. This has not been tested though. - - -==Users== - -cdist is being used at various companies in Switzerland (for instance at [[ETH Zurich]]), the USA, Germany and France. -cdist is being watched on github by more than 100 people and has more than 30 forks.Github project page https://github.com/telmich/cdist - == See also == {{Portal|Free software}} @@ -90,10 +121,14 @@ cdist is being watched on github by more than 100 people and has more than 30 fo * [http://www.nico.schottelius.org/software/cdist/ cdist Website] * [https://github.com/telmich/cdist Github home] * [http://l.schottelius.org/mailman/listinfo/cdist cdist mailinglist] -* [https://freecode.com/projects/cdist cdist on freencode] +* [https://freecode.com/projects/cdist cdist on freecode] [[Category:Configuration management]] [[Category:Free software programmed in Python]] [[Category:2010 software]] +[[Category:Linux configuration utilities]] +[[Category:Mac OS X]] +[[Category:Linux package management-related software]] +[[Category:Unix package management-related software]] From c8fa79d05350732d29ce23fa665d0c121999d7c4 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Thu, 14 Jun 2012 14:33:21 -0400 Subject: [PATCH 113/412] Parameter change Modified jailbase parameter such that it's only required when $state=present --- conf/type/__jail/gencode-local | 22 ++++++++++++++++++---- conf/type/__jail/gencode-remote | 14 +++++++++++++- conf/type/__jail/parameter/optional | 1 + conf/type/__jail/parameter/required | 1 - 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/conf/type/__jail/gencode-local b/conf/type/__jail/gencode-local index 6292d943..075a6ef1 100755 --- a/conf/type/__jail/gencode-local +++ b/conf/type/__jail/gencode-local @@ -28,12 +28,26 @@ else jaildir="/usr/jail" fi -jailbase="$(cat "$__object/parameter/jailbase")" +if [ -f "$__object/parameter/jailbase" ]; then + jailbase="$(cat "$__object/parameter/jailbase")" +else + jailbase="" +fi + +state="$(cat "$__object/parameter/state")" + +if [ "$state" = "present" ] && [ -z "$jailbase" ]; then + exec >&2 + echo "jailbase is a REQUIRED parameter when state=present!" + exit 1 +fi remotebase="${jaildir}/jailbase.tgz" basepresent="$(cat "$__object/explorer/basepresent")" -if [ "$basepresent" = "NONE" ]; then - echo "$__remote_copy" "${jailbase}" "$__target_host:${remotebase}" -fi +if [ "$state" = "present" ]; then + if [ "$basepresent" = "NONE" ]; then + echo "$__remote_copy" "${jailbase}" "$__target_host:${remotebase}" + fi # basepresent=NONE +fi # state=present diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 2db3fac0..d26e02ac 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -177,6 +177,7 @@ cat < --- conf/type/__start_on_boot/gencode-remote | 4 ++-- conf/type/__start_on_boot/manifest | 24 ------------------------ 2 files changed, 2 insertions(+), 26 deletions(-) delete mode 100755 conf/type/__start_on_boot/manifest diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index 78a82de3..7bb69ff5 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -19,10 +19,10 @@ # # -state_should="$(cat "$__object/parameter/state")" +state_should="$(cat "$__object/parameter/state" 2>/dev/null || echo present)" state_is=$(cat "$__object/explorer/state") -# Nothing todo, go away +# Short circuit if nothing is to be done [ "$state_should" = "$state_is" ] && exit 0 os=$(cat "$__global/explorer/os") diff --git a/conf/type/__start_on_boot/manifest b/conf/type/__start_on_boot/manifest deleted file mode 100755 index 6b5e1ca7..00000000 --- a/conf/type/__start_on_boot/manifest +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# 2012 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# - -# set default: present, if not setup -statefile="$__object/parameter/state" -[ -f "$statefile" ] || echo present > "$statefile" From 99b544c6e497c2a39ea2668a17c42959b8755367 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 15 Jun 2012 10:04:18 +0200 Subject: [PATCH 117/412] ++changes(2.0.14) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 9f93457a..e5384624 100644 --- a/doc/changelog +++ b/doc/changelog @@ -7,6 +7,7 @@ Changelog 2.0.14: * Bugfix Type: __jail: Use correct variable (Jake Guffey) * Change Type: __jail: Parameter jailbase now optional (Jake Guffey) + * Bugfix Type: __start_on_boot: Do not change parameters 2.0.13: 2012-06-05 * Bugfix __ssh_authorized_key: Ensure it sets proper group (contradict) From a3981f58fd04f4289046ee42b8125bab3d622cfe Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 15 Jun 2012 10:23:19 +0200 Subject: [PATCH 118/412] Initial support for SuSE, including zypper, including __start_on_boot Signed-off-by: Nico Schottelius --- conf/type/__package/manifest | 1 + conf/type/__package_yum/explorer/pkg_version | 4 +- .../__package_zypper/explorer/pkg_version | 30 +++++++++++ conf/type/__package_zypper/gencode-remote | 52 +++++++++++++++++++ conf/type/__package_zypper/man.text | 52 +++++++++++++++++++ conf/type/__package_zypper/parameter/optional | 1 + conf/type/__package_zypper/parameter/required | 1 + conf/type/__start_on_boot/explorer/state | 2 +- conf/type/__start_on_boot/gencode-remote | 4 +- 9 files changed, 142 insertions(+), 5 deletions(-) create mode 100755 conf/type/__package_zypper/explorer/pkg_version create mode 100755 conf/type/__package_zypper/gencode-remote create mode 100644 conf/type/__package_zypper/man.text create mode 100644 conf/type/__package_zypper/parameter/optional create mode 100644 conf/type/__package_zypper/parameter/required diff --git a/conf/type/__package/manifest b/conf/type/__package/manifest index 118525b1..6a84cb7f 100755 --- a/conf/type/__package/manifest +++ b/conf/type/__package/manifest @@ -35,6 +35,7 @@ else debian|ubuntu) type="apt" ;; freebsd) type="pkg_freebsd" ;; gentoo) type="emerge" ;; + suse) type="zypper" ;; openwrt) type="opkg" ;; *) echo "Don't know how to manage packages on: $os" >&2 diff --git a/conf/type/__package_yum/explorer/pkg_version b/conf/type/__package_yum/explorer/pkg_version index 0e078f68..fb3b7753 100755 --- a/conf/type/__package_yum/explorer/pkg_version +++ b/conf/type/__package_yum/explorer/pkg_version @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -18,7 +18,7 @@ # along with cdist. If not, see . # # -# Retrieve the status of a package - parsed dpkg output +# Retrieve the status of a package # if [ -f "$__object/parameter/name" ]; then diff --git a/conf/type/__package_zypper/explorer/pkg_version b/conf/type/__package_zypper/explorer/pkg_version new file mode 100755 index 00000000..fb3b7753 --- /dev/null +++ b/conf/type/__package_zypper/explorer/pkg_version @@ -0,0 +1,30 @@ +#!/bin/sh +# +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Retrieve the status of a package +# + +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/conf/type/__package_zypper/gencode-remote b/conf/type/__package_zypper/gencode-remote new file mode 100755 index 00000000..3323d6b1 --- /dev/null +++ b/conf/type/__package_zypper/gencode-remote @@ -0,0 +1,52 @@ +#!/bin/sh +# +# 2012 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Manage packages with Zypper (mostly suse) +# + +# Debug +# exec >&2 +# set -x + +globalopts="--quiet --non-interactive" + +if [ -f "$__object/parameter/name" ]; then + name="$__object/parameter/name" +else + name="$__object_id" +fi + +state_should="$(cat "$__object/parameter/state")" + +# Exit if nothing is needed to be done +[ "$state_is" = "$state_should" ] && exit 0 + +case "$state_should" in + present) + echo zypper "$globalopts" install --auto-agree-with-licenses \"$name\" + ;; + absent) + echo pacman "$globalopts" remove \"$name\" + ;; + *) + echo "Unknown state: $state_should" >&2 + exit 1 + ;; +esac diff --git a/conf/type/__package_zypper/man.text b/conf/type/__package_zypper/man.text new file mode 100644 index 00000000..9cff9706 --- /dev/null +++ b/conf/type/__package_zypper/man.text @@ -0,0 +1,52 @@ +cdist-type__package_zypper(7) +============================= +Nico Schottelius + + +NAME +---- +cdist-type__package_zypper - Manage packages with zypper + + +DESCRIPTION +----------- +Zypper is usually used on the SuSE distribution to manage packages. + + +REQUIRED PARAMETERS +------------------- +state:: + The state the package should be in, either "present" or "absent" + + +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 present + +# If you don't want to follow pythonX packages, but always use python +__package_zypper python --state present --name python2 + +# Remove package +__package_zypper cfengine --state absent +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- cdist-type__package(7) + + +COPYING +------- +Copyright \(C) 2012 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__package_zypper/parameter/optional b/conf/type/__package_zypper/parameter/optional new file mode 100644 index 00000000..f121bdbf --- /dev/null +++ b/conf/type/__package_zypper/parameter/optional @@ -0,0 +1 @@ +name diff --git a/conf/type/__package_zypper/parameter/required b/conf/type/__package_zypper/parameter/required new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/conf/type/__package_zypper/parameter/required @@ -0,0 +1 @@ +state diff --git a/conf/type/__start_on_boot/explorer/state b/conf/type/__start_on_boot/explorer/state index bf24738a..6fd0ea92 100755 --- a/conf/type/__start_on_boot/explorer/state +++ b/conf/type/__start_on_boot/explorer/state @@ -49,7 +49,7 @@ case "$os" in [ -f "/etc/rc$runlevel.d/S"??"$name" ] || state="absent" ;; - amazon|centos|fedora|owl|redhat) + amazon|centos|fedora|owl|redhat|suse) state=$(chkconfig --level "$runlevel" "$name" || echo absent) [ "$state" ] || state="present" ;; diff --git a/conf/type/__start_on_boot/gencode-remote b/conf/type/__start_on_boot/gencode-remote index 7bb69ff5..7724e8c7 100755 --- a/conf/type/__start_on_boot/gencode-remote +++ b/conf/type/__start_on_boot/gencode-remote @@ -44,7 +44,7 @@ case "$state_should" in # echo rc-update add \"$name\" default # ;; - amazon|centos|fedora|owl|redhat) + amazon|centos|fedora|owl|redhat|suse) echo chkconfig \"$name\" on ;; @@ -79,7 +79,7 @@ case "$state_should" in # echo rc-update del \"$name\" # ;; - centos|fedora|owl|redhat) + centos|fedora|owl|redhat|suse) echo chkconfig \"$name\" off ;; From bd451a2e591319cba1730d89eeece9642c3726d5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 15 Jun 2012 13:31:59 +0200 Subject: [PATCH 119/412] remove obsolete submission Signed-off-by: Nico Schottelius --- .../__package_zypper/README.inclusion | 5 -- .../__package_zypper/explorer/pkg_version | 30 ----------- .../__package_zypper/gencode-remote | 51 ------------------ .../__package_zypper/man.text | 52 ------------------- .../__package_zypper/parameter/optional | 1 - .../__package_zypper/parameter/required | 1 - 6 files changed, 140 deletions(-) delete mode 100644 other/types_submitted_for_inclusion/__package_zypper/README.inclusion delete mode 100755 other/types_submitted_for_inclusion/__package_zypper/explorer/pkg_version delete mode 100755 other/types_submitted_for_inclusion/__package_zypper/gencode-remote delete mode 100644 other/types_submitted_for_inclusion/__package_zypper/man.text delete mode 100644 other/types_submitted_for_inclusion/__package_zypper/parameter/optional delete mode 100644 other/types_submitted_for_inclusion/__package_zypper/parameter/required diff --git a/other/types_submitted_for_inclusion/__package_zypper/README.inclusion b/other/types_submitted_for_inclusion/__package_zypper/README.inclusion deleted file mode 100644 index 1e073e3f..00000000 --- a/other/types_submitted_for_inclusion/__package_zypper/README.inclusion +++ /dev/null @@ -1,5 +0,0 @@ -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/other/types_submitted_for_inclusion/__package_zypper/explorer/pkg_version b/other/types_submitted_for_inclusion/__package_zypper/explorer/pkg_version deleted file mode 100755 index 0e078f68..00000000 --- a/other/types_submitted_for_inclusion/__package_zypper/explorer/pkg_version +++ /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 . -# -# -# 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/other/types_submitted_for_inclusion/__package_zypper/gencode-remote b/other/types_submitted_for_inclusion/__package_zypper/gencode-remote deleted file mode 100755 index 2d1112d3..00000000 --- a/other/types_submitted_for_inclusion/__package_zypper/gencode-remote +++ /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 . -# -# -# 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/other/types_submitted_for_inclusion/__package_zypper/man.text b/other/types_submitted_for_inclusion/__package_zypper/man.text deleted file mode 100644 index 3a4f1026..00000000 --- a/other/types_submitted_for_inclusion/__package_zypper/man.text +++ /dev/null @@ -1,52 +0,0 @@ -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/other/types_submitted_for_inclusion/__package_zypper/parameter/optional b/other/types_submitted_for_inclusion/__package_zypper/parameter/optional deleted file mode 100644 index f121bdbf..00000000 --- a/other/types_submitted_for_inclusion/__package_zypper/parameter/optional +++ /dev/null @@ -1 +0,0 @@ -name diff --git a/other/types_submitted_for_inclusion/__package_zypper/parameter/required b/other/types_submitted_for_inclusion/__package_zypper/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/other/types_submitted_for_inclusion/__package_zypper/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state From f23e869277477973cac902b100ab74739e2fcb35 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 15 Jun 2012 13:32:12 +0200 Subject: [PATCH 120/412] ++changes(2.0.14) Signed-off-by: Nico Schottelius --- doc/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/changelog b/doc/changelog index e5384624..7d2c3efc 100644 --- a/doc/changelog +++ b/doc/changelog @@ -8,6 +8,8 @@ Changelog * Bugfix Type: __jail: Use correct variable (Jake Guffey) * Change Type: __jail: Parameter jailbase now optional (Jake Guffey) * Bugfix Type: __start_on_boot: Do not change parameters + * New Type: __package_zypper + * Feature Types: Initial Support for SuSE Linux 2.0.13: 2012-06-05 * Bugfix __ssh_authorized_key: Ensure it sets proper group (contradict) From 2a20b01a3f9462daeddd23b71c55cb2cf0a07d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Mon, 18 Jun 2012 17:54:19 +0200 Subject: [PATCH 121/412] Shorten option for both useradd and usermod. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need to shorten options for both usermod and useradd since on some systems (such as *BSD, Darwin) those commands do not handle GNU style long options. Signed-off-by: Sébastien Gross --- conf/type/__user/gencode-remote | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/conf/type/__user/gencode-remote b/conf/type/__user/gencode-remote index 8979c56e..bbf373d4 100755 --- a/conf/type/__user/gencode-remote +++ b/conf/type/__user/gencode-remote @@ -24,6 +24,22 @@ name="$__object_id" +# We need to shorten options for both usermod and useradd since on some +# systems (such as *BSD, Darwin) those commands do not handle GNU style long +# options. +shorten_property() { + RET= + case "$1" in + comment) RET="-c";; + home) RET="-d";; + gid) RET="-g";; + groups) RET="-G";; + password) RET="-p";; + shell) RET="-s";; + uid) RET="-u";; + esac +} + cd "$__object/parameter" if grep -q "^${name}:" "$__object/explorer/passwd"; then for property in $(ls .); do @@ -67,7 +83,8 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then fi if [ "$new_value" != "$current_value" ]; then - set -- "$@" "--$property" \'$new_value\' + shorten_property $property + set -- "$@" "$RET" \'$new_value\' fi done @@ -79,7 +96,8 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then else for property in $(ls .); do new_value="$(cat "$property")" - set -- "$@" "--$property" \'$new_value\' + shorten_property $property + set -- "$@" "$RET" \'$new_value\' done echo useradd "$@" "$name" From d591b5f2be9b65264ee500fc8af56e17b5675d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Tue, 19 Jun 2012 10:29:20 +0200 Subject: [PATCH 122/412] Do not use global variable. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Gross --- conf/type/__user/gencode-remote | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/conf/type/__user/gencode-remote b/conf/type/__user/gencode-remote index bbf373d4..5a868b67 100755 --- a/conf/type/__user/gencode-remote +++ b/conf/type/__user/gencode-remote @@ -28,16 +28,17 @@ name="$__object_id" # systems (such as *BSD, Darwin) those commands do not handle GNU style long # options. shorten_property() { - RET= - case "$1" in - comment) RET="-c";; - home) RET="-d";; - gid) RET="-g";; - groups) RET="-G";; - password) RET="-p";; - shell) RET="-s";; - uid) RET="-u";; - esac + local ret="" + case "$1" in + comment) ret="-c";; + home) ret="-d";; + gid) ret="-g";; + groups) ret="-G";; + password) ret="-p";; + shell) ret="-s";; + uid) ret="-u";; + esac + echo "$ret" } cd "$__object/parameter" @@ -83,8 +84,8 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then fi if [ "$new_value" != "$current_value" ]; then - shorten_property $property - set -- "$@" "$RET" \'$new_value\' + local option=$(shorten_property $property) + set -- "$@" "$option" \'$new_value\' fi done @@ -96,8 +97,8 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then else for property in $(ls .); do new_value="$(cat "$property")" - shorten_property $property - set -- "$@" "$RET" \'$new_value\' + local option=$(shorten_property $property) + set -- "$@" "$option" \'$new_value\' done echo useradd "$@" "$name" From 61030f1c18f84df5d068166288ccd5cf4b3a5d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Tue, 19 Jun 2012 10:55:50 +0200 Subject: [PATCH 123/412] Remove local variables statements. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Gross --- conf/type/__user/gencode-remote | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/conf/type/__user/gencode-remote b/conf/type/__user/gencode-remote index 5a868b67..7e175f60 100755 --- a/conf/type/__user/gencode-remote +++ b/conf/type/__user/gencode-remote @@ -28,7 +28,7 @@ name="$__object_id" # systems (such as *BSD, Darwin) those commands do not handle GNU style long # options. shorten_property() { - local ret="" + unset ret case "$1" in comment) ret="-c";; home) ret="-d";; @@ -84,8 +84,7 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then fi if [ "$new_value" != "$current_value" ]; then - local option=$(shorten_property $property) - set -- "$@" "$option" \'$new_value\' + set -- "$@" "$(shorten_property $property)" \'$new_value\' fi done @@ -97,8 +96,7 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then else for property in $(ls .); do new_value="$(cat "$property")" - local option=$(shorten_property $property) - set -- "$@" "$option" \'$new_value\' + set -- "$@" "$(shorten_property $property)" \'$new_value\' done echo useradd "$@" "$name" From 37eabffd9ccaa4181a7c8d6f375a6ca189fdaa6c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 19 Jun 2012 14:17:50 +0200 Subject: [PATCH 124/412] ++changes(2.0.14) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 7d2c3efc..9160a817 100644 --- a/doc/changelog +++ b/doc/changelog @@ -8,6 +8,7 @@ Changelog * Bugfix Type: __jail: Use correct variable (Jake Guffey) * Change Type: __jail: Parameter jailbase now optional (Jake Guffey) * Bugfix Type: __start_on_boot: Do not change parameters + * Feature __user: Added support for BSDs (Sébastien Gross) * New Type: __package_zypper * Feature Types: Initial Support for SuSE Linux From f6bd5290b31da84cd374b00dfc5198167f6ef770 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 20 Jun 2012 17:14:47 -0400 Subject: [PATCH 125/412] Add FreeBSD support Modified explorer/gshadow to do nothing on FreeBSD (unsupported command) Modified gencode-remote to use short options (--long not supported in FreeBSD) --- conf/type/__group/explorer/gshadow | 6 +++++ conf/type/__group/gencode-remote | 42 ++++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/conf/type/__group/explorer/gshadow b/conf/type/__group/explorer/gshadow index e3c2dd6c..5ab4ed80 100755 --- a/conf/type/__group/explorer/gshadow +++ b/conf/type/__group/explorer/gshadow @@ -23,6 +23,12 @@ name=$__object_id os_version="$($__explorer/os_version)" +os="$($__explorer/os)" + +if [ "$os" = "freebsd" ]; then + echo "FreeBSD does not have getent gshadow" + exit 0 +fi case "$os_version" in "Red Hat Enterprise Linux Server release "[45]*|"CentOS release "[45]*) diff --git a/conf/type/__group/gencode-remote b/conf/type/__group/gencode-remote index 2b4774ab..d2bdb6fb 100755 --- a/conf/type/__group/gencode-remote +++ b/conf/type/__group/gencode-remote @@ -24,6 +24,7 @@ name="$__object_id" os_version="$(cat "$__global/explorer/os_version")" +os="$(cat "$__global/explorer/os")" cd "$__object/parameter" if grep -q "^${name}:" "$__object/explorer/group"; then @@ -36,6 +37,10 @@ if grep -q "^${name}:" "$__object/explorer/group"; then case "$property" in password) current_value="$(awk -F: '{ print $2 }' < "$__object/explorer/gshadow")" + if [ "$os" = "freebsd" ]; then + echo "group/$name: FreeBSD doesn't support password modification" >&2 + exit 1 + fi case "$os_version" in "Red Hat Enterprise Linux Server release "[45]*|"CentOS release "[45]*) # TODO: Use gpasswd? Need to fix gshadow explorer first. @@ -57,15 +62,42 @@ if grep -q "^${name}:" "$__object/explorer/group"; then done if [ $# -gt 0 ]; then - echo groupmod "$@" "$name" - else - true + case $os in + freebsd) + echo pw group mod "$@" "$name" + ;; + *) + echo groupmod "$@" "$name" + ;; + esac fi else for property in $(ls .); do new_value="$(cat "$property")" - set -- "$@" "--$property" \"$new_value\" + if [ "$os" = "freebsd" ]; then + case $property in + gid) + proparg="-g" + ;; + *) + echo "Unknown property: $property" >&2 + exit 1 + ;; + esac + else + proparg="--$property" + fi + + set -- "$@" "$proparg" \"$new_value\" done - echo groupadd "$@" "$name" + case $os in + freebsd) + echo pw group add "$@" "$name" + ;; + *) + echo groupadd "$@" "$name" + ;; + esac fi + From 6264a9b718583626e8fdcb9608afb8da759b0541 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 20 Jun 2012 17:22:19 -0400 Subject: [PATCH 126/412] Don't use shadow passwords on FreeBSD shadow database doesn't exist by default in FreeBSD -- use "passwd" database --- conf/type/__user/explorer/shadow | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/conf/type/__user/explorer/shadow b/conf/type/__user/explorer/shadow index c75e36f4..a949ec51 100755 --- a/conf/type/__user/explorer/shadow +++ b/conf/type/__user/explorer/shadow @@ -22,6 +22,13 @@ # name=$__object_id +os="$($__explorer/os)" +# Default to using shadow passwords +database="shadow" -getent shadow "$name" || true +if [ "$os" = "freebsd" ]; then + database="passwd" +fi + +getent "$database" "$name" || true From ba576b3931719b15fa97234d5f5cdca244b9349e Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Thu, 21 Jun 2012 11:59:53 -0400 Subject: [PATCH 127/412] Don't symlink multiple times Was checking for existence of $jaildir/home -- never exists; will always create new symlink Changed to look for directory or symlink at $jaildir/base/home and respond accordingly --- conf/type/__jail/gencode-remote | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 62aa7b60..71bb31b5 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -185,10 +185,12 @@ cat < Date: Fri, 22 Jun 2012 09:30:47 +0200 Subject: [PATCH 128/412] ignore errors in global explorers Signed-off-by: Steven Armstrong --- conf/explorer/hostname | 5 ++++- conf/explorer/interfaces | 5 +++++ conf/explorer/machine | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/conf/explorer/hostname b/conf/explorer/hostname index a3ae4e15..429a5077 100755 --- a/conf/explorer/hostname +++ b/conf/explorer/hostname @@ -1,6 +1,7 @@ #!/bin/sh # # 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2012 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -19,4 +20,6 @@ # # -hostname +if which hostname >/dev/null 2>&1; then + hostname +fi diff --git a/conf/explorer/interfaces b/conf/explorer/interfaces index 76ff32bb..5333b408 100755 --- a/conf/explorer/interfaces +++ b/conf/explorer/interfaces @@ -29,6 +29,11 @@ if which ip >/dev/null 2>&1; then exit 0 fi +if ! which ifconfig >/dev/null 2>&1; then + # no ifconfig, nothing we could do + exit 0 +fi + uname_s="$(uname -s)" REGEXP='s/^(.*)(:[[:space:]]*flags=|Link encap).*/\1/p' diff --git a/conf/explorer/machine b/conf/explorer/machine index 25fc76a9..d295c8e0 100755 --- a/conf/explorer/machine +++ b/conf/explorer/machine @@ -22,4 +22,6 @@ # # -uname -m +if which uname >/dev/null 2>&1; then + uname -m +fi From b09d9786d25c31428f6175e1adaa84d6b9dbb6e6 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 22 Jun 2012 15:36:14 +0200 Subject: [PATCH 129/412] sync and remove require different options Signed-off-by: Steven Armstrong --- conf/type/__package_pacman/gencode-remote | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/conf/type/__package_pacman/gencode-remote b/conf/type/__package_pacman/gencode-remote index 9defabe8..e585ee86 100755 --- a/conf/type/__package_pacman/gencode-remote +++ b/conf/type/__package_pacman/gencode-remote @@ -25,8 +25,6 @@ # exec >&2 # set -x -pacopts="--needed --noconfirm --noprogressbar" - if [ -f "$__object/parameter/name" ]; then name="$__object/parameter/name" else @@ -57,10 +55,10 @@ fi case "$state_should" in present) - echo pacman "$pacopts" -S \"$name\" + echo pacman --needed --noconfirm --noprogressbar -S \"$name\" ;; absent) - echo pacman "$pacopts" -R \"$name\" + echo pacman --noconfirm --noprogressbar -R \"$name\" ;; *) echo "Unknown state: $state_should" >&2 From 686554358a8f3b5eb64da8a4578d6d57e8fa62c9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 25 Jun 2012 19:12:00 +0200 Subject: [PATCH 130/412] ++changes(2.0.14) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 9160a817..a70cdefe 100644 --- a/doc/changelog +++ b/doc/changelog @@ -7,6 +7,7 @@ Changelog 2.0.14: * Bugfix Type: __jail: Use correct variable (Jake Guffey) * Change Type: __jail: Parameter jailbase now optional (Jake Guffey) + * Bugfix Type: __user: Use passwd database on FreeBSD (Jake Guffey) * Bugfix Type: __start_on_boot: Do not change parameters * Feature __user: Added support for BSDs (Sébastien Gross) * New Type: __package_zypper From 946d2b9d43b9336783809c0c28e5b72b0a43c988 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Mon, 25 Jun 2012 13:19:19 -0400 Subject: [PATCH 131/412] Change order of checks per telmich's suggestion in https://github.com/telmich/cdist/pull/82/files#r1043875 --- conf/type/__group/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__group/gencode-remote b/conf/type/__group/gencode-remote index d2bdb6fb..f42e8524 100755 --- a/conf/type/__group/gencode-remote +++ b/conf/type/__group/gencode-remote @@ -36,7 +36,6 @@ if grep -q "^${name}:" "$__object/explorer/group"; then case "$property" in password) - current_value="$(awk -F: '{ print $2 }' < "$__object/explorer/gshadow")" if [ "$os" = "freebsd" ]; then echo "group/$name: FreeBSD doesn't support password modification" >&2 exit 1 @@ -48,6 +47,7 @@ if grep -q "^${name}:" "$__object/explorer/group"; then exit 1 ;; esac + current_value="$(awk -F: '{ print $2 }' < "$__object/explorer/gshadow")" ;; gid) # set to -g to support older redhat/centos From fbdbbddf3bfd22808219bf15e94aea38b95c536b Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Mon, 25 Jun 2012 13:29:10 -0400 Subject: [PATCH 132/412] Align messages for "password" parameter Use same general message if the "password" parameter is given for a FreeBSD target host whether the group exists yet or not Make language clearer surrounding the default case --- conf/type/__group/gencode-remote | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/conf/type/__group/gencode-remote b/conf/type/__group/gencode-remote index f42e8524..bb6797c2 100755 --- a/conf/type/__group/gencode-remote +++ b/conf/type/__group/gencode-remote @@ -79,8 +79,14 @@ else gid) proparg="-g" ;; + password) + echo "group/$name: FreeBSD doesn't support password setting" >&2 + exit 1 + ;; *) - echo "Unknown property: $property" >&2 + # The type has been updated to support more properties than it knows how to handle for FreeBSD + # tell the user about this. + echo "Currently unknown property: $property" >&2 exit 1 ;; esac From d13a201cd092b5eb078988d53224a8ec52d4152b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 25 Jun 2012 20:19:10 +0200 Subject: [PATCH 133/412] /which/command -v/ Signed-off-by: Steven Armstrong --- conf/explorer/hostname | 2 +- conf/explorer/interfaces | 4 ++-- conf/explorer/lsb_codename | 2 +- conf/explorer/lsb_description | 2 +- conf/explorer/lsb_id | 2 +- conf/explorer/lsb_release | 2 +- conf/explorer/machine | 2 +- conf/explorer/runlevel | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/conf/explorer/hostname b/conf/explorer/hostname index 429a5077..2ae23759 100755 --- a/conf/explorer/hostname +++ b/conf/explorer/hostname @@ -20,6 +20,6 @@ # # -if which hostname >/dev/null 2>&1; then +if command -v hostname; then hostname fi diff --git a/conf/explorer/interfaces b/conf/explorer/interfaces index 5333b408..6804f2db 100755 --- a/conf/explorer/interfaces +++ b/conf/explorer/interfaces @@ -24,12 +24,12 @@ # # Use ip, if available -if which ip >/dev/null 2>&1; then +if command -v ip; then ip -o link show | sed -n 's/^[0-9]\+: \(.\+\): <.*/\1/p' exit 0 fi -if ! which ifconfig >/dev/null 2>&1; then +if ! command -v ifconfig; then # no ifconfig, nothing we could do exit 0 fi diff --git a/conf/explorer/lsb_codename b/conf/explorer/lsb_codename index 22b6d51e..eebd3e0f 100755 --- a/conf/explorer/lsb_codename +++ b/conf/explorer/lsb_codename @@ -25,7 +25,7 @@ case "$($__explorer/os)" in (. /etc/openwrt_release && echo "$DISTRIB_CODENAME") ;; *) - lsb_release=$(which lsb_release 2>/dev/null) + lsb_release=$(command -v lsb_release) if [ -x "$lsb_release" ]; then $lsb_release --short --codename fi diff --git a/conf/explorer/lsb_description b/conf/explorer/lsb_description index 48aff30d..23f45421 100755 --- a/conf/explorer/lsb_description +++ b/conf/explorer/lsb_description @@ -25,7 +25,7 @@ case "$($__explorer/os)" in (. /etc/openwrt_release && echo "$DISTRIB_DESCRIPTION") ;; *) - lsb_release=$(which lsb_release 2>/dev/null) + lsb_release=$(command -v lsb_release) if [ -x "$lsb_release" ]; then $lsb_release --short --description fi diff --git a/conf/explorer/lsb_id b/conf/explorer/lsb_id index 0dd0f9f4..9754eb63 100755 --- a/conf/explorer/lsb_id +++ b/conf/explorer/lsb_id @@ -25,7 +25,7 @@ case "$($__explorer/os)" in (. /etc/openwrt_release && echo "$DISTRIB_ID") ;; *) - lsb_release=$(which lsb_release 2>/dev/null) + lsb_release=$(command -v lsb_release) if [ -x "$lsb_release" ]; then $lsb_release --short --id fi diff --git a/conf/explorer/lsb_release b/conf/explorer/lsb_release index 8266171a..35b5547c 100755 --- a/conf/explorer/lsb_release +++ b/conf/explorer/lsb_release @@ -25,7 +25,7 @@ case "$($__explorer/os)" in (. /etc/openwrt_release && echo "$DISTRIB_RELEASE") ;; *) - lsb_release=$(which lsb_release 2>/dev/null) + lsb_release=$(command -v lsb_release) if [ -x "$lsb_release" ]; then $lsb_release --short --release fi diff --git a/conf/explorer/machine b/conf/explorer/machine index d295c8e0..bb6e0beb 100755 --- a/conf/explorer/machine +++ b/conf/explorer/machine @@ -22,6 +22,6 @@ # # -if which uname >/dev/null 2>&1; then +if command -v uname; then uname -m fi diff --git a/conf/explorer/runlevel b/conf/explorer/runlevel index 7cdd81ef..02d3a245 100755 --- a/conf/explorer/runlevel +++ b/conf/explorer/runlevel @@ -20,7 +20,7 @@ # set +e -executable=$(which runlevel 2>/dev/null) +executable=$(command -v runlevel) if [ -x "$executable" ]; then "$executable" | awk '{ print $2 }' fi From 676687dee114a48c1db861c9c84dcc2ae50e2758 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 28 Jun 2012 14:05:44 +0200 Subject: [PATCH 134/412] add hint for building from source Signed-off-by: Nico Schottelius --- README | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README b/README index 932375c4..d37569ef 100644 --- a/README +++ b/README @@ -104,6 +104,10 @@ Archlinux already has python >= 3.2, so you only need to do: pacman -S python +#### CentOS + +See the "From source" section + #### Debian For Debian >= wheezy: @@ -167,6 +171,22 @@ You can choose between Homebrew and Macports, either way works: port install python32 ln -s /opt/local/bin/python3.2 /opt/local/bin/python3 +#### From Source + +For those operating systems not yet support Python 3.2: + + pyversion=3.2.3 + wget http://www.python.org/ftp/python/$pyversion/Python-${pyversion}.tar.bz2 + tar xvfj Python-${pyversion}.tar.bz2 + cd Python-${pyversion} + ./configure + make + sudo make install + +This installs python 3.2 to /usr/local/bin. Ensure this directory is in +your PATH environment variable. + + ### Get cdist You can clone cdist from git, which gives you the advantage of having From 590a9e5026c75b8680a94d2202b01c09473868f5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 9 Jul 2012 17:57:12 +0200 Subject: [PATCH 135/412] ++changes(2.0.14) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index a70cdefe..589e3100 100644 --- a/doc/changelog +++ b/doc/changelog @@ -10,6 +10,7 @@ Changelog * Bugfix Type: __user: Use passwd database on FreeBSD (Jake Guffey) * Bugfix Type: __start_on_boot: Do not change parameters * Feature __user: Added support for BSDs (Sébastien Gross) + * Feature __group: Added support for FreeBSD (Jake Guffey) * New Type: __package_zypper * Feature Types: Initial Support for SuSE Linux From 1116bcc504bb1ebba99d75e2fa9be1589ecb6480 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Tue, 14 Aug 2012 08:39:33 -0400 Subject: [PATCH 136/412] Migrate from useradd/usermod to pw useradd/usermod don't exist in freebsd. --- conf/type/__user/gencode-remote | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/conf/type/__user/gencode-remote b/conf/type/__user/gencode-remote index 7e175f60..baa6f354 100755 --- a/conf/type/__user/gencode-remote +++ b/conf/type/__user/gencode-remote @@ -24,6 +24,8 @@ name="$__object_id" +os="$(cat "$__global/explorer/os")" + # We need to shorten options for both usermod and useradd since on some # systems (such as *BSD, Darwin) those commands do not handle GNU style long # options. @@ -89,7 +91,11 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then done if [ $# -gt 0 ]; then - echo usermod "$@" "$name" + if [ "$os" = "freebsd" ]; then + echo pw usermod "$@" "$name" + else + echo usermod "$@" "$name" + fi else true fi @@ -99,5 +105,9 @@ else set -- "$@" "$(shorten_property $property)" \'$new_value\' done - echo useradd "$@" "$name" + if [ "$os" = "freebsd" ]; then + echo pw useradd "$@" "$name" + else + echo useradd "$@" "$name" + fi fi From b6bff3a5515c6cf5a0ef4297c28e7cc1d58f2aa7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Sep 2012 14:06:19 +0200 Subject: [PATCH 137/412] version bump Signed-off-by: Nico Schottelius --- doc/changelog | 2 +- lib/cdist/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/changelog b/doc/changelog index 589e3100..add17af2 100644 --- a/doc/changelog +++ b/doc/changelog @@ -4,7 +4,7 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -2.0.14: +2.0.14: 2012-09-07 * Bugfix Type: __jail: Use correct variable (Jake Guffey) * Change Type: __jail: Parameter jailbase now optional (Jake Guffey) * Bugfix Type: __user: Use passwd database on FreeBSD (Jake Guffey) diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index 02df2f2f..85bc5f77 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -29,7 +29,7 @@ try: 'cd "%s" && git describe' % here, stderr=devnull, shell=True).decode('utf-8') except: - VERSION = "2.0.13" + VERSION = "2.0.14" BANNER = """ .. . .x+=:. s From 0775b84c403d1dc3192a1739537df4436dda8cac Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Sep 2012 14:02:43 +0200 Subject: [PATCH 138/412] bugfix: make __object_name available in type explorers Signed-off-by: Steven Armstrong --- lib/cdist/core/explorer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py index d49b7ac4..da84cfaa 100644 --- a/lib/cdist/core/explorer.py +++ b/lib/cdist/core/explorer.py @@ -135,6 +135,7 @@ class Explorer(object): env.update({ '__object': os.path.join(self.remote.object_path, cdist_object.path), '__object_id': cdist_object.object_id, + '__object_name': cdist_object.name, '__object_fq': cdist_object.path, '__type_explorer': os.path.join(self.remote.type_path, cdist_type.explorer_path) }) From c88d648520e62afee41782528629a87cf4e854ac Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Sep 2012 14:44:04 +0200 Subject: [PATCH 139/412] ++changes(2.0.15) Signed-off-by: Nico Schottelius --- doc/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/changelog b/doc/changelog index add17af2..af693bba 100644 --- a/doc/changelog +++ b/doc/changelog @@ -4,6 +4,9 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius +2.0.15: + * Core: Make variable __object_name available in type explorers (Steven Armtrong) + 2.0.14: 2012-09-07 * Bugfix Type: __jail: Use correct variable (Jake Guffey) * Change Type: __jail: Parameter jailbase now optional (Jake Guffey) From 1ad176aa638b4a259981f55b51133d09a9d4d465 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Fri, 7 Sep 2012 10:02:37 -0400 Subject: [PATCH 140/412] Fixed use of onboot parameter onboot parameter was being checked against "true" but was being set as "yes/no" --- conf/type/__jail/gencode-remote | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index 71bb31b5..4aff6509 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -300,8 +300,8 @@ END EOF fi -# Add $name to jail_list if $onboot=true -if [ "$onboot" = "true" ]; then +# Add $name to jail_list if $onboot=yes +if [ "$onboot" = "yes" ]; then # first check to see whether jail_enable="YES" exists in rc.conf or not and add it # if necessary From 16ac158c413f3d91f31f15a6c1137bdb1348e286 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Thu, 13 Sep 2012 17:17:37 -0400 Subject: [PATCH 141/412] Add FreeBSD support Added support for FreeBSD's mktemp Fixed typo in generated script with one too many "s --- conf/type/__cron/gencode-remote | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/conf/type/__cron/gencode-remote b/conf/type/__cron/gencode-remote index 947c75ae..37e0dc15 100755 --- a/conf/type/__cron/gencode-remote +++ b/conf/type/__cron/gencode-remote @@ -18,6 +18,7 @@ # along with cdist. If not, see . # +os="$(cat "$__global/explorer/os")" user="$(cat "$__object/parameter/user")" state_should="$(cat "$__object/parameter/state")" state_is=$(diff -q "$__object/parameter/entry" "$__object/explorer/entry" \ @@ -25,14 +26,21 @@ state_is=$(diff -q "$__object/parameter/entry" "$__object/explorer/entry" \ || echo absent ) +# FreeBSD mktemp doesn't allow execution without at least one param +if [ "$os" = "freebsd" ]; then + mktemp="mktemp -t tmp" +else + mktemp="mktemp" +fi + if [ "$state_is" != "$state_should" ]; then case "$state_should" in present) cat << DONE -tmp=\$(mktemp) +tmp=\$($mktemp) crontab -u $user -l > \$tmp cat >> \$tmp << EOC -$(cat "$__object/parameter/entry")" +$(cat "$__object/parameter/entry") EOC crontab -u $user \$tmp rm \$tmp From a2e96ac435cd8fa98fad2edade8d5798fcb8d57f Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 19 Sep 2012 14:50:28 -0400 Subject: [PATCH 142/412] Initial commit Broke old __pf type into __pf_* Initial commit of __pf_ruleset type with basic logic --- conf/type/__pf_ruleset/explorer/cksum | 43 +++++++++++++ conf/type/__pf_ruleset/explorer/rcvar | 36 +++++++++++ conf/type/__pf_ruleset/gencode-local | 74 +++++++++++++++++++++++ conf/type/__pf_ruleset/gencode-remote | 41 +++++++++++++ conf/type/__pf_ruleset/man.text | 51 ++++++++++++++++ conf/type/__pf_ruleset/parameter/optional | 1 + conf/type/__pf_ruleset/parameter/required | 1 + conf/type/__pf_ruleset/singleton | 0 8 files changed, 247 insertions(+) create mode 100755 conf/type/__pf_ruleset/explorer/cksum create mode 100755 conf/type/__pf_ruleset/explorer/rcvar create mode 100644 conf/type/__pf_ruleset/gencode-local create mode 100644 conf/type/__pf_ruleset/gencode-remote create mode 100644 conf/type/__pf_ruleset/man.text create mode 100644 conf/type/__pf_ruleset/parameter/optional create mode 100644 conf/type/__pf_ruleset/parameter/required create mode 100644 conf/type/__pf_ruleset/singleton diff --git a/conf/type/__pf_ruleset/explorer/cksum b/conf/type/__pf_ruleset/explorer/cksum new file mode 100755 index 00000000..372e9193 --- /dev/null +++ b/conf/type/__pf_ruleset/explorer/cksum @@ -0,0 +1,43 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Get the 256 bit SHA2 checksum of the pf ruleset on the target host. +# + +# Debug +#exec >&2 +#set -x + +# Check /etc/rc.conf for pf's configuration file name. Default to /etc/pf.conf +# See if file exists and if so, get checksum + +RC="/etc/rc.conf" +TMP="$(grep '^pf_rules=' ${RC} | cut -d= -f2 | sed 's/"//g')" +PFCONF="${TMP:-"/etc/pf.conf"}" + +if [ -f "${PFCONF}" ]; then # The pf config file exists, find its cksum. + cksum -o 1 ${PFCONF} | cut -d= -f2 | sed 's/ //g' +else # the pf config file doesn't exist + echo NOTEXIST +fi + +# Debug +#set +x + diff --git a/conf/type/__pf_ruleset/explorer/rcvar b/conf/type/__pf_ruleset/explorer/rcvar new file mode 100755 index 00000000..20e9dfcc --- /dev/null +++ b/conf/type/__pf_ruleset/explorer/rcvar @@ -0,0 +1,36 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Get the location of the pf ruleset on the target host. +# + +# Debug +#exec >&2 +#set -x + +# Check /etc/rc.conf for pf's configuration file name. Default to /etc/pf.conf + +RC="/etc/rc.conf" +PFCONF="$(grep '^pf_rules=' ${RC} | cut -d= -f2 | sed 's/"//g')" +echo ${PFCONF:-"/etc/pf.conf"} + +# Debug +#set +x + diff --git a/conf/type/__pf_ruleset/gencode-local b/conf/type/__pf_ruleset/gencode-local new file mode 100644 index 00000000..7c2f877e --- /dev/null +++ b/conf/type/__pf_ruleset/gencode-local @@ -0,0 +1,74 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Manage pf(4) on *BSD +# + +# Debug +#exec >&2 +#set -x + +# Send files to $__target_host via $__remote_copy + +uname=$(uname) # Need to know what the cdist host is running so we know how to compute the ruleset's checksum +state=$(cat "$__object/parameter/state") + +if [ "$state" = "absent" ]; then # There is nothing more for a *local* script to do + exit 0 +fi + +if [ -f "$__object/parameter/source" ]; then + source=$(cat "$__object/parameter/source") +fi + +rcvar=$(cat "$__object/explorer/rcvar") +cksum=$(cat "$__object/explorer/cksum") + + +cat <&2 + exit 1 + ;; +esac + +if [ ! "${cksum}" = "NOTEXIST" ]; then + if [ ! "\${currentSum}" = "${cksum}" ]; then + $__remote_copy "${source}" "$__target_host:${rcvar}.new" + fi +else # File just doesn't exist yet + $__remote_copy "${source}" "$__target_host:${rcvar}.new" +fi + +if [ -n "${testscript}" ]; then + $__remote_copy "${testscript}" "$__target_host:${rcvar}.test" +fi +EOF + diff --git a/conf/type/__pf_ruleset/gencode-remote b/conf/type/__pf_ruleset/gencode-remote new file mode 100644 index 00000000..56aee3cb --- /dev/null +++ b/conf/type/__pf_ruleset/gencode-remote @@ -0,0 +1,41 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Manage pf(4) on *BSD +# + +# Debug +#exec >&2 +#set -x + +# Remove ${rcvar} in the case of --state absent + +state=$(cat "$__object/parameter/state") + +if [ ! "$state" = "absent" ]; then # There is nothing more for a *remote* script to do + exit 0 +fi + +rcvar=$(cat "$__object/explorer/rcvar") + +# --state absent, so ensure that .new doesn't exist and that conf is renamed to .old +echo rm \"${rcvar}.new\" +echo mv \"${rcvar}\" \"${rcvar.old}\" + diff --git a/conf/type/__pf_ruleset/man.text b/conf/type/__pf_ruleset/man.text new file mode 100644 index 00000000..68601fad --- /dev/null +++ b/conf/type/__pf_ruleset/man.text @@ -0,0 +1,51 @@ +cdist-type__pf_ruleset(7) +================================== +Jake Guffey + + +NAME +---- +cdist-type__pf_ruleset - Copy a pf(4) ruleset to $__target_host + + +DESCRIPTION +----------- +This type is used on *BSD systems to manage the pf firewall's ruleset. + + +REQUIRED PARAMETERS +------------------- +state:: + Either "absent" (no ruleset at all) or "present" + + +OPTIONAL PARAMETERS +------------------- +source:: + If supplied, use to define the ruleset to load onto the $__target_host for pf(4). + Note that this type is almost useless without a ruleset defined, but it's technically not + needed, e.g. for the case of disabling the firewall temporarily. + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Remove the current ruleset in place +__pf_ruleset --state absent + +# Enable the firewall with the ruleset defined in $__manifest/files/pf.conf +__pf_ruleset --state present --source $__manifest/files/pf.conf + +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- pf(4) + + +COPYING +------- +Copyright \(C) 2012 Jake Guffey. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__pf_ruleset/parameter/optional b/conf/type/__pf_ruleset/parameter/optional new file mode 100644 index 00000000..5a18cd2f --- /dev/null +++ b/conf/type/__pf_ruleset/parameter/optional @@ -0,0 +1 @@ +source diff --git a/conf/type/__pf_ruleset/parameter/required b/conf/type/__pf_ruleset/parameter/required new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/conf/type/__pf_ruleset/parameter/required @@ -0,0 +1 @@ +state diff --git a/conf/type/__pf_ruleset/singleton b/conf/type/__pf_ruleset/singleton new file mode 100644 index 00000000..e69de29b From f6de6d895732e7857be401ef621880fa30b40990 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 19 Sep 2012 21:29:44 +0200 Subject: [PATCH 143/412] begin type __qemu_img Signed-off-by: Nico Schottelius --- conf/type/__qemu_img/explorer/exists | 28 +++++++++++++++++++++++++ conf/type/__qemu_img/gencode-remote | 20 ++++++++++++++++++ conf/type/__qemu_img/manifest | 14 +++++++++++++ conf/type/__qemu_img/parameter/optional | 1 + conf/type/__qemu_img/parameter/required | 1 + 5 files changed, 64 insertions(+) create mode 100755 conf/type/__qemu_img/explorer/exists create mode 100644 conf/type/__qemu_img/gencode-remote create mode 100644 conf/type/__qemu_img/manifest create mode 100644 conf/type/__qemu_img/parameter/optional create mode 100644 conf/type/__qemu_img/parameter/required diff --git a/conf/type/__qemu_img/explorer/exists b/conf/type/__qemu_img/explorer/exists new file mode 100755 index 00000000..c80b1181 --- /dev/null +++ b/conf/type/__qemu_img/explorer/exists @@ -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 . +# +# +# Check whether file exists or not +# + +destination="/$__object_id" + +if [ -e "$destination" ]; then + echo yes +fi diff --git a/conf/type/__qemu_img/gencode-remote b/conf/type/__qemu_img/gencode-remote new file mode 100644 index 00000000..acadcef0 --- /dev/null +++ b/conf/type/__qemu_img/gencode-remote @@ -0,0 +1,20 @@ +################################################################################ +# State: absent is handled by manifest - we need only to do stuff if image is +# not existing and state != absent +# +[ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")" +[ "$state" = "absent" ] && exit 0 + +exists="$(cat "$__object/explorer/exists")" +[ "$exists" ] && exit 0 + +################################################################################ +# Still there? Create image +# + +format=qcow2 +[ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")" +size="$(cat "$__object/parameter/size")" +vm="/$__object_id" + +echo qemu-img create -f \"$format\" \"$vm\" \"$size\" diff --git a/conf/type/__qemu_img/manifest b/conf/type/__qemu_img/manifest new file mode 100644 index 00000000..d343e188 --- /dev/null +++ b/conf/type/__qemu_img/manifest @@ -0,0 +1,14 @@ +################################################################################ +# Default settings +# + +format=qcow2 +[ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")" +[ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")" + +vm="/$__object_id" + +# Absent is ensured by __file, present by gencode-remote +if [ "$state" = "absent" ]; then + __file "$vm" --state absent +fi diff --git a/conf/type/__qemu_img/parameter/optional b/conf/type/__qemu_img/parameter/optional new file mode 100644 index 00000000..0e8469e7 --- /dev/null +++ b/conf/type/__qemu_img/parameter/optional @@ -0,0 +1 @@ +format diff --git a/conf/type/__qemu_img/parameter/required b/conf/type/__qemu_img/parameter/required new file mode 100644 index 00000000..2a613ba5 --- /dev/null +++ b/conf/type/__qemu_img/parameter/required @@ -0,0 +1 @@ +size From 52583e696f28f26ac9eadca78e563c2441409205 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 19 Sep 2012 21:32:47 +0200 Subject: [PATCH 144/412] add manpage Signed-off-by: Nico Schottelius --- conf/type/__qemu_img/man.text | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 conf/type/__qemu_img/man.text diff --git a/conf/type/__qemu_img/man.text b/conf/type/__qemu_img/man.text new file mode 100644 index 00000000..e2442172 --- /dev/null +++ b/conf/type/__qemu_img/man.text @@ -0,0 +1,51 @@ +cdist-type__qemu_img(7) +======================== +Nico Schottelius + + +NAME +---- +cdist-type__qemu_img - Manage VM disk images + + +DESCRIPTION +----------- +The qemu-img program is used to create qemu images for +qemu and (qemu-)kvm. + + +REQUIRED PARAMETERS +------------------- +size:: + Size of the image in qemu-img compatible units. + See qemu-img(1). + + +OPTIONAL PARAMETERS +------------------- +state:: + The state of the image file: either "present" or "absent". + Defaults to "present". + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Ensure zsh in installed +__qemu_img /home/services/kvm/vm/myvmname/system-disk --size 50G + +# Remove image +__qemu_img /home/services/kvm/vm/myoldvm/system-disk --state absent +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2012 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). From 17858ebd0054e21d568646dcea2d0802bb9bcec8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 19 Sep 2012 21:33:16 +0200 Subject: [PATCH 145/412] ++changes(2.0.15) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index af693bba..76019235 100644 --- a/doc/changelog +++ b/doc/changelog @@ -6,6 +6,7 @@ Changelog 2.0.15: * Core: Make variable __object_name available in type explorers (Steven Armtrong) + * New Type: __qemu_img 2.0.14: 2012-09-07 * Bugfix Type: __jail: Use correct variable (Jake Guffey) From c551bbbb692e03d3035165f7798c85e9cb76c8b9 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 19 Sep 2012 15:49:36 -0400 Subject: [PATCH 146/412] Initial commit Initial commit of __pf_apply type before actually creating logic --- conf/type/__pf_apply/gencode-remote | 34 +++++++++++++++++++ conf/type/__pf_apply/man.text | 52 +++++++++++++++++++++++++++++ conf/type/__pf_apply/singleton | 0 3 files changed, 86 insertions(+) create mode 100755 conf/type/__pf_apply/gencode-remote create mode 100644 conf/type/__pf_apply/man.text create mode 100644 conf/type/__pf_apply/singleton diff --git a/conf/type/__pf_apply/gencode-remote b/conf/type/__pf_apply/gencode-remote new file mode 100755 index 00000000..309eb12d --- /dev/null +++ b/conf/type/__pf_apply/gencode-remote @@ -0,0 +1,34 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Apply pf(4) ruleset on *BSD +# + +# Debug +#exec >&2 +#set -x + +cat < + + +NAME +---- +cdist-type__pf_apply - Apply pf(4) ruleset on *BSD + + +DESCRIPTION +----------- +This type is used on *BSD systems to manage the pf firewall's active ruleset. + + +REQUIRED PARAMETERS +------------------- +NONE + + +OPTIONAL PARAMETERS +------------------- +NONE + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Modify the ruleset on $__target_host: +__pf_ruleset --state present --source /my/pf/ruleset.conf +require="__pf_ruleset" \ + __pf_apply + +# Remove the ruleset on $__target_host (implies disabling pf(4): +__pf_ruleset --state absent +require="__pf_ruleset" \ + __pf_apply +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- cdist-type__pf_ruleset(7) +- pf(4) + + +COPYING +------- +Copyright \(C) 2012 Jake Guffey. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__pf_apply/singleton b/conf/type/__pf_apply/singleton new file mode 100644 index 00000000..e69de29b From 08aa7d8e8315652dbe86b6e8ad56227a28e80d3d Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 19 Sep 2012 16:15:06 -0400 Subject: [PATCH 147/412] Fleshed out gencode-remote logic Added logic into gencode-remote to enable/disable pf Added logic into gencode-remote to apply the new ruleset if necessary Added explorer to find ${rcvar} --- conf/type/__pf_apply/explorer/rcvar | 36 +++++++++++++++++++++++++++++ conf/type/__pf_apply/gencode-remote | 22 +++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100755 conf/type/__pf_apply/explorer/rcvar diff --git a/conf/type/__pf_apply/explorer/rcvar b/conf/type/__pf_apply/explorer/rcvar new file mode 100755 index 00000000..20e9dfcc --- /dev/null +++ b/conf/type/__pf_apply/explorer/rcvar @@ -0,0 +1,36 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# +# Get the location of the pf ruleset on the target host. +# + +# Debug +#exec >&2 +#set -x + +# Check /etc/rc.conf for pf's configuration file name. Default to /etc/pf.conf + +RC="/etc/rc.conf" +PFCONF="$(grep '^pf_rules=' ${RC} | cut -d= -f2 | sed 's/"//g')" +echo ${PFCONF:-"/etc/pf.conf"} + +# Debug +#set +x + diff --git a/conf/type/__pf_apply/gencode-remote b/conf/type/__pf_apply/gencode-remote index 309eb12d..83529859 100755 --- a/conf/type/__pf_apply/gencode-remote +++ b/conf/type/__pf_apply/gencode-remote @@ -25,8 +25,28 @@ #exec >&2 #set -x +rcvar=$(cat "$__object/explorer/rcvar") + cat <&2 + fi +fi EOF # Debug From 205f32c78bcedd5f4291457753b7250f1ec95e7c Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 19 Sep 2012 16:37:18 -0400 Subject: [PATCH 148/412] Fixed generated code and explorer Generated code needed subshell escaped Explorer wasn't parsing output of cksum properly --- conf/type/__pf_ruleset/explorer/cksum | 2 +- conf/type/__pf_ruleset/gencode-local | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/conf/type/__pf_ruleset/explorer/cksum b/conf/type/__pf_ruleset/explorer/cksum index 372e9193..ce188ba0 100755 --- a/conf/type/__pf_ruleset/explorer/cksum +++ b/conf/type/__pf_ruleset/explorer/cksum @@ -33,7 +33,7 @@ TMP="$(grep '^pf_rules=' ${RC} | cut -d= -f2 | sed 's/"//g')" PFCONF="${TMP:-"/etc/pf.conf"}" if [ -f "${PFCONF}" ]; then # The pf config file exists, find its cksum. - cksum -o 1 ${PFCONF} | cut -d= -f2 | sed 's/ //g' + cksum -o 1 ${PFCONF} | cut -d= -f2 | awk '{print $1}' else # the pf config file doesn't exist echo NOTEXIST fi diff --git a/conf/type/__pf_ruleset/gencode-local b/conf/type/__pf_ruleset/gencode-local index 7c2f877e..b1ee6a14 100644 --- a/conf/type/__pf_ruleset/gencode-local +++ b/conf/type/__pf_ruleset/gencode-local @@ -45,13 +45,13 @@ cksum=$(cat "$__object/explorer/cksum") cat <&2 @@ -66,9 +66,8 @@ if [ ! "${cksum}" = "NOTEXIST" ]; then else # File just doesn't exist yet $__remote_copy "${source}" "$__target_host:${rcvar}.new" fi - -if [ -n "${testscript}" ]; then - $__remote_copy "${testscript}" "$__target_host:${rcvar}.test" -fi EOF +# Debug +#exec +x + From 995265d4a64df5d57cdaa61ca841cc49c3d1b440 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 19 Sep 2012 16:42:15 -0400 Subject: [PATCH 149/412] Allow pfctl -[de] to return 1 If pf is already enabled or disabled and we try to enable/disable it again, it returns 1. --- conf/type/__pf_apply/gencode-remote | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/conf/type/__pf_apply/gencode-remote b/conf/type/__pf_apply/gencode-remote index 83529859..72200b59 100755 --- a/conf/type/__pf_apply/gencode-remote +++ b/conf/type/__pf_apply/gencode-remote @@ -29,6 +29,8 @@ rcvar=$(cat "$__object/explorer/rcvar") cat < Date: Wed, 19 Sep 2012 17:00:22 -0400 Subject: [PATCH 150/412] Fix typo Generated code had unterminated string in first check, causing future check to fail --- conf/type/__pf_apply/gencode-remote | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/conf/type/__pf_apply/gencode-remote b/conf/type/__pf_apply/gencode-remote index 72200b59..aa3864b0 100755 --- a/conf/type/__pf_apply/gencode-remote +++ b/conf/type/__pf_apply/gencode-remote @@ -33,7 +33,7 @@ if [ -f "${rcvar}.old" ]; then # rcvar.old exists, we must need to disable pf # If it already is disabled, pfctl -d returns 1, go on with life pfctl -d # Cleanup - rm -f "${rcvar}.old + rm -f "${rcvar}.old" # This file shouldn't exist, but just in case... [ -f "${rcvar}" ] && rm -f "${rcvar}" elif [ -f "${rcvar}.new" ]; then # rcvar.new exists, we must need to apply it @@ -43,12 +43,15 @@ elif [ -f "${rcvar}.new" ]; then # rcvar.new exists, we must need to apply it pfctl -f "${rcvar}" ret="$?" # Cleanup - rm -f "${rcvar}.old + rm -f "${rcvar}.old" # This file shouldn't exist, but just in case... [ -f "${rcvar}" ] && rm -f "${rcvar}" if [ "$ret" -ne "0" ]; then # failed to configure new ruleset - echo "Failed to configure the new ruleset on ${__target_host}\!" >&2 + echo "Failed to configure the new ruleset on ${__target_host}!" >&2 fi +else # neither ${rcvar}.old nor ${rcvar}.new exist? error. + echo "Neither ${rcvar}.old nor ${rcvar}.new exist! Something is wrong." >&2 + exit 1 fi EOF From 629f751726e61ff77ef8ec344e66031c37c0bc50 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 19 Sep 2012 17:04:03 -0400 Subject: [PATCH 151/412] Removed ${rcvar} but never renamed ${rcvar}.new Was trying to load ${rcvar} into pf, but couldn't because new ruleset was never renamed. --- conf/type/__pf_apply/gencode-remote | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/type/__pf_apply/gencode-remote b/conf/type/__pf_apply/gencode-remote index aa3864b0..9288d3e2 100755 --- a/conf/type/__pf_apply/gencode-remote +++ b/conf/type/__pf_apply/gencode-remote @@ -39,13 +39,14 @@ if [ -f "${rcvar}.old" ]; then # rcvar.old exists, we must need to disable pf elif [ -f "${rcvar}.new" ]; then # rcvar.new exists, we must need to apply it # Ensure that pf is enabled in the first place # If it already is enabled, pfctl -e returns 1, go on with life + [ -f "${rcvar}" ] && rm -f "${rcvar}" + mv "${rcvar}.new" "${rcvar}" pfctl -e || true pfctl -f "${rcvar}" ret="$?" # Cleanup + # This file shouldn't exist, but just in case rm -f "${rcvar}.old" - # This file shouldn't exist, but just in case... - [ -f "${rcvar}" ] && rm -f "${rcvar}" if [ "$ret" -ne "0" ]; then # failed to configure new ruleset echo "Failed to configure the new ruleset on ${__target_host}!" >&2 fi From 269b9eff84316b9390bf428dc523d98e42091f0d Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 19 Sep 2012 17:07:56 -0400 Subject: [PATCH 152/412] Escape inner variable ret was being set and checked in generated code but the $ wasn't being escaped --- conf/type/__pf_apply/gencode-remote | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/conf/type/__pf_apply/gencode-remote b/conf/type/__pf_apply/gencode-remote index 9288d3e2..5a027984 100755 --- a/conf/type/__pf_apply/gencode-remote +++ b/conf/type/__pf_apply/gencode-remote @@ -47,12 +47,9 @@ elif [ -f "${rcvar}.new" ]; then # rcvar.new exists, we must need to apply it # Cleanup # This file shouldn't exist, but just in case rm -f "${rcvar}.old" - if [ "$ret" -ne "0" ]; then # failed to configure new ruleset + if [ "\$ret" -ne "0" ]; then # failed to configure new ruleset echo "Failed to configure the new ruleset on ${__target_host}!" >&2 fi -else # neither ${rcvar}.old nor ${rcvar}.new exist? error. - echo "Neither ${rcvar}.old nor ${rcvar}.new exist! Something is wrong." >&2 - exit 1 fi EOF From 34ca94ffa2716404d456a095c65f6c88fdbb004c Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 19 Sep 2012 17:10:48 -0400 Subject: [PATCH 153/412] Fix typo referenced ${rcvar.old} rather than ${rcvar}.old --- conf/type/__pf_ruleset/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__pf_ruleset/gencode-remote b/conf/type/__pf_ruleset/gencode-remote index 56aee3cb..b35c47c4 100644 --- a/conf/type/__pf_ruleset/gencode-remote +++ b/conf/type/__pf_ruleset/gencode-remote @@ -37,5 +37,5 @@ rcvar=$(cat "$__object/explorer/rcvar") # --state absent, so ensure that .new doesn't exist and that conf is renamed to .old echo rm \"${rcvar}.new\" -echo mv \"${rcvar}\" \"${rcvar.old}\" +echo mv \"${rcvar}\" \"${rcvar}.old\" From a1793f66ff8445298c8b86b523e073f374cb80ac Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 19 Sep 2012 17:16:00 -0400 Subject: [PATCH 154/412] Add logic to check for existence of files before interacting with them if ${rcvar} or ${rcvar}.new don't exist, we can't rm/mv them. --- conf/type/__pf_ruleset/gencode-remote | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/type/__pf_ruleset/gencode-remote b/conf/type/__pf_ruleset/gencode-remote index b35c47c4..4018bbd7 100644 --- a/conf/type/__pf_ruleset/gencode-remote +++ b/conf/type/__pf_ruleset/gencode-remote @@ -36,6 +36,6 @@ fi rcvar=$(cat "$__object/explorer/rcvar") # --state absent, so ensure that .new doesn't exist and that conf is renamed to .old -echo rm \"${rcvar}.new\" -echo mv \"${rcvar}\" \"${rcvar}.old\" +echo "[ -f \"${rcvar}.new\" ] && rm \"${rcvar}.new\"" +echo "[ -f \"${rcvar}\" ] && mv \"${rcvar}\" \"${rcvar}.old\"" From 7a67f8bc16e75330d95a11a3b35ab354dbdbad51 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 19 Sep 2012 17:18:45 -0400 Subject: [PATCH 155/412] Make code match up with comments If pf was already disabled, the code would exit upon trying to disable it again --- conf/type/__pf_apply/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__pf_apply/gencode-remote b/conf/type/__pf_apply/gencode-remote index 5a027984..94d02b3b 100755 --- a/conf/type/__pf_apply/gencode-remote +++ b/conf/type/__pf_apply/gencode-remote @@ -31,7 +31,7 @@ cat < Date: Wed, 19 Sep 2012 17:27:40 -0400 Subject: [PATCH 156/412] set -e doesn't like [ blah ] && blah syntax changed to if [ blah ]; then blah; fi format migrated echo usage to cat with HEREDOC to improve readability --- conf/type/__pf_ruleset/gencode-remote | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/conf/type/__pf_ruleset/gencode-remote b/conf/type/__pf_ruleset/gencode-remote index 4018bbd7..e5eece64 100644 --- a/conf/type/__pf_ruleset/gencode-remote +++ b/conf/type/__pf_ruleset/gencode-remote @@ -36,6 +36,12 @@ fi rcvar=$(cat "$__object/explorer/rcvar") # --state absent, so ensure that .new doesn't exist and that conf is renamed to .old -echo "[ -f \"${rcvar}.new\" ] && rm \"${rcvar}.new\"" -echo "[ -f \"${rcvar}\" ] && mv \"${rcvar}\" \"${rcvar}.old\"" +cat < Date: Wed, 19 Sep 2012 17:33:42 -0400 Subject: [PATCH 157/412] Migrate conditional syntax set -e doesn't like [ X ] && Y syntax, migrate to if [ X ]; then Y; fi --- conf/type/__pf_apply/gencode-remote | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/conf/type/__pf_apply/gencode-remote b/conf/type/__pf_apply/gencode-remote index 94d02b3b..1185696f 100755 --- a/conf/type/__pf_apply/gencode-remote +++ b/conf/type/__pf_apply/gencode-remote @@ -35,11 +35,15 @@ if [ -f "${rcvar}.old" ]; then # rcvar.old exists, we must need to disable pf # Cleanup rm -f "${rcvar}.old" # This file shouldn't exist, but just in case... - [ -f "${rcvar}" ] && rm -f "${rcvar}" + if [ -f "${rcvar}" ]; then + rm -f "${rcvar}" + fi elif [ -f "${rcvar}.new" ]; then # rcvar.new exists, we must need to apply it # Ensure that pf is enabled in the first place # If it already is enabled, pfctl -e returns 1, go on with life - [ -f "${rcvar}" ] && rm -f "${rcvar}" + if [ -f "${rcvar}" ]; + rm -f "${rcvar}" + fi mv "${rcvar}.new" "${rcvar}" pfctl -e || true pfctl -f "${rcvar}" From c01a7ebc456f5ec97b68c14384af4317c3baa301 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 19 Sep 2012 17:37:19 -0400 Subject: [PATCH 158/412] Left out ; then --- conf/type/__pf_apply/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__pf_apply/gencode-remote b/conf/type/__pf_apply/gencode-remote index 1185696f..3045ee60 100755 --- a/conf/type/__pf_apply/gencode-remote +++ b/conf/type/__pf_apply/gencode-remote @@ -41,7 +41,7 @@ if [ -f "${rcvar}.old" ]; then # rcvar.old exists, we must need to disable pf elif [ -f "${rcvar}.new" ]; then # rcvar.new exists, we must need to apply it # Ensure that pf is enabled in the first place # If it already is enabled, pfctl -e returns 1, go on with life - if [ -f "${rcvar}" ]; + if [ -f "${rcvar}" ]; then rm -f "${rcvar}" fi mv "${rcvar}.new" "${rcvar}" From 8ca3846a3ad89ed05a2235946bf59650a6074b12 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 20 Sep 2012 10:42:16 +0200 Subject: [PATCH 159/412] begin with the new manual page Signed-off-by: Nico Schottelius --- conf/type/__line/man.text | 63 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 conf/type/__line/man.text diff --git a/conf/type/__line/man.text b/conf/type/__line/man.text new file mode 100644 index 00000000..c7fc3202 --- /dev/null +++ b/conf/type/__line/man.text @@ -0,0 +1,63 @@ +cdist-type__line(7) +=================== +Nico Schottelius + + +NAME +---- +cdist-type__line - Manage lines in files + + +DESCRIPTION +----------- +This cdist type allows you to add lines and remove lines from files. + + +REQUIRED PARAMETERS +------------------- + +OPTIONAL PARAMETERS +------------------- +state:: + 'present' or 'absent', defaults to 'present' + +line:: + Specifies the line which should be absent or present + + +regex:: + If supplied, search for this regex. + Otherwise entire line must be matched. + +file:: + If supplied, use this as the destination file. + Otherwise the object_id is used. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Manage the DAEMONS line in rc.conf +__line daemons --file /etc/rc.conf --line 'DAEMONS=(hwclock !network sshd crond postfix)' + +# Ensure the home mount is present in /etc/fstab - explicitly make it present +__line home-fstab \ + --file /etc/fstab \ + --line 'filer.fs:/vol/home /home nfs defaults 0 0' \ + --state present + +# Removes the line specifiend in "include_www" from the file "lighttpd.conf" +__line legacy_timezone --file /etc/rc.conf --regex 'TIMEZONE=.*' --state absent +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2012 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). From 7b571c53dd286599fb0482cba56c9b9344c3eb52 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 20 Sep 2012 11:10:10 +0200 Subject: [PATCH 160/412] add explorer Signed-off-by: Nico Schottelius --- conf/type/__line/explorer/state | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 conf/type/__line/explorer/state diff --git a/conf/type/__line/explorer/state b/conf/type/__line/explorer/state new file mode 100755 index 00000000..d240bf4d --- /dev/null +++ b/conf/type/__line/explorer/state @@ -0,0 +1,40 @@ +#!/bin/sh +# +# 2012 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +file="/$__object_id" +[ -f "$__object/parameter/file" ] && file=$(cat "$__object/parameter/file") + +if [ -f "$__object/parameter/regex" ]; then + regex=$(cat "$__object/parameter/regex") +else + if [ ! -f "$__object/parameter/line" ]; then + echo "Parameter line and regex missing - cannot explore" >&2 + exit 1 + fi + regex="^$(cat "$__object/parameter/line")\$" +fi + +# Allow missing file - thus 2>/dev/null +if grep -q "$regex" "$file" 2>/dev/null; then + echo present +else + echo absent +fi From 5a154fa0a220e2e8b523a9885d3491600122b334 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 20 Sep 2012 13:20:30 +0200 Subject: [PATCH 161/412] first gencode version Signed-off-by: Nico Schottelius --- conf/type/__line/gencode-remote | 50 +++++++++++++++++++++++++++++++++ conf/type/__line/man.text | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100755 conf/type/__line/gencode-remote diff --git a/conf/type/__line/gencode-remote b/conf/type/__line/gencode-remote new file mode 100755 index 00000000..9ca36177 --- /dev/null +++ b/conf/type/__line/gencode-remote @@ -0,0 +1,50 @@ +#!/bin/sh +# +# 2012 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +file="/$__object_id" +state_should="present" +[ -f "$__object/parameter/file" ] && file=$(cat "$__object/parameter/file") +[ -f "$__object/parameter/state" ] && state_should=$(cat "$__object/parameter/state") + +state_is="$(cat "$__object/explorer/state")" + +[ "$state_should" = "$state_is" ] && exit 0 + +case "$state_should" in + present) + if [ ! -f "$__object/parameter/line" ]; then + echo "Required parameter \"line\" is missing" >&2 + exit 1 + else + line=$(cat "$__object/parameter/line") + fi + + echo "echo \"$line\" >> $file" + + ;; + absent) + echo "echo q | ex -c \"/${line}/d|w|q\" \"${file}\"" + ;; + *) + echo "Unknown state: $state_should" >&2 + exit 1 + ;; +esac diff --git a/conf/type/__line/man.text b/conf/type/__line/man.text index c7fc3202..137e31d1 100644 --- a/conf/type/__line/man.text +++ b/conf/type/__line/man.text @@ -23,7 +23,7 @@ state:: line:: Specifies the line which should be absent or present - + Must be present, if state is present. regex:: If supplied, search for this regex. From fd490b39f125c992a160c98839fa261c6a418fd7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 20 Sep 2012 15:25:05 +0200 Subject: [PATCH 162/412] add parameter Signed-off-by: Nico Schottelius --- conf/type/__line/parameter/optional | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 conf/type/__line/parameter/optional diff --git a/conf/type/__line/parameter/optional b/conf/type/__line/parameter/optional new file mode 100644 index 00000000..604a203e --- /dev/null +++ b/conf/type/__line/parameter/optional @@ -0,0 +1,4 @@ +state +regex +file +line From 9e40d7bc916fc072963f9c27ed45235e1ad7f947 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 20 Sep 2012 17:35:14 +0200 Subject: [PATCH 163/412] clarify relation between line and regex Signed-off-by: Nico Schottelius --- conf/type/__line/gencode-remote | 17 +++++++++++++++-- conf/type/__line/man.text | 13 +++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/conf/type/__line/gencode-remote b/conf/type/__line/gencode-remote index 9ca36177..75cd92b4 100755 --- a/conf/type/__line/gencode-remote +++ b/conf/type/__line/gencode-remote @@ -20,8 +20,10 @@ # file="/$__object_id" +regex="" state_should="present" -[ -f "$__object/parameter/file" ] && file=$(cat "$__object/parameter/file") +[ -f "$__object/parameter/file" ] && file=$(cat "$__object/parameter/file") +[ -f "$__object/parameter/regex" ] && regex=$(cat "$__object/parameter/regex") [ -f "$__object/parameter/state" ] && state_should=$(cat "$__object/parameter/state") state_is="$(cat "$__object/explorer/state")" @@ -41,7 +43,18 @@ case "$state_should" in ;; absent) - echo "echo q | ex -c \"/${line}/d|w|q\" \"${file}\"" + if [ "$regex" -a "$line" ]; then + echo "Mutally exclusive parameters regex and line given for state absent" >&2 + exit 1 + fi + + [ "$line" ] && regex="^$line\$" + + cat << eof +tmp=\$(mktemp) +sed '/$regex/d' "$file" > \$tmp && cat "\$tmp" > "$file" && rm -f "\$tmp" +eof + #echo "echo q | ex -c \"/${line}/d|w|q\" \"${file}\"" ;; *) echo "Unknown state: $state_should" >&2 diff --git a/conf/type/__line/man.text b/conf/type/__line/man.text index 137e31d1..e1a5941c 100644 --- a/conf/type/__line/man.text +++ b/conf/type/__line/man.text @@ -23,11 +23,20 @@ state:: line:: Specifies the line which should be absent or present + Must be present, if state is present. + Must not be combined with regex, if state is absent. regex:: - If supplied, search for this regex. - Otherwise entire line must be matched. + If state is present, search for this pattern and add + given line, if the given regular expression does not match. + + In case of absent, ensure all lines matching the + regular expression are absent (cannot be combined with + the line parameter, if state is absent). + + If the regular expression contains / (slashes), they need + to be escaped with \ (backslash): / becomes \/. file:: If supplied, use this as the destination file. From 1e3f0749fc8c68cf8c4ae8fd1b9cc890e0a30859 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 20 Sep 2012 17:39:14 +0200 Subject: [PATCH 164/412] setup line content early Signed-off-by: Nico Schottelius --- conf/type/__line/gencode-remote | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/conf/type/__line/gencode-remote b/conf/type/__line/gencode-remote index 75cd92b4..8ac273e2 100755 --- a/conf/type/__line/gencode-remote +++ b/conf/type/__line/gencode-remote @@ -25,6 +25,7 @@ state_should="present" [ -f "$__object/parameter/file" ] && file=$(cat "$__object/parameter/file") [ -f "$__object/parameter/regex" ] && regex=$(cat "$__object/parameter/regex") [ -f "$__object/parameter/state" ] && state_should=$(cat "$__object/parameter/state") +[ -f "$__object/parameter/line" ] && line=$(cat "$__object/parameter/line") state_is="$(cat "$__object/explorer/state")" @@ -32,11 +33,9 @@ state_is="$(cat "$__object/explorer/state")" case "$state_should" in present) - if [ ! -f "$__object/parameter/line" ]; then + if [ ! "$line" ]; then echo "Required parameter \"line\" is missing" >&2 exit 1 - else - line=$(cat "$__object/parameter/line") fi echo "echo \"$line\" >> $file" From d351029cea142e5fd0c8c13ba9a38f35d1026aa0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 20 Sep 2012 17:42:01 +0200 Subject: [PATCH 165/412] deprecate __addifnosuchline and __removeline Signed-off-by: Nico Schottelius --- conf/type/__addifnosuchline/manifest | 1 + conf/type/__removeline/manifest | 1 + 2 files changed, 2 insertions(+) create mode 100644 conf/type/__addifnosuchline/manifest create mode 100644 conf/type/__removeline/manifest diff --git a/conf/type/__addifnosuchline/manifest b/conf/type/__addifnosuchline/manifest new file mode 100644 index 00000000..44ae555a --- /dev/null +++ b/conf/type/__addifnosuchline/manifest @@ -0,0 +1 @@ +echo "Type __addifnosuchline is deprecated and will be removed in cdist 2.1. Please use __line instead" >&2 diff --git a/conf/type/__removeline/manifest b/conf/type/__removeline/manifest new file mode 100644 index 00000000..7efb5d18 --- /dev/null +++ b/conf/type/__removeline/manifest @@ -0,0 +1 @@ +echo "Type __removeline is deprecated and will be removed in cdist 2.1. Please use __line instead" >&2 From a49665ce3d1d3f1e5ba709d0f7ab32c15e4873d4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 20 Sep 2012 17:43:28 +0200 Subject: [PATCH 166/412] add WARNING prefix Signed-off-by: Nico Schottelius --- conf/type/__addifnosuchline/manifest | 2 +- conf/type/__removeline/manifest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/type/__addifnosuchline/manifest b/conf/type/__addifnosuchline/manifest index 44ae555a..ccc82471 100644 --- a/conf/type/__addifnosuchline/manifest +++ b/conf/type/__addifnosuchline/manifest @@ -1 +1 @@ -echo "Type __addifnosuchline is deprecated and will be removed in cdist 2.1. Please use __line instead" >&2 +echo "WARNING: Type __addifnosuchline is deprecated and will be removed in cdist 2.1. Please use __line instead" >&2 diff --git a/conf/type/__removeline/manifest b/conf/type/__removeline/manifest index 7efb5d18..63528795 100644 --- a/conf/type/__removeline/manifest +++ b/conf/type/__removeline/manifest @@ -1 +1 @@ -echo "Type __removeline is deprecated and will be removed in cdist 2.1. Please use __line instead" >&2 +echo "WARNING: Type __removeline is deprecated and will be removed in cdist 2.1. Please use __line instead" >&2 From 065979b8d8e486b15dc922041935638861566927 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 20 Sep 2012 17:44:24 +0200 Subject: [PATCH 167/412] ++changes(2.0.15) Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 76019235..2f9ecef5 100644 --- a/doc/changelog +++ b/doc/changelog @@ -7,6 +7,7 @@ Changelog 2.0.15: * Core: Make variable __object_name available in type explorers (Steven Armtrong) * New Type: __qemu_img + * New Type: __line 2.0.14: 2012-09-07 * Bugfix Type: __jail: Use correct variable (Jake Guffey) From b1b86b2ebfbb321060b293f2fa25bd11228d8072 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 20 Sep 2012 17:46:03 +0200 Subject: [PATCH 168/412] remove __addifnosuchline and __removeline in 2.1 branch Signed-off-by: Nico Schottelius --- conf/type/__addifnosuchline/explorer/findline | 48 ----------------- conf/type/__addifnosuchline/gencode-remote | 33 ------------ conf/type/__addifnosuchline/man.text | 52 ------------------- conf/type/__addifnosuchline/manifest | 1 - .../type/__addifnosuchline/parameter/optional | 2 - .../type/__addifnosuchline/parameter/required | 1 - conf/type/__removeline/gencode-remote | 31 ----------- conf/type/__removeline/man.text | 50 ------------------ conf/type/__removeline/manifest | 1 - conf/type/__removeline/parameter/optional | 1 - conf/type/__removeline/parameter/required | 1 - 11 files changed, 221 deletions(-) delete mode 100755 conf/type/__addifnosuchline/explorer/findline delete mode 100755 conf/type/__addifnosuchline/gencode-remote delete mode 100644 conf/type/__addifnosuchline/man.text delete mode 100644 conf/type/__addifnosuchline/manifest delete mode 100644 conf/type/__addifnosuchline/parameter/optional delete mode 100644 conf/type/__addifnosuchline/parameter/required delete mode 100755 conf/type/__removeline/gencode-remote delete mode 100644 conf/type/__removeline/man.text delete mode 100644 conf/type/__removeline/manifest delete mode 100644 conf/type/__removeline/parameter/optional delete mode 100644 conf/type/__removeline/parameter/required diff --git a/conf/type/__addifnosuchline/explorer/findline b/conf/type/__addifnosuchline/explorer/findline deleted file mode 100755 index b45bd6ea..00000000 --- a/conf/type/__addifnosuchline/explorer/findline +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Daniel Roth (dani-cdist@d-roth.li) -# 2011 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -if [ -f "$__object/parameter/file" ]; then - file=$(cat "$__object/parameter/file") -else - file="/$__object_id" -fi - -if [ -f "$__object/parameter/regex" ]; then - regex=$(cat "$__object/parameter/regex") -else - wrap=$(cat "$__object/parameter/line") - regex="^$wrap\$" -fi - -if [ -f "$file" ]; then - # sh -e is our environment, we know what we do, - # skip error detection for now - set +e - grep -q "$regex" "$file" - if [ $? -eq 1 ]; then - echo "NOTFOUND" - else - echo "FOUND" - fi -else - echo "NOTFOUND" -fi diff --git a/conf/type/__addifnosuchline/gencode-remote b/conf/type/__addifnosuchline/gencode-remote deleted file mode 100755 index 1276e5d0..00000000 --- a/conf/type/__addifnosuchline/gencode-remote +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Daniel Roth (dani-cdist@d-roth.li) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -if [ -f "$__object/parameter/file" ]; then - file=$(cat "$__object/parameter/file") -else - file="/$__object_id" -fi - -result=$(cat "$__object/explorer/findline") - -if [ "$result" = "NOTFOUND" ]; then - line=$(cat "$__object/parameter/line") - echo "echo \"$line\" >> $file" -fi diff --git a/conf/type/__addifnosuchline/man.text b/conf/type/__addifnosuchline/man.text deleted file mode 100644 index ba3825ff..00000000 --- a/conf/type/__addifnosuchline/man.text +++ /dev/null @@ -1,52 +0,0 @@ -cdist-type__addifnosuchline(7) -============================== -Daniel Roth - - -NAME ----- -cdist-type__addifnosuchline - Add a line (if not existing already) - - -DESCRIPTION ------------ -This type can be used to check a file for existence of a -specific line and adding it, if it was not found. - - -REQUIRED PARAMETERS -------------------- -line:: - Specifies the content which shall be added if not existing. - - -OPTIONAL PARAMETERS -------------------- -file:: - If supplied, use this as the destination file. - Otherwise the object_id is used. -regex:: - If supplied, search for this regex. - Otherwise entire line must be matched. - -EXAMPLES --------- - --------------------------------------------------------------------------------- -# Creates or appends the line specified in "include_www" to the file "lighttpd.conf" -__addifnosuchline www --file /etc/lighttpd.conf --line include_www - -# Adds the line "include_git" to the file "lighttpd.conf" -__addifnosuchline /etc/lighttpd.conf --line include_git --------------------------------------------------------------------------------- - - -SEE ALSO --------- -- cdist-type(7) - - -COPYING -------- -Copyright \(C) 2011 Daniel Roth. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__addifnosuchline/manifest b/conf/type/__addifnosuchline/manifest deleted file mode 100644 index ccc82471..00000000 --- a/conf/type/__addifnosuchline/manifest +++ /dev/null @@ -1 +0,0 @@ -echo "WARNING: Type __addifnosuchline is deprecated and will be removed in cdist 2.1. Please use __line instead" >&2 diff --git a/conf/type/__addifnosuchline/parameter/optional b/conf/type/__addifnosuchline/parameter/optional deleted file mode 100644 index 7ecfcde9..00000000 --- a/conf/type/__addifnosuchline/parameter/optional +++ /dev/null @@ -1,2 +0,0 @@ -file -regex diff --git a/conf/type/__addifnosuchline/parameter/required b/conf/type/__addifnosuchline/parameter/required deleted file mode 100644 index a999a0c2..00000000 --- a/conf/type/__addifnosuchline/parameter/required +++ /dev/null @@ -1 +0,0 @@ -line diff --git a/conf/type/__removeline/gencode-remote b/conf/type/__removeline/gencode-remote deleted file mode 100755 index 3ec466b9..00000000 --- a/conf/type/__removeline/gencode-remote +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# 2010-2011 Daniel Roth (dani-cdist@d-roth.li) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -if [ -f "$__object/parameter/file" ]; then - file=$(cat "$__object/parameter/file") -else - file="/$__object_id" -fi - -line=$(cat "$__object/parameter/line") -echo "ex -c \"/${line}/d|w|q\" \"${file}\" < - - -NAME ----- -cdist-type__removeline - Remove a line (if existing) - - -DESCRIPTION ------------ -This type can be used to check a file for existence of a -specific line and removeing it, if it was found. - - -REQUIRED PARAMETERS -------------------- -line:: - Specifies the content which shall be removed if existing. - - -OPTIONAL PARAMETERS -------------------- -file:: - If supplied, use this as the destination file. - Otherwise the object_id is used. - - -EXAMPLES --------- - --------------------------------------------------------------------------------- -# Removes the line specifiend in "include_www" from the file "lighttpd.conf" -__removeline www --file /etc/lighttpd.conf --line include_www - -# Removes the line "include_git" from the file "lighttpd.conf" -__removeline /etc/lighttpd.conf --line include_git --------------------------------------------------------------------------------- - - -SEE ALSO --------- -- cdist-type(7) - - -COPYING -------- -Copyright \(C) 2011 Daniel Roth. Free use of this software is -granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__removeline/manifest b/conf/type/__removeline/manifest deleted file mode 100644 index 63528795..00000000 --- a/conf/type/__removeline/manifest +++ /dev/null @@ -1 +0,0 @@ -echo "WARNING: Type __removeline is deprecated and will be removed in cdist 2.1. Please use __line instead" >&2 diff --git a/conf/type/__removeline/parameter/optional b/conf/type/__removeline/parameter/optional deleted file mode 100644 index f73f3093..00000000 --- a/conf/type/__removeline/parameter/optional +++ /dev/null @@ -1 +0,0 @@ -file diff --git a/conf/type/__removeline/parameter/required b/conf/type/__removeline/parameter/required deleted file mode 100644 index a999a0c2..00000000 --- a/conf/type/__removeline/parameter/required +++ /dev/null @@ -1 +0,0 @@ -line From 24cae3cb21c5aeca4c350df387bf1b84cf067d3b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 20 Sep 2012 17:47:40 +0200 Subject: [PATCH 169/412] +changelog for 2.1 Signed-off-by: Nico Schottelius --- doc/changelog-2.1 | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 doc/changelog-2.1 diff --git a/doc/changelog-2.1 b/doc/changelog-2.1 new file mode 100644 index 00000000..24de88f3 --- /dev/null +++ b/doc/changelog-2.1 @@ -0,0 +1,9 @@ +Changelog (v2.1 specific) +------------------------- + + * Changes are always commented with their author in (braces) + * Exception: No braces means author == Nico Schottelius + +2.1.0: + * Removed type __addifnosuchline (replaced by __line) + * Removed type __removeline (replaced by __line) From d6ce6e623a50d6ca744579887d7030754a8fcc81 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 20 Sep 2012 17:48:54 +0200 Subject: [PATCH 170/412] +old bug Signed-off-by: Nico Schottelius --- doc/dev/logs/2012-06-15.explorer-dep-problem | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/dev/logs/2012-06-15.explorer-dep-problem diff --git a/doc/dev/logs/2012-06-15.explorer-dep-problem b/doc/dev/logs/2012-06-15.explorer-dep-problem new file mode 100644 index 00000000..30803032 --- /dev/null +++ b/doc/dev/logs/2012-06-15.explorer-dep-problem @@ -0,0 +1,4 @@ +Known bug rediscovered: + Explorer for __start_on_boot mysql runs before __package mysql was finished. + +Requires two runs to actually finish the task. From e4d1ea5bc9f9874048aeb14cbc9a872bd5e7c123 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 21 Sep 2012 10:40:37 +0200 Subject: [PATCH 171/412] change --parents and --recurse to boolean Signed-off-by: Nico Schottelius --- conf/type/__directory/man.text | 7 ++++--- conf/type/__directory/parameter/boolean | 2 ++ conf/type/__directory/parameter/optional | 2 -- 3 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 conf/type/__directory/parameter/boolean diff --git a/conf/type/__directory/man.text b/conf/type/__directory/man.text index afba0875..3f005b55 100644 --- a/conf/type/__directory/man.text +++ b/conf/type/__directory/man.text @@ -32,14 +32,15 @@ mode:: owner:: User to chown to. + +OPTIONAL BOOLEAN PARAMETERS +--------------------------- parents:: - Whether to create parents as well (mkdir -p behaviour). Must be yes or no. + Whether to create parents as well (mkdir -p behaviour) recursive:: If supplied the chgrp and chown call will run recursively. This does *not* influence the behaviour of chmod. - Must be yes or no. - EXAMPLES -------- diff --git a/conf/type/__directory/parameter/boolean b/conf/type/__directory/parameter/boolean new file mode 100644 index 00000000..357c5e81 --- /dev/null +++ b/conf/type/__directory/parameter/boolean @@ -0,0 +1,2 @@ +parents +recursive diff --git a/conf/type/__directory/parameter/optional b/conf/type/__directory/parameter/optional index 27f9d76a..08798bc5 100644 --- a/conf/type/__directory/parameter/optional +++ b/conf/type/__directory/parameter/optional @@ -2,5 +2,3 @@ state group mode owner -parents -recursive From 1e765d7e777cbdcd73b10f518a8cc302e3bf1b83 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 21 Sep 2012 10:43:11 +0200 Subject: [PATCH 172/412] remove parameter changing manifest Signed-off-by: Nico Schottelius --- .../__directory/explorer/{exists => state} | 0 conf/type/__directory/manifest | 23 ------------------- 2 files changed, 23 deletions(-) rename conf/type/__directory/explorer/{exists => state} (100%) delete mode 100755 conf/type/__directory/manifest diff --git a/conf/type/__directory/explorer/exists b/conf/type/__directory/explorer/state similarity index 100% rename from conf/type/__directory/explorer/exists rename to conf/type/__directory/explorer/state diff --git a/conf/type/__directory/manifest b/conf/type/__directory/manifest deleted file mode 100755 index a8ee5a6f..00000000 --- a/conf/type/__directory/manifest +++ /dev/null @@ -1,23 +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 . -# - -# set defaults -state="$(cat "$__object/parameter/state" 2>/dev/null \ - || echo "present" | tee "$__object/parameter/state")" From 30323456bf302fb75ae6ba294ef27f2c63b4cb78 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 21 Sep 2012 11:03:53 +0200 Subject: [PATCH 173/412] cleanup gencode-remote Signed-off-by: Nico Schottelius --- conf/type/__directory/explorer/state | 4 +- conf/type/__directory/gencode-remote | 77 +++++++++++----------------- 2 files changed, 33 insertions(+), 48 deletions(-) diff --git a/conf/type/__directory/explorer/state b/conf/type/__directory/explorer/state index f8b85671..9bdd9024 100755 --- a/conf/type/__directory/explorer/state +++ b/conf/type/__directory/explorer/state @@ -24,7 +24,7 @@ destination="/$__object_id" if [ -e "$destination" ]; then - echo yes + echo present else - echo no + echo absent fi diff --git a/conf/type/__directory/gencode-remote b/conf/type/__directory/gencode-remote index e871547a..25553183 100755 --- a/conf/type/__directory/gencode-remote +++ b/conf/type/__directory/gencode-remote @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -20,54 +20,39 @@ destination="/$__object_id" state_should="$(cat "$__object/parameter/state")" +state_is="$(cat "$__object/explorer/state")" + +[ "$state_should" = "$state_is" ] && exit 0 + +mkdiropt="" +grep yes "$__object/parameter/parents" >/dev/null 2>&1 && mkdiropt="-p" +recursive="" +grep yes "$__object/parameter/recursive" >/dev/null 2>&1 && recursive="-R" case "$state_should" in - present) - # Include parent directories? - if [ -f "$__object/parameter/parents" ]; then - parents="$(cat "$__object/parameter/parents")" - if [ yes = "$parents" ]; then - mkdiropt="-p" - else - mkdiropt="" - fi - fi + present) + echo mkdir $mkdiropt \"$destination\" - if [ -f "$__object/parameter/recursive" ]; then - if [ yes = "$(cat "$__object/parameter/recursive")" ]; then - recursive="-R" - fi - fi + # Mode settings + if [ -f "$__object/parameter/mode" ]; then + echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\" + fi - # Only create if not already existent - if [ no = "$(cat "$__object/explorer/exists")" ]; then - echo mkdir $mkdiropt \"$destination\" - fi + # Group + if [ -f "$__object/parameter/group" ]; then + echo chgrp $recursive \"$(cat "$__object/parameter/group")\" \"$destination\" + fi - # Mode settings - if [ -f "$__object/parameter/mode" ]; then - echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\" - fi - - # Group - if [ -f "$__object/parameter/group" ]; then - echo chgrp $recursive \"$(cat "$__object/parameter/group")\" \"$destination\" - fi - - # Owner - if [ -f "$__object/parameter/owner" ]; then - echo chown $recursive \"$(cat "$__object/parameter/owner")\" \"$destination\" - fi - ;; - absent) - # Only delete if it exists - if [ yes = "$(cat "$__object/explorer/exists")" ]; then - echo rm -rf \"$destination\" - fi - - ;; - *) - echo "Unknown state: $state_should" >&2 - exit 1 - ;; + # Owner + if [ -f "$__object/parameter/owner" ]; then + echo chown $recursive \"$(cat "$__object/parameter/owner")\" \"$destination\" + fi + ;; + absent) + echo rm -rf \"$destination\" + ;; + *) + echo "Unknown state: $state_should" >&2 + exit 1 + ;; esac From 135299357b6ef4545f8de3c06cc4bf68ee89c3a1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 21 Sep 2012 11:08:55 +0200 Subject: [PATCH 174/412] correctly setup state Signed-off-by: Nico Schottelius --- conf/type/__directory/gencode-remote | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/conf/type/__directory/gencode-remote b/conf/type/__directory/gencode-remote index 25553183..56bd73a1 100755 --- a/conf/type/__directory/gencode-remote +++ b/conf/type/__directory/gencode-remote @@ -18,12 +18,14 @@ # along with cdist. If not, see . # -destination="/$__object_id" -state_should="$(cat "$__object/parameter/state")" +# Check state and exit if nothing needs to be done +state_should="present" +[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" state_is="$(cat "$__object/explorer/state")" - [ "$state_should" = "$state_is" ] && exit 0 +destination="/$__object_id" + mkdiropt="" grep yes "$__object/parameter/parents" >/dev/null 2>&1 && mkdiropt="-p" recursive="" From e82c11cce429ce68befbc5126e11ffb47b170997 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 21 Sep 2012 11:10:38 +0200 Subject: [PATCH 175/412] add changes for 2.1 boolean version Signed-off-by: Nico Schottelius --- conf/type/__directory/gencode-remote | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/conf/type/__directory/gencode-remote b/conf/type/__directory/gencode-remote index 56bd73a1..21f4c5b6 100755 --- a/conf/type/__directory/gencode-remote +++ b/conf/type/__directory/gencode-remote @@ -18,7 +18,6 @@ # along with cdist. If not, see . # -# Check state and exit if nothing needs to be done state_should="present" [ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" state_is="$(cat "$__object/explorer/state")" @@ -27,9 +26,9 @@ state_is="$(cat "$__object/explorer/state")" destination="/$__object_id" mkdiropt="" -grep yes "$__object/parameter/parents" >/dev/null 2>&1 && mkdiropt="-p" +[ -f "$__object/parameter/parents" ] && mkdiropt="-p" recursive="" -grep yes "$__object/parameter/recursive" >/dev/null 2>&1 && recursive="-R" +[ -f "$__object/parameter/recursive" ] && recursive="-R" case "$state_should" in present) From bc203df95f76661f433e2d7b5f30c6afe09e9fe8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 21 Sep 2012 11:12:32 +0200 Subject: [PATCH 176/412] update man for 2.1 Signed-off-by: Nico Schottelius --- conf/type/__directory/man.text | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/conf/type/__directory/man.text b/conf/type/__directory/man.text index 3f005b55..1f4def7d 100644 --- a/conf/type/__directory/man.text +++ b/conf/type/__directory/man.text @@ -33,8 +33,8 @@ owner:: User to chown to. -OPTIONAL BOOLEAN PARAMETERS ---------------------------- +BOOLEAN PARAMETERS +------------------ parents:: Whether to create parents as well (mkdir -p behaviour) @@ -42,6 +42,7 @@ recursive:: If supplied the chgrp and chown call will run recursively. This does *not* influence the behaviour of chmod. + EXAMPLES -------- @@ -56,13 +57,18 @@ __directory /tmp/foobar --state absent __directory /etc --owner root --group root --mode 0755 # Create nfs service directory, including parents -__directory /home/services/nfs --parents yes +__directory /home/services/nfs --parents # Change permissions recursively -__directory /home/services --recursive yes --owner root --group root +__directory /home/services --recursive --owner root --group root # Setup a temp directory __directory /local --mode 1777 + +# Take it all +__directory /home/services/kvm --recursive --parents \ + --owner root --group root --mode 0755 --state present + -------------------------------------------------------------------------------- From 9fbdfda3023b2f58f3d817f5af7d5ffdc56bebdc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 21 Sep 2012 11:13:04 +0200 Subject: [PATCH 177/412] ++changes(2.1.0) Signed-off-by: Nico Schottelius --- doc/changelog-2.1 | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog-2.1 b/doc/changelog-2.1 index 24de88f3..fd03e69c 100644 --- a/doc/changelog-2.1 +++ b/doc/changelog-2.1 @@ -7,3 +7,4 @@ Changelog (v2.1 specific) 2.1.0: * Removed type __addifnosuchline (replaced by __line) * Removed type __removeline (replaced by __line) + * Type __directory: Parameter --parents and --recursive are now boolean From 1b80f2806b55d52d6d7fe4c31d9b88aab88c10f6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 21 Sep 2012 11:32:04 +0200 Subject: [PATCH 178/412] remove installed/removed state parameters (2.1 cleanup) Signed-off-by: Nico Schottelius --- conf/type/__package/man.text | 1 - conf/type/__package_apt/gencode-remote | 12 ------------ conf/type/__package_apt/man.text | 3 +-- conf/type/__package_luarocks/gencode-remote | 12 ------------ conf/type/__package_luarocks/man.text | 1 - conf/type/__package_opkg/gencode-remote | 1 - conf/type/__package_pacman/gencode-remote | 10 ---------- conf/type/__package_pacman/man.text | 1 - conf/type/__package_pkg_freebsd/gencode-remote | 1 - conf/type/__package_pkg_freebsd/man.text | 8 ++++---- conf/type/__package_pkg_openbsd/gencode-remote | 11 ----------- conf/type/__package_pkg_openbsd/man.text | 1 - conf/type/__package_rubygem/gencode-remote | 11 ----------- conf/type/__package_rubygem/man.text | 1 - conf/type/__package_yum/gencode-remote | 10 ---------- conf/type/__package_yum/man.text | 3 +-- conf/type/__process/gencode-remote | 10 ---------- 17 files changed, 6 insertions(+), 91 deletions(-) diff --git a/conf/type/__package/man.text b/conf/type/__package/man.text index 071a8bfb..0d8f8c9e 100644 --- a/conf/type/__package/man.text +++ b/conf/type/__package/man.text @@ -18,7 +18,6 @@ REQUIRED PARAMETERS ------------------- state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). OPTIONAL PARAMETERS diff --git a/conf/type/__package_apt/gencode-remote b/conf/type/__package_apt/gencode-remote index 0bcdb946..a5bd7708 100755 --- a/conf/type/__package_apt/gencode-remote +++ b/conf/type/__package_apt/gencode-remote @@ -29,18 +29,6 @@ fi state_should="$(cat "$__object/parameter/state")" -# Correct pre 2.1 naming - FIXME in 2.1 -case "$state_should" in - installed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - removed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac - # FIXME: use grep directly, state is a list, not a line! state_is="$(cat "$__object/explorer/state")" case "$state_is" in diff --git a/conf/type/__package_apt/man.text b/conf/type/__package_apt/man.text index fd9c1a9c..5848a131 100644 --- a/conf/type/__package_apt/man.text +++ b/conf/type/__package_apt/man.text @@ -18,7 +18,6 @@ REQUIRED PARAMETERS ------------------- state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). OPTIONAL PARAMETERS @@ -50,5 +49,5 @@ SEE ALSO COPYING ------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is +Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__package_luarocks/gencode-remote b/conf/type/__package_luarocks/gencode-remote index 327f812c..1046a936 100755 --- a/conf/type/__package_luarocks/gencode-remote +++ b/conf/type/__package_luarocks/gencode-remote @@ -30,18 +30,6 @@ else fi state_should="$(cat "$__object/parameter/state")" -# Correct pre 2.1 naming - FIXME in 2.1 -case "$state_should" in - installed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - removed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac - if grep -q "(installed)" "$__object/explorer/pkg_status"; then state_is="present" diff --git a/conf/type/__package_luarocks/man.text b/conf/type/__package_luarocks/man.text index 8b041b7c..75ac93fb 100644 --- a/conf/type/__package_luarocks/man.text +++ b/conf/type/__package_luarocks/man.text @@ -17,7 +17,6 @@ REQUIRED PARAMETERS ------------------- state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). OPTIONAL PARAMETERS diff --git a/conf/type/__package_opkg/gencode-remote b/conf/type/__package_opkg/gencode-remote index bd9a599b..ab8b5ee8 100755 --- a/conf/type/__package_opkg/gencode-remote +++ b/conf/type/__package_opkg/gencode-remote @@ -54,4 +54,3 @@ if [ "$state_is" != "$state_should" ]; then ;; esac fi - diff --git a/conf/type/__package_pacman/gencode-remote b/conf/type/__package_pacman/gencode-remote index e585ee86..da1ac7c2 100755 --- a/conf/type/__package_pacman/gencode-remote +++ b/conf/type/__package_pacman/gencode-remote @@ -32,16 +32,6 @@ else fi state_should="$(cat "$__object/parameter/state")" -case "$state_should" in - installed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - removed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac pkg_version="$(cat "$__object/explorer/pkg_version")" if [ -z "$pkg_version" ]; then diff --git a/conf/type/__package_pacman/man.text b/conf/type/__package_pacman/man.text index fe2abac8..4c23a2bd 100644 --- a/conf/type/__package_pacman/man.text +++ b/conf/type/__package_pacman/man.text @@ -18,7 +18,6 @@ REQUIRED PARAMETERS ------------------- state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). OPTIONAL PARAMETERS diff --git a/conf/type/__package_pkg_freebsd/gencode-remote b/conf/type/__package_pkg_freebsd/gencode-remote index ef6632c0..21120d41 100755 --- a/conf/type/__package_pkg_freebsd/gencode-remote +++ b/conf/type/__package_pkg_freebsd/gencode-remote @@ -133,4 +133,3 @@ fi # Debug #set +x - diff --git a/conf/type/__package_pkg_freebsd/man.text b/conf/type/__package_pkg_freebsd/man.text index f41ac47a..fd9a6792 100644 --- a/conf/type/__package_pkg_freebsd/man.text +++ b/conf/type/__package_pkg_freebsd/man.text @@ -39,16 +39,16 @@ EXAMPLES -------------------------------------------------------------------------------- # Ensure zsh is installed -__package_pkg_freebsd zsh --state installed +__package_pkg_freebsd zsh --state present # Ensure vim is installed, use flavor no_x11 -__package_pkg_freebsd vim --state installed --flavor no_x11 +__package_pkg_freebsd vim --state present --flavor no_x11 # If you don't want to follow pythonX packages, but always use python -__package_pkg_freebsd python --state installed --name python2 +__package_pkg_freebsd python --state present --name python2 # Remove obsolete package -__package_pkg_freebsd puppet --state removed +__package_pkg_freebsd puppet --state absent -------------------------------------------------------------------------------- diff --git a/conf/type/__package_pkg_openbsd/gencode-remote b/conf/type/__package_pkg_openbsd/gencode-remote index 26dd4689..ed36f04a 100755 --- a/conf/type/__package_pkg_openbsd/gencode-remote +++ b/conf/type/__package_pkg_openbsd/gencode-remote @@ -43,17 +43,6 @@ else fi state_should="$(cat "$__object/parameter/state")" -# Correct pre 2.1 naming - FIXME in 2.1 -case "$state_should" in - installed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - removed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac pkg_version="$(cat "$__object/explorer/pkg_version")" diff --git a/conf/type/__package_pkg_openbsd/man.text b/conf/type/__package_pkg_openbsd/man.text index 71cf9d4e..19bb2094 100644 --- a/conf/type/__package_pkg_openbsd/man.text +++ b/conf/type/__package_pkg_openbsd/man.text @@ -17,7 +17,6 @@ REQUIRED PARAMETERS ------------------- state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). OPTIONAL PARAMETERS diff --git a/conf/type/__package_rubygem/gencode-remote b/conf/type/__package_rubygem/gencode-remote index 638c4252..dc755ad3 100755 --- a/conf/type/__package_rubygem/gencode-remote +++ b/conf/type/__package_rubygem/gencode-remote @@ -28,17 +28,6 @@ else fi state_should="$(cat "$__object/parameter/state")" -# Correct pre 2.1 naming - FIXME in 2.1 -case "$state_should" in - installed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - removed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac if grep -q true "$__object/explorer/pkg_status"; then state_is="present" diff --git a/conf/type/__package_rubygem/man.text b/conf/type/__package_rubygem/man.text index 79bb8b52..afe2b358 100644 --- a/conf/type/__package_rubygem/man.text +++ b/conf/type/__package_rubygem/man.text @@ -17,7 +17,6 @@ REQUIRED PARAMETERS ------------------- state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). OPTIONAL PARAMETERS diff --git a/conf/type/__package_yum/gencode-remote b/conf/type/__package_yum/gencode-remote index df2bf405..5f0e8ac8 100755 --- a/conf/type/__package_yum/gencode-remote +++ b/conf/type/__package_yum/gencode-remote @@ -28,16 +28,6 @@ else fi state_should="$(cat "$__object/parameter/state")" -case "$state_should" in - installed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - removed) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac if grep -q -E "(centos|redhat|amazon)" "$__global/explorer/os"; then opts="-y --quiet" diff --git a/conf/type/__package_yum/man.text b/conf/type/__package_yum/man.text index 9dfb394e..4aa3ddc0 100644 --- a/conf/type/__package_yum/man.text +++ b/conf/type/__package_yum/man.text @@ -19,7 +19,6 @@ REQUIRED PARAMETERS ------------------- state:: The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). OPTIONAL PARAMETERS @@ -51,5 +50,5 @@ SEE ALSO COPYING ------- -Copyright \(C) 2011 Nico Schottelius. Free use of this software is +Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/conf/type/__process/gencode-remote b/conf/type/__process/gencode-remote index 3411734e..e4519f3c 100755 --- a/conf/type/__process/gencode-remote +++ b/conf/type/__process/gencode-remote @@ -26,16 +26,6 @@ else fi state_should="$(cat "$__object/parameter/state")" -case "$state_should" in - running) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="present" - ;; - stopped) - echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 - state_should="absent" - ;; -esac runs="$(cat "$__object/explorer/runs")" if [ "$runs" ]; then From 3333df602b3f8c85ee092c69d23b53b304351790 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 21 Sep 2012 11:35:56 +0200 Subject: [PATCH 179/412] change several type to accept only state absent/present Signed-off-by: Nico Schottelius --- doc/changelog-2.1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/changelog-2.1 b/doc/changelog-2.1 index fd03e69c..973dae99 100644 --- a/doc/changelog-2.1 +++ b/doc/changelog-2.1 @@ -8,3 +8,7 @@ Changelog (v2.1 specific) * Removed type __addifnosuchline (replaced by __line) * Removed type __removeline (replaced by __line) * Type __directory: Parameter --parents and --recursive are now boolean + * Type __package_apt, __package_luarocks, __package_opkg, + __package_pacman, __package_pkg_freebsd, __package_pkg_openbsd, + __package_rubygem, __package_yum, __process: + Parameter state accepts only "present" and "absent" From 6afec722329c296eeb772dc96a1b2ed8d018fce9 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Fri, 21 Sep 2012 10:06:16 -0400 Subject: [PATCH 180/412] Implement Nico's suggestions Modified behavior of cksum explorer to print nothing if the file doesn't exist Modified gencode-local to reflect cksum's new behavior Modified gencode-remote to check states explicitly and error on invalid state. --- conf/type/__pf_ruleset/explorer/cksum | 2 -- conf/type/__pf_ruleset/gencode-local | 2 +- conf/type/__pf_ruleset/gencode-remote | 28 ++++++++++++++------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/conf/type/__pf_ruleset/explorer/cksum b/conf/type/__pf_ruleset/explorer/cksum index ce188ba0..f8679836 100755 --- a/conf/type/__pf_ruleset/explorer/cksum +++ b/conf/type/__pf_ruleset/explorer/cksum @@ -34,8 +34,6 @@ PFCONF="${TMP:-"/etc/pf.conf"}" if [ -f "${PFCONF}" ]; then # The pf config file exists, find its cksum. cksum -o 1 ${PFCONF} | cut -d= -f2 | awk '{print $1}' -else # the pf config file doesn't exist - echo NOTEXIST fi # Debug diff --git a/conf/type/__pf_ruleset/gencode-local b/conf/type/__pf_ruleset/gencode-local index b1ee6a14..c2495509 100644 --- a/conf/type/__pf_ruleset/gencode-local +++ b/conf/type/__pf_ruleset/gencode-local @@ -59,7 +59,7 @@ case $uname in ;; esac -if [ ! "${cksum}" = "NOTEXIST" ]; then +if [ -n "${cksum}" ]; then if [ ! "\${currentSum}" = "${cksum}" ]; then $__remote_copy "${source}" "$__target_host:${rcvar}.new" fi diff --git a/conf/type/__pf_ruleset/gencode-remote b/conf/type/__pf_ruleset/gencode-remote index e5eece64..6e9030ea 100644 --- a/conf/type/__pf_ruleset/gencode-remote +++ b/conf/type/__pf_ruleset/gencode-remote @@ -28,20 +28,22 @@ # Remove ${rcvar} in the case of --state absent state=$(cat "$__object/parameter/state") - -if [ ! "$state" = "absent" ]; then # There is nothing more for a *remote* script to do - exit 0 -fi - rcvar=$(cat "$__object/explorer/rcvar") -# --state absent, so ensure that .new doesn't exist and that conf is renamed to .old -cat <&2 + exit 1 +fi From 9a45333e82327a4754be0d54c3b083c717cf961e Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Fri, 21 Sep 2012 10:11:56 -0400 Subject: [PATCH 181/412] Implement Nico's suggestions Removed unnecessary code from gencode-remote --- conf/type/__pf_apply/gencode-remote | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/conf/type/__pf_apply/gencode-remote b/conf/type/__pf_apply/gencode-remote index 3045ee60..f7c889b4 100755 --- a/conf/type/__pf_apply/gencode-remote +++ b/conf/type/__pf_apply/gencode-remote @@ -34,24 +34,13 @@ if [ -f "${rcvar}.old" ]; then # rcvar.old exists, we must need to disable pf pfctl -d || true # Cleanup rm -f "${rcvar}.old" - # This file shouldn't exist, but just in case... - if [ -f "${rcvar}" ]; then - rm -f "${rcvar}" - fi elif [ -f "${rcvar}.new" ]; then # rcvar.new exists, we must need to apply it # Ensure that pf is enabled in the first place # If it already is enabled, pfctl -e returns 1, go on with life - if [ -f "${rcvar}" ]; then - rm -f "${rcvar}" - fi mv "${rcvar}.new" "${rcvar}" pfctl -e || true pfctl -f "${rcvar}" - ret="$?" - # Cleanup - # This file shouldn't exist, but just in case - rm -f "${rcvar}.old" - if [ "\$ret" -ne "0" ]; then # failed to configure new ruleset + if [ "\$?" -ne "0" ]; then # failed to configure new ruleset echo "Failed to configure the new ruleset on ${__target_host}!" >&2 fi fi From 5761787b8482abd2c70b88288071c36625227e3a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 21 Sep 2012 20:18:50 +0200 Subject: [PATCH 182/412] remove obsolete reference to tmp_dir Signed-off-by: Nico Schottelius --- doc/man/cdist-reference.text.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 2aa87aa1..3f9f7002 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -133,10 +133,6 @@ out/object/:: out/object//explorers:: Output of type specific explorers, per object. -tmp_dir:: - A tempdir and a tempfile is used by cdist internally, - which will be removed when the scripts end automatically. - TYPES ----- The following types are available: From 550ff8c7277e90aa0ae395b77eec3b34f43db2eb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 21 Sep 2012 20:23:03 +0200 Subject: [PATCH 183/412] cleanup reference Signed-off-by: Nico Schottelius --- doc/man/cdist-reference.text.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 3f9f7002..3f4f7c98 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -65,16 +65,16 @@ conf/:: Contains the (static) configuration like manifests, types and explorers. conf/manifest/init:: - This is the central entry point used by cdist-manifest-init(1). + This is the central entry point. It is an executable (+x bit set) shell script that can use values from the explorers to decide which configuration to create for the specified target host. - It should be primary used to define mapping from configurations to hosts. + Its intent is to used to define mapping from configurations to hosts. conf/manifest/*:: All other files in this directory are not directly used by cdist, but you can seperate configuration mappings, if you have a lot of code in the - manifest/init file. This may also be helpful to have different admins + conf/manifest/init file. This may also be helpful to have different admins maintain different groups of hosts. conf/explorer/:: @@ -96,10 +96,10 @@ conf/type//manifest:: Used to generate additional objects from a type. conf/type//gencode-local:: - Used to generate code to be executed on the server. + Used to generate code to be executed on the source host conf/type//gencode-remote:: - Used to generate code to be executed on the client. + Used to generate code to be executed on the target host conf/type//parameter/required:: Parameters required by type, \n seperated list. @@ -184,10 +184,9 @@ __object_id:: the filesystem database and ensured by the core). Note: Double slashes ("//") will not be fixed and result in an error. - __self:: DEPRECATED: Same as __object_name, do not use anymore, use __object_name instead. - Will be removed in cdist 3.x. + Will be removed in cdist 2.1. __object_name:: The full qualified name of the current object. Available for: type manifest, type explorer, type gencode From 57ed946414a9fe66bf5738ac6b287b56eed334d6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 21 Sep 2012 20:25:37 +0200 Subject: [PATCH 184/412] Remove __self variable Signed-off-by: Nico Schottelius --- doc/changelog-2.1 | 1 + doc/man/cdist-reference.text.sh | 3 --- lib/cdist/core/code.py | 1 - lib/cdist/core/manifest.py | 1 - lib/cdist/test/code/__init__.py | 2 -- .../code/fixtures/conf/type/__dump_environment/gencode-local | 1 - lib/cdist/test/manifest/__init__.py | 1 - 7 files changed, 1 insertion(+), 9 deletions(-) diff --git a/doc/changelog-2.1 b/doc/changelog-2.1 index 973dae99..6398e7dc 100644 --- a/doc/changelog-2.1 +++ b/doc/changelog-2.1 @@ -5,6 +5,7 @@ Changelog (v2.1 specific) * Exception: No braces means author == Nico Schottelius 2.1.0: + * Core: Removed obsolete variable __self * Removed type __addifnosuchline (replaced by __line) * Removed type __removeline (replaced by __line) * Type __directory: Parameter --parents and --recursive are now boolean diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh index 3f4f7c98..cf1b852f 100755 --- a/doc/man/cdist-reference.text.sh +++ b/doc/man/cdist-reference.text.sh @@ -184,9 +184,6 @@ __object_id:: the filesystem database and ensured by the core). Note: Double slashes ("//") will not be fixed and result in an error. -__self:: - DEPRECATED: Same as __object_name, do not use anymore, use __object_name instead. - Will be removed in cdist 2.1. __object_name:: The full qualified name of the current object. Available for: type manifest, type explorer, type gencode diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index 2ffef9cf..fa1ed3c1 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -103,7 +103,6 @@ class Code(object): '__object': cdist_object.absolute_path, '__object_id': cdist_object.object_id, '__object_name': cdist_object.name, - '__self': cdist_object.name, }) return self.local.run_script(script, env=env, return_output=True) diff --git a/lib/cdist/core/manifest.py b/lib/cdist/core/manifest.py index 4b798883..5faeccd1 100644 --- a/lib/cdist/core/manifest.py +++ b/lib/cdist/core/manifest.py @@ -96,7 +96,6 @@ class Manifest(object): '__object': cdist_object.absolute_path, '__object_id': cdist_object.object_id, '__object_name': cdist_object.name, - '__self': cdist_object.name, '__type': cdist_object.cdist_type.absolute_path, '__cdist_manifest': script, }) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index dc701cce..8a8583d7 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -78,7 +78,6 @@ class CodeTestCase(test.CdistTestCase): self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) self.assertEqual(output_dict['__object_name'], self.cdist_object.name) - self.assertEqual(output_dict['__self'], self.cdist_object.name) def test_run_gencode_remote_environment(self): output_string = self.code.run_gencode_remote(self.cdist_object) @@ -94,7 +93,6 @@ class CodeTestCase(test.CdistTestCase): self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) self.assertEqual(output_dict['__object_name'], self.cdist_object.name) - self.assertEqual(output_dict['__self'], self.cdist_object.name) def test_transfer_code_remote(self): self.cdist_object.code_remote = self.code.run_gencode_remote(self.cdist_object) diff --git a/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local b/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local index ed1265c9..771894fb 100755 --- a/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local +++ b/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local @@ -6,4 +6,3 @@ echo "echo __type: $__type" echo "echo __object: $__object" echo "echo __object_id: $__object_id" echo "echo __object_name: $__object_name" -echo "echo __self: $__self" diff --git a/lib/cdist/test/manifest/__init__.py b/lib/cdist/test/manifest/__init__.py index a188c788..a9846b1d 100644 --- a/lib/cdist/test/manifest/__init__.py +++ b/lib/cdist/test/manifest/__init__.py @@ -101,7 +101,6 @@ class ManifestTestCase(test.CdistTestCase): self.assertEqual(output_dict['__object'], cdist_object.absolute_path) self.assertEqual(output_dict['__object_id'], cdist_object.object_id) self.assertEqual(output_dict['__object_name'], cdist_object.name) - self.assertEqual(output_dict['__self'], cdist_object.name) def test_debug_env_setup(self): self.log.setLevel(logging.DEBUG) From 07902f2a0b09729bd09c3b60eaac8d43390a2267 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 1 Oct 2012 17:52:19 +0200 Subject: [PATCH 185/412] ++changes(2.0.15) Signed-off-by: Nico Schottelius --- doc/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/changelog b/doc/changelog index 2f9ecef5..39ee0fad 100644 --- a/doc/changelog +++ b/doc/changelog @@ -8,6 +8,8 @@ Changelog * Core: Make variable __object_name available in type explorers (Steven Armtrong) * New Type: __qemu_img * New Type: __line + * New Type: __pf_apply (Jake Guffey) + * New Type: __pf_ruleset (Jake Guffey) 2.0.14: 2012-09-07 * Bugfix Type: __jail: Use correct variable (Jake Guffey) From 62c69c63b51d23e6277bfda948efd36fc0a27aa6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 2 Oct 2012 18:05:47 +0200 Subject: [PATCH 186/412] support root and user rvm Signed-off-by: Nico Schottelius --- conf/type/__rvm/explorer/state | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/conf/type/__rvm/explorer/state b/conf/type/__rvm/explorer/state index d0da0d86..f43f5509 100755 --- a/conf/type/__rvm/explorer/state +++ b/conf/type/__rvm/explorer/state @@ -19,8 +19,18 @@ # user="$__object_id" -if su - $user -c "[ -d \"\$HOME/.rvm\" ]" ; then - echo "present" + +# RVM behaves differently if root is the username / uid == 0 +if [ "$user" = "root" ]; then + if [ -d /usr/local/rvm ]; then + echo present + else + echo absent + fi else - echo "absent" + if su - $user -c "[ -d \"\$HOME/.rvm\" ]" ; then + echo "present" + else + echo "absent" + fi fi From 748fc8a258d52474ca2e2e811d1ff53a316472b0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 2 Oct 2012 18:06:15 +0200 Subject: [PATCH 187/412] support installing, even if rvm is already present Signed-off-by: Nico Schottelius --- conf/type/__rvm/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__rvm/gencode-remote b/conf/type/__rvm/gencode-remote index 6c661302..aa6ef647 100755 --- a/conf/type/__rvm/gencode-remote +++ b/conf/type/__rvm/gencode-remote @@ -25,7 +25,7 @@ if [ "$state_is" != "$state_should" ]; then case "$state_should" in present) cat << DONE -su - $user -c "curl -L get.rvm.io | bash -s stable" +su - $user -c "unset rvm_path; unset rvm_bin_path; unset rvm_prefix; unset rvm_version; curl -L get.rvm.io | bash -s stable" DONE ;; absent) From 8c0228bbaadfb7b6252959908bfc062af2f3a184 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 2 Oct 2012 18:09:52 +0200 Subject: [PATCH 188/412] allow failing cat on optional parameter Signed-off-by: Nico Schottelius --- conf/type/__rvm_gemset/gencode-remote | 2 +- conf/type/__rvm_ruby/gencode-remote | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/type/__rvm_gemset/gencode-remote b/conf/type/__rvm_gemset/gencode-remote index 75cc833a..1604538d 100755 --- a/conf/type/__rvm_gemset/gencode-remote +++ b/conf/type/__rvm_gemset/gencode-remote @@ -23,7 +23,7 @@ ruby="$(echo "$gemset" | cut -d '@' -f 1)" gemsetname="$(echo "$gemset" | cut -d '@' -f 2)" state_is="$(cat "$__object/explorer/state")" user="$(cat "$__object/parameter/user")" -default="$(cat "$__object/parameter/default")" +default="$(cat "$__object/parameter/default" 2>/dev/null || true)" state_should="$(cat "$__object/parameter/state")" if [ "$state_is" != "$state_should" ]; then case "$state_should" in diff --git a/conf/type/__rvm_ruby/gencode-remote b/conf/type/__rvm_ruby/gencode-remote index b25b4fe9..0003cfe7 100755 --- a/conf/type/__rvm_ruby/gencode-remote +++ b/conf/type/__rvm_ruby/gencode-remote @@ -21,8 +21,9 @@ ruby="$__object_id" state_is="$(cat "$__object/explorer/state")" user="$(cat "$__object/parameter/user")" -default="$(cat "$__object/parameter/default")" +default="$(cat "$__object/parameter/default" 2>/dev/null || true)" state_should="$(cat "$__object/parameter/state")" + if [ "$state_is" != "$state_should" ]; then case "$state_should" in present) From 57adc731c45f1d2876c32d9db02e5e9a5fb99bf1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 2 Oct 2012 18:11:16 +0200 Subject: [PATCH 189/412] ++changes(2.0.15) - Fixes #66 Signed-off-by: Nico Schottelius --- doc/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog b/doc/changelog index 39ee0fad..05d6d96b 100644 --- a/doc/changelog +++ b/doc/changelog @@ -10,6 +10,7 @@ Changelog * New Type: __line * New Type: __pf_apply (Jake Guffey) * New Type: __pf_ruleset (Jake Guffey) + * Bugfix Type: __rvm: Make type work if rvm is already installed 2.0.14: 2012-09-07 * Bugfix Type: __jail: Use correct variable (Jake Guffey) From 61394f390976183d1f8c35c9a219ea683fb9df15 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 4 Oct 2012 10:10:41 +0200 Subject: [PATCH 190/412] correct comment Signed-off-by: Nico Schottelius --- conf/type/__qemu_img/man.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__qemu_img/man.text b/conf/type/__qemu_img/man.text index e2442172..3e16f957 100644 --- a/conf/type/__qemu_img/man.text +++ b/conf/type/__qemu_img/man.text @@ -32,7 +32,7 @@ EXAMPLES -------- -------------------------------------------------------------------------------- -# Ensure zsh in installed +# Create a 50G size image __qemu_img /home/services/kvm/vm/myvmname/system-disk --size 50G # Remove image From 1fef54ecdfd90d3dd02e489119250957259dab65 Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Sun, 7 Oct 2012 11:51:15 -0400 Subject: [PATCH 191/412] Fix __package* state usage Removed __package*/parameter/required Added state to __package*/parameter/optional Modified man pages for __package* Added optional check for state parameter Defaulted state parameter to "present" --- conf/type/__package/man.text | 8 +++++--- conf/type/__package/parameter/optional | 1 + conf/type/__package/parameter/required | 1 - conf/type/__package_apt/gencode-remote | 6 +++++- conf/type/__package_apt/man.text | 8 +++++--- conf/type/__package_apt/parameter/optional | 1 + conf/type/__package_apt/parameter/required | 1 - conf/type/__package_luarocks/gencode-remote | 6 +++++- conf/type/__package_luarocks/man.text | 8 +++++--- conf/type/__package_luarocks/parameter/optional | 1 + conf/type/__package_luarocks/parameter/required | 1 - conf/type/__package_opkg/gencode-remote | 7 ++++++- conf/type/__package_opkg/man.text | 6 ++++-- conf/type/__package_opkg/parameter/optional | 1 + conf/type/__package_opkg/parameter/required | 1 - conf/type/__package_pacman/gencode-remote | 6 +++++- conf/type/__package_pacman/man.text | 8 +++++--- conf/type/__package_pacman/parameter/optional | 1 + conf/type/__package_pacman/parameter/required | 1 - conf/type/__package_pip/gencode-remote | 6 +++++- conf/type/__package_pip/man.text | 6 ++++-- conf/type/__package_pip/parameter/optional | 1 + conf/type/__package_pip/parameter/required | 1 - conf/type/__package_pkg_freebsd/gencode-remote | 6 +++++- conf/type/__package_pkg_freebsd/man.text | 6 ++++-- conf/type/__package_pkg_freebsd/parameter/optional | 1 + conf/type/__package_pkg_freebsd/parameter/required | 1 - conf/type/__package_pkg_openbsd/gencode-remote | 6 +++++- conf/type/__package_pkg_openbsd/man.text | 8 +++++--- conf/type/__package_pkg_openbsd/parameter/optional | 1 + conf/type/__package_pkg_openbsd/parameter/required | 1 - conf/type/__package_rubygem/gencode-remote | 6 +++++- conf/type/__package_rubygem/man.text | 8 +++++--- conf/type/__package_rubygem/parameter/optional | 1 + conf/type/__package_rubygem/parameter/required | 1 - conf/type/__package_yum/gencode-remote | 6 +++++- conf/type/__package_yum/man.text | 8 +++++--- conf/type/__package_yum/parameter/optional | 1 + conf/type/__package_yum/parameter/required | 1 - conf/type/__package_zypper/gencode-remote | 6 +++++- conf/type/__package_zypper/man.text | 6 ++++-- conf/type/__package_zypper/parameter/optional | 1 + conf/type/__package_zypper/parameter/required | 1 - 43 files changed, 113 insertions(+), 50 deletions(-) delete mode 100644 conf/type/__package/parameter/required delete mode 100644 conf/type/__package_apt/parameter/required delete mode 100644 conf/type/__package_luarocks/parameter/required delete mode 100644 conf/type/__package_opkg/parameter/required delete mode 100644 conf/type/__package_pacman/parameter/required delete mode 100644 conf/type/__package_pip/parameter/required delete mode 100644 conf/type/__package_pkg_freebsd/parameter/required delete mode 100644 conf/type/__package_pkg_openbsd/parameter/required delete mode 100644 conf/type/__package_rubygem/parameter/required delete mode 100644 conf/type/__package_yum/parameter/required delete mode 100644 conf/type/__package_zypper/parameter/required diff --git a/conf/type/__package/man.text b/conf/type/__package/man.text index 071a8bfb..9ad9747a 100644 --- a/conf/type/__package/man.text +++ b/conf/type/__package/man.text @@ -16,9 +16,7 @@ It dispatches the actual work to the package system dependant types. REQUIRED PARAMETERS ------------------- -state:: - The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). +None OPTIONAL PARAMETERS @@ -35,6 +33,10 @@ type:: e.g. __package_apt for Debian __package_emerge for Gentoo +state:: + The state the package should be in, either "present" or "absent" + (the old values "installed" or "removed" will be removed in cdist 2.1). + EXAMPLES -------- diff --git a/conf/type/__package/parameter/optional b/conf/type/__package/parameter/optional index 6f793411..9982507e 100644 --- a/conf/type/__package/parameter/optional +++ b/conf/type/__package/parameter/optional @@ -2,3 +2,4 @@ name version type pkgsite +state diff --git a/conf/type/__package/parameter/required b/conf/type/__package/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/conf/type/__package/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state diff --git a/conf/type/__package_apt/gencode-remote b/conf/type/__package_apt/gencode-remote index 0bcdb946..14b2f884 100755 --- a/conf/type/__package_apt/gencode-remote +++ b/conf/type/__package_apt/gencode-remote @@ -27,7 +27,11 @@ else name="$__object_id" fi -state_should="$(cat "$__object/parameter/state")" +if [ -f "$__object/parameter/state" ]; then + state_should="$(cat "$__object/parameter/state")" +else + state_should="present" +fi # Correct pre 2.1 naming - FIXME in 2.1 case "$state_should" in diff --git a/conf/type/__package_apt/man.text b/conf/type/__package_apt/man.text index fd9c1a9c..7e880054 100644 --- a/conf/type/__package_apt/man.text +++ b/conf/type/__package_apt/man.text @@ -16,9 +16,7 @@ manage packages. REQUIRED PARAMETERS ------------------- -state:: - The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). +None OPTIONAL PARAMETERS @@ -26,6 +24,10 @@ OPTIONAL PARAMETERS name:: If supplied, use the name and not the object id as the package name. +state:: + The state the package should be in, either "present" or "absent" + (the old values "installed" or "removed" will be removed in cdist 2.1). + EXAMPLES -------- diff --git a/conf/type/__package_apt/parameter/optional b/conf/type/__package_apt/parameter/optional index a52167d3..41b8e6cf 100644 --- a/conf/type/__package_apt/parameter/optional +++ b/conf/type/__package_apt/parameter/optional @@ -1,2 +1,3 @@ name version +state diff --git a/conf/type/__package_apt/parameter/required b/conf/type/__package_apt/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/conf/type/__package_apt/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state diff --git a/conf/type/__package_luarocks/gencode-remote b/conf/type/__package_luarocks/gencode-remote index 327f812c..e8a7240c 100755 --- a/conf/type/__package_luarocks/gencode-remote +++ b/conf/type/__package_luarocks/gencode-remote @@ -29,7 +29,11 @@ else name="$__object_id" fi -state_should="$(cat "$__object/parameter/state")" +if [ -f "$__object/parameter/state" ]; then + state_should="$(cat "$__object/parameter/state")" +else + state_should="present" +fi # Correct pre 2.1 naming - FIXME in 2.1 case "$state_should" in installed) diff --git a/conf/type/__package_luarocks/man.text b/conf/type/__package_luarocks/man.text index 8b041b7c..75083821 100644 --- a/conf/type/__package_luarocks/man.text +++ b/conf/type/__package_luarocks/man.text @@ -15,9 +15,7 @@ LuaRocks is a deployment and management system for Lua modules. REQUIRED PARAMETERS ------------------- -state:: - The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). +None OPTIONAL PARAMETERS @@ -25,6 +23,10 @@ OPTIONAL PARAMETERS name:: If supplied, use the name and not the object id as the package name. +state:: + The state the package should be in, either "present" or "absent" + (the old values "installed" or "removed" will be removed in cdist 2.1). + EXAMPLES -------- diff --git a/conf/type/__package_luarocks/parameter/optional b/conf/type/__package_luarocks/parameter/optional index f121bdbf..1b423dc4 100644 --- a/conf/type/__package_luarocks/parameter/optional +++ b/conf/type/__package_luarocks/parameter/optional @@ -1 +1,2 @@ name +state diff --git a/conf/type/__package_luarocks/parameter/required b/conf/type/__package_luarocks/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/conf/type/__package_luarocks/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state diff --git a/conf/type/__package_opkg/gencode-remote b/conf/type/__package_opkg/gencode-remote index bd9a599b..99f86632 100755 --- a/conf/type/__package_opkg/gencode-remote +++ b/conf/type/__package_opkg/gencode-remote @@ -28,7 +28,12 @@ else name="$__object_id" fi -state_should="$(cat "$__object/parameter/state")" +if [ -f "$__object/parameter/state" ]; then + state_should="$(cat "$__object/parameter/state")" +else + state_should="present" +fi + state_is="$(cat "$__object/explorer/pkg_status")" case "$state_is" in absent*) diff --git a/conf/type/__package_opkg/man.text b/conf/type/__package_opkg/man.text index 19d26af6..3d02d1ce 100644 --- a/conf/type/__package_opkg/man.text +++ b/conf/type/__package_opkg/man.text @@ -15,8 +15,7 @@ opkg is usually used on OpenWRT to manage packages. REQUIRED PARAMETERS ------------------- -state:: - The state the package should be in, either "present" or "absent" +None OPTIONAL PARAMETERS @@ -24,6 +23,9 @@ OPTIONAL PARAMETERS name:: If supplied, use the name and not the object id as the package name. +state:: + The state the package should be in, either "present" or "absent" + EXAMPLES -------- diff --git a/conf/type/__package_opkg/parameter/optional b/conf/type/__package_opkg/parameter/optional index f121bdbf..1b423dc4 100644 --- a/conf/type/__package_opkg/parameter/optional +++ b/conf/type/__package_opkg/parameter/optional @@ -1 +1,2 @@ name +state diff --git a/conf/type/__package_opkg/parameter/required b/conf/type/__package_opkg/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/conf/type/__package_opkg/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state diff --git a/conf/type/__package_pacman/gencode-remote b/conf/type/__package_pacman/gencode-remote index e585ee86..9918d28d 100755 --- a/conf/type/__package_pacman/gencode-remote +++ b/conf/type/__package_pacman/gencode-remote @@ -31,7 +31,11 @@ else name="$__object_id" fi -state_should="$(cat "$__object/parameter/state")" +if [ -f "$__object/parameter/state" ]; then + state_should="$(cat "$__object/parameter/state")" +else + state_should="present" +fi case "$state_should" in installed) echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 diff --git a/conf/type/__package_pacman/man.text b/conf/type/__package_pacman/man.text index fe2abac8..b6d07c94 100644 --- a/conf/type/__package_pacman/man.text +++ b/conf/type/__package_pacman/man.text @@ -16,9 +16,7 @@ packages. REQUIRED PARAMETERS ------------------- -state:: - The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). +None OPTIONAL PARAMETERS @@ -26,6 +24,10 @@ OPTIONAL PARAMETERS name:: If supplied, use the name and not the object id as the package name. +state:: + The state the package should be in, either "present" or "absent" + (the old values "installed" or "removed" will be removed in cdist 2.1). + EXAMPLES -------- diff --git a/conf/type/__package_pacman/parameter/optional b/conf/type/__package_pacman/parameter/optional index f121bdbf..1b423dc4 100644 --- a/conf/type/__package_pacman/parameter/optional +++ b/conf/type/__package_pacman/parameter/optional @@ -1 +1,2 @@ name +state diff --git a/conf/type/__package_pacman/parameter/required b/conf/type/__package_pacman/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/conf/type/__package_pacman/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state diff --git a/conf/type/__package_pip/gencode-remote b/conf/type/__package_pip/gencode-remote index 0f15abdc..3456ced2 100644 --- a/conf/type/__package_pip/gencode-remote +++ b/conf/type/__package_pip/gencode-remote @@ -22,7 +22,11 @@ # state_is=$(cat "$__object/explorer/state") -state_should=$(cat "$__object/parameter/state") +if [ -f "$__object/parameter/state" ]; then + state_should="$(cat "$__object/parameter/state")" +else + state_should="present" +fi [ "$state_is" = "$state_should" ] && exit 0 diff --git a/conf/type/__package_pip/man.text b/conf/type/__package_pip/man.text index 2a620658..21d4f9fd 100644 --- a/conf/type/__package_pip/man.text +++ b/conf/type/__package_pip/man.text @@ -16,8 +16,7 @@ It is also included in the python virtualenv environment. REQUIRED PARAMETERS ------------------- -state:: - Either "present" or "absent". +None OPTIONAL PARAMETERS @@ -28,6 +27,9 @@ name:: pip:: Instead of using pip from PATH, use the specific pip path. +state:: + Either "present" or "absent". + EXAMPLES -------- diff --git a/conf/type/__package_pip/parameter/optional b/conf/type/__package_pip/parameter/optional index a1b589e3..f32876f7 100644 --- a/conf/type/__package_pip/parameter/optional +++ b/conf/type/__package_pip/parameter/optional @@ -1 +1,2 @@ pip +state diff --git a/conf/type/__package_pip/parameter/required b/conf/type/__package_pip/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/conf/type/__package_pip/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state diff --git a/conf/type/__package_pkg_freebsd/gencode-remote b/conf/type/__package_pkg_freebsd/gencode-remote index ef6632c0..f7dbbd7f 100755 --- a/conf/type/__package_pkg_freebsd/gencode-remote +++ b/conf/type/__package_pkg_freebsd/gencode-remote @@ -63,7 +63,11 @@ if [ -f "$__object/parameter/pkgsite" ]; then pkgsite="$(cat "$__object/parameter/pkgsite")" fi -state="$(cat "$__object/parameter/state")" +if [ -f "$__object/parameter/state" ]; then + state="$(cat "$__object/parameter/state")" +else + state="present" +fi curr_version="$(cat "$__object/explorer/pkg_version")" add_cmd="pkg_add" rm_cmd="pkg_delete" diff --git a/conf/type/__package_pkg_freebsd/man.text b/conf/type/__package_pkg_freebsd/man.text index f41ac47a..3087cae1 100644 --- a/conf/type/__package_pkg_freebsd/man.text +++ b/conf/type/__package_pkg_freebsd/man.text @@ -15,8 +15,7 @@ This type is usually used on FreeBSD to manage packages. REQUIRED PARAMETERS ------------------- -state:: - Either "present" or "absent". +None OPTIONAL PARAMETERS @@ -33,6 +32,9 @@ version:: pkgsite:: If supplied, use to install from a specific package repository. +state:: + Either "present" or "absent". + EXAMPLES -------- diff --git a/conf/type/__package_pkg_freebsd/parameter/optional b/conf/type/__package_pkg_freebsd/parameter/optional index 3fb2f29e..8cb68f98 100644 --- a/conf/type/__package_pkg_freebsd/parameter/optional +++ b/conf/type/__package_pkg_freebsd/parameter/optional @@ -2,3 +2,4 @@ name flavor version pkgsite +state diff --git a/conf/type/__package_pkg_freebsd/parameter/required b/conf/type/__package_pkg_freebsd/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/conf/type/__package_pkg_freebsd/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state diff --git a/conf/type/__package_pkg_openbsd/gencode-remote b/conf/type/__package_pkg_openbsd/gencode-remote index 26dd4689..7788c210 100755 --- a/conf/type/__package_pkg_openbsd/gencode-remote +++ b/conf/type/__package_pkg_openbsd/gencode-remote @@ -42,7 +42,11 @@ else name="$__object_id" fi -state_should="$(cat "$__object/parameter/state")" +if [ -f "$__object/parameter/state" ]; then + state_should="$(cat "$__object/parameter/state")" +else + state_should="present" +fi # Correct pre 2.1 naming - FIXME in 2.1 case "$state_should" in installed) diff --git a/conf/type/__package_pkg_openbsd/man.text b/conf/type/__package_pkg_openbsd/man.text index 71cf9d4e..91c8d378 100644 --- a/conf/type/__package_pkg_openbsd/man.text +++ b/conf/type/__package_pkg_openbsd/man.text @@ -15,9 +15,7 @@ This type is usually used on OpenBSD to manage packages. REQUIRED PARAMETERS ------------------- -state:: - The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). +None OPTIONAL PARAMETERS @@ -28,6 +26,10 @@ name:: flavor:: If supplied, use to avoid ambiguity. +state:: + The state the package should be in, either "present" or "absent" + (the old values "installed" or "removed" will be removed in cdist 2.1). + EXAMPLES -------- diff --git a/conf/type/__package_pkg_openbsd/parameter/optional b/conf/type/__package_pkg_openbsd/parameter/optional index 29b123ef..77fd22b3 100644 --- a/conf/type/__package_pkg_openbsd/parameter/optional +++ b/conf/type/__package_pkg_openbsd/parameter/optional @@ -1,2 +1,3 @@ name flavor +state diff --git a/conf/type/__package_pkg_openbsd/parameter/required b/conf/type/__package_pkg_openbsd/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/conf/type/__package_pkg_openbsd/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state diff --git a/conf/type/__package_rubygem/gencode-remote b/conf/type/__package_rubygem/gencode-remote index 638c4252..059e125e 100755 --- a/conf/type/__package_rubygem/gencode-remote +++ b/conf/type/__package_rubygem/gencode-remote @@ -27,7 +27,11 @@ else name="$__object_id" fi -state_should="$(cat "$__object/parameter/state")" +if [ -f "$__object/parameter/state" ]; then + state_should="$(cat "$__object/parameter/state")" +else + state_should="present" +fi # Correct pre 2.1 naming - FIXME in 2.1 case "$state_should" in installed) diff --git a/conf/type/__package_rubygem/man.text b/conf/type/__package_rubygem/man.text index 79bb8b52..55b202dc 100644 --- a/conf/type/__package_rubygem/man.text +++ b/conf/type/__package_rubygem/man.text @@ -15,9 +15,7 @@ Rubygems is the default package management system for the Ruby programming langu REQUIRED PARAMETERS ------------------- -state:: - The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). +None OPTIONAL PARAMETERS @@ -25,6 +23,10 @@ OPTIONAL PARAMETERS name:: If supplied, use the name and not the object id as the package name. +state:: + The state the package should be in, either "present" or "absent" + (the old values "installed" or "removed" will be removed in cdist 2.1). + EXAMPLES -------- diff --git a/conf/type/__package_rubygem/parameter/optional b/conf/type/__package_rubygem/parameter/optional index f121bdbf..1b423dc4 100644 --- a/conf/type/__package_rubygem/parameter/optional +++ b/conf/type/__package_rubygem/parameter/optional @@ -1 +1,2 @@ name +state diff --git a/conf/type/__package_rubygem/parameter/required b/conf/type/__package_rubygem/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/conf/type/__package_rubygem/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state diff --git a/conf/type/__package_yum/gencode-remote b/conf/type/__package_yum/gencode-remote index df2bf405..71c8034a 100755 --- a/conf/type/__package_yum/gencode-remote +++ b/conf/type/__package_yum/gencode-remote @@ -27,7 +27,11 @@ else name="$__object_id" fi -state_should="$(cat "$__object/parameter/state")" +if [ -f "$__object/parameter/state" ]; then + state_should="$(cat "$__object/parameter/state")" +else + state_should="present" +fi case "$state_should" in installed) echo "WARNING: ${__object_name}: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 diff --git a/conf/type/__package_yum/man.text b/conf/type/__package_yum/man.text index 9dfb394e..30c3f308 100644 --- a/conf/type/__package_yum/man.text +++ b/conf/type/__package_yum/man.text @@ -17,9 +17,7 @@ slightly confusing error message "Error: Nothing to do". REQUIRED PARAMETERS ------------------- -state:: - The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). +None OPTIONAL PARAMETERS @@ -27,6 +25,10 @@ OPTIONAL PARAMETERS name:: If supplied, use the name and not the object id as the package name. +state:: + The state the package should be in, either "present" or "absent" + (the old values "installed" or "removed" will be removed in cdist 2.1). + EXAMPLES -------- diff --git a/conf/type/__package_yum/parameter/optional b/conf/type/__package_yum/parameter/optional index f121bdbf..1b423dc4 100644 --- a/conf/type/__package_yum/parameter/optional +++ b/conf/type/__package_yum/parameter/optional @@ -1 +1,2 @@ name +state diff --git a/conf/type/__package_yum/parameter/required b/conf/type/__package_yum/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/conf/type/__package_yum/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state diff --git a/conf/type/__package_zypper/gencode-remote b/conf/type/__package_zypper/gencode-remote index 3323d6b1..ca9aec33 100755 --- a/conf/type/__package_zypper/gencode-remote +++ b/conf/type/__package_zypper/gencode-remote @@ -33,7 +33,11 @@ else name="$__object_id" fi -state_should="$(cat "$__object/parameter/state")" +if [ -f "$__object/parameter/state" ]; then + state_should="$(cat "$__object/parameter/state")" +else + state_should="present" +fi # Exit if nothing is needed to be done [ "$state_is" = "$state_should" ] && exit 0 diff --git a/conf/type/__package_zypper/man.text b/conf/type/__package_zypper/man.text index 9cff9706..702d51e5 100644 --- a/conf/type/__package_zypper/man.text +++ b/conf/type/__package_zypper/man.text @@ -15,8 +15,7 @@ Zypper is usually used on the SuSE distribution to manage packages. REQUIRED PARAMETERS ------------------- -state:: - The state the package should be in, either "present" or "absent" +None OPTIONAL PARAMETERS @@ -24,6 +23,9 @@ OPTIONAL PARAMETERS name:: If supplied, use the name and not the object id as the package name. +state:: + The state the package should be in, either "present" or "absent" + EXAMPLES -------- diff --git a/conf/type/__package_zypper/parameter/optional b/conf/type/__package_zypper/parameter/optional index f121bdbf..1b423dc4 100644 --- a/conf/type/__package_zypper/parameter/optional +++ b/conf/type/__package_zypper/parameter/optional @@ -1 +1,2 @@ name +state diff --git a/conf/type/__package_zypper/parameter/required b/conf/type/__package_zypper/parameter/required deleted file mode 100644 index ff72b5c7..00000000 --- a/conf/type/__package_zypper/parameter/required +++ /dev/null @@ -1 +0,0 @@ -state From 1c294c72f9444af3897931eb3d064eed59075249 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 8 Oct 2012 17:24:13 +0200 Subject: [PATCH 192/412] document font used for cdist logo Signed-off-by: Nico Schottelius --- doc/gfx/font-used | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/gfx/font-used diff --git a/doc/gfx/font-used b/doc/gfx/font-used new file mode 100644 index 00000000..46d3e5d3 --- /dev/null +++ b/doc/gfx/font-used @@ -0,0 +1 @@ +fraktur From 4cc3baf0575235e7df491e5593409e21e5781397 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 12 Oct 2012 09:00:50 +0200 Subject: [PATCH 193/412] import tag Signed-off-by: Nico Schottelius --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index d37569ef..ffd0bcb5 100644 --- a/README +++ b/README @@ -350,4 +350,4 @@ with cdist on more than **60** production machines of the The CBRG is managing most of their compute clusters with cdist. - +[[!tag cdist unix]] From 661a8bf831cecd826aad4792a3a0ebd2bf667187 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 18 Oct 2012 18:31:41 +0200 Subject: [PATCH 194/412] problems with conflicting types - for documentation Signed-off-by: Nico Schottelius --- .../logs/2012-10-17.conflicting-types-problem | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 doc/dev/logs/2012-10-17.conflicting-types-problem diff --git a/doc/dev/logs/2012-10-17.conflicting-types-problem b/doc/dev/logs/2012-10-17.conflicting-types-problem new file mode 100644 index 00000000..a976a7f7 --- /dev/null +++ b/doc/dev/logs/2012-10-17.conflicting-types-problem @@ -0,0 +1,19 @@ +Seen error: + +INFO: dns-vm-inx01: Generating and executing code for __package/bind-chroot +INFO: dns-vm-inx01: Generating and executing code for __directory/var/named +INFO: dns-vm-snr01: Running manifest and explorers for __directory/opt/local.ch/sys/icinga/conf.d +INFO: dns-vm-inx02: Running manifest and explorers for __directory/opt/local.ch/sys +mkdir: cannot create directory `/var/named': File exists +ERROR: Command failed: ssh -o User=root -q dns-vm-inx01 umask 077; /bin/sh -e /var/lib/cdist/object/__directory/var/named/.cdist/code-remote +INFO: dns-vm-snr01: Running manifest and explorers for __directory/opt/local.ch/web +INFO: dns-vm-inx02: Running manifest and explorers for __directory/opt/local.ch/sys/bin +INFO: dns-vm-snr02: Running manifest and explorers for __directory/opt/local.ch/web + + +Problem source: + +__directory/var/named explorer detects that the directory is missing +__package/named gencode-remote installs package, which creates directory +__directory/var/named gencode-remote outputs mkdir + From 9228168bc907a2530bcc340ccc2dfbce33f81121 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 18 Oct 2012 18:34:30 +0200 Subject: [PATCH 195/412] update comment Signed-off-by: Nico Schottelius --- doc/dev/logs/2012-10-17.conflicting-types-problem | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/dev/logs/2012-10-17.conflicting-types-problem b/doc/dev/logs/2012-10-17.conflicting-types-problem index a976a7f7..5f35ddf7 100644 --- a/doc/dev/logs/2012-10-17.conflicting-types-problem +++ b/doc/dev/logs/2012-10-17.conflicting-types-problem @@ -17,3 +17,11 @@ __directory/var/named explorer detects that the directory is missing __package/named gencode-remote installs package, which creates directory __directory/var/named gencode-remote outputs mkdir +Solutions: + + - don't use __directory, because __package does already the job (clean solution) + - re-run explorer before gencode-* stage + - gencode-remote would have caught that + +Not sure yet - although the latter feature has been requested, the first +solution looks better (more clean) to this problem. From b7a8a84bfcf25e0d3a994b8e4f17e2740441658d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 24 Oct 2012 10:21:38 +0200 Subject: [PATCH 196/412] do nothing by default and prevent traceback If not given the function, we get: aceback (most recent call last): File "/home/users/nico/p/cdist/core/bin/cdist", line 243, in commandline() File "/home/users/nico/p/cdist/core/bin/cdist", line 107, in commandline args.func(args) AttributeError: 'Namespace' object has no attribute 'func' Signed-off-by: Nico Schottelius --- bin/cdist | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 75047acb..6b10bd32 100755 --- a/bin/cdist +++ b/bin/cdist @@ -39,12 +39,15 @@ def commandline(): help='Set log level to info, be more verbose', action='store_true', default=False) - # Main subcommand parser + # Main parser parser['main'] = argparse.ArgumentParser(description='cdist ' + cdist.VERSION, parents=[parser['loglevel']]) parser['main'].add_argument('-V', '--version', help='Show version', action='version', version='%(prog)s ' + cdist.VERSION) + #parser['main'].set_defaults(func=commandline_main) + + # Subcommand shell parser['sub'] = parser['main'].add_subparsers(title="Commands") # Banner @@ -103,6 +106,9 @@ def commandline(): log.debug(args) args.func(args) +def commandline_main(args): + pass + def config(args): configinstall(args, mode=cdist.config.Config) From 840dbc5fc2a7f363dd99e121fcd425daebeb92ee Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 24 Oct 2012 10:22:13 +0200 Subject: [PATCH 197/412] enable what I've committed just before Signed-off-by: Nico Schottelius --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 6b10bd32..8002119f 100755 --- a/bin/cdist +++ b/bin/cdist @@ -45,7 +45,7 @@ def commandline(): parser['main'].add_argument('-V', '--version', help='Show version', action='version', version='%(prog)s ' + cdist.VERSION) - #parser['main'].set_defaults(func=commandline_main) + parser['main'].set_defaults(func=commandline_main) # Subcommand shell parser['sub'] = parser['main'].add_subparsers(title="Commands") From 8a8192d3d375f0813028156fc46d34f197c31fd4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 24 Oct 2012 11:16:29 +0200 Subject: [PATCH 198/412] Revert "enable what I've committed just before" This reverts commit 840dbc5fc2a7f363dd99e121fcd425daebeb92ee. --- bin/cdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 8002119f..6b10bd32 100755 --- a/bin/cdist +++ b/bin/cdist @@ -45,7 +45,7 @@ def commandline(): parser['main'].add_argument('-V', '--version', help='Show version', action='version', version='%(prog)s ' + cdist.VERSION) - parser['main'].set_defaults(func=commandline_main) + #parser['main'].set_defaults(func=commandline_main) # Subcommand shell parser['sub'] = parser['main'].add_subparsers(title="Commands") From 5315c41903e61ed0013464e201abc33f38b90e2d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 24 Oct 2012 11:16:36 +0200 Subject: [PATCH 199/412] Revert "do nothing by default and prevent traceback" This reverts commit b7a8a84bfcf25e0d3a994b8e4f17e2740441658d. --- bin/cdist | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/bin/cdist b/bin/cdist index 6b10bd32..75047acb 100755 --- a/bin/cdist +++ b/bin/cdist @@ -39,15 +39,12 @@ def commandline(): help='Set log level to info, be more verbose', action='store_true', default=False) - # Main parser + # Main subcommand parser parser['main'] = argparse.ArgumentParser(description='cdist ' + cdist.VERSION, parents=[parser['loglevel']]) parser['main'].add_argument('-V', '--version', help='Show version', action='version', version='%(prog)s ' + cdist.VERSION) - #parser['main'].set_defaults(func=commandline_main) - - # Subcommand shell parser['sub'] = parser['main'].add_subparsers(title="Commands") # Banner @@ -106,9 +103,6 @@ def commandline(): log.debug(args) args.func(args) -def commandline_main(args): - pass - def config(args): configinstall(args, mode=cdist.config.Config) From 6d1e4d06cf0b3052ba9806973b74b358a72ee589 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 17:17:52 +0200 Subject: [PATCH 200/412] doc -> docs (pypi) Signed-off-by: Nico Schottelius --- .gitignore | 16 ++++++++-------- build | 8 ++++---- {doc => docs}/changelog | 0 {doc => docs}/changelog-2.1 | 0 {doc => docs}/dev/benchmark-oprofile | 0 {doc => docs}/dev/benchmark-parallel-deploy | 0 .../dev/debug/bach25-1.6.2-373-g6fd31f8 | 0 .../dev/debug/ikq04-1.6.2-373-g6fd31f8-dbg | 0 {doc => docs}/dev/fancy-ideas | 0 {doc => docs}/dev/git-post-commit-hook | 0 {doc => docs}/dev/header | 0 {doc => docs}/dev/lastchanges | 0 {doc => docs}/dev/logs/2010-09-25 | 0 {doc => docs}/dev/logs/2010-11-02.steven | 0 {doc => docs}/dev/logs/2010-11-09 | 0 {doc => docs}/dev/logs/2010-11-21 | 0 {doc => docs}/dev/logs/2010-11-29 | 0 {doc => docs}/dev/logs/2010-12-01 | 0 .../logs/2010-12-01.handwritten/SCAN0000.PDF | Bin .../logs/2010-12-01.handwritten/SCAN0001.PDF | Bin .../logs/2010-12-01.handwritten/SCAN0002.PDF | Bin .../logs/2010-12-01.handwritten/SCAN0003.PDF | Bin .../logs/2010-12-01.handwritten/SCAN0004.PDF | Bin {doc => docs}/dev/logs/2011-01-17 | 0 {doc => docs}/dev/logs/2011-01-18.type-creation | 0 {doc => docs}/dev/logs/2011-01-24 | 0 {doc => docs}/dev/logs/2011-02-03 | 0 {doc => docs}/dev/logs/2011-02-04.steven | 0 {doc => docs}/dev/logs/2011-02-22 | 0 {doc => docs}/dev/logs/2011-02-24 | 0 {doc => docs}/dev/logs/2011-02-27 | 0 {doc => docs}/dev/logs/2011-03-03 | 0 {doc => docs}/dev/logs/2011-03-07 | 0 {doc => docs}/dev/logs/2011-03-09 | 0 {doc => docs}/dev/logs/2011-03-15 | 0 .../dev/logs/2011-03-15.file_directory_link | 0 {doc => docs}/dev/logs/2011-03-23.autorequire | 0 .../dev/logs/2011-03-23.manifest_use_explorer | 0 {doc => docs}/dev/logs/2011-03-27.pgrep | 0 .../dev/logs/2011-03-28.execution-order | 0 {doc => docs}/dev/logs/2011-04-02.yum | 0 {doc => docs}/dev/logs/2011-04-04.openbsd | 0 {doc => docs}/dev/logs/2011-04-19 | 0 .../dev/logs/2011-04-20.slashdot-articles | 0 {doc => docs}/dev/logs/2011-04-21.benchmark-eth | 0 .../2011-04-21.benchmark-from-home.with-stdout | 0 {doc => docs}/dev/logs/2011-04-27 | 0 {doc => docs}/dev/logs/2011-04-27.benchmark | 0 .../dev/logs/2011-04-27.benchmark.dash | 0 {doc => docs}/dev/logs/2011-04-27.debug-timing | 0 {doc => docs}/dev/logs/2011-05-09 | 0 {doc => docs}/dev/logs/2011-05-10 | 0 {doc => docs}/dev/logs/2011-05-10.benchmark | 0 {doc => docs}/dev/logs/2011-05-12 | 0 .../dev/logs/2011-06-13.installation-via-cdist | 0 .../dev/logs/2011-06-14.library_for_user | 0 {doc => docs}/dev/logs/2011-06-24.cinst_preos | 0 .../dev/logs/2011-06-25.trigger-graphic | 0 {doc => docs}/dev/logs/2011-07-01.type-gencode | 0 .../dev/logs/2011-07-01.type-global-explorers | 0 .../dev/logs/2011-09-08.obsolete_debugging | 0 {doc => docs}/dev/logs/2011-09-12 | 0 .../dev/logs/2011-09-12.benchmark-home | 0 {doc => docs}/dev/logs/2011-09-13 | 0 .../2011-09-16.benchmark-r815-no-control-socket | 0 ...6.benchmark-r815-no-control-socket.dmidecode | 0 {doc => docs}/dev/logs/2011-10-04 | 0 {doc => docs}/dev/logs/2011-10-05 | 0 {doc => docs}/dev/logs/2011-10-06 | 0 .../dev/logs/2011-10-06.ssh_scp_sudo_chroot | 0 .../dev/logs/2011-10-11.emulator-output | 0 {doc => docs}/dev/logs/2011-10-12 | 0 {doc => docs}/dev/logs/2011-10-13.output | 0 {doc => docs}/dev/logs/2011-10-14.error-output | 0 .../dev/logs/2011-10-15.prefix-output-missing | 0 .../2011-10-15.ugly-output-on-breaking-explorer | 0 .../dev/logs/2011-10-16.keyboardirqoutputs | 0 .../dev/logs/2011-10-18.requirement-object | 0 .../dev/logs/2011-10-18.traceback-gencode | 0 .../dev/logs/2011-11-15.startup-yannick | 0 .../dev/logs/2012-01-06.python3-in-distros | 0 {doc => docs}/dev/logs/2012-01-07.urls | 0 {doc => docs}/dev/logs/2012-01-18.urls | 0 .../2012-02-08.explorer-depends-on-another-type | 0 .../dev/logs/2012-02-10.object_id-and-slashes | 0 {doc => docs}/dev/logs/2012-02-13.dependencies | 0 {doc => docs}/dev/logs/2012-02-15.steven | 0 {doc => docs}/dev/logs/2012-02-17.keyboardirq | 0 .../dev/logs/2012-02-20.debug-jake-deps | 0 .../logs/2012-02-20.error-does-not-contain-host | 0 .../dev/logs/2012-05-24.makedirs.py-python3.1 | 0 .../dev/logs/2012-05-30.ifconfig-outputs | 0 .../dev/logs/2012-05-31.csh-compatibilty | 0 {doc => docs}/dev/logs/2012-06-06.wikipedia | 0 .../dev/logs/2012-06-15.explorer-dep-problem | 0 .../logs/2012-10-17.conflicting-types-problem | 0 {doc => docs}/dev/logs/README | 0 {doc => docs}/dev/logs/linklist | 0 {doc => docs}/dev/logs/times | 0 {doc => docs}/dev/releasechecklist | 0 {doc => docs}/dev/show_all_exported_variables | 0 {doc => docs}/dev/sync-to-testhost | 0 {doc => docs}/dev/todo/3.0 | 0 {doc => docs}/dev/todo/TAKEME | 0 {doc => docs}/dev/todo/niconext | 0 {doc => docs}/dev/todo/performance-ideas | 0 {doc => docs}/dev/todo/steven | 0 {doc => docs}/dev/todo/tests | 0 {doc => docs}/gfx/cdist-automated-inverted.png | Bin {doc => docs}/gfx/cdist-automated.png | Bin {doc => docs}/gfx/cdist-automated.text | 0 {doc => docs}/gfx/cdist-logo-cm.png | Bin {doc => docs}/gfx/cdist-logo-inverted.png | Bin {doc => docs}/gfx/cdist-logo.png | Bin {doc => docs}/gfx/cdist-logo.text | 0 {doc => docs}/gfx/font-used | 0 {doc => docs}/man/cdist-reference.text.sh | 0 {doc => docs}/man/man1/cdist.text | 0 {doc => docs}/man/man7/cdist-best-practice.text | 0 {doc => docs}/man/man7/cdist-bootstrap.text | 0 {doc => docs}/man/man7/cdist-explorer.text | 0 {doc => docs}/man/man7/cdist-hacker.text | 0 {doc => docs}/man/man7/cdist-manifest.text | 0 {doc => docs}/man/man7/cdist-quickstart.text | 0 .../man/man7/cdist-remote-exec-copy.text | 0 {doc => docs}/man/man7/cdist-stages.text | 0 {doc => docs}/man/man7/cdist-tutorial.text | 0 {doc => docs}/man/man7/cdist-type.text | 0 {doc => docs}/speeches/.gitignore | 0 .../speeches/2011-03-18_hacker_erwachen.tex | 0 {doc => docs}/speeches/2011-04-27_sans.tex | 0 {doc => docs}/speeches/2011-05-20_cosin.tex | 0 ...ist-installation-in-less-than-60-seconds.mp4 | Bin 133 files changed, 12 insertions(+), 12 deletions(-) rename {doc => docs}/changelog (100%) rename {doc => docs}/changelog-2.1 (100%) rename {doc => docs}/dev/benchmark-oprofile (100%) rename {doc => docs}/dev/benchmark-parallel-deploy (100%) rename {doc => docs}/dev/debug/bach25-1.6.2-373-g6fd31f8 (100%) rename {doc => docs}/dev/debug/ikq04-1.6.2-373-g6fd31f8-dbg (100%) rename {doc => docs}/dev/fancy-ideas (100%) rename {doc => docs}/dev/git-post-commit-hook (100%) rename {doc => docs}/dev/header (100%) rename {doc => docs}/dev/lastchanges (100%) rename {doc => docs}/dev/logs/2010-09-25 (100%) rename {doc => docs}/dev/logs/2010-11-02.steven (100%) rename {doc => docs}/dev/logs/2010-11-09 (100%) rename {doc => docs}/dev/logs/2010-11-21 (100%) rename {doc => docs}/dev/logs/2010-11-29 (100%) rename {doc => docs}/dev/logs/2010-12-01 (100%) rename {doc => docs}/dev/logs/2010-12-01.handwritten/SCAN0000.PDF (100%) rename {doc => docs}/dev/logs/2010-12-01.handwritten/SCAN0001.PDF (100%) rename {doc => docs}/dev/logs/2010-12-01.handwritten/SCAN0002.PDF (100%) rename {doc => docs}/dev/logs/2010-12-01.handwritten/SCAN0003.PDF (100%) rename {doc => docs}/dev/logs/2010-12-01.handwritten/SCAN0004.PDF (100%) rename {doc => docs}/dev/logs/2011-01-17 (100%) rename {doc => docs}/dev/logs/2011-01-18.type-creation (100%) rename {doc => docs}/dev/logs/2011-01-24 (100%) rename {doc => docs}/dev/logs/2011-02-03 (100%) rename {doc => docs}/dev/logs/2011-02-04.steven (100%) rename {doc => docs}/dev/logs/2011-02-22 (100%) rename {doc => docs}/dev/logs/2011-02-24 (100%) rename {doc => docs}/dev/logs/2011-02-27 (100%) rename {doc => docs}/dev/logs/2011-03-03 (100%) rename {doc => docs}/dev/logs/2011-03-07 (100%) rename {doc => docs}/dev/logs/2011-03-09 (100%) rename {doc => docs}/dev/logs/2011-03-15 (100%) rename {doc => docs}/dev/logs/2011-03-15.file_directory_link (100%) rename {doc => docs}/dev/logs/2011-03-23.autorequire (100%) rename {doc => docs}/dev/logs/2011-03-23.manifest_use_explorer (100%) rename {doc => docs}/dev/logs/2011-03-27.pgrep (100%) rename {doc => docs}/dev/logs/2011-03-28.execution-order (100%) rename {doc => docs}/dev/logs/2011-04-02.yum (100%) rename {doc => docs}/dev/logs/2011-04-04.openbsd (100%) rename {doc => docs}/dev/logs/2011-04-19 (100%) rename {doc => docs}/dev/logs/2011-04-20.slashdot-articles (100%) rename {doc => docs}/dev/logs/2011-04-21.benchmark-eth (100%) rename {doc => docs}/dev/logs/2011-04-21.benchmark-from-home.with-stdout (100%) rename {doc => docs}/dev/logs/2011-04-27 (100%) rename {doc => docs}/dev/logs/2011-04-27.benchmark (100%) rename {doc => docs}/dev/logs/2011-04-27.benchmark.dash (100%) rename {doc => docs}/dev/logs/2011-04-27.debug-timing (100%) rename {doc => docs}/dev/logs/2011-05-09 (100%) rename {doc => docs}/dev/logs/2011-05-10 (100%) rename {doc => docs}/dev/logs/2011-05-10.benchmark (100%) rename {doc => docs}/dev/logs/2011-05-12 (100%) rename {doc => docs}/dev/logs/2011-06-13.installation-via-cdist (100%) rename {doc => docs}/dev/logs/2011-06-14.library_for_user (100%) rename {doc => docs}/dev/logs/2011-06-24.cinst_preos (100%) rename {doc => docs}/dev/logs/2011-06-25.trigger-graphic (100%) rename {doc => docs}/dev/logs/2011-07-01.type-gencode (100%) rename {doc => docs}/dev/logs/2011-07-01.type-global-explorers (100%) rename {doc => docs}/dev/logs/2011-09-08.obsolete_debugging (100%) rename {doc => docs}/dev/logs/2011-09-12 (100%) rename {doc => docs}/dev/logs/2011-09-12.benchmark-home (100%) rename {doc => docs}/dev/logs/2011-09-13 (100%) rename {doc => docs}/dev/logs/2011-09-16.benchmark-r815-no-control-socket (100%) rename {doc => docs}/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode (100%) rename {doc => docs}/dev/logs/2011-10-04 (100%) rename {doc => docs}/dev/logs/2011-10-05 (100%) rename {doc => docs}/dev/logs/2011-10-06 (100%) rename {doc => docs}/dev/logs/2011-10-06.ssh_scp_sudo_chroot (100%) rename {doc => docs}/dev/logs/2011-10-11.emulator-output (100%) rename {doc => docs}/dev/logs/2011-10-12 (100%) rename {doc => docs}/dev/logs/2011-10-13.output (100%) rename {doc => docs}/dev/logs/2011-10-14.error-output (100%) rename {doc => docs}/dev/logs/2011-10-15.prefix-output-missing (100%) rename {doc => docs}/dev/logs/2011-10-15.ugly-output-on-breaking-explorer (100%) rename {doc => docs}/dev/logs/2011-10-16.keyboardirqoutputs (100%) rename {doc => docs}/dev/logs/2011-10-18.requirement-object (100%) rename {doc => docs}/dev/logs/2011-10-18.traceback-gencode (100%) rename {doc => docs}/dev/logs/2011-11-15.startup-yannick (100%) rename {doc => docs}/dev/logs/2012-01-06.python3-in-distros (100%) rename {doc => docs}/dev/logs/2012-01-07.urls (100%) rename {doc => docs}/dev/logs/2012-01-18.urls (100%) rename {doc => docs}/dev/logs/2012-02-08.explorer-depends-on-another-type (100%) rename {doc => docs}/dev/logs/2012-02-10.object_id-and-slashes (100%) rename {doc => docs}/dev/logs/2012-02-13.dependencies (100%) rename {doc => docs}/dev/logs/2012-02-15.steven (100%) rename {doc => docs}/dev/logs/2012-02-17.keyboardirq (100%) rename {doc => docs}/dev/logs/2012-02-20.debug-jake-deps (100%) rename {doc => docs}/dev/logs/2012-02-20.error-does-not-contain-host (100%) rename {doc => docs}/dev/logs/2012-05-24.makedirs.py-python3.1 (100%) rename {doc => docs}/dev/logs/2012-05-30.ifconfig-outputs (100%) rename {doc => docs}/dev/logs/2012-05-31.csh-compatibilty (100%) rename {doc => docs}/dev/logs/2012-06-06.wikipedia (100%) rename {doc => docs}/dev/logs/2012-06-15.explorer-dep-problem (100%) rename {doc => docs}/dev/logs/2012-10-17.conflicting-types-problem (100%) rename {doc => docs}/dev/logs/README (100%) rename {doc => docs}/dev/logs/linklist (100%) rename {doc => docs}/dev/logs/times (100%) rename {doc => docs}/dev/releasechecklist (100%) rename {doc => docs}/dev/show_all_exported_variables (100%) rename {doc => docs}/dev/sync-to-testhost (100%) rename {doc => docs}/dev/todo/3.0 (100%) rename {doc => docs}/dev/todo/TAKEME (100%) rename {doc => docs}/dev/todo/niconext (100%) rename {doc => docs}/dev/todo/performance-ideas (100%) rename {doc => docs}/dev/todo/steven (100%) rename {doc => docs}/dev/todo/tests (100%) rename {doc => docs}/gfx/cdist-automated-inverted.png (100%) rename {doc => docs}/gfx/cdist-automated.png (100%) rename {doc => docs}/gfx/cdist-automated.text (100%) rename {doc => docs}/gfx/cdist-logo-cm.png (100%) rename {doc => docs}/gfx/cdist-logo-inverted.png (100%) rename {doc => docs}/gfx/cdist-logo.png (100%) rename {doc => docs}/gfx/cdist-logo.text (100%) rename {doc => docs}/gfx/font-used (100%) rename {doc => docs}/man/cdist-reference.text.sh (100%) rename {doc => docs}/man/man1/cdist.text (100%) rename {doc => docs}/man/man7/cdist-best-practice.text (100%) rename {doc => docs}/man/man7/cdist-bootstrap.text (100%) rename {doc => docs}/man/man7/cdist-explorer.text (100%) rename {doc => docs}/man/man7/cdist-hacker.text (100%) rename {doc => docs}/man/man7/cdist-manifest.text (100%) rename {doc => docs}/man/man7/cdist-quickstart.text (100%) rename {doc => docs}/man/man7/cdist-remote-exec-copy.text (100%) rename {doc => docs}/man/man7/cdist-stages.text (100%) rename {doc => docs}/man/man7/cdist-tutorial.text (100%) rename {doc => docs}/man/man7/cdist-type.text (100%) rename {doc => docs}/speeches/.gitignore (100%) rename {doc => docs}/speeches/2011-03-18_hacker_erwachen.tex (100%) rename {doc => docs}/speeches/2011-04-27_sans.tex (100%) rename {doc => docs}/speeches/2011-05-20_cosin.tex (100%) rename {doc => docs}/video/cdist-installation-in-less-than-60-seconds.mp4 (100%) diff --git a/.gitignore b/.gitignore index 69a8ea98..fe52a82f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,14 +2,14 @@ .*.swp # Ignore generated manpages -doc/man/.marker -doc/man/man1/*.1 -doc/man/man7/*.7 -doc/man/man*/*.html -doc/man/man*/*.xml -doc/man/man7/cdist-type__*.text -doc/man/man7/cdist-reference.text -doc/man/man*/docbook-xsl.css +docs/man/.marker +docs/man/man1/*.1 +docs/man/man7/*.7 +docs/man/man*/*.html +docs/man/man*/*.xml +docs/man/man7/cdist-type__*.text +docs/man/man7/cdist-reference.text +docs/man/man*/docbook-xsl.css # Ignore cdist cache for version control /cache/ diff --git a/build b/build index bec7f5a9..d3f8ca3a 100755 --- a/build +++ b/build @@ -39,10 +39,10 @@ WEBMAN=$WEBBASE/man/$version WEBPAGE=${WEBBASE}.mdwn # Documentation -MANDIR=doc/man +MANDIR=docs/man MAN1DSTDIR=${MANDIR}/man1 MAN7DSTDIR=${MANDIR}/man7 -SPEECHESDIR=doc/speeches +SPEECHESDIR=docs/speeches case "$1" in man) @@ -75,7 +75,7 @@ case "$1" in mantype) for mansrc in conf/type/*/man.text; do - dst="$(echo $mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')" + dst="$(echo $mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;docs/man/man7/;')" ln -sf "../../../$mansrc" "$dst" done ;; @@ -85,7 +85,7 @@ case "$1" in ;; release) - ./doc/dev/releasechecklist + ./docs/dev/releasechecklist ;; speeches) diff --git a/doc/changelog b/docs/changelog similarity index 100% rename from doc/changelog rename to docs/changelog diff --git a/doc/changelog-2.1 b/docs/changelog-2.1 similarity index 100% rename from doc/changelog-2.1 rename to docs/changelog-2.1 diff --git a/doc/dev/benchmark-oprofile b/docs/dev/benchmark-oprofile similarity index 100% rename from doc/dev/benchmark-oprofile rename to docs/dev/benchmark-oprofile diff --git a/doc/dev/benchmark-parallel-deploy b/docs/dev/benchmark-parallel-deploy similarity index 100% rename from doc/dev/benchmark-parallel-deploy rename to docs/dev/benchmark-parallel-deploy diff --git a/doc/dev/debug/bach25-1.6.2-373-g6fd31f8 b/docs/dev/debug/bach25-1.6.2-373-g6fd31f8 similarity index 100% rename from doc/dev/debug/bach25-1.6.2-373-g6fd31f8 rename to docs/dev/debug/bach25-1.6.2-373-g6fd31f8 diff --git a/doc/dev/debug/ikq04-1.6.2-373-g6fd31f8-dbg b/docs/dev/debug/ikq04-1.6.2-373-g6fd31f8-dbg similarity index 100% rename from doc/dev/debug/ikq04-1.6.2-373-g6fd31f8-dbg rename to docs/dev/debug/ikq04-1.6.2-373-g6fd31f8-dbg diff --git a/doc/dev/fancy-ideas b/docs/dev/fancy-ideas similarity index 100% rename from doc/dev/fancy-ideas rename to docs/dev/fancy-ideas diff --git a/doc/dev/git-post-commit-hook b/docs/dev/git-post-commit-hook similarity index 100% rename from doc/dev/git-post-commit-hook rename to docs/dev/git-post-commit-hook diff --git a/doc/dev/header b/docs/dev/header similarity index 100% rename from doc/dev/header rename to docs/dev/header diff --git a/doc/dev/lastchanges b/docs/dev/lastchanges similarity index 100% rename from doc/dev/lastchanges rename to docs/dev/lastchanges diff --git a/doc/dev/logs/2010-09-25 b/docs/dev/logs/2010-09-25 similarity index 100% rename from doc/dev/logs/2010-09-25 rename to docs/dev/logs/2010-09-25 diff --git a/doc/dev/logs/2010-11-02.steven b/docs/dev/logs/2010-11-02.steven similarity index 100% rename from doc/dev/logs/2010-11-02.steven rename to docs/dev/logs/2010-11-02.steven diff --git a/doc/dev/logs/2010-11-09 b/docs/dev/logs/2010-11-09 similarity index 100% rename from doc/dev/logs/2010-11-09 rename to docs/dev/logs/2010-11-09 diff --git a/doc/dev/logs/2010-11-21 b/docs/dev/logs/2010-11-21 similarity index 100% rename from doc/dev/logs/2010-11-21 rename to docs/dev/logs/2010-11-21 diff --git a/doc/dev/logs/2010-11-29 b/docs/dev/logs/2010-11-29 similarity index 100% rename from doc/dev/logs/2010-11-29 rename to docs/dev/logs/2010-11-29 diff --git a/doc/dev/logs/2010-12-01 b/docs/dev/logs/2010-12-01 similarity index 100% rename from doc/dev/logs/2010-12-01 rename to docs/dev/logs/2010-12-01 diff --git a/doc/dev/logs/2010-12-01.handwritten/SCAN0000.PDF b/docs/dev/logs/2010-12-01.handwritten/SCAN0000.PDF similarity index 100% rename from doc/dev/logs/2010-12-01.handwritten/SCAN0000.PDF rename to docs/dev/logs/2010-12-01.handwritten/SCAN0000.PDF diff --git a/doc/dev/logs/2010-12-01.handwritten/SCAN0001.PDF b/docs/dev/logs/2010-12-01.handwritten/SCAN0001.PDF similarity index 100% rename from doc/dev/logs/2010-12-01.handwritten/SCAN0001.PDF rename to docs/dev/logs/2010-12-01.handwritten/SCAN0001.PDF diff --git a/doc/dev/logs/2010-12-01.handwritten/SCAN0002.PDF b/docs/dev/logs/2010-12-01.handwritten/SCAN0002.PDF similarity index 100% rename from doc/dev/logs/2010-12-01.handwritten/SCAN0002.PDF rename to docs/dev/logs/2010-12-01.handwritten/SCAN0002.PDF diff --git a/doc/dev/logs/2010-12-01.handwritten/SCAN0003.PDF b/docs/dev/logs/2010-12-01.handwritten/SCAN0003.PDF similarity index 100% rename from doc/dev/logs/2010-12-01.handwritten/SCAN0003.PDF rename to docs/dev/logs/2010-12-01.handwritten/SCAN0003.PDF diff --git a/doc/dev/logs/2010-12-01.handwritten/SCAN0004.PDF b/docs/dev/logs/2010-12-01.handwritten/SCAN0004.PDF similarity index 100% rename from doc/dev/logs/2010-12-01.handwritten/SCAN0004.PDF rename to docs/dev/logs/2010-12-01.handwritten/SCAN0004.PDF diff --git a/doc/dev/logs/2011-01-17 b/docs/dev/logs/2011-01-17 similarity index 100% rename from doc/dev/logs/2011-01-17 rename to docs/dev/logs/2011-01-17 diff --git a/doc/dev/logs/2011-01-18.type-creation b/docs/dev/logs/2011-01-18.type-creation similarity index 100% rename from doc/dev/logs/2011-01-18.type-creation rename to docs/dev/logs/2011-01-18.type-creation diff --git a/doc/dev/logs/2011-01-24 b/docs/dev/logs/2011-01-24 similarity index 100% rename from doc/dev/logs/2011-01-24 rename to docs/dev/logs/2011-01-24 diff --git a/doc/dev/logs/2011-02-03 b/docs/dev/logs/2011-02-03 similarity index 100% rename from doc/dev/logs/2011-02-03 rename to docs/dev/logs/2011-02-03 diff --git a/doc/dev/logs/2011-02-04.steven b/docs/dev/logs/2011-02-04.steven similarity index 100% rename from doc/dev/logs/2011-02-04.steven rename to docs/dev/logs/2011-02-04.steven diff --git a/doc/dev/logs/2011-02-22 b/docs/dev/logs/2011-02-22 similarity index 100% rename from doc/dev/logs/2011-02-22 rename to docs/dev/logs/2011-02-22 diff --git a/doc/dev/logs/2011-02-24 b/docs/dev/logs/2011-02-24 similarity index 100% rename from doc/dev/logs/2011-02-24 rename to docs/dev/logs/2011-02-24 diff --git a/doc/dev/logs/2011-02-27 b/docs/dev/logs/2011-02-27 similarity index 100% rename from doc/dev/logs/2011-02-27 rename to docs/dev/logs/2011-02-27 diff --git a/doc/dev/logs/2011-03-03 b/docs/dev/logs/2011-03-03 similarity index 100% rename from doc/dev/logs/2011-03-03 rename to docs/dev/logs/2011-03-03 diff --git a/doc/dev/logs/2011-03-07 b/docs/dev/logs/2011-03-07 similarity index 100% rename from doc/dev/logs/2011-03-07 rename to docs/dev/logs/2011-03-07 diff --git a/doc/dev/logs/2011-03-09 b/docs/dev/logs/2011-03-09 similarity index 100% rename from doc/dev/logs/2011-03-09 rename to docs/dev/logs/2011-03-09 diff --git a/doc/dev/logs/2011-03-15 b/docs/dev/logs/2011-03-15 similarity index 100% rename from doc/dev/logs/2011-03-15 rename to docs/dev/logs/2011-03-15 diff --git a/doc/dev/logs/2011-03-15.file_directory_link b/docs/dev/logs/2011-03-15.file_directory_link similarity index 100% rename from doc/dev/logs/2011-03-15.file_directory_link rename to docs/dev/logs/2011-03-15.file_directory_link diff --git a/doc/dev/logs/2011-03-23.autorequire b/docs/dev/logs/2011-03-23.autorequire similarity index 100% rename from doc/dev/logs/2011-03-23.autorequire rename to docs/dev/logs/2011-03-23.autorequire diff --git a/doc/dev/logs/2011-03-23.manifest_use_explorer b/docs/dev/logs/2011-03-23.manifest_use_explorer similarity index 100% rename from doc/dev/logs/2011-03-23.manifest_use_explorer rename to docs/dev/logs/2011-03-23.manifest_use_explorer diff --git a/doc/dev/logs/2011-03-27.pgrep b/docs/dev/logs/2011-03-27.pgrep similarity index 100% rename from doc/dev/logs/2011-03-27.pgrep rename to docs/dev/logs/2011-03-27.pgrep diff --git a/doc/dev/logs/2011-03-28.execution-order b/docs/dev/logs/2011-03-28.execution-order similarity index 100% rename from doc/dev/logs/2011-03-28.execution-order rename to docs/dev/logs/2011-03-28.execution-order diff --git a/doc/dev/logs/2011-04-02.yum b/docs/dev/logs/2011-04-02.yum similarity index 100% rename from doc/dev/logs/2011-04-02.yum rename to docs/dev/logs/2011-04-02.yum diff --git a/doc/dev/logs/2011-04-04.openbsd b/docs/dev/logs/2011-04-04.openbsd similarity index 100% rename from doc/dev/logs/2011-04-04.openbsd rename to docs/dev/logs/2011-04-04.openbsd diff --git a/doc/dev/logs/2011-04-19 b/docs/dev/logs/2011-04-19 similarity index 100% rename from doc/dev/logs/2011-04-19 rename to docs/dev/logs/2011-04-19 diff --git a/doc/dev/logs/2011-04-20.slashdot-articles b/docs/dev/logs/2011-04-20.slashdot-articles similarity index 100% rename from doc/dev/logs/2011-04-20.slashdot-articles rename to docs/dev/logs/2011-04-20.slashdot-articles diff --git a/doc/dev/logs/2011-04-21.benchmark-eth b/docs/dev/logs/2011-04-21.benchmark-eth similarity index 100% rename from doc/dev/logs/2011-04-21.benchmark-eth rename to docs/dev/logs/2011-04-21.benchmark-eth diff --git a/doc/dev/logs/2011-04-21.benchmark-from-home.with-stdout b/docs/dev/logs/2011-04-21.benchmark-from-home.with-stdout similarity index 100% rename from doc/dev/logs/2011-04-21.benchmark-from-home.with-stdout rename to docs/dev/logs/2011-04-21.benchmark-from-home.with-stdout diff --git a/doc/dev/logs/2011-04-27 b/docs/dev/logs/2011-04-27 similarity index 100% rename from doc/dev/logs/2011-04-27 rename to docs/dev/logs/2011-04-27 diff --git a/doc/dev/logs/2011-04-27.benchmark b/docs/dev/logs/2011-04-27.benchmark similarity index 100% rename from doc/dev/logs/2011-04-27.benchmark rename to docs/dev/logs/2011-04-27.benchmark diff --git a/doc/dev/logs/2011-04-27.benchmark.dash b/docs/dev/logs/2011-04-27.benchmark.dash similarity index 100% rename from doc/dev/logs/2011-04-27.benchmark.dash rename to docs/dev/logs/2011-04-27.benchmark.dash diff --git a/doc/dev/logs/2011-04-27.debug-timing b/docs/dev/logs/2011-04-27.debug-timing similarity index 100% rename from doc/dev/logs/2011-04-27.debug-timing rename to docs/dev/logs/2011-04-27.debug-timing diff --git a/doc/dev/logs/2011-05-09 b/docs/dev/logs/2011-05-09 similarity index 100% rename from doc/dev/logs/2011-05-09 rename to docs/dev/logs/2011-05-09 diff --git a/doc/dev/logs/2011-05-10 b/docs/dev/logs/2011-05-10 similarity index 100% rename from doc/dev/logs/2011-05-10 rename to docs/dev/logs/2011-05-10 diff --git a/doc/dev/logs/2011-05-10.benchmark b/docs/dev/logs/2011-05-10.benchmark similarity index 100% rename from doc/dev/logs/2011-05-10.benchmark rename to docs/dev/logs/2011-05-10.benchmark diff --git a/doc/dev/logs/2011-05-12 b/docs/dev/logs/2011-05-12 similarity index 100% rename from doc/dev/logs/2011-05-12 rename to docs/dev/logs/2011-05-12 diff --git a/doc/dev/logs/2011-06-13.installation-via-cdist b/docs/dev/logs/2011-06-13.installation-via-cdist similarity index 100% rename from doc/dev/logs/2011-06-13.installation-via-cdist rename to docs/dev/logs/2011-06-13.installation-via-cdist diff --git a/doc/dev/logs/2011-06-14.library_for_user b/docs/dev/logs/2011-06-14.library_for_user similarity index 100% rename from doc/dev/logs/2011-06-14.library_for_user rename to docs/dev/logs/2011-06-14.library_for_user diff --git a/doc/dev/logs/2011-06-24.cinst_preos b/docs/dev/logs/2011-06-24.cinst_preos similarity index 100% rename from doc/dev/logs/2011-06-24.cinst_preos rename to docs/dev/logs/2011-06-24.cinst_preos diff --git a/doc/dev/logs/2011-06-25.trigger-graphic b/docs/dev/logs/2011-06-25.trigger-graphic similarity index 100% rename from doc/dev/logs/2011-06-25.trigger-graphic rename to docs/dev/logs/2011-06-25.trigger-graphic diff --git a/doc/dev/logs/2011-07-01.type-gencode b/docs/dev/logs/2011-07-01.type-gencode similarity index 100% rename from doc/dev/logs/2011-07-01.type-gencode rename to docs/dev/logs/2011-07-01.type-gencode diff --git a/doc/dev/logs/2011-07-01.type-global-explorers b/docs/dev/logs/2011-07-01.type-global-explorers similarity index 100% rename from doc/dev/logs/2011-07-01.type-global-explorers rename to docs/dev/logs/2011-07-01.type-global-explorers diff --git a/doc/dev/logs/2011-09-08.obsolete_debugging b/docs/dev/logs/2011-09-08.obsolete_debugging similarity index 100% rename from doc/dev/logs/2011-09-08.obsolete_debugging rename to docs/dev/logs/2011-09-08.obsolete_debugging diff --git a/doc/dev/logs/2011-09-12 b/docs/dev/logs/2011-09-12 similarity index 100% rename from doc/dev/logs/2011-09-12 rename to docs/dev/logs/2011-09-12 diff --git a/doc/dev/logs/2011-09-12.benchmark-home b/docs/dev/logs/2011-09-12.benchmark-home similarity index 100% rename from doc/dev/logs/2011-09-12.benchmark-home rename to docs/dev/logs/2011-09-12.benchmark-home diff --git a/doc/dev/logs/2011-09-13 b/docs/dev/logs/2011-09-13 similarity index 100% rename from doc/dev/logs/2011-09-13 rename to docs/dev/logs/2011-09-13 diff --git a/doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket b/docs/dev/logs/2011-09-16.benchmark-r815-no-control-socket similarity index 100% rename from doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket rename to docs/dev/logs/2011-09-16.benchmark-r815-no-control-socket diff --git a/doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode b/docs/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode similarity index 100% rename from doc/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode rename to docs/dev/logs/2011-09-16.benchmark-r815-no-control-socket.dmidecode diff --git a/doc/dev/logs/2011-10-04 b/docs/dev/logs/2011-10-04 similarity index 100% rename from doc/dev/logs/2011-10-04 rename to docs/dev/logs/2011-10-04 diff --git a/doc/dev/logs/2011-10-05 b/docs/dev/logs/2011-10-05 similarity index 100% rename from doc/dev/logs/2011-10-05 rename to docs/dev/logs/2011-10-05 diff --git a/doc/dev/logs/2011-10-06 b/docs/dev/logs/2011-10-06 similarity index 100% rename from doc/dev/logs/2011-10-06 rename to docs/dev/logs/2011-10-06 diff --git a/doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot b/docs/dev/logs/2011-10-06.ssh_scp_sudo_chroot similarity index 100% rename from doc/dev/logs/2011-10-06.ssh_scp_sudo_chroot rename to docs/dev/logs/2011-10-06.ssh_scp_sudo_chroot diff --git a/doc/dev/logs/2011-10-11.emulator-output b/docs/dev/logs/2011-10-11.emulator-output similarity index 100% rename from doc/dev/logs/2011-10-11.emulator-output rename to docs/dev/logs/2011-10-11.emulator-output diff --git a/doc/dev/logs/2011-10-12 b/docs/dev/logs/2011-10-12 similarity index 100% rename from doc/dev/logs/2011-10-12 rename to docs/dev/logs/2011-10-12 diff --git a/doc/dev/logs/2011-10-13.output b/docs/dev/logs/2011-10-13.output similarity index 100% rename from doc/dev/logs/2011-10-13.output rename to docs/dev/logs/2011-10-13.output diff --git a/doc/dev/logs/2011-10-14.error-output b/docs/dev/logs/2011-10-14.error-output similarity index 100% rename from doc/dev/logs/2011-10-14.error-output rename to docs/dev/logs/2011-10-14.error-output diff --git a/doc/dev/logs/2011-10-15.prefix-output-missing b/docs/dev/logs/2011-10-15.prefix-output-missing similarity index 100% rename from doc/dev/logs/2011-10-15.prefix-output-missing rename to docs/dev/logs/2011-10-15.prefix-output-missing diff --git a/doc/dev/logs/2011-10-15.ugly-output-on-breaking-explorer b/docs/dev/logs/2011-10-15.ugly-output-on-breaking-explorer similarity index 100% rename from doc/dev/logs/2011-10-15.ugly-output-on-breaking-explorer rename to docs/dev/logs/2011-10-15.ugly-output-on-breaking-explorer diff --git a/doc/dev/logs/2011-10-16.keyboardirqoutputs b/docs/dev/logs/2011-10-16.keyboardirqoutputs similarity index 100% rename from doc/dev/logs/2011-10-16.keyboardirqoutputs rename to docs/dev/logs/2011-10-16.keyboardirqoutputs diff --git a/doc/dev/logs/2011-10-18.requirement-object b/docs/dev/logs/2011-10-18.requirement-object similarity index 100% rename from doc/dev/logs/2011-10-18.requirement-object rename to docs/dev/logs/2011-10-18.requirement-object diff --git a/doc/dev/logs/2011-10-18.traceback-gencode b/docs/dev/logs/2011-10-18.traceback-gencode similarity index 100% rename from doc/dev/logs/2011-10-18.traceback-gencode rename to docs/dev/logs/2011-10-18.traceback-gencode diff --git a/doc/dev/logs/2011-11-15.startup-yannick b/docs/dev/logs/2011-11-15.startup-yannick similarity index 100% rename from doc/dev/logs/2011-11-15.startup-yannick rename to docs/dev/logs/2011-11-15.startup-yannick diff --git a/doc/dev/logs/2012-01-06.python3-in-distros b/docs/dev/logs/2012-01-06.python3-in-distros similarity index 100% rename from doc/dev/logs/2012-01-06.python3-in-distros rename to docs/dev/logs/2012-01-06.python3-in-distros diff --git a/doc/dev/logs/2012-01-07.urls b/docs/dev/logs/2012-01-07.urls similarity index 100% rename from doc/dev/logs/2012-01-07.urls rename to docs/dev/logs/2012-01-07.urls diff --git a/doc/dev/logs/2012-01-18.urls b/docs/dev/logs/2012-01-18.urls similarity index 100% rename from doc/dev/logs/2012-01-18.urls rename to docs/dev/logs/2012-01-18.urls diff --git a/doc/dev/logs/2012-02-08.explorer-depends-on-another-type b/docs/dev/logs/2012-02-08.explorer-depends-on-another-type similarity index 100% rename from doc/dev/logs/2012-02-08.explorer-depends-on-another-type rename to docs/dev/logs/2012-02-08.explorer-depends-on-another-type diff --git a/doc/dev/logs/2012-02-10.object_id-and-slashes b/docs/dev/logs/2012-02-10.object_id-and-slashes similarity index 100% rename from doc/dev/logs/2012-02-10.object_id-and-slashes rename to docs/dev/logs/2012-02-10.object_id-and-slashes diff --git a/doc/dev/logs/2012-02-13.dependencies b/docs/dev/logs/2012-02-13.dependencies similarity index 100% rename from doc/dev/logs/2012-02-13.dependencies rename to docs/dev/logs/2012-02-13.dependencies diff --git a/doc/dev/logs/2012-02-15.steven b/docs/dev/logs/2012-02-15.steven similarity index 100% rename from doc/dev/logs/2012-02-15.steven rename to docs/dev/logs/2012-02-15.steven diff --git a/doc/dev/logs/2012-02-17.keyboardirq b/docs/dev/logs/2012-02-17.keyboardirq similarity index 100% rename from doc/dev/logs/2012-02-17.keyboardirq rename to docs/dev/logs/2012-02-17.keyboardirq diff --git a/doc/dev/logs/2012-02-20.debug-jake-deps b/docs/dev/logs/2012-02-20.debug-jake-deps similarity index 100% rename from doc/dev/logs/2012-02-20.debug-jake-deps rename to docs/dev/logs/2012-02-20.debug-jake-deps diff --git a/doc/dev/logs/2012-02-20.error-does-not-contain-host b/docs/dev/logs/2012-02-20.error-does-not-contain-host similarity index 100% rename from doc/dev/logs/2012-02-20.error-does-not-contain-host rename to docs/dev/logs/2012-02-20.error-does-not-contain-host diff --git a/doc/dev/logs/2012-05-24.makedirs.py-python3.1 b/docs/dev/logs/2012-05-24.makedirs.py-python3.1 similarity index 100% rename from doc/dev/logs/2012-05-24.makedirs.py-python3.1 rename to docs/dev/logs/2012-05-24.makedirs.py-python3.1 diff --git a/doc/dev/logs/2012-05-30.ifconfig-outputs b/docs/dev/logs/2012-05-30.ifconfig-outputs similarity index 100% rename from doc/dev/logs/2012-05-30.ifconfig-outputs rename to docs/dev/logs/2012-05-30.ifconfig-outputs diff --git a/doc/dev/logs/2012-05-31.csh-compatibilty b/docs/dev/logs/2012-05-31.csh-compatibilty similarity index 100% rename from doc/dev/logs/2012-05-31.csh-compatibilty rename to docs/dev/logs/2012-05-31.csh-compatibilty diff --git a/doc/dev/logs/2012-06-06.wikipedia b/docs/dev/logs/2012-06-06.wikipedia similarity index 100% rename from doc/dev/logs/2012-06-06.wikipedia rename to docs/dev/logs/2012-06-06.wikipedia diff --git a/doc/dev/logs/2012-06-15.explorer-dep-problem b/docs/dev/logs/2012-06-15.explorer-dep-problem similarity index 100% rename from doc/dev/logs/2012-06-15.explorer-dep-problem rename to docs/dev/logs/2012-06-15.explorer-dep-problem diff --git a/doc/dev/logs/2012-10-17.conflicting-types-problem b/docs/dev/logs/2012-10-17.conflicting-types-problem similarity index 100% rename from doc/dev/logs/2012-10-17.conflicting-types-problem rename to docs/dev/logs/2012-10-17.conflicting-types-problem diff --git a/doc/dev/logs/README b/docs/dev/logs/README similarity index 100% rename from doc/dev/logs/README rename to docs/dev/logs/README diff --git a/doc/dev/logs/linklist b/docs/dev/logs/linklist similarity index 100% rename from doc/dev/logs/linklist rename to docs/dev/logs/linklist diff --git a/doc/dev/logs/times b/docs/dev/logs/times similarity index 100% rename from doc/dev/logs/times rename to docs/dev/logs/times diff --git a/doc/dev/releasechecklist b/docs/dev/releasechecklist similarity index 100% rename from doc/dev/releasechecklist rename to docs/dev/releasechecklist diff --git a/doc/dev/show_all_exported_variables b/docs/dev/show_all_exported_variables similarity index 100% rename from doc/dev/show_all_exported_variables rename to docs/dev/show_all_exported_variables diff --git a/doc/dev/sync-to-testhost b/docs/dev/sync-to-testhost similarity index 100% rename from doc/dev/sync-to-testhost rename to docs/dev/sync-to-testhost diff --git a/doc/dev/todo/3.0 b/docs/dev/todo/3.0 similarity index 100% rename from doc/dev/todo/3.0 rename to docs/dev/todo/3.0 diff --git a/doc/dev/todo/TAKEME b/docs/dev/todo/TAKEME similarity index 100% rename from doc/dev/todo/TAKEME rename to docs/dev/todo/TAKEME diff --git a/doc/dev/todo/niconext b/docs/dev/todo/niconext similarity index 100% rename from doc/dev/todo/niconext rename to docs/dev/todo/niconext diff --git a/doc/dev/todo/performance-ideas b/docs/dev/todo/performance-ideas similarity index 100% rename from doc/dev/todo/performance-ideas rename to docs/dev/todo/performance-ideas diff --git a/doc/dev/todo/steven b/docs/dev/todo/steven similarity index 100% rename from doc/dev/todo/steven rename to docs/dev/todo/steven diff --git a/doc/dev/todo/tests b/docs/dev/todo/tests similarity index 100% rename from doc/dev/todo/tests rename to docs/dev/todo/tests diff --git a/doc/gfx/cdist-automated-inverted.png b/docs/gfx/cdist-automated-inverted.png similarity index 100% rename from doc/gfx/cdist-automated-inverted.png rename to docs/gfx/cdist-automated-inverted.png diff --git a/doc/gfx/cdist-automated.png b/docs/gfx/cdist-automated.png similarity index 100% rename from doc/gfx/cdist-automated.png rename to docs/gfx/cdist-automated.png diff --git a/doc/gfx/cdist-automated.text b/docs/gfx/cdist-automated.text similarity index 100% rename from doc/gfx/cdist-automated.text rename to docs/gfx/cdist-automated.text diff --git a/doc/gfx/cdist-logo-cm.png b/docs/gfx/cdist-logo-cm.png similarity index 100% rename from doc/gfx/cdist-logo-cm.png rename to docs/gfx/cdist-logo-cm.png diff --git a/doc/gfx/cdist-logo-inverted.png b/docs/gfx/cdist-logo-inverted.png similarity index 100% rename from doc/gfx/cdist-logo-inverted.png rename to docs/gfx/cdist-logo-inverted.png diff --git a/doc/gfx/cdist-logo.png b/docs/gfx/cdist-logo.png similarity index 100% rename from doc/gfx/cdist-logo.png rename to docs/gfx/cdist-logo.png diff --git a/doc/gfx/cdist-logo.text b/docs/gfx/cdist-logo.text similarity index 100% rename from doc/gfx/cdist-logo.text rename to docs/gfx/cdist-logo.text diff --git a/doc/gfx/font-used b/docs/gfx/font-used similarity index 100% rename from doc/gfx/font-used rename to docs/gfx/font-used diff --git a/doc/man/cdist-reference.text.sh b/docs/man/cdist-reference.text.sh similarity index 100% rename from doc/man/cdist-reference.text.sh rename to docs/man/cdist-reference.text.sh diff --git a/doc/man/man1/cdist.text b/docs/man/man1/cdist.text similarity index 100% rename from doc/man/man1/cdist.text rename to docs/man/man1/cdist.text diff --git a/doc/man/man7/cdist-best-practice.text b/docs/man/man7/cdist-best-practice.text similarity index 100% rename from doc/man/man7/cdist-best-practice.text rename to docs/man/man7/cdist-best-practice.text diff --git a/doc/man/man7/cdist-bootstrap.text b/docs/man/man7/cdist-bootstrap.text similarity index 100% rename from doc/man/man7/cdist-bootstrap.text rename to docs/man/man7/cdist-bootstrap.text diff --git a/doc/man/man7/cdist-explorer.text b/docs/man/man7/cdist-explorer.text similarity index 100% rename from doc/man/man7/cdist-explorer.text rename to docs/man/man7/cdist-explorer.text diff --git a/doc/man/man7/cdist-hacker.text b/docs/man/man7/cdist-hacker.text similarity index 100% rename from doc/man/man7/cdist-hacker.text rename to docs/man/man7/cdist-hacker.text diff --git a/doc/man/man7/cdist-manifest.text b/docs/man/man7/cdist-manifest.text similarity index 100% rename from doc/man/man7/cdist-manifest.text rename to docs/man/man7/cdist-manifest.text diff --git a/doc/man/man7/cdist-quickstart.text b/docs/man/man7/cdist-quickstart.text similarity index 100% rename from doc/man/man7/cdist-quickstart.text rename to docs/man/man7/cdist-quickstart.text diff --git a/doc/man/man7/cdist-remote-exec-copy.text b/docs/man/man7/cdist-remote-exec-copy.text similarity index 100% rename from doc/man/man7/cdist-remote-exec-copy.text rename to docs/man/man7/cdist-remote-exec-copy.text diff --git a/doc/man/man7/cdist-stages.text b/docs/man/man7/cdist-stages.text similarity index 100% rename from doc/man/man7/cdist-stages.text rename to docs/man/man7/cdist-stages.text diff --git a/doc/man/man7/cdist-tutorial.text b/docs/man/man7/cdist-tutorial.text similarity index 100% rename from doc/man/man7/cdist-tutorial.text rename to docs/man/man7/cdist-tutorial.text diff --git a/doc/man/man7/cdist-type.text b/docs/man/man7/cdist-type.text similarity index 100% rename from doc/man/man7/cdist-type.text rename to docs/man/man7/cdist-type.text diff --git a/doc/speeches/.gitignore b/docs/speeches/.gitignore similarity index 100% rename from doc/speeches/.gitignore rename to docs/speeches/.gitignore diff --git a/doc/speeches/2011-03-18_hacker_erwachen.tex b/docs/speeches/2011-03-18_hacker_erwachen.tex similarity index 100% rename from doc/speeches/2011-03-18_hacker_erwachen.tex rename to docs/speeches/2011-03-18_hacker_erwachen.tex diff --git a/doc/speeches/2011-04-27_sans.tex b/docs/speeches/2011-04-27_sans.tex similarity index 100% rename from doc/speeches/2011-04-27_sans.tex rename to docs/speeches/2011-04-27_sans.tex diff --git a/doc/speeches/2011-05-20_cosin.tex b/docs/speeches/2011-05-20_cosin.tex similarity index 100% rename from doc/speeches/2011-05-20_cosin.tex rename to docs/speeches/2011-05-20_cosin.tex diff --git a/doc/video/cdist-installation-in-less-than-60-seconds.mp4 b/docs/video/cdist-installation-in-less-than-60-seconds.mp4 similarity index 100% rename from doc/video/cdist-installation-in-less-than-60-seconds.mp4 rename to docs/video/cdist-installation-in-less-than-60-seconds.mp4 From c9f728e073975ce395ef17164a3e175738fdf451 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 17:21:58 +0200 Subject: [PATCH 201/412] lib/cdist => cdist (pypi) Signed-off-by: Nico Schottelius --- {lib/cdist => cdist}/__init__.py | 0 {lib/cdist => cdist}/banner.py | 0 {lib/cdist => cdist}/config.py | 0 {lib/cdist => cdist}/config_install.py | 0 {lib/cdist => cdist}/context.py | 0 {lib/cdist => cdist}/core/__init__.py | 0 {lib/cdist => cdist}/core/cdist_object.py | 0 {lib/cdist => cdist}/core/cdist_type.py | 0 {lib/cdist => cdist}/core/code.py | 0 {lib/cdist => cdist}/core/explorer.py | 0 {lib/cdist => cdist}/core/manifest.py | 0 {lib/cdist => cdist}/emulator.py | 0 {lib/cdist => cdist}/exec/__init__.py | 0 {lib/cdist => cdist}/exec/local.py | 0 {lib/cdist => cdist}/exec/remote.py | 0 {lib/cdist => cdist}/install.py | 0 {lib/cdist => cdist}/resolver.py | 0 {lib/cdist => cdist}/test/__init__.py | 0 {lib/cdist => cdist}/test/__main__.py | 0 {lib/cdist => cdist}/test/autorequire/__init__.py | 0 .../cdist => cdist}/test/autorequire/fixtures/conf/explorer/.keep | 0 .../test/autorequire/fixtures/conf/manifest/circular_dependency | 0 .../test/autorequire/fixtures/conf/manifest/implicit_dependencies | 0 .../test/autorequire/fixtures/conf/type/__addifnosuchline/.keep | 0 .../test/autorequire/fixtures/conf/type/__directory/.keep | 0 .../test/autorequire/fixtures/conf/type/__nfsroot_client/manifest | 0 .../test/autorequire/fixtures/conf/type/__package/manifest | 0 .../test/autorequire/fixtures/conf/type/__package_special/.keep | 0 .../fixtures/conf/type/__root_ssh_authorized_key/manifest | 0 .../test/autorequire/fixtures/conf/type/__top/manifest | 0 .../test/autorequire/fixtures/conf/type/__user/.keep | 0 {lib/cdist => cdist}/test/banner/__init__.py | 0 {lib/cdist => cdist}/test/code/__init__.py | 0 .../test/code/fixtures/conf/type/__dump_environment/gencode-local | 0 .../code/fixtures/conf/type/__dump_environment/gencode-remote | 0 {lib/cdist => cdist}/test/emulator/__init__.py | 0 {lib/cdist => cdist}/test/emulator/fixtures/conf/explorer/.keep | 0 {lib/cdist => cdist}/test/emulator/fixtures/conf/manifest/init | 0 .../fixtures/conf/type/__arguments_boolean/parameter/boolean | 0 .../fixtures/conf/type/__arguments_optional/parameter/optional | 0 .../fixtures/conf/type/__arguments_required/parameter/required | 0 .../fixtures/conf/type/__arguments_with_dashes/parameter/required | 0 {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__file | 0 .../test/emulator/fixtures/conf/type/__file_from_stdin/manifest | 0 .../fixtures/conf/type/__file_from_stdin/parameter/required | 0 .../test/emulator/fixtures/conf/type/__moon/manifest | 0 .../test/emulator/fixtures/conf/type/__moon/parameter/optional | 0 .../test/emulator/fixtures/conf/type/__moon/parameter/required | 0 .../test/emulator/fixtures/conf/type/__planet/manifest | 0 .../test/emulator/fixtures/conf/type/__planet/parameter/optional | 0 .../test/emulator/fixtures/conf/type/__saturn/manifest | 0 .../test/emulator/fixtures/conf/type/__saturn/singleton | 0 {lib/cdist => cdist}/test/exec/__init__.py | 0 {lib/cdist => cdist}/test/exec/local.py | 0 {lib/cdist => cdist}/test/exec/remote.py | 0 {lib/cdist => cdist}/test/explorer/__init__.py | 0 {lib/cdist => cdist}/test/explorer/fixtures/conf/explorer/foobar | 0 {lib/cdist => cdist}/test/explorer/fixtures/conf/explorer/global | 0 .../test/explorer/fixtures/conf/type/__test_type/explorer/world | 0 .../type/__test_type_object_parameter/explorer/test_parameter | 0 {lib/cdist => cdist}/test/manifest/__init__.py | 0 .../test/manifest/fixtures/conf/manifest/dump_environment | 0 {lib/cdist => cdist}/test/manifest/fixtures/conf/manifest/init | 0 .../test/manifest/fixtures/conf/type/__dump_environment/manifest | 0 .../cdist => cdist}/test/manifest/fixtures/conf/type/__moon/.keep | 0 .../test/manifest/fixtures/conf/type/__moon/manifest | 0 .../test/manifest/fixtures/conf/type/__moon/parameter/optional | 0 .../test/manifest/fixtures/conf/type/__moon/parameter/required | 0 .../test/manifest/fixtures/conf/type/__planet/.keep | 0 .../test/manifest/fixtures/conf/type/__planet/manifest | 0 .../test/manifest/fixtures/conf/type/__planet/parameter/optional | 0 {lib/cdist => cdist}/test/object/__init__.py | 0 {lib/cdist => cdist}/test/object/fixtures/object/__first/.keep | 0 .../test/object/fixtures/object/__first/man/.cdist/.keep | 0 {lib/cdist => cdist}/test/object/fixtures/object/__second/.keep | 0 .../test/object/fixtures/object/__second/on-the/.cdist/.keep | 0 {lib/cdist => cdist}/test/object/fixtures/object/__third/.keep | 0 .../test/object/fixtures/object/__third/moon/.cdist/.keep | 0 .../object/fixtures/object/__third/moon/.cdist/parameter/name | 0 .../object/fixtures/object/__third/moon/.cdist/parameter/planet | 0 {lib/cdist => cdist}/test/object/fixtures/type/__first/.keep | 0 {lib/cdist => cdist}/test/object/fixtures/type/__second/.keep | 0 {lib/cdist => cdist}/test/object/fixtures/type/__third/.keep | 0 {lib/cdist => cdist}/test/resolver/__init__.py | 0 {lib/cdist => cdist}/test/resolver/fixtures/object/__first/.keep | 0 .../test/resolver/fixtures/object/__first/child/.cdist/.keep | 0 .../test/resolver/fixtures/object/__first/dog/.cdist/.keep | 0 .../test/resolver/fixtures/object/__first/man/.cdist/.keep | 0 .../test/resolver/fixtures/object/__first/woman/.cdist/.keep | 0 {lib/cdist => cdist}/test/resolver/fixtures/object/__second/.keep | 0 .../test/resolver/fixtures/object/__second/on-the/.cdist/.keep | 0 .../test/resolver/fixtures/object/__second/under-the/.cdist/.keep | 0 {lib/cdist => cdist}/test/resolver/fixtures/object/__third/.keep | 0 .../test/resolver/fixtures/object/__third/moon/.cdist/.keep | 0 .../resolver/fixtures/object/__third/moon/.cdist/parameter/name | 0 .../resolver/fixtures/object/__third/moon/.cdist/parameter/planet | 0 {lib/cdist => cdist}/test/resolver/fixtures/type/__first/.keep | 0 {lib/cdist => cdist}/test/resolver/fixtures/type/__second/.keep | 0 {lib/cdist => cdist}/test/resolver/fixtures/type/__third/.keep | 0 {lib/cdist => cdist}/test/type/__init__.py | 0 {lib/cdist => cdist}/test/type/fixtures/__install/install | 0 {lib/cdist => cdist}/test/type/fixtures/__name_path/.keep | 0 {lib/cdist => cdist}/test/type/fixtures/__not_install/.keep | 0 {lib/cdist => cdist}/test/type/fixtures/__not_singleton/.keep | 0 {lib/cdist => cdist}/test/type/fixtures/__singleton/singleton | 0 .../type/fixtures/__with_boolean_parameters/parameter/boolean | 0 .../test/type/fixtures/__with_explorers/explorer/whatever | 0 .../type/fixtures/__with_optional_parameters/parameter/optional | 0 .../type/fixtures/__with_required_parameters/parameter/required | 0 .../test/type/fixtures/__without_boolean_parameters/.keep | 0 {lib/cdist => cdist}/test/type/fixtures/__without_explorers/.keep | 0 .../test/type/fixtures/__without_optional_parameters/.keep | 0 .../test/type/fixtures/__without_required_parameters/.keep | 0 {lib/cdist => cdist}/test/type/fixtures/list_types/__first/.keep | 0 {lib/cdist => cdist}/test/type/fixtures/list_types/__second/.keep | 0 {lib/cdist => cdist}/test/type/fixtures/list_types/__third/.keep | 0 {lib/cdist => cdist}/test/util/__init__.py | 0 {lib/cdist => cdist}/test/util/fsproperty.py | 0 {lib/cdist => cdist}/util/__init__.py | 0 {lib/cdist => cdist}/util/fsproperty.py | 0 120 files changed, 0 insertions(+), 0 deletions(-) rename {lib/cdist => cdist}/__init__.py (100%) rename {lib/cdist => cdist}/banner.py (100%) rename {lib/cdist => cdist}/config.py (100%) rename {lib/cdist => cdist}/config_install.py (100%) rename {lib/cdist => cdist}/context.py (100%) rename {lib/cdist => cdist}/core/__init__.py (100%) rename {lib/cdist => cdist}/core/cdist_object.py (100%) rename {lib/cdist => cdist}/core/cdist_type.py (100%) rename {lib/cdist => cdist}/core/code.py (100%) rename {lib/cdist => cdist}/core/explorer.py (100%) rename {lib/cdist => cdist}/core/manifest.py (100%) rename {lib/cdist => cdist}/emulator.py (100%) rename {lib/cdist => cdist}/exec/__init__.py (100%) rename {lib/cdist => cdist}/exec/local.py (100%) rename {lib/cdist => cdist}/exec/remote.py (100%) rename {lib/cdist => cdist}/install.py (100%) rename {lib/cdist => cdist}/resolver.py (100%) rename {lib/cdist => cdist}/test/__init__.py (100%) rename {lib/cdist => cdist}/test/__main__.py (100%) rename {lib/cdist => cdist}/test/autorequire/__init__.py (100%) rename {lib/cdist => cdist}/test/autorequire/fixtures/conf/explorer/.keep (100%) rename {lib/cdist => cdist}/test/autorequire/fixtures/conf/manifest/circular_dependency (100%) rename {lib/cdist => cdist}/test/autorequire/fixtures/conf/manifest/implicit_dependencies (100%) rename {lib/cdist => cdist}/test/autorequire/fixtures/conf/type/__addifnosuchline/.keep (100%) rename {lib/cdist => cdist}/test/autorequire/fixtures/conf/type/__directory/.keep (100%) rename {lib/cdist => cdist}/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest (100%) rename {lib/cdist => cdist}/test/autorequire/fixtures/conf/type/__package/manifest (100%) rename {lib/cdist => cdist}/test/autorequire/fixtures/conf/type/__package_special/.keep (100%) rename {lib/cdist => cdist}/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest (100%) rename {lib/cdist => cdist}/test/autorequire/fixtures/conf/type/__top/manifest (100%) rename {lib/cdist => cdist}/test/autorequire/fixtures/conf/type/__user/.keep (100%) rename {lib/cdist => cdist}/test/banner/__init__.py (100%) rename {lib/cdist => cdist}/test/code/__init__.py (100%) rename {lib/cdist => cdist}/test/code/fixtures/conf/type/__dump_environment/gencode-local (100%) rename {lib/cdist => cdist}/test/code/fixtures/conf/type/__dump_environment/gencode-remote (100%) rename {lib/cdist => cdist}/test/emulator/__init__.py (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/explorer/.keep (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/manifest/init (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__arguments_boolean/parameter/boolean (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__arguments_optional/parameter/optional (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__arguments_required/parameter/required (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__file (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__file_from_stdin/manifest (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__moon/manifest (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__moon/parameter/optional (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__moon/parameter/required (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__planet/manifest (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__planet/parameter/optional (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__saturn/manifest (100%) rename {lib/cdist => cdist}/test/emulator/fixtures/conf/type/__saturn/singleton (100%) rename {lib/cdist => cdist}/test/exec/__init__.py (100%) rename {lib/cdist => cdist}/test/exec/local.py (100%) rename {lib/cdist => cdist}/test/exec/remote.py (100%) rename {lib/cdist => cdist}/test/explorer/__init__.py (100%) rename {lib/cdist => cdist}/test/explorer/fixtures/conf/explorer/foobar (100%) rename {lib/cdist => cdist}/test/explorer/fixtures/conf/explorer/global (100%) rename {lib/cdist => cdist}/test/explorer/fixtures/conf/type/__test_type/explorer/world (100%) rename {lib/cdist => cdist}/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter (100%) rename {lib/cdist => cdist}/test/manifest/__init__.py (100%) rename {lib/cdist => cdist}/test/manifest/fixtures/conf/manifest/dump_environment (100%) rename {lib/cdist => cdist}/test/manifest/fixtures/conf/manifest/init (100%) rename {lib/cdist => cdist}/test/manifest/fixtures/conf/type/__dump_environment/manifest (100%) rename {lib/cdist => cdist}/test/manifest/fixtures/conf/type/__moon/.keep (100%) rename {lib/cdist => cdist}/test/manifest/fixtures/conf/type/__moon/manifest (100%) rename {lib/cdist => cdist}/test/manifest/fixtures/conf/type/__moon/parameter/optional (100%) rename {lib/cdist => cdist}/test/manifest/fixtures/conf/type/__moon/parameter/required (100%) rename {lib/cdist => cdist}/test/manifest/fixtures/conf/type/__planet/.keep (100%) rename {lib/cdist => cdist}/test/manifest/fixtures/conf/type/__planet/manifest (100%) rename {lib/cdist => cdist}/test/manifest/fixtures/conf/type/__planet/parameter/optional (100%) rename {lib/cdist => cdist}/test/object/__init__.py (100%) rename {lib/cdist => cdist}/test/object/fixtures/object/__first/.keep (100%) rename {lib/cdist => cdist}/test/object/fixtures/object/__first/man/.cdist/.keep (100%) rename {lib/cdist => cdist}/test/object/fixtures/object/__second/.keep (100%) rename {lib/cdist => cdist}/test/object/fixtures/object/__second/on-the/.cdist/.keep (100%) rename {lib/cdist => cdist}/test/object/fixtures/object/__third/.keep (100%) rename {lib/cdist => cdist}/test/object/fixtures/object/__third/moon/.cdist/.keep (100%) rename {lib/cdist => cdist}/test/object/fixtures/object/__third/moon/.cdist/parameter/name (100%) rename {lib/cdist => cdist}/test/object/fixtures/object/__third/moon/.cdist/parameter/planet (100%) rename {lib/cdist => cdist}/test/object/fixtures/type/__first/.keep (100%) rename {lib/cdist => cdist}/test/object/fixtures/type/__second/.keep (100%) rename {lib/cdist => cdist}/test/object/fixtures/type/__third/.keep (100%) rename {lib/cdist => cdist}/test/resolver/__init__.py (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/object/__first/.keep (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/object/__first/child/.cdist/.keep (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/object/__first/dog/.cdist/.keep (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/object/__first/man/.cdist/.keep (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/object/__first/woman/.cdist/.keep (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/object/__second/.keep (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/object/__second/on-the/.cdist/.keep (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/object/__second/under-the/.cdist/.keep (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/object/__third/.keep (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/object/__third/moon/.cdist/.keep (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/object/__third/moon/.cdist/parameter/name (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/object/__third/moon/.cdist/parameter/planet (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/type/__first/.keep (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/type/__second/.keep (100%) rename {lib/cdist => cdist}/test/resolver/fixtures/type/__third/.keep (100%) rename {lib/cdist => cdist}/test/type/__init__.py (100%) rename {lib/cdist => cdist}/test/type/fixtures/__install/install (100%) rename {lib/cdist => cdist}/test/type/fixtures/__name_path/.keep (100%) rename {lib/cdist => cdist}/test/type/fixtures/__not_install/.keep (100%) rename {lib/cdist => cdist}/test/type/fixtures/__not_singleton/.keep (100%) rename {lib/cdist => cdist}/test/type/fixtures/__singleton/singleton (100%) rename {lib/cdist => cdist}/test/type/fixtures/__with_boolean_parameters/parameter/boolean (100%) rename {lib/cdist => cdist}/test/type/fixtures/__with_explorers/explorer/whatever (100%) rename {lib/cdist => cdist}/test/type/fixtures/__with_optional_parameters/parameter/optional (100%) rename {lib/cdist => cdist}/test/type/fixtures/__with_required_parameters/parameter/required (100%) rename {lib/cdist => cdist}/test/type/fixtures/__without_boolean_parameters/.keep (100%) rename {lib/cdist => cdist}/test/type/fixtures/__without_explorers/.keep (100%) rename {lib/cdist => cdist}/test/type/fixtures/__without_optional_parameters/.keep (100%) rename {lib/cdist => cdist}/test/type/fixtures/__without_required_parameters/.keep (100%) rename {lib/cdist => cdist}/test/type/fixtures/list_types/__first/.keep (100%) rename {lib/cdist => cdist}/test/type/fixtures/list_types/__second/.keep (100%) rename {lib/cdist => cdist}/test/type/fixtures/list_types/__third/.keep (100%) rename {lib/cdist => cdist}/test/util/__init__.py (100%) rename {lib/cdist => cdist}/test/util/fsproperty.py (100%) rename {lib/cdist => cdist}/util/__init__.py (100%) rename {lib/cdist => cdist}/util/fsproperty.py (100%) diff --git a/lib/cdist/__init__.py b/cdist/__init__.py similarity index 100% rename from lib/cdist/__init__.py rename to cdist/__init__.py diff --git a/lib/cdist/banner.py b/cdist/banner.py similarity index 100% rename from lib/cdist/banner.py rename to cdist/banner.py diff --git a/lib/cdist/config.py b/cdist/config.py similarity index 100% rename from lib/cdist/config.py rename to cdist/config.py diff --git a/lib/cdist/config_install.py b/cdist/config_install.py similarity index 100% rename from lib/cdist/config_install.py rename to cdist/config_install.py diff --git a/lib/cdist/context.py b/cdist/context.py similarity index 100% rename from lib/cdist/context.py rename to cdist/context.py diff --git a/lib/cdist/core/__init__.py b/cdist/core/__init__.py similarity index 100% rename from lib/cdist/core/__init__.py rename to cdist/core/__init__.py diff --git a/lib/cdist/core/cdist_object.py b/cdist/core/cdist_object.py similarity index 100% rename from lib/cdist/core/cdist_object.py rename to cdist/core/cdist_object.py diff --git a/lib/cdist/core/cdist_type.py b/cdist/core/cdist_type.py similarity index 100% rename from lib/cdist/core/cdist_type.py rename to cdist/core/cdist_type.py diff --git a/lib/cdist/core/code.py b/cdist/core/code.py similarity index 100% rename from lib/cdist/core/code.py rename to cdist/core/code.py diff --git a/lib/cdist/core/explorer.py b/cdist/core/explorer.py similarity index 100% rename from lib/cdist/core/explorer.py rename to cdist/core/explorer.py diff --git a/lib/cdist/core/manifest.py b/cdist/core/manifest.py similarity index 100% rename from lib/cdist/core/manifest.py rename to cdist/core/manifest.py diff --git a/lib/cdist/emulator.py b/cdist/emulator.py similarity index 100% rename from lib/cdist/emulator.py rename to cdist/emulator.py diff --git a/lib/cdist/exec/__init__.py b/cdist/exec/__init__.py similarity index 100% rename from lib/cdist/exec/__init__.py rename to cdist/exec/__init__.py diff --git a/lib/cdist/exec/local.py b/cdist/exec/local.py similarity index 100% rename from lib/cdist/exec/local.py rename to cdist/exec/local.py diff --git a/lib/cdist/exec/remote.py b/cdist/exec/remote.py similarity index 100% rename from lib/cdist/exec/remote.py rename to cdist/exec/remote.py diff --git a/lib/cdist/install.py b/cdist/install.py similarity index 100% rename from lib/cdist/install.py rename to cdist/install.py diff --git a/lib/cdist/resolver.py b/cdist/resolver.py similarity index 100% rename from lib/cdist/resolver.py rename to cdist/resolver.py diff --git a/lib/cdist/test/__init__.py b/cdist/test/__init__.py similarity index 100% rename from lib/cdist/test/__init__.py rename to cdist/test/__init__.py diff --git a/lib/cdist/test/__main__.py b/cdist/test/__main__.py similarity index 100% rename from lib/cdist/test/__main__.py rename to cdist/test/__main__.py diff --git a/lib/cdist/test/autorequire/__init__.py b/cdist/test/autorequire/__init__.py similarity index 100% rename from lib/cdist/test/autorequire/__init__.py rename to cdist/test/autorequire/__init__.py diff --git a/lib/cdist/test/autorequire/fixtures/conf/explorer/.keep b/cdist/test/autorequire/fixtures/conf/explorer/.keep similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/explorer/.keep rename to cdist/test/autorequire/fixtures/conf/explorer/.keep diff --git a/lib/cdist/test/autorequire/fixtures/conf/manifest/circular_dependency b/cdist/test/autorequire/fixtures/conf/manifest/circular_dependency similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/manifest/circular_dependency rename to cdist/test/autorequire/fixtures/conf/manifest/circular_dependency diff --git a/lib/cdist/test/autorequire/fixtures/conf/manifest/implicit_dependencies b/cdist/test/autorequire/fixtures/conf/manifest/implicit_dependencies similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/manifest/implicit_dependencies rename to cdist/test/autorequire/fixtures/conf/manifest/implicit_dependencies diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__addifnosuchline/.keep b/cdist/test/autorequire/fixtures/conf/type/__addifnosuchline/.keep similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__addifnosuchline/.keep rename to cdist/test/autorequire/fixtures/conf/type/__addifnosuchline/.keep diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__directory/.keep b/cdist/test/autorequire/fixtures/conf/type/__directory/.keep similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__directory/.keep rename to cdist/test/autorequire/fixtures/conf/type/__directory/.keep diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest b/cdist/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest rename to cdist/test/autorequire/fixtures/conf/type/__nfsroot_client/manifest diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__package/manifest b/cdist/test/autorequire/fixtures/conf/type/__package/manifest similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__package/manifest rename to cdist/test/autorequire/fixtures/conf/type/__package/manifest diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__package_special/.keep b/cdist/test/autorequire/fixtures/conf/type/__package_special/.keep similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__package_special/.keep rename to cdist/test/autorequire/fixtures/conf/type/__package_special/.keep diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest b/cdist/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest rename to cdist/test/autorequire/fixtures/conf/type/__root_ssh_authorized_key/manifest diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__top/manifest b/cdist/test/autorequire/fixtures/conf/type/__top/manifest similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__top/manifest rename to cdist/test/autorequire/fixtures/conf/type/__top/manifest diff --git a/lib/cdist/test/autorequire/fixtures/conf/type/__user/.keep b/cdist/test/autorequire/fixtures/conf/type/__user/.keep similarity index 100% rename from lib/cdist/test/autorequire/fixtures/conf/type/__user/.keep rename to cdist/test/autorequire/fixtures/conf/type/__user/.keep diff --git a/lib/cdist/test/banner/__init__.py b/cdist/test/banner/__init__.py similarity index 100% rename from lib/cdist/test/banner/__init__.py rename to cdist/test/banner/__init__.py diff --git a/lib/cdist/test/code/__init__.py b/cdist/test/code/__init__.py similarity index 100% rename from lib/cdist/test/code/__init__.py rename to cdist/test/code/__init__.py diff --git a/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local b/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local similarity index 100% rename from lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local rename to cdist/test/code/fixtures/conf/type/__dump_environment/gencode-local diff --git a/lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-remote b/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-remote similarity index 100% rename from lib/cdist/test/code/fixtures/conf/type/__dump_environment/gencode-remote rename to cdist/test/code/fixtures/conf/type/__dump_environment/gencode-remote diff --git a/lib/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py similarity index 100% rename from lib/cdist/test/emulator/__init__.py rename to cdist/test/emulator/__init__.py diff --git a/lib/cdist/test/emulator/fixtures/conf/explorer/.keep b/cdist/test/emulator/fixtures/conf/explorer/.keep similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/explorer/.keep rename to cdist/test/emulator/fixtures/conf/explorer/.keep diff --git a/lib/cdist/test/emulator/fixtures/conf/manifest/init b/cdist/test/emulator/fixtures/conf/manifest/init similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/manifest/init rename to cdist/test/emulator/fixtures/conf/manifest/init diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__arguments_boolean/parameter/boolean b/cdist/test/emulator/fixtures/conf/type/__arguments_boolean/parameter/boolean similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__arguments_boolean/parameter/boolean rename to cdist/test/emulator/fixtures/conf/type/__arguments_boolean/parameter/boolean diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__arguments_optional/parameter/optional b/cdist/test/emulator/fixtures/conf/type/__arguments_optional/parameter/optional similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__arguments_optional/parameter/optional rename to cdist/test/emulator/fixtures/conf/type/__arguments_optional/parameter/optional diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__arguments_required/parameter/required b/cdist/test/emulator/fixtures/conf/type/__arguments_required/parameter/required similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__arguments_required/parameter/required rename to cdist/test/emulator/fixtures/conf/type/__arguments_required/parameter/required diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required b/cdist/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required rename to cdist/test/emulator/fixtures/conf/type/__arguments_with_dashes/parameter/required diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__file b/cdist/test/emulator/fixtures/conf/type/__file similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__file rename to cdist/test/emulator/fixtures/conf/type/__file diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/manifest b/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/manifest similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/manifest rename to cdist/test/emulator/fixtures/conf/type/__file_from_stdin/manifest diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required b/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required rename to cdist/test/emulator/fixtures/conf/type/__file_from_stdin/parameter/required diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__moon/manifest b/cdist/test/emulator/fixtures/conf/type/__moon/manifest similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__moon/manifest rename to cdist/test/emulator/fixtures/conf/type/__moon/manifest diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/optional b/cdist/test/emulator/fixtures/conf/type/__moon/parameter/optional similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/optional rename to cdist/test/emulator/fixtures/conf/type/__moon/parameter/optional diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/required b/cdist/test/emulator/fixtures/conf/type/__moon/parameter/required similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__moon/parameter/required rename to cdist/test/emulator/fixtures/conf/type/__moon/parameter/required diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__planet/manifest b/cdist/test/emulator/fixtures/conf/type/__planet/manifest similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__planet/manifest rename to cdist/test/emulator/fixtures/conf/type/__planet/manifest diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__planet/parameter/optional b/cdist/test/emulator/fixtures/conf/type/__planet/parameter/optional similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__planet/parameter/optional rename to cdist/test/emulator/fixtures/conf/type/__planet/parameter/optional diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__saturn/manifest b/cdist/test/emulator/fixtures/conf/type/__saturn/manifest similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__saturn/manifest rename to cdist/test/emulator/fixtures/conf/type/__saturn/manifest diff --git a/lib/cdist/test/emulator/fixtures/conf/type/__saturn/singleton b/cdist/test/emulator/fixtures/conf/type/__saturn/singleton similarity index 100% rename from lib/cdist/test/emulator/fixtures/conf/type/__saturn/singleton rename to cdist/test/emulator/fixtures/conf/type/__saturn/singleton diff --git a/lib/cdist/test/exec/__init__.py b/cdist/test/exec/__init__.py similarity index 100% rename from lib/cdist/test/exec/__init__.py rename to cdist/test/exec/__init__.py diff --git a/lib/cdist/test/exec/local.py b/cdist/test/exec/local.py similarity index 100% rename from lib/cdist/test/exec/local.py rename to cdist/test/exec/local.py diff --git a/lib/cdist/test/exec/remote.py b/cdist/test/exec/remote.py similarity index 100% rename from lib/cdist/test/exec/remote.py rename to cdist/test/exec/remote.py diff --git a/lib/cdist/test/explorer/__init__.py b/cdist/test/explorer/__init__.py similarity index 100% rename from lib/cdist/test/explorer/__init__.py rename to cdist/test/explorer/__init__.py diff --git a/lib/cdist/test/explorer/fixtures/conf/explorer/foobar b/cdist/test/explorer/fixtures/conf/explorer/foobar similarity index 100% rename from lib/cdist/test/explorer/fixtures/conf/explorer/foobar rename to cdist/test/explorer/fixtures/conf/explorer/foobar diff --git a/lib/cdist/test/explorer/fixtures/conf/explorer/global b/cdist/test/explorer/fixtures/conf/explorer/global similarity index 100% rename from lib/cdist/test/explorer/fixtures/conf/explorer/global rename to cdist/test/explorer/fixtures/conf/explorer/global diff --git a/lib/cdist/test/explorer/fixtures/conf/type/__test_type/explorer/world b/cdist/test/explorer/fixtures/conf/type/__test_type/explorer/world similarity index 100% rename from lib/cdist/test/explorer/fixtures/conf/type/__test_type/explorer/world rename to cdist/test/explorer/fixtures/conf/type/__test_type/explorer/world diff --git a/lib/cdist/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter b/cdist/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter similarity index 100% rename from lib/cdist/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter rename to cdist/test/explorer/fixtures/conf/type/__test_type_object_parameter/explorer/test_parameter diff --git a/lib/cdist/test/manifest/__init__.py b/cdist/test/manifest/__init__.py similarity index 100% rename from lib/cdist/test/manifest/__init__.py rename to cdist/test/manifest/__init__.py diff --git a/lib/cdist/test/manifest/fixtures/conf/manifest/dump_environment b/cdist/test/manifest/fixtures/conf/manifest/dump_environment similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/manifest/dump_environment rename to cdist/test/manifest/fixtures/conf/manifest/dump_environment diff --git a/lib/cdist/test/manifest/fixtures/conf/manifest/init b/cdist/test/manifest/fixtures/conf/manifest/init similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/manifest/init rename to cdist/test/manifest/fixtures/conf/manifest/init diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest b/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest rename to cdist/test/manifest/fixtures/conf/type/__dump_environment/manifest diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__moon/.keep b/cdist/test/manifest/fixtures/conf/type/__moon/.keep similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__moon/.keep rename to cdist/test/manifest/fixtures/conf/type/__moon/.keep diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__moon/manifest b/cdist/test/manifest/fixtures/conf/type/__moon/manifest similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__moon/manifest rename to cdist/test/manifest/fixtures/conf/type/__moon/manifest diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/optional b/cdist/test/manifest/fixtures/conf/type/__moon/parameter/optional similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/optional rename to cdist/test/manifest/fixtures/conf/type/__moon/parameter/optional diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/required b/cdist/test/manifest/fixtures/conf/type/__moon/parameter/required similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__moon/parameter/required rename to cdist/test/manifest/fixtures/conf/type/__moon/parameter/required diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__planet/.keep b/cdist/test/manifest/fixtures/conf/type/__planet/.keep similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__planet/.keep rename to cdist/test/manifest/fixtures/conf/type/__planet/.keep diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__planet/manifest b/cdist/test/manifest/fixtures/conf/type/__planet/manifest similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__planet/manifest rename to cdist/test/manifest/fixtures/conf/type/__planet/manifest diff --git a/lib/cdist/test/manifest/fixtures/conf/type/__planet/parameter/optional b/cdist/test/manifest/fixtures/conf/type/__planet/parameter/optional similarity index 100% rename from lib/cdist/test/manifest/fixtures/conf/type/__planet/parameter/optional rename to cdist/test/manifest/fixtures/conf/type/__planet/parameter/optional diff --git a/lib/cdist/test/object/__init__.py b/cdist/test/object/__init__.py similarity index 100% rename from lib/cdist/test/object/__init__.py rename to cdist/test/object/__init__.py diff --git a/lib/cdist/test/object/fixtures/object/__first/.keep b/cdist/test/object/fixtures/object/__first/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/object/__first/.keep rename to cdist/test/object/fixtures/object/__first/.keep diff --git a/lib/cdist/test/object/fixtures/object/__first/man/.cdist/.keep b/cdist/test/object/fixtures/object/__first/man/.cdist/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/object/__first/man/.cdist/.keep rename to cdist/test/object/fixtures/object/__first/man/.cdist/.keep diff --git a/lib/cdist/test/object/fixtures/object/__second/.keep b/cdist/test/object/fixtures/object/__second/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/object/__second/.keep rename to cdist/test/object/fixtures/object/__second/.keep diff --git a/lib/cdist/test/object/fixtures/object/__second/on-the/.cdist/.keep b/cdist/test/object/fixtures/object/__second/on-the/.cdist/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/object/__second/on-the/.cdist/.keep rename to cdist/test/object/fixtures/object/__second/on-the/.cdist/.keep diff --git a/lib/cdist/test/object/fixtures/object/__third/.keep b/cdist/test/object/fixtures/object/__third/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/object/__third/.keep rename to cdist/test/object/fixtures/object/__third/.keep diff --git a/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/.keep b/cdist/test/object/fixtures/object/__third/moon/.cdist/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/object/__third/moon/.cdist/.keep rename to cdist/test/object/fixtures/object/__third/moon/.cdist/.keep diff --git a/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/name b/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/name similarity index 100% rename from lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/name rename to cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/name diff --git a/lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/planet b/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/planet similarity index 100% rename from lib/cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/planet rename to cdist/test/object/fixtures/object/__third/moon/.cdist/parameter/planet diff --git a/lib/cdist/test/object/fixtures/type/__first/.keep b/cdist/test/object/fixtures/type/__first/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/type/__first/.keep rename to cdist/test/object/fixtures/type/__first/.keep diff --git a/lib/cdist/test/object/fixtures/type/__second/.keep b/cdist/test/object/fixtures/type/__second/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/type/__second/.keep rename to cdist/test/object/fixtures/type/__second/.keep diff --git a/lib/cdist/test/object/fixtures/type/__third/.keep b/cdist/test/object/fixtures/type/__third/.keep similarity index 100% rename from lib/cdist/test/object/fixtures/type/__third/.keep rename to cdist/test/object/fixtures/type/__third/.keep diff --git a/lib/cdist/test/resolver/__init__.py b/cdist/test/resolver/__init__.py similarity index 100% rename from lib/cdist/test/resolver/__init__.py rename to cdist/test/resolver/__init__.py diff --git a/lib/cdist/test/resolver/fixtures/object/__first/.keep b/cdist/test/resolver/fixtures/object/__first/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__first/.keep rename to cdist/test/resolver/fixtures/object/__first/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__first/child/.cdist/.keep b/cdist/test/resolver/fixtures/object/__first/child/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__first/child/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__first/child/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__first/dog/.cdist/.keep b/cdist/test/resolver/fixtures/object/__first/dog/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__first/dog/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__first/dog/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__first/man/.cdist/.keep b/cdist/test/resolver/fixtures/object/__first/man/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__first/man/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__first/man/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__first/woman/.cdist/.keep b/cdist/test/resolver/fixtures/object/__first/woman/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__first/woman/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__first/woman/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__second/.keep b/cdist/test/resolver/fixtures/object/__second/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__second/.keep rename to cdist/test/resolver/fixtures/object/__second/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__second/on-the/.cdist/.keep b/cdist/test/resolver/fixtures/object/__second/on-the/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__second/on-the/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__second/on-the/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__second/under-the/.cdist/.keep b/cdist/test/resolver/fixtures/object/__second/under-the/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__second/under-the/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__second/under-the/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__third/.keep b/cdist/test/resolver/fixtures/object/__third/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__third/.keep rename to cdist/test/resolver/fixtures/object/__third/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__third/moon/.cdist/.keep b/cdist/test/resolver/fixtures/object/__third/moon/.cdist/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__third/moon/.cdist/.keep rename to cdist/test/resolver/fixtures/object/__third/moon/.cdist/.keep diff --git a/lib/cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/name b/cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/name similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/name rename to cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/name diff --git a/lib/cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/planet b/cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/planet similarity index 100% rename from lib/cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/planet rename to cdist/test/resolver/fixtures/object/__third/moon/.cdist/parameter/planet diff --git a/lib/cdist/test/resolver/fixtures/type/__first/.keep b/cdist/test/resolver/fixtures/type/__first/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/type/__first/.keep rename to cdist/test/resolver/fixtures/type/__first/.keep diff --git a/lib/cdist/test/resolver/fixtures/type/__second/.keep b/cdist/test/resolver/fixtures/type/__second/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/type/__second/.keep rename to cdist/test/resolver/fixtures/type/__second/.keep diff --git a/lib/cdist/test/resolver/fixtures/type/__third/.keep b/cdist/test/resolver/fixtures/type/__third/.keep similarity index 100% rename from lib/cdist/test/resolver/fixtures/type/__third/.keep rename to cdist/test/resolver/fixtures/type/__third/.keep diff --git a/lib/cdist/test/type/__init__.py b/cdist/test/type/__init__.py similarity index 100% rename from lib/cdist/test/type/__init__.py rename to cdist/test/type/__init__.py diff --git a/lib/cdist/test/type/fixtures/__install/install b/cdist/test/type/fixtures/__install/install similarity index 100% rename from lib/cdist/test/type/fixtures/__install/install rename to cdist/test/type/fixtures/__install/install diff --git a/lib/cdist/test/type/fixtures/__name_path/.keep b/cdist/test/type/fixtures/__name_path/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__name_path/.keep rename to cdist/test/type/fixtures/__name_path/.keep diff --git a/lib/cdist/test/type/fixtures/__not_install/.keep b/cdist/test/type/fixtures/__not_install/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__not_install/.keep rename to cdist/test/type/fixtures/__not_install/.keep diff --git a/lib/cdist/test/type/fixtures/__not_singleton/.keep b/cdist/test/type/fixtures/__not_singleton/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__not_singleton/.keep rename to cdist/test/type/fixtures/__not_singleton/.keep diff --git a/lib/cdist/test/type/fixtures/__singleton/singleton b/cdist/test/type/fixtures/__singleton/singleton similarity index 100% rename from lib/cdist/test/type/fixtures/__singleton/singleton rename to cdist/test/type/fixtures/__singleton/singleton diff --git a/lib/cdist/test/type/fixtures/__with_boolean_parameters/parameter/boolean b/cdist/test/type/fixtures/__with_boolean_parameters/parameter/boolean similarity index 100% rename from lib/cdist/test/type/fixtures/__with_boolean_parameters/parameter/boolean rename to cdist/test/type/fixtures/__with_boolean_parameters/parameter/boolean diff --git a/lib/cdist/test/type/fixtures/__with_explorers/explorer/whatever b/cdist/test/type/fixtures/__with_explorers/explorer/whatever similarity index 100% rename from lib/cdist/test/type/fixtures/__with_explorers/explorer/whatever rename to cdist/test/type/fixtures/__with_explorers/explorer/whatever diff --git a/lib/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional b/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional similarity index 100% rename from lib/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional rename to cdist/test/type/fixtures/__with_optional_parameters/parameter/optional diff --git a/lib/cdist/test/type/fixtures/__with_required_parameters/parameter/required b/cdist/test/type/fixtures/__with_required_parameters/parameter/required similarity index 100% rename from lib/cdist/test/type/fixtures/__with_required_parameters/parameter/required rename to cdist/test/type/fixtures/__with_required_parameters/parameter/required diff --git a/lib/cdist/test/type/fixtures/__without_boolean_parameters/.keep b/cdist/test/type/fixtures/__without_boolean_parameters/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__without_boolean_parameters/.keep rename to cdist/test/type/fixtures/__without_boolean_parameters/.keep diff --git a/lib/cdist/test/type/fixtures/__without_explorers/.keep b/cdist/test/type/fixtures/__without_explorers/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__without_explorers/.keep rename to cdist/test/type/fixtures/__without_explorers/.keep diff --git a/lib/cdist/test/type/fixtures/__without_optional_parameters/.keep b/cdist/test/type/fixtures/__without_optional_parameters/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__without_optional_parameters/.keep rename to cdist/test/type/fixtures/__without_optional_parameters/.keep diff --git a/lib/cdist/test/type/fixtures/__without_required_parameters/.keep b/cdist/test/type/fixtures/__without_required_parameters/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/__without_required_parameters/.keep rename to cdist/test/type/fixtures/__without_required_parameters/.keep diff --git a/lib/cdist/test/type/fixtures/list_types/__first/.keep b/cdist/test/type/fixtures/list_types/__first/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/list_types/__first/.keep rename to cdist/test/type/fixtures/list_types/__first/.keep diff --git a/lib/cdist/test/type/fixtures/list_types/__second/.keep b/cdist/test/type/fixtures/list_types/__second/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/list_types/__second/.keep rename to cdist/test/type/fixtures/list_types/__second/.keep diff --git a/lib/cdist/test/type/fixtures/list_types/__third/.keep b/cdist/test/type/fixtures/list_types/__third/.keep similarity index 100% rename from lib/cdist/test/type/fixtures/list_types/__third/.keep rename to cdist/test/type/fixtures/list_types/__third/.keep diff --git a/lib/cdist/test/util/__init__.py b/cdist/test/util/__init__.py similarity index 100% rename from lib/cdist/test/util/__init__.py rename to cdist/test/util/__init__.py diff --git a/lib/cdist/test/util/fsproperty.py b/cdist/test/util/fsproperty.py similarity index 100% rename from lib/cdist/test/util/fsproperty.py rename to cdist/test/util/fsproperty.py diff --git a/lib/cdist/util/__init__.py b/cdist/util/__init__.py similarity index 100% rename from lib/cdist/util/__init__.py rename to cdist/util/__init__.py diff --git a/lib/cdist/util/fsproperty.py b/cdist/util/fsproperty.py similarity index 100% rename from lib/cdist/util/fsproperty.py rename to cdist/util/fsproperty.py From 814c5e04d9db3193b935f768f1f56fbc0d8fe244 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 17:42:38 +0200 Subject: [PATCH 202/412] add initial setup.py Signed-off-by: Nico Schottelius --- setup.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..92194071 --- /dev/null +++ b/setup.py @@ -0,0 +1,34 @@ +from distutils.core import setup + +setup( + name = "cdist", + packages = ["cdist"], + version = "2.1.0", + description = "Usable configuration management system", + author = "Nico Schottelius", + author_email = "nico-cdist-pypi@schottelius.org", + url = "http://www.nico.schottelius.org/software/cdist/", + classifiers = [ + "Development Status :: 6 - Mature", + "Environment :: Console", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX", + "Operating System :: POSIX :: BSD", + "Operating System :: POSIX :: Linux", + "Operating System :: Unix", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Topic :: System :: Boot", + "Topic :: System :: Installation/Setup", + "Topic :: System :: Operating System", + "Topic :: System :: Software Distribution", + "Topic :: Utilities" + ], + long_description = ''' + cdist is a usable configuration management system. + It adheres to the KISS principle and is being used in small up to enterprise grade environments. + cdist is an alternative to other configuration management systems like cfengine, bcfg2, chef and puppet. + ''' +) From abb384c2708224ba20a535c63c22e5969aaa08b2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 17:43:20 +0200 Subject: [PATCH 203/412] add manifest for distutils Signed-off-by: Nico Schottelius --- MANIFEST.in | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..ae20db47 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include docs/changelog docs/changelog-2.1 +recursive-include docs/gfx +recursive-include docs *.mdwn From 392ec3c5edbea53179325fabfbce47493ade48d5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 17:46:19 +0200 Subject: [PATCH 204/412] correct link to __file Signed-off-by: Nico Schottelius --- cdist/test/emulator/fixtures/conf/type/__file | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/test/emulator/fixtures/conf/type/__file b/cdist/test/emulator/fixtures/conf/type/__file index c57c4134..8458361c 120000 --- a/cdist/test/emulator/fixtures/conf/type/__file +++ b/cdist/test/emulator/fixtures/conf/type/__file @@ -1 +1 @@ -../../../../../../../conf/type/__file \ No newline at end of file +../../../../../../conf/type/__file \ No newline at end of file From f25989d779f9926a89ad4f7d1b3d39a03e8071e9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 18:28:19 +0200 Subject: [PATCH 205/412] build MANIFEST ourselves Signed-off-by: Nico Schottelius --- .gitignore | 3 ++- MANIFEST.in | 3 --- build | 57 +++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 44 insertions(+), 19 deletions(-) delete mode 100644 MANIFEST.in diff --git a/.gitignore b/.gitignore index fe52a82f..5fc6b0ad 100644 --- a/.gitignore +++ b/.gitignore @@ -14,5 +14,6 @@ docs/man/man*/docbook-xsl.css # Ignore cdist cache for version control /cache/ -# Python / cache +# Python: cache, distutils __pycache__/ +MANIFEST diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index ae20db47..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -include docs/changelog docs/changelog-2.1 -recursive-include docs/gfx -recursive-include docs *.mdwn diff --git a/build b/build index d3f8ca3a..59bc0b65 100755 --- a/build +++ b/build @@ -45,12 +45,37 @@ MAN7DSTDIR=${MANDIR}/man7 SPEECHESDIR=docs/speeches case "$1" in - man) - set -e - "$0" mangen - "$0" mantype - "$0" manbuild - ;; + man) + set -e + "$0" mangen + "$0" mantype + "$0" manbuild + ;; + + pypi-manifest) + : > MANIFEST + # bin + echo bin/cdist >> MANIFEST + + # conf + find conf >> MANIFEST + + # docs + ls docs/changelog* >> MANIFEST + find docs/gfx >> MANIFEST + find docs/man/ -name \*.text >> MANIFEST + find docs/man/ -name \*.text.sh >> MANIFEST + + # other + find other/ >> MANIFEST + + + ;; + + pypi) + $0 pypi-manifest + python3 setup.py sdist + ;; manbuild) trap abort INT @@ -133,15 +158,17 @@ case "$1" in done ;; - clean) - rm -f ${MAN7DSTDIR}/cdist-reference.text - find "${MANDIR}" -mindepth 2 -type l \ - -o -name "*.1" \ - -o -name "*.7" \ - -o -name "*.html" \ - -o -name "*.xml" \ - | xargs rm -f - ;; + clean) + rm -f ${MAN7DSTDIR}/cdist-reference.text + find "${MANDIR}" -mindepth 2 -type l \ + -o -name "*.1" \ + -o -name "*.7" \ + -o -name "*.html" \ + -o -name "*.xml" \ + | xargs rm -f + + find * -name __pycache__ | xargs rm -rf + ;; test) shift # skip t From 45a4719fb0c08dcc7ab00076881a07b578a68586 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 18:29:49 +0200 Subject: [PATCH 206/412] clean before running pypi Signed-off-by: Nico Schottelius --- build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build b/build index 59bc0b65..fa0e78a2 100755 --- a/build +++ b/build @@ -73,6 +73,7 @@ case "$1" in ;; pypi) + $0 clean $0 pypi-manifest python3 setup.py sdist ;; @@ -168,6 +169,8 @@ case "$1" in | xargs rm -f find * -name __pycache__ | xargs rm -rf + + rm -f MANIFEST ;; test) From 65128e4bcfa7d73e25abc459914488a9b832df13 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 18:44:05 +0200 Subject: [PATCH 207/412] re-indent Signed-off-by: Nico Schottelius --- build | 287 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 146 insertions(+), 141 deletions(-) diff --git a/build b/build index fa0e78a2..bb8d60f5 100755 --- a/build +++ b/build @@ -45,157 +45,162 @@ MAN7DSTDIR=${MANDIR}/man7 SPEECHESDIR=docs/speeches case "$1" in - man) - set -e - "$0" mangen - "$0" mantype - "$0" manbuild - ;; + man) + set -e + "$0" mangen + "$0" mantype + "$0" manbuild + ;; - pypi-manifest) - : > MANIFEST - # bin - echo bin/cdist >> MANIFEST - - # conf - find conf >> MANIFEST + pypi-manifest) + # init MANIFEST + echo README > MANIFEST - # docs - ls docs/changelog* >> MANIFEST - find docs/gfx >> MANIFEST - find docs/man/ -name \*.text >> MANIFEST - find docs/man/ -name \*.text.sh >> MANIFEST + # bin + echo bin/cdist >> MANIFEST + + # main source + find cdist -type f >> MANIFEST - # other - find other/ >> MANIFEST + # conf + find conf -type f >> MANIFEST + + # docs + ls docs/changelog* >> MANIFEST + find docs/gfx -type f >> MANIFEST + find docs/man/ -type f -name \*.text >> MANIFEST + find docs/man/ -type f -name \*.text.sh >> MANIFEST + + # other + find other/ -type f >> MANIFEST - ;; + ;; - pypi) - $0 clean - $0 pypi-manifest - python3 setup.py sdist - ;; + pypi) + $0 clean + $0 pypi-manifest + python3 setup.py sdist + ;; - manbuild) - trap abort INT - abort() { - kill 0 - } - for section in 1 7; do - for src in ${MANDIR}/man${section}/*.text; do - manpage="${src%.text}.$section" - if [ ! -f "$manpage" -o "$manpage" -ot "$src" ]; then - echo "Compiling man page for $src" - $A2XM "$src" - fi - htmlpage="${src%.text}.html" - if [ ! -f "$htmlpage" -o "$htmlpage" -ot "$src" ]; then - echo "Compiling html page for $src" - $A2XH "$src" - fi - done - done - ;; - - mantype) - for mansrc in conf/type/*/man.text; do - dst="$(echo $mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;docs/man/man7/;')" - ln -sf "../../../$mansrc" "$dst" - done - ;; - - mangen) - ${MANDIR}/cdist-reference.text.sh - ;; - - release) - ./docs/dev/releasechecklist - ;; - - speeches) - cd "$SPEECHESDIR" - for speech in *tex; do - pdflatex "$speech" - pdflatex "$speech" - pdflatex "$speech" - done - ;; - - webmain) - cp README ${WEBPAGE} - cd ${WEBDIR} && git commit -m "cdist main update" ${WEBPAGE} - cd ${WEBDIR} && make pub - ;; - - web) - cp README ${WEBPAGE} - rm -rf ${WEBMAN} - mkdir -p ${WEBMAN}/man1 ${WEBMAN}/man7 - - # old stuff - # rm -rf ${WEBDIR}/${WEBBASE}/speeches && mkdir ${WEBDIR}/${WEBBASE}/speeches - # cp ${SPEECHESDIR}/*.pdf ${WEBDIR}/${WEBBASE}/speeches - # git describe > ${WEBDIR}/${WEBBASE}/man/VERSION - - cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${WEBMAN}/man1 - cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${WEBMAN}/man7 - - cd ${WEBDIR} && git add ${WEBBASE} - cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} - cd ${WEBDIR} && make pub - - # Fix ikiwiki, which does not like symlinks for pseudo security - ssh tee.schottelius.org \ - "cd /home/services/www/nico/www.nico.schottelius.org/www/software/cdist/man && - rm -f latest && ln -sf "$version" latest" - ;; - - p|pu|pub) - for remote in "" github sf ethz; do - echo "Pushing to $remote" - git push --mirror $remote + manbuild) + trap abort INT + abort() { + kill 0 + } + for section in 1 7; do + for src in ${MANDIR}/man${section}/*.text; do + manpage="${src%.text}.$section" + if [ ! -f "$manpage" -o "$manpage" -ot "$src" ]; then + echo "Compiling man page for $src" + $A2XM "$src" + fi + htmlpage="${src%.text}.html" + if [ ! -f "$htmlpage" -o "$htmlpage" -ot "$src" ]; then + echo "Compiling html page for $src" + $A2XH "$src" + fi + done done - ;; - - clean) - rm -f ${MAN7DSTDIR}/cdist-reference.text - find "${MANDIR}" -mindepth 2 -type l \ - -o -name "*.1" \ - -o -name "*.7" \ - -o -name "*.html" \ - -o -name "*.xml" \ - | xargs rm -f - - find * -name __pycache__ | xargs rm -rf - - rm -f MANIFEST ;; - test) - shift # skip t - export PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib + mantype) + for mansrc in conf/type/*/man.text; do + dst="$(echo $mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;docs/man/man7/;')" + ln -sf "../../../$mansrc" "$dst" + done + ;; - if [ $# -lt 1 ]; then - python3 -m cdist.test - else - python3 -m unittest "$@" - fi - ;; + mangen) + ${MANDIR}/cdist-reference.text.sh + ;; - *) - echo '' - echo 'Welcome to cdist!' - echo '' - echo 'Here are the possible targets:' - echo '' - echo ' clean: Remove build stuff' - echo ' man: Build manpages (requires Asciidoc)' - echo ' test: Run tests' - echo '' - echo '' - echo "Unknown target, \"$1\"" >&2 - exit 1 - ;; + release) + ./docs/dev/releasechecklist + ;; + + speeches) + cd "$SPEECHESDIR" + for speech in *tex; do + pdflatex "$speech" + pdflatex "$speech" + pdflatex "$speech" + done + ;; + + webmain) + cp README ${WEBPAGE} + cd ${WEBDIR} && git commit -m "cdist main update" ${WEBPAGE} + cd ${WEBDIR} && make pub + ;; + + web) + cp README ${WEBPAGE} + rm -rf ${WEBMAN} + mkdir -p ${WEBMAN}/man1 ${WEBMAN}/man7 + + # old stuff + # rm -rf ${WEBDIR}/${WEBBASE}/speeches && mkdir ${WEBDIR}/${WEBBASE}/speeches + # cp ${SPEECHESDIR}/*.pdf ${WEBDIR}/${WEBBASE}/speeches + # git describe > ${WEBDIR}/${WEBBASE}/man/VERSION + + cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${WEBMAN}/man1 + cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${WEBMAN}/man7 + + cd ${WEBDIR} && git add ${WEBBASE} + cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} + cd ${WEBDIR} && make pub + + # Fix ikiwiki, which does not like symlinks for pseudo security + ssh tee.schottelius.org \ + "cd /home/services/www/nico/www.nico.schottelius.org/www/software/cdist/man && + rm -f latest && ln -sf "$version" latest" + ;; + + p|pu|pub) + for remote in "" github sf ethz; do + echo "Pushing to $remote" + git push --mirror $remote + done + ;; + + clean) + rm -f ${MAN7DSTDIR}/cdist-reference.text + find "${MANDIR}" -mindepth 2 -type l \ + -o -name "*.1" \ + -o -name "*.7" \ + -o -name "*.html" \ + -o -name "*.xml" \ + | xargs rm -f + + find * -name __pycache__ | xargs rm -rf + + rm -f MANIFEST + ;; + + test) + shift # skip t + export PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib + + if [ $# -lt 1 ]; then + python3 -m cdist.test + else + python3 -m unittest "$@" + fi + ;; + + *) + echo '' + echo 'Welcome to cdist!' + echo '' + echo 'Here are the possible targets:' + echo '' + echo ' clean: Remove build stuff' + echo ' man: Build manpages (requires Asciidoc)' + echo ' test: Run tests' + echo '' + echo '' + echo "Unknown target, \"$1\"" >&2 + exit 1 + ;; esac From 37db1e8c2fe2ed469260769a8f78e0104ec2598e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 18:47:48 +0200 Subject: [PATCH 208/412] retry MANIFEST.in, when deleting cache before Signed-off-by: Nico Schottelius --- MANIFEST.in | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..6b86bbd0 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include docs/changelog docs/changelog-2.1 +recursive-include docs/gfx *.png *.text +recursive-include docs *.text From d20ae0596d484c928df39b00f98c2ae4d223f7ce Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 19:07:50 +0200 Subject: [PATCH 209/412] pypi cleanups Signed-off-by: Nico Schottelius --- .gitignore | 1 + MANIFEST.in | 2 +- build | 77 +++++++++++++++++++---------------------------------- 3 files changed, 30 insertions(+), 50 deletions(-) diff --git a/.gitignore b/.gitignore index 5fc6b0ad..71b70251 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ docs/man/man*/docbook-xsl.css # Python: cache, distutils __pycache__/ MANIFEST +dist/ diff --git a/MANIFEST.in b/MANIFEST.in index 6b86bbd0..b4935a92 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include docs/changelog docs/changelog-2.1 recursive-include docs/gfx *.png *.text -recursive-include docs *.text +recursive-include docs *.text *.html *.1 *.7 diff --git a/build b/build index bb8d60f5..4b5690ef 100755 --- a/build +++ b/build @@ -45,43 +45,12 @@ MAN7DSTDIR=${MANDIR}/man7 SPEECHESDIR=docs/speeches case "$1" in - man) - set -e - "$0" mangen - "$0" mantype - "$0" manbuild - ;; - - pypi-manifest) - # init MANIFEST - echo README > MANIFEST - - # bin - echo bin/cdist >> MANIFEST - - # main source - find cdist -type f >> MANIFEST - - # conf - find conf -type f >> MANIFEST - - # docs - ls docs/changelog* >> MANIFEST - find docs/gfx -type f >> MANIFEST - find docs/man/ -type f -name \*.text >> MANIFEST - find docs/man/ -type f -name \*.text.sh >> MANIFEST - - # other - find other/ -type f >> MANIFEST - - - ;; - - pypi) - $0 clean - $0 pypi-manifest - python3 setup.py sdist - ;; + man) + set -e + "$0" mangen + "$0" mantype + "$0" manbuild + ;; manbuild) trap abort INT @@ -119,6 +88,12 @@ case "$1" in ./docs/dev/releasechecklist ;; + pypi) + $0 very-clean + $0 man + python3 setup.py sdist + ;; + speeches) cd "$SPEECHESDIR" for speech in *tex; do @@ -164,19 +139,23 @@ case "$1" in done ;; - clean) - rm -f ${MAN7DSTDIR}/cdist-reference.text - find "${MANDIR}" -mindepth 2 -type l \ - -o -name "*.1" \ - -o -name "*.7" \ - -o -name "*.html" \ - -o -name "*.xml" \ - | xargs rm -f - - find * -name __pycache__ | xargs rm -rf + clean) + rm -f ${MAN7DSTDIR}/cdist-reference.text + find "${MANDIR}" -mindepth 2 -type l \ + -o -name "*.1" \ + -o -name "*.7" \ + -o -name "*.html" \ + -o -name "*.xml" \ + | xargs rm -f - rm -f MANIFEST - ;; + find * -name __pycache__ | xargs rm -rf + + rm -f MANIFEST + ;; + very-clean) + $0 clean + rm -rf cache/ + ;; test) shift # skip t From afbfc031f7a9bc794439fde2bacf0d6916b84c1f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 19:12:22 +0200 Subject: [PATCH 210/412] begin to split off version information from source Signed-off-by: Nico Schottelius --- .version | 1 + doc/dev/logs/2012-10-25.version-split | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 .version create mode 100644 doc/dev/logs/2012-10-25.version-split diff --git a/.version b/.version new file mode 100644 index 00000000..3d45b5c6 --- /dev/null +++ b/.version @@ -0,0 +1 @@ +2.0.14 diff --git a/doc/dev/logs/2012-10-25.version-split b/doc/dev/logs/2012-10-25.version-split new file mode 100644 index 00000000..975e1173 --- /dev/null +++ b/doc/dev/logs/2012-10-25.version-split @@ -0,0 +1,3 @@ +- store version in .version +- when distributed / packaged, include .version into sourcecode +- when in git checkout, use dynamic versioning From 637e4b28cbd091766ee51687be435d12bb6c2a32 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 22:19:27 +0200 Subject: [PATCH 211/412] include base for dynamic and static versioning Signed-off-by: Nico Schottelius --- build | 16 ++++++++++++++-- doc/dev/logs/2012-10-25.version-split | 7 ++++--- lib/cdist/__init__.py | 11 +++-------- lib/cdist/version.py | 1 + lib/cdist/version_dynamic.py | 27 +++++++++++++++++++++++++++ 5 files changed, 49 insertions(+), 13 deletions(-) create mode 120000 lib/cdist/version.py create mode 100644 lib/cdist/version_dynamic.py diff --git a/build b/build index bec7f5a9..a9647ff1 100755 --- a/build +++ b/build @@ -134,7 +134,7 @@ case "$1" in ;; clean) - rm -f ${MAN7DSTDIR}/cdist-reference.text + rm -f ${MAN7DSTDIR}/cdist-reference.text lib/cdist/version.py find "${MANDIR}" -mindepth 2 -type l \ -o -name "*.1" \ -o -name "*.7" \ @@ -154,7 +154,19 @@ case "$1" in fi ;; - *) + version-dynamic) + cd lib/cdist/ + ln -sf version_dynamic.py version.py + ;; + + version-dist) + version=$(cat .version) + cd lib/cdist/ + echo "VERSION=\"$version\"" > version_static.py + ln -sf version_static.py version.py + ;; + + *) echo '' echo 'Welcome to cdist!' echo '' diff --git a/doc/dev/logs/2012-10-25.version-split b/doc/dev/logs/2012-10-25.version-split index 975e1173..f381c48f 100644 --- a/doc/dev/logs/2012-10-25.version-split +++ b/doc/dev/logs/2012-10-25.version-split @@ -1,3 +1,4 @@ -- store version in .version -- when distributed / packaged, include .version into sourcecode -- when in git checkout, use dynamic versioning +x store version in .version +x when distributed / packaged, include .version into sourcecode + split into two files +x when in git checkout, use dynamic versioning diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py index 85bc5f77..02d708b1 100644 --- a/lib/cdist/__init__.py +++ b/lib/cdist/__init__.py @@ -22,14 +22,9 @@ import os import subprocess -try: - with open(os.devnull, 'w') as devnull: - here = os.path.dirname(os.path.realpath(__file__)) - VERSION = subprocess.check_output( - 'cd "%s" && git describe' % here, - stderr=devnull, shell=True).decode('utf-8') -except: - VERSION = "2.0.14" +import cdist.version + +VERSION = cdist.version.VERSION BANNER = """ .. . .x+=:. s diff --git a/lib/cdist/version.py b/lib/cdist/version.py new file mode 120000 index 00000000..153cf043 --- /dev/null +++ b/lib/cdist/version.py @@ -0,0 +1 @@ +version_dynamic.py \ No newline at end of file diff --git a/lib/cdist/version_dynamic.py b/lib/cdist/version_dynamic.py new file mode 100644 index 00000000..5f69f374 --- /dev/null +++ b/lib/cdist/version_dynamic.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# +# 2010-2012 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +import os +import subprocess + +here = os.path.dirname(os.path.realpath(__file__)) +VERSION = subprocess.check_output('cd "%s" && git describe' % here, + shell=True).decode('utf-8') From d3c7abbaba7935efd8c4e6a9176ecef8ee36deb0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 22:32:05 +0200 Subject: [PATCH 212/412] ignore static version Signed-off-by: Nico Schottelius --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 69a8ea98..b86e4a99 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ doc/man/man*/docbook-xsl.css # Python / cache __pycache__/ + +# Is static and will never be included +lib/cdist/version_static.py From 91c1374657e9122e4527d1f08f8ad8d08c6990f4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 23:37:15 +0200 Subject: [PATCH 213/412] begin restructering for python package Signed-off-by: Nico Schottelius --- .gitignore | 2 +- .version | 2 +- bin/cdist | 233 +--------------- cdist.py | 248 ++++++++++++++++++ cdist/test/emulator/fixtures/conf/type/__file | 2 +- {lib/cdist => cdist}/version.py | 0 {lib/cdist => cdist}/version_dynamic.py | 0 7 files changed, 256 insertions(+), 231 deletions(-) create mode 100755 cdist.py rename {lib/cdist => cdist}/version.py (100%) rename {lib/cdist => cdist}/version_dynamic.py (100%) diff --git a/.gitignore b/.gitignore index 786c706d..707b5f66 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,4 @@ docs/man/man7/cdist-reference.text __pycache__/ MANIFEST dist/ -lib/cdist/version_static.py +cdist/version_static.py diff --git a/.version b/.version index 3d45b5c6..71f08595 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.0.14 +2.1.0-pre1 diff --git a/bin/cdist b/bin/cdist index 75047acb..15127d2b 100755 --- a/bin/cdist +++ b/bin/cdist @@ -1,7 +1,7 @@ -#!/usr/bin/env python3 +#!/bin/sh # -*- coding: utf-8 -*- # -# 2010-2012 Nico Schottelius (nico-cdist at schottelius.org) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -20,229 +20,6 @@ # # -def commandline(): - """Parse command line""" - import argparse - - import cdist.banner - import cdist.config - import cdist.install - - # Construct parser others can reuse - parser = {} - # Options _all_ parsers have in common - parser['loglevel'] = argparse.ArgumentParser(add_help=False) - parser['loglevel'].add_argument('-d', '--debug', - help='Set log level to debug', action='store_true', - default=False) - parser['loglevel'].add_argument('-v', '--verbose', - help='Set log level to info, be more verbose', - action='store_true', default=False) - - # Main subcommand parser - parser['main'] = argparse.ArgumentParser(description='cdist ' + cdist.VERSION, - parents=[parser['loglevel']]) - parser['main'].add_argument('-V', '--version', - help='Show version', action='version', - version='%(prog)s ' + cdist.VERSION) - parser['sub'] = parser['main'].add_subparsers(title="Commands") - - # Banner - parser['banner'] = parser['sub'].add_parser('banner', - parents=[parser['loglevel']]) - parser['banner'].set_defaults(func=cdist.banner.banner) - - # Config and install (common stuff) - parser['configinstall'] = argparse.ArgumentParser(add_help=False) - parser['configinstall'].add_argument('host', nargs='+', - help='one or more hosts to operate on') - parser['configinstall'].add_argument('-c', '--cdist-home', - help='Change cdist home (default: .. from bin directory)', - action='store') - parser['configinstall'].add_argument('-i', '--initial-manifest', - help='Path to a cdist manifest or \'-\' to read from stdin.', - dest='manifest', required=False) - parser['configinstall'].add_argument('-p', '--parallel', - help='Operate on multiple hosts in parallel', - action='store_true', dest='parallel') - parser['configinstall'].add_argument('-s', '--sequential', - help='Operate on multiple hosts sequentially (default)', - action='store_false', dest='parallel') - - parser['configinstall'].add_argument('--remote-copy', - help='Command to use for remote copy (should behave like scp)', - action='store', dest='remote_copy', - default="scp -o User=root -q") - parser['configinstall'].add_argument('--remote-exec', - help='Command to use for remote execution (should behave like ssh)', - action='store', dest='remote_exec', - default="ssh -o User=root -q") - - # Config - parser['config'] = parser['sub'].add_parser('config', - parents=[parser['loglevel'], parser['configinstall']]) - parser['config'].set_defaults(func=config) - - # Install - # 20120525/sar: commented until it actually does something - #parser['install'] = parser['sub'].add_parser('install', - # parents=[parser['loglevel'], parser['configinstall']]) - #parser['install'].set_defaults(func=install) - - for p in parser: - parser[p].epilog = "Get cdist at http://www.nico.schottelius.org/software/cdist/" - - args = parser['main'].parse_args(sys.argv[1:]) - - # Loglevels are handled globally in here and debug wins over verbose - if args.verbose: - logging.root.setLevel(logging.INFO) - if args.debug: - logging.root.setLevel(logging.DEBUG) - - log.debug(args) - args.func(args) - -def config(args): - configinstall(args, mode=cdist.config.Config) - -def install(args): - configinstall(args, mode=cdist.install.Install) - -def configinstall(args, mode): - """Configure or install remote system""" - import multiprocessing - import time - - initial_manifest_tempfile = None - if args.manifest == '-': - # read initial manifest from stdin - import tempfile - try: - handle, initial_manifest_temp_path = tempfile.mkstemp(prefix='cdist.stdin.') - with os.fdopen(handle, 'w') as fd: - fd.write(sys.stdin.read()) - except (IOError, OSError) as e: - raise cdist.Error("Creating tempfile for stdin data failed: %s" % e) - - args.manifest = initial_manifest_temp_path - import atexit - atexit.register(lambda: os.remove(initial_manifest_temp_path)) - - process = {} - failed_hosts = [] - time_start = time.time() - - for host in args.host: - if args.parallel: - log.debug("Creating child process for %s", host) - process[host] = multiprocessing.Process(target=configinstall_onehost, args=(host, args, mode, True)) - process[host].start() - else: - try: - configinstall_onehost(host, args, mode, parallel=False) - except cdist.Error as e: - failed_hosts.append(host) - - # Catch errors in parallel mode when joining - if args.parallel: - for host in process.keys(): - log.debug("Joining process %s", host) - process[host].join() - - if not process[host].exitcode == 0: - failed_hosts.append(host) - - time_end = time.time() - log.info("Total processing time for %s host(s): %s", len(args.host), - (time_end - time_start)) - - if len(failed_hosts) > 0: - raise cdist.Error("Failed to deploy to the following hosts: " + - " ".join(failed_hosts)) - -def configinstall_onehost(host, args, mode, parallel): - """Configure or install ONE remote system""" - - try: - import cdist.context - - context = cdist.context.Context( - target_host=host, - remote_copy=args.remote_copy, - remote_exec=args.remote_exec, - initial_manifest=args.manifest, - base_path=args.cdist_home, - exec_path=sys.argv[0], - debug=args.debug) - - c = mode(context) - c.deploy_and_cleanup() - context.cleanup() - - except cdist.Error as e: - # We are running in our own process here, need to sys.exit! - if parallel: - log.error(e) - sys.exit(1) - else: - raise - - except KeyboardInterrupt: - # Ignore in parallel mode, we are existing anyway - if parallel: - sys.exit(0) - # Pass back to controlling code in sequential mode - else: - raise - -def emulator(): - """Prepare and run emulator""" - import cdist.emulator - emulator = cdist.emulator.Emulator(sys.argv) - return emulator.run() - -if __name__ == "__main__": - # Sys is needed for sys.exit() - import sys - - cdistpythonversion = '3.2' - if sys.version < cdistpythonversion: - print('Cdist requires Python >= ' + cdistpythonversion + - ' on the source host.', file=sys.stderr) - sys.exit(1) - - - exit_code = 0 - - try: - import logging - import os - import re - - # Ensure our /lib/ is included into PYTHON_PATH - sys.path.insert(0, os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) - - # And now import our stuff - import cdist - - log = logging.getLogger("cdist") - - logging.basicConfig(format='%(levelname)s: %(message)s') - - if re.match("__", os.path.basename(sys.argv[0])): - emulator() - else: - commandline() - - except KeyboardInterrupt: - pass - - except cdist.Error as e: - log.error(e) - exit_code = 1 - - # Determine exit code by return value of function - - sys.exit(exit_code) +# Wrapper for real script to allow execution from checkout +dir=${0%/*} +"$dir/../cdist.py" "$@" diff --git a/cdist.py b/cdist.py new file mode 100755 index 00000000..75047acb --- /dev/null +++ b/cdist.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# 2010-2012 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +def commandline(): + """Parse command line""" + import argparse + + import cdist.banner + import cdist.config + import cdist.install + + # Construct parser others can reuse + parser = {} + # Options _all_ parsers have in common + parser['loglevel'] = argparse.ArgumentParser(add_help=False) + parser['loglevel'].add_argument('-d', '--debug', + help='Set log level to debug', action='store_true', + default=False) + parser['loglevel'].add_argument('-v', '--verbose', + help='Set log level to info, be more verbose', + action='store_true', default=False) + + # Main subcommand parser + parser['main'] = argparse.ArgumentParser(description='cdist ' + cdist.VERSION, + parents=[parser['loglevel']]) + parser['main'].add_argument('-V', '--version', + help='Show version', action='version', + version='%(prog)s ' + cdist.VERSION) + parser['sub'] = parser['main'].add_subparsers(title="Commands") + + # Banner + parser['banner'] = parser['sub'].add_parser('banner', + parents=[parser['loglevel']]) + parser['banner'].set_defaults(func=cdist.banner.banner) + + # Config and install (common stuff) + parser['configinstall'] = argparse.ArgumentParser(add_help=False) + parser['configinstall'].add_argument('host', nargs='+', + help='one or more hosts to operate on') + parser['configinstall'].add_argument('-c', '--cdist-home', + help='Change cdist home (default: .. from bin directory)', + action='store') + parser['configinstall'].add_argument('-i', '--initial-manifest', + help='Path to a cdist manifest or \'-\' to read from stdin.', + dest='manifest', required=False) + parser['configinstall'].add_argument('-p', '--parallel', + help='Operate on multiple hosts in parallel', + action='store_true', dest='parallel') + parser['configinstall'].add_argument('-s', '--sequential', + help='Operate on multiple hosts sequentially (default)', + action='store_false', dest='parallel') + + parser['configinstall'].add_argument('--remote-copy', + help='Command to use for remote copy (should behave like scp)', + action='store', dest='remote_copy', + default="scp -o User=root -q") + parser['configinstall'].add_argument('--remote-exec', + help='Command to use for remote execution (should behave like ssh)', + action='store', dest='remote_exec', + default="ssh -o User=root -q") + + # Config + parser['config'] = parser['sub'].add_parser('config', + parents=[parser['loglevel'], parser['configinstall']]) + parser['config'].set_defaults(func=config) + + # Install + # 20120525/sar: commented until it actually does something + #parser['install'] = parser['sub'].add_parser('install', + # parents=[parser['loglevel'], parser['configinstall']]) + #parser['install'].set_defaults(func=install) + + for p in parser: + parser[p].epilog = "Get cdist at http://www.nico.schottelius.org/software/cdist/" + + args = parser['main'].parse_args(sys.argv[1:]) + + # Loglevels are handled globally in here and debug wins over verbose + if args.verbose: + logging.root.setLevel(logging.INFO) + if args.debug: + logging.root.setLevel(logging.DEBUG) + + log.debug(args) + args.func(args) + +def config(args): + configinstall(args, mode=cdist.config.Config) + +def install(args): + configinstall(args, mode=cdist.install.Install) + +def configinstall(args, mode): + """Configure or install remote system""" + import multiprocessing + import time + + initial_manifest_tempfile = None + if args.manifest == '-': + # read initial manifest from stdin + import tempfile + try: + handle, initial_manifest_temp_path = tempfile.mkstemp(prefix='cdist.stdin.') + with os.fdopen(handle, 'w') as fd: + fd.write(sys.stdin.read()) + except (IOError, OSError) as e: + raise cdist.Error("Creating tempfile for stdin data failed: %s" % e) + + args.manifest = initial_manifest_temp_path + import atexit + atexit.register(lambda: os.remove(initial_manifest_temp_path)) + + process = {} + failed_hosts = [] + time_start = time.time() + + for host in args.host: + if args.parallel: + log.debug("Creating child process for %s", host) + process[host] = multiprocessing.Process(target=configinstall_onehost, args=(host, args, mode, True)) + process[host].start() + else: + try: + configinstall_onehost(host, args, mode, parallel=False) + except cdist.Error as e: + failed_hosts.append(host) + + # Catch errors in parallel mode when joining + if args.parallel: + for host in process.keys(): + log.debug("Joining process %s", host) + process[host].join() + + if not process[host].exitcode == 0: + failed_hosts.append(host) + + time_end = time.time() + log.info("Total processing time for %s host(s): %s", len(args.host), + (time_end - time_start)) + + if len(failed_hosts) > 0: + raise cdist.Error("Failed to deploy to the following hosts: " + + " ".join(failed_hosts)) + +def configinstall_onehost(host, args, mode, parallel): + """Configure or install ONE remote system""" + + try: + import cdist.context + + context = cdist.context.Context( + target_host=host, + remote_copy=args.remote_copy, + remote_exec=args.remote_exec, + initial_manifest=args.manifest, + base_path=args.cdist_home, + exec_path=sys.argv[0], + debug=args.debug) + + c = mode(context) + c.deploy_and_cleanup() + context.cleanup() + + except cdist.Error as e: + # We are running in our own process here, need to sys.exit! + if parallel: + log.error(e) + sys.exit(1) + else: + raise + + except KeyboardInterrupt: + # Ignore in parallel mode, we are existing anyway + if parallel: + sys.exit(0) + # Pass back to controlling code in sequential mode + else: + raise + +def emulator(): + """Prepare and run emulator""" + import cdist.emulator + emulator = cdist.emulator.Emulator(sys.argv) + return emulator.run() + +if __name__ == "__main__": + # Sys is needed for sys.exit() + import sys + + cdistpythonversion = '3.2' + if sys.version < cdistpythonversion: + print('Cdist requires Python >= ' + cdistpythonversion + + ' on the source host.', file=sys.stderr) + sys.exit(1) + + + exit_code = 0 + + try: + import logging + import os + import re + + # Ensure our /lib/ is included into PYTHON_PATH + sys.path.insert(0, os.path.abspath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) + + # And now import our stuff + import cdist + + log = logging.getLogger("cdist") + + logging.basicConfig(format='%(levelname)s: %(message)s') + + if re.match("__", os.path.basename(sys.argv[0])): + emulator() + else: + commandline() + + except KeyboardInterrupt: + pass + + except cdist.Error as e: + log.error(e) + exit_code = 1 + + # Determine exit code by return value of function + + sys.exit(exit_code) diff --git a/cdist/test/emulator/fixtures/conf/type/__file b/cdist/test/emulator/fixtures/conf/type/__file index 8458361c..c57c4134 120000 --- a/cdist/test/emulator/fixtures/conf/type/__file +++ b/cdist/test/emulator/fixtures/conf/type/__file @@ -1 +1 @@ -../../../../../../conf/type/__file \ No newline at end of file +../../../../../../../conf/type/__file \ No newline at end of file diff --git a/lib/cdist/version.py b/cdist/version.py similarity index 100% rename from lib/cdist/version.py rename to cdist/version.py diff --git a/lib/cdist/version_dynamic.py b/cdist/version_dynamic.py similarity index 100% rename from lib/cdist/version_dynamic.py rename to cdist/version_dynamic.py From 136bb01a67fed7c55426b62cbe84b1dc8818a55f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 23:43:12 +0200 Subject: [PATCH 214/412] correct placement in build script Signed-off-by: Nico Schottelius --- build | 33 +++++++++++++++++++-------------- setup.py | 9 +++++++-- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/build b/build index 1dedabba..7d73224d 100755 --- a/build +++ b/build @@ -89,8 +89,13 @@ case "$1" in ;; pypi) - $0 very-clean - $0 man + #$0 very-clean + #$0 man + $0 version-dist + $0 sdist + $0 version-dynamic + ;; + sdist) python3 setup.py sdist ;; @@ -159,7 +164,6 @@ case "$1" in test) shift # skip t - export PYTHONPATH=$PYTHONPATH:$(pwd -P)/lib if [ $# -lt 1 ]; then python3 -m cdist.test @@ -168,6 +172,18 @@ case "$1" in fi ;; + version-dynamic) + cd cdist/ + ln -sf version_dynamic.py version.py + ;; + + version-dist) + version=$(cat .version) + cd cdist/ + echo "VERSION=\"$version\"" > version_static.py + ln -sf version_static.py version.py + ;; + *) echo '' echo 'Welcome to cdist!' @@ -183,15 +199,4 @@ case "$1" in exit 1 ;; - version-dynamic) - cd lib/cdist/ - ln -sf version_dynamic.py version.py - ;; - - version-dist) - version=$(cat .version) - cd lib/cdist/ - echo "VERSION=\"$version\"" > version_static.py - ln -sf version_static.py version.py - ;; esac diff --git a/setup.py b/setup.py index 92194071..62ee480c 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,14 @@ from distutils.core import setup +package_dir = {'': 'lib'} + +import cdist + setup( name = "cdist", - packages = ["cdist"], - version = "2.1.0", + packages = ["cdist", "cdist.core", "cdist.exec", "cdist.util" ], + scripts = ["cdist.py"], + version = cdist.version.VERSION, description = "Usable configuration management system", author = "Nico Schottelius", author_email = "nico-cdist-pypi@schottelius.org", From 3cf59fdf9a1ebdde176835dd2f986dd6465d6dd4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 23:45:56 +0200 Subject: [PATCH 215/412] always use dynamic version - on shipping included generated version Signed-off-by: Nico Schottelius --- bin/cdist | 1 + build | 12 ++---------- cdist/version.py | 1 - cdist/version_dynamic.py | 27 --------------------------- 4 files changed, 3 insertions(+), 38 deletions(-) delete mode 120000 cdist/version.py delete mode 100644 cdist/version_dynamic.py diff --git a/bin/cdist b/bin/cdist index 15127d2b..5c1239fb 100755 --- a/bin/cdist +++ b/bin/cdist @@ -22,4 +22,5 @@ # Wrapper for real script to allow execution from checkout dir=${0%/*} +"$dir/../build" version "$dir/../cdist.py" "$@" diff --git a/build b/build index 7d73224d..f8d6c74a 100755 --- a/build +++ b/build @@ -172,16 +172,8 @@ case "$1" in fi ;; - version-dynamic) - cd cdist/ - ln -sf version_dynamic.py version.py - ;; - - version-dist) - version=$(cat .version) - cd cdist/ - echo "VERSION=\"$version\"" > version_static.py - ln -sf version_static.py version.py + version) + echo "VERSION=\"$version\"" > cdist/version.py ;; *) diff --git a/cdist/version.py b/cdist/version.py deleted file mode 120000 index 153cf043..00000000 --- a/cdist/version.py +++ /dev/null @@ -1 +0,0 @@ -version_dynamic.py \ No newline at end of file diff --git a/cdist/version_dynamic.py b/cdist/version_dynamic.py deleted file mode 100644 index 5f69f374..00000000 --- a/cdist/version_dynamic.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# -# 2010-2012 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# -# - -import os -import subprocess - -here = os.path.dirname(os.path.realpath(__file__)) -VERSION = subprocess.check_output('cd "%s" && git describe' % here, - shell=True).decode('utf-8') From af8f944aaf8d72bd6c9f9287cee40d8ac7ff7f08 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 23:47:32 +0200 Subject: [PATCH 216/412] package_dir not needed anymore Signed-off-by: Nico Schottelius --- setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.py b/setup.py index 62ee480c..be907786 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,5 @@ from distutils.core import setup -package_dir = {'': 'lib'} - import cdist setup( From 85fcfb1744030f8f4f806abc745edbcb1745bf5d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 23:48:56 +0200 Subject: [PATCH 217/412] correct __file link again Signed-off-by: Nico Schottelius --- cdist/test/emulator/fixtures/conf/type/__file | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/test/emulator/fixtures/conf/type/__file b/cdist/test/emulator/fixtures/conf/type/__file index c57c4134..8458361c 120000 --- a/cdist/test/emulator/fixtures/conf/type/__file +++ b/cdist/test/emulator/fixtures/conf/type/__file @@ -1 +1 @@ -../../../../../../../conf/type/__file \ No newline at end of file +../../../../../../conf/type/__file \ No newline at end of file From 3826b6ce36b99dba101e821ec129c58e8da19e50 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 23:49:10 +0200 Subject: [PATCH 218/412] not needed to import our path anymore Signed-off-by: Nico Schottelius --- cdist.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cdist.py b/cdist.py index 75047acb..2066db55 100755 --- a/cdist.py +++ b/cdist.py @@ -219,16 +219,9 @@ if __name__ == "__main__": import logging import os import re - - # Ensure our /lib/ is included into PYTHON_PATH - sys.path.insert(0, os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), '../lib'))) - - # And now import our stuff import cdist log = logging.getLogger("cdist") - logging.basicConfig(format='%(levelname)s: %(message)s') if re.match("__", os.path.basename(sys.argv[0])): From c613f868a2564de8e814d15866a5ed37721862b6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 23:49:22 +0200 Subject: [PATCH 219/412] cleanups Signed-off-by: Nico Schottelius --- .gitignore | 2 +- build | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 707b5f66..0269a9fc 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,4 @@ docs/man/man7/cdist-reference.text __pycache__/ MANIFEST dist/ -cdist/version_static.py +cdist/version.py diff --git a/build b/build index f8d6c74a..75496c8d 100755 --- a/build +++ b/build @@ -146,6 +146,9 @@ case "$1" in clean) rm -f ${MAN7DSTDIR}/cdist-reference.text + rm -f cdist/version.py + rm -f MANIFEST + find "${MANDIR}" -mindepth 2 -type l \ -o -name "*.1" \ -o -name "*.7" \ @@ -154,8 +157,6 @@ case "$1" in | xargs rm -f find * -name __pycache__ | xargs rm -rf - - rm -f MANIFEST ;; very-clean) $0 clean From a21f5f787db135202b917f8e6e50ceb315076af6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 23:51:18 +0200 Subject: [PATCH 220/412] begin with pre first --- docs/changelog-2.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog-2.1 b/docs/changelog-2.1 index 6398e7dc..a5f7ca98 100644 --- a/docs/changelog-2.1 +++ b/docs/changelog-2.1 @@ -4,7 +4,7 @@ Changelog (v2.1 specific) * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -2.1.0: +2.1.0pre1: * Core: Removed obsolete variable __self * Removed type __addifnosuchline (replaced by __line) * Removed type __removeline (replaced by __line) From 66224f5bdc5b94595708c8c1c7fb95753c03b791 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 25 Oct 2012 23:51:45 +0200 Subject: [PATCH 221/412] add some urls Signed-off-by: Nico Schottelius --- doc/dev/logs/2012-05-23.urls | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 doc/dev/logs/2012-05-23.urls diff --git a/doc/dev/logs/2012-05-23.urls b/doc/dev/logs/2012-05-23.urls new file mode 100644 index 00000000..e37407b3 --- /dev/null +++ b/doc/dev/logs/2012-05-23.urls @@ -0,0 +1,5 @@ +http://nu-ex.com/cv.html + +https://lists.metalab.at/pipermail/devops/2012-January/000089.html + +http://www.ir0nik.com/wordpress/?p=121 From eb6687bd32a895f2adb8c41374d0824ee05e948f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 06:55:01 +0200 Subject: [PATCH 222/412] allow build to be called outside of the project directory Signed-off-by: Nico Schottelius --- build | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build b/build index 75496c8d..8e30c8d4 100755 --- a/build +++ b/build @@ -26,6 +26,7 @@ # exit on any error #set -e +basedir=${0%/*} version=$(git describe) # Manpage and HTML @@ -44,6 +45,9 @@ MAN1DSTDIR=${MANDIR}/man1 MAN7DSTDIR=${MANDIR}/man7 SPEECHESDIR=docs/speeches +# Change to checkout directory +cd "$basedir" + case "$1" in man) set -e From 27a832676bd39251d895a4208fb99918e18a27ef Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 07:09:05 +0200 Subject: [PATCH 223/412] move logfile into new destination Signed-off-by: Nico Schottelius --- {doc => docs}/dev/logs/2012-10-25.version-split | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {doc => docs}/dev/logs/2012-10-25.version-split (100%) diff --git a/doc/dev/logs/2012-10-25.version-split b/docs/dev/logs/2012-10-25.version-split similarity index 100% rename from doc/dev/logs/2012-10-25.version-split rename to docs/dev/logs/2012-10-25.version-split From 0db38038a90ecc2b5fc56e813a4762e84485bb30 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 07:20:03 +0200 Subject: [PATCH 224/412] merge changelog-2.1 back into main changelog Signed-off-by: Nico Schottelius --- docs/changelog | 12 ++++++++++++ docs/changelog-2.1 | 15 --------------- 2 files changed, 12 insertions(+), 15 deletions(-) delete mode 100644 docs/changelog-2.1 diff --git a/docs/changelog b/docs/changelog index 05d6d96b..7475a566 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,6 +4,18 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius + +2.1.0pre1: + * Core: Removed obsolete variable __self + * Removed type __addifnosuchline (replaced by __line) + * Removed type __removeline (replaced by __line) + * Type __directory: Parameter --parents and --recursive are now boolean + * Type __package_apt, __package_luarocks, __package_opkg, + __package_pacman, __package_pkg_freebsd, __package_pkg_openbsd, + __package_rubygem, __package_yum, __process: + Parameter state accepts only "present" and "absent" + * Initial support for pypi packaging + 2.0.15: * Core: Make variable __object_name available in type explorers (Steven Armtrong) * New Type: __qemu_img diff --git a/docs/changelog-2.1 b/docs/changelog-2.1 deleted file mode 100644 index a5f7ca98..00000000 --- a/docs/changelog-2.1 +++ /dev/null @@ -1,15 +0,0 @@ -Changelog (v2.1 specific) -------------------------- - - * Changes are always commented with their author in (braces) - * Exception: No braces means author == Nico Schottelius - -2.1.0pre1: - * Core: Removed obsolete variable __self - * Removed type __addifnosuchline (replaced by __line) - * Removed type __removeline (replaced by __line) - * Type __directory: Parameter --parents and --recursive are now boolean - * Type __package_apt, __package_luarocks, __package_opkg, - __package_pacman, __package_pkg_freebsd, __package_pkg_openbsd, - __package_rubygem, __package_yum, __process: - Parameter state accepts only "present" and "absent" From 80db8a01cf82a2f92d454c54aa7956d3e2dee7a3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 07:36:07 +0200 Subject: [PATCH 225/412] +linebreak Signed-off-by: Nico Schottelius --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index be907786..2de4a3c0 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,7 @@ setup( long_description = ''' cdist is a usable configuration management system. It adheres to the KISS principle and is being used in small up to enterprise grade environments. - cdist is an alternative to other configuration management systems like cfengine, bcfg2, chef and puppet. + cdist is an alternative to other configuration management systems like + cfengine, bcfg2, chef and puppet. ''' ) From ca275133d3eab812703565895a2c6dbd70ac3627 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 07:36:56 +0200 Subject: [PATCH 226/412] add releasedate for 2.1.0pre1 Signed-off-by: Nico Schottelius --- docs/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 7475a566..e691c09d 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,7 +5,7 @@ Changelog * Exception: No braces means author == Nico Schottelius -2.1.0pre1: +2.1.0pre1: 2012-10-26 * Core: Removed obsolete variable __self * Removed type __addifnosuchline (replaced by __line) * Removed type __removeline (replaced by __line) From 9eb7503713820a28aee7532b968123c19b875ba9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 07:37:18 +0200 Subject: [PATCH 227/412] split clean-dist into its own section Signed-off-by: Nico Schottelius --- build | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build b/build index 8e30c8d4..d7426feb 100755 --- a/build +++ b/build @@ -95,9 +95,8 @@ case "$1" in pypi) #$0 very-clean #$0 man - $0 version-dist + $0 version $0 sdist - $0 version-dynamic ;; sdist) python3 setup.py sdist @@ -150,8 +149,6 @@ case "$1" in clean) rm -f ${MAN7DSTDIR}/cdist-reference.text - rm -f cdist/version.py - rm -f MANIFEST find "${MANDIR}" -mindepth 2 -type l \ -o -name "*.1" \ @@ -162,9 +159,14 @@ case "$1" in find * -name __pycache__ | xargs rm -rf ;; + clean-dist) + rm -f cdist/version.py MANIFEST + rm -rf cache/ dist/ + ;; + very-clean) $0 clean - rm -rf cache/ + $0 clean-dist ;; test) From 3b04f5749e94a155bcc4a89b565374bcc7b3f36c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 08:31:54 +0200 Subject: [PATCH 228/412] change release script to setup version from changelog Signed-off-by: Nico Schottelius --- docs/dev/releasechecklist | 44 ++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/docs/dev/releasechecklist b/docs/dev/releasechecklist index 71f2979e..197ab2d3 100755 --- a/docs/dev/releasechecklist +++ b/docs/dev/releasechecklist @@ -1,48 +1,40 @@ #!/bin/sh # Nico Schottelius -files="doc/changelog lib/cdist/__init__.py" - -# Stuff to take care of when doing a release -echo "Preparing next release" - # Ensure documentation builds cleanly -echo "Testing documentation..." -./build clean && ./build man || exit 1 +echo "Verifying documentation building works ..." +## ./build clean && ./build man || exit 1 -# get version -changelog_version=$(grep '^[[:digit:]]' doc/changelog | head -n1 | sed 's/:.*//') -#git_version=$(git describe) -lib_version=$(grep "^ VERSION" lib/cdist/__init__.py | sed -e 's/.*= //' -e 's/"//g') +# get version from changelog and ensure it's not already present +changelog_version=$(grep '^[[:digit:]]' docs/changelog | head -n1 | sed 's/:.*//') -# get date +if git show --quiet $changelog_version >/dev/null 2>&1; then + echo "Version $changelog_version already exists, aborting." + exit 1 +fi + +echo "Target version from changelog: $changelog_version" + +# verify date in changelog date_today="$(date +%Y-%m-%d)" -date_changelog=$(grep '^[[:digit:]]' doc/changelog | head -n1 | sed 's/.*: //') - -echo "Ensure you fixed/prepared version files: $files" -echo "changelog: $changelog_version" -#echo "git: $git_version" -echo "lib: $lib_version" +date_changelog=$(grep '^[[:digit:]]' docs/changelog | head -n1 | sed 's/.*: //') if [ "$date_today" != "$date_changelog" ]; then - echo "Messed up date, not releasing:" + echo "Date in changelog is not today" echo "Changelog: $date_changelog" exit 1 fi -if [ "$lib_version" != "$changelog_version" ]; then - echo "Messed up versions, not releasing" - exit 1 -else - echo "Versions are sane, continuing" -fi echo "Press enter to continue" read wait -version=$lib_version +version=$changelog_version # get target branch branch=${version%\.*} +echo "Selecting branch $branch for merging" +exit 0 + # add tag printf "Enter tag description for %s> " "$version" read tagmessage From c29b7f68141a48657b3ef1dd267e74270179e630 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 11:59:43 +0200 Subject: [PATCH 229/412] checklist is now a helper Signed-off-by: Nico Schottelius --- docs/dev/{releasechecklist => releasehelper} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/dev/{releasechecklist => releasehelper} (100%) diff --git a/docs/dev/releasechecklist b/docs/dev/releasehelper similarity index 100% rename from docs/dev/releasechecklist rename to docs/dev/releasehelper From 1064d8edd50752f661c621b0c3aa4301c4bef5e6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 12:17:43 +0200 Subject: [PATCH 230/412] cleanup release and build script Signed-off-by: Nico Schottelius --- build | 5 ----- docs/dev/releasehelper | 16 ++++++++-------- 2 files changed, 8 insertions(+), 13 deletions(-) mode change 100755 => 100644 docs/dev/releasehelper diff --git a/build b/build index d7426feb..76057530 100755 --- a/build +++ b/build @@ -122,11 +122,6 @@ case "$1" in rm -rf ${WEBMAN} mkdir -p ${WEBMAN}/man1 ${WEBMAN}/man7 - # old stuff - # rm -rf ${WEBDIR}/${WEBBASE}/speeches && mkdir ${WEBDIR}/${WEBBASE}/speeches - # cp ${SPEECHESDIR}/*.pdf ${WEBDIR}/${WEBBASE}/speeches - # git describe > ${WEBDIR}/${WEBBASE}/man/VERSION - cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${WEBMAN}/man1 cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${WEBMAN}/man7 diff --git a/docs/dev/releasehelper b/docs/dev/releasehelper old mode 100755 new mode 100644 index 197ab2d3..4a570f89 --- a/docs/dev/releasehelper +++ b/docs/dev/releasehelper @@ -30,10 +30,10 @@ read wait version=$changelog_version # get target branch -branch=${version%\.*} +target_branch=${version%\.*} +current_branch=$(git rev-parse --abbrev-ref HEAD) -echo "Selecting branch $branch for merging" -exit 0 +echo "Selected branch $target_branch for merging $current_branch" # add tag printf "Enter tag description for %s> " "$version" @@ -41,14 +41,14 @@ read tagmessage git tag "$version" -m "$tagmessage" # Import into current version branch -printf "Press enter to git merge into branch \"$branch\" > " +printf "Press enter to git merge into branch \"$target_branch\" > " read prompt -git checkout $branch -git merge master -git checkout master +git checkout "$target_branch" +git merge "$current_branch" +git checkout "$current_branch" # Publish manpages and sourcecode -printf "Press enter to publish doc/ and code/ > " +printf "Press enter to publish doc/ code/ pypi for $version > " read prompt ./build web ./build pub From 281852ff27ee1a2d3803324da565da68cd825c8b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 12:19:41 +0200 Subject: [PATCH 231/412] use new helper Signed-off-by: Nico Schottelius --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index 76057530..16479304 100755 --- a/build +++ b/build @@ -89,7 +89,7 @@ case "$1" in ;; release) - ./docs/dev/releasechecklist + ./docs/dev/releasehelper ;; pypi) From aef91d972efc9acbb92a53097aece31bd7169894 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 12:23:47 +0200 Subject: [PATCH 232/412] more cleanups Signed-off-by: Nico Schottelius --- build | 1 - docs/dev/releasehelper | 0 2 files changed, 1 deletion(-) mode change 100644 => 100755 docs/dev/releasehelper diff --git a/build b/build index 16479304..2e6e7813 100755 --- a/build +++ b/build @@ -93,7 +93,6 @@ case "$1" in ;; pypi) - #$0 very-clean #$0 man $0 version $0 sdist diff --git a/docs/dev/releasehelper b/docs/dev/releasehelper old mode 100644 new mode 100755 From 7a34c6cd28697618a8b323c19d9fa27051e0a7fc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 17:40:38 +0200 Subject: [PATCH 233/412] add types to pypi distribution Signed-off-by: Nico Schottelius --- MANIFEST.in | 1 + docs/changelog | 3 +++ 2 files changed, 4 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index b4935a92..319dad56 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ include docs/changelog docs/changelog-2.1 recursive-include docs/gfx *.png *.text recursive-include docs *.text *.html *.1 *.7 +recursive-include conf * diff --git a/docs/changelog b/docs/changelog index e691c09d..3f170057 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,6 +5,9 @@ Changelog * Exception: No braces means author == Nico Schottelius +2.1.0pre2: + * PyPi: Add conf/ directory to distribution + 2.1.0pre1: 2012-10-26 * Core: Removed obsolete variable __self * Removed type __addifnosuchline (replaced by __line) From 6627325b454ef36354204787eb8dd8a9f0752d21 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 17:42:26 +0200 Subject: [PATCH 234/412] build manpages before doing a pypi package Signed-off-by: Nico Schottelius --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index 2e6e7813..18dcfdab 100755 --- a/build +++ b/build @@ -93,7 +93,7 @@ case "$1" in ;; pypi) - #$0 man + $0 man $0 version $0 sdist ;; From cbd44a883780d7ec541b07eea9fde7305d941cff Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 17:53:35 +0200 Subject: [PATCH 235/412] begin initial PKGBUILD for archlinux Signed-off-by: Nico Schottelius --- PKGBUILD.in | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 PKGBUILD.in diff --git a/PKGBUILD.in b/PKGBUILD.in new file mode 100755 index 00000000..8e55946f --- /dev/null +++ b/PKGBUILD.in @@ -0,0 +1,26 @@ +#!/bin/sh + +version=$(git describe) +version=2.1.0pre1 + +outfile=${0%.in} + +cat << eof > "${outfile}" +pkgname=cdist +pkgver=$version +pkgrel=1 +pkgdesc='A Usable Configuration Management System"' +arch=('any') +url='http://www.nico.schottelius.org/software/cdist/' +license=('GPL3') +depends=('python3>=3.2.0') +source=("http://pypi.python.org/packages/source/c/cdist/cdist-\${pkgver}.tar.gz") + +package() { + python3 setup.py build install --root="${pkgdir}" + + #install -Dm644 offlineimap.1 "${pkgdir}"/usr/share/man/man1/offlineimap.1 + #install -Dm644 offlineimap.conf "${pkgdir}"/usr/share/offlineimap/offlineimap.conf + #install -Dm644 offlineimap.conf.minimal "${pkgdir}"/usr/share/offlineimap/offlineimap.conf.minimal +} +eof From 4c4b234feb401d26b52d004611fdc1366df4e1eb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 17:53:57 +0200 Subject: [PATCH 236/412] ignore generated PKGBUILD Signed-off-by: Nico Schottelius --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 0269a9fc..5d39eae1 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ __pycache__/ MANIFEST dist/ cdist/version.py + +# Packaging: Archlinux +/PKGBUILD From 195036b7101db05002d85f478ba4151d0576e0c1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 18:13:17 +0200 Subject: [PATCH 237/412] creating basic cdist archlinux package works Signed-off-by: Nico Schottelius --- .gitignore | 4 ++++ PKGBUILD.in | 14 +++++++------- build | 13 +++++++++++-- setup.py | 2 +- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 5d39eae1..6e2d4437 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,7 @@ cdist/version.py # Packaging: Archlinux /PKGBUILD +/cdist-*.pkg.tar.xz +/cdist-*.tar.gz +/pkg +/src diff --git a/PKGBUILD.in b/PKGBUILD.in index 8e55946f..a4e744ae 100755 --- a/PKGBUILD.in +++ b/PKGBUILD.in @@ -1,8 +1,6 @@ #!/bin/sh version=$(git describe) -version=2.1.0pre1 - outfile=${0%.in} cat << eof > "${outfile}" @@ -13,14 +11,16 @@ pkgdesc='A Usable Configuration Management System"' arch=('any') url='http://www.nico.schottelius.org/software/cdist/' license=('GPL3') -depends=('python3>=3.2.0') +depends=('python>=3.2.0') source=("http://pypi.python.org/packages/source/c/cdist/cdist-\${pkgver}.tar.gz") package() { - python3 setup.py build install --root="${pkgdir}" + cd cdist-\${pkgver} + python3 setup.py build install --root="\${pkgdir}" + mv "\${pkgdir}"/usr/bin/cdist.py "\${pkgdir}"/usr/bin/cdist - #install -Dm644 offlineimap.1 "${pkgdir}"/usr/share/man/man1/offlineimap.1 - #install -Dm644 offlineimap.conf "${pkgdir}"/usr/share/offlineimap/offlineimap.conf - #install -Dm644 offlineimap.conf.minimal "${pkgdir}"/usr/share/offlineimap/offlineimap.conf.minimal + #install -Dm644 offlineimap.1 "\${pkgdir}"/usr/share/man/man1/offlineimap.1 } eof + +makepkg -g >> "${outfile}" diff --git a/build b/build index 18dcfdab..bb31ccc0 100755 --- a/build +++ b/build @@ -92,7 +92,12 @@ case "$1" in ./docs/dev/releasehelper ;; - pypi) + dist-archlinux) + ./PKGBUILD.in + makepkg + ;; + + dist-pypi) $0 man $0 version $0 sdist @@ -154,8 +159,12 @@ case "$1" in find * -name __pycache__ | xargs rm -rf ;; clean-dist) - rm -f cdist/version.py MANIFEST + rm -f cdist/version.py MANIFEST PKGBUILD rm -rf cache/ dist/ + + # Archlinux + rm -f cdist-*.pkg.tar.xz cdist-*.tar.gz + rm -rf pkg/ src/ ;; very-clean) diff --git a/setup.py b/setup.py index 2de4a3c0..900dac0f 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( packages = ["cdist", "cdist.core", "cdist.exec", "cdist.util" ], scripts = ["cdist.py"], version = cdist.version.VERSION, - description = "Usable configuration management system", + description = "A Usable Configuration Management System", author = "Nico Schottelius", author_email = "nico-cdist-pypi@schottelius.org", url = "http://www.nico.schottelius.org/software/cdist/", From 992be4959a0aa660de8ea44abd2a36e2f7a9e119 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 18:14:04 +0200 Subject: [PATCH 238/412] ++changes(2.1.0pre2) Signed-off-by: Nico Schottelius --- docs/changelog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/changelog b/docs/changelog index 3f170057..295aa677 100644 --- a/docs/changelog +++ b/docs/changelog @@ -6,7 +6,8 @@ Changelog 2.1.0pre2: - * PyPi: Add conf/ directory to distribution + * Dist: PyPi: Add conf/ directory to distribution + * Dist: Initial support for archlinux packaging 2.1.0pre1: 2012-10-26 * Core: Removed obsolete variable __self @@ -17,7 +18,7 @@ Changelog __package_pacman, __package_pkg_freebsd, __package_pkg_openbsd, __package_rubygem, __package_yum, __process: Parameter state accepts only "present" and "absent" - * Initial support for pypi packaging + * Dist: Initial support for pypi packaging 2.0.15: * Core: Make variable __object_name available in type explorers (Steven Armtrong) From 3e573fa21e36f6e25884b3c94d13342340f0f08c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 18:20:09 +0200 Subject: [PATCH 239/412] begin to merge releasehelper into build Signed-off-by: Nico Schottelius --- build | 83 +++++++++++++++++++++++++++++++++++++++++- docs/dev/releasehelper | 64 -------------------------------- 2 files changed, 81 insertions(+), 66 deletions(-) delete mode 100755 docs/dev/releasehelper diff --git a/build b/build index bb31ccc0..7fb3c2ec 100755 --- a/build +++ b/build @@ -88,13 +88,26 @@ case "$1" in ${MANDIR}/cdist-reference.text.sh ;; - release) + dist) + $0 dist-pypi + + # Archlinux depends on successful pypi ;-) + $0 dist-archlinux + + $0 dist-post + ;; + + dist-prepare) ./docs/dev/releasehelper ;; + dist-post) + + ;; + dist-archlinux) ./PKGBUILD.in - makepkg + makepkg -c ;; dist-pypi) @@ -202,3 +215,69 @@ case "$1" in ;; esac + + +#!/bin/sh +# Nico Schottelius + +# Ensure documentation builds cleanly +echo "Verifying documentation building works ..." +## ./build clean && ./build man || exit 1 + +# get version from changelog and ensure it's not already present +changelog_version=$(grep '^[[:digit:]]' docs/changelog | head -n1 | sed 's/:.*//') + +if git show --quiet $changelog_version >/dev/null 2>&1; then + echo "Version $changelog_version already exists, aborting." + exit 1 +fi + +echo "Target version from changelog: $changelog_version" + +# verify date in changelog +date_today="$(date +%Y-%m-%d)" +date_changelog=$(grep '^[[:digit:]]' docs/changelog | head -n1 | sed 's/.*: //') + +if [ "$date_today" != "$date_changelog" ]; then + echo "Date in changelog is not today" + echo "Changelog: $date_changelog" + exit 1 +fi + +echo "Press enter to continue" +read wait +version=$changelog_version + +# get target branch +target_branch=${version%\.*} +current_branch=$(git rev-parse --abbrev-ref HEAD) + +echo "Selected branch $target_branch for merging $current_branch" + +# add tag +printf "Enter tag description for %s> " "$version" +read tagmessage +git tag "$version" -m "$tagmessage" + +# Import into current version branch +printf "Press enter to git merge into branch \"$target_branch\" > " +read prompt +git checkout "$target_branch" +git merge "$current_branch" +git checkout "$current_branch" + +# Publish manpages and sourcecode +printf "Press enter to publish doc/ code/ pypi for $version > " +read prompt +./build web +./build pub + +cat << notes +To be done manually... + + - freecode release + - blog entry + - linkedin entry + - mailinglist update + +notes diff --git a/docs/dev/releasehelper b/docs/dev/releasehelper deleted file mode 100755 index 4a570f89..00000000 --- a/docs/dev/releasehelper +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh -# Nico Schottelius - -# Ensure documentation builds cleanly -echo "Verifying documentation building works ..." -## ./build clean && ./build man || exit 1 - -# get version from changelog and ensure it's not already present -changelog_version=$(grep '^[[:digit:]]' docs/changelog | head -n1 | sed 's/:.*//') - -if git show --quiet $changelog_version >/dev/null 2>&1; then - echo "Version $changelog_version already exists, aborting." - exit 1 -fi - -echo "Target version from changelog: $changelog_version" - -# verify date in changelog -date_today="$(date +%Y-%m-%d)" -date_changelog=$(grep '^[[:digit:]]' docs/changelog | head -n1 | sed 's/.*: //') - -if [ "$date_today" != "$date_changelog" ]; then - echo "Date in changelog is not today" - echo "Changelog: $date_changelog" - exit 1 -fi - -echo "Press enter to continue" -read wait -version=$changelog_version - -# get target branch -target_branch=${version%\.*} -current_branch=$(git rev-parse --abbrev-ref HEAD) - -echo "Selected branch $target_branch for merging $current_branch" - -# add tag -printf "Enter tag description for %s> " "$version" -read tagmessage -git tag "$version" -m "$tagmessage" - -# Import into current version branch -printf "Press enter to git merge into branch \"$target_branch\" > " -read prompt -git checkout "$target_branch" -git merge "$current_branch" -git checkout "$current_branch" - -# Publish manpages and sourcecode -printf "Press enter to publish doc/ code/ pypi for $version > " -read prompt -./build web -./build pub - -cat << notes -To be done manually... - - - freecode release - - blog entry - - linkedin entry - - mailinglist update - -notes From e397f2a74cce0a1ae0a832415a06e238c7135d45 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 18:35:47 +0200 Subject: [PATCH 240/412] cleanup distribution process in build file Signed-off-by: Nico Schottelius --- build | 144 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 71 insertions(+), 73 deletions(-) diff --git a/build b/build index 7fb3c2ec..1aa76f3b 100755 --- a/build +++ b/build @@ -89,34 +89,98 @@ case "$1" in ;; dist) + set -e + # Do the checks + $0 dist-check + + # Git changes - everything depends on this + $0 dist-tag + $0 dist-branch-merge + $0 dist-pypi # Archlinux depends on successful pypi ;-) $0 dist-archlinux + # Update website (includes documentation) + $0 web + + $0 pub + $0 dist-post ;; - dist-prepare) - ./docs/dev/releasehelper + changelog-version) + # get version from changelog and ensure it's not already present + grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/:.*//' + ;; + + dist-check) + echo "Verifying documentation building works ..." + $0 clean && $0 man + + changelog_version=$($0 changelog-version) + + if git show --quiet $changelog_version >/dev/null 2>&1; then + echo "Version $changelog_version already exists, aborting." + exit 1 + fi + + echo "Target version from changelog: $changelog_version" + + # verify date in changelog + date_today="$(date +%Y-%m-%d)" + date_changelog=$(grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/.*: //') + + if [ "$date_today" != "$date_changelog" ]; then + echo "Date in changelog is not today" + echo "Changelog: $date_changelog" + exit 1 + fi + ;; dist-post) + cat << notes + To be done manually... + + - freecode release + - blog entry + - linkedin entry + - mailinglist update +notes + + ;; + + dist-tag) + version=$($0 changelog-version) + # add tag + printf "Enter tag description for %s> " "$version" + read tagmessage + git tag "$version" -m "$tagmessage" + ;; + + dist-branch-merge) + version=$($0 changelog-version) + target_branch=${version%\.*} + current_branch=$(git rev-parse --abbrev-ref HEAD) + + printf "Press enter to git merge $current_branch into \"$target_branch\" > " + read prompt + git checkout "$target_branch" + git merge "$current_branch" + git checkout "$current_branch" ;; dist-archlinux) ./PKGBUILD.in makepkg -c ;; - dist-pypi) $0 man $0 version - $0 sdist - ;; - sdist) - python3 setup.py sdist + python3 setup.py sdist update ;; speeches) @@ -215,69 +279,3 @@ case "$1" in ;; esac - - -#!/bin/sh -# Nico Schottelius - -# Ensure documentation builds cleanly -echo "Verifying documentation building works ..." -## ./build clean && ./build man || exit 1 - -# get version from changelog and ensure it's not already present -changelog_version=$(grep '^[[:digit:]]' docs/changelog | head -n1 | sed 's/:.*//') - -if git show --quiet $changelog_version >/dev/null 2>&1; then - echo "Version $changelog_version already exists, aborting." - exit 1 -fi - -echo "Target version from changelog: $changelog_version" - -# verify date in changelog -date_today="$(date +%Y-%m-%d)" -date_changelog=$(grep '^[[:digit:]]' docs/changelog | head -n1 | sed 's/.*: //') - -if [ "$date_today" != "$date_changelog" ]; then - echo "Date in changelog is not today" - echo "Changelog: $date_changelog" - exit 1 -fi - -echo "Press enter to continue" -read wait -version=$changelog_version - -# get target branch -target_branch=${version%\.*} -current_branch=$(git rev-parse --abbrev-ref HEAD) - -echo "Selected branch $target_branch for merging $current_branch" - -# add tag -printf "Enter tag description for %s> " "$version" -read tagmessage -git tag "$version" -m "$tagmessage" - -# Import into current version branch -printf "Press enter to git merge into branch \"$target_branch\" > " -read prompt -git checkout "$target_branch" -git merge "$current_branch" -git checkout "$current_branch" - -# Publish manpages and sourcecode -printf "Press enter to publish doc/ code/ pypi for $version > " -read prompt -./build web -./build pub - -cat << notes -To be done manually... - - - freecode release - - blog entry - - linkedin entry - - mailinglist update - -notes From 2307cdebfa1dd1759a1e37a52241919fa7b12f03 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 18:38:00 +0200 Subject: [PATCH 241/412] abort dist on any error Signed-off-by: Nico Schottelius --- build | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build b/build index 1aa76f3b..5ecf481a 100755 --- a/build +++ b/build @@ -116,18 +116,19 @@ case "$1" in ;; dist-check) + set -e echo "Verifying documentation building works ..." - $0 clean && $0 man + $0 clean + $0 man changelog_version=$($0 changelog-version) + echo "Target version from changelog: $changelog_version" if git show --quiet $changelog_version >/dev/null 2>&1; then echo "Version $changelog_version already exists, aborting." exit 1 fi - echo "Target version from changelog: $changelog_version" - # verify date in changelog date_today="$(date +%Y-%m-%d)" date_changelog=$(grep '^[[:digit:]]' "$basedir/docs/changelog" | head -n1 | sed 's/.*: //') From 0d46dc336766be528b8030da2fe21db466d8ca0d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 18:38:14 +0200 Subject: [PATCH 242/412] fix manpages of __pf_ruleset and __pf_apply Signed-off-by: Nico Schottelius --- conf/type/__pf_apply/man.text | 2 +- conf/type/__pf_ruleset/man.text | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/type/__pf_apply/man.text b/conf/type/__pf_apply/man.text index 55bf5745..2e0d7802 100644 --- a/conf/type/__pf_apply/man.text +++ b/conf/type/__pf_apply/man.text @@ -1,5 +1,5 @@ cdist-type__pf_apply(7) -================================== +======================= Jake Guffey diff --git a/conf/type/__pf_ruleset/man.text b/conf/type/__pf_ruleset/man.text index 68601fad..5c368e77 100644 --- a/conf/type/__pf_ruleset/man.text +++ b/conf/type/__pf_ruleset/man.text @@ -1,5 +1,5 @@ cdist-type__pf_ruleset(7) -================================== +========================= Jake Guffey From fd9aca7b3c1648edb5c489c1ca4669f00b72f86d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 18:39:22 +0200 Subject: [PATCH 243/412] release 2.1.0pre2 today Signed-off-by: Nico Schottelius --- docs/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 295aa677..dba70701 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,7 +5,7 @@ Changelog * Exception: No braces means author == Nico Schottelius -2.1.0pre2: +2.1.0pre2: 2012-10-26 * Dist: PyPi: Add conf/ directory to distribution * Dist: Initial support for archlinux packaging From 24481781f94b13e6f8b92bbdba2a33969d0d29a9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 18:42:06 +0200 Subject: [PATCH 244/412] +comment Signed-off-by: Nico Schottelius --- build | 1 + 1 file changed, 1 insertion(+) diff --git a/build b/build index 5ecf481a..16029581 100755 --- a/build +++ b/build @@ -97,6 +97,7 @@ case "$1" in $0 dist-tag $0 dist-branch-merge + # Pypi first - is the base for others $0 dist-pypi # Archlinux depends on successful pypi ;-) From 8324c9dee4ba03aaf5aac066aa277aca2f9bd2dc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 26 Oct 2012 18:47:49 +0200 Subject: [PATCH 245/412] build source for archlinux as well as upload to pypi Signed-off-by: Nico Schottelius --- build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build b/build index 16029581..d295da14 100755 --- a/build +++ b/build @@ -178,11 +178,12 @@ notes dist-archlinux) ./PKGBUILD.in makepkg -c + makepkg -c --source ;; dist-pypi) $0 man $0 version - python3 setup.py sdist update + python3 setup.py sdist upload ;; speeches) From e2ba9ab1d2096072ef764e98d1ae400248d11f0e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 29 Oct 2012 22:18:32 +0100 Subject: [PATCH 246/412] add package data info Signed-off-by: Nico Schottelius --- MANIFEST.in | 3 +-- setup.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 319dad56..a675f446 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,3 @@ -include docs/changelog docs/changelog-2.1 +include docs/changelog recursive-include docs/gfx *.png *.text recursive-include docs *.text *.html *.1 *.7 -recursive-include conf * diff --git a/setup.py b/setup.py index 900dac0f..19fb28e6 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,31 @@ from distutils.core import setup +#data_files=[('/usr/share/cdist', 'conf')], + # data_files=[('/tmp/cdist', ['conf'])], import cdist +import os + +def data_finder(data_dir): + entries = [] + for name in os.listdir(data_dir): + entry = os.path.join(data_dir, name) + if os.path.isdir(entry): + entries.extend(data_finder(entry)) + else: + entries.append(entry) + + return entries + +package_data = data_finder("conf") + + +print(package_data) + setup( name = "cdist", packages = ["cdist", "cdist.core", "cdist.exec", "cdist.util" ], + package_data={'cdist': package_data}, scripts = ["cdist.py"], version = cdist.version.VERSION, description = "A Usable Configuration Management System", From 63573a9797651ba90233e5f59a1a4360a3a15189 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 29 Oct 2012 22:50:27 +0100 Subject: [PATCH 247/412] make package_data work Signed-off-by: Nico Schottelius --- {conf => cdist/conf}/.gitignore | 0 {conf => cdist/conf}/README | 0 {conf => cdist/conf}/explorer/hostname | 0 {conf => cdist/conf}/explorer/interfaces | 0 {conf => cdist/conf}/explorer/lsb_codename | 0 {conf => cdist/conf}/explorer/lsb_description | 0 {conf => cdist/conf}/explorer/lsb_id | 0 {conf => cdist/conf}/explorer/lsb_release | 0 {conf => cdist/conf}/explorer/machine | 0 {conf => cdist/conf}/explorer/os | 0 {conf => cdist/conf}/explorer/os_version | 0 {conf => cdist/conf}/explorer/runlevel | 0 {conf => cdist/conf}/manifest/init.sample | 0 {conf => cdist/conf}/type/__apt_ppa/explorer/state | 0 .../conf}/type/__apt_ppa/files/remove-apt-repository | 0 {conf => cdist/conf}/type/__apt_ppa/gencode-remote | 0 {conf => cdist/conf}/type/__apt_ppa/man.text | 0 {conf => cdist/conf}/type/__apt_ppa/manifest | 0 {conf => cdist/conf}/type/__apt_ppa/parameter/required | 0 {conf => cdist/conf}/type/__apt_update_index/gencode-remote | 0 {conf => cdist/conf}/type/__apt_update_index/man.text | 0 {conf => cdist/conf}/type/__apt_update_index/singleton | 0 {conf => cdist/conf}/type/__autofs_map/man.text | 0 {conf => cdist/conf}/type/__autofs_map/manifest | 0 {conf => cdist/conf}/type/__autofs_map/parameter/optional | 0 {conf => cdist/conf}/type/__autofs_map/parameter/required | 0 .../conf}/type/__autofs_master/files/auto.master.header | 0 {conf => cdist/conf}/type/__autofs_master/gencode-local | 0 {conf => cdist/conf}/type/__autofs_master/man.text | 0 {conf => cdist/conf}/type/__autofs_master/manifest | 0 .../conf}/type/__autofs_master/parameter/optional | 0 {conf => cdist/conf}/type/__autofs_master/singleton | 0 {conf => cdist/conf}/type/__cdistmarker/gencode-remote | 0 {conf => cdist/conf}/type/__cdistmarker/man.text | 0 {conf => cdist/conf}/type/__cdistmarker/parameter/optional | 0 {conf => cdist/conf}/type/__cdistmarker/singleton | 0 {conf => cdist/conf}/type/__cron/explorer/entry | 0 {conf => cdist/conf}/type/__cron/gencode-remote | 0 {conf => cdist/conf}/type/__cron/man.text | 0 {conf => cdist/conf}/type/__cron/manifest | 0 {conf => cdist/conf}/type/__cron/parameter/optional | 0 {conf => cdist/conf}/type/__cron/parameter/required | 0 .../conf}/type/__debconf_set_selections/gencode-remote | 0 {conf => cdist/conf}/type/__debconf_set_selections/man.text | 0 .../conf}/type/__debconf_set_selections/parameter/required | 0 {conf => cdist/conf}/type/__directory/explorer/state | 0 {conf => cdist/conf}/type/__directory/gencode-remote | 0 {conf => cdist/conf}/type/__directory/man.text | 0 {conf => cdist/conf}/type/__directory/parameter/boolean | 0 {conf => cdist/conf}/type/__directory/parameter/optional | 0 {conf => cdist/conf}/type/__file/explorer/cksum | 0 {conf => cdist/conf}/type/__file/explorer/exists | 0 {conf => cdist/conf}/type/__file/gencode-local | 0 {conf => cdist/conf}/type/__file/gencode-remote | 0 {conf => cdist/conf}/type/__file/man.text | 0 {conf => cdist/conf}/type/__file/manifest | 0 {conf => cdist/conf}/type/__file/parameter/optional | 0 {conf => cdist/conf}/type/__group/TODO | 0 {conf => cdist/conf}/type/__group/explorer/group | 0 {conf => cdist/conf}/type/__group/explorer/gshadow | 0 {conf => cdist/conf}/type/__group/gencode-remote | 0 {conf => cdist/conf}/type/__group/man.text | 0 {conf => cdist/conf}/type/__group/parameter/optional | 0 {conf => cdist/conf}/type/__issue/files/archlinux | 0 {conf => cdist/conf}/type/__issue/files/default | 0 {conf => cdist/conf}/type/__issue/files/redhat | 0 {conf => cdist/conf}/type/__issue/man.text | 0 {conf => cdist/conf}/type/__issue/manifest | 0 {conf => cdist/conf}/type/__issue/parameter/optional | 0 {conf => cdist/conf}/type/__issue/singleton | 0 {conf => cdist/conf}/type/__jail/.gitignore | 0 {conf => cdist/conf}/type/__jail/explorer/basepresent | 0 {conf => cdist/conf}/type/__jail/explorer/present | 0 {conf => cdist/conf}/type/__jail/explorer/status | 0 {conf => cdist/conf}/type/__jail/gencode-local | 0 {conf => cdist/conf}/type/__jail/gencode-remote | 0 {conf => cdist/conf}/type/__jail/man.text | 0 {conf => cdist/conf}/type/__jail/manifest | 0 {conf => cdist/conf}/type/__jail/parameter/optional | 0 {conf => cdist/conf}/type/__jail/parameter/required | 0 {conf => cdist/conf}/type/__key_value/explorer/state | 0 {conf => cdist/conf}/type/__key_value/gencode-remote | 0 {conf => cdist/conf}/type/__key_value/man.text | 0 {conf => cdist/conf}/type/__key_value/manifest | 0 {conf => cdist/conf}/type/__key_value/parameter/optional | 0 {conf => cdist/conf}/type/__key_value/parameter/required | 0 {conf => cdist/conf}/type/__line/explorer/state | 0 {conf => cdist/conf}/type/__line/gencode-remote | 0 {conf => cdist/conf}/type/__line/man.text | 0 {conf => cdist/conf}/type/__line/parameter/optional | 0 {conf => cdist/conf}/type/__link/explorer/state | 0 {conf => cdist/conf}/type/__link/gencode-remote | 0 {conf => cdist/conf}/type/__link/man.text | 0 {conf => cdist/conf}/type/__link/manifest | 0 {conf => cdist/conf}/type/__link/parameter/optional | 0 {conf => cdist/conf}/type/__link/parameter/required | 0 {conf => cdist/conf}/type/__mkfs/gencode-remote | 0 {conf => cdist/conf}/type/__mkfs/install | 0 {conf => cdist/conf}/type/__mkfs/man.text | 0 {conf => cdist/conf}/type/__mkfs/manifest | 0 {conf => cdist/conf}/type/__mkfs/parameter/optional | 0 {conf => cdist/conf}/type/__mkfs/parameter/required | 0 {conf => cdist/conf}/type/__motd/files/motd | 0 {conf => cdist/conf}/type/__motd/man.text | 0 {conf => cdist/conf}/type/__motd/manifest | 0 {conf => cdist/conf}/type/__motd/parameter/optional | 0 {conf => cdist/conf}/type/__motd/singleton | 0 {conf => cdist/conf}/type/__mysql_database/gencode-remote | 0 {conf => cdist/conf}/type/__mysql_database/man.text | 0 .../conf}/type/__mysql_database/parameter/optional | 0 {conf => cdist/conf}/type/__package/man.text | 0 {conf => cdist/conf}/type/__package/manifest | 0 {conf => cdist/conf}/type/__package/parameter/optional | 0 {conf => cdist/conf}/type/__package_apt/explorer/state | 0 {conf => cdist/conf}/type/__package_apt/gencode-remote | 0 {conf => cdist/conf}/type/__package_apt/man.text | 0 {conf => cdist/conf}/type/__package_apt/notes.txt | 0 {conf => cdist/conf}/type/__package_apt/parameter/optional | 0 .../conf}/type/__package_luarocks/explorer/pkg_status | 0 {conf => cdist/conf}/type/__package_luarocks/gencode-remote | 0 {conf => cdist/conf}/type/__package_luarocks/man.text | 0 {conf => cdist/conf}/type/__package_luarocks/manifest | 0 .../conf}/type/__package_luarocks/parameter/optional | 0 .../conf}/type/__package_opkg/explorer/pkg_status | 0 {conf => cdist/conf}/type/__package_opkg/gencode-remote | 0 {conf => cdist/conf}/type/__package_opkg/man.text | 0 {conf => cdist/conf}/type/__package_opkg/parameter/optional | 0 .../conf}/type/__package_pacman/explorer/pkg_version | 0 {conf => cdist/conf}/type/__package_pacman/gencode-remote | 0 {conf => cdist/conf}/type/__package_pacman/man.text | 0 .../conf}/type/__package_pacman/parameter/optional | 0 {conf => cdist/conf}/type/__package_pip/explorer/state | 0 {conf => cdist/conf}/type/__package_pip/gencode-remote | 0 {conf => cdist/conf}/type/__package_pip/man.text | 0 {conf => cdist/conf}/type/__package_pip/parameter/optional | 0 .../conf}/type/__package_pkg_freebsd/explorer/pkg_version | 0 .../conf}/type/__package_pkg_freebsd/gencode-remote | 0 {conf => cdist/conf}/type/__package_pkg_freebsd/man.text | 0 .../conf}/type/__package_pkg_freebsd/parameter/optional | 0 .../conf}/type/__package_pkg_openbsd/explorer/pkg_version | 0 .../conf}/type/__package_pkg_openbsd/gencode-remote | 0 {conf => cdist/conf}/type/__package_pkg_openbsd/man.text | 0 .../conf}/type/__package_pkg_openbsd/parameter/optional | 0 .../conf}/type/__package_rubygem/explorer/pkg_status | 0 {conf => cdist/conf}/type/__package_rubygem/gencode-remote | 0 {conf => cdist/conf}/type/__package_rubygem/man.text | 0 .../conf}/type/__package_rubygem/parameter/optional | 0 .../conf}/type/__package_yum/explorer/pkg_version | 0 {conf => cdist/conf}/type/__package_yum/gencode-remote | 0 {conf => cdist/conf}/type/__package_yum/man.text | 0 {conf => cdist/conf}/type/__package_yum/parameter/optional | 0 .../conf}/type/__package_zypper/explorer/pkg_version | 0 {conf => cdist/conf}/type/__package_zypper/gencode-remote | 0 {conf => cdist/conf}/type/__package_zypper/man.text | 0 .../conf}/type/__package_zypper/parameter/optional | 0 {conf => cdist/conf}/type/__partition_msdos/install | 0 {conf => cdist/conf}/type/__partition_msdos/man.text | 0 {conf => cdist/conf}/type/__partition_msdos/manifest | 0 .../conf}/type/__partition_msdos/parameter/optional | 0 .../conf}/type/__partition_msdos/parameter/required | 0 .../conf}/type/__partition_msdos_apply/explorer/partitions | 0 .../conf}/type/__partition_msdos_apply/files/lib.sh | 0 .../conf}/type/__partition_msdos_apply/gencode-remote | 0 {conf => cdist/conf}/type/__partition_msdos_apply/install | 0 {conf => cdist/conf}/type/__partition_msdos_apply/man.text | 0 {conf => cdist/conf}/type/__partition_msdos_apply/singleton | 0 {conf => cdist/conf}/type/__pf_apply/explorer/rcvar | 0 {conf => cdist/conf}/type/__pf_apply/gencode-remote | 0 {conf => cdist/conf}/type/__pf_apply/man.text | 0 {conf => cdist/conf}/type/__pf_apply/singleton | 0 {conf => cdist/conf}/type/__pf_ruleset/explorer/cksum | 0 {conf => cdist/conf}/type/__pf_ruleset/explorer/rcvar | 0 {conf => cdist/conf}/type/__pf_ruleset/gencode-local | 0 {conf => cdist/conf}/type/__pf_ruleset/gencode-remote | 0 {conf => cdist/conf}/type/__pf_ruleset/man.text | 0 {conf => cdist/conf}/type/__pf_ruleset/parameter/optional | 0 {conf => cdist/conf}/type/__pf_ruleset/parameter/required | 0 {conf => cdist/conf}/type/__pf_ruleset/singleton | 0 .../conf}/type/__postgres_database/explorer/state | 0 .../conf}/type/__postgres_database/gencode-remote | 0 {conf => cdist/conf}/type/__postgres_database/man.text | 0 .../conf}/type/__postgres_database/parameter/optional | 0 .../conf}/type/__postgres_database/parameter/required | 0 {conf => cdist/conf}/type/__postgres_role/explorer/state | 0 {conf => cdist/conf}/type/__postgres_role/gencode-remote | 0 {conf => cdist/conf}/type/__postgres_role/man.text | 0 .../conf}/type/__postgres_role/parameter/optional | 0 .../conf}/type/__postgres_role/parameter/required | 0 {conf => cdist/conf}/type/__process/explorer/runs | 0 {conf => cdist/conf}/type/__process/gencode-remote | 0 {conf => cdist/conf}/type/__process/man.text | 0 {conf => cdist/conf}/type/__process/parameter/optional | 0 {conf => cdist/conf}/type/__process/parameter/required | 0 {conf => cdist/conf}/type/__qemu_img/explorer/exists | 0 {conf => cdist/conf}/type/__qemu_img/gencode-remote | 0 {conf => cdist/conf}/type/__qemu_img/man.text | 0 {conf => cdist/conf}/type/__qemu_img/manifest | 0 {conf => cdist/conf}/type/__qemu_img/parameter/optional | 0 {conf => cdist/conf}/type/__qemu_img/parameter/required | 0 {conf => cdist/conf}/type/__rvm/explorer/state | 0 {conf => cdist/conf}/type/__rvm/gencode-remote | 0 {conf => cdist/conf}/type/__rvm/man.text | 0 {conf => cdist/conf}/type/__rvm/manifest | 0 {conf => cdist/conf}/type/__rvm/parameter/required | 0 {conf => cdist/conf}/type/__rvm_gem/explorer/state | 0 {conf => cdist/conf}/type/__rvm_gem/gencode-remote | 0 {conf => cdist/conf}/type/__rvm_gem/man.text | 0 {conf => cdist/conf}/type/__rvm_gem/manifest | 0 {conf => cdist/conf}/type/__rvm_gem/parameter/optional | 0 {conf => cdist/conf}/type/__rvm_gem/parameter/required | 0 {conf => cdist/conf}/type/__rvm_gemset/explorer/state | 0 {conf => cdist/conf}/type/__rvm_gemset/gencode-remote | 0 {conf => cdist/conf}/type/__rvm_gemset/man.text | 0 {conf => cdist/conf}/type/__rvm_gemset/manifest | 0 {conf => cdist/conf}/type/__rvm_gemset/parameter/optional | 0 {conf => cdist/conf}/type/__rvm_gemset/parameter/required | 0 {conf => cdist/conf}/type/__rvm_ruby/explorer/state | 0 {conf => cdist/conf}/type/__rvm_ruby/gencode-remote | 0 {conf => cdist/conf}/type/__rvm_ruby/man.text | 0 {conf => cdist/conf}/type/__rvm_ruby/manifest | 0 {conf => cdist/conf}/type/__rvm_ruby/parameter/optional | 0 {conf => cdist/conf}/type/__rvm_ruby/parameter/required | 0 .../conf}/type/__ssh_authorized_key/explorer/dstuser_group | 0 {conf => cdist/conf}/type/__ssh_authorized_key/man.text | 0 {conf => cdist/conf}/type/__ssh_authorized_key/manifest | 0 .../conf}/type/__ssh_authorized_key/parameter/optional | 0 {conf => cdist/conf}/type/__start_on_boot/explorer/state | 0 {conf => cdist/conf}/type/__start_on_boot/gencode-remote | 0 {conf => cdist/conf}/type/__start_on_boot/man.text | 0 .../conf}/type/__start_on_boot/parameter/optional | 0 {conf => cdist/conf}/type/__timezone/man.text | 0 {conf => cdist/conf}/type/__timezone/manifest | 0 {conf => cdist/conf}/type/__user/TODO | 0 {conf => cdist/conf}/type/__user/explorer/group | 0 {conf => cdist/conf}/type/__user/explorer/passwd | 0 {conf => cdist/conf}/type/__user/explorer/shadow | 0 {conf => cdist/conf}/type/__user/gencode-remote | 0 {conf => cdist/conf}/type/__user/man.text | 0 {conf => cdist/conf}/type/__user/parameter/optional | 0 cdist/test/emulator/fixtures/conf/type/__file | 2 +- setup.py | 6 +++++- 241 files changed, 6 insertions(+), 2 deletions(-) rename {conf => cdist/conf}/.gitignore (100%) rename {conf => cdist/conf}/README (100%) rename {conf => cdist/conf}/explorer/hostname (100%) rename {conf => cdist/conf}/explorer/interfaces (100%) rename {conf => cdist/conf}/explorer/lsb_codename (100%) rename {conf => cdist/conf}/explorer/lsb_description (100%) rename {conf => cdist/conf}/explorer/lsb_id (100%) rename {conf => cdist/conf}/explorer/lsb_release (100%) rename {conf => cdist/conf}/explorer/machine (100%) rename {conf => cdist/conf}/explorer/os (100%) rename {conf => cdist/conf}/explorer/os_version (100%) rename {conf => cdist/conf}/explorer/runlevel (100%) rename {conf => cdist/conf}/manifest/init.sample (100%) rename {conf => cdist/conf}/type/__apt_ppa/explorer/state (100%) rename {conf => cdist/conf}/type/__apt_ppa/files/remove-apt-repository (100%) rename {conf => cdist/conf}/type/__apt_ppa/gencode-remote (100%) rename {conf => cdist/conf}/type/__apt_ppa/man.text (100%) rename {conf => cdist/conf}/type/__apt_ppa/manifest (100%) rename {conf => cdist/conf}/type/__apt_ppa/parameter/required (100%) rename {conf => cdist/conf}/type/__apt_update_index/gencode-remote (100%) rename {conf => cdist/conf}/type/__apt_update_index/man.text (100%) rename {conf => cdist/conf}/type/__apt_update_index/singleton (100%) rename {conf => cdist/conf}/type/__autofs_map/man.text (100%) rename {conf => cdist/conf}/type/__autofs_map/manifest (100%) rename {conf => cdist/conf}/type/__autofs_map/parameter/optional (100%) rename {conf => cdist/conf}/type/__autofs_map/parameter/required (100%) rename {conf => cdist/conf}/type/__autofs_master/files/auto.master.header (100%) rename {conf => cdist/conf}/type/__autofs_master/gencode-local (100%) rename {conf => cdist/conf}/type/__autofs_master/man.text (100%) rename {conf => cdist/conf}/type/__autofs_master/manifest (100%) rename {conf => cdist/conf}/type/__autofs_master/parameter/optional (100%) rename {conf => cdist/conf}/type/__autofs_master/singleton (100%) rename {conf => cdist/conf}/type/__cdistmarker/gencode-remote (100%) rename {conf => cdist/conf}/type/__cdistmarker/man.text (100%) rename {conf => cdist/conf}/type/__cdistmarker/parameter/optional (100%) rename {conf => cdist/conf}/type/__cdistmarker/singleton (100%) rename {conf => cdist/conf}/type/__cron/explorer/entry (100%) rename {conf => cdist/conf}/type/__cron/gencode-remote (100%) rename {conf => cdist/conf}/type/__cron/man.text (100%) rename {conf => cdist/conf}/type/__cron/manifest (100%) rename {conf => cdist/conf}/type/__cron/parameter/optional (100%) rename {conf => cdist/conf}/type/__cron/parameter/required (100%) rename {conf => cdist/conf}/type/__debconf_set_selections/gencode-remote (100%) rename {conf => cdist/conf}/type/__debconf_set_selections/man.text (100%) rename {conf => cdist/conf}/type/__debconf_set_selections/parameter/required (100%) rename {conf => cdist/conf}/type/__directory/explorer/state (100%) rename {conf => cdist/conf}/type/__directory/gencode-remote (100%) rename {conf => cdist/conf}/type/__directory/man.text (100%) rename {conf => cdist/conf}/type/__directory/parameter/boolean (100%) rename {conf => cdist/conf}/type/__directory/parameter/optional (100%) rename {conf => cdist/conf}/type/__file/explorer/cksum (100%) rename {conf => cdist/conf}/type/__file/explorer/exists (100%) rename {conf => cdist/conf}/type/__file/gencode-local (100%) rename {conf => cdist/conf}/type/__file/gencode-remote (100%) rename {conf => cdist/conf}/type/__file/man.text (100%) rename {conf => cdist/conf}/type/__file/manifest (100%) rename {conf => cdist/conf}/type/__file/parameter/optional (100%) rename {conf => cdist/conf}/type/__group/TODO (100%) rename {conf => cdist/conf}/type/__group/explorer/group (100%) rename {conf => cdist/conf}/type/__group/explorer/gshadow (100%) rename {conf => cdist/conf}/type/__group/gencode-remote (100%) rename {conf => cdist/conf}/type/__group/man.text (100%) rename {conf => cdist/conf}/type/__group/parameter/optional (100%) rename {conf => cdist/conf}/type/__issue/files/archlinux (100%) rename {conf => cdist/conf}/type/__issue/files/default (100%) rename {conf => cdist/conf}/type/__issue/files/redhat (100%) rename {conf => cdist/conf}/type/__issue/man.text (100%) rename {conf => cdist/conf}/type/__issue/manifest (100%) rename {conf => cdist/conf}/type/__issue/parameter/optional (100%) rename {conf => cdist/conf}/type/__issue/singleton (100%) rename {conf => cdist/conf}/type/__jail/.gitignore (100%) rename {conf => cdist/conf}/type/__jail/explorer/basepresent (100%) rename {conf => cdist/conf}/type/__jail/explorer/present (100%) rename {conf => cdist/conf}/type/__jail/explorer/status (100%) rename {conf => cdist/conf}/type/__jail/gencode-local (100%) rename {conf => cdist/conf}/type/__jail/gencode-remote (100%) rename {conf => cdist/conf}/type/__jail/man.text (100%) rename {conf => cdist/conf}/type/__jail/manifest (100%) rename {conf => cdist/conf}/type/__jail/parameter/optional (100%) rename {conf => cdist/conf}/type/__jail/parameter/required (100%) rename {conf => cdist/conf}/type/__key_value/explorer/state (100%) rename {conf => cdist/conf}/type/__key_value/gencode-remote (100%) rename {conf => cdist/conf}/type/__key_value/man.text (100%) rename {conf => cdist/conf}/type/__key_value/manifest (100%) rename {conf => cdist/conf}/type/__key_value/parameter/optional (100%) rename {conf => cdist/conf}/type/__key_value/parameter/required (100%) rename {conf => cdist/conf}/type/__line/explorer/state (100%) rename {conf => cdist/conf}/type/__line/gencode-remote (100%) rename {conf => cdist/conf}/type/__line/man.text (100%) rename {conf => cdist/conf}/type/__line/parameter/optional (100%) rename {conf => cdist/conf}/type/__link/explorer/state (100%) rename {conf => cdist/conf}/type/__link/gencode-remote (100%) rename {conf => cdist/conf}/type/__link/man.text (100%) rename {conf => cdist/conf}/type/__link/manifest (100%) rename {conf => cdist/conf}/type/__link/parameter/optional (100%) rename {conf => cdist/conf}/type/__link/parameter/required (100%) rename {conf => cdist/conf}/type/__mkfs/gencode-remote (100%) rename {conf => cdist/conf}/type/__mkfs/install (100%) rename {conf => cdist/conf}/type/__mkfs/man.text (100%) rename {conf => cdist/conf}/type/__mkfs/manifest (100%) rename {conf => cdist/conf}/type/__mkfs/parameter/optional (100%) rename {conf => cdist/conf}/type/__mkfs/parameter/required (100%) rename {conf => cdist/conf}/type/__motd/files/motd (100%) rename {conf => cdist/conf}/type/__motd/man.text (100%) rename {conf => cdist/conf}/type/__motd/manifest (100%) rename {conf => cdist/conf}/type/__motd/parameter/optional (100%) rename {conf => cdist/conf}/type/__motd/singleton (100%) rename {conf => cdist/conf}/type/__mysql_database/gencode-remote (100%) rename {conf => cdist/conf}/type/__mysql_database/man.text (100%) rename {conf => cdist/conf}/type/__mysql_database/parameter/optional (100%) rename {conf => cdist/conf}/type/__package/man.text (100%) rename {conf => cdist/conf}/type/__package/manifest (100%) rename {conf => cdist/conf}/type/__package/parameter/optional (100%) rename {conf => cdist/conf}/type/__package_apt/explorer/state (100%) rename {conf => cdist/conf}/type/__package_apt/gencode-remote (100%) rename {conf => cdist/conf}/type/__package_apt/man.text (100%) rename {conf => cdist/conf}/type/__package_apt/notes.txt (100%) rename {conf => cdist/conf}/type/__package_apt/parameter/optional (100%) rename {conf => cdist/conf}/type/__package_luarocks/explorer/pkg_status (100%) rename {conf => cdist/conf}/type/__package_luarocks/gencode-remote (100%) rename {conf => cdist/conf}/type/__package_luarocks/man.text (100%) rename {conf => cdist/conf}/type/__package_luarocks/manifest (100%) rename {conf => cdist/conf}/type/__package_luarocks/parameter/optional (100%) rename {conf => cdist/conf}/type/__package_opkg/explorer/pkg_status (100%) rename {conf => cdist/conf}/type/__package_opkg/gencode-remote (100%) rename {conf => cdist/conf}/type/__package_opkg/man.text (100%) rename {conf => cdist/conf}/type/__package_opkg/parameter/optional (100%) rename {conf => cdist/conf}/type/__package_pacman/explorer/pkg_version (100%) rename {conf => cdist/conf}/type/__package_pacman/gencode-remote (100%) rename {conf => cdist/conf}/type/__package_pacman/man.text (100%) rename {conf => cdist/conf}/type/__package_pacman/parameter/optional (100%) rename {conf => cdist/conf}/type/__package_pip/explorer/state (100%) rename {conf => cdist/conf}/type/__package_pip/gencode-remote (100%) rename {conf => cdist/conf}/type/__package_pip/man.text (100%) rename {conf => cdist/conf}/type/__package_pip/parameter/optional (100%) rename {conf => cdist/conf}/type/__package_pkg_freebsd/explorer/pkg_version (100%) rename {conf => cdist/conf}/type/__package_pkg_freebsd/gencode-remote (100%) rename {conf => cdist/conf}/type/__package_pkg_freebsd/man.text (100%) rename {conf => cdist/conf}/type/__package_pkg_freebsd/parameter/optional (100%) rename {conf => cdist/conf}/type/__package_pkg_openbsd/explorer/pkg_version (100%) rename {conf => cdist/conf}/type/__package_pkg_openbsd/gencode-remote (100%) rename {conf => cdist/conf}/type/__package_pkg_openbsd/man.text (100%) rename {conf => cdist/conf}/type/__package_pkg_openbsd/parameter/optional (100%) rename {conf => cdist/conf}/type/__package_rubygem/explorer/pkg_status (100%) rename {conf => cdist/conf}/type/__package_rubygem/gencode-remote (100%) rename {conf => cdist/conf}/type/__package_rubygem/man.text (100%) rename {conf => cdist/conf}/type/__package_rubygem/parameter/optional (100%) rename {conf => cdist/conf}/type/__package_yum/explorer/pkg_version (100%) rename {conf => cdist/conf}/type/__package_yum/gencode-remote (100%) rename {conf => cdist/conf}/type/__package_yum/man.text (100%) rename {conf => cdist/conf}/type/__package_yum/parameter/optional (100%) rename {conf => cdist/conf}/type/__package_zypper/explorer/pkg_version (100%) rename {conf => cdist/conf}/type/__package_zypper/gencode-remote (100%) rename {conf => cdist/conf}/type/__package_zypper/man.text (100%) rename {conf => cdist/conf}/type/__package_zypper/parameter/optional (100%) rename {conf => cdist/conf}/type/__partition_msdos/install (100%) rename {conf => cdist/conf}/type/__partition_msdos/man.text (100%) rename {conf => cdist/conf}/type/__partition_msdos/manifest (100%) rename {conf => cdist/conf}/type/__partition_msdos/parameter/optional (100%) rename {conf => cdist/conf}/type/__partition_msdos/parameter/required (100%) rename {conf => cdist/conf}/type/__partition_msdos_apply/explorer/partitions (100%) rename {conf => cdist/conf}/type/__partition_msdos_apply/files/lib.sh (100%) rename {conf => cdist/conf}/type/__partition_msdos_apply/gencode-remote (100%) rename {conf => cdist/conf}/type/__partition_msdos_apply/install (100%) rename {conf => cdist/conf}/type/__partition_msdos_apply/man.text (100%) rename {conf => cdist/conf}/type/__partition_msdos_apply/singleton (100%) rename {conf => cdist/conf}/type/__pf_apply/explorer/rcvar (100%) rename {conf => cdist/conf}/type/__pf_apply/gencode-remote (100%) rename {conf => cdist/conf}/type/__pf_apply/man.text (100%) rename {conf => cdist/conf}/type/__pf_apply/singleton (100%) rename {conf => cdist/conf}/type/__pf_ruleset/explorer/cksum (100%) rename {conf => cdist/conf}/type/__pf_ruleset/explorer/rcvar (100%) rename {conf => cdist/conf}/type/__pf_ruleset/gencode-local (100%) rename {conf => cdist/conf}/type/__pf_ruleset/gencode-remote (100%) rename {conf => cdist/conf}/type/__pf_ruleset/man.text (100%) rename {conf => cdist/conf}/type/__pf_ruleset/parameter/optional (100%) rename {conf => cdist/conf}/type/__pf_ruleset/parameter/required (100%) rename {conf => cdist/conf}/type/__pf_ruleset/singleton (100%) rename {conf => cdist/conf}/type/__postgres_database/explorer/state (100%) rename {conf => cdist/conf}/type/__postgres_database/gencode-remote (100%) rename {conf => cdist/conf}/type/__postgres_database/man.text (100%) rename {conf => cdist/conf}/type/__postgres_database/parameter/optional (100%) rename {conf => cdist/conf}/type/__postgres_database/parameter/required (100%) rename {conf => cdist/conf}/type/__postgres_role/explorer/state (100%) rename {conf => cdist/conf}/type/__postgres_role/gencode-remote (100%) rename {conf => cdist/conf}/type/__postgres_role/man.text (100%) rename {conf => cdist/conf}/type/__postgres_role/parameter/optional (100%) rename {conf => cdist/conf}/type/__postgres_role/parameter/required (100%) rename {conf => cdist/conf}/type/__process/explorer/runs (100%) rename {conf => cdist/conf}/type/__process/gencode-remote (100%) rename {conf => cdist/conf}/type/__process/man.text (100%) rename {conf => cdist/conf}/type/__process/parameter/optional (100%) rename {conf => cdist/conf}/type/__process/parameter/required (100%) rename {conf => cdist/conf}/type/__qemu_img/explorer/exists (100%) rename {conf => cdist/conf}/type/__qemu_img/gencode-remote (100%) rename {conf => cdist/conf}/type/__qemu_img/man.text (100%) rename {conf => cdist/conf}/type/__qemu_img/manifest (100%) rename {conf => cdist/conf}/type/__qemu_img/parameter/optional (100%) rename {conf => cdist/conf}/type/__qemu_img/parameter/required (100%) rename {conf => cdist/conf}/type/__rvm/explorer/state (100%) rename {conf => cdist/conf}/type/__rvm/gencode-remote (100%) rename {conf => cdist/conf}/type/__rvm/man.text (100%) rename {conf => cdist/conf}/type/__rvm/manifest (100%) rename {conf => cdist/conf}/type/__rvm/parameter/required (100%) rename {conf => cdist/conf}/type/__rvm_gem/explorer/state (100%) rename {conf => cdist/conf}/type/__rvm_gem/gencode-remote (100%) rename {conf => cdist/conf}/type/__rvm_gem/man.text (100%) rename {conf => cdist/conf}/type/__rvm_gem/manifest (100%) rename {conf => cdist/conf}/type/__rvm_gem/parameter/optional (100%) rename {conf => cdist/conf}/type/__rvm_gem/parameter/required (100%) rename {conf => cdist/conf}/type/__rvm_gemset/explorer/state (100%) rename {conf => cdist/conf}/type/__rvm_gemset/gencode-remote (100%) rename {conf => cdist/conf}/type/__rvm_gemset/man.text (100%) rename {conf => cdist/conf}/type/__rvm_gemset/manifest (100%) rename {conf => cdist/conf}/type/__rvm_gemset/parameter/optional (100%) rename {conf => cdist/conf}/type/__rvm_gemset/parameter/required (100%) rename {conf => cdist/conf}/type/__rvm_ruby/explorer/state (100%) rename {conf => cdist/conf}/type/__rvm_ruby/gencode-remote (100%) rename {conf => cdist/conf}/type/__rvm_ruby/man.text (100%) rename {conf => cdist/conf}/type/__rvm_ruby/manifest (100%) rename {conf => cdist/conf}/type/__rvm_ruby/parameter/optional (100%) rename {conf => cdist/conf}/type/__rvm_ruby/parameter/required (100%) rename {conf => cdist/conf}/type/__ssh_authorized_key/explorer/dstuser_group (100%) rename {conf => cdist/conf}/type/__ssh_authorized_key/man.text (100%) rename {conf => cdist/conf}/type/__ssh_authorized_key/manifest (100%) rename {conf => cdist/conf}/type/__ssh_authorized_key/parameter/optional (100%) rename {conf => cdist/conf}/type/__start_on_boot/explorer/state (100%) rename {conf => cdist/conf}/type/__start_on_boot/gencode-remote (100%) rename {conf => cdist/conf}/type/__start_on_boot/man.text (100%) rename {conf => cdist/conf}/type/__start_on_boot/parameter/optional (100%) rename {conf => cdist/conf}/type/__timezone/man.text (100%) rename {conf => cdist/conf}/type/__timezone/manifest (100%) rename {conf => cdist/conf}/type/__user/TODO (100%) rename {conf => cdist/conf}/type/__user/explorer/group (100%) rename {conf => cdist/conf}/type/__user/explorer/passwd (100%) rename {conf => cdist/conf}/type/__user/explorer/shadow (100%) rename {conf => cdist/conf}/type/__user/gencode-remote (100%) rename {conf => cdist/conf}/type/__user/man.text (100%) rename {conf => cdist/conf}/type/__user/parameter/optional (100%) diff --git a/conf/.gitignore b/cdist/conf/.gitignore similarity index 100% rename from conf/.gitignore rename to cdist/conf/.gitignore diff --git a/conf/README b/cdist/conf/README similarity index 100% rename from conf/README rename to cdist/conf/README diff --git a/conf/explorer/hostname b/cdist/conf/explorer/hostname similarity index 100% rename from conf/explorer/hostname rename to cdist/conf/explorer/hostname diff --git a/conf/explorer/interfaces b/cdist/conf/explorer/interfaces similarity index 100% rename from conf/explorer/interfaces rename to cdist/conf/explorer/interfaces diff --git a/conf/explorer/lsb_codename b/cdist/conf/explorer/lsb_codename similarity index 100% rename from conf/explorer/lsb_codename rename to cdist/conf/explorer/lsb_codename diff --git a/conf/explorer/lsb_description b/cdist/conf/explorer/lsb_description similarity index 100% rename from conf/explorer/lsb_description rename to cdist/conf/explorer/lsb_description diff --git a/conf/explorer/lsb_id b/cdist/conf/explorer/lsb_id similarity index 100% rename from conf/explorer/lsb_id rename to cdist/conf/explorer/lsb_id diff --git a/conf/explorer/lsb_release b/cdist/conf/explorer/lsb_release similarity index 100% rename from conf/explorer/lsb_release rename to cdist/conf/explorer/lsb_release diff --git a/conf/explorer/machine b/cdist/conf/explorer/machine similarity index 100% rename from conf/explorer/machine rename to cdist/conf/explorer/machine diff --git a/conf/explorer/os b/cdist/conf/explorer/os similarity index 100% rename from conf/explorer/os rename to cdist/conf/explorer/os diff --git a/conf/explorer/os_version b/cdist/conf/explorer/os_version similarity index 100% rename from conf/explorer/os_version rename to cdist/conf/explorer/os_version diff --git a/conf/explorer/runlevel b/cdist/conf/explorer/runlevel similarity index 100% rename from conf/explorer/runlevel rename to cdist/conf/explorer/runlevel diff --git a/conf/manifest/init.sample b/cdist/conf/manifest/init.sample similarity index 100% rename from conf/manifest/init.sample rename to cdist/conf/manifest/init.sample diff --git a/conf/type/__apt_ppa/explorer/state b/cdist/conf/type/__apt_ppa/explorer/state similarity index 100% rename from conf/type/__apt_ppa/explorer/state rename to cdist/conf/type/__apt_ppa/explorer/state diff --git a/conf/type/__apt_ppa/files/remove-apt-repository b/cdist/conf/type/__apt_ppa/files/remove-apt-repository similarity index 100% rename from conf/type/__apt_ppa/files/remove-apt-repository rename to cdist/conf/type/__apt_ppa/files/remove-apt-repository diff --git a/conf/type/__apt_ppa/gencode-remote b/cdist/conf/type/__apt_ppa/gencode-remote similarity index 100% rename from conf/type/__apt_ppa/gencode-remote rename to cdist/conf/type/__apt_ppa/gencode-remote diff --git a/conf/type/__apt_ppa/man.text b/cdist/conf/type/__apt_ppa/man.text similarity index 100% rename from conf/type/__apt_ppa/man.text rename to cdist/conf/type/__apt_ppa/man.text diff --git a/conf/type/__apt_ppa/manifest b/cdist/conf/type/__apt_ppa/manifest similarity index 100% rename from conf/type/__apt_ppa/manifest rename to cdist/conf/type/__apt_ppa/manifest diff --git a/conf/type/__apt_ppa/parameter/required b/cdist/conf/type/__apt_ppa/parameter/required similarity index 100% rename from conf/type/__apt_ppa/parameter/required rename to cdist/conf/type/__apt_ppa/parameter/required diff --git a/conf/type/__apt_update_index/gencode-remote b/cdist/conf/type/__apt_update_index/gencode-remote similarity index 100% rename from conf/type/__apt_update_index/gencode-remote rename to cdist/conf/type/__apt_update_index/gencode-remote diff --git a/conf/type/__apt_update_index/man.text b/cdist/conf/type/__apt_update_index/man.text similarity index 100% rename from conf/type/__apt_update_index/man.text rename to cdist/conf/type/__apt_update_index/man.text diff --git a/conf/type/__apt_update_index/singleton b/cdist/conf/type/__apt_update_index/singleton similarity index 100% rename from conf/type/__apt_update_index/singleton rename to cdist/conf/type/__apt_update_index/singleton diff --git a/conf/type/__autofs_map/man.text b/cdist/conf/type/__autofs_map/man.text similarity index 100% rename from conf/type/__autofs_map/man.text rename to cdist/conf/type/__autofs_map/man.text diff --git a/conf/type/__autofs_map/manifest b/cdist/conf/type/__autofs_map/manifest similarity index 100% rename from conf/type/__autofs_map/manifest rename to cdist/conf/type/__autofs_map/manifest diff --git a/conf/type/__autofs_map/parameter/optional b/cdist/conf/type/__autofs_map/parameter/optional similarity index 100% rename from conf/type/__autofs_map/parameter/optional rename to cdist/conf/type/__autofs_map/parameter/optional diff --git a/conf/type/__autofs_map/parameter/required b/cdist/conf/type/__autofs_map/parameter/required similarity index 100% rename from conf/type/__autofs_map/parameter/required rename to cdist/conf/type/__autofs_map/parameter/required diff --git a/conf/type/__autofs_master/files/auto.master.header b/cdist/conf/type/__autofs_master/files/auto.master.header similarity index 100% rename from conf/type/__autofs_master/files/auto.master.header rename to cdist/conf/type/__autofs_master/files/auto.master.header diff --git a/conf/type/__autofs_master/gencode-local b/cdist/conf/type/__autofs_master/gencode-local similarity index 100% rename from conf/type/__autofs_master/gencode-local rename to cdist/conf/type/__autofs_master/gencode-local diff --git a/conf/type/__autofs_master/man.text b/cdist/conf/type/__autofs_master/man.text similarity index 100% rename from conf/type/__autofs_master/man.text rename to cdist/conf/type/__autofs_master/man.text diff --git a/conf/type/__autofs_master/manifest b/cdist/conf/type/__autofs_master/manifest similarity index 100% rename from conf/type/__autofs_master/manifest rename to cdist/conf/type/__autofs_master/manifest diff --git a/conf/type/__autofs_master/parameter/optional b/cdist/conf/type/__autofs_master/parameter/optional similarity index 100% rename from conf/type/__autofs_master/parameter/optional rename to cdist/conf/type/__autofs_master/parameter/optional diff --git a/conf/type/__autofs_master/singleton b/cdist/conf/type/__autofs_master/singleton similarity index 100% rename from conf/type/__autofs_master/singleton rename to cdist/conf/type/__autofs_master/singleton diff --git a/conf/type/__cdistmarker/gencode-remote b/cdist/conf/type/__cdistmarker/gencode-remote similarity index 100% rename from conf/type/__cdistmarker/gencode-remote rename to cdist/conf/type/__cdistmarker/gencode-remote diff --git a/conf/type/__cdistmarker/man.text b/cdist/conf/type/__cdistmarker/man.text similarity index 100% rename from conf/type/__cdistmarker/man.text rename to cdist/conf/type/__cdistmarker/man.text diff --git a/conf/type/__cdistmarker/parameter/optional b/cdist/conf/type/__cdistmarker/parameter/optional similarity index 100% rename from conf/type/__cdistmarker/parameter/optional rename to cdist/conf/type/__cdistmarker/parameter/optional diff --git a/conf/type/__cdistmarker/singleton b/cdist/conf/type/__cdistmarker/singleton similarity index 100% rename from conf/type/__cdistmarker/singleton rename to cdist/conf/type/__cdistmarker/singleton diff --git a/conf/type/__cron/explorer/entry b/cdist/conf/type/__cron/explorer/entry similarity index 100% rename from conf/type/__cron/explorer/entry rename to cdist/conf/type/__cron/explorer/entry diff --git a/conf/type/__cron/gencode-remote b/cdist/conf/type/__cron/gencode-remote similarity index 100% rename from conf/type/__cron/gencode-remote rename to cdist/conf/type/__cron/gencode-remote diff --git a/conf/type/__cron/man.text b/cdist/conf/type/__cron/man.text similarity index 100% rename from conf/type/__cron/man.text rename to cdist/conf/type/__cron/man.text diff --git a/conf/type/__cron/manifest b/cdist/conf/type/__cron/manifest similarity index 100% rename from conf/type/__cron/manifest rename to cdist/conf/type/__cron/manifest diff --git a/conf/type/__cron/parameter/optional b/cdist/conf/type/__cron/parameter/optional similarity index 100% rename from conf/type/__cron/parameter/optional rename to cdist/conf/type/__cron/parameter/optional diff --git a/conf/type/__cron/parameter/required b/cdist/conf/type/__cron/parameter/required similarity index 100% rename from conf/type/__cron/parameter/required rename to cdist/conf/type/__cron/parameter/required diff --git a/conf/type/__debconf_set_selections/gencode-remote b/cdist/conf/type/__debconf_set_selections/gencode-remote similarity index 100% rename from conf/type/__debconf_set_selections/gencode-remote rename to cdist/conf/type/__debconf_set_selections/gencode-remote diff --git a/conf/type/__debconf_set_selections/man.text b/cdist/conf/type/__debconf_set_selections/man.text similarity index 100% rename from conf/type/__debconf_set_selections/man.text rename to cdist/conf/type/__debconf_set_selections/man.text diff --git a/conf/type/__debconf_set_selections/parameter/required b/cdist/conf/type/__debconf_set_selections/parameter/required similarity index 100% rename from conf/type/__debconf_set_selections/parameter/required rename to cdist/conf/type/__debconf_set_selections/parameter/required diff --git a/conf/type/__directory/explorer/state b/cdist/conf/type/__directory/explorer/state similarity index 100% rename from conf/type/__directory/explorer/state rename to cdist/conf/type/__directory/explorer/state diff --git a/conf/type/__directory/gencode-remote b/cdist/conf/type/__directory/gencode-remote similarity index 100% rename from conf/type/__directory/gencode-remote rename to cdist/conf/type/__directory/gencode-remote diff --git a/conf/type/__directory/man.text b/cdist/conf/type/__directory/man.text similarity index 100% rename from conf/type/__directory/man.text rename to cdist/conf/type/__directory/man.text diff --git a/conf/type/__directory/parameter/boolean b/cdist/conf/type/__directory/parameter/boolean similarity index 100% rename from conf/type/__directory/parameter/boolean rename to cdist/conf/type/__directory/parameter/boolean diff --git a/conf/type/__directory/parameter/optional b/cdist/conf/type/__directory/parameter/optional similarity index 100% rename from conf/type/__directory/parameter/optional rename to cdist/conf/type/__directory/parameter/optional diff --git a/conf/type/__file/explorer/cksum b/cdist/conf/type/__file/explorer/cksum similarity index 100% rename from conf/type/__file/explorer/cksum rename to cdist/conf/type/__file/explorer/cksum diff --git a/conf/type/__file/explorer/exists b/cdist/conf/type/__file/explorer/exists similarity index 100% rename from conf/type/__file/explorer/exists rename to cdist/conf/type/__file/explorer/exists diff --git a/conf/type/__file/gencode-local b/cdist/conf/type/__file/gencode-local similarity index 100% rename from conf/type/__file/gencode-local rename to cdist/conf/type/__file/gencode-local diff --git a/conf/type/__file/gencode-remote b/cdist/conf/type/__file/gencode-remote similarity index 100% rename from conf/type/__file/gencode-remote rename to cdist/conf/type/__file/gencode-remote diff --git a/conf/type/__file/man.text b/cdist/conf/type/__file/man.text similarity index 100% rename from conf/type/__file/man.text rename to cdist/conf/type/__file/man.text diff --git a/conf/type/__file/manifest b/cdist/conf/type/__file/manifest similarity index 100% rename from conf/type/__file/manifest rename to cdist/conf/type/__file/manifest diff --git a/conf/type/__file/parameter/optional b/cdist/conf/type/__file/parameter/optional similarity index 100% rename from conf/type/__file/parameter/optional rename to cdist/conf/type/__file/parameter/optional diff --git a/conf/type/__group/TODO b/cdist/conf/type/__group/TODO similarity index 100% rename from conf/type/__group/TODO rename to cdist/conf/type/__group/TODO diff --git a/conf/type/__group/explorer/group b/cdist/conf/type/__group/explorer/group similarity index 100% rename from conf/type/__group/explorer/group rename to cdist/conf/type/__group/explorer/group diff --git a/conf/type/__group/explorer/gshadow b/cdist/conf/type/__group/explorer/gshadow similarity index 100% rename from conf/type/__group/explorer/gshadow rename to cdist/conf/type/__group/explorer/gshadow diff --git a/conf/type/__group/gencode-remote b/cdist/conf/type/__group/gencode-remote similarity index 100% rename from conf/type/__group/gencode-remote rename to cdist/conf/type/__group/gencode-remote diff --git a/conf/type/__group/man.text b/cdist/conf/type/__group/man.text similarity index 100% rename from conf/type/__group/man.text rename to cdist/conf/type/__group/man.text diff --git a/conf/type/__group/parameter/optional b/cdist/conf/type/__group/parameter/optional similarity index 100% rename from conf/type/__group/parameter/optional rename to cdist/conf/type/__group/parameter/optional diff --git a/conf/type/__issue/files/archlinux b/cdist/conf/type/__issue/files/archlinux similarity index 100% rename from conf/type/__issue/files/archlinux rename to cdist/conf/type/__issue/files/archlinux diff --git a/conf/type/__issue/files/default b/cdist/conf/type/__issue/files/default similarity index 100% rename from conf/type/__issue/files/default rename to cdist/conf/type/__issue/files/default diff --git a/conf/type/__issue/files/redhat b/cdist/conf/type/__issue/files/redhat similarity index 100% rename from conf/type/__issue/files/redhat rename to cdist/conf/type/__issue/files/redhat diff --git a/conf/type/__issue/man.text b/cdist/conf/type/__issue/man.text similarity index 100% rename from conf/type/__issue/man.text rename to cdist/conf/type/__issue/man.text diff --git a/conf/type/__issue/manifest b/cdist/conf/type/__issue/manifest similarity index 100% rename from conf/type/__issue/manifest rename to cdist/conf/type/__issue/manifest diff --git a/conf/type/__issue/parameter/optional b/cdist/conf/type/__issue/parameter/optional similarity index 100% rename from conf/type/__issue/parameter/optional rename to cdist/conf/type/__issue/parameter/optional diff --git a/conf/type/__issue/singleton b/cdist/conf/type/__issue/singleton similarity index 100% rename from conf/type/__issue/singleton rename to cdist/conf/type/__issue/singleton diff --git a/conf/type/__jail/.gitignore b/cdist/conf/type/__jail/.gitignore similarity index 100% rename from conf/type/__jail/.gitignore rename to cdist/conf/type/__jail/.gitignore diff --git a/conf/type/__jail/explorer/basepresent b/cdist/conf/type/__jail/explorer/basepresent similarity index 100% rename from conf/type/__jail/explorer/basepresent rename to cdist/conf/type/__jail/explorer/basepresent diff --git a/conf/type/__jail/explorer/present b/cdist/conf/type/__jail/explorer/present similarity index 100% rename from conf/type/__jail/explorer/present rename to cdist/conf/type/__jail/explorer/present diff --git a/conf/type/__jail/explorer/status b/cdist/conf/type/__jail/explorer/status similarity index 100% rename from conf/type/__jail/explorer/status rename to cdist/conf/type/__jail/explorer/status diff --git a/conf/type/__jail/gencode-local b/cdist/conf/type/__jail/gencode-local similarity index 100% rename from conf/type/__jail/gencode-local rename to cdist/conf/type/__jail/gencode-local diff --git a/conf/type/__jail/gencode-remote b/cdist/conf/type/__jail/gencode-remote similarity index 100% rename from conf/type/__jail/gencode-remote rename to cdist/conf/type/__jail/gencode-remote diff --git a/conf/type/__jail/man.text b/cdist/conf/type/__jail/man.text similarity index 100% rename from conf/type/__jail/man.text rename to cdist/conf/type/__jail/man.text diff --git a/conf/type/__jail/manifest b/cdist/conf/type/__jail/manifest similarity index 100% rename from conf/type/__jail/manifest rename to cdist/conf/type/__jail/manifest diff --git a/conf/type/__jail/parameter/optional b/cdist/conf/type/__jail/parameter/optional similarity index 100% rename from conf/type/__jail/parameter/optional rename to cdist/conf/type/__jail/parameter/optional diff --git a/conf/type/__jail/parameter/required b/cdist/conf/type/__jail/parameter/required similarity index 100% rename from conf/type/__jail/parameter/required rename to cdist/conf/type/__jail/parameter/required diff --git a/conf/type/__key_value/explorer/state b/cdist/conf/type/__key_value/explorer/state similarity index 100% rename from conf/type/__key_value/explorer/state rename to cdist/conf/type/__key_value/explorer/state diff --git a/conf/type/__key_value/gencode-remote b/cdist/conf/type/__key_value/gencode-remote similarity index 100% rename from conf/type/__key_value/gencode-remote rename to cdist/conf/type/__key_value/gencode-remote diff --git a/conf/type/__key_value/man.text b/cdist/conf/type/__key_value/man.text similarity index 100% rename from conf/type/__key_value/man.text rename to cdist/conf/type/__key_value/man.text diff --git a/conf/type/__key_value/manifest b/cdist/conf/type/__key_value/manifest similarity index 100% rename from conf/type/__key_value/manifest rename to cdist/conf/type/__key_value/manifest diff --git a/conf/type/__key_value/parameter/optional b/cdist/conf/type/__key_value/parameter/optional similarity index 100% rename from conf/type/__key_value/parameter/optional rename to cdist/conf/type/__key_value/parameter/optional diff --git a/conf/type/__key_value/parameter/required b/cdist/conf/type/__key_value/parameter/required similarity index 100% rename from conf/type/__key_value/parameter/required rename to cdist/conf/type/__key_value/parameter/required diff --git a/conf/type/__line/explorer/state b/cdist/conf/type/__line/explorer/state similarity index 100% rename from conf/type/__line/explorer/state rename to cdist/conf/type/__line/explorer/state diff --git a/conf/type/__line/gencode-remote b/cdist/conf/type/__line/gencode-remote similarity index 100% rename from conf/type/__line/gencode-remote rename to cdist/conf/type/__line/gencode-remote diff --git a/conf/type/__line/man.text b/cdist/conf/type/__line/man.text similarity index 100% rename from conf/type/__line/man.text rename to cdist/conf/type/__line/man.text diff --git a/conf/type/__line/parameter/optional b/cdist/conf/type/__line/parameter/optional similarity index 100% rename from conf/type/__line/parameter/optional rename to cdist/conf/type/__line/parameter/optional diff --git a/conf/type/__link/explorer/state b/cdist/conf/type/__link/explorer/state similarity index 100% rename from conf/type/__link/explorer/state rename to cdist/conf/type/__link/explorer/state diff --git a/conf/type/__link/gencode-remote b/cdist/conf/type/__link/gencode-remote similarity index 100% rename from conf/type/__link/gencode-remote rename to cdist/conf/type/__link/gencode-remote diff --git a/conf/type/__link/man.text b/cdist/conf/type/__link/man.text similarity index 100% rename from conf/type/__link/man.text rename to cdist/conf/type/__link/man.text diff --git a/conf/type/__link/manifest b/cdist/conf/type/__link/manifest similarity index 100% rename from conf/type/__link/manifest rename to cdist/conf/type/__link/manifest diff --git a/conf/type/__link/parameter/optional b/cdist/conf/type/__link/parameter/optional similarity index 100% rename from conf/type/__link/parameter/optional rename to cdist/conf/type/__link/parameter/optional diff --git a/conf/type/__link/parameter/required b/cdist/conf/type/__link/parameter/required similarity index 100% rename from conf/type/__link/parameter/required rename to cdist/conf/type/__link/parameter/required diff --git a/conf/type/__mkfs/gencode-remote b/cdist/conf/type/__mkfs/gencode-remote similarity index 100% rename from conf/type/__mkfs/gencode-remote rename to cdist/conf/type/__mkfs/gencode-remote diff --git a/conf/type/__mkfs/install b/cdist/conf/type/__mkfs/install similarity index 100% rename from conf/type/__mkfs/install rename to cdist/conf/type/__mkfs/install diff --git a/conf/type/__mkfs/man.text b/cdist/conf/type/__mkfs/man.text similarity index 100% rename from conf/type/__mkfs/man.text rename to cdist/conf/type/__mkfs/man.text diff --git a/conf/type/__mkfs/manifest b/cdist/conf/type/__mkfs/manifest similarity index 100% rename from conf/type/__mkfs/manifest rename to cdist/conf/type/__mkfs/manifest diff --git a/conf/type/__mkfs/parameter/optional b/cdist/conf/type/__mkfs/parameter/optional similarity index 100% rename from conf/type/__mkfs/parameter/optional rename to cdist/conf/type/__mkfs/parameter/optional diff --git a/conf/type/__mkfs/parameter/required b/cdist/conf/type/__mkfs/parameter/required similarity index 100% rename from conf/type/__mkfs/parameter/required rename to cdist/conf/type/__mkfs/parameter/required diff --git a/conf/type/__motd/files/motd b/cdist/conf/type/__motd/files/motd similarity index 100% rename from conf/type/__motd/files/motd rename to cdist/conf/type/__motd/files/motd diff --git a/conf/type/__motd/man.text b/cdist/conf/type/__motd/man.text similarity index 100% rename from conf/type/__motd/man.text rename to cdist/conf/type/__motd/man.text diff --git a/conf/type/__motd/manifest b/cdist/conf/type/__motd/manifest similarity index 100% rename from conf/type/__motd/manifest rename to cdist/conf/type/__motd/manifest diff --git a/conf/type/__motd/parameter/optional b/cdist/conf/type/__motd/parameter/optional similarity index 100% rename from conf/type/__motd/parameter/optional rename to cdist/conf/type/__motd/parameter/optional diff --git a/conf/type/__motd/singleton b/cdist/conf/type/__motd/singleton similarity index 100% rename from conf/type/__motd/singleton rename to cdist/conf/type/__motd/singleton diff --git a/conf/type/__mysql_database/gencode-remote b/cdist/conf/type/__mysql_database/gencode-remote similarity index 100% rename from conf/type/__mysql_database/gencode-remote rename to cdist/conf/type/__mysql_database/gencode-remote diff --git a/conf/type/__mysql_database/man.text b/cdist/conf/type/__mysql_database/man.text similarity index 100% rename from conf/type/__mysql_database/man.text rename to cdist/conf/type/__mysql_database/man.text diff --git a/conf/type/__mysql_database/parameter/optional b/cdist/conf/type/__mysql_database/parameter/optional similarity index 100% rename from conf/type/__mysql_database/parameter/optional rename to cdist/conf/type/__mysql_database/parameter/optional diff --git a/conf/type/__package/man.text b/cdist/conf/type/__package/man.text similarity index 100% rename from conf/type/__package/man.text rename to cdist/conf/type/__package/man.text diff --git a/conf/type/__package/manifest b/cdist/conf/type/__package/manifest similarity index 100% rename from conf/type/__package/manifest rename to cdist/conf/type/__package/manifest diff --git a/conf/type/__package/parameter/optional b/cdist/conf/type/__package/parameter/optional similarity index 100% rename from conf/type/__package/parameter/optional rename to cdist/conf/type/__package/parameter/optional diff --git a/conf/type/__package_apt/explorer/state b/cdist/conf/type/__package_apt/explorer/state similarity index 100% rename from conf/type/__package_apt/explorer/state rename to cdist/conf/type/__package_apt/explorer/state diff --git a/conf/type/__package_apt/gencode-remote b/cdist/conf/type/__package_apt/gencode-remote similarity index 100% rename from conf/type/__package_apt/gencode-remote rename to cdist/conf/type/__package_apt/gencode-remote diff --git a/conf/type/__package_apt/man.text b/cdist/conf/type/__package_apt/man.text similarity index 100% rename from conf/type/__package_apt/man.text rename to cdist/conf/type/__package_apt/man.text diff --git a/conf/type/__package_apt/notes.txt b/cdist/conf/type/__package_apt/notes.txt similarity index 100% rename from conf/type/__package_apt/notes.txt rename to cdist/conf/type/__package_apt/notes.txt diff --git a/conf/type/__package_apt/parameter/optional b/cdist/conf/type/__package_apt/parameter/optional similarity index 100% rename from conf/type/__package_apt/parameter/optional rename to cdist/conf/type/__package_apt/parameter/optional diff --git a/conf/type/__package_luarocks/explorer/pkg_status b/cdist/conf/type/__package_luarocks/explorer/pkg_status similarity index 100% rename from conf/type/__package_luarocks/explorer/pkg_status rename to cdist/conf/type/__package_luarocks/explorer/pkg_status diff --git a/conf/type/__package_luarocks/gencode-remote b/cdist/conf/type/__package_luarocks/gencode-remote similarity index 100% rename from conf/type/__package_luarocks/gencode-remote rename to cdist/conf/type/__package_luarocks/gencode-remote diff --git a/conf/type/__package_luarocks/man.text b/cdist/conf/type/__package_luarocks/man.text similarity index 100% rename from conf/type/__package_luarocks/man.text rename to cdist/conf/type/__package_luarocks/man.text diff --git a/conf/type/__package_luarocks/manifest b/cdist/conf/type/__package_luarocks/manifest similarity index 100% rename from conf/type/__package_luarocks/manifest rename to cdist/conf/type/__package_luarocks/manifest diff --git a/conf/type/__package_luarocks/parameter/optional b/cdist/conf/type/__package_luarocks/parameter/optional similarity index 100% rename from conf/type/__package_luarocks/parameter/optional rename to cdist/conf/type/__package_luarocks/parameter/optional diff --git a/conf/type/__package_opkg/explorer/pkg_status b/cdist/conf/type/__package_opkg/explorer/pkg_status similarity index 100% rename from conf/type/__package_opkg/explorer/pkg_status rename to cdist/conf/type/__package_opkg/explorer/pkg_status diff --git a/conf/type/__package_opkg/gencode-remote b/cdist/conf/type/__package_opkg/gencode-remote similarity index 100% rename from conf/type/__package_opkg/gencode-remote rename to cdist/conf/type/__package_opkg/gencode-remote diff --git a/conf/type/__package_opkg/man.text b/cdist/conf/type/__package_opkg/man.text similarity index 100% rename from conf/type/__package_opkg/man.text rename to cdist/conf/type/__package_opkg/man.text diff --git a/conf/type/__package_opkg/parameter/optional b/cdist/conf/type/__package_opkg/parameter/optional similarity index 100% rename from conf/type/__package_opkg/parameter/optional rename to cdist/conf/type/__package_opkg/parameter/optional diff --git a/conf/type/__package_pacman/explorer/pkg_version b/cdist/conf/type/__package_pacman/explorer/pkg_version similarity index 100% rename from conf/type/__package_pacman/explorer/pkg_version rename to cdist/conf/type/__package_pacman/explorer/pkg_version diff --git a/conf/type/__package_pacman/gencode-remote b/cdist/conf/type/__package_pacman/gencode-remote similarity index 100% rename from conf/type/__package_pacman/gencode-remote rename to cdist/conf/type/__package_pacman/gencode-remote diff --git a/conf/type/__package_pacman/man.text b/cdist/conf/type/__package_pacman/man.text similarity index 100% rename from conf/type/__package_pacman/man.text rename to cdist/conf/type/__package_pacman/man.text diff --git a/conf/type/__package_pacman/parameter/optional b/cdist/conf/type/__package_pacman/parameter/optional similarity index 100% rename from conf/type/__package_pacman/parameter/optional rename to cdist/conf/type/__package_pacman/parameter/optional diff --git a/conf/type/__package_pip/explorer/state b/cdist/conf/type/__package_pip/explorer/state similarity index 100% rename from conf/type/__package_pip/explorer/state rename to cdist/conf/type/__package_pip/explorer/state diff --git a/conf/type/__package_pip/gencode-remote b/cdist/conf/type/__package_pip/gencode-remote similarity index 100% rename from conf/type/__package_pip/gencode-remote rename to cdist/conf/type/__package_pip/gencode-remote diff --git a/conf/type/__package_pip/man.text b/cdist/conf/type/__package_pip/man.text similarity index 100% rename from conf/type/__package_pip/man.text rename to cdist/conf/type/__package_pip/man.text diff --git a/conf/type/__package_pip/parameter/optional b/cdist/conf/type/__package_pip/parameter/optional similarity index 100% rename from conf/type/__package_pip/parameter/optional rename to cdist/conf/type/__package_pip/parameter/optional diff --git a/conf/type/__package_pkg_freebsd/explorer/pkg_version b/cdist/conf/type/__package_pkg_freebsd/explorer/pkg_version similarity index 100% rename from conf/type/__package_pkg_freebsd/explorer/pkg_version rename to cdist/conf/type/__package_pkg_freebsd/explorer/pkg_version diff --git a/conf/type/__package_pkg_freebsd/gencode-remote b/cdist/conf/type/__package_pkg_freebsd/gencode-remote similarity index 100% rename from conf/type/__package_pkg_freebsd/gencode-remote rename to cdist/conf/type/__package_pkg_freebsd/gencode-remote diff --git a/conf/type/__package_pkg_freebsd/man.text b/cdist/conf/type/__package_pkg_freebsd/man.text similarity index 100% rename from conf/type/__package_pkg_freebsd/man.text rename to cdist/conf/type/__package_pkg_freebsd/man.text diff --git a/conf/type/__package_pkg_freebsd/parameter/optional b/cdist/conf/type/__package_pkg_freebsd/parameter/optional similarity index 100% rename from conf/type/__package_pkg_freebsd/parameter/optional rename to cdist/conf/type/__package_pkg_freebsd/parameter/optional diff --git a/conf/type/__package_pkg_openbsd/explorer/pkg_version b/cdist/conf/type/__package_pkg_openbsd/explorer/pkg_version similarity index 100% rename from conf/type/__package_pkg_openbsd/explorer/pkg_version rename to cdist/conf/type/__package_pkg_openbsd/explorer/pkg_version diff --git a/conf/type/__package_pkg_openbsd/gencode-remote b/cdist/conf/type/__package_pkg_openbsd/gencode-remote similarity index 100% rename from conf/type/__package_pkg_openbsd/gencode-remote rename to cdist/conf/type/__package_pkg_openbsd/gencode-remote diff --git a/conf/type/__package_pkg_openbsd/man.text b/cdist/conf/type/__package_pkg_openbsd/man.text similarity index 100% rename from conf/type/__package_pkg_openbsd/man.text rename to cdist/conf/type/__package_pkg_openbsd/man.text diff --git a/conf/type/__package_pkg_openbsd/parameter/optional b/cdist/conf/type/__package_pkg_openbsd/parameter/optional similarity index 100% rename from conf/type/__package_pkg_openbsd/parameter/optional rename to cdist/conf/type/__package_pkg_openbsd/parameter/optional diff --git a/conf/type/__package_rubygem/explorer/pkg_status b/cdist/conf/type/__package_rubygem/explorer/pkg_status similarity index 100% rename from conf/type/__package_rubygem/explorer/pkg_status rename to cdist/conf/type/__package_rubygem/explorer/pkg_status diff --git a/conf/type/__package_rubygem/gencode-remote b/cdist/conf/type/__package_rubygem/gencode-remote similarity index 100% rename from conf/type/__package_rubygem/gencode-remote rename to cdist/conf/type/__package_rubygem/gencode-remote diff --git a/conf/type/__package_rubygem/man.text b/cdist/conf/type/__package_rubygem/man.text similarity index 100% rename from conf/type/__package_rubygem/man.text rename to cdist/conf/type/__package_rubygem/man.text diff --git a/conf/type/__package_rubygem/parameter/optional b/cdist/conf/type/__package_rubygem/parameter/optional similarity index 100% rename from conf/type/__package_rubygem/parameter/optional rename to cdist/conf/type/__package_rubygem/parameter/optional diff --git a/conf/type/__package_yum/explorer/pkg_version b/cdist/conf/type/__package_yum/explorer/pkg_version similarity index 100% rename from conf/type/__package_yum/explorer/pkg_version rename to cdist/conf/type/__package_yum/explorer/pkg_version diff --git a/conf/type/__package_yum/gencode-remote b/cdist/conf/type/__package_yum/gencode-remote similarity index 100% rename from conf/type/__package_yum/gencode-remote rename to cdist/conf/type/__package_yum/gencode-remote diff --git a/conf/type/__package_yum/man.text b/cdist/conf/type/__package_yum/man.text similarity index 100% rename from conf/type/__package_yum/man.text rename to cdist/conf/type/__package_yum/man.text diff --git a/conf/type/__package_yum/parameter/optional b/cdist/conf/type/__package_yum/parameter/optional similarity index 100% rename from conf/type/__package_yum/parameter/optional rename to cdist/conf/type/__package_yum/parameter/optional diff --git a/conf/type/__package_zypper/explorer/pkg_version b/cdist/conf/type/__package_zypper/explorer/pkg_version similarity index 100% rename from conf/type/__package_zypper/explorer/pkg_version rename to cdist/conf/type/__package_zypper/explorer/pkg_version diff --git a/conf/type/__package_zypper/gencode-remote b/cdist/conf/type/__package_zypper/gencode-remote similarity index 100% rename from conf/type/__package_zypper/gencode-remote rename to cdist/conf/type/__package_zypper/gencode-remote diff --git a/conf/type/__package_zypper/man.text b/cdist/conf/type/__package_zypper/man.text similarity index 100% rename from conf/type/__package_zypper/man.text rename to cdist/conf/type/__package_zypper/man.text diff --git a/conf/type/__package_zypper/parameter/optional b/cdist/conf/type/__package_zypper/parameter/optional similarity index 100% rename from conf/type/__package_zypper/parameter/optional rename to cdist/conf/type/__package_zypper/parameter/optional diff --git a/conf/type/__partition_msdos/install b/cdist/conf/type/__partition_msdos/install similarity index 100% rename from conf/type/__partition_msdos/install rename to cdist/conf/type/__partition_msdos/install diff --git a/conf/type/__partition_msdos/man.text b/cdist/conf/type/__partition_msdos/man.text similarity index 100% rename from conf/type/__partition_msdos/man.text rename to cdist/conf/type/__partition_msdos/man.text diff --git a/conf/type/__partition_msdos/manifest b/cdist/conf/type/__partition_msdos/manifest similarity index 100% rename from conf/type/__partition_msdos/manifest rename to cdist/conf/type/__partition_msdos/manifest diff --git a/conf/type/__partition_msdos/parameter/optional b/cdist/conf/type/__partition_msdos/parameter/optional similarity index 100% rename from conf/type/__partition_msdos/parameter/optional rename to cdist/conf/type/__partition_msdos/parameter/optional diff --git a/conf/type/__partition_msdos/parameter/required b/cdist/conf/type/__partition_msdos/parameter/required similarity index 100% rename from conf/type/__partition_msdos/parameter/required rename to cdist/conf/type/__partition_msdos/parameter/required diff --git a/conf/type/__partition_msdos_apply/explorer/partitions b/cdist/conf/type/__partition_msdos_apply/explorer/partitions similarity index 100% rename from conf/type/__partition_msdos_apply/explorer/partitions rename to cdist/conf/type/__partition_msdos_apply/explorer/partitions diff --git a/conf/type/__partition_msdos_apply/files/lib.sh b/cdist/conf/type/__partition_msdos_apply/files/lib.sh similarity index 100% rename from conf/type/__partition_msdos_apply/files/lib.sh rename to cdist/conf/type/__partition_msdos_apply/files/lib.sh diff --git a/conf/type/__partition_msdos_apply/gencode-remote b/cdist/conf/type/__partition_msdos_apply/gencode-remote similarity index 100% rename from conf/type/__partition_msdos_apply/gencode-remote rename to cdist/conf/type/__partition_msdos_apply/gencode-remote diff --git a/conf/type/__partition_msdos_apply/install b/cdist/conf/type/__partition_msdos_apply/install similarity index 100% rename from conf/type/__partition_msdos_apply/install rename to cdist/conf/type/__partition_msdos_apply/install diff --git a/conf/type/__partition_msdos_apply/man.text b/cdist/conf/type/__partition_msdos_apply/man.text similarity index 100% rename from conf/type/__partition_msdos_apply/man.text rename to cdist/conf/type/__partition_msdos_apply/man.text diff --git a/conf/type/__partition_msdos_apply/singleton b/cdist/conf/type/__partition_msdos_apply/singleton similarity index 100% rename from conf/type/__partition_msdos_apply/singleton rename to cdist/conf/type/__partition_msdos_apply/singleton diff --git a/conf/type/__pf_apply/explorer/rcvar b/cdist/conf/type/__pf_apply/explorer/rcvar similarity index 100% rename from conf/type/__pf_apply/explorer/rcvar rename to cdist/conf/type/__pf_apply/explorer/rcvar diff --git a/conf/type/__pf_apply/gencode-remote b/cdist/conf/type/__pf_apply/gencode-remote similarity index 100% rename from conf/type/__pf_apply/gencode-remote rename to cdist/conf/type/__pf_apply/gencode-remote diff --git a/conf/type/__pf_apply/man.text b/cdist/conf/type/__pf_apply/man.text similarity index 100% rename from conf/type/__pf_apply/man.text rename to cdist/conf/type/__pf_apply/man.text diff --git a/conf/type/__pf_apply/singleton b/cdist/conf/type/__pf_apply/singleton similarity index 100% rename from conf/type/__pf_apply/singleton rename to cdist/conf/type/__pf_apply/singleton diff --git a/conf/type/__pf_ruleset/explorer/cksum b/cdist/conf/type/__pf_ruleset/explorer/cksum similarity index 100% rename from conf/type/__pf_ruleset/explorer/cksum rename to cdist/conf/type/__pf_ruleset/explorer/cksum diff --git a/conf/type/__pf_ruleset/explorer/rcvar b/cdist/conf/type/__pf_ruleset/explorer/rcvar similarity index 100% rename from conf/type/__pf_ruleset/explorer/rcvar rename to cdist/conf/type/__pf_ruleset/explorer/rcvar diff --git a/conf/type/__pf_ruleset/gencode-local b/cdist/conf/type/__pf_ruleset/gencode-local similarity index 100% rename from conf/type/__pf_ruleset/gencode-local rename to cdist/conf/type/__pf_ruleset/gencode-local diff --git a/conf/type/__pf_ruleset/gencode-remote b/cdist/conf/type/__pf_ruleset/gencode-remote similarity index 100% rename from conf/type/__pf_ruleset/gencode-remote rename to cdist/conf/type/__pf_ruleset/gencode-remote diff --git a/conf/type/__pf_ruleset/man.text b/cdist/conf/type/__pf_ruleset/man.text similarity index 100% rename from conf/type/__pf_ruleset/man.text rename to cdist/conf/type/__pf_ruleset/man.text diff --git a/conf/type/__pf_ruleset/parameter/optional b/cdist/conf/type/__pf_ruleset/parameter/optional similarity index 100% rename from conf/type/__pf_ruleset/parameter/optional rename to cdist/conf/type/__pf_ruleset/parameter/optional diff --git a/conf/type/__pf_ruleset/parameter/required b/cdist/conf/type/__pf_ruleset/parameter/required similarity index 100% rename from conf/type/__pf_ruleset/parameter/required rename to cdist/conf/type/__pf_ruleset/parameter/required diff --git a/conf/type/__pf_ruleset/singleton b/cdist/conf/type/__pf_ruleset/singleton similarity index 100% rename from conf/type/__pf_ruleset/singleton rename to cdist/conf/type/__pf_ruleset/singleton diff --git a/conf/type/__postgres_database/explorer/state b/cdist/conf/type/__postgres_database/explorer/state similarity index 100% rename from conf/type/__postgres_database/explorer/state rename to cdist/conf/type/__postgres_database/explorer/state diff --git a/conf/type/__postgres_database/gencode-remote b/cdist/conf/type/__postgres_database/gencode-remote similarity index 100% rename from conf/type/__postgres_database/gencode-remote rename to cdist/conf/type/__postgres_database/gencode-remote diff --git a/conf/type/__postgres_database/man.text b/cdist/conf/type/__postgres_database/man.text similarity index 100% rename from conf/type/__postgres_database/man.text rename to cdist/conf/type/__postgres_database/man.text diff --git a/conf/type/__postgres_database/parameter/optional b/cdist/conf/type/__postgres_database/parameter/optional similarity index 100% rename from conf/type/__postgres_database/parameter/optional rename to cdist/conf/type/__postgres_database/parameter/optional diff --git a/conf/type/__postgres_database/parameter/required b/cdist/conf/type/__postgres_database/parameter/required similarity index 100% rename from conf/type/__postgres_database/parameter/required rename to cdist/conf/type/__postgres_database/parameter/required diff --git a/conf/type/__postgres_role/explorer/state b/cdist/conf/type/__postgres_role/explorer/state similarity index 100% rename from conf/type/__postgres_role/explorer/state rename to cdist/conf/type/__postgres_role/explorer/state diff --git a/conf/type/__postgres_role/gencode-remote b/cdist/conf/type/__postgres_role/gencode-remote similarity index 100% rename from conf/type/__postgres_role/gencode-remote rename to cdist/conf/type/__postgres_role/gencode-remote diff --git a/conf/type/__postgres_role/man.text b/cdist/conf/type/__postgres_role/man.text similarity index 100% rename from conf/type/__postgres_role/man.text rename to cdist/conf/type/__postgres_role/man.text diff --git a/conf/type/__postgres_role/parameter/optional b/cdist/conf/type/__postgres_role/parameter/optional similarity index 100% rename from conf/type/__postgres_role/parameter/optional rename to cdist/conf/type/__postgres_role/parameter/optional diff --git a/conf/type/__postgres_role/parameter/required b/cdist/conf/type/__postgres_role/parameter/required similarity index 100% rename from conf/type/__postgres_role/parameter/required rename to cdist/conf/type/__postgres_role/parameter/required diff --git a/conf/type/__process/explorer/runs b/cdist/conf/type/__process/explorer/runs similarity index 100% rename from conf/type/__process/explorer/runs rename to cdist/conf/type/__process/explorer/runs diff --git a/conf/type/__process/gencode-remote b/cdist/conf/type/__process/gencode-remote similarity index 100% rename from conf/type/__process/gencode-remote rename to cdist/conf/type/__process/gencode-remote diff --git a/conf/type/__process/man.text b/cdist/conf/type/__process/man.text similarity index 100% rename from conf/type/__process/man.text rename to cdist/conf/type/__process/man.text diff --git a/conf/type/__process/parameter/optional b/cdist/conf/type/__process/parameter/optional similarity index 100% rename from conf/type/__process/parameter/optional rename to cdist/conf/type/__process/parameter/optional diff --git a/conf/type/__process/parameter/required b/cdist/conf/type/__process/parameter/required similarity index 100% rename from conf/type/__process/parameter/required rename to cdist/conf/type/__process/parameter/required diff --git a/conf/type/__qemu_img/explorer/exists b/cdist/conf/type/__qemu_img/explorer/exists similarity index 100% rename from conf/type/__qemu_img/explorer/exists rename to cdist/conf/type/__qemu_img/explorer/exists diff --git a/conf/type/__qemu_img/gencode-remote b/cdist/conf/type/__qemu_img/gencode-remote similarity index 100% rename from conf/type/__qemu_img/gencode-remote rename to cdist/conf/type/__qemu_img/gencode-remote diff --git a/conf/type/__qemu_img/man.text b/cdist/conf/type/__qemu_img/man.text similarity index 100% rename from conf/type/__qemu_img/man.text rename to cdist/conf/type/__qemu_img/man.text diff --git a/conf/type/__qemu_img/manifest b/cdist/conf/type/__qemu_img/manifest similarity index 100% rename from conf/type/__qemu_img/manifest rename to cdist/conf/type/__qemu_img/manifest diff --git a/conf/type/__qemu_img/parameter/optional b/cdist/conf/type/__qemu_img/parameter/optional similarity index 100% rename from conf/type/__qemu_img/parameter/optional rename to cdist/conf/type/__qemu_img/parameter/optional diff --git a/conf/type/__qemu_img/parameter/required b/cdist/conf/type/__qemu_img/parameter/required similarity index 100% rename from conf/type/__qemu_img/parameter/required rename to cdist/conf/type/__qemu_img/parameter/required diff --git a/conf/type/__rvm/explorer/state b/cdist/conf/type/__rvm/explorer/state similarity index 100% rename from conf/type/__rvm/explorer/state rename to cdist/conf/type/__rvm/explorer/state diff --git a/conf/type/__rvm/gencode-remote b/cdist/conf/type/__rvm/gencode-remote similarity index 100% rename from conf/type/__rvm/gencode-remote rename to cdist/conf/type/__rvm/gencode-remote diff --git a/conf/type/__rvm/man.text b/cdist/conf/type/__rvm/man.text similarity index 100% rename from conf/type/__rvm/man.text rename to cdist/conf/type/__rvm/man.text diff --git a/conf/type/__rvm/manifest b/cdist/conf/type/__rvm/manifest similarity index 100% rename from conf/type/__rvm/manifest rename to cdist/conf/type/__rvm/manifest diff --git a/conf/type/__rvm/parameter/required b/cdist/conf/type/__rvm/parameter/required similarity index 100% rename from conf/type/__rvm/parameter/required rename to cdist/conf/type/__rvm/parameter/required diff --git a/conf/type/__rvm_gem/explorer/state b/cdist/conf/type/__rvm_gem/explorer/state similarity index 100% rename from conf/type/__rvm_gem/explorer/state rename to cdist/conf/type/__rvm_gem/explorer/state diff --git a/conf/type/__rvm_gem/gencode-remote b/cdist/conf/type/__rvm_gem/gencode-remote similarity index 100% rename from conf/type/__rvm_gem/gencode-remote rename to cdist/conf/type/__rvm_gem/gencode-remote diff --git a/conf/type/__rvm_gem/man.text b/cdist/conf/type/__rvm_gem/man.text similarity index 100% rename from conf/type/__rvm_gem/man.text rename to cdist/conf/type/__rvm_gem/man.text diff --git a/conf/type/__rvm_gem/manifest b/cdist/conf/type/__rvm_gem/manifest similarity index 100% rename from conf/type/__rvm_gem/manifest rename to cdist/conf/type/__rvm_gem/manifest diff --git a/conf/type/__rvm_gem/parameter/optional b/cdist/conf/type/__rvm_gem/parameter/optional similarity index 100% rename from conf/type/__rvm_gem/parameter/optional rename to cdist/conf/type/__rvm_gem/parameter/optional diff --git a/conf/type/__rvm_gem/parameter/required b/cdist/conf/type/__rvm_gem/parameter/required similarity index 100% rename from conf/type/__rvm_gem/parameter/required rename to cdist/conf/type/__rvm_gem/parameter/required diff --git a/conf/type/__rvm_gemset/explorer/state b/cdist/conf/type/__rvm_gemset/explorer/state similarity index 100% rename from conf/type/__rvm_gemset/explorer/state rename to cdist/conf/type/__rvm_gemset/explorer/state diff --git a/conf/type/__rvm_gemset/gencode-remote b/cdist/conf/type/__rvm_gemset/gencode-remote similarity index 100% rename from conf/type/__rvm_gemset/gencode-remote rename to cdist/conf/type/__rvm_gemset/gencode-remote diff --git a/conf/type/__rvm_gemset/man.text b/cdist/conf/type/__rvm_gemset/man.text similarity index 100% rename from conf/type/__rvm_gemset/man.text rename to cdist/conf/type/__rvm_gemset/man.text diff --git a/conf/type/__rvm_gemset/manifest b/cdist/conf/type/__rvm_gemset/manifest similarity index 100% rename from conf/type/__rvm_gemset/manifest rename to cdist/conf/type/__rvm_gemset/manifest diff --git a/conf/type/__rvm_gemset/parameter/optional b/cdist/conf/type/__rvm_gemset/parameter/optional similarity index 100% rename from conf/type/__rvm_gemset/parameter/optional rename to cdist/conf/type/__rvm_gemset/parameter/optional diff --git a/conf/type/__rvm_gemset/parameter/required b/cdist/conf/type/__rvm_gemset/parameter/required similarity index 100% rename from conf/type/__rvm_gemset/parameter/required rename to cdist/conf/type/__rvm_gemset/parameter/required diff --git a/conf/type/__rvm_ruby/explorer/state b/cdist/conf/type/__rvm_ruby/explorer/state similarity index 100% rename from conf/type/__rvm_ruby/explorer/state rename to cdist/conf/type/__rvm_ruby/explorer/state diff --git a/conf/type/__rvm_ruby/gencode-remote b/cdist/conf/type/__rvm_ruby/gencode-remote similarity index 100% rename from conf/type/__rvm_ruby/gencode-remote rename to cdist/conf/type/__rvm_ruby/gencode-remote diff --git a/conf/type/__rvm_ruby/man.text b/cdist/conf/type/__rvm_ruby/man.text similarity index 100% rename from conf/type/__rvm_ruby/man.text rename to cdist/conf/type/__rvm_ruby/man.text diff --git a/conf/type/__rvm_ruby/manifest b/cdist/conf/type/__rvm_ruby/manifest similarity index 100% rename from conf/type/__rvm_ruby/manifest rename to cdist/conf/type/__rvm_ruby/manifest diff --git a/conf/type/__rvm_ruby/parameter/optional b/cdist/conf/type/__rvm_ruby/parameter/optional similarity index 100% rename from conf/type/__rvm_ruby/parameter/optional rename to cdist/conf/type/__rvm_ruby/parameter/optional diff --git a/conf/type/__rvm_ruby/parameter/required b/cdist/conf/type/__rvm_ruby/parameter/required similarity index 100% rename from conf/type/__rvm_ruby/parameter/required rename to cdist/conf/type/__rvm_ruby/parameter/required diff --git a/conf/type/__ssh_authorized_key/explorer/dstuser_group b/cdist/conf/type/__ssh_authorized_key/explorer/dstuser_group similarity index 100% rename from conf/type/__ssh_authorized_key/explorer/dstuser_group rename to cdist/conf/type/__ssh_authorized_key/explorer/dstuser_group diff --git a/conf/type/__ssh_authorized_key/man.text b/cdist/conf/type/__ssh_authorized_key/man.text similarity index 100% rename from conf/type/__ssh_authorized_key/man.text rename to cdist/conf/type/__ssh_authorized_key/man.text diff --git a/conf/type/__ssh_authorized_key/manifest b/cdist/conf/type/__ssh_authorized_key/manifest similarity index 100% rename from conf/type/__ssh_authorized_key/manifest rename to cdist/conf/type/__ssh_authorized_key/manifest diff --git a/conf/type/__ssh_authorized_key/parameter/optional b/cdist/conf/type/__ssh_authorized_key/parameter/optional similarity index 100% rename from conf/type/__ssh_authorized_key/parameter/optional rename to cdist/conf/type/__ssh_authorized_key/parameter/optional diff --git a/conf/type/__start_on_boot/explorer/state b/cdist/conf/type/__start_on_boot/explorer/state similarity index 100% rename from conf/type/__start_on_boot/explorer/state rename to cdist/conf/type/__start_on_boot/explorer/state diff --git a/conf/type/__start_on_boot/gencode-remote b/cdist/conf/type/__start_on_boot/gencode-remote similarity index 100% rename from conf/type/__start_on_boot/gencode-remote rename to cdist/conf/type/__start_on_boot/gencode-remote diff --git a/conf/type/__start_on_boot/man.text b/cdist/conf/type/__start_on_boot/man.text similarity index 100% rename from conf/type/__start_on_boot/man.text rename to cdist/conf/type/__start_on_boot/man.text diff --git a/conf/type/__start_on_boot/parameter/optional b/cdist/conf/type/__start_on_boot/parameter/optional similarity index 100% rename from conf/type/__start_on_boot/parameter/optional rename to cdist/conf/type/__start_on_boot/parameter/optional diff --git a/conf/type/__timezone/man.text b/cdist/conf/type/__timezone/man.text similarity index 100% rename from conf/type/__timezone/man.text rename to cdist/conf/type/__timezone/man.text diff --git a/conf/type/__timezone/manifest b/cdist/conf/type/__timezone/manifest similarity index 100% rename from conf/type/__timezone/manifest rename to cdist/conf/type/__timezone/manifest diff --git a/conf/type/__user/TODO b/cdist/conf/type/__user/TODO similarity index 100% rename from conf/type/__user/TODO rename to cdist/conf/type/__user/TODO diff --git a/conf/type/__user/explorer/group b/cdist/conf/type/__user/explorer/group similarity index 100% rename from conf/type/__user/explorer/group rename to cdist/conf/type/__user/explorer/group diff --git a/conf/type/__user/explorer/passwd b/cdist/conf/type/__user/explorer/passwd similarity index 100% rename from conf/type/__user/explorer/passwd rename to cdist/conf/type/__user/explorer/passwd diff --git a/conf/type/__user/explorer/shadow b/cdist/conf/type/__user/explorer/shadow similarity index 100% rename from conf/type/__user/explorer/shadow rename to cdist/conf/type/__user/explorer/shadow diff --git a/conf/type/__user/gencode-remote b/cdist/conf/type/__user/gencode-remote similarity index 100% rename from conf/type/__user/gencode-remote rename to cdist/conf/type/__user/gencode-remote diff --git a/conf/type/__user/man.text b/cdist/conf/type/__user/man.text similarity index 100% rename from conf/type/__user/man.text rename to cdist/conf/type/__user/man.text diff --git a/conf/type/__user/parameter/optional b/cdist/conf/type/__user/parameter/optional similarity index 100% rename from conf/type/__user/parameter/optional rename to cdist/conf/type/__user/parameter/optional diff --git a/cdist/test/emulator/fixtures/conf/type/__file b/cdist/test/emulator/fixtures/conf/type/__file index 8458361c..1ed684b9 120000 --- a/cdist/test/emulator/fixtures/conf/type/__file +++ b/cdist/test/emulator/fixtures/conf/type/__file @@ -1 +1 @@ -../../../../../../conf/type/__file \ No newline at end of file +../../../../../conf/type/__file \ No newline at end of file diff --git a/setup.py b/setup.py index 19fb28e6..d5dac616 100644 --- a/setup.py +++ b/setup.py @@ -11,14 +11,18 @@ def data_finder(data_dir): for name in os.listdir(data_dir): entry = os.path.join(data_dir, name) if os.path.isdir(entry): + entries.append(entry) entries.extend(data_finder(entry)) else: entries.append(entry) return entries +cur = os.getcwd() +os.chdir("cdist") package_data = data_finder("conf") - + # package_dir={'cdist': 'src/mypkg'}, +os.chdir(cur) print(package_data) From 8202cd0e7ad78c2df4969635932752d9752e0896 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 29 Oct 2012 22:56:29 +0100 Subject: [PATCH 248/412] remove some debug, remove adding dirs Signed-off-by: Nico Schottelius --- setup.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/setup.py b/setup.py index d5dac616..5b5e2a47 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,5 @@ from distutils.core import setup - -#data_files=[('/usr/share/cdist', 'conf')], - # data_files=[('/tmp/cdist', ['conf'])], import cdist - import os def data_finder(data_dir): @@ -11,7 +7,6 @@ def data_finder(data_dir): for name in os.listdir(data_dir): entry = os.path.join(data_dir, name) if os.path.isdir(entry): - entries.append(entry) entries.extend(data_finder(entry)) else: entries.append(entry) @@ -21,11 +16,8 @@ def data_finder(data_dir): cur = os.getcwd() os.chdir("cdist") package_data = data_finder("conf") - # package_dir={'cdist': 'src/mypkg'}, os.chdir(cur) -print(package_data) - setup( name = "cdist", packages = ["cdist", "cdist.core", "cdist.exec", "cdist.util" ], From 6c4480abfa138bbc99d59da6a3e3838c1a9c98cf Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 29 Oct 2012 23:25:28 +0100 Subject: [PATCH 249/412] ++changes(2.1.0pre3) Signed-off-by: Nico Schottelius --- docs/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog b/docs/changelog index dba70701..93d71ba2 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,6 +5,9 @@ Changelog * Exception: No braces means author == Nico Schottelius +2.1.0pre3: 2012-10-29 + * Dist: PyPi: Types and explorer included as package data + 2.1.0pre2: 2012-10-26 * Dist: PyPi: Add conf/ directory to distribution * Dist: Initial support for archlinux packaging From cbb34de1b2bd1ebb0b7f11cac3933f40d00effc3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 29 Oct 2012 23:28:27 +0100 Subject: [PATCH 250/412] explorers are now below cdist/ Signed-off-by: Nico Schottelius --- docs/man/cdist-reference.text.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/man/cdist-reference.text.sh b/docs/man/cdist-reference.text.sh index cf1b852f..8e3f49a2 100755 --- a/docs/man/cdist-reference.text.sh +++ b/docs/man/cdist-reference.text.sh @@ -49,7 +49,7 @@ The following global explorers are available: eof ( - cd ../../conf/explorer + cd ../../cdist/conf/explorer for explorer in *; do echo "- $explorer" done From e0bdcea78b1a59424e22de1ccf7ea8ec24b22f8b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 07:33:07 +0100 Subject: [PATCH 251/412] adjust type linking script Signed-off-by: Nico Schottelius --- build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build b/build index d295da14..a4550f67 100755 --- a/build +++ b/build @@ -78,8 +78,8 @@ case "$1" in ;; mantype) - for mansrc in conf/type/*/man.text; do - dst="$(echo $mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;docs/man/man7/;')" + for mansrc in cdist/conf/type/*/man.text; do + dst="$(echo $mansrc | sed -e 's;cdist/conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;docs/man/man7/;')" ln -sf "../../../$mansrc" "$dst" done ;; From 80e42c133ddb93edae8f6da303294a960f9d7b3a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 07:37:19 +0100 Subject: [PATCH 252/412] this is pre3, not pre2 Signed-off-by: Nico Schottelius --- docs/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 93d71ba2..118d9bfe 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,7 +5,7 @@ Changelog * Exception: No braces means author == Nico Schottelius -2.1.0pre3: 2012-10-29 +2.1.0pre3: 2012-10-30 * Dist: PyPi: Types and explorer included as package data 2.1.0pre2: 2012-10-26 From a81525b101929bc334bb1414c431bd5c1cb92bed Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 07:41:42 +0100 Subject: [PATCH 253/412] add some thoughts on changes for multiple directory search for types and explorers Signed-off-by: Nico Schottelius --- docs/dev/logs/2012-10-29.installed_paths | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 docs/dev/logs/2012-10-29.installed_paths diff --git a/docs/dev/logs/2012-10-29.installed_paths b/docs/dev/logs/2012-10-29.installed_paths new file mode 100644 index 00000000..f6824274 --- /dev/null +++ b/docs/dev/logs/2012-10-29.installed_paths @@ -0,0 +1,32 @@ + +Installed paths: (read first) + os.path.dirname(cdist.__file__) + + /conf/explorer + /conf/type + +User paths: (read after, overwrite)? + + $HOME/.cdist + + /explorer + /type + + /manifest + +Additional paths: + + CDIST_EXPLORER_EXTRA_PATH=... + CDIST_TYPE_EXTRA_PATH=... + + or + + -c dir -c dir2 -c ... => + add types and explorer from those directories + last one wins? + because they can only be appended to existing "$PATH" + +Open questions: + + - How to tell types to use global explorer? + - How to tell types to find other types? From 10b6c31ac8d14cec11e615827981ac0f49de8258 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 11:47:16 +0100 Subject: [PATCH 254/412] Rename cdist.py to scripts/cdist to avoid self import naming cdist cdist.py and running import cdist, imports itself and thus raises an interesting error: (virtualenv)[7:47] brief:virtualenv% cdist.py Traceback (most recent call last): File "", line 1512, in _find_and_load_unlocked AttributeError: 'module' object has no attribute '__path__' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/users/nico/oeffentlich/rechner/projekte/cdist/virtualenv/bin/cdist.py", line 230, in commandline() File "/home/users/nico/oeffentlich/rechner/projekte/cdist/virtualenv/bin/cdist.py", line 27, in commandline import cdist.banner ImportError: No module named 'cdist.banner'; cdist is not a package During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/users/nico/oeffentlich/rechner/projekte/cdist/virtualenv/bin/cdist.py", line 235, in except cdist.Error as e: AttributeError: 'module' object has no attribute 'Error' Also described on http://www.velocityreviews.com/forums/t953596-error-executing-import-html-parser-from-a-script.html Signed-off-by: Nico Schottelius --- bin/cdist | 5 ++++- cdist.py => scripts/cdist | 0 2 files changed, 4 insertions(+), 1 deletion(-) rename cdist.py => scripts/cdist (100%) diff --git a/bin/cdist b/bin/cdist index 5c1239fb..5a6ce92f 100755 --- a/bin/cdist +++ b/bin/cdist @@ -22,5 +22,8 @@ # Wrapper for real script to allow execution from checkout dir=${0%/*} + +# Ensure version is present - the bundled/shipped version contains a static version, +# the git version contains a dynamic version "$dir/../build" version -"$dir/../cdist.py" "$@" +PYTHONPATH="${dir}/../" "$dir/../scripts/cdist" "$@" diff --git a/cdist.py b/scripts/cdist similarity index 100% rename from cdist.py rename to scripts/cdist From c4274e789fe0d7349acf6307d15c0a15c01b5e2e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 11:51:27 +0100 Subject: [PATCH 255/412] include cdist from the scripts/ directory for shipping Signed-off-by: Nico Schottelius --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5b5e2a47..25fc4820 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( name = "cdist", packages = ["cdist", "cdist.core", "cdist.exec", "cdist.util" ], package_data={'cdist': package_data}, - scripts = ["cdist.py"], + scripts = ["scripts/cdist"], version = cdist.version.VERSION, description = "A Usable Configuration Management System", author = "Nico Schottelius", From 01eef6b242cd87a608855fdd975bbd40e5ae220c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 14:53:53 +0100 Subject: [PATCH 256/412] ++changes(2.1.0pre4) Signed-off-by: Nico Schottelius --- docs/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog b/docs/changelog index 118d9bfe..242e0c2f 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,6 +5,9 @@ Changelog * Exception: No braces means author == Nico Schottelius +2.1.0pre4: + * Dist: PyPi: Move cdist.py to script/cdist to avoid double import + 2.1.0pre3: 2012-10-30 * Dist: PyPi: Types and explorer included as package data From 6ece8a97c71c5c0a946e515603015837562c68ac Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 14:54:05 +0100 Subject: [PATCH 257/412] use obsolete lib path Signed-off-by: Nico Schottelius --- cdist/exec/local.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cdist/exec/local.py b/cdist/exec/local.py index e510a8fb..9947ac64 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -20,8 +20,6 @@ # # -# FIXME: common base class with Remote? - import io import os import sys @@ -49,8 +47,6 @@ class Local(object): self.global_explorer_path = os.path.join(self.conf_path, "explorer") self.manifest_path = os.path.join(self.conf_path, "manifest") self.type_path = os.path.join(self.conf_path, "type") - # FIXME: should not be needed anywhere - self.lib_path = os.path.join(self.base_path, "lib") # Local output self.out_path = out_path From f09378eed05cd4b4c15b424dbdb751baa652ee8d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 14:57:49 +0100 Subject: [PATCH 258/412] path implementation done (in theory) Signed-off-by: Nico Schottelius --- ...0-30.path-for-types-and-global-explorer-implementation | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 docs/dev/logs/2012-10-30.path-for-types-and-global-explorer-implementation diff --git a/docs/dev/logs/2012-10-30.path-for-types-and-global-explorer-implementation b/docs/dev/logs/2012-10-30.path-for-types-and-global-explorer-implementation new file mode 100644 index 00000000..8a683a40 --- /dev/null +++ b/docs/dev/logs/2012-10-30.path-for-types-and-global-explorer-implementation @@ -0,0 +1,8 @@ +- Allow list of base directories, which may contain explorer/ or type/ subdirectories + - can use the existing -c parameter, only allow it to be specified multiple times +- for each directory, link the given explorer and types to a temporary conf/ directory + similar to bin/ +- last one wins strategy + - what is expected by the user + + From 18c0c937dd417900ae48c4e43df1e6ee4010e836 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 14:58:03 +0100 Subject: [PATCH 259/412] also add cache to user dir Signed-off-by: Nico Schottelius --- docs/dev/logs/2012-10-29.installed_paths | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/dev/logs/2012-10-29.installed_paths b/docs/dev/logs/2012-10-29.installed_paths index f6824274..3587390e 100644 --- a/docs/dev/logs/2012-10-29.installed_paths +++ b/docs/dev/logs/2012-10-29.installed_paths @@ -14,6 +14,8 @@ User paths: (read after, overwrite)? /manifest + /cache + Additional paths: CDIST_EXPLORER_EXTRA_PATH=... From 813651c14b87d30b5f2c028ac7d21d43efb67bb2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 15:59:02 +0100 Subject: [PATCH 260/412] allow passing conf_dir instead of cdist-home Signed-off-by: Nico Schottelius --- scripts/cdist | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/cdist b/scripts/cdist index 2066db55..d5ea06d0 100755 --- a/scripts/cdist +++ b/scripts/cdist @@ -56,9 +56,9 @@ def commandline(): 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('-c', '--conf-dir', + help='Add configuration directory (can be repeated, last one wins)', + action='append') parser['configinstall'].add_argument('-i', '--initial-manifest', help='Path to a cdist manifest or \'-\' to read from stdin.', dest='manifest', required=False) @@ -172,7 +172,7 @@ def configinstall_onehost(host, args, mode, parallel): remote_copy=args.remote_copy, remote_exec=args.remote_exec, initial_manifest=args.manifest, - base_path=args.cdist_home, + conf_dirs=args.conf_dir, exec_path=sys.argv[0], debug=args.debug) From b0e8c23078acd1f8ba73e3aa23c0bb24a5ec843a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 15:59:21 +0100 Subject: [PATCH 261/412] initial change to support multiple conf_dirs Signed-off-by: Nico Schottelius --- cdist/context.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/cdist/context.py b/cdist/context.py index 8b468739..64a8086e 100644 --- a/cdist/context.py +++ b/cdist/context.py @@ -38,26 +38,18 @@ class Context(object): remote_copy, remote_exec, initial_manifest=False, - base_path=False, + conf_dirs=[], exec_path=sys.argv[0], debug=False): - self.debug = debug - + self.debug = debug self.target_host = target_host - - # Only required for testing self.exec_path = exec_path # Context logging self.log = logging.getLogger(self.target_host) self.log.addFilter(self) - # Local base directory - self.base_path = (base_path or - os.path.abspath(os.path.join(os.path.dirname(__file__), - os.pardir, os.pardir))) - # Local temp directory # FIXME: if __cdist_out_dir can be given from the outside, the same directory will be used for all hosts if '__cdist_out_dir' in os.environ: @@ -67,7 +59,7 @@ class Context(object): self.temp_dir = tempfile.mkdtemp() self.out_path = os.path.join(self.temp_dir, "out") - self.local = local.Local(self.target_host, self.base_path, self.out_path) + self.local = local.Local(self.target_host, self.conf_dirs, self.out_path) self.initial_manifest = (initial_manifest or os.path.join(self.local.manifest_path, "init")) From 1e264afa6343ffbab5c61d7d4b379d1454f8aee8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 16:05:37 +0100 Subject: [PATCH 262/412] refactor code to allow multiple directories to be passed in Signed-off-by: Nico Schottelius --- cdist/exec/local.py | 107 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 89 insertions(+), 18 deletions(-) diff --git a/cdist/exec/local.py b/cdist/exec/local.py index 9947ac64..4d94789b 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -37,32 +37,67 @@ class Local(object): 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 + def __init__(self, target_host, conf_dirs, out_path, cache_dir): - # Local input - self.cache_path = os.path.join(self.base_path, "cache") - self.conf_path = os.path.join(self.base_path, "conf") + self.target_host = target_host + self.add_conf_dirs = conf_dirs + self.out_path = out_path + + self._init_log() + self._init_permissions() + self._init_home_dir() + self._init_paths() + self._init_cache_dir() + self._init_conf_dirs() + + def _init_home_dir(self): + if 'HOME' in os.environ: + self.home_dir = os.environ['HOME'] + else: + self.home_dir = None + + def _init_log(self): + self.log = logging.getLogger(self.target_host) + + def _init_permissions(self): + # Setup file permissions using umask + os.umask(0o077) + + def _init_paths(self): + # Depending on out_path + self.bin_path = os.path.join(self.out_path, "bin") + self.conf_path = os.path.join(self.out_path, "conf") + self.global_explorer_out_path = os.path.join(self.out_path, "explorer") + self.object_path = os.path.join(self.out_path, "object") + + # Depending on conf_path self.global_explorer_path = os.path.join(self.conf_path, "explorer") self.manifest_path = os.path.join(self.conf_path, "manifest") self.type_path = os.path.join(self.conf_path, "type") - # Local output - self.out_path = out_path - self.bin_path = os.path.join(self.out_path, "bin") - self.global_explorer_out_path = os.path.join(self.out_path, "explorer") - self.object_path = os.path.join(self.out_path, "object") + def _init_conf_dirs(self): + self.conf_dirs = [] - self.log = logging.getLogger(self.target_host) + # Comes with the distribution + system_conf_dir = os.path.join(os.path.dirname(cdist.__file__), "conf") + self.conf_dirs.append(system_conf_dir) - # Setup file permissions using umask - os.umask(0o077) + # Is the default place for user created explorer, type and manifest + if self.home_dir: + user_conf_dir = os.path.join(self.home_dir, ".cdist") + self.conf_dirs.append(user_conf_dir) - def create_directories(self): - self.mkdir(self.out_path) - self.mkdir(self.global_explorer_out_path) - self.mkdir(self.bin_path) + # Add user supplied directories + self.conf_dirs.extend(self.add_conf_dirs) + + def _init_cache_dir(self, cache_dir): + if cache_dir: + self.cache_path = cache_dir + else: + if self.home_dir: + self.cache_path = os.path.join(self.home_dir, "cache") + else: + raise cdist.Error("No homedir setup and no cache dir location given") def rmdir(self, path): """Remove directory on the local side.""" @@ -107,6 +142,42 @@ class Local(object): return self.run(command, env, return_output) + def create_context_files_dirs(self): + self._create_context_dirs() + self._create_conf_path_and_link_conf_dirs() + + def _create_context_dirs(self): + self.mkdir(self.out_path) + self.mkdir(self.conf_path) + self.mkdir(self.global_explorer_out_path) + self.mkdir(self.bin_path) + + def _create_conf_path_and_link_conf_dirs(self): + self.mkdir(self.conf_path) + + # Link destination directories + for sub_dir in [ "explorer", "manifest", "type" ]: + self.mkdir(os.path.join(self.conf_path, sub_dir)) + + # Iterate over all directories and link the to the output dir + for conf_dir in self.conf_dirs: + for sub_dir in [ "explorer", "manifest", "type" ]: + current_dir = os.path.join(conf_dir, sub_dir) + + for entry in os.listdir(current_dir): + rel_entry_path = os.path.join(sub_dir, entry) + src = os.path.join(self.conf_path, entry) + dst = os.path.join(conf_dir, sub_dir, entry) + + # Already exists? remove and link + if os.path.exists(dst): + os.ulink(dst) + + try: + os.symlink(src, dst) + except OSError as e: + raise cdist.Error("Linking %s %s to %s failed: %s" % (sub_dir, src, dst, e.__str__())) + def link_emulator(self, exec_path): """Link emulator to types""" src = os.path.abspath(exec_path) From cbe95b18e650b1fc1b6fe28059590ae94a437d6e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 16:06:27 +0100 Subject: [PATCH 263/412] rename function to reveal new task: create_files_dirs Signed-off-by: Nico Schottelius --- cdist/config_install.py | 4 ++-- cdist/exec/local.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cdist/config_install.py b/cdist/config_install.py index 3aadca86..280f186c 100644 --- a/cdist/config_install.py +++ b/cdist/config_install.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2010-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -48,7 +48,7 @@ class ConfigInstall(object): self.remote = context.remote # Initialise local directory structure - self.local.create_directories() + self.local.create_files_dirs() # Initialise remote directory structure self.remote.create_directories() diff --git a/cdist/exec/local.py b/cdist/exec/local.py index 4d94789b..bb90ab6c 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -142,7 +142,7 @@ class Local(object): return self.run(command, env, return_output) - def create_context_files_dirs(self): + def create_files_dirs(self): self._create_context_dirs() self._create_conf_path_and_link_conf_dirs() From dcaa70e6be1487942adc687e54473bca8119d4a1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 16:07:00 +0100 Subject: [PATCH 264/412] be consistent in remote Signed-off-by: Nico Schottelius --- cdist/config_install.py | 2 +- cdist/exec/remote.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/config_install.py b/cdist/config_install.py index 280f186c..b7804a10 100644 --- a/cdist/config_install.py +++ b/cdist/config_install.py @@ -50,7 +50,7 @@ class ConfigInstall(object): # Initialise local directory structure self.local.create_files_dirs() # Initialise remote directory structure - self.remote.create_directories() + self.remote.create_files_dirs() self.explorer = core.Explorer(self.context.target_host, self.local, self.remote) self.manifest = core.Manifest(self.context.target_host, self.local) diff --git a/cdist/exec/remote.py b/cdist/exec/remote.py index 487beea3..07c6614b 100644 --- a/cdist/exec/remote.py +++ b/cdist/exec/remote.py @@ -57,7 +57,7 @@ class Remote(object): self.log = logging.getLogger(self.target_host) - def create_directories(self): + def create_files_dirs(self): self.rmdir(self.base_path) self.mkdir(self.base_path) self.mkdir(self.conf_path) From e41aae041a64d378be522a97456a1df93e9d3782 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 16:11:03 +0100 Subject: [PATCH 265/412] fix cache_dir syntax error Signed-off-by: Nico Schottelius --- cdist/context.py | 2 +- cdist/exec/local.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cdist/context.py b/cdist/context.py index 64a8086e..5fec530f 100644 --- a/cdist/context.py +++ b/cdist/context.py @@ -59,7 +59,7 @@ class Context(object): self.temp_dir = tempfile.mkdtemp() self.out_path = os.path.join(self.temp_dir, "out") - self.local = local.Local(self.target_host, self.conf_dirs, self.out_path) + self.local = local.Local(self.target_host, conf_dirs, self.out_path) self.initial_manifest = (initial_manifest or os.path.join(self.local.manifest_path, "init")) diff --git a/cdist/exec/local.py b/cdist/exec/local.py index bb90ab6c..a5e838cb 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -37,7 +37,7 @@ class Local(object): Directly accessing the local side from python code is a bug. """ - def __init__(self, target_host, conf_dirs, out_path, cache_dir): + def __init__(self, target_host, conf_dirs, out_path, cache_dir=None): self.target_host = target_host self.add_conf_dirs = conf_dirs @@ -47,7 +47,7 @@ class Local(object): self._init_permissions() self._init_home_dir() self._init_paths() - self._init_cache_dir() + self._init_cache_dir(cache_dir) self._init_conf_dirs() def _init_home_dir(self): @@ -88,7 +88,8 @@ class Local(object): self.conf_dirs.append(user_conf_dir) # Add user supplied directories - self.conf_dirs.extend(self.add_conf_dirs) + if self.add_conf_dirs: + self.conf_dirs.extend(self.add_conf_dirs) def _init_cache_dir(self, cache_dir): if cache_dir: @@ -166,12 +167,12 @@ class Local(object): for entry in os.listdir(current_dir): rel_entry_path = os.path.join(sub_dir, entry) - src = os.path.join(self.conf_path, entry) - dst = os.path.join(conf_dir, sub_dir, entry) + src = os.path.join(conf_dir, sub_dir, entry) + dst = os.path.join(self.conf_path, entry) # Already exists? remove and link if os.path.exists(dst): - os.ulink(dst) + os.unlink(dst) try: os.symlink(src, dst) From 92d21a46251f00f37cc6855f4f8efa05c154c0b1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 16:14:02 +0100 Subject: [PATCH 266/412] remove init.sample from this place in the distribution Signed-off-by: Nico Schottelius --- cdist/conf/manifest/init.sample | 69 --------------------------------- 1 file changed, 69 deletions(-) delete mode 100755 cdist/conf/manifest/init.sample diff --git a/cdist/conf/manifest/init.sample b/cdist/conf/manifest/init.sample deleted file mode 100755 index fca959e2..00000000 --- a/cdist/conf/manifest/init.sample +++ /dev/null @@ -1,69 +0,0 @@ -# -# This is a sample manifest, but used in real world -# - -# This is debug and should not be in a production environment -# echo "We could access other manifests in $__manifest" - -# Every machine becomes a marker, so sysadmins know that automatic -# configurations are happening -__file /etc/cdist-configured - -case "$__target_host" in - # Everybody has this - localhost) - require="__file/etc/cdist-configured" __link /tmp/cdist-testfile \ - --source /etc/cdist-configured --type symbolic - require="__directory/tmp/cdist-test-dir" __file /tmp/cdist-test-dir/test-file \ - --mode 0750 --owner nobody --group root - __directory /tmp/cdist-test-dir --mode 4777 - - require="__file/etc/cdist-configured __link/tmp/cdist-testfile" \ - __file /tmp/cdist-another-testfile - - ;; - - # - # Examples using different types - # - - # - # Use an alias in /etc/hosts for localhost to use these hosts: - # - # 127.0.0.1 localhost.localdomain localhost cdist-archlinux - # - cdist-archlinux) - # This is the specific package type for pacman - __package_pacman zsh --state installed - - # The __package type autoselect the right type based on the os - __package vim --state installed - - # If the type is a singleton, it does not take an object id - __issue - ;; - # This is how it would look like on gentoo - cdist-gentoo) - # Same stuff for gentoo - __package tree --state installed - ;; - - cdist-debian) - __package_apt atop --state installed - __package apache2 --state removed - ;; - - cdist-redhat) - __issue - __motd - ;; - - # Real machines may be used with their hostname or fqdn, - # depending on how you call cdist-deploy-to - # machine) - # ... - # ;; - # machine.example.org) - # ... - # ;; -esac From e7be0cceab502fb77628230af0d3131b17edbc06 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 16:16:59 +0100 Subject: [PATCH 267/412] big change for pre4 Signed-off-by: Nico Schottelius --- cdist/exec/local.py | 9 +++++++-- docs/changelog | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cdist/exec/local.py b/cdist/exec/local.py index a5e838cb..785d5ff2 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -165,15 +165,20 @@ class Local(object): for sub_dir in [ "explorer", "manifest", "type" ]: current_dir = os.path.join(conf_dir, sub_dir) + # Allow conf dirs to contain only partial content + if not os.path.exists(current_dir): + continue + for entry in os.listdir(current_dir): rel_entry_path = os.path.join(sub_dir, entry) src = os.path.join(conf_dir, sub_dir, entry) - dst = os.path.join(self.conf_path, entry) + dst = os.path.join(self.conf_path, sub_dir, entry) # Already exists? remove and link if os.path.exists(dst): os.unlink(dst) - + + self.log.debug("Linking %s to %s ..." % (src, dst)) try: os.symlink(src, dst) except OSError as e: diff --git a/docs/changelog b/docs/changelog index 242e0c2f..4b77af7a 100644 --- a/docs/changelog +++ b/docs/changelog @@ -7,6 +7,7 @@ Changelog 2.1.0pre4: * Dist: PyPi: Move cdist.py to script/cdist to avoid double import + * Added internal support for multiple configuration directories 2.1.0pre3: 2012-10-30 * Dist: PyPi: Types and explorer included as package data From c25c986992338e0b32de91098619cc8fc74954ec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 16:33:18 +0100 Subject: [PATCH 268/412] re-add sample, but longer name Signed-off-by: Nico Schottelius --- cdist/conf/manifest/sample-from-distribution | 62 ++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 cdist/conf/manifest/sample-from-distribution diff --git a/cdist/conf/manifest/sample-from-distribution b/cdist/conf/manifest/sample-from-distribution new file mode 100755 index 00000000..56d52cf5 --- /dev/null +++ b/cdist/conf/manifest/sample-from-distribution @@ -0,0 +1,62 @@ +## # +## # Sample manifest from cdist distribution +## # +## +## # Every machine becomes a marker, so sysadmins know that automatic +## # configurations are happening +## __file /etc/cdist-configured +## __cdistmarker +## +## case "$__target_host" in +## # Everybody has this +## localhost) +## require="__file/etc/cdist-configured" __link /tmp/cdist-testfile \ +## --source /etc/cdist-configured --type symbolic +## require="__directory/tmp/cdist-test-dir" __file /tmp/cdist-test-dir/test-file \ +## --mode 0750 --owner nobody --group root +## __directory /tmp/cdist-test-dir --mode 4777 +## +## require="__file/etc/cdist-configured __link/tmp/cdist-testfile" \ +## __file /tmp/cdist-another-testfile +## +## ;; +## +## # +## # Use an alias in /etc/hosts for localhost to use these hosts: +## # +## # 127.0.0.1 localhost.localdomain localhost cdist-archlinux +## # +## cdist-archlinux) +## # This is the specific package type for pacman +## __package_pacman zsh --state installed +## +## # The __package type autoselect the right type based on the os +## __package vim --state installed +## +## # If the type is a singleton, it does not take an object id +## __issue +## ;; +## # This is how it would look like on gentoo +## cdist-gentoo) +## # Same stuff for gentoo +## __package tree --state installed +## ;; +## +## cdist-debian) +## __package_apt atop --state installed +## __package apache2 --state removed +## ;; +## +## cdist-redhat) +## __issue +## __motd +## ;; +## +## # Real machines may be used with their hostname or fqdn, +## # depending on how you call cdist +## # ... +## # ;; +## # machine.example.org) +## # ... +## # ;; +## esac From 1d1149deab6a48be34a49384b9afc79e42106af8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 16:36:32 +0100 Subject: [PATCH 269/412] +debug Signed-off-by: Nico Schottelius --- cdist/exec/local.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cdist/exec/local.py b/cdist/exec/local.py index 785d5ff2..d0ff1765 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -162,6 +162,7 @@ class Local(object): # Iterate over all directories and link the to the output dir for conf_dir in self.conf_dirs: + self.log.debug("Checking conf_dir %s ..." % (conf_dir)) for sub_dir in [ "explorer", "manifest", "type" ]: current_dir = os.path.join(conf_dir, sub_dir) From 9ca0d4efe73bfe01b20585f5444ab18d38921f6d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 30 Oct 2012 16:37:02 +0100 Subject: [PATCH 270/412] clarify changes for 2.1.0pre4 Signed-off-by: Nico Schottelius --- docs/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 4b77af7a..bc330818 100644 --- a/docs/changelog +++ b/docs/changelog @@ -7,7 +7,7 @@ Changelog 2.1.0pre4: * Dist: PyPi: Move cdist.py to script/cdist to avoid double import - * Added internal support for multiple configuration directories + * Added support for multiple configuration directories (no documentation) 2.1.0pre3: 2012-10-30 * Dist: PyPi: Types and explorer included as package data From 6af14263e3f1ddefc45cd0ea64e50617910f5c32 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 31 Oct 2012 08:12:01 +0100 Subject: [PATCH 271/412] past Signed-off-by: Nico Schottelius --- docs/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index bc330818..7eecab93 100644 --- a/docs/changelog +++ b/docs/changelog @@ -6,7 +6,7 @@ Changelog 2.1.0pre4: - * Dist: PyPi: Move cdist.py to script/cdist to avoid double import + * Dist: PyPi: Moved cdist.py to script/cdist to avoid double import * Added support for multiple configuration directories (no documentation) 2.1.0pre3: 2012-10-30 From dafc6c601757b8f2a4d7aa1211bddfb5e0f7cdd6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 31 Oct 2012 08:15:09 +0100 Subject: [PATCH 272/412] update changelog date Signed-off-by: Nico Schottelius --- docs/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/changelog b/docs/changelog index 7eecab93..d76f65bb 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,9 +5,9 @@ Changelog * Exception: No braces means author == Nico Schottelius -2.1.0pre4: +2.1.0pre4: 2012-10-31 * Dist: PyPi: Moved cdist.py to script/cdist to avoid double import - * Added support for multiple configuration directories (no documentation) + * Core: Added support for multiple configuration directories (no documentation) 2.1.0pre3: 2012-10-30 * Dist: PyPi: Types and explorer included as package data From 2b22bfc0db25f262a4a369c82a4987c469443c87 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 31 Oct 2012 08:15:23 +0100 Subject: [PATCH 273/412] ignore freecode tempory script used to submit a release Signed-off-by: Nico Schottelius --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6e2d4437..b5f69ec7 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ cdist/version.py /cdist-*.tar.gz /pkg /src +freecode-release From f8b20d58546efddf77d1e4b78a46000958ab9fdb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 31 Oct 2012 08:18:02 +0100 Subject: [PATCH 274/412] skip unecessary merge in dist process Signed-off-by: Nico Schottelius --- build | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/build b/build index a4550f67..0af286f8 100755 --- a/build +++ b/build @@ -168,12 +168,16 @@ notes target_branch=${version%\.*} current_branch=$(git rev-parse --abbrev-ref HEAD) - printf "Press enter to git merge $current_branch into \"$target_branch\" > " - read prompt - git checkout "$target_branch" - git merge "$current_branch" - git checkout "$current_branch" - ;; + if [ "$target_branch" = "$current_branch" ]; then + echo "Skipping merge, already on destination branch" + else + printf "Press enter to git merge $current_branch into \"$target_branch\" > " + read prompt + git checkout "$target_branch" + git merge "$current_branch" + git checkout "$current_branch" + fi + ;; dist-archlinux) ./PKGBUILD.in From 59dd52d55528659956c074d308209d1ffbc83a9d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 31 Oct 2012 08:42:24 +0100 Subject: [PATCH 275/412] include uploading to aur in dist process Signed-off-by: Nico Schottelius --- build | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build b/build index 0af286f8..158e3ef8 100755 --- a/build +++ b/build @@ -180,10 +180,21 @@ notes ;; dist-archlinux) + $0 dist-archlinux-makepkg + $0 dist-archlinux-aur-upload + ;; + + dist-archlinux-makepkg) ./PKGBUILD.in - makepkg -c makepkg -c --source ;; + + dist-archlinux-aur-upload) + version=$($0 changelog-version) + tar=cdist-${version}-1.src.tar.gz + burp -c system "$tar" + ;; + dist-pypi) $0 man $0 version From 876eebe1c7d620f467674c66d69b499bcbe6bdec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 31 Oct 2012 08:52:40 +0100 Subject: [PATCH 276/412] begin to include automatic freecode submissions using cfreecode-api Signed-off-by: Nico Schottelius --- build | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/build b/build index 158e3ef8..e5f252e7 100755 --- a/build +++ b/build @@ -195,6 +195,39 @@ notes burp -c system "$tar" ;; + dist-freecode) + version=$($0 changelog-version) + api_token=$(awk '/machine freecode login/ { print $8 }' ~/.netrc) + + printf "Enter tag list for freecode release %s> " "$version" + read taglist + + printf "Enter changelog for freecode release %s> " "$version" + read changelog + + echo "Submit preview" + cat << eof +tag_list = $taglist +changelog = $changelog +version = $version +eof + printf "Press enter to submit to freecode> " + read dummy + + cat << eof | cfreecode-api cdist + { + "auth_code": "$api_token", + "release": { + "tag_list": "REPLACEME", + "version": "$version", + "changelog": "REPLACEMETOO", + "hidden_from_frontpage": false + } + } +eof + + ;; + dist-pypi) $0 man $0 version From 440c209248026fe3fc1a9078cd15de79c9a70816 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 31 Oct 2012 08:53:17 +0100 Subject: [PATCH 277/412] no need to ignore the file anymore as being piped now Signed-off-by: Nico Schottelius --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index b5f69ec7..6e2d4437 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,3 @@ cdist/version.py /cdist-*.tar.gz /pkg /src -freecode-release From 8f5d1f910f5fb08c79a8b174fcb19755f76408fc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 31 Oct 2012 09:35:08 +0100 Subject: [PATCH 278/412] fix asciidoc title issues (made box out of it) Signed-off-by: Nico Schottelius --- docs/man/man7/cdist-remote-exec-copy.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/man/man7/cdist-remote-exec-copy.text b/docs/man/man7/cdist-remote-exec-copy.text index d789b12d..298891d6 100644 --- a/docs/man/man7/cdist-remote-exec-copy.text +++ b/docs/man/man7/cdist-remote-exec-copy.text @@ -31,7 +31,7 @@ remains as simple as possible. EXAMPLES --------------- +-------- See cdist/other/examples/remote/ for some example implementations. From c836a60a7e6697dfa587b71abcd19ad646b905f3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 31 Oct 2012 09:40:28 +0100 Subject: [PATCH 279/412] correct call to cfreecode-api Signed-off-by: Nico Schottelius --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index e5f252e7..9d7284d7 100755 --- a/build +++ b/build @@ -214,7 +214,7 @@ eof printf "Press enter to submit to freecode> " read dummy - cat << eof | cfreecode-api cdist + cat << eof | cfreecode-api release cdist { "auth_code": "$api_token", "release": { From 3a97ab910abe9a4a068c01a7345ef0dfe639de8f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 10:45:39 +0100 Subject: [PATCH 280/412] begin to split off readme Signed-off-by: Nico Schottelius --- README | 355 +------------------------------------------- docs/web/cdist.mdwn | 353 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 357 insertions(+), 351 deletions(-) create mode 100644 docs/web/cdist.mdwn diff --git a/README b/README index ffd0bcb5..a67e25e3 100644 --- a/README +++ b/README @@ -1,353 +1,6 @@ -[[!meta title="cdist - usable configuration management"]] +cdist +----- - - .. . .x+=:. s - dF @88> z` ^% :8 - '88bu. %8P . = 2.0.4)](man) - -### OS support - -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 - -### Server - - * A posix like shell - * Python (>= 3.2 required) - * SSH client - * Asciidoc (for building the manpages) - -### Client ("target host") - - * A posix like shell - * SSH server - - -## Installation - -### Preparation - -Ensure you have Python 3.2 installed on the machine you use to **deploy to the targets** -(the ***source host***). - -#### Archlinux - -Archlinux already has python >= 3.2, so you only need to do: - - pacman -S python - -#### CentOS - -See the "From source" section - -#### Debian - -For Debian >= wheezy: - - aptitude install python3 - -On squeeze you can add following line in **/etc/apt/sources.list** - - deb http://ftp.debian.org/debian wheezy main - -And add pinning entry in **/etc/apt/preferences.d/wheezy**: - - Package: * - Pin: release n=wheezy - Pin-Priority: 1 - -Please be aware that both **openssh-server** and **openssh-client** might be -removed on **python3.2** installation. You surely want to reinstall them: - - apt-get install -t wheezy openssh-server openssh-client - -For older Debian versions, installing python 3.2 manually is required. - - -#### Fedora - -For Fedora >= 15: - - yum install python3 - -#### FreeBSD - -For the port: - - cd /usr/ports/lang/python32/ && make install clean - -For the package: - - pkg_add -r python32 - -#### Gentoo - -Gentoo only provides python 3.2 in testing packages (http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=3). -If you want to ensure nothing breaks you must set back the python version to what was default before. - - emerge -av =python-3.2.2 --autounmask-write - emerge -av =python-3.2.2 - eselect python list - eselect python list set python3.2 - -#### Max OS X - -You can choose between Homebrew and Macports, either way works: - -[Homebrew](http://mxcl.github.com/homebrew/) variant: - - brew install python3 - -[Macports](http://www.macports.org/install.php) variant: - - port install python32 - ln -s /opt/local/bin/python3.2 /opt/local/bin/python3 - -#### From Source - -For those operating systems not yet support Python 3.2: - - pyversion=3.2.3 - wget http://www.python.org/ftp/python/$pyversion/Python-${pyversion}.tar.bz2 - tar xvfj Python-${pyversion}.tar.bz2 - cd Python-${pyversion} - ./configure - make - sudo make install - -This installs python 3.2 to /usr/local/bin. Ensure this directory is in -your PATH environment variable. - - -### 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. -To install cdist, execute the following commands: - - git clone git://git.schottelius.org/cdist - cd cdist - export PATH=$PATH:$(pwd -P)/bin - - # If you want the manpages - ./build man - export MANPATH=$MANPATH:$(pwd -P)/doc/man - - -### Available versions - -There are at least the following branches available: - - * Development: master - * 2.0: Python rewrite of cdist core [stable branch] - -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) - * 1.3: Support for local and remote code execution (current stable) - * 1.2: Dependencies supported - * 1.1: \_\_file to \_\_file, \_\_directory, \_\_link migration - * 1.0: First official release - -Other branches may be available for features or bugfixes, but they -may vanish at any point. To select a specific branch use - - # Generic code - git checkout -b origin/ - - # Stay on a specific version - version=2.0 - git checkout -b $version origin/$version - -### 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 - -To upgrade cdist in the current branch use - - git pull - - # Also update the manpages - ./build man - export MANPATH=$MANPATH:$(pwd -P)/doc/man - -If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break. -The master branch on the other hand is the development branch and may not be -working, break your setup or eat the tree in your garden. - -### 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 "cdist banner" for fun -* 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 - your code to use **machine** instead. - -### Upgrading from 1.5 to 1.6 - -* If you used **\_\_package_apt --preseed**, you need to use the new - type **\_\_debconf_set_selections** instead. -* The **\_\_package** types accepted either --state deinstalled or - --state uninstaaled. Starting with 1.6, it was made consistently - to --state removed. - -### Upgrading from 1.3 to 1.5 - -No incompatiblities. - -### Upgrading from 1.2 to 1.3 - -Rename **gencode** of every type to **gencode-remote**. - -### Upgrading from 1.1 to 1.2 - -No incompatiblities. - -### Upgrading from 1.0 to 1.1 - -In 1.1 the type **\_\_file** was split into **\_\_directory**, **\_\_file** and -**\_\_link**. The parameter **--type** was removed from **\_\_file**. Thus you -need to replace **\_\_file** calls in your manifests: - - * Remove --type from all \_\_file calls - * If type was symlink, use \_\_link and --type symbolic - * If type was directory, use \_\_directory - - -## Support - -### IRC - -You can join the development ***IRC channel*** -[#cstar on irc.freenode.net](irc://irc.freenode.org/#cstar). - -### Mailing list - -Bug reports, questions, patches, etc. should be send to the -[cdist mailing list](http://l.schottelius.org/mailman/listinfo/cdist). - -### Linkedin - -If you have an account -at [Linked in](http://www.linkedin.com/), -you can join the -[cdist group](http://www.linkedin.com/groups/cdist-configuration-management-3952797). - -### Commercial support - -You can request commercial support for cdist from -[my company](http://firma.schottelius.org/english/). - -## Used by - -If you're using cdist, feel free to send a report to the mailing list. -Interesting information are for instance - - * Which services do you manage? - * How many machines do you manage? - * What are the pros/cons you see in cdist? - * General comments/critics - -### Nico Schottelius, Systems Group ETH Zurich, local.ch and privately - -Yes, I'm actually eating my own dogfood and currently managing - - * [plone](http://plone.org/) (cms) - * [moinmoin](http://moinmo.in/) (wiki) - * [apache](http://httpd.apache.org/) (webserver) - * [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication) - * [nss-pam-ldapd](http://arthurdejong.org/nss-pam-ldapd/) (authentication) - * [ircd-hybrid](http://www.ircd-hybrid.org/) (chat) - * [stunnel](http://stunnel.mirt.net/) (SSL tunnel) - * [mercurial-server](http://www.lshift.net/mercurial-server.html) (version control) - * [xfce](http://www.xfce.org/) (lightweight desktop environment) - * [slim](http://slim.berlios.de/) (graphical login manager for X11) - -with cdist on more than **60** production machines of the -[Systems Group](http://www.systems.ethz.ch) at the -[ETH Zurich](http://www.ethz.ch) as well at home. - -### Steven Armstrong, CBRG ETH Zurich - -The CBRG is managing most of their compute clusters with cdist. - -[[!tag cdist unix]] +For the web documentation have a look at docs/web/. diff --git a/docs/web/cdist.mdwn b/docs/web/cdist.mdwn new file mode 100644 index 00000000..ffd0bcb5 --- /dev/null +++ b/docs/web/cdist.mdwn @@ -0,0 +1,353 @@ +[[!meta title="cdist - usable configuration management"]] + + + .. . .x+=:. s + dF @88> z` ^% :8 + '88bu. %8P . = 2.0.4)](man) + +### OS support + +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 + +### Server + + * A posix like shell + * Python (>= 3.2 required) + * SSH client + * Asciidoc (for building the manpages) + +### Client ("target host") + + * A posix like shell + * SSH server + + +## Installation + +### Preparation + +Ensure you have Python 3.2 installed on the machine you use to **deploy to the targets** +(the ***source host***). + +#### Archlinux + +Archlinux already has python >= 3.2, so you only need to do: + + pacman -S python + +#### CentOS + +See the "From source" section + +#### Debian + +For Debian >= wheezy: + + aptitude install python3 + +On squeeze you can add following line in **/etc/apt/sources.list** + + deb http://ftp.debian.org/debian wheezy main + +And add pinning entry in **/etc/apt/preferences.d/wheezy**: + + Package: * + Pin: release n=wheezy + Pin-Priority: 1 + +Please be aware that both **openssh-server** and **openssh-client** might be +removed on **python3.2** installation. You surely want to reinstall them: + + apt-get install -t wheezy openssh-server openssh-client + +For older Debian versions, installing python 3.2 manually is required. + + +#### Fedora + +For Fedora >= 15: + + yum install python3 + +#### FreeBSD + +For the port: + + cd /usr/ports/lang/python32/ && make install clean + +For the package: + + pkg_add -r python32 + +#### Gentoo + +Gentoo only provides python 3.2 in testing packages (http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=3). +If you want to ensure nothing breaks you must set back the python version to what was default before. + + emerge -av =python-3.2.2 --autounmask-write + emerge -av =python-3.2.2 + eselect python list + eselect python list set python3.2 + +#### Max OS X + +You can choose between Homebrew and Macports, either way works: + +[Homebrew](http://mxcl.github.com/homebrew/) variant: + + brew install python3 + +[Macports](http://www.macports.org/install.php) variant: + + port install python32 + ln -s /opt/local/bin/python3.2 /opt/local/bin/python3 + +#### From Source + +For those operating systems not yet support Python 3.2: + + pyversion=3.2.3 + wget http://www.python.org/ftp/python/$pyversion/Python-${pyversion}.tar.bz2 + tar xvfj Python-${pyversion}.tar.bz2 + cd Python-${pyversion} + ./configure + make + sudo make install + +This installs python 3.2 to /usr/local/bin. Ensure this directory is in +your PATH environment variable. + + +### 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. +To install cdist, execute the following commands: + + git clone git://git.schottelius.org/cdist + cd cdist + export PATH=$PATH:$(pwd -P)/bin + + # If you want the manpages + ./build man + export MANPATH=$MANPATH:$(pwd -P)/doc/man + + +### Available versions + +There are at least the following branches available: + + * Development: master + * 2.0: Python rewrite of cdist core [stable branch] + +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) + * 1.3: Support for local and remote code execution (current stable) + * 1.2: Dependencies supported + * 1.1: \_\_file to \_\_file, \_\_directory, \_\_link migration + * 1.0: First official release + +Other branches may be available for features or bugfixes, but they +may vanish at any point. To select a specific branch use + + # Generic code + git checkout -b origin/ + + # Stay on a specific version + version=2.0 + git checkout -b $version origin/$version + +### 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 + +To upgrade cdist in the current branch use + + git pull + + # Also update the manpages + ./build man + export MANPATH=$MANPATH:$(pwd -P)/doc/man + +If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break. +The master branch on the other hand is the development branch and may not be +working, break your setup or eat the tree in your garden. + +### 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 "cdist banner" for fun +* 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 + your code to use **machine** instead. + +### Upgrading from 1.5 to 1.6 + +* If you used **\_\_package_apt --preseed**, you need to use the new + type **\_\_debconf_set_selections** instead. +* The **\_\_package** types accepted either --state deinstalled or + --state uninstaaled. Starting with 1.6, it was made consistently + to --state removed. + +### Upgrading from 1.3 to 1.5 + +No incompatiblities. + +### Upgrading from 1.2 to 1.3 + +Rename **gencode** of every type to **gencode-remote**. + +### Upgrading from 1.1 to 1.2 + +No incompatiblities. + +### Upgrading from 1.0 to 1.1 + +In 1.1 the type **\_\_file** was split into **\_\_directory**, **\_\_file** and +**\_\_link**. The parameter **--type** was removed from **\_\_file**. Thus you +need to replace **\_\_file** calls in your manifests: + + * Remove --type from all \_\_file calls + * If type was symlink, use \_\_link and --type symbolic + * If type was directory, use \_\_directory + + +## Support + +### IRC + +You can join the development ***IRC channel*** +[#cstar on irc.freenode.net](irc://irc.freenode.org/#cstar). + +### Mailing list + +Bug reports, questions, patches, etc. should be send to the +[cdist mailing list](http://l.schottelius.org/mailman/listinfo/cdist). + +### Linkedin + +If you have an account +at [Linked in](http://www.linkedin.com/), +you can join the +[cdist group](http://www.linkedin.com/groups/cdist-configuration-management-3952797). + +### Commercial support + +You can request commercial support for cdist from +[my company](http://firma.schottelius.org/english/). + +## Used by + +If you're using cdist, feel free to send a report to the mailing list. +Interesting information are for instance + + * Which services do you manage? + * How many machines do you manage? + * What are the pros/cons you see in cdist? + * General comments/critics + +### Nico Schottelius, Systems Group ETH Zurich, local.ch and privately + +Yes, I'm actually eating my own dogfood and currently managing + + * [plone](http://plone.org/) (cms) + * [moinmoin](http://moinmo.in/) (wiki) + * [apache](http://httpd.apache.org/) (webserver) + * [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication) + * [nss-pam-ldapd](http://arthurdejong.org/nss-pam-ldapd/) (authentication) + * [ircd-hybrid](http://www.ircd-hybrid.org/) (chat) + * [stunnel](http://stunnel.mirt.net/) (SSL tunnel) + * [mercurial-server](http://www.lshift.net/mercurial-server.html) (version control) + * [xfce](http://www.xfce.org/) (lightweight desktop environment) + * [slim](http://slim.berlios.de/) (graphical login manager for X11) + +with cdist on more than **60** production machines of the +[Systems Group](http://www.systems.ethz.ch) at the +[ETH Zurich](http://www.ethz.ch) as well at home. + +### Steven Armstrong, CBRG ETH Zurich + +The CBRG is managing most of their compute clusters with cdist. + +[[!tag cdist unix]] From 081d3aea37ab23fad42bc64d83e9ac23cb64ae60 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 11:09:45 +0100 Subject: [PATCH 281/412] remove manifests, which are not needed anymore (in production without them for some months) Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm_gem/manifest | 38 ------------ cdist/conf/type/__rvm_gemset/manifest | 36 ------------ cdist/conf/type/__rvm_ruby/manifest | 83 --------------------------- 3 files changed, 157 deletions(-) delete mode 100755 cdist/conf/type/__rvm_gem/manifest delete mode 100755 cdist/conf/type/__rvm_gemset/manifest delete mode 100755 cdist/conf/type/__rvm_ruby/manifest diff --git a/cdist/conf/type/__rvm_gem/manifest b/cdist/conf/type/__rvm_gem/manifest deleted file mode 100755 index a551472d..00000000 --- a/cdist/conf/type/__rvm_gem/manifest +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# 2012 Evax Software -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# - -gem="$__object_id" -gemset="$(cat "$__object/parameter/gemset")" -ruby="$(echo "$gemset" | cut -d '@' -f 1)" -gemsetname="$(echo "$gemset" | cut -d '@' -f 2)" -user="$(cat "$__object/parameter/user")" -state="$(cat "$__object/explorer/state")" -if [ -f "$__object/parameter/default" ]; then - default="$(cat "$__object/parameter/default")" -else - default="no" - echo $default > "$__object/parameter/default" -fi - -__rvm "$user" --state present -require="__rvm/$user" \ - __rvm_ruby $ruby --user "$user" --state present --default $default -require="__rvm_ruby/$ruby" \ - __rvm_gemset $gemset --user "$user" --state present --default $default diff --git a/cdist/conf/type/__rvm_gemset/manifest b/cdist/conf/type/__rvm_gemset/manifest deleted file mode 100755 index b69395ea..00000000 --- a/cdist/conf/type/__rvm_gemset/manifest +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# -# 2012 Evax Software -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# - -gemset="$__object_id" -ruby="$(echo "$gemset" | cut -d '@' -f 1)" -gemsetname="$(echo "$gemset" | cut -d '@' -f 2)" -user="$(cat "$__object/parameter/user")" -state="$(cat "$__object/explorer/state")" -if [ -f "$__object/parameter/default" ]; then - default="$(cat "$__object/parameter/default")" -else - default="no" - echo $default > "$__object/parameter/default" -fi - -__rvm "$user" --state present -require="__rvm/$user" \ - __rvm_ruby $ruby --user "$user" --state present --default $default - diff --git a/cdist/conf/type/__rvm_ruby/manifest b/cdist/conf/type/__rvm_ruby/manifest deleted file mode 100755 index 581e98a8..00000000 --- a/cdist/conf/type/__rvm_ruby/manifest +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -# -# 2012 Evax Software -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# - -if [ -f "$__object/parameter/default" ]; then - default="$(cat "$__object/parameter/default")" -else - default="no" - echo "$default" > "$__object/parameter/default" -fi - -ruby="$__object_id" -user="$(cat "$__object/parameter/user")" -state="$(cat "$__object/explorer/state")" - -apt_ruby="build-essential openssl libreadline6 libreadline6-dev curl git-core -zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 -libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison -subversion" -apt_jruby="curl g++ openjdk-6-jre-headless" -apt_jruby_head="ant openjdk-6-jdk" -apt_ironruby="curl mono-2.0-devel" - -emerge_ruby="libiconv readline zlib openssl curl git libyaml sqlite libxslt -libtool gcc autoconf automake bison m4" -emerge_jruby="dev-java/sun-jdk dev-java/sun-jre-bin" -emerge_ironruby="dev-lang/mono" - -pacman_ruby="gcc patch curl zlib readline libxml2 libxslt git autoconf -diffutils make libtool bison subversion" -pacman_jruby="jdk jre curl" -pacman_ironruby="mono" - -yum_ruby="gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel -libffi-devel openssl-devel make bzip2 autoconf automake libtool bison -iconv-devel" -yum_jruby="java" - -os="$(cat "$__global/explorer/os")" -case "$os" in - archlinux) type="pacman" ;; - debian|ubuntu) type="apt" ;; - gentoo) type="emerge" ;; - fedora|redhat|centos) type="yum" ;; - *);; -esac -case "$ruby" in - ruby-head*) - deps_list="${type}_ruby_head" - ;; - ruby*) - deps_list="${type}_ruby" - ;; - jruby-head*) - deps_list="${type}_jruby_head" - ;; - jruby*) - deps_list="${type}_jruby" - ;; - ironruby*) - deps_list="${type}_ironruby" - ;; -esac -deps=$(eval echo \$$deps_list) -for p in $deps; do __package_${type} $p --state present; done - -__rvm "$user" --state present From 6771a13758820813af402e47f5c4ace4be854d65 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 13:30:45 +0100 Subject: [PATCH 282/412] pass exec_path from context to local, making it obsolete to manually add the argument to the _link_types_for_emulator Signed-off-by: Nico Schottelius --- cdist/config_install.py | 1 - cdist/context.py | 2 +- cdist/exec/local.py | 15 +++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cdist/config_install.py b/cdist/config_install.py index b7804a10..2c1edc44 100644 --- a/cdist/config_install.py +++ b/cdist/config_install.py @@ -79,7 +79,6 @@ class ConfigInstall(object): def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" - self.local.link_emulator(self.context.exec_path) self.explorer.run_global_explorers(self.local.global_explorer_out_path) self.manifest.run_initial_manifest(self.context.initial_manifest) diff --git a/cdist/context.py b/cdist/context.py index 5fec530f..d3e30dec 100644 --- a/cdist/context.py +++ b/cdist/context.py @@ -59,7 +59,7 @@ class Context(object): self.temp_dir = tempfile.mkdtemp() self.out_path = os.path.join(self.temp_dir, "out") - self.local = local.Local(self.target_host, conf_dirs, self.out_path) + self.local = local.Local(self.target_host, conf_dirs, self.out_path, self.exec_path) self.initial_manifest = (initial_manifest or os.path.join(self.local.manifest_path, "init")) diff --git a/cdist/exec/local.py b/cdist/exec/local.py index d0ff1765..d75917f5 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -37,11 +37,13 @@ class Local(object): Directly accessing the local side from python code is a bug. """ - def __init__(self, target_host, conf_dirs, out_path, cache_dir=None): + def __init__(self, target_host, conf_dirs, out_path, exec_path, cache_dir=None): self.target_host = target_host - self.add_conf_dirs = conf_dirs self.out_path = out_path + self.exec_path = exec_path + + self._add_conf_dirs = conf_dirs self._init_log() self._init_permissions() @@ -88,8 +90,8 @@ class Local(object): self.conf_dirs.append(user_conf_dir) # Add user supplied directories - if self.add_conf_dirs: - self.conf_dirs.extend(self.add_conf_dirs) + if self._add_conf_dirs: + self.conf_dirs.extend(self._add_conf_dirs) def _init_cache_dir(self, cache_dir): if cache_dir: @@ -146,6 +148,7 @@ class Local(object): def create_files_dirs(self): self._create_context_dirs() self._create_conf_path_and_link_conf_dirs() + self._link_types_for_emulator() def _create_context_dirs(self): self.mkdir(self.out_path) @@ -185,9 +188,9 @@ class Local(object): except OSError as e: raise cdist.Error("Linking %s %s to %s failed: %s" % (sub_dir, src, dst, e.__str__())) - def link_emulator(self, exec_path): + def _link_types_for_emulator(self): """Link emulator to types""" - src = os.path.abspath(exec_path) + src = os.path.abspath(self.exec_path) for cdist_type in core.CdistType.list_types(self.type_path): dst = os.path.join(self.bin_path, cdist_type.name) self.log.debug("Linking emulator: %s to %s", src, dst) From 4946fe26541a91b815bc553344adf82b970d0786 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 13:34:48 +0100 Subject: [PATCH 283/412] adjust paths in test --- cdist/test/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/test/__init__.py b/cdist/test/__init__.py index faa9dc2d..f8e71287 100644 --- a/cdist/test/__init__.py +++ b/cdist/test/__init__.py @@ -24,9 +24,9 @@ import unittest import tempfile cdist_base_path = os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../")) + os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../../")) -cdist_exec_path = os.path.join(cdist_base_path, "bin/cdist") +cdist_exec_path = os.path.join(cdist_base_path, "scripts/cdist") class CdistTestCase(unittest.TestCase): From 32a94a0f89e0ba8002ff0135e66e425d4fd93c96 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 13:35:52 +0100 Subject: [PATCH 284/412] adjust emulator test to pass exec_path to local Signed-off-by: Nico Schottelius --- cdist/test/emulator/__init__.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py index ff18fe87..679fd149 100644 --- a/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -45,8 +45,8 @@ class EmulatorTestCase(test.CdistTestCase): os.close(handle) self.target_host = 'localhost' out_path = self.temp_dir - self.local = local.Local(self.target_host, local_base_path, out_path) - self.local.create_directories() + self.local = local.Local(self.target_host, local_base_path, out_path, test.cdist_exec_path) + self.local.create_files_dirs() self.env = { 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), '__target_host': self.target_host, @@ -113,9 +113,8 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase): self.target_host = 'localhost' out_path = self.temp_dir _local_base_path = fixtures - self.local = local.Local(self.target_host, _local_base_path, out_path) - self.local.create_directories() - self.local.link_emulator(cdist.test.cdist_exec_path) + self.local = local.Local(self.target_host, _local_base_path, out_path, test.cdist_exec_path) + self.local.create_files_dirs() self.manifest = core.Manifest(self.target_host, self.local) def tearDown(self): @@ -140,9 +139,8 @@ class ArgumentsTestCase(test.CdistTestCase): handle, self.script = self.mkstemp(dir=self.temp_dir) os.close(handle) _local_base_path = fixtures - self.local = local.Local(self.target_host, _local_base_path, out_path) - self.local.create_directories() - self.local.link_emulator(test.cdist_exec_path) + self.local = local.Local(self.target_host, _local_base_path, out_path, test.cdist_exec_path) + self.local.create_files_dirs() self.env = { 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), '__target_host': self.target_host, From 6eddaaf09057b26157c27fe3ef3f1606b89d7ef5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 13:46:01 +0100 Subject: [PATCH 285/412] rename parameter correctly to add_conf_dirs Signed-off-by: Nico Schottelius --- cdist/exec/local.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/exec/local.py b/cdist/exec/local.py index d75917f5..2406c8d5 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -37,13 +37,13 @@ class Local(object): Directly accessing the local side from python code is a bug. """ - def __init__(self, target_host, conf_dirs, out_path, exec_path, cache_dir=None): + def __init__(self, target_host, out_path, exec_path, add_conf_dirs=[], cache_dir=None): self.target_host = target_host self.out_path = out_path self.exec_path = exec_path - self._add_conf_dirs = conf_dirs + self._add_conf_dirs = add_conf_dirs self._init_log() self._init_permissions() From d944f2ac19985dd76c8bdca0b3be34536a5db51a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 14:13:52 +0100 Subject: [PATCH 286/412] add pythonpath for testing --- build | 1 + 1 file changed, 1 insertion(+) diff --git a/build b/build index 9d7284d7..57dc275b 100755 --- a/build +++ b/build @@ -302,6 +302,7 @@ eof test) shift # skip t + export PYTHONPATH="$(pwd -P)" if [ $# -lt 1 ]; then python3 -m cdist.test From 6ecfb28d9346830c8c643b0b36aac3597cfacb7a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 14:14:52 +0100 Subject: [PATCH 287/412] name parameter correctly add_conf_dirs Signed-off-by: Nico Schottelius --- cdist/context.py | 4 ++-- scripts/cdist | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cdist/context.py b/cdist/context.py index d3e30dec..92e683a3 100644 --- a/cdist/context.py +++ b/cdist/context.py @@ -38,7 +38,7 @@ class Context(object): remote_copy, remote_exec, initial_manifest=False, - conf_dirs=[], + add_conf_dirs=[], exec_path=sys.argv[0], debug=False): @@ -59,7 +59,7 @@ class Context(object): self.temp_dir = tempfile.mkdtemp() self.out_path = os.path.join(self.temp_dir, "out") - self.local = local.Local(self.target_host, conf_dirs, self.out_path, self.exec_path) + self.local = local.Local(self.target_host, self.out_path, self.exec_path, add_conf_dirs=add_conf_dirs) self.initial_manifest = (initial_manifest or os.path.join(self.local.manifest_path, "init")) diff --git a/scripts/cdist b/scripts/cdist index d5ea06d0..00ebbf18 100755 --- a/scripts/cdist +++ b/scripts/cdist @@ -172,7 +172,7 @@ def configinstall_onehost(host, args, mode, parallel): remote_copy=args.remote_copy, remote_exec=args.remote_exec, initial_manifest=args.manifest, - conf_dirs=args.conf_dir, + add_conf_dirs=args.conf_dir, exec_path=sys.argv[0], debug=args.debug) From 1177286d4e678547bc1df228e4e97008fe12551f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 14:42:55 +0100 Subject: [PATCH 288/412] cleanups of tests (especially exec.local) Signed-off-by: Nico Schottelius --- cdist/test/exec/local.py | 29 +++++++++++++++-------------- cdist/test/manifest/__init__.py | 3 +-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cdist/test/exec/local.py b/cdist/test/exec/local.py index e6f2c2b0..ebfc64af 100644 --- a/cdist/test/exec/local.py +++ b/cdist/test/exec/local.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -25,9 +26,6 @@ import shutil import string import random -#import logging -#logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s') - import cdist from cdist import test from cdist.exec import local @@ -35,17 +33,22 @@ 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(test.CdistTestCase): def setUp(self): - self.temp_dir = self.mkdtemp() + target_host = 'localhost' + self.temp_dir = self.mkdtemp() self.out_path = self.temp_dir - self.base_path = local_base_path - self.local = local.Local(target_host, self.base_path, self.out_path) + + self.local = local.Local( + target_host=target_host, + out_path=self.out_path, + exec_path=test.cdist_exec_path + ) + + self.home_dir = os.path.join(os.environ['HOME'], ".cdist") def tearDown(self): shutil.rmtree(self.temp_dir) @@ -53,10 +56,7 @@ class LocalTestCase(test.CdistTestCase): ### 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")) + self.assertEqual(self.local.cache_path, os.path.join(self.home_dir, "cache")) def test_global_explorer_path(self): self.assertEqual(self.local.global_explorer_path, os.path.join(self.base_path, "conf", "explorer")) @@ -117,7 +117,8 @@ class LocalTestCase(test.CdistTestCase): self.local.rmdir(temp_dir) self.assertFalse(os.path.isdir(temp_dir)) - def test_create_directories(self): - self.local.create_directories() + def test_create_files_dirs(self): + self.local.create_files_dirs() self.assertTrue(os.path.isdir(self.local.out_path)) self.assertTrue(os.path.isdir(self.local.bin_path)) + self.assertTrue(os.path.isdir(self.local.conf_path)) diff --git a/cdist/test/manifest/__init__.py b/cdist/test/manifest/__init__.py index a9846b1d..61a815a9 100644 --- a/cdist/test/manifest/__init__.py +++ b/cdist/test/manifest/__init__.py @@ -49,8 +49,7 @@ class ManifestTestCase(test.CdistTestCase): self.target_host = 'localhost' out_path = self.temp_dir self.local = local.Local(self.target_host, local_base_path, out_path) - self.local.create_directories() - self.local.link_emulator(cdist.test.cdist_exec_path) + self.local.create_files_dirs() self.manifest = manifest.Manifest(self.target_host, self.local) self.log = logging.getLogger(self.target_host) From 69a38443328c93d6ae30ed8f50433f9b3694f35a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 14:48:51 +0100 Subject: [PATCH 289/412] fix some tests and fix home_dir lookup Signed-off-by: Nico Schottelius --- cdist/exec/local.py | 2 +- cdist/test/exec/local.py | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/cdist/exec/local.py b/cdist/exec/local.py index 2406c8d5..4a9660ef 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -54,7 +54,7 @@ class Local(object): def _init_home_dir(self): if 'HOME' in os.environ: - self.home_dir = os.environ['HOME'] + self.home_dir = os.path.join(os.environ['HOME'], ".cdist") else: self.home_dir = None diff --git a/cdist/test/exec/local.py b/cdist/test/exec/local.py index ebfc64af..f74302df 100644 --- a/cdist/test/exec/local.py +++ b/cdist/test/exec/local.py @@ -58,14 +58,8 @@ class LocalTestCase(test.CdistTestCase): def test_cache_path(self): self.assertEqual(self.local.cache_path, os.path.join(self.home_dir, "cache")) - 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_conf_path(self): + self.assertEqual(self.local.conf_path, os.path.join(self.out_path, "conf")) def test_out_path(self): self.assertEqual(self.local.out_path, self.out_path) @@ -81,6 +75,18 @@ class LocalTestCase(test.CdistTestCase): ### /test api + ### test internal implementation + + def test_global_explorer_path(self): + self.assertEqual(self.local.global_explorer_path, os.path.join(self.out_path, "conf", "explorer")) + + def test_manifest_path(self): + self.assertEqual(self.local.manifest_path, os.path.join(self.out_path, "conf", "manifest")) + + def test_type_path(self): + self.assertEqual(self.local.type_path, os.path.join(self.out_path, "conf", "type")) + + ### other tests def test_run_success(self): self.local.run(['/bin/true']) @@ -98,7 +104,7 @@ class LocalTestCase(test.CdistTestCase): handle, script = self.mkstemp(dir=self.temp_dir) with os.fdopen(handle, "w") as fd: fd.writelines(["#!/bin/sh\n", "/bin/false"]) - self.assertRaises(local.LocalScriptError, self.local.run_script, script) + self.assertRaises(cdist.Error, self.local.run_script, script) def test_run_script_get_output(self): handle, script = self.mkstemp(dir=self.temp_dir) From af241653670318d514212d903b995ec9202a64f8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 15:17:46 +0100 Subject: [PATCH 290/412] introduce home_dir as a property Signed-off-by: Nico Schottelius --- cdist/exec/local.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cdist/exec/local.py b/cdist/exec/local.py index 4a9660ef..2f870033 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -47,16 +47,20 @@ class Local(object): self._init_log() self._init_permissions() - self._init_home_dir() self._init_paths() self._init_cache_dir(cache_dir) self._init_conf_dirs() - def _init_home_dir(self): + @property + def dist_conf_dir(self): + return os.path.abspath(os.path.join(os.path.dirname(cdist.__file__), "conf")) + + @property + def home_dir(self): if 'HOME' in os.environ: - self.home_dir = os.path.join(os.environ['HOME'], ".cdist") + return os.path.join(os.environ['HOME'], ".cdist") else: - self.home_dir = None + return = None def _init_log(self): self.log = logging.getLogger(self.target_host) @@ -81,13 +85,12 @@ class Local(object): self.conf_dirs = [] # Comes with the distribution - system_conf_dir = os.path.join(os.path.dirname(cdist.__file__), "conf") + system_conf_dir = os.path.abspath(os.path.join(os.path.dirname(cdist.__file__), "conf")) self.conf_dirs.append(system_conf_dir) # Is the default place for user created explorer, type and manifest if self.home_dir: - user_conf_dir = os.path.join(self.home_dir, ".cdist") - self.conf_dirs.append(user_conf_dir) + self.conf_dirs.append(self.home_dir) # Add user supplied directories if self._add_conf_dirs: @@ -152,13 +155,12 @@ class Local(object): def _create_context_dirs(self): self.mkdir(self.out_path) + self.mkdir(self.conf_path) self.mkdir(self.global_explorer_out_path) self.mkdir(self.bin_path) def _create_conf_path_and_link_conf_dirs(self): - self.mkdir(self.conf_path) - # Link destination directories for sub_dir in [ "explorer", "manifest", "type" ]: self.mkdir(os.path.join(self.conf_path, sub_dir)) From 528901bdeee3f963d42e30e0408edeb459b56732 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 15:20:10 +0100 Subject: [PATCH 291/412] update a lot of tests for new exec.local Signed-off-by: Nico Schottelius --- cdist/core/cdist_type.py | 1 - cdist/exec/local.py | 2 +- cdist/test/autorequire/__init__.py | 6 +++-- cdist/test/code/__init__.py | 2 +- cdist/test/emulator/__init__.py | 23 +++++++++++-------- cdist/test/exec/local.py | 36 ++++++++++++++++++++++++++++++ cdist/test/explorer/__init__.py | 2 +- 7 files changed, 57 insertions(+), 15 deletions(-) diff --git a/cdist/core/cdist_type.py b/cdist/core/cdist_type.py index 86f3ced1..44e192fc 100644 --- a/cdist/core/cdist_type.py +++ b/cdist/core/cdist_type.py @@ -24,7 +24,6 @@ import os import cdist - class NoSuchTypeError(cdist.Error): def __init__(self, type_path, type_absolute_path): self.type_path = type_path diff --git a/cdist/exec/local.py b/cdist/exec/local.py index 2f870033..7ef11458 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -60,7 +60,7 @@ class Local(object): if 'HOME' in os.environ: return os.path.join(os.environ['HOME'], ".cdist") else: - return = None + return None def _init_log(self): self.log = logging.getLogger(self.target_host) diff --git a/cdist/test/autorequire/__init__.py b/cdist/test/autorequire/__init__.py index 2263cbf9..bd763fd3 100644 --- a/cdist/test/autorequire/__init__.py +++ b/cdist/test/autorequire/__init__.py @@ -34,7 +34,7 @@ import cdist.context import os.path as op my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') -local_base_path = fixtures +add_conf_dir = op.join(fixtures, 'conf') class AutorequireTestCase(test.CdistTestCase): @@ -48,7 +48,9 @@ class AutorequireTestCase(test.CdistTestCase): self.context = cdist.context.Context( target_host=self.target_host, - base_path=local_base_path, + remote_copy='/bin/true', + remote_exec='/bin/true', + add_conf_dirs=add_conf_dir, exec_path=test.cdist_exec_path, debug=False) self.config = config.Config(self.context) diff --git a/cdist/test/code/__init__.py b/cdist/test/code/__init__.py index 8a8583d7..8bc937b0 100644 --- a/cdist/test/code/__init__.py +++ b/cdist/test/code/__init__.py @@ -44,7 +44,7 @@ class CodeTestCase(test.CdistTestCase): self.local_base_path = local_base_path self.out_path = self.mkdtemp() self.local = local.Local(self.target_host, self.local_base_path, self.out_path) - self.local.create_directories() + self.local.create_files_dirs() self.remote_base_path = self.mkdtemp() self.user = getpass.getuser() diff --git a/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py index 679fd149..1b77bdb6 100644 --- a/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -33,8 +33,6 @@ from cdist import core from cdist import config import cdist.context -local_base_path = test.cdist_base_path - class EmulatorTestCase(test.CdistTestCase): def setUp(self): @@ -45,7 +43,10 @@ class EmulatorTestCase(test.CdistTestCase): os.close(handle) self.target_host = 'localhost' out_path = self.temp_dir - self.local = local.Local(self.target_host, local_base_path, out_path, test.cdist_exec_path) + self.local = local.Local( + target_host=self.target_host, + out_path=out_path, + exec_path=test.cdist_exec_path) self.local.create_files_dirs() self.env = { 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), @@ -112,8 +113,10 @@ class AutoRequireEmulatorTestCase(test.CdistTestCase): self.temp_dir = self.mkdtemp() self.target_host = 'localhost' out_path = self.temp_dir - _local_base_path = fixtures - self.local = local.Local(self.target_host, _local_base_path, out_path, test.cdist_exec_path) + self.local = local.Local( + target_host=self.target_host, + out_path=out_path, + exec_path=test.cdist_exec_path) self.local.create_files_dirs() self.manifest = core.Manifest(self.target_host, self.local) @@ -138,9 +141,13 @@ class ArgumentsTestCase(test.CdistTestCase): out_path = self.temp_dir handle, self.script = self.mkstemp(dir=self.temp_dir) os.close(handle) - _local_base_path = fixtures - self.local = local.Local(self.target_host, _local_base_path, out_path, test.cdist_exec_path) + + self.local = local.Local( + target_host=self.target_host, + out_path=out_path, + exec_path=test.cdist_exec_path) self.local.create_files_dirs() + self.env = { 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), '__target_host': self.target_host, @@ -228,13 +235,11 @@ class StdinTestCase(test.CdistTestCase): self.target_host = 'localhost' self.temp_dir = self.mkdtemp() os.environ['__cdist_out_dir'] = self.temp_dir - local_base_path = fixtures self.context = cdist.context.Context( target_host=self.target_host, remote_copy='scp -o User=root -q', remote_exec='ssh -o User=root -q', - base_path=local_base_path, exec_path=test.cdist_exec_path, debug=False) self.config = config.Config(self.context) diff --git a/cdist/test/exec/local.py b/cdist/test/exec/local.py index f74302df..687c13a5 100644 --- a/cdist/test/exec/local.py +++ b/cdist/test/exec/local.py @@ -33,6 +33,7 @@ from cdist.exec import local import os.path as op my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') +conf_dir = op.join(fixtures, "conf") class LocalTestCase(test.CdistTestCase): @@ -86,6 +87,41 @@ class LocalTestCase(test.CdistTestCase): def test_type_path(self): self.assertEqual(self.local.type_path, os.path.join(self.out_path, "conf", "type")) + def test_dist_conf_dir_linking(self): + """Ensure that links are correctly created for types included in distribution""" + + test_type="__file" + + link_test_local = local.Local( + target_host='localhost', + out_path=self.out_path, + exec_path=test.cdist_exec_path, + ) + + link_test_local._create_conf_path_and_link_conf_dirs() + + our_type_dir = os.path.join(link_test_local.type_path, test_type) + + self.assertTrue(os.path.isdir(our_type_dir)) + + def test_added_conf_dir_linking(self): + """Ensure that links are correctly created for types in added conf directories""" + + test_type="__cdist_test_type" + + link_test_local = local.Local( + target_host='localhost', + out_path=self.out_path, + exec_path=test.cdist_exec_path, + add_conf_dirs=[conf_dir] + ) + + link_test_local._create_conf_path_and_link_conf_dirs() + + our_type_dir = os.path.join(link_test_local.type_path, test_type) + + self.assertTrue(os.path.isdir(our_type_dir)) + ### other tests def test_run_success(self): diff --git a/cdist/test/explorer/__init__.py b/cdist/test/explorer/__init__.py index 257ad8a9..528cb786 100644 --- a/cdist/test/explorer/__init__.py +++ b/cdist/test/explorer/__init__.py @@ -45,7 +45,7 @@ class ExplorerClassTestCase(test.CdistTestCase): self.local_base_path = local_base_path self.out_path = self.mkdtemp() self.local = local.Local(self.target_host, self.local_base_path, self.out_path) - self.local.create_directories() + self.local.create_files_dirs() self.remote_base_path = self.mkdtemp() self.user = getpass.getuser() From 0dd4942d96e6636bdfd05f3d70c78d960dbdc169 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 15:25:57 +0100 Subject: [PATCH 292/412] pre5 updates Signed-off-by: Nico Schottelius --- docs/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog b/docs/changelog index d76f65bb..db6dbe59 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,6 +5,9 @@ Changelog * Exception: No braces means author == Nico Schottelius +2.1.0pre5: 2012-11-01 + * Core: First round of tests updated to work with multiple configuration directories + 2.1.0pre4: 2012-10-31 * Dist: PyPi: Moved cdist.py to script/cdist to avoid double import * Core: Added support for multiple configuration directories (no documentation) From 8a40ba789a13ee55b8879aa18a1c5f7a66af3996 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 15:39:36 +0100 Subject: [PATCH 293/412] include freecode dist into dist process Signed-off-by: Nico Schottelius --- build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build b/build index 57dc275b..0dca69c9 100755 --- a/build +++ b/build @@ -108,6 +108,8 @@ case "$1" in $0 pub + $0 dist-freecode + $0 dist-post ;; @@ -214,7 +216,7 @@ eof printf "Press enter to submit to freecode> " read dummy - cat << eof | cfreecode-api release cdist + cat << eof | cfreecode-api release-add cdist { "auth_code": "$api_token", "release": { From f264cf9f6cfb1678377c57d7ee7d9e5ce464a1fe Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 17:45:34 +0100 Subject: [PATCH 294/412] insert the actual data into the release process for freecode Signed-off-by: Nico Schottelius --- build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build b/build index 0dca69c9..def72470 100755 --- a/build +++ b/build @@ -220,9 +220,9 @@ eof { "auth_code": "$api_token", "release": { - "tag_list": "REPLACEME", + "tag_list": "$taglist", "version": "$version", - "changelog": "REPLACEMETOO", + "changelog": "$changelog", "hidden_from_frontpage": false } } From 5ec586f7641f22a0d4fa565e48dd3eb3a9519a25 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 18:21:56 +0100 Subject: [PATCH 295/412] begin to cleanup explorer test case Signed-off-by: Nico Schottelius --- cdist/test/__init__.py | 4 ++++ cdist/test/explorer/__init__.py | 40 ++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/cdist/test/__init__.py b/cdist/test/__init__.py index f8e71287..3d9b1a2e 100644 --- a/cdist/test/__init__.py +++ b/cdist/test/__init__.py @@ -28,9 +28,13 @@ cdist_base_path = os.path.abspath( cdist_exec_path = os.path.join(cdist_base_path, "scripts/cdist") +global_fixtures_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "fixtures")) class CdistTestCase(unittest.TestCase): + remote_exec = os.path.join(global_fixtures_dir, "remote", "exec") + remote_copy = os.path.join(global_fixtures_dir, "remote", "copy") + def mkdtemp(self, **kwargs): return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) diff --git a/cdist/test/explorer/__init__.py b/cdist/test/explorer/__init__.py index 528cb786..7801df5d 100644 --- a/cdist/test/explorer/__init__.py +++ b/cdist/test/explorer/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -35,35 +35,45 @@ from cdist.core import explorer import os.path as op my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') -local_base_path = fixtures +conf_dir = op.join(fixtures, "conf") class ExplorerClassTestCase(test.CdistTestCase): def setUp(self): self.target_host = 'localhost' - self.local_base_path = local_base_path - self.out_path = self.mkdtemp() - self.local = local.Local(self.target_host, self.local_base_path, self.out_path) + self.temp_dir = self.mkdtemp() + self.out_path = os.path.join(self.temp_dir, "out") + self.remote_base_path = os.path.join(self.temp_dir, "remote") + + self.local = local.Local( + target_host=self.target_host, + out_path=self.out_path, + exec_path=test.cdist_exec_path, + add_conf_dirs=[conf_dir]) + self.local.create_files_dirs() - self.remote_base_path = self.mkdtemp() - self.user = getpass.getuser() - remote_exec = "ssh -o User=%s -q" % self.user - remote_copy = "scp -o User=%s -q" % self.user - self.remote = remote.Remote(self.target_host, self.remote_base_path, remote_exec, remote_copy) + self.remote = remote.Remote( + self.target_host, + self.remote_base_path, + self.remote_exec, + self.remote_copy) - self.explorer = explorer.Explorer(self.target_host, self.local, self.remote) + self.explorer = explorer.Explorer( + self.target_host, + self.local, + self.remote) self.log = logging.getLogger(self.target_host) def tearDown(self): - shutil.rmtree(self.out_path) - shutil.rmtree(self.remote_base_path) + shutil.rmtree(self.temp_dir) def test_list_global_explorer_names(self): - expected = ['foobar', 'global'] - self.assertEqual(self.explorer.list_global_explorer_names(), expected) + names = self.explorer.list_global_explorer_names() + self.assertIn("foobar", names) + self.assertIn("global", names) def test_transfer_global_explorers(self): self.explorer.transfer_global_explorers() From 09fd8090324f0e706a11fb2ae9c091ec977dd42d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 18:22:52 +0100 Subject: [PATCH 296/412] add new remote handler which turns remote into local ;-) Signed-off-by: Nico Schottelius --- cdist/test/fixtures/remote/copy | 28 ++++++++++++++++++++++++++++ cdist/test/fixtures/remote/exec | 29 +++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100755 cdist/test/fixtures/remote/copy create mode 100755 cdist/test/fixtures/remote/exec diff --git a/cdist/test/fixtures/remote/copy b/cdist/test/fixtures/remote/copy new file mode 100755 index 00000000..475155da --- /dev/null +++ b/cdist/test/fixtures/remote/copy @@ -0,0 +1,28 @@ +#!/bin/sh +# +# 2012 Nico Schottelius (nico-cdist 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 . +# +# + +recursive=$1; shift +src=$1; shift +dst=$1; shift + +dst=$(echo $dst | sed "s/^${__target_host}://") + +cp "$recursive" "$src" "$dst" diff --git a/cdist/test/fixtures/remote/exec b/cdist/test/fixtures/remote/exec new file mode 100755 index 00000000..ac658313 --- /dev/null +++ b/cdist/test/fixtures/remote/exec @@ -0,0 +1,29 @@ +#!/bin/sh +# +# 2012 Nico Schottelius (nico-cdist 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 . +# +# +# same as cdist default +# +# Usage: +# cdist config --remote-exec "/path/to/this/script" target_host +# + +target_host=$1; shift +# echo "Executing $@ (for $target_host)" +/bin/sh -c "$@" From 184e2bd9c56a751bfc6fa6ed300618fac36f6719 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 1 Nov 2012 18:25:29 +0100 Subject: [PATCH 297/412] add new remote that does local calls Signed-off-by: Nico Schottelius --- cdist/test/fixtures/remote | 1 + docs/changelog | 3 +++ other/examples/remote/local/README | 3 +++ .../test/fixtures/remote => other/examples/remote/local}/copy | 0 .../test/fixtures/remote => other/examples/remote/local}/exec | 0 5 files changed, 7 insertions(+) create mode 120000 cdist/test/fixtures/remote create mode 100644 other/examples/remote/local/README rename {cdist/test/fixtures/remote => other/examples/remote/local}/copy (100%) rename {cdist/test/fixtures/remote => other/examples/remote/local}/exec (100%) diff --git a/cdist/test/fixtures/remote b/cdist/test/fixtures/remote new file mode 120000 index 00000000..c5db6358 --- /dev/null +++ b/cdist/test/fixtures/remote @@ -0,0 +1 @@ +../../../other/examples/remote/local \ No newline at end of file diff --git a/docs/changelog b/docs/changelog index db6dbe59..2cdf6cbf 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,6 +5,9 @@ Changelog * Exception: No braces means author == Nico Schottelius +2.1.0pre6: + * New Example: Turn remote calls into local calls (used for unittesting) + 2.1.0pre5: 2012-11-01 * Core: First round of tests updated to work with multiple configuration directories diff --git a/other/examples/remote/local/README b/other/examples/remote/local/README new file mode 100644 index 00000000..cfd350f9 --- /dev/null +++ b/other/examples/remote/local/README @@ -0,0 +1,3 @@ +This effectively turns remote calling into local calling. + +Probably most useful for the unittesting. diff --git a/cdist/test/fixtures/remote/copy b/other/examples/remote/local/copy similarity index 100% rename from cdist/test/fixtures/remote/copy rename to other/examples/remote/local/copy diff --git a/cdist/test/fixtures/remote/exec b/other/examples/remote/local/exec similarity index 100% rename from cdist/test/fixtures/remote/exec rename to other/examples/remote/local/exec From 90fad0fe83176dd5a07fc690f527c97dba34c32b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 14:15:14 +0100 Subject: [PATCH 298/412] create remote base in test - needed? Signed-off-by: Nico Schottelius --- cdist/test/explorer/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cdist/test/explorer/__init__.py b/cdist/test/explorer/__init__.py index 7801df5d..bb39d006 100644 --- a/cdist/test/explorer/__init__.py +++ b/cdist/test/explorer/__init__.py @@ -45,6 +45,7 @@ class ExplorerClassTestCase(test.CdistTestCase): self.temp_dir = self.mkdtemp() self.out_path = os.path.join(self.temp_dir, "out") self.remote_base_path = os.path.join(self.temp_dir, "remote") + os.makedirs(self.remote_base_path) self.local = local.Local( target_host=self.target_host, From ccb3c8780f1091d3ed889b5e63ffe900e8f26c0c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 14:16:27 +0100 Subject: [PATCH 299/412] ++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 05d6d96b..e5abb6b5 100644 --- a/doc/changelog +++ b/doc/changelog @@ -4,7 +4,7 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -2.0.15: +2.0.15: 2012-11-02 * Core: Make variable __object_name available in type explorers (Steven Armtrong) * New Type: __qemu_img * New Type: __line From afa5f884c5bd73ec3c07b5920145fe50c67f6fe7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 14:25:55 +0100 Subject: [PATCH 300/412] rought migration document Signed-off-by: Nico Schottelius --- docs/dev/logs/2012-11-02.migration_to_2.1 | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 docs/dev/logs/2012-11-02.migration_to_2.1 diff --git a/docs/dev/logs/2012-11-02.migration_to_2.1 b/docs/dev/logs/2012-11-02.migration_to_2.1 new file mode 100644 index 00000000..2ef8df22 --- /dev/null +++ b/docs/dev/logs/2012-11-02.migration_to_2.1 @@ -0,0 +1,40 @@ +create a new branch to ensure nothing breaks + + % git checkout -b 2.1_merge + +fetch latest upstream changes (change origin if you use another +remote name for upstream cdist) + + % git fetch -v origin + +Now try to merge upstream into the new branch. + + + % git merge origin/2.1 + +fix any conflicts that may have been occurred due to local changes +and then **git add** and *git commit** those changes. + +As the types have a new location, **cdist/conf/** now, you have to move +your own types there as well: + + % git mv conf/type/* cdist/conf/ + +The manifest location also changed, so move this one as well: + + % git mv conf/manifest/* cdist/conf/manifest/ + +Use **git status** to review the changes and ensure they +are in the git database: + + % git commit -m "Move types and manifests for 2.1 migration" + +This should be everything necessary for a 2.1 migration. Test the result +by running cdist on one of your staging hosts: + + % ./bin/cdist config -v staging-host + + +You can now cleanup the empty conf/ directory: + + % rmdir conf/* && rmdir conf From 6e107fa92c121482be9f9804b57b154116fc697b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 16:27:28 +0100 Subject: [PATCH 301/412] Export PYTHONPATH so it's available for the emulator Signed-off-by: Nico Schottelius --- bin/cdist | 6 +++++- docs/changelog | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/cdist b/bin/cdist index 5a6ce92f..dfe4fa00 100755 --- a/bin/cdist +++ b/bin/cdist @@ -26,4 +26,8 @@ dir=${0%/*} # Ensure version is present - the bundled/shipped version contains a static version, # the git version contains a dynamic version "$dir/../build" version -PYTHONPATH="${dir}/../" "$dir/../scripts/cdist" "$@" + +libdir=$(cd "${dir}/../" && pwd -P) +export PYTHONPATH="${libdir}" + +"$dir/../scripts/cdist" "$@" diff --git a/docs/changelog b/docs/changelog index 9b6a391f..3062d44b 100644 --- a/docs/changelog +++ b/docs/changelog @@ -6,6 +6,7 @@ Changelog 2.1.0pre6: * New Example: Turn remote calls into local calls (used for unittesting) + * Core: Export PYTHONPATH, it's also needed by emulator 2.1.0pre5: 2012-11-01 * Core: First round of tests updated to work with multiple configuration directories From 384a20ffbca66330279837cccc742fb9e7459ede Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 16:58:52 +0100 Subject: [PATCH 302/412] building ruby requires bzip2 to be present to extract the tar.bz2 Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm_ruby/manifest | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 cdist/conf/type/__rvm_ruby/manifest diff --git a/cdist/conf/type/__rvm_ruby/manifest b/cdist/conf/type/__rvm_ruby/manifest new file mode 100755 index 00000000..65cf80a1 --- /dev/null +++ b/cdist/conf/type/__rvm_ruby/manifest @@ -0,0 +1,25 @@ +#!/bin/sh +# +# 2012 Nico Schottelius (nico-cdist at schottelius.org) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# +# + +# Required packages for building ruby +for package in bzip2; do + __package --state present +done From 5eac7512a5fd613e99586a422e8d68d6106f3af5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 17:04:00 +0100 Subject: [PATCH 303/412] fix dependencies for __rvm_ruby Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm_ruby/manifest | 2 +- docs/changelog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cdist/conf/type/__rvm_ruby/manifest b/cdist/conf/type/__rvm_ruby/manifest index 65cf80a1..6d5f4977 100755 --- a/cdist/conf/type/__rvm_ruby/manifest +++ b/cdist/conf/type/__rvm_ruby/manifest @@ -20,6 +20,6 @@ # # Required packages for building ruby -for package in bzip2; do +for package in bzip2 gcc make; do __package --state present done diff --git a/docs/changelog b/docs/changelog index 3062d44b..f848d83c 100644 --- a/docs/changelog +++ b/docs/changelog @@ -7,6 +7,7 @@ Changelog 2.1.0pre6: * New Example: Turn remote calls into local calls (used for unittesting) * Core: Export PYTHONPATH, it's also needed by emulator + * Type __rvm_ruby: Add clean package dependencies 2.1.0pre5: 2012-11-01 * Core: First round of tests updated to work with multiple configuration directories From 13fc5aa8f5b1a3a92b59fe00c6e7d53bd6158c8f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 17:15:16 +0100 Subject: [PATCH 304/412] use shortcut version to exit if nothing is to be done Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm_gem/gencode-remote | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/cdist/conf/type/__rvm_gem/gencode-remote b/cdist/conf/type/__rvm_gem/gencode-remote index 34a69624..0b855fc0 100755 --- a/cdist/conf/type/__rvm_gem/gencode-remote +++ b/cdist/conf/type/__rvm_gem/gencode-remote @@ -1,6 +1,7 @@ #!/bin/sh # # 2012 Evax Software +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -25,19 +26,20 @@ gemsetname="$(echo "$gemset" | cut -d '@' -f 2)" state_is="$(cat "$__object/explorer/state")" user="$(cat "$__object/parameter/user")" state_should="$(cat "$__object/parameter/state")" -if [ "$state_is" != "$state_should" ]; then - case "$state_should" in - present) - cat << DONE + +[ "$state_is" = "$state_should" ] && exit 0 + +case "$state_should" in + present) + cat << DONE su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" rvm use $gemset; gem install $gem" DONE - ;; - absent) - cat << DONE + ;; + absent) + cat << DONE su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" rvm use $gemset; gem uninstall $gem" DONE - ;; - esac -fi + ;; +esac From d97f6794d0cf65a839c22dcb71c781ee79ef6ba4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 17:16:25 +0100 Subject: [PATCH 305/412] run rvm as user, not as root Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm_gem/gencode-remote | 6 ++---- docs/changelog | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cdist/conf/type/__rvm_gem/gencode-remote b/cdist/conf/type/__rvm_gem/gencode-remote index 0b855fc0..3aef45ef 100755 --- a/cdist/conf/type/__rvm_gem/gencode-remote +++ b/cdist/conf/type/__rvm_gem/gencode-remote @@ -32,14 +32,12 @@ state_should="$(cat "$__object/parameter/state")" case "$state_should" in present) cat << DONE -su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" -rvm use $gemset; gem install $gem" +su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm; rvm use $gemset; gem install $gem"\" DONE ;; absent) cat << DONE -su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" -rvm use $gemset; gem uninstall $gem" +su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm; rvm use $gemset; gem uninstall $gem"\" DONE ;; esac diff --git a/docs/changelog b/docs/changelog index f848d83c..a2c78210 100644 --- a/docs/changelog +++ b/docs/changelog @@ -7,7 +7,8 @@ Changelog 2.1.0pre6: * New Example: Turn remote calls into local calls (used for unittesting) * Core: Export PYTHONPATH, it's also needed by emulator - * Type __rvm_ruby: Add clean package dependencies + * Bugfix Type __rvm_ruby: Add clean package dependencies + * Bugfix Type __rvm_gem: Run rvm as user, not as root 2.1.0pre5: 2012-11-01 * Core: First round of tests updated to work with multiple configuration directories From c779e16fe23c6e3bf340ecde633bae4972893058 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 17:18:57 +0100 Subject: [PATCH 306/412] __rvm: use shortcut version Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm/gencode-remote | 23 ++++++++++++----------- docs/changelog | 1 + 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cdist/conf/type/__rvm/gencode-remote b/cdist/conf/type/__rvm/gencode-remote index aa6ef647..dbc6ba60 100755 --- a/cdist/conf/type/__rvm/gencode-remote +++ b/cdist/conf/type/__rvm/gencode-remote @@ -1,6 +1,7 @@ #!/bin/sh # # 2012 Evax Software +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -21,20 +22,20 @@ user="$__object_id" state_is="$(cat "$__object/explorer/state")" state_should="$(cat "$__object/parameter/state")" -if [ "$state_is" != "$state_should" ]; then - case "$state_should" in - present) - cat << DONE + +[ "$state_is" = "$state_should" ] && exit 0 + +case "$state_should" in + present) + cat << DONE su - $user -c "unset rvm_path; unset rvm_bin_path; unset rvm_prefix; unset rvm_version; curl -L get.rvm.io | bash -s stable" DONE - ;; - absent) - cat << DONE + ;; + absent) + cat << DONE su - $user -c "rm -Rf \"\\\$HOME/.rvm\"; sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" > \"\\\$HOME/.bashrc.cdist-tmp\" mv \"\\\$HOME/.bashrc.cdist-tmp\" \"\\\$HOME/.bashrc\"" - DONE - ;; - esac -fi + ;; +esac diff --git a/docs/changelog b/docs/changelog index a2c78210..e9423925 100644 --- a/docs/changelog +++ b/docs/changelog @@ -9,6 +9,7 @@ Changelog * Core: Export PYTHONPATH, it's also needed by emulator * Bugfix Type __rvm_ruby: Add clean package dependencies * Bugfix Type __rvm_gem: Run rvm as user, not as root + * Cleanup Type __rvm: Use shortcut version 2.1.0pre5: 2012-11-01 * Core: First round of tests updated to work with multiple configuration directories From d5955bbb4d0f0e341cd3be258d7c1ac59b0c4ea9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 17:19:30 +0100 Subject: [PATCH 307/412] reference dependency package as well Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm_ruby/manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__rvm_ruby/manifest b/cdist/conf/type/__rvm_ruby/manifest index 6d5f4977..db8fd830 100755 --- a/cdist/conf/type/__rvm_ruby/manifest +++ b/cdist/conf/type/__rvm_ruby/manifest @@ -21,5 +21,5 @@ # Required packages for building ruby for package in bzip2 gcc make; do - __package --state present + __package "$package" --state present done From df88d98ea05565fa64452c9eb7ab816454849e3a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 17:35:13 +0100 Subject: [PATCH 308/412] many cleanups to __rvm* types Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm_gem/gencode-remote | 7 ++-- cdist/conf/type/__rvm_gemset/explorer/state | 6 ++-- cdist/conf/type/__rvm_gemset/gencode-remote | 37 ++++++++++----------- docs/changelog | 2 +- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/cdist/conf/type/__rvm_gem/gencode-remote b/cdist/conf/type/__rvm_gem/gencode-remote index 3aef45ef..1fe6e78e 100755 --- a/cdist/conf/type/__rvm_gem/gencode-remote +++ b/cdist/conf/type/__rvm_gem/gencode-remote @@ -1,5 +1,4 @@ -#!/bin/sh -# +#!/bin/sh # # 2012 Evax Software # 2012 Nico Schottelius (nico-cdist at schottelius.org) # @@ -32,12 +31,12 @@ state_should="$(cat "$__object/parameter/state")" case "$state_should" in present) cat << DONE -su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm; rvm use $gemset; gem install $gem"\" +su - "$user" -c 'source ~/.rvm/scripts/rvm; rvm use "$gemset"; gem install "$gem"' DONE ;; absent) cat << DONE -su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm; rvm use $gemset; gem uninstall $gem"\" +su - "$user" -c 'source ~/.rvm/scripts/rvm; rvm use "$gemset"; gem uninstall "$gem"' DONE ;; esac diff --git a/cdist/conf/type/__rvm_gemset/explorer/state b/cdist/conf/type/__rvm_gemset/explorer/state index fbf11830..c8d573b5 100755 --- a/cdist/conf/type/__rvm_gemset/explorer/state +++ b/cdist/conf/type/__rvm_gemset/explorer/state @@ -22,13 +22,13 @@ gemset="$__object_id" ruby="$(echo "$gemset" | cut -d '@' -f 1)" gemsetname="$(echo "$gemset" | cut -d '@' -f2)" user="$(cat "$__object/parameter/user")" -if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then +if su - "$user" -c "[ ! -d ~/.rvm ]" ; then echo "absent" exit 0 fi -if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\" +if su - "$user" -c "source ~/.rvm/scripts/rvm rvm list | grep -q $ruby"; then - if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\" + if su - "$user" -c "source ~/.rvm/scripts/rvm rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname"; then echo "present" exit 0 diff --git a/cdist/conf/type/__rvm_gemset/gencode-remote b/cdist/conf/type/__rvm_gemset/gencode-remote index 1604538d..1fd14061 100755 --- a/cdist/conf/type/__rvm_gemset/gencode-remote +++ b/cdist/conf/type/__rvm_gemset/gencode-remote @@ -1,6 +1,7 @@ #!/bin/sh # # 2012 Evax Software +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -25,29 +26,27 @@ state_is="$(cat "$__object/explorer/state")" user="$(cat "$__object/parameter/user")" default="$(cat "$__object/parameter/default" 2>/dev/null || true)" state_should="$(cat "$__object/parameter/state")" -if [ "$state_is" != "$state_should" ]; then - case "$state_should" in - present) - cat << DONE -su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" -rvm $gemset --create" + +[ "$state_is" = "$state_should" ] && exit 0 + +case "$state_should" in + present) + cat << DONE +su - "$user" -c "source ~/.rvm/scripts/rvm; rvm $gemset --create" DONE - case "$default" in + case "$default" in no) ;; *) - cat << DONE -su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" -rvm use --default $gemset" + cat << DONE +su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use --default $gemset" DONE ;; - esac - ;; - absent) - cat << DONE -su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\" -rvm use $ruby; rvm --force gemset delete $gemsetname" + esac + ;; + absent) + cat << DONE +su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use $ruby; rvm --force gemset delete $gemsetname" DONE - ;; - esac -fi + ;; +esac diff --git a/docs/changelog b/docs/changelog index e9423925..b91b01c7 100644 --- a/docs/changelog +++ b/docs/changelog @@ -9,7 +9,7 @@ Changelog * Core: Export PYTHONPATH, it's also needed by emulator * Bugfix Type __rvm_ruby: Add clean package dependencies * Bugfix Type __rvm_gem: Run rvm as user, not as root - * Cleanup Type __rvm: Use shortcut version + * Cleanup Type __rvm, __rvm_gemset: Use shortcut version 2.1.0pre5: 2012-11-01 * Core: First round of tests updated to work with multiple configuration directories From 0eac132b83fe4ea44517fe9f051412cbd1552c8d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 21:46:08 +0100 Subject: [PATCH 309/412] adjust gemset explorer to work with new rvm version (fixes #108) See https://github.com/wayneeseguin/rvm/issues/1285 Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm_gemset/explorer/state | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cdist/conf/type/__rvm_gemset/explorer/state b/cdist/conf/type/__rvm_gemset/explorer/state index c8d573b5..fa643a6e 100755 --- a/cdist/conf/type/__rvm_gemset/explorer/state +++ b/cdist/conf/type/__rvm_gemset/explorer/state @@ -22,14 +22,14 @@ gemset="$__object_id" ruby="$(echo "$gemset" | cut -d '@' -f 1)" gemsetname="$(echo "$gemset" | cut -d '@' -f2)" user="$(cat "$__object/parameter/user")" -if su - "$user" -c "[ ! -d ~/.rvm ]" ; then + +if [ ! -e "~$user/.rvm/scripts/rvm" ] ; then echo "absent" exit 0 fi -if su - "$user" -c "source ~/.rvm/scripts/rvm -rvm list | grep -q $ruby"; then - if su - "$user" -c "source ~/.rvm/scripts/rvm -rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname"; then + +if su - "$user" -c 'source ~/.rvm/scripts/rvm; rvm list strings | grep -q "^$ruby\$"'; then + if su - "$user" -c 'source ~/.rvm/scripts/rvm; rvm use "$ruby" > /dev/null; rvm gemset list strings | cut -f 1 -d " " | grep -q "^$gemsetname\$"'; then echo "present" exit 0 fi From 5308d2cfe7363414be071b889ef6e93a9e800776 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 22:35:52 +0100 Subject: [PATCH 310/412] link to role from database Signed-off-by: Nico Schottelius --- cdist/conf/type/__postgres_database/man.text | 1 + 1 file changed, 1 insertion(+) diff --git a/cdist/conf/type/__postgres_database/man.text b/cdist/conf/type/__postgres_database/man.text index 06cb736f..d01ca8f6 100644 --- a/cdist/conf/type/__postgres_database/man.text +++ b/cdist/conf/type/__postgres_database/man.text @@ -36,6 +36,7 @@ __postgres_database mydbname --state present --owner mydbusername SEE ALSO -------- - cdist-type(7) +- cdist-type__postgres_role(7) COPYING From 03d224c74c7578f555562480026437d8a7d72401 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 22:43:19 +0100 Subject: [PATCH 311/412] add hint to db from role Signed-off-by: Nico Schottelius --- cdist/conf/type/__postgres_role/man.text | 1 + 1 file changed, 1 insertion(+) diff --git a/cdist/conf/type/__postgres_role/man.text b/cdist/conf/type/__postgres_role/man.text index bcc7b5d7..9b917060 100644 --- a/cdist/conf/type/__postgres_role/man.text +++ b/cdist/conf/type/__postgres_role/man.text @@ -49,6 +49,7 @@ __postgres_role dbcustomer --state present --password 'bla' --createdb true SEE ALSO -------- - cdist-type(7) +- cdist-type__postgres_database(7) - http://www.postgresql.org/docs/current/static/sql-createrole.html From b6f61a632f0d49e8f90f8adafb25afda149b0167 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 22:56:45 +0100 Subject: [PATCH 312/412] __postgres_role: switch to boolean, use shortcut version Signed-off-by: Nico Schottelius --- .../conf/type/__postgres_role/gencode-remote | 45 +++++++++---------- cdist/conf/type/__postgres_role/man.text | 13 ++++-- .../type/__postgres_role/parameter/boolean | 5 +++ .../type/__postgres_role/parameter/optional | 5 --- docs/changelog | 4 ++ 5 files changed, 38 insertions(+), 34 deletions(-) create mode 100644 cdist/conf/type/__postgres_role/parameter/boolean diff --git a/cdist/conf/type/__postgres_role/gencode-remote b/cdist/conf/type/__postgres_role/gencode-remote index a3280c09..c9de4707 100755 --- a/cdist/conf/type/__postgres_role/gencode-remote +++ b/cdist/conf/type/__postgres_role/gencode-remote @@ -22,33 +22,28 @@ name="$__object_id" state_is="$(cat "$__object/explorer/state")" state_should="$(cat "$__object/parameter/state")" -if [ "$state_is" != "$state_should" ]; then - case "$state_should" in - present) - optional="password - login - createdb - createrole - superuser" - for parameter in $optional; do - if [ -f "$__object/parameter/$parameter" ]; then - value="$(cat "$__object/parameter/$parameter")" - eval $parameter=$value +[ "$state_is" = "$state_should" ] && exit 0 + +case "$state_should" in + present) + if [ -f "$__object/parameter/password" ]; then + password="$(cat "$__object/parameter/$parameter")" + fi + booleans="" + for boolean in login createdb createrole superuser; do + if [ ! -f "$__object/parameter/$boolean" ]; then + boolean="no${boolean}" fi - done + upper=$(echo $boolean | tr '[a-z]' '[A-Z]') + booleans="$booleans $upper" + done [ -n "$password" ] && password="PASSWORD '$password'" - [ "$login" = "true" ] && login="LOGIN" || login="NOLOGIN" - [ "$createdb" = "true" ] && createdb="CREATEDB" || createdb="NOCREATEDB" - [ "$createrole" = "true" ] && createrole="CREATEROLE" || createrole="NOCREATEROLE" - [ "$superuser" = "true" ] && superuser="SUPERUSER" || superuser="NOSUPERUSER" - [ "$inherit" = "true" ] && inherit="INHERIT" || inherit="NOINHERIT" - cmd="CREATE ROLE $name WITH $password $login $createdb $createrole $superuser $inherit" + cmd="CREATE ROLE $name WITH $password $booleans" echo "su - postgres -c \"psql -c \\\"$cmd\\\"\"" - ;; - absent) - echo "su - postgres -c \"dropuser \\\"$name\\\"\"" - ;; - esac -fi + ;; + absent) + echo "su - postgres -c \"dropuser \\\"$name\\\"\"" + ;; +esac diff --git a/cdist/conf/type/__postgres_role/man.text b/cdist/conf/type/__postgres_role/man.text index 9b917060..4f13fa53 100644 --- a/cdist/conf/type/__postgres_role/man.text +++ b/cdist/conf/type/__postgres_role/man.text @@ -21,17 +21,22 @@ state:: OPTIONAL PARAMETERS ------------------- -All optional parameter map directly to the corresponding postgres createrole +All parameter map directly to the corresponding postgres createrole parameters. password:: + +BOOLEAN PARAMETERS +------------------ +All parameter map directly to the corresponding postgres createrole +parameters. + login:: createdb:: createrole:: superuser:: inherit:: - EXAMPLES -------- @@ -40,9 +45,9 @@ __postgres_role myrole --state present __postgres_role myrole --state present --password 'secret' -__postgres_role admin --state present --password 'very-secret' --superuser true +__postgres_role admin --state present --password 'very-secret' --superuser -__postgres_role dbcustomer --state present --password 'bla' --createdb true +__postgres_role dbcustomer --state present --password 'bla' --createdb -------------------------------------------------------------------------------- diff --git a/cdist/conf/type/__postgres_role/parameter/boolean b/cdist/conf/type/__postgres_role/parameter/boolean new file mode 100644 index 00000000..a581b3fd --- /dev/null +++ b/cdist/conf/type/__postgres_role/parameter/boolean @@ -0,0 +1,5 @@ +login +createdb +createrole +superuser +inherit diff --git a/cdist/conf/type/__postgres_role/parameter/optional b/cdist/conf/type/__postgres_role/parameter/optional index c5abb57f..f3097ab1 100644 --- a/cdist/conf/type/__postgres_role/parameter/optional +++ b/cdist/conf/type/__postgres_role/parameter/optional @@ -1,6 +1 @@ password -login -createdb -createrole -superuser -inherit diff --git a/docs/changelog b/docs/changelog index b91b01c7..56750722 100644 --- a/docs/changelog +++ b/docs/changelog @@ -10,6 +10,10 @@ Changelog * Bugfix Type __rvm_ruby: Add clean package dependencies * Bugfix Type __rvm_gem: Run rvm as user, not as root * Cleanup Type __rvm, __rvm_gemset: Use shortcut version + * Bugfix __rvm_gemset: Correctly check for gemsets + * Cleanup Type __postgres_database, __postgres_role: Reference each other + in documentation + * Cleanp Type __postgres_role: Use boolean parameters where appropriate 2.1.0pre5: 2012-11-01 * Core: First round of tests updated to work with multiple configuration directories From 2d69eb07c198e46ece48cda8c0142d6002d5dfcb Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 2 Nov 2012 22:57:23 +0100 Subject: [PATCH 313/412] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog b/docs/changelog index 56750722..1df72293 100644 --- a/docs/changelog +++ b/docs/changelog @@ -14,6 +14,7 @@ Changelog * Cleanup Type __postgres_database, __postgres_role: Reference each other in documentation * Cleanp Type __postgres_role: Use boolean parameters where appropriate + * Cleanp Type __postgres_role: Use shortcut version 2.1.0pre5: 2012-11-01 * Core: First round of tests updated to work with multiple configuration directories From 1db1168c9ab09919efe49e37dc0cac3b1a6a04dd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 5 Nov 2012 21:42:39 +0100 Subject: [PATCH 314/412] move doc into new location Signed-off-by: Nico Schottelius --- {doc => docs}/dev/logs/2012-05-23.urls | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {doc => docs}/dev/logs/2012-05-23.urls (100%) diff --git a/doc/dev/logs/2012-05-23.urls b/docs/dev/logs/2012-05-23.urls similarity index 100% rename from doc/dev/logs/2012-05-23.urls rename to docs/dev/logs/2012-05-23.urls From 43061dc1b3068ab239f6eee78b8ea3ebc23895b7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 5 Nov 2012 22:44:20 +0100 Subject: [PATCH 315/412] +releasedate Signed-off-by: Nico Schottelius --- docs/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 1df72293..6a3e29ba 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,7 +4,7 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -2.1.0pre6: +2.1.0pre6: 2012-11-05 * New Example: Turn remote calls into local calls (used for unittesting) * Core: Export PYTHONPATH, it's also needed by emulator * Bugfix Type __rvm_ruby: Add clean package dependencies From 9bdb715b7d3b75b733db15a4198576a96d936719 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 16:42:18 +0100 Subject: [PATCH 316/412] ensure all parameters for exec are executed Signed-off-by: Nico Schottelius --- other/examples/remote/local/copy | 1 - other/examples/remote/local/exec | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/other/examples/remote/local/copy b/other/examples/remote/local/copy index 475155da..644fee15 100755 --- a/other/examples/remote/local/copy +++ b/other/examples/remote/local/copy @@ -24,5 +24,4 @@ src=$1; shift dst=$1; shift dst=$(echo $dst | sed "s/^${__target_host}://") - cp "$recursive" "$src" "$dst" diff --git a/other/examples/remote/local/exec b/other/examples/remote/local/exec index ac658313..838513a9 100755 --- a/other/examples/remote/local/exec +++ b/other/examples/remote/local/exec @@ -18,12 +18,6 @@ # along with cdist. If not, see . # # -# same as cdist default -# -# Usage: -# cdist config --remote-exec "/path/to/this/script" target_host -# target_host=$1; shift -# echo "Executing $@ (for $target_host)" -/bin/sh -c "$@" +echo "$@" | /bin/sh From 4a67d768d5655f9c7bdc1df0ac0a31685d38fd63 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 16:47:51 +0100 Subject: [PATCH 317/412] fix all explorer test cases Signed-off-by: Nico Schottelius --- cdist/test/explorer/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cdist/test/explorer/__init__.py b/cdist/test/explorer/__init__.py index bb39d006..266a1073 100644 --- a/cdist/test/explorer/__init__.py +++ b/cdist/test/explorer/__init__.py @@ -60,6 +60,7 @@ class ExplorerClassTestCase(test.CdistTestCase): self.remote_base_path, self.remote_exec, self.remote_copy) + self.remote.create_files_dirs() self.explorer = explorer.Explorer( self.target_host, @@ -83,14 +84,20 @@ class ExplorerClassTestCase(test.CdistTestCase): self.assertEqual(sorted(os.listdir(source)), sorted(os.listdir(destination))) def test_run_global_explorer(self): + """Checkt that running ONE global explorer works""" self.explorer.transfer_global_explorers() output = self.explorer.run_global_explorer('global') self.assertEqual(output, 'global\n') def test_run_global_explorers(self): + """Ensure output is created for every global explorer""" out_path = self.mkdtemp() + self.explorer.run_global_explorers(out_path) - self.assertEqual(sorted(os.listdir(out_path)), sorted(['foobar', 'global'])) + names = sorted(self.explorer.list_global_explorer_names()) + output = sorted(os.listdir(out_path)) + + self.assertEqual(names, output) shutil.rmtree(out_path) def test_list_type_explorer_names(self): From 04bd5d88c36482b82f50adad7928cb3409137df4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 16:58:30 +0100 Subject: [PATCH 318/412] Fix tests for code Signed-off-by: Nico Schottelius --- cdist/exec/remote.py | 2 +- cdist/test/code/__init__.py | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cdist/exec/remote.py b/cdist/exec/remote.py index 07c6614b..d4d2cb2b 100644 --- a/cdist/exec/remote.py +++ b/cdist/exec/remote.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # diff --git a/cdist/test/code/__init__.py b/cdist/test/code/__init__.py index 8bc937b0..473c4b39 100644 --- a/cdist/test/code/__init__.py +++ b/cdist/test/code/__init__.py @@ -34,23 +34,27 @@ 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 +conf_dir = op.join(fixtures, 'conf') class CodeTestCase(test.CdistTestCase): def setUp(self): self.target_host = 'localhost' - self.local_base_path = local_base_path self.out_path = self.mkdtemp() - self.local = local.Local(self.target_host, self.local_base_path, self.out_path) + + self.local = local.Local( + target_host=self.target_host, + out_path = self.out_path, + exec_path = cdist.test.cdist_exec_path, + add_conf_dirs=[conf_dir]) self.local.create_files_dirs() 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 + remote_exec = self.remote_exec + remote_copy = self.remote_copy self.remote = remote.Remote(self.target_host, self.remote_base_path, remote_exec, remote_copy) + self.remote.create_files_dirs() self.code = code.Code(self.target_host, self.local, self.remote) From 8dfbb4a9dd7bad57566c7d9021524244b16cbb8f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 16:59:21 +0100 Subject: [PATCH 319/412] ++changes for next version Signed-off-by: Nico Schottelius --- docs/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog b/docs/changelog index 6a3e29ba..16e6e25d 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,6 +4,9 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius +2.1.0pre7: + * Core: Tests for "cdist.code" work again + 2.1.0pre6: 2012-11-05 * New Example: Turn remote calls into local calls (used for unittesting) * Core: Export PYTHONPATH, it's also needed by emulator From bb1a8d8e661eb04f3d972451e279521b520b8ea6 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 17:01:20 +0100 Subject: [PATCH 320/412] fixup manifest tests Signed-off-by: Nico Schottelius --- cdist/test/code/__init__.py | 1 + cdist/test/manifest/__init__.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cdist/test/code/__init__.py b/cdist/test/code/__init__.py index 473c4b39..f5d445ab 100644 --- a/cdist/test/code/__init__.py +++ b/cdist/test/code/__init__.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # diff --git a/cdist/test/manifest/__init__.py b/cdist/test/manifest/__init__.py index 61a815a9..0de04743 100644 --- a/cdist/test/manifest/__init__.py +++ b/cdist/test/manifest/__init__.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -37,8 +38,7 @@ 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 - +conf_dir = op.join(fixtures, 'conf') class ManifestTestCase(test.CdistTestCase): @@ -48,8 +48,13 @@ class ManifestTestCase(test.CdistTestCase): self.temp_dir = self.mkdtemp() self.target_host = 'localhost' out_path = self.temp_dir - self.local = local.Local(self.target_host, local_base_path, out_path) + self.local = local.Local( + target_host=self.target_host, + out_path=out_path, + exec_path = cdist.test.cdist_exec_path, + add_conf_dirs=[conf_dir]) self.local.create_files_dirs() + self.manifest = manifest.Manifest(self.target_host, self.local) self.log = logging.getLogger(self.target_host) From 474d901fdad4bc319b08a3bdc49e19e396d52b50 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 17:02:05 +0100 Subject: [PATCH 321/412] ++changes next version Signed-off-by: Nico Schottelius --- docs/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 16e6e25d..3f1dec49 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,7 +5,7 @@ Changelog * Exception: No braces means author == Nico Schottelius 2.1.0pre7: - * Core: Tests for "cdist.code" work again + * Core: Tests for "test.code", "test.manifest" work again 2.1.0pre6: 2012-11-05 * New Example: Turn remote calls into local calls (used for unittesting) From c47d0fae1c67f576e810304eb4b004ce807f03d8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 17:28:26 +0100 Subject: [PATCH 322/412] fix autorequire test case and fix cdist_base_path test assignment Signed-off-by: Nico Schottelius --- cdist/context.py | 2 +- cdist/test/__init__.py | 4 ++-- cdist/test/autorequire/__init__.py | 16 +++++++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/cdist/context.py b/cdist/context.py index 92e683a3..2855f228 100644 --- a/cdist/context.py +++ b/cdist/context.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # -# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2010-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # diff --git a/cdist/test/__init__.py b/cdist/test/__init__.py index 3d9b1a2e..a8c6103b 100644 --- a/cdist/test/__init__.py +++ b/cdist/test/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -24,7 +24,7 @@ import unittest import tempfile cdist_base_path = os.path.abspath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../../")) + os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../")) cdist_exec_path = os.path.join(cdist_base_path, "scripts/cdist") diff --git a/cdist/test/autorequire/__init__.py b/cdist/test/autorequire/__init__.py index bd763fd3..4b47b06b 100644 --- a/cdist/test/autorequire/__init__.py +++ b/cdist/test/autorequire/__init__.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -36,7 +37,6 @@ my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') add_conf_dir = op.join(fixtures, 'conf') - class AutorequireTestCase(test.CdistTestCase): def setUp(self): @@ -44,15 +44,21 @@ class AutorequireTestCase(test.CdistTestCase): os.environ = os.environ.copy() self.target_host = 'localhost' self.temp_dir = self.mkdtemp() - os.environ['__cdist_out_dir'] = self.temp_dir + + self.out_dir = os.path.join(self.temp_dir, "out") + self.remote_out_dir = os.path.join(self.temp_dir, "remote") + + os.environ['__cdist_out_dir'] = self.out_dir + os.environ['__cdist_remote_out_dir'] = self.remote_out_dir self.context = cdist.context.Context( target_host=self.target_host, - remote_copy='/bin/true', - remote_exec='/bin/true', - add_conf_dirs=add_conf_dir, + remote_copy=self.remote_copy, + remote_exec=self.remote_exec, + add_conf_dirs=[add_conf_dir], exec_path=test.cdist_exec_path, debug=False) + self.config = config.Config(self.context) def tearDown(self): From e4024736689b2695f11ae20327c4794644e2ad77 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 21:32:20 +0100 Subject: [PATCH 323/412] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 3f1dec49..93c3cf69 100644 --- a/docs/changelog +++ b/docs/changelog @@ -5,7 +5,8 @@ Changelog * Exception: No braces means author == Nico Schottelius 2.1.0pre7: - * Core: Tests for "test.code", "test.manifest" work again + * Core: Tests for autorequire, code, manifest work again + * Core: Print error message on missing initial manifest 2.1.0pre6: 2012-11-05 * New Example: Turn remote calls into local calls (used for unittesting) From a22e729a3cf7ddab5465b311be602ee36eb095ce Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 21:32:37 +0100 Subject: [PATCH 324/412] raise special error on missing manifest Signed-off-by: Nico Schottelius --- cdist/core/manifest.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/cdist/core/manifest.py b/cdist/core/manifest.py index 5faeccd1..ecc4a490 100644 --- a/cdist/core/manifest.py +++ b/cdist/core/manifest.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -25,6 +25,20 @@ import os import cdist +class NoInitialManifestError(cdist.Error): + """ + Display missing initial manifest + """ + + def __init__(self, manifest_path): + if os.path.islink(manifest_path): + self.message = "%s -> %s" (manifest_path, os.path.realpath(manifest_path)) + else: + self.message = manifest_path + + def __str__(self): + return "Initial manifest missing: %s" % self.message + ''' common: runs only locally, does not need remote @@ -84,6 +98,11 @@ class Manifest(object): env['__manifest'] = self.local.manifest_path env['__cdist_manifest'] = script self.log.info("Running initial manifest " + self.local.manifest_path) + + if not os.path.isfile(self.local.manifest_path): + print("fooooobar") + raise NoInitialManifestError(self.local.manifest_path) + self.local.run_script(script, env=env) def run_type_manifest(self, cdist_object): From 866f23ea2cc1d4f6b9961f5c892efcae2e2caddf Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 21:32:54 +0100 Subject: [PATCH 325/412] inject conf_dir for emulator test Signed-off-by: Nico Schottelius --- cdist/test/emulator/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py index 1b77bdb6..871083f8 100644 --- a/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -33,6 +34,12 @@ from cdist import core from cdist import config import cdist.context +import os.path as op +my_dir = op.abspath(op.dirname(__file__)) +fixtures = op.join(my_dir, 'fixtures') +conf_dir = op.join(fixtures, 'conf') + + class EmulatorTestCase(test.CdistTestCase): def setUp(self): @@ -46,7 +53,8 @@ class EmulatorTestCase(test.CdistTestCase): self.local = local.Local( target_host=self.target_host, out_path=out_path, - exec_path=test.cdist_exec_path) + exec_path=test.cdist_exec_path, + add_conf_dirs=[conf_dir]) self.local.create_files_dirs() self.env = { 'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']), From aedb3669c74e786c312fd261d74182077b51ecd4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 21:46:02 +0100 Subject: [PATCH 326/412] print hint if initial manifest is missing Signed-off-by: Nico Schottelius --- cdist/context.py | 2 +- cdist/core/manifest.py | 17 +---------------- scripts/cdist | 2 +- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/cdist/context.py b/cdist/context.py index 2855f228..767b17a8 100644 --- a/cdist/context.py +++ b/cdist/context.py @@ -87,6 +87,6 @@ class Context(object): def filter(self, record): """Add hostname to logs via logging Filter""" - record.msg = self.target_host + ": " + record.msg + record.msg = self.target_host + ": " + str(record.msg) return True diff --git a/cdist/core/manifest.py b/cdist/core/manifest.py index ecc4a490..61d92992 100644 --- a/cdist/core/manifest.py +++ b/cdist/core/manifest.py @@ -25,20 +25,6 @@ import os import cdist -class NoInitialManifestError(cdist.Error): - """ - Display missing initial manifest - """ - - def __init__(self, manifest_path): - if os.path.islink(manifest_path): - self.message = "%s -> %s" (manifest_path, os.path.realpath(manifest_path)) - else: - self.message = manifest_path - - def __str__(self): - return "Initial manifest missing: %s" % self.message - ''' common: runs only locally, does not need remote @@ -100,8 +86,7 @@ class Manifest(object): self.log.info("Running initial manifest " + self.local.manifest_path) if not os.path.isfile(self.local.manifest_path): - print("fooooobar") - raise NoInitialManifestError(self.local.manifest_path) + raise cdist.Error("Initial manifest is missing") self.local.run_script(script, env=env) diff --git a/scripts/cdist b/scripts/cdist index 00ebbf18..fd18933a 100755 --- a/scripts/cdist +++ b/scripts/cdist @@ -181,9 +181,9 @@ def configinstall_onehost(host, args, mode, parallel): context.cleanup() except cdist.Error as e: + context.log.error(e) # We are running in our own process here, need to sys.exit! if parallel: - log.error(e) sys.exit(1) else: raise From 28bf0c3ed8f8bcee36caa07839b8163986d29872 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 21:52:11 +0100 Subject: [PATCH 327/412] setup target_host for tests in test main class Signed-off-by: Nico Schottelius --- cdist/test/__init__.py | 2 ++ cdist/test/emulator/__init__.py | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/test/__init__.py b/cdist/test/__init__.py index a8c6103b..ab767699 100644 --- a/cdist/test/__init__.py +++ b/cdist/test/__init__.py @@ -35,6 +35,8 @@ class CdistTestCase(unittest.TestCase): remote_exec = os.path.join(global_fixtures_dir, "remote", "exec") remote_copy = os.path.join(global_fixtures_dir, "remote", "copy") + target_host = 'cdisttesthost' + def mkdtemp(self, **kwargs): return tempfile.mkdtemp(prefix='tmp.cdist.test.', **kwargs) diff --git a/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py index 871083f8..f9743e16 100644 --- a/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -39,7 +39,6 @@ my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') conf_dir = op.join(fixtures, 'conf') - class EmulatorTestCase(test.CdistTestCase): def setUp(self): @@ -48,7 +47,6 @@ class EmulatorTestCase(test.CdistTestCase): 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( target_host=self.target_host, From 6482863c5d1bc7c75e6b0babe05524ff9bd6cbf0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 22:32:18 +0100 Subject: [PATCH 328/412] allow manifest to return env for usage from external Signed-off-by: Nico Schottelius --- cdist/core/manifest.py | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/cdist/core/manifest.py b/cdist/core/manifest.py index 61d92992..324374c3 100644 --- a/cdist/core/manifest.py +++ b/cdist/core/manifest.py @@ -78,29 +78,37 @@ class Manifest(object): self.env.update({'__cdist_debug': "yes" }) - def run_initial_manifest(self, script): + def env_initial_manifest(self, script): env = os.environ.copy() env.update(self.env) env['__manifest'] = self.local.manifest_path env['__cdist_manifest'] = script + + return env + + def run_initial_manifest(self, script): self.log.info("Running initial manifest " + self.local.manifest_path) if not os.path.isfile(self.local.manifest_path): raise cdist.Error("Initial manifest is missing") - self.local.run_script(script, env=env) + self.local.run_script(script, env=self.env_initial_manifest(script)) + + def env_type_manifest(self, cdist_object): + env = os.environ.copy() + env.update(self.env) + env.update({ + '__manifest': self.local.manifest_path, + '__object': cdist_object.absolute_path, + '__object_id': cdist_object.object_id, + '__object_name': cdist_object.name, + '__type': cdist_object.cdist_type.absolute_path, + '__cdist_manifest': script, + }) + + return env def run_type_manifest(self, cdist_object): script = os.path.join(self.local.type_path, cdist_object.cdist_type.manifest_path) if os.path.isfile(script): - env = os.environ.copy() - env.update(self.env) - env.update({ - '__manifest': self.local.manifest_path, - '__object': cdist_object.absolute_path, - '__object_id': cdist_object.object_id, - '__object_name': cdist_object.name, - '__type': cdist_object.cdist_type.absolute_path, - '__cdist_manifest': script, - }) - self.local.run_script(script, env=env) + self.local.run_script(script, env=self.env_type_manifest(cdist_object)) From 9cf80f5fdfb2bced3dc58178b7b3f4e3d6871da5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 22:39:25 +0100 Subject: [PATCH 329/412] make use of env provided by manifest Signed-off-by: Nico Schottelius --- cdist/test/emulator/__init__.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py index f9743e16..26530f44 100644 --- a/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -39,6 +39,7 @@ my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') conf_dir = op.join(fixtures, 'conf') +import logging class EmulatorTestCase(test.CdistTestCase): def setUp(self): @@ -48,20 +49,17 @@ class EmulatorTestCase(test.CdistTestCase): handle, self.script = self.mkstemp(dir=self.temp_dir) os.close(handle) out_path = self.temp_dir + self.local = local.Local( target_host=self.target_host, out_path=out_path, exec_path=test.cdist_exec_path, add_conf_dirs=[conf_dir]) + logging.root.setLevel(logging.DEBUG) self.local.create_files_dirs() - 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, - } + + self.manifest = core.Manifest(self.target_host, self.local) + self.env = self.manifest.env_initial_manifest(self.script) def tearDown(self): os.environ = self.orig_environ From e785092935b710fa48e1b9ca2d673ed69d5ea2a3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 09:07:18 +0100 Subject: [PATCH 330/412] allow Manifest to differentiate between supplied and implicit found initial manifest Signed-off-by: Nico Schottelius --- cdist/core/manifest.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/cdist/core/manifest.py b/cdist/core/manifest.py index 324374c3..74d45947 100644 --- a/cdist/core/manifest.py +++ b/cdist/core/manifest.py @@ -86,15 +86,19 @@ class Manifest(object): return env - def run_initial_manifest(self, script): - self.log.info("Running initial manifest " + self.local.manifest_path) + def run_initial_manifest(self, initial_manifest=None): + if not initial_manifest: + initial_manifest = self.local.initial_manifest - if not os.path.isfile(self.local.manifest_path): - raise cdist.Error("Initial manifest is missing") + self.log.info("Running initial manifest " + initial_manifest) - self.local.run_script(script, env=self.env_initial_manifest(script)) + if not os.path.isfile(initial_manifest): + raise cdist.Error("Initial manifest is missing: %s" % initial_manifest) + + self.local.run_script(script, env=self.env_initial_manifest(initial_manifest)) def env_type_manifest(self, cdist_object): + type_manifest = os.path.join(self.local.type_path, cdist_object.cdist_type.manifest_path) env = os.environ.copy() env.update(self.env) env.update({ @@ -103,12 +107,12 @@ class Manifest(object): '__object_id': cdist_object.object_id, '__object_name': cdist_object.name, '__type': cdist_object.cdist_type.absolute_path, - '__cdist_manifest': script, + '__cdist_manifest': type_manifest, }) return env def run_type_manifest(self, cdist_object): - script = os.path.join(self.local.type_path, cdist_object.cdist_type.manifest_path) - if os.path.isfile(script): - self.local.run_script(script, env=self.env_type_manifest(cdist_object)) + type_manifest = os.path.join(self.local.type_path, cdist_object.cdist_type.manifest_path) + if os.path.isfile(type_manifest): + self.local.run_script(type_manifest, env=self.env_type_manifest(cdist_object)) From 7b51e22922d2d118737594d65e111c8bef3348ee Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 09:58:47 +0100 Subject: [PATCH 331/412] allow to read stdin from different handle than sys.stdin in emulator Signed-off-by: Nico Schottelius --- cdist/emulator.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index dedb52ed..2d344f09 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -29,8 +29,9 @@ import cdist from cdist import core class Emulator(object): - def __init__(self, argv): + def __init__(self, argv, stdin=sys.stdin): self.argv = argv + self.stdin = stdin self.object_id = False self.global_path = os.environ['__global'] @@ -148,13 +149,13 @@ class Emulator(object): chunk_size = 8192 def _read_stdin(self): - return sys.stdin.buffer.read(self.chunk_size) + return self.stdin.buffer.read(self.chunk_size) def save_stdin(self): """If something is written to stdin, save it in the object as $__object/stdin so it can be accessed in manifest and gencode-* scripts. """ - if not sys.stdin.isatty(): + if not self.stdin.isatty(): try: # go directly to file instead of using CdistObject's api # as that does not support streaming From a32d3abd338937e1b7d9331204a477eb93746d80 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 10:25:47 +0100 Subject: [PATCH 332/412] allow to pass in environment into emulator Signed-off-by: Nico Schottelius --- cdist/emulator.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index 2d344f09..f65c9bec 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -29,17 +29,17 @@ import cdist from cdist import core class Emulator(object): - def __init__(self, argv, stdin=sys.stdin): + def __init__(self, argv, stdin=sys.stdin, env=os.environ): self.argv = argv self.stdin = stdin self.object_id = False - self.global_path = os.environ['__global'] - self.target_host = os.environ['__target_host'] + self.global_path = self.env['__global'] + self.target_host = self.env['__target_host'] # Internally only - self.object_source = os.environ['__cdist_manifest'] - self.type_base_path = os.environ['__cdist_type_base_path'] + self.object_source = self.env['__cdist_manifest'] + self.type_base_path = self.env['__cdist_type_base_path'] self.object_base_path = os.path.join(self.global_path, "object") @@ -63,7 +63,7 @@ class Emulator(object): def run(self): """Emulate type commands (i.e. __file and co)""" - if '__install' in os.environ: + if '__install' in self.env: if not self.cdist_type.is_install: self.log.debug("Running in install mode, ignoring non install type") return True @@ -80,7 +80,7 @@ class Emulator(object): logformat = '%(levelname)s: %(message)s' logging.basicConfig(format=logformat) - if '__cdist_debug' in os.environ: + if '__cdist_debug' in self.env: logging.root.setLevel(logging.DEBUG) else: logging.root.setLevel(logging.INFO) @@ -171,8 +171,8 @@ class Emulator(object): def record_requirements(self): """record requirements""" - if "require" in os.environ: - requirements = os.environ['require'] + if "require" in self.env: + requirements = self.env['require'] self.log.debug("reqs = " + requirements) for requirement in requirements.split(" "): # Ignore empty fields - probably the only field anyway @@ -192,7 +192,7 @@ class Emulator(object): """An object shall automatically depend on all objects that it defined in it's type manifest. """ # __object_name is the name of the object whose type manifest is currently executed - __object_name = os.environ.get('__object_name', None) + __object_name = self.env.get('__object_name', None) if __object_name: # The object whose type manifest is currently run parent = self.cdist_object.object_from_name(__object_name) From 1e4833781efb3bb38109a0348470597bed941113 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 10:48:30 +0100 Subject: [PATCH 333/412] distinguish between user supplied and derived manifest on error printing Signed-off-by: Nico Schottelius --- cdist/core/manifest.py | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/cdist/core/manifest.py b/cdist/core/manifest.py index 74d45947..1e34afbf 100644 --- a/cdist/core/manifest.py +++ b/cdist/core/manifest.py @@ -57,6 +57,29 @@ type manifeste is: creates: new objects through type emulator ''' +class NoInitialManifestError(cdist.Error): + """ + Display missing initial manifest: + - Display path if user given + - try to resolve link if it is a link + - Omit path if default (is a linked path in temp directory without + much help) + """ + + def __init__(self, manifest_path, user_supplied): + msg_header = "Initial manifest missing" + + if user_supplied: + if os.path.islink(manifest_path): + self.message = "%s: %s -> %s" (msg_header, manifest_path, os.path.realpath(manifest_path)) + else: + self.message = "%s: %s" (msg_header, manifest_path) + else: + self.message = "%s" (msg_header) + + def __str__(self): + return repr(self.message) + class Manifest(object): """Executes cdist manifests. @@ -70,44 +93,47 @@ class Manifest(object): 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 + '__global': self.local.out_path, + '__target_host': self.target_host, } if self.log.getEffectiveLevel() == logging.DEBUG: self.env.update({'__cdist_debug': "yes" }) - def env_initial_manifest(self, script): + def env_initial_manifest(self, initial_manifest): env = os.environ.copy() env.update(self.env) + env['__cdist_manifest'] = initial_manifest env['__manifest'] = self.local.manifest_path - env['__cdist_manifest'] = script return env def run_initial_manifest(self, initial_manifest=None): if not initial_manifest: initial_manifest = self.local.initial_manifest + user_supplied = False + else: + user_supplied = True self.log.info("Running initial manifest " + initial_manifest) if not os.path.isfile(initial_manifest): - raise cdist.Error("Initial manifest is missing: %s" % initial_manifest) + raise NoInitialManifestError(initial_manifest, user_supplied) - self.local.run_script(script, env=self.env_initial_manifest(initial_manifest)) + self.local.run_script(initial_manifest, env=self.env_initial_manifest(initial_manifest)) def env_type_manifest(self, cdist_object): type_manifest = os.path.join(self.local.type_path, cdist_object.cdist_type.manifest_path) env = os.environ.copy() env.update(self.env) env.update({ + '__cdist_manifest': type_manifest, '__manifest': self.local.manifest_path, '__object': cdist_object.absolute_path, '__object_id': cdist_object.object_id, '__object_name': cdist_object.name, '__type': cdist_object.cdist_type.absolute_path, - '__cdist_manifest': type_manifest, }) return env From 45d5e4719a83185670b4b57a469f166494c387e3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 10:49:11 +0100 Subject: [PATCH 334/412] read from stdin using read, not buffer.read() to be compatible with other IO streams Signed-off-by: Nico Schottelius --- cdist/emulator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index f65c9bec..53c6914d 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -32,6 +32,8 @@ class Emulator(object): def __init__(self, argv, stdin=sys.stdin, env=os.environ): self.argv = argv self.stdin = stdin + self.env = env + self.object_id = False self.global_path = self.env['__global'] @@ -147,9 +149,8 @@ class Emulator(object): # Record / Append source self.cdist_object.source.append(self.object_source) - chunk_size = 8192 def _read_stdin(self): - return self.stdin.buffer.read(self.chunk_size) + return self.stdin.read() def save_stdin(self): """If something is written to stdin, save it in the object as $__object/stdin so it can be accessed in manifest and gencode-* From 217d2bcb23516b3cfe5fa733928db91a6b8fdbca Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 10:49:51 +0100 Subject: [PATCH 335/412] Fix test: StdinTestCase Signed-off-by: Nico Schottelius --- cdist/test/autorequire/__init__.py | 1 - cdist/test/emulator/__init__.py | 69 ++++++++++++------- cdist/test/emulator/fixtures/conf/type/__file | 1 - 3 files changed, 45 insertions(+), 26 deletions(-) delete mode 120000 cdist/test/emulator/fixtures/conf/type/__file diff --git a/cdist/test/autorequire/__init__.py b/cdist/test/autorequire/__init__.py index 4b47b06b..2a647954 100644 --- a/cdist/test/autorequire/__init__.py +++ b/cdist/test/autorequire/__init__.py @@ -42,7 +42,6 @@ class AutorequireTestCase(test.CdistTestCase): def setUp(self): self.orig_environ = os.environ os.environ = os.environ.copy() - self.target_host = 'localhost' self.temp_dir = self.mkdtemp() self.out_dir = os.path.join(self.temp_dir, "out") diff --git a/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py index 26530f44..ec254a21 100644 --- a/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -20,6 +20,7 @@ # # +import io import os import shutil import string @@ -141,7 +142,6 @@ class ArgumentsTestCase(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) @@ -236,38 +236,59 @@ class StdinTestCase(test.CdistTestCase): def setUp(self): self.orig_environ = os.environ os.environ = os.environ.copy() - self.target_host = 'localhost' + self.temp_dir = self.mkdtemp() - os.environ['__cdist_out_dir'] = self.temp_dir + out_path = os.path.join(self.temp_dir, "out") - self.context = cdist.context.Context( + self.local = local.Local( target_host=self.target_host, - remote_copy='scp -o User=root -q', - remote_exec='ssh -o User=root -q', + out_path=out_path, exec_path=test.cdist_exec_path, - debug=False) - self.config = config.Config(self.context) + add_conf_dirs=[conf_dir]) + self.local.create_files_dirs() + + self.manifest = core.Manifest( + target_host=self.target_host, + local = self.local) + def tearDown(self): os.environ = self.orig_environ shutil.rmtree(self.temp_dir) def test_file_from_stdin(self): - handle, destination = self.mkstemp(dir=self.temp_dir) - os.close(handle) - source_handle, source = self.mkstemp(dir=self.temp_dir) - candidates = string.ascii_letters+string.digits - with os.fdopen(source_handle, 'w') as fd: - for x in range(100): - fd.write(''.join(random.sample(candidates, len(candidates)))) + """ + Test whether reading from stdin works + """ - handle, initial_manifest = self.mkstemp(dir=self.temp_dir) - with os.fdopen(handle, 'w') as fd: - fd.write('__file_from_stdin %s --source %s\n' % (destination, source)) - self.context.initial_manifest = initial_manifest - self.config.stage_prepare() + ###################################################################### + # Create string with random content + random_string = str(random.sample(range(1000), 800)) + random_buffer = io.BytesIO(bytes(random_string, 'utf-8')) - cdist_type = core.CdistType(self.config.local.type_path, '__file') - cdist_object = core.CdistObject(cdist_type, self.config.local.object_path, destination) - # Test weither stdin has been stored correctly - self.assertTrue(filecmp.cmp(source, os.path.join(cdist_object.absolute_path, 'stdin'))) + ###################################################################### + # Prepare required args and environment for emulator + type_name = '__file' + object_id = "cdist-test-id" + argv = [type_name, object_id] + + initial_manifest_path = "/cdist-test/path/that/does/not/exist" + env = self.manifest.env_initial_manifest(initial_manifest_path) + + ###################################################################### + # Create path where stdin should reside at + cdist_type = core.CdistType(self.local.type_path, type_name) + cdist_object = core.CdistObject(cdist_type, self.local.object_path, object_id) + stdin_out_path = os.path.join(cdist_object.absolute_path, 'stdin') + + ###################################################################### + # Run emulator + emu = emulator.Emulator(argv, stdin=random_buffer, env=env) + emu.run() + + ###################################################################### + # Read where emulator should have placed stdin + with open(stdin_out_path, 'r') as fd: + stdin_saved_by_emulator = fd.read() + + self.assertEqual(random_string, stdin_saved_by_emulator) diff --git a/cdist/test/emulator/fixtures/conf/type/__file b/cdist/test/emulator/fixtures/conf/type/__file deleted file mode 120000 index 1ed684b9..00000000 --- a/cdist/test/emulator/fixtures/conf/type/__file +++ /dev/null @@ -1 +0,0 @@ -../../../../../conf/type/__file \ No newline at end of file From 4dd0f61934cb2123eafefe9a16d65b9b86406040 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 10:51:13 +0100 Subject: [PATCH 336/412] --whitespace Signed-off-by: Nico Schottelius --- cdist/test/emulator/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py index ec254a21..ecbb97a3 100644 --- a/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -212,7 +212,7 @@ class ArgumentsTestCase(test.CdistTestCase): # argv = [type_name, object_id, '--required1', value] # os.environ.update(self.env) # emu = emulator.Emulator(argv) -# +# # self.assertRaises(SystemExit, emu.run) def test_optional(self): @@ -251,7 +251,7 @@ class StdinTestCase(test.CdistTestCase): self.manifest = core.Manifest( target_host=self.target_host, local = self.local) - + def tearDown(self): os.environ = self.orig_environ shutil.rmtree(self.temp_dir) From e2e1d0bb67cfb4578177c0b2cd3ce86fbda5e76c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 11:05:29 +0100 Subject: [PATCH 337/412] include % Signed-off-by: Nico Schottelius --- cdist/core/manifest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cdist/core/manifest.py b/cdist/core/manifest.py index 1e34afbf..19639618 100644 --- a/cdist/core/manifest.py +++ b/cdist/core/manifest.py @@ -71,11 +71,11 @@ class NoInitialManifestError(cdist.Error): if user_supplied: if os.path.islink(manifest_path): - self.message = "%s: %s -> %s" (msg_header, manifest_path, os.path.realpath(manifest_path)) + self.message = "%s: %s -> %s" % (msg_header, manifest_path, os.path.realpath(manifest_path)) else: - self.message = "%s: %s" (msg_header, manifest_path) + self.message = "%s: %s" % (msg_header, manifest_path) else: - self.message = "%s" (msg_header) + self.message = "%s" % (msg_header) def __str__(self): return repr(self.message) From 7d57d1df79a6e91efbe50eeddfe501085f96496e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 11:05:40 +0100 Subject: [PATCH 338/412] update emulator tests to work again Signed-off-by: Nico Schottelius --- cdist/test/emulator/__init__.py | 57 +++++++++++---------------------- 1 file changed, 19 insertions(+), 38 deletions(-) diff --git a/cdist/test/emulator/__init__.py b/cdist/test/emulator/__init__.py index ecbb97a3..fc0b6695 100644 --- a/cdist/test/emulator/__init__.py +++ b/cdist/test/emulator/__init__.py @@ -40,12 +40,9 @@ my_dir = op.abspath(op.dirname(__file__)) fixtures = op.join(my_dir, 'fixtures') conf_dir = op.join(fixtures, 'conf') -import logging class EmulatorTestCase(test.CdistTestCase): 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) os.close(handle) @@ -56,72 +53,61 @@ class EmulatorTestCase(test.CdistTestCase): out_path=out_path, exec_path=test.cdist_exec_path, add_conf_dirs=[conf_dir]) - logging.root.setLevel(logging.DEBUG) self.local.create_files_dirs() self.manifest = core.Manifest(self.target_host, self.local) self.env = self.manifest.env_initial_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) + self.assertRaises(core.NoSuchTypeError, emulator.Emulator, argv, env=self.env) 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.env['require'] = '__does-not-exist/some-id' + emu = emulator.Emulator(argv, env=self.env) 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.env['require'] = '__file/bad/id/with/.cdist/inside' + emu = emulator.Emulator(argv, env=self.env) 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.env['require'] = '__file' + emu = emulator.Emulator(argv, env=self.env) self.assertRaises(core.IllegalObjectIdError, 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) + self.env['require'] = '__issue' + emu = emulator.Emulator(argv, env=self.env) emu.run() # if we get here all is fine def test_requirement_pattern(self): argv = ['__file', '/tmp/foobar'] - os.environ.update(self.env) - os.environ['require'] = '__file/etc/*' - emu = emulator.Emulator(argv) + self.env['require'] = '__file/etc/*' + emu = emulator.Emulator(argv, env=self.env) # 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 AutoRequireEmulatorTestCase(test.CdistTestCase): def setUp(self): self.temp_dir = self.mkdtemp() - self.target_host = 'localhost' - out_path = self.temp_dir + out_path = os.path.join(self.temp_dir, "out") + self.local = local.Local( target_host=self.target_host, out_path=out_path, - exec_path=test.cdist_exec_path) + exec_path=test.cdist_exec_path, + add_conf_dirs=[conf_dir]) self.local.create_files_dirs() self.manifest = core.Manifest(self.target_host, self.local) @@ -149,17 +135,12 @@ class ArgumentsTestCase(test.CdistTestCase): self.local = local.Local( target_host=self.target_host, out_path=out_path, - exec_path=test.cdist_exec_path) + exec_path=test.cdist_exec_path, + add_conf_dirs=[conf_dir]) self.local.create_files_dirs() - 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, - } + self.manifest = core.Manifest(self.target_host, self.local) + self.env = self.manifest.env_initial_manifest(self.script) def tearDown(self): shutil.rmtree(self.temp_dir) From 1bb3c82d729a1c0b721f10000e2012218812d467 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 11:47:26 +0100 Subject: [PATCH 339/412] cleanup some logging stuff Signed-off-by: Nico Schottelius --- cdist/test/code/__init__.py | 5 +---- cdist/test/explorer/__init__.py | 3 --- cdist/test/manifest/__init__.py | 2 ++ 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/cdist/test/code/__init__.py b/cdist/test/code/__init__.py index f5d445ab..284ef9c0 100644 --- a/cdist/test/code/__init__.py +++ b/cdist/test/code/__init__.py @@ -20,10 +20,9 @@ # # +import getpass import os import shutil -import getpass -import logging import cdist from cdist import core @@ -63,8 +62,6 @@ class CodeTestCase(test.CdistTestCase): self.cdist_object = core.CdistObject(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) diff --git a/cdist/test/explorer/__init__.py b/cdist/test/explorer/__init__.py index 266a1073..a97b538a 100644 --- a/cdist/test/explorer/__init__.py +++ b/cdist/test/explorer/__init__.py @@ -23,7 +23,6 @@ import os import shutil import getpass -import logging import cdist from cdist import core @@ -67,8 +66,6 @@ class ExplorerClassTestCase(test.CdistTestCase): self.local, self.remote) - self.log = logging.getLogger(self.target_host) - def tearDown(self): shutil.rmtree(self.temp_dir) diff --git a/cdist/test/manifest/__init__.py b/cdist/test/manifest/__init__.py index 0de04743..727017e7 100644 --- a/cdist/test/manifest/__init__.py +++ b/cdist/test/manifest/__init__.py @@ -107,6 +107,8 @@ class ManifestTestCase(test.CdistTestCase): self.assertEqual(output_dict['__object_name'], cdist_object.name) def test_debug_env_setup(self): + current_level = self.log.getEffectiveLevel() self.log.setLevel(logging.DEBUG) manifest = cdist.core.manifest.Manifest(self.target_host, self.local) self.assertTrue("__cdist_debug" in manifest.env) + self.log.setLevel(current_level) From 37ea64d23b00e6f70e288ebb266950ac8d755f93 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 12:12:26 +0100 Subject: [PATCH 340/412] automate blog & ml Signed-off-by: Nico Schottelius --- build | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 5 deletions(-) diff --git a/build b/build index def72470..776da03f 100755 --- a/build +++ b/build @@ -35,6 +35,7 @@ A2XH="a2x -f xhtml --no-xmllint -a encoding=UTF-8" # Developer webbase WEBDIR=$HOME/niconetz +WEBBLOG=$WEBDIR/blog WEBBASE=$WEBDIR/software/cdist WEBMAN=$WEBBASE/man/$version WEBPAGE=${WEBBASE}.mdwn @@ -108,9 +109,14 @@ case "$1" in $0 pub + $0 dist-blog $0 dist-freecode + $0 dist-ml + $0 dist-manual + ;; - $0 dist-post + changelog-changes) + awk -F: 'BEGIN { start=0 } { if ($0 ~ /^[[:digit:]]/) { if(start == 0) {start = 1 } else { exit } } else { if(start==1) {print $0 }} }' "$basedir/docs/changelog" ;; changelog-version) @@ -144,15 +150,78 @@ case "$1" in ;; - dist-post) + blog) + version=$($0 changelog-version) + blogfile=$WEBBLOG/cdist-${version}-released.mdwn + cat << eof > "$blogfile" +[[!meta title="Cdist $version released"]] + +Here's a short overview about the changes found in this release: + +eof + + $0 changelog-changes >> "$blogfile" + + cat << eof >> "$blogfile" +For more information visit the [[cdist homepage|software/cdist]]. + +[[!tag cdist config unix]] +eof + ;; + + dist-blog) + $0 blog + version=$($0 changelog-version) + file=cdist-${version}-released.mdwn + cd $WEBBBLOG + git add "$file" + git commit -m "New cdist version (blogentry): $version" "$file" + git push + ;; + + dist-ml) + $0 blog + version=$($0 changelog-version) + to_a=cdist + to_d=l.schottelius.org + to=${to_a}@${to_d} + + from_a=nico-cdist + from_d=schottelius.org + from=${from_a}@${from_d} + + ( + cat << eof +From: Nico -telmich- Schottelius <$from> +To: cdist mailing list <$to> +Subject: [cdist] cdist $version released + +Hello .*, + +cdist $version has been released with the following changes: + +eof + + "$0" changelog-changes + cat << eof + +Cheers, + +Nico + +-- +Automatisation at its best level. With cdist. +eof + ) | /usr/sbin/sendmail -f "$from" "$to" + ;; + + + dist-manual) cat << notes To be done manually... - - freecode release - - blog entry - linkedin entry - - mailinglist update notes ;; From c53d1807524c30ee497782dae347e1026a595329 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 12:12:33 +0100 Subject: [PATCH 341/412] release 2.1.0pre7 Signed-off-by: Nico Schottelius --- docs/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/changelog b/docs/changelog index 93c3cf69..f8030609 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,8 +4,8 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -2.1.0pre7: - * Core: Tests for autorequire, code, manifest work again +2.1.0pre7: 2012-11-07 + * Core: All unit tests restored back to working * Core: Print error message on missing initial manifest 2.1.0pre6: 2012-11-05 From e786803daec2d598bcc2853469dccb297e0d6cfc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 12:13:06 +0100 Subject: [PATCH 342/412] strip prefix away Signed-off-by: Nico Schottelius --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index 776da03f..34775a31 100755 --- a/build +++ b/build @@ -194,7 +194,7 @@ eof cat << eof From: Nico -telmich- Schottelius <$from> To: cdist mailing list <$to> -Subject: [cdist] cdist $version released +Subject: cdist $version released Hello .*, From 7a1f81dc7b15defa8ae41fdf9f227dd8213fead1 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 7 Nov 2012 16:54:34 +0100 Subject: [PATCH 343/412] remove install types Signed-off-by: Steven Armstrong --- cdist/conf/type/__mkfs/gencode-remote | 38 ----- cdist/conf/type/__mkfs/install | 0 cdist/conf/type/__mkfs/man.text | 57 -------- cdist/conf/type/__mkfs/manifest | 31 ---- cdist/conf/type/__mkfs/parameter/optional | 3 - cdist/conf/type/__mkfs/parameter/required | 1 - cdist/conf/type/__partition_msdos/install | 0 cdist/conf/type/__partition_msdos/man.text | 62 -------- cdist/conf/type/__partition_msdos/manifest | 41 ------ .../type/__partition_msdos/parameter/optional | 3 - .../type/__partition_msdos/parameter/required | 1 - .../explorer/partitions | 3 - .../type/__partition_msdos_apply/files/lib.sh | 61 -------- .../__partition_msdos_apply/gencode-remote | 138 ------------------ .../conf/type/__partition_msdos_apply/install | 0 .../type/__partition_msdos_apply/man.text | 42 ------ .../type/__partition_msdos_apply/singleton | 0 17 files changed, 481 deletions(-) delete mode 100755 cdist/conf/type/__mkfs/gencode-remote delete mode 100644 cdist/conf/type/__mkfs/install delete mode 100644 cdist/conf/type/__mkfs/man.text delete mode 100755 cdist/conf/type/__mkfs/manifest delete mode 100644 cdist/conf/type/__mkfs/parameter/optional delete mode 100644 cdist/conf/type/__mkfs/parameter/required delete mode 100644 cdist/conf/type/__partition_msdos/install delete mode 100644 cdist/conf/type/__partition_msdos/man.text delete mode 100755 cdist/conf/type/__partition_msdos/manifest delete mode 100644 cdist/conf/type/__partition_msdos/parameter/optional delete mode 100644 cdist/conf/type/__partition_msdos/parameter/required delete mode 100755 cdist/conf/type/__partition_msdos_apply/explorer/partitions delete mode 100644 cdist/conf/type/__partition_msdos_apply/files/lib.sh delete mode 100755 cdist/conf/type/__partition_msdos_apply/gencode-remote delete mode 100644 cdist/conf/type/__partition_msdos_apply/install delete mode 100644 cdist/conf/type/__partition_msdos_apply/man.text delete mode 100644 cdist/conf/type/__partition_msdos_apply/singleton diff --git a/cdist/conf/type/__mkfs/gencode-remote b/cdist/conf/type/__mkfs/gencode-remote deleted file mode 100755 index b3561bad..00000000 --- a/cdist/conf/type/__mkfs/gencode-remote +++ /dev/null @@ -1,38 +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 . -# - -device="$(cat "$__object/parameter/device")" -type="$(cat "$__object/parameter/type")" - -if [ "$type" = "swap" ]; then - echo "mkswap $device" -else - command="mkfs -t $type -q" - if [ -f "$__object/parameter/options" ]; then - options="$(cat "$__object/parameter/options")" - command="$command $options" - fi - command="$command $device" - if [ -f "$__object/parameter/blocks" ]; then - blocks="$(cat "$__object/parameter/blocks")" - command="$command $blocks" - fi - echo "$command" -fi diff --git a/cdist/conf/type/__mkfs/install b/cdist/conf/type/__mkfs/install deleted file mode 100644 index e69de29b..00000000 diff --git a/cdist/conf/type/__mkfs/man.text b/cdist/conf/type/__mkfs/man.text deleted file mode 100644 index 4320c639..00000000 --- a/cdist/conf/type/__mkfs/man.text +++ /dev/null @@ -1,57 +0,0 @@ -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/cdist/conf/type/__mkfs/manifest b/cdist/conf/type/__mkfs/manifest deleted file mode 100755 index e9d275a4..00000000 --- a/cdist/conf/type/__mkfs/manifest +++ /dev/null @@ -1,31 +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 . -# - -# 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/cdist/conf/type/__mkfs/parameter/optional b/cdist/conf/type/__mkfs/parameter/optional deleted file mode 100644 index 86aeae30..00000000 --- a/cdist/conf/type/__mkfs/parameter/optional +++ /dev/null @@ -1,3 +0,0 @@ -device -options -blocks diff --git a/cdist/conf/type/__mkfs/parameter/required b/cdist/conf/type/__mkfs/parameter/required deleted file mode 100644 index aa80e646..00000000 --- a/cdist/conf/type/__mkfs/parameter/required +++ /dev/null @@ -1 +0,0 @@ -type diff --git a/cdist/conf/type/__partition_msdos/install b/cdist/conf/type/__partition_msdos/install deleted file mode 100644 index e69de29b..00000000 diff --git a/cdist/conf/type/__partition_msdos/man.text b/cdist/conf/type/__partition_msdos/man.text deleted file mode 100644 index 78220ee0..00000000 --- a/cdist/conf/type/__partition_msdos/man.text +++ /dev/null @@ -1,62 +0,0 @@ -cdist-type__partition_msdos(7) -============================== -Steven Armstrong - - -NAME ----- -cdist-type__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 -------------------- -partition:: - defaults to object_id -bootable:: - mark partition as bootable, true or false, defaults to false -size:: - 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). Defaults to +. - - -EXAMPLES --------- - --------------------------------------------------------------------------------- -# 128MB, linux, bootable -__partition_msdos /dev/sda1 --type 83 --size 128M --bootable true -# 512MB, swap -__partition_msdos /dev/sda2 --type 82 --size 512M -# 100GB, extended -__partition_msdos /dev/sda3 --type extended --size 100G -# 10GB, linux -__partition_msdos /dev/sda5 --type 83 --size 10G -# 50% of the free space of the extended partition, linux -__partition_msdos /dev/sda6 --type 83 --size 50% -# rest of the extended partition, linux -__partition_msdos /dev/sda7 --type 83 --size + --------------------------------------------------------------------------------- - - -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/cdist/conf/type/__partition_msdos/manifest b/cdist/conf/type/__partition_msdos/manifest deleted file mode 100755 index 21e43856..00000000 --- a/cdist/conf/type/__partition_msdos/manifest +++ /dev/null @@ -1,41 +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 . -# - -# 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" - -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="$__object_name" __partition_msdos_apply diff --git a/cdist/conf/type/__partition_msdos/parameter/optional b/cdist/conf/type/__partition_msdos/parameter/optional deleted file mode 100644 index b2b0a4c2..00000000 --- a/cdist/conf/type/__partition_msdos/parameter/optional +++ /dev/null @@ -1,3 +0,0 @@ -partition -bootable -size diff --git a/cdist/conf/type/__partition_msdos/parameter/required b/cdist/conf/type/__partition_msdos/parameter/required deleted file mode 100644 index aa80e646..00000000 --- a/cdist/conf/type/__partition_msdos/parameter/required +++ /dev/null @@ -1 +0,0 @@ -type diff --git a/cdist/conf/type/__partition_msdos_apply/explorer/partitions b/cdist/conf/type/__partition_msdos_apply/explorer/partitions deleted file mode 100755 index 6be61af4..00000000 --- a/cdist/conf/type/__partition_msdos_apply/explorer/partitions +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -cat /proc/partitions diff --git a/cdist/conf/type/__partition_msdos_apply/files/lib.sh b/cdist/conf/type/__partition_msdos_apply/files/lib.sh deleted file mode 100644 index 5767ea43..00000000 --- a/cdist/conf/type/__partition_msdos_apply/files/lib.sh +++ /dev/null @@ -1,61 +0,0 @@ -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}" - printf "${cmd}\nw\n" | fdisk -c -u "$device" - # give disk some time - sleep 1 - 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" -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" - return $? -} - diff --git a/cdist/conf/type/__partition_msdos_apply/gencode-remote b/cdist/conf/type/__partition_msdos_apply/gencode-remote deleted file mode 100755 index 5dab7070..00000000 --- a/cdist/conf/type/__partition_msdos_apply/gencode-remote +++ /dev/null @@ -1,138 +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 . -# - -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_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\" || die 'Failed to create disklabel for $device'" - current_device="$device" - device_name=$(echo ${device} | sed -e 's:^/dev/::;s:/:\\/:g') - available_device_size=$(( $(awk "/${device_name}\$/ { print \$3; }" "$partitions") / 1024)) - # make sure we don't go past the end of the drive - available_device_size=$((available_device_size - 2)) - available_extended_size=0 - primary_count=0 - debug "----- $device" - debug "current_device=$current_device" - debug "available_device_size=$available_device_size" - fi - - type="$(cat "$object/parameter/type")" - partition="$(cat "$object/parameter/partition")" - minor="$(cat "$object/parameter/minor")" - - 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="" - available_size=0 - else - partition_size=$(size_to_mb "$size" "$available_size") - 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" - 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" - 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' \ - || die 'Failed to create partition: $partition'" -done - diff --git a/cdist/conf/type/__partition_msdos_apply/install b/cdist/conf/type/__partition_msdos_apply/install deleted file mode 100644 index e69de29b..00000000 diff --git a/cdist/conf/type/__partition_msdos_apply/man.text b/cdist/conf/type/__partition_msdos_apply/man.text deleted file mode 100644 index 6cc53b77..00000000 --- a/cdist/conf/type/__partition_msdos_apply/man.text +++ /dev/null @@ -1,42 +0,0 @@ -cdist-type__partition_msdos_apply(7) -==================================== -Steven Armstrong - - -NAME ----- -cdist-type__partition_msdos_apply - Apply dos partition settings - - -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/cdist/conf/type/__partition_msdos_apply/singleton b/cdist/conf/type/__partition_msdos_apply/singleton deleted file mode 100644 index e69de29b..00000000 From 03cc2a63b163fabd2654843acbabba5d00301d1b Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 7 Nov 2012 14:28:30 +0100 Subject: [PATCH 344/412] types to handle autofs maps Signed-off-by: Steven Armstrong --- cdist/conf/type/__autofs/man.text | 42 +++++++++ .../gencode-local => __autofs/manifest} | 26 ++++-- .../{__autofs_master => __autofs}/singleton | 0 cdist/conf/type/__autofs_map/explorer/entry | 50 ++++++++++ cdist/conf/type/__autofs_map/gencode-remote | 93 +++++++++++++++++++ cdist/conf/type/__autofs_map/man.text | 20 +++- cdist/conf/type/__autofs_map/manifest | 45 +++++---- .../conf/type/__autofs_map/parameter/boolean | 1 + .../__autofs_master/files/auto.master.header | 3 - .../type/__autofs_master/parameter/optional | 1 - .../gencode-remote} | 24 +++-- .../man.text | 23 ++--- cdist/conf/type/__autofs_reload/singleton | 0 13 files changed, 273 insertions(+), 55 deletions(-) create mode 100644 cdist/conf/type/__autofs/man.text rename cdist/conf/type/{__autofs_master/gencode-local => __autofs/manifest} (59%) rename cdist/conf/type/{__autofs_master => __autofs}/singleton (100%) create mode 100755 cdist/conf/type/__autofs_map/explorer/entry create mode 100755 cdist/conf/type/__autofs_map/gencode-remote create mode 100644 cdist/conf/type/__autofs_map/parameter/boolean delete mode 100644 cdist/conf/type/__autofs_master/files/auto.master.header delete mode 100644 cdist/conf/type/__autofs_master/parameter/optional rename cdist/conf/type/{__autofs_master/manifest => __autofs_reload/gencode-remote} (62%) rename cdist/conf/type/{__autofs_master => __autofs_reload}/man.text (51%) create mode 100644 cdist/conf/type/__autofs_reload/singleton diff --git a/cdist/conf/type/__autofs/man.text b/cdist/conf/type/__autofs/man.text new file mode 100644 index 00000000..9b343309 --- /dev/null +++ b/cdist/conf/type/__autofs/man.text @@ -0,0 +1,42 @@ +cdist-type__autofs(7) +===================== +Steven Armstrong + + +NAME +---- +cdist-type__autofs - install and start autofs + + +DESCRIPTION +----------- +This space intentionally left blank. + + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +None. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +__autofs +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2012 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__autofs_master/gencode-local b/cdist/conf/type/__autofs/manifest similarity index 59% rename from cdist/conf/type/__autofs_master/gencode-local rename to cdist/conf/type/__autofs/manifest index 701f97a8..31844415 100755 --- a/cdist/conf/type/__autofs_master/gencode-local +++ b/cdist/conf/type/__autofs/manifest @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -17,10 +17,22 @@ # You should have received a copy of the GNU General Public License # along with cdist. If not, see . # -# -# Generate auto.master config based on all defined __autofs_map ojbects. -# -auto_master="$__object/files/auto.master" -cat "$(cat "$__object/parameter/header")" > "$auto_master" -find "$__global/object/__autofs_map" -path "*.cdist/parameter/entry" | xargs cat >> "$auto_master" + +os=$(cat "$__global/explorer/os") + +not_supported() { + echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 + echo "Please contribute an implementation for it if you can." >&2 + exit 1 +} + +case "$os" in + ubuntu|debian|archlinux) + __package autofs --state present + __start_on_boot autofs --state present + ;; + *) + not_supported + ;; +esac diff --git a/cdist/conf/type/__autofs_master/singleton b/cdist/conf/type/__autofs/singleton similarity index 100% rename from cdist/conf/type/__autofs_master/singleton rename to cdist/conf/type/__autofs/singleton diff --git a/cdist/conf/type/__autofs_map/explorer/entry b/cdist/conf/type/__autofs_map/explorer/entry new file mode 100755 index 00000000..7aa26518 --- /dev/null +++ b/cdist/conf/type/__autofs_map/explorer/entry @@ -0,0 +1,50 @@ +#!/bin/sh +# +# 2011 - 2012 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 . +# + +candidates="/etc/auto.master /etc/autofs/auto.master" +find_auto_master() { + # get the path of the auto.master file + for candidate in $candidates; do + if [ -f "$candidate" ]; then + echo "$candidate" + return + fi + done +} + +auto_master="$(find_auto_master)" + +# no auto.master, nothing we could do +[ -f "$auto_master" ] || exit 0 + +# NOTE: keep variables in sync in manifest/explorer/gencode-* +prefix="#cdist:$__object_name" +suffix="#/cdist:$__object_name" +awk -v prefix="$prefix" -v suffix="$suffix" '{ + if (index($0,prefix)) { + triggered=1 + } + if (triggered) { + if (index($0,suffix)) { + triggered=0 + } + print + } +}' "$auto_master" diff --git a/cdist/conf/type/__autofs_map/gencode-remote b/cdist/conf/type/__autofs_map/gencode-remote new file mode 100755 index 00000000..fa6acffb --- /dev/null +++ b/cdist/conf/type/__autofs_map/gencode-remote @@ -0,0 +1,93 @@ +#!/bin/sh +# +# 2011 - 2012 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 . +# + +entry="$__object/files/entry" +state_should="$(cat "$__object/parameter/state" 2>/dev/null || echo present)" +if [ ! -s "$__object/explorer/entry" ]; then + state_is='absent' +else + state_is=$(diff -q "$entry" "$__object/explorer/entry" >/dev/null \ + && echo present \ + || echo changed + ) +fi + +if [ "$state_should" = "$state_is" ]; then + # Nothing to do, move along + exit 0 +fi + +cat << DONE +candidates="/etc/auto.master /etc/autofs/auto.master" +find_auto_master() { + # get the path of the auto.master file + for candidate in \$candidates; do + if [ -f "\$candidate" ]; then + echo "\$candidate" + return + fi + done +} + +auto_master="\$(find_auto_master)" + +if [ ! -f "\$auto_master" ]; then + echo "Could not determine auto.master location, tried: \$candidates" >&2 + exit 1 +fi +DONE + +remove_entry() { + # NOTE: keep variables in sync in manifest/explorer/gencode-* + prefix="#cdist:$__object_name" + suffix="#/cdist:$__object_name" + cat << DONE +awk -v prefix="$prefix" -v suffix="$suffix" ' +{ + if (index(\$0,prefix)) { + triggered=1 + } + if (triggered) { + if (index(\$0,suffix)) { + triggered=0 + } + } else { + print + } +}' "\$auto_master" > "\$auto_master"+ +mv -f "\$auto_master"+ "\$auto_master" +DONE +} + +case "$state_should" in + present) + if [ "$state_is" = "changed" ]; then + remove_entry + fi + cat << DONE +cat >> "\$auto_master" << EOC +$(cat "$entry") +EOC +DONE + ;; + absent) + remove_entry + ;; +esac diff --git a/cdist/conf/type/__autofs_map/man.text b/cdist/conf/type/__autofs_map/man.text index 941e22da..50ce2fa8 100644 --- a/cdist/conf/type/__autofs_map/man.text +++ b/cdist/conf/type/__autofs_map/man.text @@ -36,25 +36,35 @@ comment:: auto.master. +BOOLEAN PARAMETERS +------------------ +noreload:: + don't reload autofs after the entry has been changed + + EXAMPLES -------- -------------------------------------------------------------------------------- -# Add auto mounter at /net +# Add auto mounter at /net and reload __autofs_map /net --map /etc/auto.net --type program -# Add auto mounter at /pub -__autofs_map /pub --map /etc/auto.pub \ - --type file --options nosuid,rw,bg,hard,intr --ghost +# Add auto mounter at /pub and don't reload +__autofs_map /pub \ + --map /etc/auto.pub \ + --type file \ + --options "nosuid,rw,bg,hard,intr --ghost" \ + --noreload -------------------------------------------------------------------------------- SEE ALSO -------- - cdist-type(7) +- cdist-type__autofs_reload(7) COPYING ------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is +Copyright \(C) 2012 Steven Armstrong. Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__autofs_map/manifest b/cdist/conf/type/__autofs_map/manifest index d86ea799..58dc0f98 100755 --- a/cdist/conf/type/__autofs_map/manifest +++ b/cdist/conf/type/__autofs_map/manifest @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2011 - 2012 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -20,23 +20,36 @@ name="/$__object_id" map="$(cat "$__object/parameter/map")" +type="$(cat "$__object/parameter/type" 2>/dev/null || echo "file")" +options="$(cat "$__object/parameter/options" 2>/dev/null || true)" -if [ -f "$__object/parameter/type" ]; then - type="$(cat "$__object/parameter/type")" -else - type="file" - echo "$type" > "$__object/parameter/type" -fi +# NOTE: keep variables in sync in manifest/explorer/gencode-* +prefix="#cdist:$__object_name" +suffix="#/cdist:$__object_name" -# Generate entry for use in auto.master -entry="${name} ${type}:${map}" -if [ -f "$__object/parameter/options" ]; then - entry="$entry $(cat "$__object/parameter/options")" -fi +mkdir "$__object/files" + +# Generate entry for inclusion in auto.master +entry="$__object/files/entry" +echo "$prefix" > "$entry" if [ -f "$__object/parameter/comment" ]; then - echo "# $(cat "$__object/parameter/comment")" > "$__object/parameter/entry" + echo "# $(cat "$__object/parameter/comment")" >> "$entry" fi -echo "$entry" >> "$__object/parameter/entry" - -require="$__object_name" __autofs_master +echo "$name $type:$map $options" >> $entry +echo "$suffix" >> "$entry" +# Reload autofs after changes if the user wishes this +if [ ! -f "$__object/parameter/noreload" ]; then + state_should="$(cat "$__object/parameter/state" 2>/dev/null || echo present)" + if [ ! -s "$__object/explorer/entry" ]; then + state_is='absent' + else + state_is=$(diff -q "$entry" "$__object/explorer/entry" >/dev/null \ + && echo present \ + || echo changed + ) + fi + if [ "$state_is" != "$state_should" ]; then + require="$__object_name" __autofs_reload + fi +fi diff --git a/cdist/conf/type/__autofs_map/parameter/boolean b/cdist/conf/type/__autofs_map/parameter/boolean new file mode 100644 index 00000000..862edc87 --- /dev/null +++ b/cdist/conf/type/__autofs_map/parameter/boolean @@ -0,0 +1 @@ +noreload diff --git a/cdist/conf/type/__autofs_master/files/auto.master.header b/cdist/conf/type/__autofs_master/files/auto.master.header deleted file mode 100644 index 53590257..00000000 --- a/cdist/conf/type/__autofs_master/files/auto.master.header +++ /dev/null @@ -1,3 +0,0 @@ -# Generated from cdist __autofs_master -# Do not change this file. Changes will be overwritten. - diff --git a/cdist/conf/type/__autofs_master/parameter/optional b/cdist/conf/type/__autofs_master/parameter/optional deleted file mode 100644 index 8e83f898..00000000 --- a/cdist/conf/type/__autofs_master/parameter/optional +++ /dev/null @@ -1 +0,0 @@ -header diff --git a/cdist/conf/type/__autofs_master/manifest b/cdist/conf/type/__autofs_reload/gencode-remote similarity index 62% rename from cdist/conf/type/__autofs_master/manifest rename to cdist/conf/type/__autofs_reload/gencode-remote index e429842e..883602e2 100755 --- a/cdist/conf/type/__autofs_master/manifest +++ b/cdist/conf/type/__autofs_reload/gencode-remote @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -19,13 +19,19 @@ # -if [ ! -f "$__object/parameter/header" ]; then - echo "$__type/files/auto.master.header" > "$__object/parameter/header" -fi +os=$(cat "$__global/explorer/os") -[ -d "$__object/files" ] || mkdir "$__object/files" -require="$__object_name" __file /etc/auto.master --source "$__object/files/auto.master" \ - --mode 644 \ - --owner root \ - --group root +not_supported() { + echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 + echo "Please contribute an implementation for it if you can." >&2 + exit 1 +} +case "$os" in + ubuntu|debian|archlinux) + echo "pkill -HUP automount" + ;; + *) + not_supported + ;; +esac diff --git a/cdist/conf/type/__autofs_master/man.text b/cdist/conf/type/__autofs_reload/man.text similarity index 51% rename from cdist/conf/type/__autofs_master/man.text rename to cdist/conf/type/__autofs_reload/man.text index 641c8393..d2085a98 100644 --- a/cdist/conf/type/__autofs_master/man.text +++ b/cdist/conf/type/__autofs_reload/man.text @@ -1,38 +1,33 @@ -cdist-type__autofs_master(7) +cdist-type__autofs_reload(7) ============================ Steven Armstrong NAME ---- -cdist-type__autofs_master - Generate the auto.master file +cdist-type__autofs_reload - tell automounter to reload config file DESCRIPTION ----------- -This cdist type generates a auto.master configuration from given __autofs_map -definitions. See cdist-type__auto_map(7). +This space intentionally left blank. REQUIRED PARAMETERS ------------------- -None +None. + OPTIONAL PARAMETERS ------------------- -header:: - Absolute path to a file used as the header for the generated auto.master - file. +None. + EXAMPLES -------- -------------------------------------------------------------------------------- -# auto.master with default header -__autofs_master - -# auto.master with custom header -__autofs_master --header /path/to/header +__autofs_reload -------------------------------------------------------------------------------- @@ -43,5 +38,5 @@ SEE ALSO COPYING ------- -Copyright \(C) 2011 Steven Armstrong. Free use of this software is +Copyright \(C) 2012 Steven Armstrong. Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__autofs_reload/singleton b/cdist/conf/type/__autofs_reload/singleton new file mode 100644 index 00000000..e69de29b From 7e951fd4d184a2948c808039e0ed92a83ef07974 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 7 Nov 2012 15:16:04 +0100 Subject: [PATCH 345/412] __apt_ppa: /installed/present/ Signed-off-by: Steven Armstrong --- cdist/conf/type/__apt_ppa/manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__apt_ppa/manifest b/cdist/conf/type/__apt_ppa/manifest index 04c66ce0..e7ad0c26 100755 --- a/cdist/conf/type/__apt_ppa/manifest +++ b/cdist/conf/type/__apt_ppa/manifest @@ -20,7 +20,7 @@ name="$__object_id" -__package python-software-properties --state installed +__package python-software-properties --state present require="__package/python-software-properties" \ __file /usr/local/bin/remove-apt-repository \ From 8f525fbc8345997b3a4cb93f88afb32968c3f7fd Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 7 Nov 2012 15:46:25 +0100 Subject: [PATCH 346/412] __apt_update_index: ignore top level directory Signed-off-by: Steven Armstrong --- cdist/conf/type/__apt_update_index/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__apt_update_index/gencode-remote b/cdist/conf/type/__apt_update_index/gencode-remote index e66ff7a3..61ce11a9 100755 --- a/cdist/conf/type/__apt_update_index/gencode-remote +++ b/cdist/conf/type/__apt_update_index/gencode-remote @@ -20,7 +20,7 @@ # run 'apt-get update' if anything in /etc/apt is newer then /var/lib/apt/lists cat << DONE -if find /etc/apt -cnewer /var/lib/apt/lists | grep . > /dev/null; then +if find /etc/apt -mindepth 1 -cnewer /var/lib/apt/lists | grep . > /dev/null; then apt-get update || apt-get update fi DONE From f769b395c27a8eaf5ebdda518d2c9a201d9a5d46 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 7 Nov 2012 16:28:21 +0100 Subject: [PATCH 347/412] __file: implement --state exists Signed-off-by: Steven Armstrong --- cdist/conf/type/__file/gencode-local | 2 +- cdist/conf/type/__file/gencode-remote | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__file/gencode-local b/cdist/conf/type/__file/gencode-local index b74893fb..a6c55abf 100755 --- a/cdist/conf/type/__file/gencode-local +++ b/cdist/conf/type/__file/gencode-local @@ -27,7 +27,7 @@ exists="$(cat "$__object/explorer/exists")" [ "$state_should" = "exists" -a "$exists" = "yes" ] && exit 0 # nothing to do -if [ "$state_should" = "present" ]; then +if [ "$state_should" = "present" -o "$state_should" = "exists" ]; then if [ -f "$__object/parameter/source" ]; then source="$(cat "$__object/parameter/source")" if [ "$source" = "-" ]; then diff --git a/cdist/conf/type/__file/gencode-remote b/cdist/conf/type/__file/gencode-remote index 2b4c7e45..04a1ea78 100755 --- a/cdist/conf/type/__file/gencode-remote +++ b/cdist/conf/type/__file/gencode-remote @@ -26,7 +26,7 @@ state_should="$(cat "$__object/parameter/state")" exists="$(cat "$__object/explorer/exists")" case "$state_should" in - present) + present|exists) # No source? Create empty file if [ ! -f "$__object/parameter/source" ]; then if [ "$exists" = "no" ]; then From 324a88c435b89395c1c67b800588ef7ef0aa10db Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 7 Nov 2012 16:49:55 +0100 Subject: [PATCH 348/412] __timezone: set timezone in /etc/timezone on debuntu Signed-off-by: Steven Armstrong --- cdist/conf/type/__timezone/gencode-remote | 30 +++++++++++++++++++++++ cdist/conf/type/__timezone/manifest | 21 +++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100755 cdist/conf/type/__timezone/gencode-remote diff --git a/cdist/conf/type/__timezone/gencode-remote b/cdist/conf/type/__timezone/gencode-remote new file mode 100755 index 00000000..b4782d4b --- /dev/null +++ b/cdist/conf/type/__timezone/gencode-remote @@ -0,0 +1,30 @@ +#!/bin/sh +# +# 2012 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 . +# +# +# This type allows to configure the desired localtime timezone. + +timezone="$__object_id" +os=$(cat "$__global/explorer/os") + +case "$os" in + ubuntu|debian) + echo "echo \"$timezone\" > /etc/timezone" + ;; +esac diff --git a/cdist/conf/type/__timezone/manifest b/cdist/conf/type/__timezone/manifest index b0bae209..7583c9c9 100755 --- a/cdist/conf/type/__timezone/manifest +++ b/cdist/conf/type/__timezone/manifest @@ -1,6 +1,7 @@ #!/bin/sh # # 2011 Ramon Salvadó (rsalvado at gnuine dot com) +# 2012 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -22,7 +23,25 @@ timezone="$__object_id" -__package tzdata --state installed +os=$(cat "$__global/explorer/os") + +not_supported() { + echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 + echo "Please contribute an implementation for it if you can." >&2 + exit 1 +} + +case "$os" in + ubuntu|debian|archlinux) + : + ;; + *) + not_supported + ;; +esac + +# same for all supported os's +__package tzdata --state present require="__package/tzdata" __link /etc/localtime \ --source "/usr/share/zoneinfo/${timezone}" \ --type symbolic From 6adb20b8292851b67a7357ee28ed4ab7eb321dc3 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 7 Nov 2012 16:52:44 +0100 Subject: [PATCH 349/412] __ssh_authorized_key: /installed/present/ Signed-off-by: Steven Armstrong --- cdist/conf/type/__ssh_authorized_key/manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__ssh_authorized_key/manifest b/cdist/conf/type/__ssh_authorized_key/manifest index d9db9c78..8984d5d4 100755 --- a/cdist/conf/type/__ssh_authorized_key/manifest +++ b/cdist/conf/type/__ssh_authorized_key/manifest @@ -21,7 +21,7 @@ # This type allows to send a public ssh key from a user to the # authorized_keys of another # -#require="__package openssh-server --state installed" +#require="__package openssh-server --state present" # Get option srcuser if defined if [ -f "$__object/parameter/srcuser" ]; then srcuser=`cat "$__object/parameter/srcuser"` From 489fa2a8be06260c241ec2c71f535c63577cadac Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 17:21:22 +0100 Subject: [PATCH 350/412] +quotes Signed-off-by: Nico Schottelius --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index 34775a31..baad93be 100755 --- a/build +++ b/build @@ -173,7 +173,7 @@ eof $0 blog version=$($0 changelog-version) file=cdist-${version}-released.mdwn - cd $WEBBBLOG + cd "$WEBBLOG" git add "$file" git commit -m "New cdist version (blogentry): $version" "$file" git push From ace897de258ade3f0597f81f7850de745a3cd149 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 17:28:27 +0100 Subject: [PATCH 351/412] simplify timezone manifest Signed-off-by: Nico Schottelius --- cdist/conf/type/__timezone/manifest | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/cdist/conf/type/__timezone/manifest b/cdist/conf/type/__timezone/manifest index 7583c9c9..76fa5c97 100755 --- a/cdist/conf/type/__timezone/manifest +++ b/cdist/conf/type/__timezone/manifest @@ -2,6 +2,7 @@ # # 2011 Ramon Salvadó (rsalvado at gnuine dot com) # 2012 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -22,26 +23,16 @@ # This type allows to configure the desired localtime timezone. timezone="$__object_id" - os=$(cat "$__global/explorer/os") -not_supported() { - echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 - echo "Please contribute an implementation for it if you can." >&2 - exit 1 -} - case "$os" in - ubuntu|debian|archlinux) - : - ;; - *) - not_supported - ;; + archlinux|debian|ubuntu) + __package tzdata --state present + require="__package/tzdata" __link /etc/localtime \ + --source "/usr/share/zoneinfo/${timezone}" \ + --type symbolic + ;; + *) + echo "Unsupported OS $os" >&2 + ;; esac - -# same for all supported os's -__package tzdata --state present -require="__package/tzdata" __link /etc/localtime \ - --source "/usr/share/zoneinfo/${timezone}" \ - --type symbolic From a4b2e2ce9556ef82f02126080a1c531ed2dbaf46 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 17:34:21 +0100 Subject: [PATCH 352/412] ++changes(next version) Signed-off-by: Nico Schottelius --- docs/changelog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/changelog b/docs/changelog index f8030609..863f6db3 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,6 +4,10 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius +2.1.0pre8: + * Type cleanup: __apt_ppa, __apt_ppa_update_index, __file, + __ssh_authorized_key, __timezone, all install types (Steven Armstrong) + 2.1.0pre7: 2012-11-07 * Core: All unit tests restored back to working * Core: Print error message on missing initial manifest From 265d1af56a8a1d59080b63bff8aa24c8db4df42b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 17:40:39 +0100 Subject: [PATCH 353/412] rename vm to diskimage, ensure state is setup Signed-off-by: Nico Schottelius --- cdist/conf/type/__qemu_img/gencode-remote | 7 ++++--- cdist/conf/type/__qemu_img/manifest | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cdist/conf/type/__qemu_img/gencode-remote b/cdist/conf/type/__qemu_img/gencode-remote index acadcef0..e5ff1b4f 100644 --- a/cdist/conf/type/__qemu_img/gencode-remote +++ b/cdist/conf/type/__qemu_img/gencode-remote @@ -2,7 +2,8 @@ # State: absent is handled by manifest - we need only to do stuff if image is # not existing and state != absent # -[ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")" +state="present" +[ -f "$__object/parameter/state" ] state="$(cat "$__object/parameter/state")" [ "$state" = "absent" ] && exit 0 exists="$(cat "$__object/explorer/exists")" @@ -15,6 +16,6 @@ exists="$(cat "$__object/explorer/exists")" format=qcow2 [ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")" size="$(cat "$__object/parameter/size")" -vm="/$__object_id" +diskimage="/$__object_id" -echo qemu-img create -f \"$format\" \"$vm\" \"$size\" +echo qemu-img create -f \"$format\" \"$diskimage\" \"$size\" diff --git a/cdist/conf/type/__qemu_img/manifest b/cdist/conf/type/__qemu_img/manifest index d343e188..b835301d 100644 --- a/cdist/conf/type/__qemu_img/manifest +++ b/cdist/conf/type/__qemu_img/manifest @@ -3,12 +3,13 @@ # format=qcow2 +state=present [ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")" [ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")" -vm="/$__object_id" +diskimage="/$__object_id" # Absent is ensured by __file, present by gencode-remote if [ "$state" = "absent" ]; then - __file "$vm" --state absent + __file "$diskimage" --state absent fi From a0add17cf804696f634b85b31bcab4329d4b0903 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 17:44:54 +0100 Subject: [PATCH 354/412] ++exit 1 Signed-off-by: Nico Schottelius --- cdist/conf/type/__timezone/manifest | 1 + 1 file changed, 1 insertion(+) diff --git a/cdist/conf/type/__timezone/manifest b/cdist/conf/type/__timezone/manifest index 76fa5c97..81de0217 100755 --- a/cdist/conf/type/__timezone/manifest +++ b/cdist/conf/type/__timezone/manifest @@ -34,5 +34,6 @@ case "$os" in ;; *) echo "Unsupported OS $os" >&2 + exit 1 ;; esac From 7a44f3057412b2a600c91b7feabe59f32a95571f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 17:47:55 +0100 Subject: [PATCH 355/412] simplify manifest Signed-off-by: Nico Schottelius --- cdist/conf/type/__autofs/manifest | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/cdist/conf/type/__autofs/manifest b/cdist/conf/type/__autofs/manifest index 31844415..4a726c0a 100755 --- a/cdist/conf/type/__autofs/manifest +++ b/cdist/conf/type/__autofs/manifest @@ -1,6 +1,7 @@ #!/bin/sh # # 2012 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -21,18 +22,13 @@ os=$(cat "$__global/explorer/os") -not_supported() { - echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 - echo "Please contribute an implementation for it if you can." >&2 - exit 1 -} - case "$os" in - ubuntu|debian|archlinux) - __package autofs --state present - __start_on_boot autofs --state present - ;; - *) - not_supported - ;; + ubuntu|debian|archlinux) + __package autofs --state present + __start_on_boot autofs --state present + ;; + *) + echo "Unsupported OS: $os" >&2 + exit 1 + ;; esac From 8ab408f890970a92d88ccf39c770a37c10d58fa9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 17:52:05 +0100 Subject: [PATCH 356/412] remove parameter change code Signed-off-by: Nico Schottelius --- cdist/conf/type/__file/gencode-local | 5 +++-- cdist/conf/type/__file/gencode-remote | 5 +++-- cdist/conf/type/__file/manifest | 24 ------------------------ 3 files changed, 6 insertions(+), 28 deletions(-) delete mode 100755 cdist/conf/type/__file/manifest diff --git a/cdist/conf/type/__file/gencode-local b/cdist/conf/type/__file/gencode-local index a6c55abf..087011c4 100755 --- a/cdist/conf/type/__file/gencode-local +++ b/cdist/conf/type/__file/gencode-local @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -22,7 +22,8 @@ # destination="/$__object_id" -state_should="$(cat "$__object/parameter/state")" +state_should=present +[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" exists="$(cat "$__object/explorer/exists")" [ "$state_should" = "exists" -a "$exists" = "yes" ] && exit 0 # nothing to do diff --git a/cdist/conf/type/__file/gencode-remote b/cdist/conf/type/__file/gencode-remote index 04a1ea78..8b03e919 100755 --- a/cdist/conf/type/__file/gencode-remote +++ b/cdist/conf/type/__file/gencode-remote @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -22,7 +22,8 @@ # destination="/$__object_id" -state_should="$(cat "$__object/parameter/state")" +state_should=present +[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" exists="$(cat "$__object/explorer/exists")" case "$state_should" in diff --git a/cdist/conf/type/__file/manifest b/cdist/conf/type/__file/manifest deleted file mode 100755 index 6b5e1ca7..00000000 --- a/cdist/conf/type/__file/manifest +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# 2012 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# - -# set default: present, if not setup -statefile="$__object/parameter/state" -[ -f "$statefile" ] || echo present > "$statefile" From 2cfa046cdd373df9248375fc52498786b6a1778e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 17:57:47 +0100 Subject: [PATCH 357/412] indentions, whitespace Signed-off-by: Nico Schottelius --- cdist/conf/type/__issue/manifest | 21 +++++++++---------- cdist/conf/type/__ssh_authorized_key/manifest | 1 - 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/cdist/conf/type/__issue/manifest b/cdist/conf/type/__issue/manifest index eff6b808..d2720f2d 100755 --- a/cdist/conf/type/__issue/manifest +++ b/cdist/conf/type/__issue/manifest @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -24,17 +24,16 @@ destination=/etc/issue os="$(cat "$__global/explorer/os")" if [ -f "$__object/parameter/source" ]; then - source="$(cat "$__object/parameter/source")" - echo using $source + source="$(cat "$__object/parameter/source")" else - case "$os" in - archlinux|redhat) - source="$__type/files/$os" - ;; - *) - source="$__type/files/default" - ;; - esac + case "$os" in + archlinux|redhat) + source="$__type/files/$os" + ;; + *) + source="$__type/files/default" + ;; + esac fi __file "$destination" --source "$source" diff --git a/cdist/conf/type/__ssh_authorized_key/manifest b/cdist/conf/type/__ssh_authorized_key/manifest index 8984d5d4..86c58740 100755 --- a/cdist/conf/type/__ssh_authorized_key/manifest +++ b/cdist/conf/type/__ssh_authorized_key/manifest @@ -64,4 +64,3 @@ require="__directory${sshpath}" \ # the line added depends on authorized_keys existence require="__file${sshpath}/authorized_keys" __addifnosuchline sshkey --file \ "$sshpath/authorized_keys" --line "$rsa" - From 7814ece7b7745b0bb97140d23c2f65fe98e70d0e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 18:01:30 +0100 Subject: [PATCH 358/412] remove parameter changing code Signed-off-by: Nico Schottelius --- cdist/conf/type/__link/gencode-remote | 50 +++++++++++++-------------- cdist/conf/type/__link/manifest | 24 ------------- 2 files changed, 24 insertions(+), 50 deletions(-) delete mode 100755 cdist/conf/type/__link/manifest diff --git a/cdist/conf/type/__link/gencode-remote b/cdist/conf/type/__link/gencode-remote index 8d4cc3d5..2975ef69 100755 --- a/cdist/conf/type/__link/gencode-remote +++ b/cdist/conf/type/__link/gencode-remote @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -27,35 +27,33 @@ type="$(cat "$__object/parameter/type")" source="$(cat "$__object/parameter/source")" case "$type" in - symbolic) - lnopt="-s" - ;; - hard) - lnopt="" - ;; - *) - echo "Unknown type: $type" >&2 - exit 1 - ;; + symbolic) + lnopt="-s" + ;; + hard) + lnopt="" + ;; + *) + echo "Unknown link type: $type" >&2 + exit 1 + ;; esac state_is="$(cat "$__object/explorer/state")" -state_should="$(cat "$__object/parameter/state")" +state_should=present +[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" -if [ "$state_should" = "$state_is" ]; then - # nothing to do - exit 0 -fi +[ "$state_should" = "$state_is" ] && exit 0 case "$state_should" in - present) - echo ln ${lnopt} -f \"$source\" \"$destination\" - ;; - absent) - echo rm -f \"$destination\" - ;; - *) - echo "Unknown state: $state_should" >&2 - exit 1 - ;; + present) + echo ln ${lnopt} -f \"$source\" \"$destination\" + ;; + absent) + echo rm -f \"$destination\" + ;; + *) + echo "Unknown state: $state_should" >&2 + exit 1 + ;; esac diff --git a/cdist/conf/type/__link/manifest b/cdist/conf/type/__link/manifest deleted file mode 100755 index 6b5e1ca7..00000000 --- a/cdist/conf/type/__link/manifest +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# 2012 Nico Schottelius (nico-cdist at schottelius.org) -# -# This file is part of cdist. -# -# cdist is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# - -# set default: present, if not setup -statefile="$__object/parameter/state" -[ -f "$statefile" ] || echo present > "$statefile" From 82830f191dc040e1e4087604260c10f20de44a7e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 18:04:49 +0100 Subject: [PATCH 359/412] link __process to __start_on_boot and vice versa Signed-off-by: Nico Schottelius --- cdist/conf/type/__process/man.text | 3 +-- cdist/conf/type/__start_on_boot/man.text | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__process/man.text b/cdist/conf/type/__process/man.text index 961a7f9a..929ba6a0 100644 --- a/cdist/conf/type/__process/man.text +++ b/cdist/conf/type/__process/man.text @@ -17,8 +17,6 @@ REQUIRED PARAMETERS ------------------- state:: State of the process: Either present or absent - (old values "stopped" and "running" are deprecated and will be removed in - cdist 2.1). OPTIONAL PARAMETERS @@ -66,6 +64,7 @@ __process rpcstatd --state present --start "/etc/init.d/statd start" \ SEE ALSO -------- - cdist-type(7) +- cdist-type__start_on_boot(7) COPYING diff --git a/cdist/conf/type/__start_on_boot/man.text b/cdist/conf/type/__start_on_boot/man.text index 0e75c9ab..58a68d65 100644 --- a/cdist/conf/type/__start_on_boot/man.text +++ b/cdist/conf/type/__start_on_boot/man.text @@ -45,6 +45,7 @@ __start_on_boot puppet --state absent SEE ALSO -------- - cdist-type(7) +- cdist-type__process(7) COPYING From aeff2bcb0f0523f4a02698910fbc3295baeb9b23 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 18:06:11 +0100 Subject: [PATCH 360/412] indention Signed-off-by: Nico Schottelius --- cdist/conf/type/__process/explorer/runs | 6 +++--- cdist/conf/type/__process/gencode-remote | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cdist/conf/type/__process/explorer/runs b/cdist/conf/type/__process/explorer/runs index 240ebef9..561e2fe9 100755 --- a/cdist/conf/type/__process/explorer/runs +++ b/cdist/conf/type/__process/explorer/runs @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -22,9 +22,9 @@ # if [ -f "$__object/parameter/name" ]; then - name="$(cat "$__object/parameter/name")" + name="$(cat "$__object/parameter/name")" else - name="$__object_id" + name="$__object_id" fi pgrep -x -f "$name" || true diff --git a/cdist/conf/type/__process/gencode-remote b/cdist/conf/type/__process/gencode-remote index e4519f3c..fdb6033a 100755 --- a/cdist/conf/type/__process/gencode-remote +++ b/cdist/conf/type/__process/gencode-remote @@ -20,9 +20,9 @@ # if [ -f "$__object/parameter/name" ]; then - name="$(cat "$__object/parameter/name")" + name="$(cat "$__object/parameter/name")" else - name="$__object_id" + name="$__object_id" fi state_should="$(cat "$__object/parameter/state")" From 347c620eedd1385aea2492884bbc799372311293 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 18:08:03 +0100 Subject: [PATCH 361/412] indent Signed-off-by: Nico Schottelius --- cdist/conf/type/__file/explorer/cksum | 14 +++++++------- cdist/conf/type/__file/explorer/exists | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cdist/conf/type/__file/explorer/cksum b/cdist/conf/type/__file/explorer/cksum index dcad99ba..335e4e7a 100755 --- a/cdist/conf/type/__file/explorer/cksum +++ b/cdist/conf/type/__file/explorer/cksum @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -24,11 +24,11 @@ destination="/$__object_id" if [ -e "$destination" ]; then - if [ -f "$destination" ]; then - cksum < "$destination" - else - echo "NO REGULAR FILE" - fi + if [ -f "$destination" ]; then + cksum < "$destination" + else + echo "NO REGULAR FILE" + fi else - echo "NO FILE FOUND, NO CHECKSUM CALCULATED." + echo "NO FILE FOUND, NO CHECKSUM CALCULATED." fi diff --git a/cdist/conf/type/__file/explorer/exists b/cdist/conf/type/__file/explorer/exists index f8b85671..c319cb5d 100755 --- a/cdist/conf/type/__file/explorer/exists +++ b/cdist/conf/type/__file/explorer/exists @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -24,7 +24,7 @@ destination="/$__object_id" if [ -e "$destination" ]; then - echo yes + echo yes else - echo no + echo no fi From 13d6644966ca8319eef99c49cedd1a8e518a2b1c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 18:10:15 +0100 Subject: [PATCH 362/412] do not report errors on missing gemset Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm_gem/explorer/state | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__rvm_gem/explorer/state b/cdist/conf/type/__rvm_gem/explorer/state index 09509a2e..4146d666 100755 --- a/cdist/conf/type/__rvm_gem/explorer/state +++ b/cdist/conf/type/__rvm_gem/explorer/state @@ -1,6 +1,7 @@ #!/bin/sh # # 2012 Evax Software +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -30,8 +31,8 @@ fi if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\" rvm list | grep -q $ruby"; then if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\" -rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname && -rvm use $gemset > /dev/null && gem list | grep -q $gem"; then +rvm use $ruby > /dev/null 2>&1; rvm gemset list | grep -q $gemsetname && +rvm use $gemset > /dev/null 2>&1 && gem list | grep -q $gem"; then echo "present" exit 0 fi From 47424bf200c7e0fb2361f0b710c892e48153d1f7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 18:15:15 +0100 Subject: [PATCH 363/412] update __package* manpages Signed-off-by: Nico Schottelius --- cdist/conf/type/__package/man.text | 2 +- cdist/conf/type/__package_pip/man.text | 2 +- cdist/conf/type/__package_pkg_freebsd/man.text | 10 +++++----- cdist/conf/type/__package_pkg_openbsd/man.text | 2 +- cdist/conf/type/__package_rubygem/man.text | 2 +- cdist/conf/type/__package_yum/man.text | 3 +-- cdist/conf/type/__package_zypper/man.text | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/cdist/conf/type/__package/man.text b/cdist/conf/type/__package/man.text index 69ecf0ad..229ccf92 100644 --- a/cdist/conf/type/__package/man.text +++ b/cdist/conf/type/__package/man.text @@ -34,7 +34,7 @@ type:: __package_emerge for Gentoo state:: - The state the package should be in, either "present" or "absent" + either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__package_pip/man.text b/cdist/conf/type/__package_pip/man.text index 21d4f9fd..8cb7d80a 100644 --- a/cdist/conf/type/__package_pip/man.text +++ b/cdist/conf/type/__package_pip/man.text @@ -28,7 +28,7 @@ pip:: Instead of using pip from PATH, use the specific pip path. state:: - Either "present" or "absent". + Either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__package_pkg_freebsd/man.text b/cdist/conf/type/__package_pkg_freebsd/man.text index f1589037..71387148 100644 --- a/cdist/conf/type/__package_pkg_freebsd/man.text +++ b/cdist/conf/type/__package_pkg_freebsd/man.text @@ -21,19 +21,19 @@ None OPTIONAL PARAMETERS ------------------- name:: - If supplied, use the name and not the object id as the package name. + If supplied, use the name and not the object id as the package name. flavor:: - If supplied, use to avoid ambiguity. + If supplied, use to avoid ambiguity. version:: - If supplied, use to install a specific version of the package named. + If supplied, use to install a specific version of the package named. pkgsite:: - If supplied, use to install from a specific package repository. + If supplied, use to install from a specific package repository. state:: - Either "present" or "absent". + Either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__package_pkg_openbsd/man.text b/cdist/conf/type/__package_pkg_openbsd/man.text index 8fcc3216..f523a892 100644 --- a/cdist/conf/type/__package_pkg_openbsd/man.text +++ b/cdist/conf/type/__package_pkg_openbsd/man.text @@ -27,7 +27,7 @@ flavor:: If supplied, use to avoid ambiguity. state:: - The state the package should be in, either "present" or "absent" + Either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__package_rubygem/man.text b/cdist/conf/type/__package_rubygem/man.text index feefe699..a808c2aa 100644 --- a/cdist/conf/type/__package_rubygem/man.text +++ b/cdist/conf/type/__package_rubygem/man.text @@ -24,7 +24,7 @@ name:: If supplied, use the name and not the object id as the package name. state:: - The state the package should be in, either "present" or "absent" + Either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__package_yum/man.text b/cdist/conf/type/__package_yum/man.text index 9aabf7fb..d958dd1e 100644 --- a/cdist/conf/type/__package_yum/man.text +++ b/cdist/conf/type/__package_yum/man.text @@ -26,8 +26,7 @@ name:: If supplied, use the name and not the object id as the package name. state:: - The state the package should be in, either "present" or "absent" - (the old values "installed" or "removed" will be removed in cdist 2.1). + Either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__package_zypper/man.text b/cdist/conf/type/__package_zypper/man.text index 702d51e5..e2261d33 100644 --- a/cdist/conf/type/__package_zypper/man.text +++ b/cdist/conf/type/__package_zypper/man.text @@ -24,7 +24,7 @@ name:: If supplied, use the name and not the object id as the package name. state:: - The state the package should be in, either "present" or "absent" + Either "present" or "absent", defaults to "present" EXAMPLES From 344e08dddae8c2a03b4ac135a3feb72c02a6ff27 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 18:22:25 +0100 Subject: [PATCH 364/412] Archive __autofs types (fixes #116) Signed-off-by: Nico Schottelius --- other/archived_types/.README.unmaintained | 1 + other/archived_types/README | 3 +++ other/archived_types/__autofs/README | 1 + {cdist/conf/type => other/archived_types}/__autofs/man.text | 0 {cdist/conf/type => other/archived_types}/__autofs/manifest | 0 {cdist/conf/type => other/archived_types}/__autofs/singleton | 0 other/archived_types/__autofs_map/README | 1 + .../type => other/archived_types}/__autofs_map/explorer/entry | 0 .../type => other/archived_types}/__autofs_map/gencode-remote | 0 .../conf/type => other/archived_types}/__autofs_map/man.text | 0 .../conf/type => other/archived_types}/__autofs_map/manifest | 0 .../archived_types}/__autofs_map/parameter/boolean | 0 .../archived_types}/__autofs_map/parameter/optional | 0 .../archived_types}/__autofs_map/parameter/required | 0 other/archived_types/__autofs_reload/README | 1 + .../archived_types}/__autofs_reload/gencode-remote | 0 .../type => other/archived_types}/__autofs_reload/man.text | 0 .../type => other/archived_types}/__autofs_reload/singleton | 0 18 files changed, 7 insertions(+) create mode 100644 other/archived_types/.README.unmaintained create mode 100644 other/archived_types/README create mode 120000 other/archived_types/__autofs/README rename {cdist/conf/type => other/archived_types}/__autofs/man.text (100%) rename {cdist/conf/type => other/archived_types}/__autofs/manifest (100%) rename {cdist/conf/type => other/archived_types}/__autofs/singleton (100%) create mode 120000 other/archived_types/__autofs_map/README rename {cdist/conf/type => other/archived_types}/__autofs_map/explorer/entry (100%) rename {cdist/conf/type => other/archived_types}/__autofs_map/gencode-remote (100%) rename {cdist/conf/type => other/archived_types}/__autofs_map/man.text (100%) rename {cdist/conf/type => other/archived_types}/__autofs_map/manifest (100%) rename {cdist/conf/type => other/archived_types}/__autofs_map/parameter/boolean (100%) rename {cdist/conf/type => other/archived_types}/__autofs_map/parameter/optional (100%) rename {cdist/conf/type => other/archived_types}/__autofs_map/parameter/required (100%) create mode 120000 other/archived_types/__autofs_reload/README rename {cdist/conf/type => other/archived_types}/__autofs_reload/gencode-remote (100%) rename {cdist/conf/type => other/archived_types}/__autofs_reload/man.text (100%) rename {cdist/conf/type => other/archived_types}/__autofs_reload/singleton (100%) diff --git a/other/archived_types/.README.unmaintained b/other/archived_types/.README.unmaintained new file mode 100644 index 00000000..e9795911 --- /dev/null +++ b/other/archived_types/.README.unmaintained @@ -0,0 +1 @@ +This type is not maintained by anymore and has thus been removed from cdist. diff --git a/other/archived_types/README b/other/archived_types/README new file mode 100644 index 00000000..32cd1f3d --- /dev/null +++ b/other/archived_types/README @@ -0,0 +1,3 @@ +This directory contains types that used to be included with +cdist, but are not in use anymore. Have a look at the README +file in each type, to find out why it was removed. diff --git a/other/archived_types/__autofs/README b/other/archived_types/__autofs/README new file mode 120000 index 00000000..7495e43b --- /dev/null +++ b/other/archived_types/__autofs/README @@ -0,0 +1 @@ +../.README.unmaintained \ No newline at end of file diff --git a/cdist/conf/type/__autofs/man.text b/other/archived_types/__autofs/man.text similarity index 100% rename from cdist/conf/type/__autofs/man.text rename to other/archived_types/__autofs/man.text diff --git a/cdist/conf/type/__autofs/manifest b/other/archived_types/__autofs/manifest similarity index 100% rename from cdist/conf/type/__autofs/manifest rename to other/archived_types/__autofs/manifest diff --git a/cdist/conf/type/__autofs/singleton b/other/archived_types/__autofs/singleton similarity index 100% rename from cdist/conf/type/__autofs/singleton rename to other/archived_types/__autofs/singleton diff --git a/other/archived_types/__autofs_map/README b/other/archived_types/__autofs_map/README new file mode 120000 index 00000000..7495e43b --- /dev/null +++ b/other/archived_types/__autofs_map/README @@ -0,0 +1 @@ +../.README.unmaintained \ No newline at end of file diff --git a/cdist/conf/type/__autofs_map/explorer/entry b/other/archived_types/__autofs_map/explorer/entry similarity index 100% rename from cdist/conf/type/__autofs_map/explorer/entry rename to other/archived_types/__autofs_map/explorer/entry diff --git a/cdist/conf/type/__autofs_map/gencode-remote b/other/archived_types/__autofs_map/gencode-remote similarity index 100% rename from cdist/conf/type/__autofs_map/gencode-remote rename to other/archived_types/__autofs_map/gencode-remote diff --git a/cdist/conf/type/__autofs_map/man.text b/other/archived_types/__autofs_map/man.text similarity index 100% rename from cdist/conf/type/__autofs_map/man.text rename to other/archived_types/__autofs_map/man.text diff --git a/cdist/conf/type/__autofs_map/manifest b/other/archived_types/__autofs_map/manifest similarity index 100% rename from cdist/conf/type/__autofs_map/manifest rename to other/archived_types/__autofs_map/manifest diff --git a/cdist/conf/type/__autofs_map/parameter/boolean b/other/archived_types/__autofs_map/parameter/boolean similarity index 100% rename from cdist/conf/type/__autofs_map/parameter/boolean rename to other/archived_types/__autofs_map/parameter/boolean diff --git a/cdist/conf/type/__autofs_map/parameter/optional b/other/archived_types/__autofs_map/parameter/optional similarity index 100% rename from cdist/conf/type/__autofs_map/parameter/optional rename to other/archived_types/__autofs_map/parameter/optional diff --git a/cdist/conf/type/__autofs_map/parameter/required b/other/archived_types/__autofs_map/parameter/required similarity index 100% rename from cdist/conf/type/__autofs_map/parameter/required rename to other/archived_types/__autofs_map/parameter/required diff --git a/other/archived_types/__autofs_reload/README b/other/archived_types/__autofs_reload/README new file mode 120000 index 00000000..7495e43b --- /dev/null +++ b/other/archived_types/__autofs_reload/README @@ -0,0 +1 @@ +../.README.unmaintained \ No newline at end of file diff --git a/cdist/conf/type/__autofs_reload/gencode-remote b/other/archived_types/__autofs_reload/gencode-remote similarity index 100% rename from cdist/conf/type/__autofs_reload/gencode-remote rename to other/archived_types/__autofs_reload/gencode-remote diff --git a/cdist/conf/type/__autofs_reload/man.text b/other/archived_types/__autofs_reload/man.text similarity index 100% rename from cdist/conf/type/__autofs_reload/man.text rename to other/archived_types/__autofs_reload/man.text diff --git a/cdist/conf/type/__autofs_reload/singleton b/other/archived_types/__autofs_reload/singleton similarity index 100% rename from cdist/conf/type/__autofs_reload/singleton rename to other/archived_types/__autofs_reload/singleton From 0eda57986fd205a7a64abbfd12a0e9103ff9d72e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 18:28:58 +0100 Subject: [PATCH 365/412] remove parameter changing code in __key_value (fixes #114,#36) Signed-off-by: Nico Schottelius --- cdist/conf/type/__key_value/gencode-remote | 61 +++++++++++----------- cdist/conf/type/__key_value/manifest | 10 ++-- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/cdist/conf/type/__key_value/gencode-remote b/cdist/conf/type/__key_value/gencode-remote index b3ffeb46..5fa24d5b 100755 --- a/cdist/conf/type/__key_value/gencode-remote +++ b/cdist/conf/type/__key_value/gencode-remote @@ -1,6 +1,7 @@ #!/bin/sh # # 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -18,42 +19,42 @@ # along with cdist. If not, see . # -key="$(cat "$__object/parameter/key")" +key="$__object_id" +[ -f "$__object/parameter/key" ] && key="$(cat "$__object/parameter/key")" +state_should=present +[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" + file="$(cat "$__object/parameter/file")" delimiter="$(cat "$__object/parameter/delimiter")" value="$(cat "$__object/parameter/value")" state_is="$(cat "$__object/explorer/state")" -state_should="$(cat "$__object/parameter/state")" -if [ "$state_is" = "$state_should" ]; then - # nothing to do - exit 0 -fi +[ "$state_is" = "$state_should" ] && exit 0 case "$state_should" in - absent) - # remove lines starting with key - echo "sed '/^$key\($delimiter\+\)/d' \"$file\" > \"$file.cdist-tmp\"" - echo "mv \"$file.cdist-tmp\" \"$file\"" - ;; - present) - case "$state_is" in - absent) - # add new key and value - echo "echo \"${key}${delimiter}${value}\" >> \"$file\"" - ;; - wrongvalue) - # change exisiting value - echo "sed \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\" > \"$file.cdist-tmp\"" - echo "mv \"$file.cdist-tmp\" \"$file\"" - ;; - *) - echo "Unknown explorer state: $state_is" >&2 - exit 1 - esac - ;; - *) - echo "Unknown state: $state_should" >&2 - exit 1 + absent) + # remove lines starting with key + echo "sed '/^$key\($delimiter\+\)/d' \"$file\" > \"$file.cdist-tmp\"" + echo "mv \"$file.cdist-tmp\" \"$file\"" + ;; + present) + case "$state_is" in + absent) + # add new key and value + echo "echo \"${key}${delimiter}${value}\" >> \"$file\"" + ;; + wrongvalue) + # change exisiting value + echo "sed \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\" > \"$file.cdist-tmp\"" + echo "mv \"$file.cdist-tmp\" \"$file\"" + ;; + *) + echo "Unknown explorer state: $state_is" >&2 + exit 1 + esac + ;; + *) + echo "Unknown state: $state_should" >&2 + exit 1 esac diff --git a/cdist/conf/type/__key_value/manifest b/cdist/conf/type/__key_value/manifest index 2e75e175..8ed9cc9c 100755 --- a/cdist/conf/type/__key_value/manifest +++ b/cdist/conf/type/__key_value/manifest @@ -1,6 +1,7 @@ #!/bin/sh # # 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -18,13 +19,10 @@ # along with cdist. If not, see . # -# set defaults -key="$(cat "$__object/parameter/key" 2>/dev/null \ - || echo "$__object_id" | tee "$__object/parameter/key")" -state="$(cat "$__object/parameter/state" 2>/dev/null \ - || echo "present" | tee "$__object/parameter/state")" +state_should=present +[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" -if [ "$state" = "present" -a ! -f "$__object/parameter/value" ]; then +if [ "$state_should" = "present" -a ! -f "$__object/parameter/value" ]; then echo "Missing required parameter 'value'" >&2 exit 1 fi From 91eccc892056172bdac3db0d34219ba72f1fe0e1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 18:57:52 +0100 Subject: [PATCH 366/412] ++changes(next_version) Signed-off-by: Nico Schottelius --- docs/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog b/docs/changelog index 863f6db3..5d3c1698 100644 --- a/docs/changelog +++ b/docs/changelog @@ -7,6 +7,7 @@ Changelog 2.1.0pre8: * Type cleanup: __apt_ppa, __apt_ppa_update_index, __file, __ssh_authorized_key, __timezone, all install types (Steven Armstrong) + * Types: Remove all parameter changing code 2.1.0pre7: 2012-11-07 * Core: All unit tests restored back to working From 3d4bb3837f073d820c833267e19a0ffd3f25d20b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 19:22:02 +0100 Subject: [PATCH 367/412] documentation cleanups Signed-off-by: Nico Schottelius --- cdist/conf/type/__package/man.text | 2 +- cdist/conf/type/__package_apt/man.text | 2 +- cdist/conf/type/__package_luarocks/man.text | 2 +- cdist/conf/type/__package_opkg/man.text | 2 +- cdist/conf/type/__package_pacman/man.text | 5 ++--- cdist/conf/type/__package_pip/man.text | 2 +- cdist/conf/type/__pf_ruleset/man.text | 1 + cdist/conf/type/__postgres_role/man.text | 2 +- cdist/conf/type/__process/man.text | 14 +++++++------- cdist/conf/type/__qemu_img/man.text | 3 +-- cdist/conf/type/__rvm/man.text | 2 +- cdist/conf/type/__rvm_gem/man.text | 8 ++++---- cdist/conf/type/__rvm_gemset/man.text | 6 +++--- cdist/conf/type/__rvm_ruby/man.text | 10 +++++----- cdist/conf/type/__start_on_boot/man.text | 2 +- 15 files changed, 31 insertions(+), 32 deletions(-) diff --git a/cdist/conf/type/__package/man.text b/cdist/conf/type/__package/man.text index 229ccf92..b656c890 100644 --- a/cdist/conf/type/__package/man.text +++ b/cdist/conf/type/__package/man.text @@ -34,7 +34,7 @@ type:: __package_emerge for Gentoo state:: - either "present" or "absent", defaults to "present" + Either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__package_apt/man.text b/cdist/conf/type/__package_apt/man.text index 35c34d33..5d4656c1 100644 --- a/cdist/conf/type/__package_apt/man.text +++ b/cdist/conf/type/__package_apt/man.text @@ -25,7 +25,7 @@ name:: If supplied, use the name and not the object id as the package name. state:: - The state the package should be in, either "present" or "absent" + Either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__package_luarocks/man.text b/cdist/conf/type/__package_luarocks/man.text index 18a80a79..657f68e5 100644 --- a/cdist/conf/type/__package_luarocks/man.text +++ b/cdist/conf/type/__package_luarocks/man.text @@ -24,7 +24,7 @@ name:: If supplied, use the name and not the object id as the package name. state:: - The state the package should be in, either "present" or "absent" + Either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__package_opkg/man.text b/cdist/conf/type/__package_opkg/man.text index 3d02d1ce..aeb0a1c5 100644 --- a/cdist/conf/type/__package_opkg/man.text +++ b/cdist/conf/type/__package_opkg/man.text @@ -24,7 +24,7 @@ name:: If supplied, use the name and not the object id as the package name. state:: - The state the package should be in, either "present" or "absent" + Either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__package_pacman/man.text b/cdist/conf/type/__package_pacman/man.text index 17c2037a..2e24ecd9 100644 --- a/cdist/conf/type/__package_pacman/man.text +++ b/cdist/conf/type/__package_pacman/man.text @@ -10,8 +10,7 @@ cdist-type__package_pacman - Manage packages with pacman DESCRIPTION ----------- -Pacman is usually used on the Archlinux distribution to manage -packages. +Pacman is usually used on the Archlinux distribution to manage packages. REQUIRED PARAMETERS @@ -25,7 +24,7 @@ name:: If supplied, use the name and not the object id as the package name. state:: - The state the package should be in, either "present" or "absent" + Either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__package_pip/man.text b/cdist/conf/type/__package_pip/man.text index 8cb7d80a..5f619871 100644 --- a/cdist/conf/type/__package_pip/man.text +++ b/cdist/conf/type/__package_pip/man.text @@ -28,7 +28,7 @@ pip:: Instead of using pip from PATH, use the specific pip path. state:: - Either "present" or "absent", defaults to "present" + Either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__pf_ruleset/man.text b/cdist/conf/type/__pf_ruleset/man.text index 5c368e77..0dc07f71 100644 --- a/cdist/conf/type/__pf_ruleset/man.text +++ b/cdist/conf/type/__pf_ruleset/man.text @@ -26,6 +26,7 @@ source:: Note that this type is almost useless without a ruleset defined, but it's technically not needed, e.g. for the case of disabling the firewall temporarily. + EXAMPLES -------- diff --git a/cdist/conf/type/__postgres_role/man.text b/cdist/conf/type/__postgres_role/man.text index 4f13fa53..904f0831 100644 --- a/cdist/conf/type/__postgres_role/man.text +++ b/cdist/conf/type/__postgres_role/man.text @@ -16,7 +16,7 @@ This cdist type allows you to create or drop postgres roles. REQUIRED PARAMETERS ------------------- state:: - either 'present' or 'absent' + Either "present" or "absent", defaults to "present" OPTIONAL PARAMETERS diff --git a/cdist/conf/type/__process/man.text b/cdist/conf/type/__process/man.text index 929ba6a0..0d457ead 100644 --- a/cdist/conf/type/__process/man.text +++ b/cdist/conf/type/__process/man.text @@ -16,23 +16,23 @@ This cdist type allows you to define the state of a process. REQUIRED PARAMETERS ------------------- state:: - State of the process: Either present or absent + Either "present" or "absent", defaults to "present" OPTIONAL PARAMETERS ------------------- name:: - Process name to match on when using pgrep -f -x. + Process name to match on when using pgrep -f -x. - This is useful, if the name starts with a "/", - because the leading slash is stripped away from - the object id by cdist. + This is useful, if the name starts with a "/", + because the leading slash is stripped away from + the object id by cdist. stop:: - Executable to use for stopping the process. + Executable to use for stopping the process. start:: - Executable to use for starting the process. + Executable to use for starting the process. EXAMPLES diff --git a/cdist/conf/type/__qemu_img/man.text b/cdist/conf/type/__qemu_img/man.text index 3e16f957..39188ab0 100644 --- a/cdist/conf/type/__qemu_img/man.text +++ b/cdist/conf/type/__qemu_img/man.text @@ -24,8 +24,7 @@ size:: OPTIONAL PARAMETERS ------------------- state:: - The state of the image file: either "present" or "absent". - Defaults to "present". + Either "present" or "absent", defaults to "present" EXAMPLES diff --git a/cdist/conf/type/__rvm/man.text b/cdist/conf/type/__rvm/man.text index 0a355dc6..c1f83e60 100644 --- a/cdist/conf/type/__rvm/man.text +++ b/cdist/conf/type/__rvm/man.text @@ -16,7 +16,7 @@ RVM is the Ruby enVironment Manager for the Ruby programming language. REQUIRED PARAMETERS ------------------- state:: - Either "present" or "absent". + Either "present" or "absent". EXAMPLES diff --git a/cdist/conf/type/__rvm_gem/man.text b/cdist/conf/type/__rvm_gem/man.text index 85b52d65..fbf9a622 100644 --- a/cdist/conf/type/__rvm_gem/man.text +++ b/cdist/conf/type/__rvm_gem/man.text @@ -16,16 +16,16 @@ RVM is the Ruby enVironment Manager for the Ruby programming language. REQUIRED PARAMETERS ------------------- user:: - The remote user account to use + The remote user account to use gemset:: - The gemset to use + The gemset to use state:: - Either "present" or "absent". + Either "present" or "absent" OPTIONAL PARAMETERS ------------------- default:: - Make the selected gemset the default + Make the selected gemset the default EXAMPLES -------- diff --git a/cdist/conf/type/__rvm_gemset/man.text b/cdist/conf/type/__rvm_gemset/man.text index 10b6b411..26e866ba 100644 --- a/cdist/conf/type/__rvm_gemset/man.text +++ b/cdist/conf/type/__rvm_gemset/man.text @@ -16,14 +16,14 @@ RVM is the Ruby enVironment Manager for the Ruby programming language. REQUIRED PARAMETERS ------------------- user:: - The remote user account to use + The remote user account to use state:: - Either "present" or "absent". + Either "present" or "absent". OPTIONAL PARAMETERS ------------------- default:: - If set to anything but "no" (the default), set the given gemset as default. + If set to anything but "no" (the default), set the given gemset as default. EXAMPLES -------- diff --git a/cdist/conf/type/__rvm_ruby/man.text b/cdist/conf/type/__rvm_ruby/man.text index c558cfe3..90a7b654 100644 --- a/cdist/conf/type/__rvm_ruby/man.text +++ b/cdist/conf/type/__rvm_ruby/man.text @@ -16,14 +16,14 @@ RVM is the Ruby enVironment Manager for the Ruby programming language. REQUIRED PARAMETERS ------------------- user:: - The remote user account to use + The remote user account to use state:: - Either "present" or "absent". + Either "present" or "absent". -OPTIONAL PARAMETERS -------------------- +BOOLEAN PARAMETERS +------------------ default: - If set to anything but "no" (the default), set the given version as default + If set to anything but "no" (the default), set the given version as default EXAMPLES -------- diff --git a/cdist/conf/type/__start_on_boot/man.text b/cdist/conf/type/__start_on_boot/man.text index 58a68d65..6d804884 100644 --- a/cdist/conf/type/__start_on_boot/man.text +++ b/cdist/conf/type/__start_on_boot/man.text @@ -24,7 +24,7 @@ None. OPTIONAL PARAMETERS ------------------- state:: - 'present' or 'absent', defaults to 'present' + Either "present" or "absent", defaults to "present" EXAMPLES From 482ec3c5d8bcd0d9dc4b7ba7df8bdfe39870f001 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 19:27:17 +0100 Subject: [PATCH 368/412] make --default boolean in type __rvm_ruby Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm_ruby/gencode-remote | 41 ++++++++++--------- cdist/conf/type/__rvm_ruby/man.text | 4 +- .../parameter/{optional => boolean} | 0 3 files changed, 23 insertions(+), 22 deletions(-) rename cdist/conf/type/__rvm_ruby/parameter/{optional => boolean} (100%) diff --git a/cdist/conf/type/__rvm_ruby/gencode-remote b/cdist/conf/type/__rvm_ruby/gencode-remote index 0003cfe7..f1de3906 100755 --- a/cdist/conf/type/__rvm_ruby/gencode-remote +++ b/cdist/conf/type/__rvm_ruby/gencode-remote @@ -24,23 +24,24 @@ user="$(cat "$__object/parameter/user")" default="$(cat "$__object/parameter/default" 2>/dev/null || true)" state_should="$(cat "$__object/parameter/state")" -if [ "$state_is" != "$state_should" ]; then - case "$state_should" in - present) - echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\ - "rvm install $ruby\"" - case "$default" in - no) - ;; - *) - echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\ - "rvm use --default $ruby\"" - ;; - esac - ;; - absent) - echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\ - "rvm remove $ruby\"" - ;; - esac -fi +[ "$state_is" = "$state_should" ] && exit 0 + +case "$state_should" in + present) + echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\ + "rvm install $ruby\"" + if [ -f "$__object/parameter/default" ]; then + echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\ + "rvm use --default $ruby\"" + fi + ;; + absent) + echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\ + "rvm remove $ruby\"" + ;; + + *) + echo "Unknown state $state_should" >&2 + exit 1 + ;; +esac diff --git a/cdist/conf/type/__rvm_ruby/man.text b/cdist/conf/type/__rvm_ruby/man.text index 90a7b654..dbbab85e 100644 --- a/cdist/conf/type/__rvm_ruby/man.text +++ b/cdist/conf/type/__rvm_ruby/man.text @@ -23,7 +23,7 @@ state:: BOOLEAN PARAMETERS ------------------ default: - If set to anything but "no" (the default), set the given version as default + Set the given version as default EXAMPLES -------- @@ -33,7 +33,7 @@ EXAMPLES __rvm_ruby ruby-1.9.3-p0 --user thelonious --state present # Install ruby 1.9.3 through rvm for user ornette and make it the default -__rvm_ruby ruby-1.9.3-p0 --user ornette --state present --default yes +__rvm_ruby ruby-1.9.3-p0 --user ornette --state present --default # Remove ruby 1.9.3 for user john __rvm_ruby ruby-1.9.3-p0 --user john --state absent diff --git a/cdist/conf/type/__rvm_ruby/parameter/optional b/cdist/conf/type/__rvm_ruby/parameter/boolean similarity index 100% rename from cdist/conf/type/__rvm_ruby/parameter/optional rename to cdist/conf/type/__rvm_ruby/parameter/boolean From fc7564c829db210c888fcbabc58f1019f03cc685 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 7 Nov 2012 19:28:24 +0100 Subject: [PATCH 369/412] ++changes(next_version) Signed-off-by: Nico Schottelius --- docs/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog b/docs/changelog index 5d3c1698..df5c1b2b 100644 --- a/docs/changelog +++ b/docs/changelog @@ -8,6 +8,7 @@ Changelog * Type cleanup: __apt_ppa, __apt_ppa_update_index, __file, __ssh_authorized_key, __timezone, all install types (Steven Armstrong) * Types: Remove all parameter changing code + * Type __rvm_ruby: Change parameter "default" to be boolean 2.1.0pre7: 2012-11-07 * Core: All unit tests restored back to working From bbea7123f3422519bdabb41f760a1a5e77ad88c7 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 11 Nov 2012 13:09:46 +0100 Subject: [PATCH 370/412] cdist prefix required Signed-off-by: Nico Schottelius --- docs/man/man7/cdist-quickstart.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/man/man7/cdist-quickstart.text b/docs/man/man7/cdist-quickstart.text index 51943d41..b718da64 100644 --- a/docs/man/man7/cdist-quickstart.text +++ b/docs/man/man7/cdist-quickstart.text @@ -77,7 +77,7 @@ git clone git://git.schottelius.org/cdist # Create manifest (maps configuration to host(s) cd cdist -echo '__file /etc/cdist-configured' > conf/manifest/init +echo '__file /etc/cdist-configured' > cdist/conf/manifest/init # Configure localhost in verbose mode ./bin/cdist config -v localhost From 03ec09c771f0f89fae4b7f54c37476f04b435a4b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 14 Nov 2012 20:51:52 +0100 Subject: [PATCH 371/412] ++changes 2.1 documentation Signed-off-by: Nico Schottelius --- docs/dev/logs/2012-11-02.migration_to_2.1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/dev/logs/2012-11-02.migration_to_2.1 b/docs/dev/logs/2012-11-02.migration_to_2.1 index 2ef8df22..6c736a5c 100644 --- a/docs/dev/logs/2012-11-02.migration_to_2.1 +++ b/docs/dev/logs/2012-11-02.migration_to_2.1 @@ -38,3 +38,10 @@ by running cdist on one of your staging hosts: You can now cleanup the empty conf/ directory: % rmdir conf/* && rmdir conf + + + +-------------------------------------------------------------------------------- + +Boolean parameter introduced: + __directory /path/to --parents yes => __directory /path/to --parents From a498330bd3122b6abd150c543b89f22af85065bc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 09:32:44 +0100 Subject: [PATCH 372/412] remove _read_stdin and open stdin file in non-binary mode Signed-off-by: Nico Schottelius --- cdist/emulator.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index 53c6914d..b6ee5166 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -149,8 +149,6 @@ class Emulator(object): # Record / Append source self.cdist_object.source.append(self.object_source) - def _read_stdin(self): - return self.stdin.read() def save_stdin(self): """If something is written to stdin, save it in the object as $__object/stdin so it can be accessed in manifest and gencode-* @@ -160,12 +158,10 @@ class Emulator(object): try: # go directly to file instead of using CdistObject's api # as that does not support streaming + # FIXME: no streaming needed anymore path = os.path.join(self.cdist_object.absolute_path, 'stdin') - with open(path, 'wb') as fd: - chunk = self._read_stdin() - while chunk: - fd.write(chunk) - chunk = self._read_stdin() + with open(path, 'w') as fd: + fd.write(self.stdin.read()) except EnvironmentError as e: raise cdist.Error('Failed to read from stdin: %s' % e) From 2fca87eda855449734b6e5588d3da60f94e1a7e5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 09:34:19 +0100 Subject: [PATCH 373/412] ++comment Signed-off-by: Nico Schottelius --- cdist/emulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index b6ee5166..e54bd0dc 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -158,7 +158,7 @@ class Emulator(object): try: # go directly to file instead of using CdistObject's api # as that does not support streaming - # FIXME: no streaming needed anymore + # FIXME: no streaming needed anymore - use a raw file (not yet there?) path = os.path.join(self.cdist_object.absolute_path, 'stdin') with open(path, 'w') as fd: fd.write(self.stdin.read()) From 80c6592ec8676c1963573d54e3aa80008b7d100b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 09:49:37 +0100 Subject: [PATCH 374/412] add hints to related manpages Signed-off-by: Nico Schottelius --- cdist/conf/type/__user/man.text | 1 + 1 file changed, 1 insertion(+) diff --git a/cdist/conf/type/__user/man.text b/cdist/conf/type/__user/man.text index e571c7c5..7be2c2f2 100644 --- a/cdist/conf/type/__user/man.text +++ b/cdist/conf/type/__user/man.text @@ -54,6 +54,7 @@ __user foobar --uid 1001 --shell /bin/zsh --home /home/foobar SEE ALSO -------- - cdist-type(7) +- usermod(8) or pw(8) COPYING From 91de1b08aa76e1c750ebab6946d809166fcefd0d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 10:53:24 +0100 Subject: [PATCH 375/412] replace ascii logo by png logo (search engines don't like the ascii version Signed-off-by: Nico Schottelius --- docs/web/cdist.mdwn | 15 +-------------- docs/web/cdist/cdist-logo.png | Bin 0 -> 1542 bytes 2 files changed, 1 insertion(+), 14 deletions(-) create mode 100644 docs/web/cdist/cdist-logo.png diff --git a/docs/web/cdist.mdwn b/docs/web/cdist.mdwn index ffd0bcb5..d25714b5 100644 --- a/docs/web/cdist.mdwn +++ b/docs/web/cdist.mdwn @@ -1,19 +1,6 @@ [[!meta title="cdist - usable configuration management"]] - - .. . .x+=:. s - dF @88> z` ^% :8 - '88bu. %8P . Px#22e~?MF0Q*|NsA`*`M72000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipS@ z0U8oZ%R(#w00o9gL_t(o!|j;OOC(1Wz^mIa(<@6fGKU5*AnRX5Vhb0Zp zl-0j^^}hPms}|z_>pi<{At%Dr`U@U4gF4RoGSKpzdV%|9@IftRZLXV9@rE>N@N!C~ zGe!OUp&qdMyVA_e*UFQ*nQ6FwG6UDY#;;ZQdr1m53*5jARMf$*1#sLK#5utjPU&db zU785>|Q;`jcYt&fW8y13Dv?GjzEFS5zgd^L_8Dcpp*UC7%Q|3g| zeW!0Xc2ln5Rr4S=Vw`9rom{QR%eaLoD99VfwGKs%e!wYXuc>Ro!YNg8JEj$j^K%vMI*!X+fZJ61zup&| z_&2@o@#j2c4Ow58Hv--l{9E;X!t)PThohc&SqQ&#?tli zeQ~q`w_7_Q4-|PvJ%@O73;v3uexPskGwxuUxYYml(wYAUI%ek9r9qEY?};s1j`9Ns zws+2%V_kFL`}_%&3B=6YnssgO7v^UEE^rn<`DuRG-WhWykyiNA+NRs7e#(n=#)dSo zC4b`2WX@hcQKUGP1Q;~i_~10#_Lg>}wnLWcfIX@<+++6!>FOsE(lNYg;o!>kuYLrZ zgn0Pmn(d&{8hK&l4S+j!SA~?-kZ(d{hS{KtRyo7mHqy$s_JuIA?hdVknB7 zLmcRLeo>TXD!t|!#KppS^(U1G?uTqIrW6TN&L%q)1U|fh!8$5_6|fyo5;wJD>?Nn8 z7@(SuyO_)`(2ft;4l8l7-_6;9W~(mlmj~#Vqtq{l($Q`rzu?yO%mX=fdC=B&2+U{e4Ydo2tmeVMoEvfXx48|#$#HqW zTvw#rm^=`@-JY`kV#Va)&A7P1?!T;r((*!4!$HtGcXKPzc`S^6g>{Se%ENDB0rpaV z5LWU)8vnI-KXJt}pCil*k@~kQ_nrqXYSH9EMl)|%efJ-1(-zZu5F_WnM!-h{74^xT z;0|clXTjlN%3T{{fFAO-|Ift!@>@-G2m|qxhyoK=0!BZA|iCn43h9NNJLMXkOv16dzyd&)Y5*|k+R=&8w!jnSNv6LK39 saY9X~U}r+kn~+ Date: Thu, 15 Nov 2012 11:15:27 +0100 Subject: [PATCH 376/412] split off features Signed-off-by: Nico Schottelius --- docs/web/cdist.mdwn | 29 ----------------------------- docs/web/cdist/features.mdwn | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 29 deletions(-) create mode 100644 docs/web/cdist/features.mdwn diff --git a/docs/web/cdist.mdwn b/docs/web/cdist.mdwn index d25714b5..a69ea034 100644 --- a/docs/web/cdist.mdwn +++ b/docs/web/cdist.mdwn @@ -2,11 +2,6 @@ ![cdist-logo](cdist-logo.png "cdist logo") -[[!toc levels=3]] - -## Introduction - -cdist is a usable configuration management system. It adheres to the KISS principle and is being used in small up to enterprise grade environments. cdist is an alternative to other configuration management systems like @@ -14,30 +9,6 @@ cdist is an alternative to other configuration management systems like [bcfg2](http://trac.mcs.anl.gov/projects/bcfg2), [chef](http://wiki.opscode.com/display/chef/) and [puppet](http://www.puppetlabs.com/). -But cdist ticks differently, here is the feature set that makes it unique: - -[[!table data=""" -Keywords | Description -Simplicity | There is only one type to extend cdist called ***type*** -Design | Type and core cleanly seperated -Design | Sticks completly to the KISS (keep it simple and stupid) paradigma -Design | Meaningful error messages - do not lose time debugging error messages -Design | Consistency in behaviour, naming and documentation -Design | No surprise factor: Only do what is obviously clear, no magic -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 -Fast development | Batteries included: A lot of requirements can be solved using standard types -Modern Programming Language | cdist is written in Python -Requirements, Scalability | No central server needed, cdist operates in push mode and can be run from any computer -Requirements, Scalability, Upgrade | cdist only needs to be updated on the master, not on the target hosts -Requirements, Security | Uses well-know [SSH](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 configured in POSIX shell -"""]] ### Documentation diff --git a/docs/web/cdist/features.mdwn b/docs/web/cdist/features.mdwn new file mode 100644 index 00000000..1b3525ac --- /dev/null +++ b/docs/web/cdist/features.mdwn @@ -0,0 +1,22 @@ +[[!table data=""" +Keywords | Description +Simplicity | There is only one type to extend cdist called ***type*** +Design | Type and core cleanly seperated +Design | Sticks completly to the KISS (keep it simple and stupid) paradigma +Design | Meaningful error messages - do not lose time debugging error messages +Design | Consistency in behaviour, naming and documentation +Design | No surprise factor: Only do what is obviously clear, no magic +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 +Fast development | Batteries included: A lot of requirements can be solved using standard types +Modern Programming Language | cdist is written in Python +Requirements, Scalability | No central server needed, cdist operates in push mode and can be run from any computer +Requirements, Scalability, Upgrade | cdist only needs to be updated on the master, not on the target hosts +Requirements, Security | Uses well-know [SSH](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 configured in POSIX shell +"""]] From 2d59bb01a5a3a70a161313de54fd36e0870e2f5d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 11:24:04 +0100 Subject: [PATCH 377/412] split install/update into its own file Signed-off-by: Nico Schottelius --- docs/web/cdist.mdwn | 226 +---------------------------- docs/web/cdist/features.mdwn | 2 + docs/web/cdist/install-update.mdwn | 218 ++++++++++++++++++++++++++++ 3 files changed, 222 insertions(+), 224 deletions(-) create mode 100644 docs/web/cdist/install-update.mdwn diff --git a/docs/web/cdist.mdwn b/docs/web/cdist.mdwn index a69ea034..4d8fe82b 100644 --- a/docs/web/cdist.mdwn +++ b/docs/web/cdist.mdwn @@ -10,13 +10,8 @@ cdist is an alternative to other configuration management systems like [chef](http://wiki.opscode.com/display/chef/) and [puppet](http://www.puppetlabs.com/). -### Documentation - -The cdist documentation is included as manpages in the distribution. -You can browse the documentation online as well: - - * [latest version](man/latest) - * [all versions (>= 2.0.4)](man) + * Browse the **documentation** for the [latest version](man/latest) or [all versions (>= 2.0.4)](man) + * Read how to [[install or update cdist|install-update]] ### OS support @@ -34,223 +29,6 @@ cdist was tested or is know to run on at least * [XenServer](http://www.citrix.com/xenserver/) -## Requirements - -### Server - - * A posix like shell - * Python (>= 3.2 required) - * SSH client - * Asciidoc (for building the manpages) - -### Client ("target host") - - * A posix like shell - * SSH server - - -## Installation - -### Preparation - -Ensure you have Python 3.2 installed on the machine you use to **deploy to the targets** -(the ***source host***). - -#### Archlinux - -Archlinux already has python >= 3.2, so you only need to do: - - pacman -S python - -#### CentOS - -See the "From source" section - -#### Debian - -For Debian >= wheezy: - - aptitude install python3 - -On squeeze you can add following line in **/etc/apt/sources.list** - - deb http://ftp.debian.org/debian wheezy main - -And add pinning entry in **/etc/apt/preferences.d/wheezy**: - - Package: * - Pin: release n=wheezy - Pin-Priority: 1 - -Please be aware that both **openssh-server** and **openssh-client** might be -removed on **python3.2** installation. You surely want to reinstall them: - - apt-get install -t wheezy openssh-server openssh-client - -For older Debian versions, installing python 3.2 manually is required. - - -#### Fedora - -For Fedora >= 15: - - yum install python3 - -#### FreeBSD - -For the port: - - cd /usr/ports/lang/python32/ && make install clean - -For the package: - - pkg_add -r python32 - -#### Gentoo - -Gentoo only provides python 3.2 in testing packages (http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=3). -If you want to ensure nothing breaks you must set back the python version to what was default before. - - emerge -av =python-3.2.2 --autounmask-write - emerge -av =python-3.2.2 - eselect python list - eselect python list set python3.2 - -#### Max OS X - -You can choose between Homebrew and Macports, either way works: - -[Homebrew](http://mxcl.github.com/homebrew/) variant: - - brew install python3 - -[Macports](http://www.macports.org/install.php) variant: - - port install python32 - ln -s /opt/local/bin/python3.2 /opt/local/bin/python3 - -#### From Source - -For those operating systems not yet support Python 3.2: - - pyversion=3.2.3 - wget http://www.python.org/ftp/python/$pyversion/Python-${pyversion}.tar.bz2 - tar xvfj Python-${pyversion}.tar.bz2 - cd Python-${pyversion} - ./configure - make - sudo make install - -This installs python 3.2 to /usr/local/bin. Ensure this directory is in -your PATH environment variable. - - -### 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. -To install cdist, execute the following commands: - - git clone git://git.schottelius.org/cdist - cd cdist - export PATH=$PATH:$(pwd -P)/bin - - # If you want the manpages - ./build man - export MANPATH=$MANPATH:$(pwd -P)/doc/man - - -### Available versions - -There are at least the following branches available: - - * Development: master - * 2.0: Python rewrite of cdist core [stable branch] - -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) - * 1.3: Support for local and remote code execution (current stable) - * 1.2: Dependencies supported - * 1.1: \_\_file to \_\_file, \_\_directory, \_\_link migration - * 1.0: First official release - -Other branches may be available for features or bugfixes, but they -may vanish at any point. To select a specific branch use - - # Generic code - git checkout -b origin/ - - # Stay on a specific version - version=2.0 - git checkout -b $version origin/$version - -### 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 - -To upgrade cdist in the current branch use - - git pull - - # Also update the manpages - ./build man - export MANPATH=$MANPATH:$(pwd -P)/doc/man - -If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break. -The master branch on the other hand is the development branch and may not be -working, break your setup or eat the tree in your garden. - -### 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 "cdist banner" for fun -* 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 - your code to use **machine** instead. - -### Upgrading from 1.5 to 1.6 - -* If you used **\_\_package_apt --preseed**, you need to use the new - type **\_\_debconf_set_selections** instead. -* The **\_\_package** types accepted either --state deinstalled or - --state uninstaaled. Starting with 1.6, it was made consistently - to --state removed. - -### Upgrading from 1.3 to 1.5 - -No incompatiblities. - -### Upgrading from 1.2 to 1.3 - -Rename **gencode** of every type to **gencode-remote**. - -### Upgrading from 1.1 to 1.2 - -No incompatiblities. - -### Upgrading from 1.0 to 1.1 - -In 1.1 the type **\_\_file** was split into **\_\_directory**, **\_\_file** and -**\_\_link**. The parameter **--type** was removed from **\_\_file**. Thus you -need to replace **\_\_file** calls in your manifests: - - * Remove --type from all \_\_file calls - * If type was symlink, use \_\_link and --type symbolic - * If type was directory, use \_\_directory - - ## Support ### IRC diff --git a/docs/web/cdist/features.mdwn b/docs/web/cdist/features.mdwn index 1b3525ac..c1fecb53 100644 --- a/docs/web/cdist/features.mdwn +++ b/docs/web/cdist/features.mdwn @@ -1,3 +1,5 @@ +But cdist ticks differently, here is the feature set that makes it unique: + [[!table data=""" Keywords | Description Simplicity | There is only one type to extend cdist called ***type*** diff --git a/docs/web/cdist/install-update.mdwn b/docs/web/cdist/install-update.mdwn new file mode 100644 index 00000000..67d9df8c --- /dev/null +++ b/docs/web/cdist/install-update.mdwn @@ -0,0 +1,218 @@ +## Requirements + +### Server + + * A posix like shell + * Python (>= 3.2 required) + * SSH client + * Asciidoc (for building the manpages) + +### Client ("target host") + + * A posix like shell + * SSH server + + +## Installation + +### Preparation + +Ensure you have Python 3.2 installed on the machine you use to **deploy to the targets** +(the ***source host***). + +#### Archlinux + +Archlinux already has python >= 3.2, so you only need to do: + + pacman -S python + +#### CentOS + +See the "From source" section + +#### Debian + +For Debian >= wheezy: + + aptitude install python3 + +On squeeze you can add following line in **/etc/apt/sources.list** + + deb http://ftp.debian.org/debian wheezy main + +And add pinning entry in **/etc/apt/preferences.d/wheezy**: + + Package: * + Pin: release n=wheezy + Pin-Priority: 1 + +Please be aware that both **openssh-server** and **openssh-client** might be +removed on **python3.2** installation. You surely want to reinstall them: + + apt-get install -t wheezy openssh-server openssh-client + +For older Debian versions, installing python 3.2 manually is required. + + +#### Fedora + +For Fedora >= 15: + + yum install python3 + +#### FreeBSD + +For the port: + + cd /usr/ports/lang/python32/ && make install clean + +For the package: + + pkg_add -r python32 + +#### Gentoo + +Gentoo only provides python 3.2 in testing packages (http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=3). +If you want to ensure nothing breaks you must set back the python version to what was default before. + + emerge -av =python-3.2.2 --autounmask-write + emerge -av =python-3.2.2 + eselect python list + eselect python list set python3.2 + +#### Max OS X + +You can choose between Homebrew and Macports, either way works: + +[Homebrew](http://mxcl.github.com/homebrew/) variant: + + brew install python3 + +[Macports](http://www.macports.org/install.php) variant: + + port install python32 + ln -s /opt/local/bin/python3.2 /opt/local/bin/python3 + +#### From Source + +For those operating systems not yet support Python 3.2: + + pyversion=3.2.3 + wget http://www.python.org/ftp/python/$pyversion/Python-${pyversion}.tar.bz2 + tar xvfj Python-${pyversion}.tar.bz2 + cd Python-${pyversion} + ./configure + make + sudo make install + +This installs python 3.2 to /usr/local/bin. Ensure this directory is in +your PATH environment variable. + + +### 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. +To install cdist, execute the following commands: + + git clone git://git.schottelius.org/cdist + cd cdist + export PATH=$PATH:$(pwd -P)/bin + + # If you want the manpages + ./build man + export MANPATH=$MANPATH:$(pwd -P)/doc/man + + +### Available versions + +There are at least the following branches available: + + * Development: master + * 2.0: Python rewrite of cdist core [stable branch] + +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) + * 1.3: Support for local and remote code execution (current stable) + * 1.2: Dependencies supported + * 1.1: \_\_file to \_\_file, \_\_directory, \_\_link migration + * 1.0: First official release + +Other branches may be available for features or bugfixes, but they +may vanish at any point. To select a specific branch use + + # Generic code + git checkout -b origin/ + + # Stay on a specific version + version=2.0 + git checkout -b $version origin/$version + +### 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 + +To upgrade cdist in the current branch use + + git pull + + # Also update the manpages + ./build man + export MANPATH=$MANPATH:$(pwd -P)/doc/man + +If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break. +The master branch on the other hand is the development branch and may not be +working, break your setup or eat the tree in your garden. + +### 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 "cdist banner" for fun +* 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 + your code to use **machine** instead. + +### Upgrading from 1.5 to 1.6 + +* If you used **\_\_package_apt --preseed**, you need to use the new + type **\_\_debconf_set_selections** instead. +* The **\_\_package** types accepted either --state deinstalled or + --state uninstaaled. Starting with 1.6, it was made consistently + to --state removed. + +### Upgrading from 1.3 to 1.5 + +No incompatiblities. + +### Upgrading from 1.2 to 1.3 + +Rename **gencode** of every type to **gencode-remote**. + +### Upgrading from 1.1 to 1.2 + +No incompatiblities. + +### Upgrading from 1.0 to 1.1 + +In 1.1 the type **\_\_file** was split into **\_\_directory**, **\_\_file** and +**\_\_link**. The parameter **--type** was removed from **\_\_file**. Thus you +need to replace **\_\_file** calls in your manifests: + + * Remove --type from all \_\_file calls + * If type was symlink, use \_\_link and --type symbolic + * If type was directory, use \_\_directory + + +[[!tag cdist unix]] From b6d3bfe64f353448ca9ec6e420ee07fe5e612865 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 11:25:57 +0100 Subject: [PATCH 378/412] split off support Signed-off-by: Nico Schottelius --- docs/web/cdist.mdwn | 26 ++------------------------ docs/web/cdist/support.mdwn | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 docs/web/cdist/support.mdwn diff --git a/docs/web/cdist.mdwn b/docs/web/cdist.mdwn index 4d8fe82b..fff727bf 100644 --- a/docs/web/cdist.mdwn +++ b/docs/web/cdist.mdwn @@ -12,6 +12,7 @@ and [puppet](http://www.puppetlabs.com/). * Browse the **documentation** for the [latest version](man/latest) or [all versions (>= 2.0.4)](man) * Read how to [[install or update cdist|install-update]] + * [[Support|support]] ### OS support @@ -21,6 +22,7 @@ cdist was tested or is know to run on at least * [Debian](http://www.debian.org/) * [CentOS](http://www.centos.org/) * [Fedora](http://fedoraproject.org/) + * [FreeBSD](http://www.freebsd.org) * [Gentoo](http://www.gentoo.org/) * [Mac OS X](http://www.apple.com/macosx/) * [OpenBSD](http://www.openbsd.org) @@ -29,30 +31,6 @@ cdist was tested or is know to run on at least * [XenServer](http://www.citrix.com/xenserver/) -## Support - -### IRC - -You can join the development ***IRC channel*** -[#cstar on irc.freenode.net](irc://irc.freenode.org/#cstar). - -### Mailing list - -Bug reports, questions, patches, etc. should be send to the -[cdist mailing list](http://l.schottelius.org/mailman/listinfo/cdist). - -### Linkedin - -If you have an account -at [Linked in](http://www.linkedin.com/), -you can join the -[cdist group](http://www.linkedin.com/groups/cdist-configuration-management-3952797). - -### Commercial support - -You can request commercial support for cdist from -[my company](http://firma.schottelius.org/english/). - ## Used by If you're using cdist, feel free to send a report to the mailing list. diff --git a/docs/web/cdist/support.mdwn b/docs/web/cdist/support.mdwn new file mode 100644 index 00000000..47ee1193 --- /dev/null +++ b/docs/web/cdist/support.mdwn @@ -0,0 +1,23 @@ +## Support + +### IRC + +You can join the development ***IRC channel*** +[#cstar on irc.freenode.net](irc://irc.freenode.org/#cstar). + +### Mailing list + +Bug reports, questions, patches, etc. should be send to the +[cdist mailing list](http://l.schottelius.org/mailman/listinfo/cdist). + +### Linkedin + +If you have an account +at [Linked in](http://www.linkedin.com/), +you can join the +[cdist group](http://www.linkedin.com/groups/cdist-configuration-management-3952797). + +### Commercial support + +You can request commercial support for cdist from +[my company](http://firma.schottelius.org/english/). From 7272a7b13cfbdf02fc0659f055c3c6938dfc7186 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 11:36:28 +0100 Subject: [PATCH 379/412] move operating sytems to a new page Signed-off-by: Nico Schottelius --- docs/web/cdist.mdwn | 34 ---------------------------------- docs/web/cdist/features.mdwn | 2 ++ docs/web/cdist/os.mdwn | 15 +++++++++++++++ docs/web/cdist/support.mdwn | 2 ++ 4 files changed, 19 insertions(+), 34 deletions(-) create mode 100644 docs/web/cdist/os.mdwn diff --git a/docs/web/cdist.mdwn b/docs/web/cdist.mdwn index fff727bf..ab501f56 100644 --- a/docs/web/cdist.mdwn +++ b/docs/web/cdist.mdwn @@ -30,38 +30,4 @@ cdist was tested or is know to run on at least * [Ubuntu](http://www.ubuntu.com/) * [XenServer](http://www.citrix.com/xenserver/) - -## Used by - -If you're using cdist, feel free to send a report to the mailing list. -Interesting information are for instance - - * Which services do you manage? - * How many machines do you manage? - * What are the pros/cons you see in cdist? - * General comments/critics - -### Nico Schottelius, Systems Group ETH Zurich, local.ch and privately - -Yes, I'm actually eating my own dogfood and currently managing - - * [plone](http://plone.org/) (cms) - * [moinmoin](http://moinmo.in/) (wiki) - * [apache](http://httpd.apache.org/) (webserver) - * [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication) - * [nss-pam-ldapd](http://arthurdejong.org/nss-pam-ldapd/) (authentication) - * [ircd-hybrid](http://www.ircd-hybrid.org/) (chat) - * [stunnel](http://stunnel.mirt.net/) (SSL tunnel) - * [mercurial-server](http://www.lshift.net/mercurial-server.html) (version control) - * [xfce](http://www.xfce.org/) (lightweight desktop environment) - * [slim](http://slim.berlios.de/) (graphical login manager for X11) - -with cdist on more than **60** production machines of the -[Systems Group](http://www.systems.ethz.ch) at the -[ETH Zurich](http://www.ethz.ch) as well at home. - -### Steven Armstrong, CBRG ETH Zurich - -The CBRG is managing most of their compute clusters with cdist. - [[!tag cdist unix]] diff --git a/docs/web/cdist/features.mdwn b/docs/web/cdist/features.mdwn index c1fecb53..a97f2013 100644 --- a/docs/web/cdist/features.mdwn +++ b/docs/web/cdist/features.mdwn @@ -22,3 +22,5 @@ UNIX | Reuse of existing tools like cat, find, mv, ... UNIX, familar environment, documentation | Is available as manpages and HTML UNIX, simplicity, familar environment | cdist is configured in POSIX shell """]] + +[[!tag cdist unix]] diff --git a/docs/web/cdist/os.mdwn b/docs/web/cdist/os.mdwn new file mode 100644 index 00000000..d53bc1c9 --- /dev/null +++ b/docs/web/cdist/os.mdwn @@ -0,0 +1,15 @@ +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/) + * [FreeBSD](http://www.freebsd.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/) + +[[!tag cdist unix]] diff --git a/docs/web/cdist/support.mdwn b/docs/web/cdist/support.mdwn index 47ee1193..7515070d 100644 --- a/docs/web/cdist/support.mdwn +++ b/docs/web/cdist/support.mdwn @@ -21,3 +21,5 @@ you can join the You can request commercial support for cdist from [my company](http://firma.schottelius.org/english/). + +[[!tag cdist unix]] From 8ab91009e10caec87751943d894d3e8f39cd04b5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 12:00:25 +0100 Subject: [PATCH 380/412] Cleanup of install, update and general documentation Signed-off-by: Nico Schottelius --- docs/web/cdist.mdwn | 22 +--- .../{install-update.mdwn => install.mdwn} | 109 +++++------------- docs/web/cdist/update.mdwn | 59 ++++++++++ 3 files changed, 91 insertions(+), 99 deletions(-) rename docs/web/cdist/{install-update.mdwn => install.mdwn} (59%) create mode 100644 docs/web/cdist/update.mdwn diff --git a/docs/web/cdist.mdwn b/docs/web/cdist.mdwn index ab501f56..e0e1f504 100644 --- a/docs/web/cdist.mdwn +++ b/docs/web/cdist.mdwn @@ -10,24 +10,10 @@ cdist is an alternative to other configuration management systems like [chef](http://wiki.opscode.com/display/chef/) and [puppet](http://www.puppetlabs.com/). - * Browse the **documentation** for the [latest version](man/latest) or [all versions (>= 2.0.4)](man) - * Read how to [[install or update cdist|install-update]] + * **Documentation** for the [latest version](man/latest) or [all versions (>= 2.0.4)](man) + * [[Installation|install]] + * [[Update|update]] + * [[Supported Operating Systems|os]] * [[Support|support]] -### OS support - -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/) - * [FreeBSD](http://www.freebsd.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/) - [[!tag cdist unix]] diff --git a/docs/web/cdist/install-update.mdwn b/docs/web/cdist/install.mdwn similarity index 59% rename from docs/web/cdist/install-update.mdwn rename to docs/web/cdist/install.mdwn index 67d9df8c..43b0e3e1 100644 --- a/docs/web/cdist/install-update.mdwn +++ b/docs/web/cdist/install.mdwn @@ -1,42 +1,44 @@ +[[!toc levels=3]] + ## Requirements -### Server +### Source Host - * A posix like shell +This is the machine you use to configure the target hosts. + + * /bin/sh: A posix like shell (for instance bash, dash, zsh) * Python (>= 3.2 required) * SSH client * Asciidoc (for building the manpages) -### Client ("target host") +### Target Hosts - * A posix like shell + * /bin/sh: A posix like shell (for instance bash, dash, zsh) * SSH server - -## Installation - -### Preparation +## Python Installation Ensure you have Python 3.2 installed on the machine you use to **deploy to the targets** (the ***source host***). -#### Archlinux +### Archlinux -Archlinux already has python >= 3.2, so you only need to do: +Archlinux includes a recent python in the extra repository. +You can install it using pacman -S python -#### CentOS +### CentOS See the "From source" section #### Debian -For Debian >= wheezy: +For Debian **wheezy** or newer: aptitude install python3 -On squeeze you can add following line in **/etc/apt/sources.list** +On **squeeze** you can add following line in **/etc/apt/sources.list** deb http://ftp.debian.org/debian wheezy main @@ -51,16 +53,16 @@ removed on **python3.2** installation. You surely want to reinstall them: apt-get install -t wheezy openssh-server openssh-client -For older Debian versions, installing python 3.2 manually is required. +For older Debian versions, installing python 3.2 from source is required. +### Fedora -#### Fedora - -For Fedora >= 15: +Fedora 15 and newer includes a recent python. +You can install it using yum install python3 -#### FreeBSD +### FreeBSD For the port: @@ -70,7 +72,9 @@ For the package: pkg_add -r python32 -#### Gentoo +You can also use any newer version, but at least python 3.2 is required. + +### Gentoo Gentoo only provides python 3.2 in testing packages (http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=3). If you want to ensure nothing breaks you must set back the python version to what was default before. @@ -80,7 +84,7 @@ 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 +### Max OS X You can choose between Homebrew and Macports, either way works: @@ -93,7 +97,7 @@ You can choose between Homebrew and Macports, either way works: port install python32 ln -s /opt/local/bin/python3.2 /opt/local/bin/python3 -#### From Source +### From Source For those operating systems not yet support Python 3.2: @@ -109,7 +113,7 @@ This installs python 3.2 to /usr/local/bin. Ensure this directory is in your PATH environment variable. -### Get cdist +## Install 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. @@ -129,7 +133,8 @@ To install cdist, execute the following commands: There are at least the following branches available: * Development: master - * 2.0: Python rewrite of cdist core [stable branch] + * 2.0: Current stable branch + * 2.1: Currently experimental - the next stable branch Old versions: @@ -157,62 +162,4 @@ may vanish at any point. To select a specific branch use * 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 - -To upgrade cdist in the current branch use - - git pull - - # Also update the manpages - ./build man - export MANPATH=$MANPATH:$(pwd -P)/doc/man - -If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break. -The master branch on the other hand is the development branch and may not be -working, break your setup or eat the tree in your garden. - -### 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 "cdist banner" for fun -* 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 - your code to use **machine** instead. - -### Upgrading from 1.5 to 1.6 - -* If you used **\_\_package_apt --preseed**, you need to use the new - type **\_\_debconf_set_selections** instead. -* The **\_\_package** types accepted either --state deinstalled or - --state uninstaaled. Starting with 1.6, it was made consistently - to --state removed. - -### Upgrading from 1.3 to 1.5 - -No incompatiblities. - -### Upgrading from 1.2 to 1.3 - -Rename **gencode** of every type to **gencode-remote**. - -### Upgrading from 1.1 to 1.2 - -No incompatiblities. - -### Upgrading from 1.0 to 1.1 - -In 1.1 the type **\_\_file** was split into **\_\_directory**, **\_\_file** and -**\_\_link**. The parameter **--type** was removed from **\_\_file**. Thus you -need to replace **\_\_file** calls in your manifests: - - * Remove --type from all \_\_file calls - * If type was symlink, use \_\_link and --type symbolic - * If type was directory, use \_\_directory - - [[!tag cdist unix]] diff --git a/docs/web/cdist/update.mdwn b/docs/web/cdist/update.mdwn new file mode 100644 index 00000000..085075e7 --- /dev/null +++ b/docs/web/cdist/update.mdwn @@ -0,0 +1,59 @@ +## Update + +To upgrade cdist in the current branch use + + git pull + + # Also update the manpages + ./build man + export MANPATH=$MANPATH:$(pwd -P)/doc/man + +If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break. +The master branch on the other hand is the development branch and may not be +working, break your setup or eat the tree in your garden. + +### 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 "cdist banner" for fun +* 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 + your code to use **machine** instead. + +### Upgrading from 1.5 to 1.6 + +* If you used **\_\_package_apt --preseed**, you need to use the new + type **\_\_debconf_set_selections** instead. +* The **\_\_package** types accepted either --state deinstalled or + --state uninstaaled. Starting with 1.6, it was made consistently + to --state removed. + +### Upgrading from 1.3 to 1.5 + +No incompatiblities. + +### Upgrading from 1.2 to 1.3 + +Rename **gencode** of every type to **gencode-remote**. + +### Upgrading from 1.1 to 1.2 + +No incompatiblities. + +### Upgrading from 1.0 to 1.1 + +In 1.1 the type **\_\_file** was split into **\_\_directory**, **\_\_file** and +**\_\_link**. The parameter **--type** was removed from **\_\_file**. Thus you +need to replace **\_\_file** calls in your manifests: + + * Remove --type from all \_\_file calls + * If type was symlink, use \_\_link and --type symbolic + * If type was directory, use \_\_directory + + +[[!tag cdist unix]] From caa49167ca5b5d33427d61725dbd78b1ec868f2a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 12:10:28 +0100 Subject: [PATCH 381/412] +title Signed-off-by: Nico Schottelius --- docs/web/cdist/os.mdwn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/web/cdist/os.mdwn b/docs/web/cdist/os.mdwn index d53bc1c9..24992439 100644 --- a/docs/web/cdist/os.mdwn +++ b/docs/web/cdist/os.mdwn @@ -1,3 +1,5 @@ +[[!meta title="Supported Operating Systems"]] + cdist was tested or is know to run on at least * [Archlinux](http://www.archlinux.org/) From 7550f4de3ec2df6d8acd21ce5f9446f644bf9657 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 12:10:36 +0100 Subject: [PATCH 382/412] reorder comparision Signed-off-by: Nico Schottelius --- docs/web/cdist.mdwn | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/web/cdist.mdwn b/docs/web/cdist.mdwn index e0e1f504..cd2a7567 100644 --- a/docs/web/cdist.mdwn +++ b/docs/web/cdist.mdwn @@ -2,18 +2,19 @@ ![cdist-logo](cdist-logo.png "cdist logo") -the KISS principle and is being used in small up to enterprise grade -environments. +cdist is a usable configuration management system. +It adheres to the KISS principle and +is being used in small up to enterprise grade environments. cdist is an alternative to other configuration management systems like -[cfengine](http://www.cfengine.org/), [bcfg2](http://trac.mcs.anl.gov/projects/bcfg2), [chef](http://wiki.opscode.com/display/chef/) +[cfengine](http://www.cfengine.org/), and [puppet](http://www.puppetlabs.com/). - * **Documentation** for the [latest version](man/latest) or [all versions (>= 2.0.4)](man) + * [[Documentation|documentation]] + * [[Supported Operating Systems|os]] * [[Installation|install]] * [[Update|update]] - * [[Supported Operating Systems|os]] * [[Support|support]] [[!tag cdist unix]] From b512a76db93b7f3823fc6f2e3b9209b5f5890f90 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 14:02:17 +0100 Subject: [PATCH 383/412] documentation pointers Signed-off-by: Nico Schottelius --- docs/web/cdist/documentation.mdwn | 5 +++ docs/web/cdist/install.mdwn | 61 ++++++++++++++++--------------- 2 files changed, 36 insertions(+), 30 deletions(-) create mode 100644 docs/web/cdist/documentation.mdwn diff --git a/docs/web/cdist/documentation.mdwn b/docs/web/cdist/documentation.mdwn new file mode 100644 index 00000000..aa751a4b --- /dev/null +++ b/docs/web/cdist/documentation.mdwn @@ -0,0 +1,5 @@ + +* [Latest documentation](man/latest) +* [All versions](man) + +[[!tag cdist unix]] diff --git a/docs/web/cdist/install.mdwn b/docs/web/cdist/install.mdwn index 43b0e3e1..95dc8c9b 100644 --- a/docs/web/cdist/install.mdwn +++ b/docs/web/cdist/install.mdwn @@ -1,3 +1,4 @@ +[[!meta title="How to install cdist"]] [[!toc levels=3]] ## Requirements @@ -7,7 +8,7 @@ This is the machine you use to configure the target hosts. * /bin/sh: A posix like shell (for instance bash, dash, zsh) - * Python (>= 3.2 required) + * Python >= 3.2 * SSH client * Asciidoc (for building the manpages) @@ -16,10 +17,14 @@ This is the machine you use to configure the target hosts. * /bin/sh: A posix like shell (for instance bash, dash, zsh) * SSH server -## Python Installation +## Requirement Installation: Python >= 3.2 -Ensure you have Python 3.2 installed on the machine you use to **deploy to the targets** -(the ***source host***). +Ensure you have at least Python 3.2 or newer installed on +the **source host**. +You can check this by running **python -V**: + + % python -V + Python 3.3.0 ### Archlinux @@ -32,7 +37,7 @@ You can install it using See the "From source" section -#### Debian +### Debian For Debian **wheezy** or newer: @@ -97,9 +102,13 @@ You can choose between Homebrew and Macports, either way works: port install python32 ln -s /opt/local/bin/python3.2 /opt/local/bin/python3 +### Redhat + +See the "From source" section + ### From Source -For those operating systems not yet support Python 3.2: +For those operating systems not yet supporting Python 3.2: pyversion=3.2.3 wget http://www.python.org/ftp/python/$pyversion/Python-${pyversion}.tar.bz2 @@ -109,43 +118,35 @@ For those operating systems not yet support Python 3.2: make sudo make install -This installs python 3.2 to /usr/local/bin. Ensure this directory is in -your PATH environment variable. - +This installs python 3.2 to /usr/local/bin. +Ensure this directory is in your PATH environment variable. ## Install 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. +You can install cdist either from git or as a python package. + +### From git + +Cloning cdist from git gives you the advantage of having +a version control in place for development of your own stuff +immediately. + To install cdist, execute the following commands: git clone git://git.schottelius.org/cdist cd cdist export PATH=$PATH:$(pwd -P)/bin - # If you want the manpages +If you want to build and use the manpages, run: + ./build man export MANPATH=$MANPATH:$(pwd -P)/doc/man +#### Available versions in git -### Available versions - -There are at least the following branches available: - - * Development: master - * 2.0: Current stable branch - * 2.1: Currently experimental - the next stable branch - -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) - * 1.3: Support for local and remote code execution (current stable) - * 1.2: Dependencies supported - * 1.1: \_\_file to \_\_file, \_\_directory, \_\_link migration - * 1.0: First official release + * The active development takes place in the **master** branch + * The current stable version can be found in the **2.0** branch + * The upcoming stable version can be found in the **2.1** branch Other branches may be available for features or bugfixes, but they may vanish at any point. To select a specific branch use From 373120814ce6b7752c93b09c64b5c178c34b86fa Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 14:02:38 +0100 Subject: [PATCH 384/412] update install/update instructions Signed-off-by: Nico Schottelius --- docs/web/cdist/install.mdwn | 22 +++++++++++++------ docs/web/cdist/update.mdwn | 43 +++++++++++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/docs/web/cdist/install.mdwn b/docs/web/cdist/install.mdwn index 95dc8c9b..79d8705d 100644 --- a/docs/web/cdist/install.mdwn +++ b/docs/web/cdist/install.mdwn @@ -152,15 +152,25 @@ Other branches may be available for features or bugfixes, but they may vanish at any point. To select a specific branch use # Generic code - git checkout -b origin/ - - # Stay on a specific version - version=2.0 - git checkout -b $version origin/$version + git checkout -b origin/ -### Mirrors +So for instance if you want to use and stay with version 2.0, you can use + + git checkout -b 2.0 origin/2.0 + +#### Git Mirrors + +If the main site is down, you can acquire cdist from one of the following sites: * git://github.com/telmich/cdist.git ([github](https://github.com/telmich/cdist)) * git://git.code.sf.net/p/cdist/code ([sourceforge](https://sourceforge.net/p/cdist/code)) +### Python Package + +Cdist is available as a python package at +[PyPi](http://pypi.python.org/pypi/cdist/). You can install it using + + pip install cdist + + [[!tag cdist unix]] diff --git a/docs/web/cdist/update.mdwn b/docs/web/cdist/update.mdwn index 085075e7..5f427369 100644 --- a/docs/web/cdist/update.mdwn +++ b/docs/web/cdist/update.mdwn @@ -1,4 +1,6 @@ -## Update +[[!meta title="How to update cdist"]] + +## Update The Git Installation To upgrade cdist in the current branch use @@ -12,20 +14,43 @@ 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 +## Update The Python Package -* Ensure python (>= 3.2) is installed on the server +To upgrade to the lastet version do + + pip install --upgrade cdist + +## Update Instructions / Hints + +### Updating from 2.0 to 2.1 + + * Type __package* and __process use --state **present** or **absent**. + The states **removed/installed** and **stopped/running** have been removed. + Support for the new states is already present in 2.0. + * Type __directory: Parameter --parents and --recursive are now boolean + and the old "yes/no" values need to be removed + * Type **__addifnosuchline** and **__removeline** have been replaced by **__line** + * The **conf** directory is now located at **cdist/conf**. + You need to migrate your types, explorers and manifests + manually to the new location. + * Replace the variable **__self** by **__object_name** + Support for the variable **__object_name** is already present in 2.0. + + +### Updating from 1.7 to 2.0 + +* Ensure python (>= 3.2) is installed on the source host * Use "cdist config host" instead of "cdist-deploy-to host" * Use "cdist config -p host1 host2" instead of "cdist-mass-deploy" * Use "cdist banner" for fun * Use **\_\_object_fq** instead of **\_\_self** in manifests -### Upgrading from 1.6 to 1.7 +### Updating from 1.6 to 1.7 * If you used the global explorer **hardware_type**, you need to change your code to use **machine** instead. -### Upgrading from 1.5 to 1.6 +### Updating from 1.5 to 1.6 * If you used **\_\_package_apt --preseed**, you need to use the new type **\_\_debconf_set_selections** instead. @@ -33,19 +58,19 @@ working, break your setup or eat the tree in your garden. --state uninstaaled. Starting with 1.6, it was made consistently to --state removed. -### Upgrading from 1.3 to 1.5 +### Updating from 1.3 to 1.5 No incompatiblities. -### Upgrading from 1.2 to 1.3 +### Updating from 1.2 to 1.3 Rename **gencode** of every type to **gencode-remote**. -### Upgrading from 1.1 to 1.2 +### Updating from 1.1 to 1.2 No incompatiblities. -### Upgrading from 1.0 to 1.1 +### Updating from 1.0 to 1.1 In 1.1 the type **\_\_file** was split into **\_\_directory**, **\_\_file** and **\_\_link**. The parameter **--type** was removed from **\_\_file**. Thus you From 38e84a8b69f611d67148c8f3a50b1e169017a241 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 14:06:25 +0100 Subject: [PATCH 385/412] fix title Signed-off-by: Nico Schottelius --- docs/web/cdist/update.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/web/cdist/update.mdwn b/docs/web/cdist/update.mdwn index 5f427369..c34c83ee 100644 --- a/docs/web/cdist/update.mdwn +++ b/docs/web/cdist/update.mdwn @@ -20,7 +20,7 @@ To upgrade to the lastet version do pip install --upgrade cdist -## Update Instructions / Hints +## Update Instructions ### Updating from 2.0 to 2.1 @@ -43,7 +43,7 @@ To upgrade to the lastet version do * 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 +* Use **\_\_object_name** instead of **\_\_self** in manifests ### Updating from 1.6 to 1.7 From cad5015962704ea7d6c441713a4743a7f97935cd Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 14:08:27 +0100 Subject: [PATCH 386/412] no autofs* anymore Signed-off-by: Nico Schottelius --- docs/web/cdist/update.mdwn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/web/cdist/update.mdwn b/docs/web/cdist/update.mdwn index c34c83ee..a916575a 100644 --- a/docs/web/cdist/update.mdwn +++ b/docs/web/cdist/update.mdwn @@ -35,6 +35,8 @@ To upgrade to the lastet version do manually to the new location. * Replace the variable **__self** by **__object_name** Support for the variable **__object_name** is already present in 2.0. + * The types __autofs, __autofs_map and __autofs_reload have been removed + (no maintainer, no users) ### Updating from 1.7 to 2.0 From c51edff9f586361dfc13237c2bdf26317f260d30 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 14:15:54 +0100 Subject: [PATCH 387/412] ++changes(2.1.0pre8) Signed-off-by: Nico Schottelius --- docs/changelog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/changelog b/docs/changelog index df5c1b2b..c6ea4ffc 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,15 +4,16 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius -2.1.0pre8: +2.1.0pre8: 2012-11-15 * Type cleanup: __apt_ppa, __apt_ppa_update_index, __file, __ssh_authorized_key, __timezone, all install types (Steven Armstrong) * Types: Remove all parameter changing code * Type __rvm_ruby: Change parameter "default" to be boolean + * Documentation: Web documentation cleaned up 2.1.0pre7: 2012-11-07 * Core: All unit tests restored back to working - * Core: Print error message on missing initial manifest + * Core: Print error message when missing the initial manifest 2.1.0pre6: 2012-11-05 * New Example: Turn remote calls into local calls (used for unittesting) From 5ffd52334052e0b6074992a964bc1a85c96bade5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 14:33:08 +0100 Subject: [PATCH 388/412] doc and doc building update Signed-off-by: Nico Schottelius --- build | 36 +++++++++++++++---------------- docs/web/cdist/documentation.mdwn | 6 ++++-- docs/web/cdist/update.mdwn | 16 ++++++++------ 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/build b/build index baad93be..f1e0bf8e 100755 --- a/build +++ b/build @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Nico Schottelius (nico-cdist at schottelius.org) +# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -34,9 +34,10 @@ 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 +WEBDIR=$HOME/www.nico.schottelius.org WEBBLOG=$WEBDIR/blog -WEBBASE=$WEBDIR/software/cdist +WEBTOPDIR=$WEBDIR/software +WEBBASE=$WEBTOPDIR/cdist WEBMAN=$WEBBASE/man/$version WEBPAGE=${WEBBASE}.mdwn @@ -89,6 +90,13 @@ case "$1" in ${MANDIR}/cdist-reference.text.sh ;; + man-pub) + rm -rf "${WEBMAN}" + mkdir -p "${WEBMAN}/man1" "${WEBMAN}/man7" + cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${WEBMAN}/man1 + cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${WEBMAN}/man7 + ;; + dist) set -e # Do the checks @@ -314,23 +322,15 @@ eof done ;; - webmain) - cp README ${WEBPAGE} - cd ${WEBDIR} && git commit -m "cdist main update" ${WEBPAGE} - cd ${WEBDIR} && make pub - ;; - web) - cp README ${WEBPAGE} - rm -rf ${WEBMAN} - mkdir -p ${WEBMAN}/man1 ${WEBMAN}/man7 + set -e + rsync -av "${basedir}/docs/web/" "${WEBTOPDIR}" - cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${WEBMAN}/man1 - cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${WEBMAN}/man7 - - cd ${WEBDIR} && git add ${WEBBASE} - cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE} - cd ${WEBDIR} && make pub + $0 man-pub + + cd "${WEBDIR}" && git add "${WEBBASE}" + cd "${WEBDIR}" && git commit -m "cdist update" "${WEBBASE}" "${WEBPAGE}" + cd "${WEBDIR}" && make pub # Fix ikiwiki, which does not like symlinks for pseudo security ssh tee.schottelius.org \ diff --git a/docs/web/cdist/documentation.mdwn b/docs/web/cdist/documentation.mdwn index aa751a4b..ba829101 100644 --- a/docs/web/cdist/documentation.mdwn +++ b/docs/web/cdist/documentation.mdwn @@ -1,5 +1,7 @@ +[[!meta title="Documentation"]] -* [Latest documentation](man/latest) -* [All versions](man) +You can browse the latest +[latest version of the manpages](man/latest) or +have a look at [all versions](man). [[!tag cdist unix]] diff --git a/docs/web/cdist/update.mdwn b/docs/web/cdist/update.mdwn index a916575a..7fac8444 100644 --- a/docs/web/cdist/update.mdwn +++ b/docs/web/cdist/update.mdwn @@ -24,18 +24,20 @@ To upgrade to the lastet version do ### Updating from 2.0 to 2.1 - * Type __package* and __process use --state **present** or **absent**. + * Type **\_\_package* and \_\_process** use --state **present** or **absent**. The states **removed/installed** and **stopped/running** have been removed. Support for the new states is already present in 2.0. - * Type __directory: Parameter --parents and --recursive are now boolean - and the old "yes/no" values need to be removed - * Type **__addifnosuchline** and **__removeline** have been replaced by **__line** + * Type **\_\_directory**: Parameter --parents and --recursive are now boolean + The old "yes/no" values need to be removed. + * Type **\_\_rvm_ruby**: Parameter --default is now boolean + The old "yes/no" values need to be removed. + * Type **\_\_addifnosuchline** and **\_\_removeline** have been replaced by **\_\_line** * The **conf** directory is now located at **cdist/conf**. You need to migrate your types, explorers and manifests manually to the new location. - * Replace the variable **__self** by **__object_name** - Support for the variable **__object_name** is already present in 2.0. - * The types __autofs, __autofs_map and __autofs_reload have been removed + * Replace the variable **\_\_self** by **\_\_object_name** + Support for the variable **\_\_object_name** is already present in 2.0. + * The types **\_\_autofs**, **\_\_autofs_map** and **\_\_autofs_reload** have been removed (no maintainer, no users) From 625f67f45fb6d331df36e1d083eca0c0be2ad023 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 14:36:45 +0100 Subject: [PATCH 389/412] exchange comma Signed-off-by: Nico Schottelius --- docs/web/cdist.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/web/cdist.mdwn b/docs/web/cdist.mdwn index cd2a7567..ee24e910 100644 --- a/docs/web/cdist.mdwn +++ b/docs/web/cdist.mdwn @@ -7,8 +7,8 @@ It adheres to the KISS principle and is being used in small up to enterprise grade environments. cdist is an alternative to other configuration management systems like [bcfg2](http://trac.mcs.anl.gov/projects/bcfg2), -[chef](http://wiki.opscode.com/display/chef/) -[cfengine](http://www.cfengine.org/), +[chef](http://wiki.opscode.com/display/chef/), +[cfengine](http://www.cfengine.org/) and [puppet](http://www.puppetlabs.com/). * [[Documentation|documentation]] From 447092ced4e712da9532a064e747203e30d4e2d9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 14:43:11 +0100 Subject: [PATCH 390/412] hint to the documentation on the install site Signed-off-by: Nico Schottelius --- docs/web/cdist/install.mdwn | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/web/cdist/install.mdwn b/docs/web/cdist/install.mdwn index 79d8705d..ad97cd2b 100644 --- a/docs/web/cdist/install.mdwn +++ b/docs/web/cdist/install.mdwn @@ -172,5 +172,8 @@ Cdist is available as a python package at pip install cdist +## Use cdist + +[[Dig into the documentation|documentation]] to get started with cdist! [[!tag cdist unix]] From c10080ec2f86728e2f6d4cb8bb021390c2a7bb10 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 14:47:42 +0100 Subject: [PATCH 391/412] add path prefix for manpages Signed-off-by: Nico Schottelius --- docs/web/cdist/documentation.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/web/cdist/documentation.mdwn b/docs/web/cdist/documentation.mdwn index ba829101..e5fd9bc9 100644 --- a/docs/web/cdist/documentation.mdwn +++ b/docs/web/cdist/documentation.mdwn @@ -1,7 +1,7 @@ [[!meta title="Documentation"]] You can browse the latest -[latest version of the manpages](man/latest) or -have a look at [all versions](man). +[latest version of the manpages](/software/cdist/man/latest) or +have a look at [all versions](/software/cdist/man). [[!tag cdist unix]] From a3f3d2a3b35698df66a123cf0c034c0c2c454810 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 14:54:15 +0100 Subject: [PATCH 392/412] call man-pub in dist, but not in web releases Signed-off-by: Nico Schottelius --- build | 8 ++++++-- docs/web/cdist/update.mdwn | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build b/build index f1e0bf8e..b19be55a 100755 --- a/build +++ b/build @@ -91,6 +91,8 @@ case "$1" in ;; man-pub) + $0 man + rm -rf "${WEBMAN}" mkdir -p "${WEBMAN}/man1" "${WEBMAN}/man7" cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${WEBMAN}/man1 @@ -115,6 +117,10 @@ case "$1" in # Update website (includes documentation) $0 web + # Update manpages on website + $0 man-pub + + # update git repos $0 pub $0 dist-blog @@ -326,8 +332,6 @@ eof set -e rsync -av "${basedir}/docs/web/" "${WEBTOPDIR}" - $0 man-pub - cd "${WEBDIR}" && git add "${WEBBASE}" cd "${WEBDIR}" && git commit -m "cdist update" "${WEBBASE}" "${WEBPAGE}" cd "${WEBDIR}" && make pub diff --git a/docs/web/cdist/update.mdwn b/docs/web/cdist/update.mdwn index 7fac8444..c62acc8f 100644 --- a/docs/web/cdist/update.mdwn +++ b/docs/web/cdist/update.mdwn @@ -40,7 +40,6 @@ To upgrade to the lastet version do * The types **\_\_autofs**, **\_\_autofs_map** and **\_\_autofs_reload** have been removed (no maintainer, no users) - ### Updating from 1.7 to 2.0 * Ensure python (>= 3.2) is installed on the source host From 018ba02111db60fd6c125ac8089690e5e1fbd2c2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 15:03:55 +0100 Subject: [PATCH 393/412] no past Signed-off-by: Nico Schottelius --- docs/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index c6ea4ffc..151ff45c 100644 --- a/docs/changelog +++ b/docs/changelog @@ -9,7 +9,7 @@ Changelog __ssh_authorized_key, __timezone, all install types (Steven Armstrong) * Types: Remove all parameter changing code * Type __rvm_ruby: Change parameter "default" to be boolean - * Documentation: Web documentation cleaned up + * Documentation: Web documentation clean up 2.1.0pre7: 2012-11-07 * Core: All unit tests restored back to working From 8457e6cfd1581ec875c5a0b1ff38ea0cbdaf6c1b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 15:17:15 +0100 Subject: [PATCH 394/412] also git add & commit the manpages Signed-off-by: Nico Schottelius --- build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build b/build index b19be55a..fb01c565 100755 --- a/build +++ b/build @@ -93,10 +93,13 @@ case "$1" in man-pub) $0 man + version=$($0 changelog-version) + rm -rf "${WEBMAN}" mkdir -p "${WEBMAN}/man1" "${WEBMAN}/man7" cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${WEBMAN}/man1 cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${WEBMAN}/man7 + cd ${WEBMAN} && git add . && git commit -m "Cdist Manpage update: $version" ;; dist) From 19426574f723617b12a4dfd05d31650e10a31883 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 16:49:00 +0100 Subject: [PATCH 395/412] remove obsolete move Signed-off-by: Nico Schottelius --- PKGBUILD.in | 3 --- 1 file changed, 3 deletions(-) diff --git a/PKGBUILD.in b/PKGBUILD.in index a4e744ae..68bd6add 100755 --- a/PKGBUILD.in +++ b/PKGBUILD.in @@ -17,9 +17,6 @@ source=("http://pypi.python.org/packages/source/c/cdist/cdist-\${pkgver}.tar.gz" package() { cd cdist-\${pkgver} python3 setup.py build install --root="\${pkgdir}" - mv "\${pkgdir}"/usr/bin/cdist.py "\${pkgdir}"/usr/bin/cdist - - #install -Dm644 offlineimap.1 "\${pkgdir}"/usr/share/man/man1/offlineimap.1 } eof From 18dd0ebd337a550429954cac7646b5a7b2cdea74 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 17:37:15 +0100 Subject: [PATCH 396/412] ensure global and type explorers are executable on the remote side Signed-off-by: Nico Schottelius --- cdist/core/explorer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cdist/core/explorer.py b/cdist/core/explorer.py index da84cfaa..86ce52ac 100644 --- a/cdist/core/explorer.py +++ b/cdist/core/explorer.py @@ -98,6 +98,7 @@ class Explorer(object): """Transfer the global explorers to the remote side.""" self.remote.mkdir(self.remote.global_explorer_path) self.remote.transfer(self.local.global_explorer_path, self.remote.global_explorer_path) + self.remote.run(["chmod", "0700", "%s/*" % (self.remote.global_explorer_path)]) def run_global_explorer(self, explorer): """Run the given global explorer and return it's output.""" @@ -152,6 +153,7 @@ class Explorer(object): destination = os.path.join(self.remote.type_path, cdist_type.explorer_path) self.remote.mkdir(destination) self.remote.transfer(source, destination) + self.remote.run(["chmod", "0700", "%s" % (destination)]) self._type_explorers_transferred.append(cdist_type.name) def transfer_object_parameters(self, cdist_object): From f834352e881d6ab75b4a2496dbf8c28c0798d18b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 17:38:43 +0100 Subject: [PATCH 397/412] document changes for next version, fixes #122 Signed-off-by: Nico Schottelius --- docs/changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog b/docs/changelog index 151ff45c..a2c72ed9 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,6 +4,9 @@ Changelog * Changes are always commented with their author in (braces) * Exception: No braces means author == Nico Schottelius +next: + * Core: Ensure global and type explorers are executable + 2.1.0pre8: 2012-11-15 * Type cleanup: __apt_ppa, __apt_ppa_update_index, __file, __ssh_authorized_key, __timezone, all install types (Steven Armstrong) From e6bf22603651d3941c000ce671cc57e58d01b784 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 17:47:06 +0100 Subject: [PATCH 398/412] convert __rvm_gmeset to boolean parameter Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm_gemset/gencode-remote | 12 ++++-------- cdist/conf/type/__rvm_gemset/man.text | 7 ++++--- .../__rvm_gemset/parameter/{optional => boolean} | 0 3 files changed, 8 insertions(+), 11 deletions(-) rename cdist/conf/type/__rvm_gemset/parameter/{optional => boolean} (100%) diff --git a/cdist/conf/type/__rvm_gemset/gencode-remote b/cdist/conf/type/__rvm_gemset/gencode-remote index 1fd14061..f0c0052b 100755 --- a/cdist/conf/type/__rvm_gemset/gencode-remote +++ b/cdist/conf/type/__rvm_gemset/gencode-remote @@ -24,7 +24,6 @@ ruby="$(echo "$gemset" | cut -d '@' -f 1)" gemsetname="$(echo "$gemset" | cut -d '@' -f 2)" state_is="$(cat "$__object/explorer/state")" user="$(cat "$__object/parameter/user")" -default="$(cat "$__object/parameter/default" 2>/dev/null || true)" state_should="$(cat "$__object/parameter/state")" [ "$state_is" = "$state_should" ] && exit 0 @@ -34,15 +33,12 @@ case "$state_should" in cat << DONE su - "$user" -c "source ~/.rvm/scripts/rvm; rvm $gemset --create" DONE - case "$default" in - no) - ;; - *) - cat << DONE + if -f "$__object/parameter/default"; then + cat << DONE su - "$user" -c "source ~/.rvm/scripts/rvm; rvm use --default $gemset" DONE - ;; - esac + fi + ;; absent) cat << DONE diff --git a/cdist/conf/type/__rvm_gemset/man.text b/cdist/conf/type/__rvm_gemset/man.text index 26e866ba..44c0c555 100644 --- a/cdist/conf/type/__rvm_gemset/man.text +++ b/cdist/conf/type/__rvm_gemset/man.text @@ -20,10 +20,11 @@ user:: state:: Either "present" or "absent". -OPTIONAL PARAMETERS +BOOLEAN PARAMETERS ------------------- default:: - If set to anything but "no" (the default), set the given gemset as default. + If present, set the given gemset as default. + EXAMPLES -------- @@ -33,7 +34,7 @@ EXAMPLES __rvm_gemset ruby-1.9.3-p0@myset --user charles --state present # Do the same and make ruby-1.9.3-p0@myset the default gemset -__rvm_gemset ruby-1.9.3-p0@myset --user charles --state present --default yes +__rvm_gemset ruby-1.9.3-p0@myset --user charles --state present --default # Remove the gemset @myset for user john __rvm_ruby ruby-1.9.3-p0@myset --user john --state absent diff --git a/cdist/conf/type/__rvm_gemset/parameter/optional b/cdist/conf/type/__rvm_gemset/parameter/boolean similarity index 100% rename from cdist/conf/type/__rvm_gemset/parameter/optional rename to cdist/conf/type/__rvm_gemset/parameter/boolean From bec3569724156a541390d22aa7b1ddff3ddf6bd0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 15 Nov 2012 17:48:01 +0100 Subject: [PATCH 399/412] document more changes for next release Signed-off-by: Nico Schottelius --- docs/changelog | 1 + docs/web/cdist/update.mdwn | 2 ++ 2 files changed, 3 insertions(+) diff --git a/docs/changelog b/docs/changelog index a2c72ed9..46c9fa50 100644 --- a/docs/changelog +++ b/docs/changelog @@ -6,6 +6,7 @@ Changelog next: * Core: Ensure global and type explorers are executable + * Type __rvm_gemset: Change parameter "default" to be boolean 2.1.0pre8: 2012-11-15 * Type cleanup: __apt_ppa, __apt_ppa_update_index, __file, diff --git a/docs/web/cdist/update.mdwn b/docs/web/cdist/update.mdwn index c62acc8f..2316cf68 100644 --- a/docs/web/cdist/update.mdwn +++ b/docs/web/cdist/update.mdwn @@ -31,6 +31,8 @@ To upgrade to the lastet version do The old "yes/no" values need to be removed. * Type **\_\_rvm_ruby**: Parameter --default is now boolean The old "yes/no" values need to be removed. + * Type **\_\_rvm_gemset**: Parameter --default is now boolean + The old "yes/no" values need to be removed. * Type **\_\_addifnosuchline** and **\_\_removeline** have been replaced by **\_\_line** * The **conf** directory is now located at **cdist/conf**. You need to migrate your types, explorers and manifests From e4910933b109c4d0858a0fa6ee901d211544e6e1 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 16 Nov 2012 14:56:20 +0100 Subject: [PATCH 400/412] __apt_ppa: /enabled/present/ -e /disabled/absent/ Signed-off-by: Steven Armstrong --- cdist/conf/type/__apt_ppa/explorer/state | 2 +- cdist/conf/type/__apt_ppa/gencode-remote | 20 +++++++++++--------- cdist/conf/type/__apt_ppa/man.text | 6 +++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cdist/conf/type/__apt_ppa/explorer/state b/cdist/conf/type/__apt_ppa/explorer/state index 8a5638b2..2d8ca7c5 100755 --- a/cdist/conf/type/__apt_ppa/explorer/state +++ b/cdist/conf/type/__apt_ppa/explorer/state @@ -29,5 +29,5 @@ repo_name="${name#ppa:}" repo_file_name="$(echo "$repo_name" | sed "s:\/:\-:")-${DISTRIB_CODENAME}.list" [ -s "/etc/apt/sources.list.d/${repo_file_name}" ] \ - && echo enabled || echo disabled + && echo present || echo absent diff --git a/cdist/conf/type/__apt_ppa/gencode-remote b/cdist/conf/type/__apt_ppa/gencode-remote index 0e7fe163..0ea8011c 100755 --- a/cdist/conf/type/__apt_ppa/gencode-remote +++ b/cdist/conf/type/__apt_ppa/gencode-remote @@ -22,14 +22,16 @@ name="$__object_id" state_should="$(cat "$__object/parameter/state")" state_is="$(cat "$__object/explorer/state")" -if [ "$state_should" != "$state_is" ]; then - case "$state_should" in - enabled) - echo add-apt-repository \"$name\" - ;; - disabled) - echo remove-apt-repository \"$name\" - ;; - esac +if [ "$state_should" == "$state_is" ]; then + # Nothing to do, move along + exit 0 fi +case "$state_should" in + present) + echo add-apt-repository \"$name\" + ;; + absent) + echo remove-apt-repository \"$name\" + ;; +esac diff --git a/cdist/conf/type/__apt_ppa/man.text b/cdist/conf/type/__apt_ppa/man.text index f986eb2d..6a5990d5 100644 --- a/cdist/conf/type/__apt_ppa/man.text +++ b/cdist/conf/type/__apt_ppa/man.text @@ -16,7 +16,7 @@ This cdist type allows manage ubuntu ppa repositories. REQUIRED PARAMETERS ------------------- state:: - The state the ppa should be in, either "enabled" or "disabled". + The state the ppa should be in, either "present" or "absent". OPTIONAL PARAMETERS @@ -29,10 +29,10 @@ EXAMPLES -------------------------------------------------------------------------------- # Enable a ppa repository -__apt_ppa ppa:sans-intern/missing-bits --state enabled +__apt_ppa ppa:sans-intern/missing-bits --state present # Disable a ppa repository -__apt_ppa ppa:sans-intern/missing-bits --state disabled +__apt_ppa ppa:sans-intern/missing-bits --state absent -------------------------------------------------------------------------------- From 6c685e61d58959dac82653a34d68e32d9f20cbcc Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 15 Nov 2012 14:54:28 +0100 Subject: [PATCH 401/412] fixes #126 Signed-off-by: Steven Armstrong --- cdist/emulator.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cdist/emulator.py b/cdist/emulator.py index e54bd0dc..42744fab 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -135,6 +135,8 @@ class Emulator(object): self.parameters = {} for key,value in vars(self.args).items(): if value is not None: + if isinstance(value, list): + value = '\n'.join(value) self.parameters[key] = value if self.cdist_object.exists: From 28e8632097ae6b0bd1db92d100ea75a72f498a35 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 16 Nov 2012 15:31:33 +0100 Subject: [PATCH 402/412] new type: __user_group: manage user groups Signed-off-by: Steven Armstrong --- cdist/conf/type/__user_groups/explorer/group | 23 ++++++++ cdist/conf/type/__user_groups/gencode-remote | 46 ++++++++++++++++ cdist/conf/type/__user_groups/man.text | 52 +++++++++++++++++++ .../type/__user_groups/parameter/optional | 2 + .../__user_groups/parameter/required_multiple | 1 + 5 files changed, 124 insertions(+) create mode 100755 cdist/conf/type/__user_groups/explorer/group create mode 100755 cdist/conf/type/__user_groups/gencode-remote create mode 100644 cdist/conf/type/__user_groups/man.text create mode 100644 cdist/conf/type/__user_groups/parameter/optional create mode 100644 cdist/conf/type/__user_groups/parameter/required_multiple diff --git a/cdist/conf/type/__user_groups/explorer/group b/cdist/conf/type/__user_groups/explorer/group new file mode 100755 index 00000000..a8cb63af --- /dev/null +++ b/cdist/conf/type/__user_groups/explorer/group @@ -0,0 +1,23 @@ +#!/bin/sh +# +# 2012 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" 2>/dev/null || echo "$__object_id")" + +(id --groups --name "$user" | tr ' ' '\n' | sort) 2>/dev/null || true diff --git a/cdist/conf/type/__user_groups/gencode-remote b/cdist/conf/type/__user_groups/gencode-remote new file mode 100755 index 00000000..c5e4a35e --- /dev/null +++ b/cdist/conf/type/__user_groups/gencode-remote @@ -0,0 +1,46 @@ +#!/bin/sh +# +# 2012 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" 2>/dev/null || echo "$__object_id")" +state_should="$(cat "$__object/parameter/state" 2>/dev/null || echo "present")" + +mkdir "$__object/files" +# file has to be sorted for comparison with `comm` +sort "$__object/parameter/group" > "$__object/files/group.sorted" + +case "$state_should" in + present) + changed_groups="$(comm -13 "$__object/explorer/group" "$__object/files/group.sorted")" + action="-a" + ;; + absent) + changed_groups="$(comm -12 "$__object/explorer/group" "$__object/files/group.sorted")" + action="-d" + ;; +esac + +if [ -z "$changed_groups" ]; then + # Nothing to do, move along + exit 0 +fi + +for group in $changed_groups; do + echo "gpasswd $action \"$user\" \"$group\"" +done diff --git a/cdist/conf/type/__user_groups/man.text b/cdist/conf/type/__user_groups/man.text new file mode 100644 index 00000000..d45784fe --- /dev/null +++ b/cdist/conf/type/__user_groups/man.text @@ -0,0 +1,52 @@ +cdist-type__user_groups(7) +========================== +Steven Armstrong + + +NAME +---- +cdist-type__user_groups - manage user groups + + +DESCRIPTION +----------- +Adds or removes a user from one or more groups. + + +REQUIRED PARAMETERS +------------------- +group:: + the group to which this user should be added or removed. + Can be specified multiple times. + + +OPTIONAL PARAMETERS +------------------- +user:: + the name of the user. Defaults to object_id + +state:: + absent or present. Defaults to present. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +__user_groups nginx --group webuser1 --group webuser2 + +# remove user nginx from groups webuser2 +__user_groups nginx-webuser2 --user nginx \ + --group webuser2 --state absent +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2012 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__user_groups/parameter/optional b/cdist/conf/type/__user_groups/parameter/optional new file mode 100644 index 00000000..7d9ecf60 --- /dev/null +++ b/cdist/conf/type/__user_groups/parameter/optional @@ -0,0 +1,2 @@ +user +state diff --git a/cdist/conf/type/__user_groups/parameter/required_multiple b/cdist/conf/type/__user_groups/parameter/required_multiple new file mode 100644 index 00000000..3a60ccec --- /dev/null +++ b/cdist/conf/type/__user_groups/parameter/required_multiple @@ -0,0 +1 @@ +group From b0ac5fe78d913f03f24e17d36222a6638cda0a73 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 16 Nov 2012 21:18:08 +0100 Subject: [PATCH 403/412] update __jail type to match changed signature of __directory: fixes #135 Signed-off-by: Steven Armstrong --- cdist/conf/type/__jail/manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__jail/manifest b/cdist/conf/type/__jail/manifest index b2ecf2bc..0570d62d 100755 --- a/cdist/conf/type/__jail/manifest +++ b/cdist/conf/type/__jail/manifest @@ -39,7 +39,7 @@ else jaildir="/usr/jail" fi -__directory ${jaildir} --parents yes +__directory ${jaildir} --parents # Debug #set +x From aedda96f3e3dbb3f261cfab87721819baa49f304 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 18 Nov 2012 12:36:12 +0100 Subject: [PATCH 404/412] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog b/docs/changelog index 46c9fa50..b1cf62ff 100644 --- a/docs/changelog +++ b/docs/changelog @@ -7,6 +7,7 @@ Changelog next: * Core: Ensure global and type explorers are executable * Type __rvm_gemset: Change parameter "default" to be boolean + * New Type: __user_groups (Steven Armstrong) 2.1.0pre8: 2012-11-15 * Type cleanup: __apt_ppa, __apt_ppa_update_index, __file, From 1774b50e479411d658e49e638ac4e8572ce3ccd0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 18 Nov 2012 23:20:22 +0100 Subject: [PATCH 405/412] argh - side effects Signed-off-by: Nico Schottelius --- .../logs/2012-11-18.problematic-side-effects | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/dev/logs/2012-11-18.problematic-side-effects diff --git a/docs/dev/logs/2012-11-18.problematic-side-effects b/docs/dev/logs/2012-11-18.problematic-side-effects new file mode 100644 index 00000000..032a9f80 --- /dev/null +++ b/docs/dev/logs/2012-11-18.problematic-side-effects @@ -0,0 +1,22 @@ +- Problem: Installing xbmc package creates user xbmc. +As xbmc is the first user, it gets the uid 1000. + +Later on trying to create the user "nutzer" with uid 1000 fails, because +xbmc already has that uid. + + +INFO: matte: Generating and executing code for __package/upower +INFO: matte: Generating and executing code for __nico_managed_desktop/singleton +ln -s '/usr/lib/systemd/system/slim.service' '/etc/systemd/system/display-manager.service' +INFO: matte: Generating and executing code for __directory/etc/sudoers.d +INFO: matte: Generating and executing code for __file/etc/sudoers.d/nico +INFO: matte: Generating and executing code for __cdistmarker/singleton +INFO: matte: Generating and executing code for __package_pacman/sudo +INFO: matte: Generating and executing code for __package/sudo +INFO: matte: Generating and executing code for __package_pacman/xf86-video-intel +INFO: matte: Generating and executing code for __user/nutzer +useradd: UID 1000 is not unique +ERROR: matte: Command failed: ssh -o User=root -q matte umask 077; /bin/sh -e /var/lib/cdist/object/__user/nutzer/.cdist/code-remote +INFO: Total processing time for 1 host(s): 3512.761916399002 +ERROR: Failed to deploy to the following hosts: matte +[17:40] brief:nico% ./bin/cdist config -v matte From 327a0f2844d93c13c36ae99385a5fdaaa9656534 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 18 Nov 2012 23:31:19 +0100 Subject: [PATCH 406/412] remove --groups from __user type Signed-off-by: Nico Schottelius --- cdist/conf/type/__user/man.text | 2 -- cdist/conf/type/__user/parameter/optional | 1 - docs/changelog | 1 + docs/web/cdist/update.mdwn | 1 + 4 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cdist/conf/type/__user/man.text b/cdist/conf/type/__user/man.text index 7be2c2f2..9db4a9f0 100644 --- a/cdist/conf/type/__user/man.text +++ b/cdist/conf/type/__user/man.text @@ -26,8 +26,6 @@ home:: see above gid:: see above -groups:: - see above password:: see above shell:: diff --git a/cdist/conf/type/__user/parameter/optional b/cdist/conf/type/__user/parameter/optional index fe02e227..e3cf52d5 100644 --- a/cdist/conf/type/__user/parameter/optional +++ b/cdist/conf/type/__user/parameter/optional @@ -1,7 +1,6 @@ comment home gid -groups password shell uid diff --git a/docs/changelog b/docs/changelog index b1cf62ff..68b35eac 100644 --- a/docs/changelog +++ b/docs/changelog @@ -8,6 +8,7 @@ next: * Core: Ensure global and type explorers are executable * Type __rvm_gemset: Change parameter "default" to be boolean * New Type: __user_groups (Steven Armstrong) + * Type __user: Remove --groups support (now provided by __user_groups) 2.1.0pre8: 2012-11-15 * Type cleanup: __apt_ppa, __apt_ppa_update_index, __file, diff --git a/docs/web/cdist/update.mdwn b/docs/web/cdist/update.mdwn index 2316cf68..22b92769 100644 --- a/docs/web/cdist/update.mdwn +++ b/docs/web/cdist/update.mdwn @@ -41,6 +41,7 @@ To upgrade to the lastet version do Support for the variable **\_\_object_name** is already present in 2.0. * The types **\_\_autofs**, **\_\_autofs_map** and **\_\_autofs_reload** have been removed (no maintainer, no users) + * Type **\_\_user**: Parameter --groups removed (use the new \_\_user_groups type) ### Updating from 1.7 to 2.0 From 6d430524f1a0ee661dbd1c4af1aac6d721a0d064 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 19 Nov 2012 12:04:07 +0100 Subject: [PATCH 407/412] binary all the way, fixes issue #138 Signed-off-by: Steven Armstrong --- cdist/emulator.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index 42744fab..a9c760cb 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -29,7 +29,7 @@ import cdist from cdist import core class Emulator(object): - def __init__(self, argv, stdin=sys.stdin, env=os.environ): + def __init__(self, argv, stdin=sys.stdin.buffer, env=os.environ): self.argv = argv self.stdin = stdin self.env = env @@ -151,6 +151,10 @@ class Emulator(object): # Record / Append source self.cdist_object.source.append(self.object_source) + chunk_size = 65536 + def _read_stdin(self): + return self.stdin.read(self.chunk_size) + def save_stdin(self): """If something is written to stdin, save it in the object as $__object/stdin so it can be accessed in manifest and gencode-* @@ -160,10 +164,12 @@ class Emulator(object): try: # go directly to file instead of using CdistObject's api # as that does not support streaming - # FIXME: no streaming needed anymore - use a raw file (not yet there?) path = os.path.join(self.cdist_object.absolute_path, 'stdin') - with open(path, 'w') as fd: - fd.write(self.stdin.read()) + with open(path, 'wb') as fd: + chunk = self._read_stdin() + while chunk: + fd.write(chunk) + chunk = self._read_stdin() except EnvironmentError as e: raise cdist.Error('Failed to read from stdin: %s' % e) From 84770b9ef2afbfa1232845ce6538b56df99cee3a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 19 Nov 2012 11:25:56 +0100 Subject: [PATCH 408/412] implement before/after to declare dependencies and deprecate require Signed-off-by: Steven Armstrong --whitespace Signed-off-by: Steven Armstrong --- cdist/core/cdist_object.py | 2 ++ cdist/emulator.py | 25 +++++++++++++++++++++---- cdist/resolver.py | 17 ++++++++++++++--- cdist/test/object/__init__.py | 1 + 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/cdist/core/cdist_object.py b/cdist/core/cdist_object.py index 90a21e59..7e587bf3 100644 --- a/cdist/core/cdist_object.py +++ b/cdist/core/cdist_object.py @@ -186,6 +186,8 @@ class CdistObject(object): return os.path.join(self.path, "explorer") requirements = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'require')) + before = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'before')) + after = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'after')) autorequire = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, 'autorequire')) parameters = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.parameter_path)) explorers = fsproperty.DirectoryDictProperty(lambda obj: os.path.join(obj.base_path, obj.explorer_path)) diff --git a/cdist/emulator.py b/cdist/emulator.py index a9c760cb..bd3661d3 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -23,6 +23,7 @@ import argparse import logging import os +import warnings import sys import cdist @@ -92,8 +93,12 @@ class Emulator(object): def commandline(self): """Parse command line""" + self.meta_parameters = dict.fromkeys(('after', 'before')) + meta_parser = argparse.ArgumentParser(add_help=False) + for meta_parameter in self.meta_parameters.keys(): + meta_parser.add_argument('--%s' % meta_parameter, action='append', required=False) - parser = argparse.ArgumentParser(add_help=False, argument_default=argparse.SUPPRESS) + parser = argparse.ArgumentParser(add_help=False, parents=[meta_parser], argument_default=argparse.SUPPRESS) for parameter in self.cdist_type.required_parameters: argument = "--" + parameter @@ -119,6 +124,11 @@ class Emulator(object): self.args = parser.parse_args(self.argv[1:]) self.log.debug('Args: %s' % self.args) + # Handle meta parameters + for meta_parameter in self.meta_parameters.keys(): + if meta_parameter in self.args: + self.meta_parameters[meta_parameter] = getattr(self.args, meta_parameter) + delattr(self.args, meta_parameter) def setup_object(self): # Setup object_id - FIXME: unset / do not setup anymore! @@ -175,10 +185,18 @@ class Emulator(object): def record_requirements(self): """record requirements""" + for key in ('before', 'after'): + if key in self.meta_parameters and self.meta_parameters[key]: + for value in self.meta_parameters[key]: + self.log.debug("Recording requirement: %s %s %s", self.cdist_object.name, key, value) + dependency_list = getattr(self.cdist_object, key) + # append to the object.after or object.before lists + dependency_list.append(value) if "require" in self.env: + warnings.warn("The 'require' envrionment variable is deprecated. Use the --before and --after meta parameters to define dependencies.", category=PendingDeprecationWarning, stacklevel=2) + requirements = self.env['require'] - self.log.debug("reqs = " + requirements) for requirement in requirements.split(" "): # Ignore empty fields - probably the only field anyway if len(requirement) == 0: continue @@ -187,11 +205,10 @@ class Emulator(object): cdist_object = self.cdist_object.object_from_name(requirement) self.log.debug("Recording requirement: " + requirement) - # Save the sanitised version, not the user supplied one # (__file//bar => __file/bar) # This ensures pattern matching is done against sanitised list - self.cdist_object.requirements.append(cdist_object.name) + self.cdist_object.after.append(cdist_object.name) def record_auto_requirements(self): """An object shall automatically depend on all objects that it defined in it's type manifest. diff --git a/cdist/resolver.py b/cdist/resolver.py index 7e3a1a68..d181d066 100644 --- a/cdist/resolver.py +++ b/cdist/resolver.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2011-2012 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -109,10 +109,21 @@ class DependencyResolver(object): raise RequirementNotFoundError(pattern) def _preprocess_requirements(self): - """Find all autorequire dependencies and merge them to be just requirements - for further processing. + """Find all before, after and autorequire dependencies and merge them + to be just requirements for further processing. """ for cdist_object in self.objects.values(): + if cdist_object.after: + cdist_object.requirements.extend(cdist_object.after) + # As we changed the object on disc, we have to ensure it is not + # preprocessed again if someone would call us multiple times. + cdist_object.after = [] + if cdist_object.before: + for other_object in self.find_requirements_by_name(cdist_object.before): + other_object.requirements.append(cdist_object.name) + # As we changed the object on disc, we have to ensure it is not + # preprocessed again if someone would call us multiple times. + cdist_object.before = [] if cdist_object.autorequire: # The objects (children) that this cdist_object (parent) defined # in it's type manifest shall inherit all explicit requirements diff --git a/cdist/test/object/__init__.py b/cdist/test/object/__init__.py index 3a91f709..7bdc037e 100644 --- a/cdist/test/object/__init__.py +++ b/cdist/test/object/__init__.py @@ -87,6 +87,7 @@ class ObjectTestCase(test.CdistTestCase): self.cdist_object.code_local = '' self.cdist_object.code_remote = '' self.cdist_object.state = '' + self.cdist_object.requirements = [] def test_name(self): self.assertEqual(self.cdist_object.name, '__third/moon') From 7f0ae7928a3e2bb37c7db20d23251fdd156c8f0a Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 19 Nov 2012 13:04:57 +0100 Subject: [PATCH 409/412] fix state explorer to properly detect already existing ppa Signed-off-by: Steven Armstrong --- cdist/conf/type/__apt_ppa/explorer/state | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__apt_ppa/explorer/state b/cdist/conf/type/__apt_ppa/explorer/state index 2d8ca7c5..2bb4f65a 100755 --- a/cdist/conf/type/__apt_ppa/explorer/state +++ b/cdist/conf/type/__apt_ppa/explorer/state @@ -26,7 +26,7 @@ name="$__object_id" . /etc/lsb-release repo_name="${name#ppa:}" -repo_file_name="$(echo "$repo_name" | sed "s:\/:\-:")-${DISTRIB_CODENAME}.list" +repo_file_name="$(echo "$repo_name" | sed -e "s|[/:]|-|" -e "s|\.|_|")-${DISTRIB_CODENAME}.list" [ -s "/etc/apt/sources.list.d/${repo_file_name}" ] \ && echo present || echo absent From a8d4544c46bd54f920bff016ae372ccf56aa913f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Nov 2012 13:28:56 +0100 Subject: [PATCH 410/412] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog b/docs/changelog index 68b35eac..d2c5f5fe 100644 --- a/docs/changelog +++ b/docs/changelog @@ -9,6 +9,7 @@ next: * Type __rvm_gemset: Change parameter "default" to be boolean * New Type: __user_groups (Steven Armstrong) * Type __user: Remove --groups support (now provided by __user_groups) + * Core: Support for --after and --before parameters 2.1.0pre8: 2012-11-15 * Type cleanup: __apt_ppa, __apt_ppa_update_index, __file, From 52368b0116106dd959bb5d90f88a6bb328ccf32b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Nov 2012 13:35:40 +0100 Subject: [PATCH 411/412] ++changes, ++update notes Signed-off-by: Nico Schottelius --- docs/changelog | 1 + docs/web/cdist/update.mdwn | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/changelog b/docs/changelog index d2c5f5fe..943d83e4 100644 --- a/docs/changelog +++ b/docs/changelog @@ -9,6 +9,7 @@ next: * Type __rvm_gemset: Change parameter "default" to be boolean * New Type: __user_groups (Steven Armstrong) * Type __user: Remove --groups support (now provided by __user_groups) + * Type __apt_ppa: Bugfix: Installeded ppa detection (Steven Armstrong) * Core: Support for --after and --before parameters 2.1.0pre8: 2012-11-15 diff --git a/docs/web/cdist/update.mdwn b/docs/web/cdist/update.mdwn index 22b92769..3331ec85 100644 --- a/docs/web/cdist/update.mdwn +++ b/docs/web/cdist/update.mdwn @@ -42,6 +42,7 @@ To upgrade to the lastet version do * The types **\_\_autofs**, **\_\_autofs_map** and **\_\_autofs_reload** have been removed (no maintainer, no users) * Type **\_\_user**: Parameter --groups removed (use the new \_\_user_groups type) + * require="" is deprecated: Use --after and --before as parameters instead ### Updating from 1.7 to 2.0 From 4718b81a08c4b95ad76a654723d655a7ee62a324 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Nov 2012 13:40:35 +0100 Subject: [PATCH 412/412] Documentation cleanup (old pre-boolean variant) Signed-off-by: Nico Schottelius --- cdist/conf/type/__rvm_gem/man.text | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__rvm_gem/man.text b/cdist/conf/type/__rvm_gem/man.text index fbf9a622..2b72e7ae 100644 --- a/cdist/conf/type/__rvm_gem/man.text +++ b/cdist/conf/type/__rvm_gem/man.text @@ -36,7 +36,7 @@ __rvm_gemset rails --gemset ruby-1.9.3-p0@myset --user bill --state present # Do the same and also make ruby-1.9.3-p0@myset the default gemset __rvm_gemset rails --gemset ruby-1.9.3-p0@myset --user bill \ - --state present --default yes + --state present --default # Remove it __rvm_ruby rails --gemset ruby-1.9.3-p0@myset --user bill --state absent