forked from ungleich-public/cdist
allow __file to read source file from stdin
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
06649d3478
commit
7ae1a2bc52
2 changed files with 10 additions and 0 deletions
|
@ -30,6 +30,9 @@ exists="$(cat "$__object/explorer/exists")"
|
||||||
if [ "$state_should" = "present" ]; then
|
if [ "$state_should" = "present" ]; then
|
||||||
if [ -f "$__object/parameter/source" ]; then
|
if [ -f "$__object/parameter/source" ]; then
|
||||||
source="$(cat "$__object/parameter/source")"
|
source="$(cat "$__object/parameter/source")"
|
||||||
|
if [ "$source" = "-" ]; then
|
||||||
|
source="$__object/stdin"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f "$source" ]; then
|
if [ -f "$source" ]; then
|
||||||
local_cksum="$(cksum < "$source")"
|
local_cksum="$(cksum < "$source")"
|
||||||
|
|
|
@ -39,6 +39,7 @@ owner::
|
||||||
source::
|
source::
|
||||||
If supplied, copy this file from the host running cdist to the target.
|
If supplied, copy this file from the host running cdist to the target.
|
||||||
If not supplied, an empty file or directory will be created.
|
If not supplied, an empty file or directory will be created.
|
||||||
|
If source is '-' (dash), take what was written to stdin as the file content.
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
|
@ -64,6 +65,12 @@ __file /etc/shadow --source "$__type/files/shadow" \
|
||||||
__file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \
|
__file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \
|
||||||
--state exists \
|
--state exists \
|
||||||
--owner frodo --mode 0600
|
--owner frodo --mode 0600
|
||||||
|
|
||||||
|
# Take file content from stdin
|
||||||
|
__file /tmp/whatever --owner root --group root --mode 644 --source - << DONE
|
||||||
|
Here goes the content for /tmp/whatever
|
||||||
|
DONE
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue