Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-6998

File attribute "target" forces file to be symlink if not already

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: PUP 3.8.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • QA Risk Assessment:
      Needs Assessment

      Description

      It appears that no matter what the "ensure" attribute is set to, if the file being ensured is not a symlink and a "target" is specified, then puppet will ensure that it is a symlink.

      As an example, say that you have a directory that needs to be a real directory on some systems and a symlink to another directory on other systems, you might make a hiera key $dir_ensure_val to contain what a server or group of servers will get, and then write the following puppet code:

      file

      {"/this/is/my/directory": ensure => "$dir_ensure_val", target => "/usr/lib_global_directory"; }

      If $dir_ensure_val is set to 'directory', then:
      --If /this/is/my/directory doesn't exist or is a symlink, this code will create /this/is/my/directory as a real, standard directory.

      --If /this/is/my/directory is already a real directory, this code will attempt to replace /this/is/my/directory with a symlink that points to /usr/lib_global_directory

      That means that if it's an empty directory, then puppet will alternate between the two indefinitely. If it's not an empty directory, then the code will succeed at creating the directory on the first run and fail on all subsequent runs because it can't delete the directory to replace it with a symlink.

      This behavior should be consistent but isn't. Personally I'd love it if "target" was ignored if ensure isn't 'link' so that code with variable ensures can be used. However, if puppet were to always create a symlink if "target" is set, that also gives a consistent behavior.

      Please let me know if there's anything at all I can do to help better explain things.

      Thanks!

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ConstipatedNinja John Williamson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Zendesk Support