2015-02-24 12:01:48 +00:00
|
|
|
cdist-type__staged_file(7)
|
|
|
|
==========================
|
2016-06-23 14:08:59 +00:00
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
|
|
|
cdist-type__staged_file - Manage staged files
|
2015-02-24 12:01:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
Manages a staged file that is downloaded on the server (the machine running
|
|
|
|
cdist) and then deployed to the target host using the __file type.
|
|
|
|
|
|
|
|
|
|
|
|
REQUIRED PARAMETERS
|
|
|
|
-------------------
|
2016-05-20 06:50:56 +00:00
|
|
|
source
|
2015-02-24 12:01:48 +00:00
|
|
|
the URL from which to retreive the source file.
|
|
|
|
e.g.
|
2016-05-20 06:50:56 +00:00
|
|
|
|
|
|
|
* https://dl.bintray.com/mitchellh/consul/0.4.1_linux_amd64.zip
|
|
|
|
* file:///path/to/local/file
|
|
|
|
|
|
|
|
cksum
|
2015-02-24 12:01:48 +00:00
|
|
|
the output of running the command: `cksum $source-file`
|
2016-05-20 06:50:56 +00:00
|
|
|
e.g.::
|
|
|
|
|
2015-02-24 12:01:48 +00:00
|
|
|
$ echo foobar > /tmp/foobar
|
|
|
|
$ cksum /tmp/foobar
|
|
|
|
857691210 7 /tmp/foobar
|
2016-05-20 06:50:56 +00:00
|
|
|
|
2015-02-24 12:01:48 +00:00
|
|
|
If either checksum or file size has changed the file will be
|
|
|
|
(re)fetched from the --source. The file name can be omitted and is
|
|
|
|
ignored if given.
|
|
|
|
|
|
|
|
|
|
|
|
OPTIONAL PARAMETERS
|
|
|
|
-------------------
|
2016-05-20 06:50:56 +00:00
|
|
|
fetch-command
|
2015-02-24 12:01:48 +00:00
|
|
|
the command used to fetch the staged file using printf formatting.
|
|
|
|
Where a single %s will be replaced with the value of the given --source
|
|
|
|
parameter. The --fetch-command is expected to output the fetched file to
|
|
|
|
stdout.
|
|
|
|
Defaults to 'curl -s -L "%s"'.
|
2016-05-20 06:50:56 +00:00
|
|
|
|
|
|
|
group
|
2015-02-24 12:01:48 +00:00
|
|
|
see cdist-type__file
|
2016-05-20 06:50:56 +00:00
|
|
|
|
|
|
|
owner
|
2015-02-24 12:01:48 +00:00
|
|
|
see cdist-type__file
|
2016-05-20 06:50:56 +00:00
|
|
|
|
|
|
|
mode
|
2015-02-24 12:01:48 +00:00
|
|
|
see cdist-type__file
|
2016-05-20 06:50:56 +00:00
|
|
|
|
|
|
|
prepare-command
|
2015-02-24 12:01:48 +00:00
|
|
|
the optional command used to prepare or preprocess the staged file for later
|
|
|
|
use by the file type.
|
|
|
|
If given, it must be a string in printf formatting where a single %s will
|
|
|
|
be replaced with the last segment (filename) of the value of the given
|
|
|
|
--source parameter.
|
|
|
|
It is executed in the same directory into which the fetched file has been
|
|
|
|
saved. The --prepare-command is expected to output the final file to stdout.
|
|
|
|
|
|
|
|
So for example given a --source of https://example.com/my-zip.zip, and a
|
|
|
|
--prepare-command of 'unzip -p "%s"', the code `unzip -p "my-zip.zip"` will
|
|
|
|
be executed in the folder containing the downloaded file my-zip.zip.
|
|
|
|
A more complex example might be --prepare-command 'tar -xz "%s"; cat path/from/archive'
|
2016-05-20 06:50:56 +00:00
|
|
|
stage-dir
|
2015-02-24 12:01:48 +00:00
|
|
|
the directory in which to store downloaded and prepared files.
|
|
|
|
Defaults to '/var/tmp/cdist/__staged_file'
|
2016-05-20 06:50:56 +00:00
|
|
|
|
|
|
|
state
|
2015-02-24 12:01:48 +00:00
|
|
|
see cdist-type__file
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES
|
|
|
|
--------
|
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
.. code-block:: sh
|
2015-02-24 12:01:48 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
__staged_file /usr/local/bin/consul \
|
|
|
|
--source file:///path/to/local/copy/consul \
|
|
|
|
--cksum '428915666 15738724' \
|
|
|
|
--state present \
|
|
|
|
--group root \
|
|
|
|
--owner root \
|
|
|
|
--mode 755
|
2015-02-24 12:01:48 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
__staged_file /usr/local/bin/consul \
|
|
|
|
--source https://dl.bintray.com/mitchellh/consul/0.4.1_linux_amd64.zip \
|
|
|
|
--cksum '428915666 15738724' \
|
|
|
|
--fetch-command 'curl -s -L "%s"' \
|
|
|
|
--prepare-command 'unzip -p "%s"' \
|
|
|
|
--state present \
|
|
|
|
--group root \
|
|
|
|
--owner root \
|
|
|
|
--mode 755
|
2015-02-24 12:01:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
2016-06-30 10:09:07 +00:00
|
|
|
:manpage:`cdist-type__file`\ (7)
|
2016-06-17 19:28:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
AUTHORS
|
|
|
|
-------
|
|
|
|
Steven Armstrong <steven-cdist--@--armstrong.cc>
|
2015-02-24 12:01:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
COPYING
|
|
|
|
-------
|
|
|
|
Copyright \(C) 2015 Steven Armstrong. Free use of this software is
|
|
|
|
granted under the terms of the GNU General Public License version 3 (GPLv3).
|