1CDIST-TYPE__STAGED_FILE(7) cdist CDIST-TYPE__STAGED_FILE(7)
2
3
4
6 cdist-type__staged_file - Manage staged files
7
9 Manages a staged file that is downloaded on the server (the machine
10 running cdist) and then deployed to the target host using the __file
11 type.
12
14 source the URL from which to retrieve the source file. e.g.
15
16 · https://dl.bintray.com/mitchellh/consul/0.4.1_linux_amd64.zip
17
18 · file:///path/to/local/file
19
20 cksum the output of running the command: cksum $source-file e.g.:
21
22 $ echo foobar > /tmp/foobar
23 $ cksum /tmp/foobar
24 857691210 7 /tmp/foobar
25
26 If either checksum or file size has changed the file will be
27 (re)fetched from the --source. The file name can be omitted and
28 is ignored if given.
29
31 fetch-command
32 the command used to fetch the staged file using printf format‐
33 ting. Where a single %s will be replaced with the value of the
34 given --source parameter. The --fetch-command is expected to
35 output the fetched file to stdout. Defaults to 'curl -s -L
36 "%s"'.
37
38 group see cdist-type__file
39
40 owner see cdist-type__file
41
42 mode see cdist-type__file
43
44 prepare-command
45 the optional command used to prepare or preprocess the staged
46 file for later use by the file type. If given, it must be a
47 string in printf formatting where a single %s will be replaced
48 with the last segment (filename) of the value of the given
49 --source parameter. It is executed in the same directory into
50 which the fetched file has been saved. The --prepare-command is
51 expected to output the final file to stdout.
52
53 So for example given a --source of
54 https://example.com/my-zip.zip, and a --prepare-command of
55 'unzip -p "%s"', the code unzip -p "my-zip.zip" will be executed
56 in the folder containing the downloaded file my-zip.zip. A more
57 complex example might be --prepare-command 'tar -xz "%s"; cat
58 path/from/archive'
59
60 stage-dir
61 the directory in which to store downloaded and prepared files.
62 Defaults to '/var/tmp/cdist/__staged_file'
63
64 state see cdist-type__file
65
67 __staged_file /usr/local/bin/consul \
68 --source file:///path/to/local/copy/consul \
69 --cksum '428915666 15738724' \
70 --state present \
71 --group root \
72 --owner root \
73 --mode 755
74
75 __staged_file /usr/local/bin/consul \
76 --source https://dl.bintray.com/mitchellh/consul/0.4.1_linux_amd64.zip \
77 --cksum '428915666 15738724' \
78 --fetch-command 'curl -s -L "%s"' \
79 --prepare-command 'unzip -p "%s"' \
80 --state present \
81 --group root \
82 --owner root \
83 --mode 755
84
86 cdist-type__file(7)
87
89 Steven Armstrong <steven-cdist--@--armstrong.cc>
90
92 Copyright (C) 2015 Steven Armstrong. You can redistribute it and/or
93 modify it under the terms of the GNU General Public License as pub‐
94 lished by the Free Software Foundation, either version 3 of the
95 License, or (at your option) any later version.
96
98 ungleich GmbH 2019
99
100
101
102
1036.4.0 Jan 04, 2020 CDIST-TYPE__STAGED_FILE(7)