Provided by: cdist_4.0.0~pre3-2_all
cdist-messaging - How the initial manifest and types can communication
cdist has a simple but powerful way of allowing communication between the initial manifest and types as well as types and types. Whenever execution is passed from cdist to one of the scripts described below, cdist generate 2 new temporary files and exports the environment variables messages_in and messages_out to point to them. Before handing over the control, the content of the global message file is copied into the file referenced by $__messages_in. After cdist gained control back, the content of the file referenced by $__messages_out is appended to the global message file. This way overwriting any of the two files by accident does not interfere with other types. The order of execution is not defined unless you create dependencies between the different objects (see cdist-manifest(7)) and thus you can only react reliably on messages by objects that you depend on.
Messaging is possible between all local scripts: · initial manifest · type/manifest · type/gencode-local · type/gencode-remote
When you want to emit a message use: echo "something" >> "$__messages_out" When you want to react on a message use: if grep -q "^__your_type/object/id:something" "$__messages_in"; then echo "I do something else" fi
· cdist(1) · cdist-manifest(7) · cdist-reference(7) · cdist-type(7)
Copyright (C) 2013 Nico Schottelius. Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3).
Nico Schottelius <nico-cdist--@--schottelius.org> Author. 04/07/2016 CDIST-MESSAGING(7)