Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

staging::file when specifying $target not behaving as documented #51

Closed
michaelraz opened this issue Jan 12, 2015 · 0 comments
Closed

Comments

@michaelraz
Copy link

Hi guys,

I tried to override the $target path for a call to staging::file. What I found was that nothing was happening until I specified the full path, including filename.

The documentation for staging::file indicates:

$target      = undef, #: the target staging directory, if unspecified ${staging::path}/${caller_module_name}

Looking at the source below from file.pp you can see if the $target is specified, $target_file is set to the submitted value which, in my case, is a folder. If $target is not specified, $target_file is set to ${staging_dir}/${name} (${name} would be the resource title here I would imagine?):

  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,
      }
    }
  }

The reason nothing was happening (no file copy and no error) was due to your Idempotent check. I was creating the folder in another task. Your check would fire, checking if the "folder" existed, and move on.

Hope this makes sense,

Michael

nanliu added a commit that referenced this issue Jan 16, 2015
@nanliu nanliu closed this as completed Jan 16, 2015
cegeka-jenkins pushed a commit to cegeka/puppet-staging that referenced this issue Oct 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants