merge from changerunningorder

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-03-28 13:03:17 +02:00
commit cd1a1347c9
14 changed files with 314 additions and 122 deletions

58
bin/cdist-object-run Executable file
View File

@ -0,0 +1,58 @@
#!/bin/sh
#
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# For the given object:
# - run type explorers
# - generate code
# - copy object to target
# - execute code on target
#
. cdist-config
[ $# -eq 2 ] || __cdist_usage "<target host> <object>"
set -eu
__cdist_target_host="$1"; shift
__cdist_object="$1"; shift
__cdist_type="$(__cdist_type_from_object "$__cdist_object")"
# Check if type of object has >= 1 explorer
__cdist_has_explorer="$(__cdist_type_has_explorer "$__cdist_type")"
# Run the type explorers for the current object if any
if [ "$__cdist_has_explorer" ]; then
cdist-object-explorer-run "$__cdist_target_host" "$__cdist_object"
fi
# Run the manifest for the current object
cdist-object-manifest-run "$__cdist_target_host" "$__cdist_object"
# Run the gencode scripts for the current object
cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object"
# Transfer the current object to the target
cdist-object-push "$__cdist_target_host" "$__cdist_object"
# Run the code for the current object
cdist-object-code-run "$__cdist_target_host" "$__cdist_object"

View File

@ -19,11 +19,7 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# For each created object:
# - run type explorers
# - generate code
# - copy object to target
# - execute code on target
# Run cdist-object-run for each created object.
#
. cdist-config
@ -56,30 +52,16 @@ while [ $# -gt 0 ]; do
# Check if type of object has >= 1 explorer
__cdist_has_explorer="$(__cdist_type_has_explorer "$__cdist_type")"
# If so, run explorers on remote side
# Transfer the type explorers if any
if [ "$__cdist_has_explorer" ]; then
# Transfer the type explorers
if ! grep -q "$__cdist_type" "$__cdist_types_pushed"; then
cdist-type-explorer-push "$__cdist_target_host" "$__cdist_type"
echo "$__cdist_type" >> "$__cdist_types_pushed"
fi
# Run the type explorers for the current object
cdist-object-explorer-run "$__cdist_target_host" "$__cdist_object"
echo "$__cdist_type" >> "$__cdist_types_pushed"
fi
fi
# Run the manifest for the current object
cdist-object-manifest-run "$__cdist_target_host" "$__cdist_object"
# Run the gencode scripts for the current object
cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object"
# Transfer the current object to the target
cdist-object-push "$__cdist_target_host" "$__cdist_object"
# Run the code for the current object
cdist-object-code-run "$__cdist_target_host" "$__cdist_object"
# Process the given object
cdist-object-run "$__cdist_target_host" "$__cdist_object"
done

16
doc/dev/todo/steven Normal file
View File

@ -0,0 +1,16 @@
- document object_id=$1 for manifest + gencode :-)
- update docs regarding flow in cdist-stages.text
- create man pages for new executables
- nuke legacy manpages
- prettify output of cdist-deploy-to, e.g.
Processing object __file/etc/cdist-configured
transfering type explorers ...
running type explorers ...
running manifest ...
running gencode ...
transfering object to target ...
running code ...

View File

@ -1,32 +0,0 @@
cdist-code-run-all(1)
=====================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-code-run-all - Execute all generated code on the target
SYNOPSIS
--------
cdist-code-run-all HOSTNAME
DESCRIPTION
-----------
cdist-code-run-all is just a wrapper for cdist-remote-code-run-all.
SEE ALSO
--------
- cdist(7)
- cdist-deploy-to(1)
- cdist-remote-code-run-all(1)
- cdist-run-remote(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).

View File

@ -0,0 +1,33 @@
cdist-object-code-run(1)
========================
Nico Schottelius <nico-cdist--@--schottelius.org>
Steven Armstrong <steven-dist--@--armstrong.cc>
NAME
----
cdist-object-code-run - Execute the generated code for a object
SYNOPSIS
--------
cdist-object-code-run HOSTNAME OBJECT
DESCRIPTION
-----------
Execute the local and remote code for the given object.
SEE ALSO
--------
- cdist(7)
- cdist-object-run-all(1)
- cdist-code-run(1)
- cdist-run-remote(1)
COPYING
-------
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View File

@ -1,33 +0,0 @@
cdist-object-explorer-all(1)
============================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-object-explorer-all - Run type explorer for every object
SYNOPSIS
--------
cdist-object-explorer-all HOSTNAME
DESCRIPTION
-----------
For every object, it checks whether the type has one or more explorers.
If so, the explorers of the type are copied to the target and executed
once per object.
SEE ALSO
--------
- cdist(7)
- cdist-deploy-to(1)
- cdist-remote-explorer-run(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).

View File

@ -0,0 +1,32 @@
cdist-object-explorer-run(1)
============================
Nico Schottelius <nico-cdist--@--schottelius.org>
Steven Armstrong <steven-dist--@--armstrong.cc>
NAME
----
cdist-object-explorer-run - Run type explorers for a object
SYNOPSIS
--------
cdist-object-explorer-run HOSTNAME OBJECT
DESCRIPTION
-----------
Runs the explorers for the given object on the target host.
SEE ALSO
--------
- cdist(7)
- cdist-deploy-to(1)
- cdist-remote-explorer-run(1)
COPYING
-------
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View File

@ -1,32 +0,0 @@
cdist-object-gencode-all(1)
===========================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-object-gencode-all - Generate code for every existing object
SYNOPSIS
--------
cdist-object-gencode-all HOSTNAME
DESCRIPTION
-----------
For every object that exists, the cdist-object-gencode is executed.
SEE ALSO
--------
- cdist(7)
- cdist-code-run(1)
- cdist-deploy-to(1)
- cdist-object-gencode(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).

View File

@ -0,0 +1,33 @@
cdist-object-gencode-run(1)
===========================
Nico Schottelius <nico-cdist--@--schottelius.org>
Steven Armstrong <steven-dist--@--armstrong.cc>
NAME
----
cdist-object-gencode-run - Generate code for a object
SYNOPSIS
--------
cdist-object-gencode-run HOSTNAME OBJECT
DESCRIPTION
-----------
For the given object, generate the code for local and remote execution.
SEE ALSO
--------
- cdist(7)
- cdist-code-run(1)
- cdist-object-run-all(1)
- cdist-object-gencode(1)
COPYING
-------
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View File

@ -0,0 +1,32 @@
cdist-object-push(1)
====================
Nico Schottelius <nico-cdist--@--schottelius.org>
Steven Armstrong <steven-dist--@--armstrong.cc>
NAME
----
cdist-object-push - Transfer a object to the target host
SYNOPSIS
--------
cdist-object-push HOSTNAME OBJECT
DESCRIPTION
-----------
Transfers the given object to the target host.
SEE ALSO
--------
- cdist(7)
- cdist-object-run-all(1)
- cdist-type(1)
COPYING
-------
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View File

@ -0,0 +1,34 @@
cdist-object-run-all(1)
=======================
Nico Schottelius <nico-cdist--@--schottelius.org>
Steven Armstrong <steven-dist--@--armstrong.cc>
NAME
----
cdist-object-run-all - Run all created objects on the target host
SYNOPSIS
--------
cdist-object-run-all HOSTNAME
DESCRIPTION
-----------
Transfers type explorers to the target then runs cdist-object-run(1)
for each created object.
SEE ALSO
--------
- cdist(7)
- cdist-type-explorer-push(1)
- cdist-object-run(1)
- cdist-type(1)
COPYING
-------
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View File

@ -0,0 +1,37 @@
cdist-object-run(1)
===================
Nico Schottelius <nico-cdist--@--schottelius.org>
Steven Armstrong <steven-dist--@--armstrong.cc>
NAME
----
cdist-object-run - Run an object
SYNOPSIS
--------
cdist-object-run HOSTNAME OBJECT
DESCRIPTION
-----------
Runs the given object on the given target host.
The different subtasks are dispatched to specialized exectuables.
See related man pages for details.
SEE ALSO
--------
- cdist(7)
- cdist-object-explorer-run(1)
- cdist-object-gencode-run(1)
- cdist-object-push(1)
- cdist-object-code-run(1)
- cdist-type(1)
COPYING
-------
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View File

@ -22,7 +22,7 @@ It ensures PATH is setup correctly on the target side.
SEE ALSO
--------
- cdist(7)
- cdist-code-run-all(1)
- cdist-object-code-run(1)
- cdist-deploy-to(1)
- cdist-remote-code-run-all(1)

View File

@ -0,0 +1,32 @@
cdist-type-explorer-push(1)
===========================
Nico Schottelius <nico-cdist--@--schottelius.org>
Steven Armstrong <steven-dist--@--armstrong.cc>
NAME
----
cdist-type-explorer-push - Transfer type explorers to the target host
SYNOPSIS
--------
cdist-type-explorer-push HOSTNAME TYPE
DESCRIPTION
-----------
Transfers the explorers of the given type to the target host.
SEE ALSO
--------
- cdist(7)
- cdist-object-run(1)
- cdist-type(1)
COPYING
-------
Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).