X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstaging%2Fdocs%2Ffile.html;fp=3rdparty%2Fmodules%2Fstaging%2Fdocs%2Ffile.html;h=38aa0da55c8ab4266dccd6c18c4ae4e76130085d;hb=269aa0e4ab1d106f521995e9e4beb8335acdbed6;hp=0000000000000000000000000000000000000000;hpb=d44d714d51cff79f225cae6a6d8f98f97d3000a5;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/staging/docs/file.html b/3rdparty/modules/staging/docs/file.html new file mode 100644 index 000000000..38aa0da55 --- /dev/null +++ b/3rdparty/modules/staging/docs/file.html @@ -0,0 +1,178 @@ + + +
+ +file.pp |
+ + |
---|---|
+
+ ¶
+
+ Define: staging::file+ +Overview:+ +Define resource to retrieve files to staging directories. It is +intententionally not replacing files, as these intend to be large binaries +that are versioned. + +Notes:+ +If you specify a different staging location, please manage the file + resource as necessary. + +Parameters:+ +
Usage:+ +
+
+ |
+
+ define staging::file (
+ $source,
+ $target = undef,
+ $username = undef,
+ $certificate = undef,
+ $password = undef,
+ $environment = undef,
+ $timeout = undef,
+ $subdir = $caller_module_name
+) {
+
+ include staging
+
+ if $target {
+ $target_file = $target
+ $staging_dir = staging_parse($target, 'parent')
+ } else {
+ $staging_dir = "${staging::path}/${subdir}"
+ $target_file = "${staging_dir}/${name}"
+
+ if ! defined(File[$staging_dir]) {
+ file { $staging_dir:
+ ensure=>directory,
+ }
+ }
+ }
+
+ Exec {
+ path => '/usr/local/bin:/usr/bin:/bin',
+ environment => $environment,
+ cwd => $staging_dir,
+ creates => $target_file,
+ timeout => $timeout,
+ logoutput => on_failure,
+ }
+
+ case $source {
+ /^\//: {
+ file { $target_file:
+ source => $source,
+ replace => false,
+ }
+ }
+
+ /^puppet:\/\//: {
+ file { $target_file:
+ source => $source,
+ replace => false,
+ }
+ }
+
+ /^http:\/\//: {
+ exec { $target_file:
+ command => "curl -L -o ${name} ${source}",
+ }
+ }
+
+ /^https:\/\//: {
+ if $username {
+ $command = "curl -L -o ${name} -u ${username}:${password} ${source}"
+ } elsif $certificate {
+ $command = "curl -L -o ${name} -E ${certificate}:${password} ${source}"
+ } else {
+ $command = "curl -L -o ${name} ${source}"
+ }
+
+ exec { $target_file:
+ command => $command,
+ }
+ }
+
+ /^ftp:\/\//: {
+ if $username {
+ $command = "curl -o ${name} -u ${username}:${password} ${source}"
+ } else {
+ $command = "curl -o ${name} ${source}"
+ }
+
+ exec { $target_file:
+ command => $command,
+ }
+ }
+
+ default: {
+ fail("stage::file: do not recognize source ${source}.")
+ }
+ }
+
+} |
+