| 1 |
Saving output streams |
| 2 |
===================== |
| 3 |
|
| 4 |
Description |
| 5 |
----------- |
| 6 |
Since version 4.8.0 cdist, by default, saves output streams to local cache. |
| 7 |
Saving output streams is implemented because important information was lost |
| 8 |
during a config run, hidden in all other output. |
| 9 |
Now all created output is bound to the context where it was produced. |
| 10 |
|
| 11 |
Saving output streams include stdout and stderr of init manifest, remote |
| 12 |
commands and for each object stdout and stderr of manifest, gencode-\* and code-\*. |
| 13 |
Output stream files are created only if some output is produced. For more info |
| 14 |
on these cache files see `Local cache overview <cdist-cache.html>`_. |
| 15 |
|
| 16 |
Also, in case of an error, cdist can now exit and show all information it has |
| 17 |
about the error. |
| 18 |
|
| 19 |
For example: |
| 20 |
|
| 21 |
.. code-block:: sh |
| 22 |
|
| 23 |
$ ./bin/cdist config -v -i ~/.cdist/manifest/init-output-streams $(cat ~/ungleich/data/opennebula-debian9-test ) |
| 24 |
INFO: 185.203.112.42: Starting configuration run |
| 25 |
INFO: 185.203.112.42: Processing __myline/test |
| 26 |
ERROR: 185.203.112.42: Command failed: '/bin/sh -e /tmp/tmpow6cwemh/75ee6a79e32da093da23fe4a13dd104b/data/object/__myline/test/.cdist-kisrqlpw/code-local' |
| 27 |
return code: 1 |
| 28 |
---- BEGIN stdout ---- |
| 29 |
---- END stdout ---- |
| 30 |
|
| 31 |
Error processing object '__myline/test' |
| 32 |
======================================== |
| 33 |
name: __myline/test |
| 34 |
path: /tmp/tmpow6cwemh/75ee6a79e32da093da23fe4a13dd104b/data/object/__myline/test/.cdist-kisrqlpw |
| 35 |
source: /home/darko/.cdist/manifest/init-output-streams |
| 36 |
type: /tmp/tmpow6cwemh/75ee6a79e32da093da23fe4a13dd104b/data/conf/type/__myline |
| 37 |
|
| 38 |
---- BEGIN manifest:stderr ---- |
| 39 |
myline manifest stderr |
| 40 |
|
| 41 |
---- END manifest:stderr ---- |
| 42 |
|
| 43 |
---- BEGIN gencode-remote:stderr ---- |
| 44 |
test gencode-remote error |
| 45 |
|
| 46 |
---- END gencode-remote:stderr ---- |
| 47 |
|
| 48 |
---- BEGIN code-local:stderr ---- |
| 49 |
error |
| 50 |
|
| 51 |
---- END code-local:stderr ---- |
| 52 |
|
| 53 |
ERROR: cdist: Failed to configure the following hosts: 185.203.112.42 |
| 54 |
|
| 55 |
Upon successful run execution state is saved to local cache and temporary |
| 56 |
directory is removed. |
| 57 |
In case of an error temporary directory is not removed and can be further |
| 58 |
discovered. |
| 59 |
|
| 60 |
There is also an option :strong:`-S/--disable-saving-output-streams` for |
| 61 |
disabling saving output streams. In this case error reporting can look |
| 62 |
like this: |
| 63 |
|
| 64 |
.. code-block:: sh |
| 65 |
|
| 66 |
$ ./bin/cdist config -v -S -i ~/.cdist/manifest/init-output-streams $(cat ~/ungleich/data/opennebula-debian9-test ) |
| 67 |
INFO: 185.203.112.42: Starting configuration run |
| 68 |
test stdout output streams |
| 69 |
test stderr output streams |
| 70 |
myline manifest stdout |
| 71 |
myline manifest stderr |
| 72 |
test gencode-remote error |
| 73 |
INFO: 185.203.112.42: Processing __myline/test |
| 74 |
error |
| 75 |
ERROR: 185.203.112.42: Command failed: '/bin/sh -e /tmp/tmpzomy0wis/75ee6a79e32da093da23fe4a13dd104b/data/object/__myline/test/.cdist-n566pqut/code-local' |
| 76 |
return code: 1 |
| 77 |
---- BEGIN stdout ---- |
| 78 |
---- END stdout ---- |
| 79 |
|
| 80 |
Error processing object '__myline/test' |
| 81 |
======================================== |
| 82 |
name: __myline/test |
| 83 |
path: /tmp/tmpzomy0wis/75ee6a79e32da093da23fe4a13dd104b/data/object/__myline/test/.cdist-n566pqut |
| 84 |
source: /home/darko/.cdist/manifest/init-output-streams |
| 85 |
type: /tmp/tmpzomy0wis/75ee6a79e32da093da23fe4a13dd104b/data/conf/type/__myline |
| 86 |
|
| 87 |
|
| 88 |
ERROR: cdist: Failed to configure the following hosts: 185.203.112.42 |