diff --git a/cdist/__init__.py b/cdist/__init__.py index c142230c..6ea02d41 100644 --- a/cdist/__init__.py +++ b/cdist/__init__.py @@ -67,13 +67,13 @@ class CdistBetaRequired(cdist.Error): if self.arg is None: err_msg = ("\'{}\' command is beta, but beta is " "not enabled. If you want to use it please enable beta " - "functionalities by using the -b/--enable-beta command " + "functionalities by using the -b/--beta command " "line flag or setting CDIST_BETA env var.") fmt_args = [self.command, ] else: err_msg = ("\'{}\' argument of \'{}\' command is beta, but beta " "is not enabled. If you want to use it please enable " - "beta functionalities by using the -b/--enable-beta " + "beta functionalities by using the -b/--beta " "command line flag or setting CDIST_BETA env var.") fmt_args = [self.arg, self.command, ] return err_msg.format(*fmt_args) diff --git a/cdist/conf/type/__docker/man.rst b/cdist/conf/type/__docker/man.rst new file mode 100644 index 00000000..42e71af5 --- /dev/null +++ b/cdist/conf/type/__docker/man.rst @@ -0,0 +1,49 @@ +cdist-type__docker(7) +===================== + +NAME +---- +cdist-type__docker - install docker-engine + + +DESCRIPTION +----------- +Installs latest docker-engine package from dockerproject.org. + + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +None. + + +BOOLEAN PARAMETERS +------------------ +experimental + Install the experimental docker-engine package instead of the latest stable release. + + +EXAMPLES +-------- + +.. code-block:: sh + + __docker + + # experimental + __docker --experimental + + +AUTHORS +------- +Steven Armstrong + + +COPYING +------- +Copyright \(C) 2016 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/__docker/manifest b/cdist/conf/type/__docker/manifest new file mode 100755 index 00000000..ba13b3e4 --- /dev/null +++ b/cdist/conf/type/__docker/manifest @@ -0,0 +1,81 @@ +#!/bin/sh +# +# 2016 Steven Armstrong (steven-cdist at armstrong.cc) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + + +os=$(cat "$__global/explorer/os") + +case "$os" in + centos) + component="main" + if [ -f "$__object/parameter/experimental" ]; then + component="experimental" + fi + export CDIST_ORDER_DEPENDENCY=on + __yum_repo docker \ + --name 'Docker Repository' \ + --baseurl "https://yum.dockerproject.org/repo/$component/centos/\$releasever/" \ + --enabled \ + --gpgcheck \ + --gpgkey 'https://yum.dockerproject.org/gpg' + __package docker-engine + unset CDIST_ORDER_DEPENDENCY + ;; + ubuntu) + component="main" + if [ -f "$__object/parameter/experimental" ]; then + component="experimental" + fi + __package apparmor + __package ca-certificates + __package apt-transport-https + __apt_key docker --keyid 58118E89F3A912897C070ADBF76221572C52609D + export CDIST_ORDER_DEPENDENCY=on + __apt_source docker \ + --uri https://apt.dockerproject.org/repo \ + --distribution "ubuntu-$(cat "$__global/explorer/lsb_codename")" \ + --component "$component" + __package docker-engine + unset CDIST_ORDER_DEPENDENCY + ;; + debian) + component="main" + if [ -f "$__object/parameter/experimental" ]; then + component="experimental" + fi + + __package apt-transport-https + __package ca-certificates + __package gnupg2 + __apt_key docker --keyid 58118E89F3A912897C070ADBF76221572C52609D + export CDIST_ORDER_DEPENDENCY=on + __apt_source docker \ + --uri https://apt.dockerproject.org/repo \ + --distribution "debian-$(cat "$__global/explorer/lsb_codename")" \ + --component "$component" + __package docker-engine + unset CDIST_ORDER_DEPENDENCY + + ;; + *) + echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 + echo "Please contribute an implementation for it if you can." >&2 + exit 1 + ;; +esac diff --git a/cdist/conf/type/__docker/parameter/boolean b/cdist/conf/type/__docker/parameter/boolean new file mode 100644 index 00000000..9839eb20 --- /dev/null +++ b/cdist/conf/type/__docker/parameter/boolean @@ -0,0 +1 @@ +experimental diff --git a/cdist/conf/type/__docker/singleton b/cdist/conf/type/__docker/singleton new file mode 100644 index 00000000..e69de29b diff --git a/cdist/conf/type/__package_dpkg/gencode-remote b/cdist/conf/type/__package_dpkg/gencode-remote new file mode 100755 index 00000000..d4186e66 --- /dev/null +++ b/cdist/conf/type/__package_dpkg/gencode-remote @@ -0,0 +1,30 @@ +#!/bin/sh +# +# 2013 Tomas Pospisek (tpo_deb sourcepole.ch) +# +# This file is based on cdist's __file/gencode-local and part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU 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 __package_dpkg type does not check whether a *.deb package is +# allready installed. It just copies the *.deb package over to the +# destination and installs it. We could use __package_apt to check +# whether a *.deb package is allready installed and only install it +# if we're given a --force argument or similar (would be clever not +# to conflict with dpkg's --force options). But currently we don't +# do any checks or --force'ing. +# + +echo "dpkg -i /var/cache/apt/archives/$__object_id" diff --git a/cdist/conf/type/__package_dpkg/man.rst b/cdist/conf/type/__package_dpkg/man.rst new file mode 100644 index 00000000..65a695b5 --- /dev/null +++ b/cdist/conf/type/__package_dpkg/man.rst @@ -0,0 +1,46 @@ +cdist-type__package_dpkg(7) +=========================== + +NAME +---- +cdist-type__package_dpkg - Manage packages with dpkg + + +DESCRIPTION +----------- +__package_dpkg is used on Debian and variants (like Ubuntu) to +install packages that are provided locally as *.deb files. + +The object given to __package_dpkg must be the name of the deb package. + + +REQUIRED PARAMETERS +------------------- +source + path to the *.deb package + +EXAMPLES +-------- + +.. code-block:: sh + + # Install foo and bar packages + __package_dpkg --source /tmp/foo_0.1_all.deb foo_0.1_all.deb + __package_dpkg --source $__type/files/bar_1.4.deb bar_1.4.deb + + +SEE ALSO +-------- +:strong:`cdist-type__package`\ (7) + +AUTHORS +------- +Tomas Pospisek + +COPYING +------- +Copyright \(C) 2013 Tomas Pospisek. You can redistribute it +and/or modify it under the terms of the GNU General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. +This type is based on __package_apt. diff --git a/cdist/conf/type/__package_dpkg/manifest b/cdist/conf/type/__package_dpkg/manifest new file mode 100644 index 00000000..ff477c2d --- /dev/null +++ b/cdist/conf/type/__package_dpkg/manifest @@ -0,0 +1,34 @@ +#!/bin/sh +# +# 2013 Tomas Pospisek (tpo_deb sourcepole.ch) +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU 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 __package_dpkg type does not check whether a *.deb package is +# allready installed. It just copies the *.deb package over to the +# destination and installs it. We could use __package_apt to check +# whether a *.deb package is allready installed and only install it +# if we're given a --force argument or similar (would be clever not +# to conflict with dpkg's --force options). But currently we don't +# do any checks or --force'ing. + + +package_path=$( cat "$__object/parameter/source" ) +package=$( basename "$__object_id" ) + +__file "/var/cache/apt/archives/$package" \ + --source "$package_path" \ + --state present + diff --git a/cdist/conf/type/__package_dpkg/parameter/required b/cdist/conf/type/__package_dpkg/parameter/required new file mode 100644 index 00000000..5a18cd2f --- /dev/null +++ b/cdist/conf/type/__package_dpkg/parameter/required @@ -0,0 +1 @@ +source diff --git a/completions/bash/cdist-completion.bash b/completions/bash/cdist-completion.bash index 68f45327..1c4226c2 100644 --- a/completions/bash/cdist-completion.bash +++ b/completions/bash/cdist-completion.bash @@ -36,7 +36,7 @@ _cdist() return 0 ;; config|install) - opts="-h --help -d --debug -v --verbose -b --enable-beta \ + opts="-h --help -d --debug -v --verbose -b --beta \ -c --conf-dir -f --file -i --initial-manifest -j --jobs \ -n --dry-run -o --out-dir -p --parallel -s --sequential \ --remote-copy --remote-exec" diff --git a/completions/zsh/_cdist b/completions/zsh/_cdist index dc320224..001356d4 100644 --- a/completions/zsh/_cdist +++ b/completions/zsh/_cdist @@ -36,7 +36,7 @@ _cdist() esac ;; config|install) - opts=(-h --help -d --debug -v --verbose -b --enable-beta -c --conf-dir -f --file -i --initial-manifest -j --jobs -n --dry-run -o --out-dir -p --parallel -s --sequential --remote-copy --remote-exec) + opts=(-h --help -d --debug -v --verbose -b --beta -c --conf-dir -f --file -i --initial-manifest -j --jobs -n --dry-run -o --out-dir -p --parallel -s --sequential --remote-copy --remote-exec) compadd "$@" -- $opts ;; *) diff --git a/docs/changelog b/docs/changelog index d9939bf1..ea3c74c2 100644 --- a/docs/changelog +++ b/docs/changelog @@ -1,15 +1,19 @@ Changelog --------- +next: + * New type: __docker (Steven Armstrong) + * New type: __package_dpkg (Tomas Pospisek) + 4.4.0: 2016-12-03 - * Core: deprecate -d option and make -v option log level counter (Darko Poljak) + * Core: Deprecate -d option and make -v option log level counter (Darko Poljak) * New type: __postgres_extension (Tomas Pospisek) - * Core, types: support IPv6 (Darko Poljak) - * Type __consul: add source and cksum files for Consul 0.7.0 and 0.7.1 (Carlos Ortigoza) + * Core, types: Support IPv6 (Darko Poljak) + * Type __consul: Add source and cksum files for Consul 0.7.0 and 0.7.1 (Carlos Ortigoza) * Type __user: FreeBSD fix (Kamila Souckova) * New type: __apt_mark (Ander Punnar) - * Type __package_upgrade_all: do not dist-upgrade by default, add apt-clean and apt-dist-upgrade options (Ander Punnar) - * Core: fix target_host vars (Darko Poljak) + * Type __package_upgrade_all: Do not dist-upgrade by default, add apt-clean and apt-dist-upgrade options (Ander Punnar) + * Core: Correct target_host var in code.py (Darko Poljak) * All: Merge install feature from 4.0-pre-not-stable (Darko Poljak) 4.3.2: 2016-10-13 @@ -20,7 +24,7 @@ Changelog * Type __package_pkg_openbsd: Support --version (Andres Erbsen) * Type __hostname: Support openbsd (Andres Erbsen) * New type: __firewalld_start: start/stop firewalld and/or enable/disable start on boot (Darko Poljak) - * Bugfix __consul_agent: config option was misnamed 'syslog' instead of 'enable_syslog' (Steven Armstrong) + * Bugfix __consul_agent: Config option was misnamed 'syslog' instead of 'enable_syslog' (Steven Armstrong) 4.3.1: 2016-08-22 * Documentation: Spelling fixes (Darko Poljak) diff --git a/docs/src/man1/cdist.rst b/docs/src/man1/cdist.rst index 08c856b1..55901300 100644 --- a/docs/src/man1/cdist.rst +++ b/docs/src/man1/cdist.rst @@ -69,10 +69,11 @@ CONFIG/INSTALL -------------- Configure/install one or more hosts. -.. option:: -b, --enable-beta +.. option:: -b, --beta - Enable beta functionalities. Beta functionalities include the - following options: -j/--jobs. + Enable beta functionalities. + + Can also be enabled using CDIST_BETA env var. .. option:: -c CONF_DIR, --conf-dir CONF_DIR