diff --git a/bin/cdist-object-run b/bin/cdist-object-run new file mode 100755 index 00000000..e123c7a4 --- /dev/null +++ b/bin/cdist-object-run @@ -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 . +# +# +# For the given object: +# - run type explorers +# - generate code +# - copy object to target +# - execute code on target +# + +. cdist-config +[ $# -eq 2 ] || __cdist_usage " " +set -eu + +__cdist_target_host="$1"; shift +__cdist_object="$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" + diff --git a/bin/cdist-object-run-all b/bin/cdist-object-run-all index abf01b23..45a1ae2a 100755 --- a/bin/cdist-object-run-all +++ b/bin/cdist-object-run-all @@ -19,11 +19,7 @@ # along with cdist. If not, see . # # -# 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 diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven new file mode 100644 index 00000000..5f91a198 --- /dev/null +++ b/doc/dev/todo/steven @@ -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 ... + diff --git a/doc/man/cdist-code-run-all.text b/doc/man/cdist-code-run-all.text deleted file mode 100644 index fba2e7e3..00000000 --- a/doc/man/cdist-code-run-all.text +++ /dev/null @@ -1,32 +0,0 @@ -cdist-code-run-all(1) -===================== -Nico Schottelius - - -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). diff --git a/doc/man/cdist-object-code-run.text b/doc/man/cdist-object-code-run.text new file mode 100644 index 00000000..4d19b5eb --- /dev/null +++ b/doc/man/cdist-object-code-run.text @@ -0,0 +1,33 @@ +cdist-object-code-run(1) +======================== +Nico Schottelius +Steven Armstrong + + +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). diff --git a/doc/man/cdist-object-explorer-all.text b/doc/man/cdist-object-explorer-all.text deleted file mode 100644 index dda3d30d..00000000 --- a/doc/man/cdist-object-explorer-all.text +++ /dev/null @@ -1,33 +0,0 @@ -cdist-object-explorer-all(1) -============================ -Nico Schottelius - - -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). diff --git a/doc/man/cdist-object-explorer-run.text b/doc/man/cdist-object-explorer-run.text new file mode 100644 index 00000000..a94047c3 --- /dev/null +++ b/doc/man/cdist-object-explorer-run.text @@ -0,0 +1,32 @@ +cdist-object-explorer-run(1) +============================ +Nico Schottelius +Steven Armstrong + + +NAME +---- +cdist-object-explorer-run - Run type explorers for a object + + +SYNOPSIS +-------- +cdist-object-explorer-run HOSTNAME OBJECT + + +DESCRIPTION +----------- +Runs the explorers for the given object on the target host. + + +SEE ALSO +-------- +- cdist(7) +- cdist-deploy-to(1) +- cdist-remote-explorer-run(1) + + +COPYING +------- +Copyright \(C) 2011 Nico Schottelius, Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/doc/man/cdist-object-gencode-all.text b/doc/man/cdist-object-gencode-all.text deleted file mode 100644 index b1c96748..00000000 --- a/doc/man/cdist-object-gencode-all.text +++ /dev/null @@ -1,32 +0,0 @@ -cdist-object-gencode-all(1) -=========================== -Nico Schottelius - - -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). diff --git a/doc/man/cdist-object-gencode-run.text b/doc/man/cdist-object-gencode-run.text new file mode 100644 index 00000000..d69d1787 --- /dev/null +++ b/doc/man/cdist-object-gencode-run.text @@ -0,0 +1,33 @@ +cdist-object-gencode-run(1) +=========================== +Nico Schottelius +Steven Armstrong + + +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). diff --git a/doc/man/cdist-object-push.text b/doc/man/cdist-object-push.text new file mode 100644 index 00000000..69648a4d --- /dev/null +++ b/doc/man/cdist-object-push.text @@ -0,0 +1,32 @@ +cdist-object-push(1) +==================== +Nico Schottelius +Steven Armstrong + + +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). diff --git a/doc/man/cdist-object-run-all.text b/doc/man/cdist-object-run-all.text new file mode 100644 index 00000000..a3a8d56b --- /dev/null +++ b/doc/man/cdist-object-run-all.text @@ -0,0 +1,34 @@ +cdist-object-run-all(1) +======================= +Nico Schottelius +Steven Armstrong + + +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). diff --git a/doc/man/cdist-object-run.text b/doc/man/cdist-object-run.text new file mode 100644 index 00000000..b527c0e6 --- /dev/null +++ b/doc/man/cdist-object-run.text @@ -0,0 +1,37 @@ +cdist-object-run(1) +=================== +Nico Schottelius +Steven Armstrong + + +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). diff --git a/doc/man/cdist-run-remote.text b/doc/man/cdist-run-remote.text index 6f06360f..ee7a6337 100644 --- a/doc/man/cdist-run-remote.text +++ b/doc/man/cdist-run-remote.text @@ -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) diff --git a/doc/man/cdist-type-explorer-push.text b/doc/man/cdist-type-explorer-push.text new file mode 100644 index 00000000..e32f10a4 --- /dev/null +++ b/doc/man/cdist-type-explorer-push.text @@ -0,0 +1,32 @@ +cdist-type-explorer-push(1) +=========================== +Nico Schottelius +Steven Armstrong + + +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).