Jira (PUP-6998) File attribute "target" forces file to be symlink if not already

2 views
Skip to first unread message

John Williamson (JIRA)

unread,
Dec 12, 2016, 2:13:02 PM12/12/16
to puppe...@googlegroups.com
John Williamson created an issue
 
Puppet / Bug PUP-6998
File attribute "target" forces file to be symlink if not already
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2016/12/12 11:12 AM
Priority: Trivial Trivial
Reporter: John Williamson

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!

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

John Williamson (JIRA)

unread,
Dec 12, 2016, 4:11:02 PM12/12/16
to puppe...@googlegroups.com

Maggie Dreyer (JIRA)

unread,
May 16, 2017, 2:53:04 PM5/16/17
to puppe...@googlegroups.com

Moses Mendoza (JIRA)

unread,
May 18, 2017, 1:55:07 PM5/18/17
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jun 15, 2021, 1:29:03 PM6/15/21
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-6998
 
Re: File attribute "target" forces file to be symlink if not already

In addition, puppet always creates the symlink, even if replace => false

This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages