www.nico.schottelius.org/software/cdist/man/4.0.0pre1/man7/cdist-messaging.html

30 lines
4.4 KiB
HTML
Raw Normal View History

2014-01-20 13:49:06 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>cdist-messaging(7)</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /></head><body><div xml:lang="en" class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="idm139895292516864"></a>cdist-messaging(7)</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Nico</span> <span class="surname">Schottelius</span></h3><code class="email">&lt;<a class="email" href="mailto:nico-cdist--@--schottelius.org">nico-cdist--@--schottelius.org</a>&gt;</code></div></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#_name">1. NAME</a></span></dt><dt><span class="section"><a href="#_description">2. DESCRIPTION</a></span></dt><dt><span class="section"><a href="#_availability">3. AVAILABILITY</a></span></dt><dt><span class="section"><a href="#_examples">4. EXAMPLES</a></span></dt><dt><span class="section"><a href="#_see_also">5. SEE ALSO</a></span></dt><dt><span class="section"><a href="#_copying">6. COPYING</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_name"></a>1. NAME</h2></div></div></div><p>cdist-messaging - How the initial manifest and types can communication</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_description"></a>2. DESCRIPTION</h2></div></div></div><p>cdist has a simple but powerful way of allowing communication between
the initial manifest and types as well as types and types.</p><p>Whenever execution is passed from cdist to one of the
scripts described below, cdist generate 2 new temporary files
and exports the environment variables <span class="emphasis"><em>messages_in and
</em></span>messages_out to point to them.</p><p>Before handing over the control, the content of the global message
file is copied into the file referenced by $__messages_in.</p><p>After cdist gained control back, the content of the file referenced
by $__messages_out is appended to the global message file.</p><p>This way overwriting any of the two files by accident does not
interfere with other types.</p><p>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.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_availability"></a>3. AVAILABILITY</h2></div></div></div><p>Messaging is possible between all <span class="strong"><strong>local</strong></span> scripts:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
initial manifest
</li><li class="listitem">
type/manifest
</li><li class="listitem">
type/gencode-local
</li><li class="listitem">
type/gencode-remote
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_examples"></a>4. EXAMPLES</h2></div></div></div><p>When you want to emit a message use:</p><pre class="screen">echo "something" &gt;&gt; "$__messages_out"</pre><p>When you want to react on a message use:</p><pre class="screen">if grep -q "^__your_type/object/id:something" "$__messages_in"; then
echo "I do something else"
fi</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_see_also"></a>5. SEE ALSO</h2></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
cdist(1)
</li><li class="listitem">
cdist-manifest(7)
</li><li class="listitem">
cdist-reference(7)
</li><li class="listitem">
cdist-type(7)
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_copying"></a>6. COPYING</h2></div></div></div><p>Copyright (C) 2013 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).</p></div></div></body></html>