cdist-messaging(7)


Table of Contents

1. NAME
2. DESCRIPTION
3. AVAILABILITY
4. EXAMPLES
5. SEE ALSO
6. COPYING

1. NAME

cdist-messaging - How the initial manifest and types can communication

2. DESCRIPTION

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.

3. AVAILABILITY

Messaging is possible between all local scripts:

  • initial manifest
  • type/manifest
  • type/gencode-local
  • type/gencode-remote

4. EXAMPLES

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

5. SEE ALSO

6. COPYING

Copyright (C) 2013 Nico Schottelius. Free use of this software is granted under the terms of the GNU General Public License version 3 (GPLv3).