Conflicts: lib/cdist/config.py lib/cdist/path.py Merged changes from config.py to config_install.py Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>remotes/origin/feature_files_export
commit
54fb9e6c3f
@ -0,0 +1,40 @@ |
||||
#!/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 <http://www.gnu.org/licenses/>. |
||||
# |
||||
# |
||||
|
||||
if [ -f "$__object/parameter/script" ]; then |
||||
script=$(cat "$__object/parameter/script") |
||||
else |
||||
script="/$__object_id" |
||||
fi |
||||
|
||||
if [ -f "$__object/parameter/base_dir" ]; then |
||||
base_dir=$(cat "$__object/parameter/base_dir") |
||||
else |
||||
os="$(cat "$__global/explorer/os")" |
||||
case "$os" in |
||||
archlinux|netbsd|macosx|freebsd|openbsd) base_dir="/etc/rc.d" ;; |
||||
*) base_dir="/etc/init.d" |
||||
esac |
||||
fi |
||||
|
||||
mode=$(cat "$__object/parameter/mode") |
||||
|
||||
echo "${base_dir}/${script} ${mode}" |
@ -0,0 +1,51 @@ |
||||
cdist-type__init_script(7) |
||||
========================== |
||||
Daniel Roth <dani-cdist--@--d-roth.li> |
||||
|
||||
|
||||
NAME |
||||
---- |
||||
cdist-type__init_script - Use the init scripts |
||||
|
||||
|
||||
DESCRIPTION |
||||
----------- |
||||
This type can be used to control your init scripts. |
||||
|
||||
|
||||
REQUIRED PARAMETERS |
||||
------------------- |
||||
mode:: |
||||
Specifies what shall be done with the init script (usually one of 'start'|'stop'|'restart'|'reload' or 'force-reload') |
||||
|
||||
|
||||
OPTIONAL PARAMETERS |
||||
------------------- |
||||
script:: |
||||
If supplied, use this as the init-script. |
||||
Otherwise the object_id is used. |
||||
|
||||
base_dir:: |
||||
If supplied, this type uses this directory instead of '/etc/init.d'. The parameter will not need an ending slash. |
||||
|
||||
EXAMPLES |
||||
-------- |
||||
|
||||
-------------------------------------------------------------------------------- |
||||
# Reloads the configuration for lighttpd |
||||
__init_script lighttpd --mode force-reload |
||||
|
||||
# Reloads the configuration for lighttpd |
||||
__init_script lighty --script lighttpd --mode force-reload |
||||
-------------------------------------------------------------------------------- |
||||
|
||||
|
||||
SEE ALSO |
||||
-------- |
||||
- cdist-type(7) |
||||
|
||||
|
||||
COPYING |
||||
------- |
||||
Copyright \(C) 2011 Daniel Roth. Free use of this software is |
||||
granted under the terms of the GNU General Public License version 3 (GPLv3). |
@ -0,0 +1,2 @@ |
||||
script |
||||
base_dir |
@ -0,0 +1 @@ |
||||
mode |
@ -0,0 +1,87 @@ |
||||
Commands needed: |
||||
conf/cmd/remote_exec |
||||
conf/cmd/copy |
||||
|
||||
If ! conf/cmd/remote_exec: |
||||
use builtin |
||||
If ! conf/cmd/copy: |
||||
use builtin |
||||
|
||||
-------------------------------------------------------------------------------- |
||||
|
||||
--cmd-dir? |
||||
$__cdist_cmd_dir |
||||
|
||||
-------------------------------------------------------------------------------- |
||||
-> Depend on session! |
||||
|
||||
Builtin: |
||||
cdist.exec.run_or_fail(["scp", "-qr", source, |
||||
self.remote_user + "@" + |
||||
self.target_host + ":" + |
||||
destination]) |
||||
|
||||
self.remote_prefix = ["ssh", self.remote_user + "@" + self.target_host] |
||||
|
||||
self.remote_user = remote_user |
||||
self.remote_prefix = remote_prefix |
||||
|
||||
-------------------------------------------------------------------------------- |
||||
What is in a session? |
||||
|
||||
base_dir |
||||
target_host |
||||
|
||||
-------------------------------------------------------------------------------- |
||||
remote_user |
||||
pseudo-static, can be hardcoded again |
||||
-------------------------------------------------------------------------------- |
||||
|
||||
Result: |
||||
|
||||
os.environ['__remote_exec'] = ["ssh", "-l", "root" ] |
||||
|
||||
os.environ['__remote_exec'] = ["ssh", "-o", "User=root" ] |
||||
os.environ['__remote_copy'] = ["scp", "-o", "User=root" ] |
||||
|
||||
|
||||
__remote_exec=~/sudossh __remote_copy=... cdist config localhost |
||||
|
||||
~/sudossh hostname $@... |
||||
~/sudocopy a hostname:b |
||||
|
||||
~/chrootssh |
||||
~/chrootcopy |
||||
|
||||
|
||||
|
||||
a) |
||||
3 cmd verzeichnnise: cdist, sudo, chroot |
||||
pro aufruf variable ändern |
||||
|
||||
b) |
||||
1 dir, mit zeug |
||||
pro aufruf variablen ändern |
||||
|
||||
|
||||
conf/cmd/remote_exec |
||||
|
||||
args for __remote_exec |
||||
$1 = hostname |
||||
$2 - ... = stuff to be executed in /bin/sh on remote side |
||||
$2 - $7 = env |
||||
$7 - 12 = cmd |
||||
|
||||
|
||||
args for __remote_copy |
||||
$1 = file here |
||||
$2 = hostname:destination |
||||
|
||||
-------------------------------------------------------------------------------- |
||||
There needs to be an easy way to change those cmds! |
||||
-------------------------------------------------------------------------------- |
||||
Env-Passing: |
||||
_a=b test -> test can access $_a |
||||
_a=b test $_a -> $1 = "", because _a is *not* set within the shell |
||||
_a=b; test -> can access $_a |
||||
_a=b; test $_a -> $1 == "b" |
@ -1,48 +0,0 @@ |
||||
cdist-config(1) |
||||
=============== |
||||
Nico Schottelius <nico-cdist--@--schottelius.org> |
||||
|
||||
|
||||
NAME |
||||
---- |
||||
cdist-config - Read basic cdist configuration |
||||
|
||||
|
||||
DESCRIPTION |
||||
----------- |
||||
Cdist-config is sourced by cdist programs and provides hints on where to find |
||||
types, manifests, etc. Generally speaking, it's just usable from within the |
||||
core and is only of interest for cdist-developers. |
||||
|
||||
|
||||
ENVIRONMENT VARIABLES |
||||
--------------------- |
||||
The following list contains environment variables that are known |
||||
to be changed by users in various situations. To change the variable, |
||||
use your current shell and export it, so all cdist-binaries know about it. |
||||
|
||||
__cdist_tmp_base_dir:: |
||||
Normally this points to /tmp. In case /tmp is not suitable for |
||||
cdist (i.e. has noexec flag setup) you can change this variable |
||||
to point to a better location. |
||||
|
||||
|
||||
EXAMPLES |
||||
-------- |
||||
|
||||
If /tmp has the noexec flag, you can use $HOME/.tmp for instance: |
||||
|
||||
-------------------------------------------------------------------------------- |
||||
export __cdist_tmp_base_dir=$HOME/.tmp |
||||
-------------------------------------------------------------------------------- |
||||
|
||||
|
||||
SEE ALSO |
||||
-------- |
||||
cdist(7) |
||||
|
||||
|
||||
COPYING |
||||
------- |
||||
Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is |
||||
granted under the terms of the GNU General Public License version 3 (GPLv3). |
@ -1,49 +0,0 @@ |
||||
cdist-env(1) |
||||
============ |
||||
Nico Schottelius <nico-cdist--@--schottelius.org> |
||||
|
||||
|
||||
NAME |
||||
---- |
||||
cdist-env - Setup environment for using cdist |
||||
|
||||
|
||||
SYNOPSIS |
||||
-------- |
||||
cdist-env |
||||
|
||||
|
||||
DESCRIPTION |
||||
----------- |
||||
cdist-env outputs two strings suitable for usage in your current shell, |
||||
so you can use cdist from the checkout. cdist-env essentially helps you |
||||
to easily setup PATH and MANPATH. |
||||
|
||||
If you've multiple checkouts of cdist and run cdist-env from the various |
||||
checkouts, a new run will prepend the last directory, thus ensures you |
||||
can run it multiple times and does what one expects. |
||||
|
||||
EXAMPLES |
||||
-------- |
||||
For use in bourne shell variants (like dash, bash, ksh) as well as |
||||
in csh variants (csh, tcsh): |
||||
|
||||
-------------------------------------------------------------------------------- |
||||
eval `./bin/cdist-env` |
||||
-------------------------------------------------------------------------------- |
||||
|
||||
For bourne shell, there is also a shorter version: |
||||
-------------------------------------------------------------------------------- |
||||
. ./bin/cdist-env |
||||
-------------------------------------------------------------------------------- |
||||
|
||||
|
||||
SEE ALSO |
||||
-------- |
||||
cdist(7) |
||||
|
||||
|
||||
COPYING |
||||
------- |
||||
Copyright \(C) 2011 Nico Schottelius. Free use of this software is |
||||
granted under the terms of the GNU General Public License version 3 (GPLv3). |
@ -1,47 +0,0 @@ |
||||
cdist-quickstart(1) |
||||
=================== |
||||
Nico Schottelius <nico-cdist--@--schottelius.org> |
||||
|
||||
NAME |
||||
---- |
||||
cdist-quickstart - Make use of cinit in 5 minutes |
||||
|
||||
|
||||
SYNOPSIS |
||||
-------- |
||||
cdist-quickstart |
||||
|
||||
|
||||
DESCRIPTION |
||||
----------- |
||||
cdist-quickstart is an interactive guide to cdist. It should be one |
||||
of the first tools you use when you begin with cdist. |
||||
|
||||
|
||||
EXAMPLES |
||||
-------- |
||||
To use cdist-quickstart, add the bin directory to your PATH, execute |
||||
cdist-quickstart and enjoy cdist: |
||||
|
||||
-------------------------------------------------------------------------------- |
||||
# Bourne shell example |
||||
export PATH=$(pwd -P)/bin:$PATH |
||||
|
||||
# Alternatively, usable for csh and bsh, set's up PATH and MANPATH |
||||
eval `./bin/cdist-env` |
||||
|
||||
# Let's go! |
||||
cdist-quickstart |
||||
-------------------------------------------------------------------------------- |
||||
|
||||
|
||||
SEE ALSO |
||||
-------- |
||||
- cdist(7) |
||||
- cdist-env(1) |
||||
|
||||
|
||||
COPYING |
||||
------- |
||||
Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is |
||||
granted under the terms of the GNU General Public License version 3 (GPLv3). |
@ -1,56 +0,0 @@ |
||||
cdist-type-emulator(1) |
||||
====================== |
||||
Nico Schottelius <nico-cdist--@--schottelius.org> |
||||
|
||||
|
||||
NAME |
||||
---- |
||||
cdist-type-emulator - Emulate type and record parameters and dependencies |
||||
|
||||
|
||||
SYNOPSIS |
||||
-------- |
||||
cdist-type-emulator [TYPE ARGS] |
||||
|
||||
|
||||
DESCRIPTION |
||||
----------- |
||||
cdist-type-emulator is normally called through a link to it of the |
||||
name of a specifc type. It saves the given parameters into |
||||
a parameters directory and the requirements into a require file. |
||||
|
||||
It checks whether the parameters are valid: |
||||
|
||||
- are required parameter given? |
||||
- are all other required parameters specified as optional? |
||||
|
||||
|
||||
EXAMPLES |
||||
-------- |
||||
Your manifest may contain stuff like this: |
||||
|
||||
|
||||
-------------------------------------------------------------------------------- |
||||
__addifnosuchline /tmp/linetest --line "test" |
||||
|
||||
__motd |
||||
-------------------------------------------------------------------------------- |
||||
|
||||
In both cases, cdist-type-emulator is called instead of a real type. |
||||
In the first case, the object id "/tmp/linetest" is recorded and the |
||||
parameter "line" stored with the content "test". |
||||
|
||||
In the second case, __motd must be decleared as a singleton, as the |
||||
object id is missing. |
||||
|
||||
|
||||
SEE ALSO |
||||
-------- |
||||
- cdist(7) |
||||
- cdist-type-build-emulation(1) |
||||
|
||||
|
||||
COPYING |
||||
------- |
||||
Copyright \(C) 2011 Nico Schottelius. Free use of this software is |
||||
granted under the terms of the GNU General Public License version 3 (GPLv3). |
Loading…
Reference in new issue