[PUP-855] On Windows allow using root path for file type Created: 2013/11/20  Updated: 2019/04/04  Resolved: 2014/07/17

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: redmine.exporter Assignee: Unassigned
Resolution: Won't Fix Votes: 3
Labels: puppethack, redmine, trivial, windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified



This would allow full path in a way that doesn't require specifying the drive to look at. When this is specified, we will use SYSTEMDRIVE. This would allow multiple computers with different system drives to be able to use the same manifests. This could also open the door for more platforms using the same manifest with less use of selectors based on the OS.

file {'/somepath':
  ensure => directory,
file { '/somepath/somefile.txt':
  ensure => file,
  content => 'this is content',

Those would translate to `c:\somepath` and `c:\somepath\somefile.txt` respectively on Windows if SYSTEMDRIVE was C:, otherwise it would translate to whatever the system drive is set to on Windows.

Comment by Rob Reynolds [ 2014/04/23 ]

I would like to see this in there at some point but others had some reservations on this.

Comment by Rob Reynolds [ 2014/06/06 ]

The concern here is that this could cause inconsistent changes if someone had moved the systemdrive to not C or applications Program files over to another drive. - Summarized from conversation with Josh Cooper

Comment by Rob Reynolds [ 2014/07/01 ]

Due to it's non-deterministic nature, it goes against what puppet considers an accurate location. While you can already get a non-deterministic nature with variables that depend on system environment information, building it into core puppet seems incorrect. Perhaps a module that would add this behavior would be more plausible as someone would be opting into this nature.

Comment by Henrik Lindberg [ 2014/07/02 ]

Adding facts for things like %PROGRAMFILES% and %SYSTEMDRIVE% (as suggested on puppet dev) seems to be a better solution as it also handles internationalized windows disk layouts.

Comment by Rob Reynolds [ 2014/07/03 ]

Henrik Lindberg One can do those things now. This is more meant to bring more parity with other platforms. You can't create any fact that is going to allow you to set the path like so "/temp/somedirectory" and use it across both windows and *nix. Or can you?

Interesting though... somewhat pseudo-code here:

case $::operatingsystem {
  windows: { $rp = $::systemdrive  }
  default: { $rp = '' }
file {"$rp/somedirectory":
 ensure => directory,

Comment by Henrik Lindberg [ 2014/07/03 ]

I guess the value of having a root of / map to someplace depends on what is being managed - if it is "windows stuff", then the paths and layouts are different from any *nix stuff, and vice versa. Unless there are *nix like tools being managed on windows referencing things like /etc/something, /opt/var/something, /user etc. isn't the automatic mapping just going to make people silently drop files on to windows boxes in places where they are at best just ignored and harmless, but worst case screw something up?

The alternative is to have some kind of symbolic mapping / abstraction that works across all platforms - sort of like mount points. This could take place agent side, but the agent would need to know how to do the mapping, so it probably should be something that is configured in the catalog it gets, constructed out of facts it provided.

Comment by Rob Reynolds [ 2014/07/03 ]

And it looks like Old Dasz already follows this as a common pattern. Good that there is already a pattern established out there.

Comment by Andrew Parker [ 2014/07/14 ]

Rob Reynolds, if I'm reading this and the puppet-dev conversation correctly, it seems like this feature request is being rejected. If so, can you close it out and reply to the thread on puppet-dev just to make that clear?

Comment by Rob Reynolds [ 2014/07/17 ]

Rejecting this based on an acceptable pattern that is more deterministic and also works in module development. Based on this thread response from Old Dasz - https://groups.google.com/forum/#!msg/puppet-dev/LXKp28yqqB8/ey4qhUOKQZ8J

Generated at Fri Aug 07 09:01:28 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.