Windows and Root Path ("/") - Should we do this?

56 views
Skip to first unread message

Rob Reynolds

unread,
Jul 1, 2014, 3:28:22 PM7/1/14
to puppe...@googlegroups.com
Context,
 Awhile ago I thought it might be a good idea to allow for some more consistency in manifests where you would not need to specify the drive letter if you were going to the system drive on windows (usually c: as in c:/).

This is encapsulated in PUP-855[1]. 

This would allow for the ability to specify paths in somewhat the same way as they are specified on other systems, with the knowledge that on Windows, the "/" on the front of the path ("/somepath/bob") would actually be translated to SYSTEMDRIVE, most times c:/ ("c:/somepath/bob").  

There is concern that this is non-deterministic and could possibly be a problem, but this could potentially be useful for most folks.

Thoughts? Feedback?


--
Rob Reynolds
Developer, Puppet Labs

Join us at PuppetConf 2014September 20-24 in San Francisco
Register by July 31st to take advantage of the Early Bird discount save $249!

Paul Stack

unread,
Jul 2, 2014, 6:45:49 AM7/2/14
to puppe...@googlegroups.com
Would this help with rspec puppet errors on Windows?


If so, then id be all for it :)

P.

David Schmitt

unread,
Jul 2, 2014, 8:49:06 AM7/2/14
to puppe...@googlegroups.com
Hi Rob,

The alternative would be to provide many of the well-known paths on
windows as facts.

file { "${::systemdrive}/somepath/bob": ... }

Not an obvious improvement.

A different question: is %PROGRAMFILES% always on %SYSTEMDRIVE% and
will people tend to write

file { "/Program Files/...": }
file { "/Windows/...": }

expecting it to work?

So I'm leaning more on the side of requiring explicit paths and against
magic.

Regards, David

On 2014-07-01 21:28, Rob Reynolds wrote:
> Context,
> Awhile ago I thought it might be a good idea to allow for some more
> consistency in manifests where you would not need to specify the
> drive
> letter if you were going to the system drive on windows (usually c:
> as
> in c:/).
>
> This is encapsulated in PUP-855[1].
>
> This would allow for the ability to specify paths in somewhat the
> same
> way as they are specified on other systems, with the knowledge that
> on
> Windows, the "/" on the front of the path ("/somepath/bob") would
> actually be translated to SYSTEMDRIVE, most times c:/
> ("c:/somepath/bob").
>
> There is concern that this is non-deterministic and could possibly be
> a problem, but this could potentially be useful for most folks.
>
> Thoughts? Feedback?
>
> [1] https://tickets.puppetlabs.com/browse/PUP-855 [1]
>
> --
>
> Rob Reynolds
>
> Developer, Puppet Labs
>
> JOIN US AT , SEPTEMBER 20-24 IN SAN FRANCISCO
>
> _Register by July 31st to take advantage of the Early Bird discount
> [2] __--__save $249!_
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Developers" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to puppet-dev+...@googlegroups.com [3].
> To view this discussion on the web visit
>
> https://groups.google.com/d/msgid/puppet-dev/CAMJiBK6YGz42hFL3JJ%2B%3D4nXriZ69ZcPYo1dQA6znpfxCU%2BRG5w%40mail.gmail.com
> [4].
> For more options, visit https://groups.google.com/d/optout [5].
>
>
> Links:
> ------
> [1] https://tickets.puppetlabs.com/browse/PUP-855
> [2] https://puppetconf2014.eventbrite.com/?discount=EarlyBird
> [3] mailto:puppet-dev+...@googlegroups.com
> [4]
>
> https://groups.google.com/d/msgid/puppet-dev/CAMJiBK6YGz42hFL3JJ%2B%3D4nXriZ69ZcPYo1dQA6znpfxCU%2BRG5w%40mail.gmail.com?utm_medium=email&utm_source=footer
> [5] https://groups.google.com/d/optout

Erik Dalén

unread,
Jul 2, 2014, 8:52:58 AM7/2/14
to Puppet Developers
That has the added benefit of also working correctly on localized versions of windows where they changed "Program Files" to something completely different locale dependent :(


--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/4f489b7dd0e881b2c7ccf00f02cf04dd%40hosting.edv-bus.at.

For more options, visit https://groups.google.com/d/optout.



--
Erik Dalén

Rob Reynolds

unread,
Jul 2, 2014, 2:15:59 PM7/2/14
to puppe...@googlegroups.com
On Wed, Jul 2, 2014 at 7:49 AM, David Schmitt <da...@dasz.at> wrote:
Hi Rob,

The alternative would be to provide many of the well-known paths on windows as facts.

  file { "${::systemdrive}/somepath/bob": ... }

Not an obvious improvement.

A different question: is %PROGRAMFILES% always on %SYSTEMDRIVE% and will people tend to write

  file { "/Program Files/...": }
  file { "/Windows/...": }

expecting it to work?

It's not and that's what this discussion is about. This is what makes it non-deterministic. And makes it possibly an undesirable change.

The big question is how often do folks usually move things from the default system drive with how often would those same folks fall into the category of using '/Program Files' and expecting it to work?
 
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/4f489b7dd0e881b2c7ccf00f02cf04dd%40hosting.edv-bus.at.

For more options, visit https://groups.google.com/d/optout.



--
Rob Reynolds
Developer, Puppet Labs

Join us at PuppetConf 2014September 20-24 in San Francisco
Register by July 31st to take advantage of the Early Bird discount save $249!

David Schmitt

unread,
Jul 3, 2014, 3:25:09 AM7/3/14
to puppe...@googlegroups.com
On 2014-07-02 20:15, Rob Reynolds wrote:
> On Wed, Jul 2, 2014 at 7:49 AM, David Schmitt <da...@dasz.at [13]>
> wrote:
>
>> Hi Rob,
>>
>> The alternative would be to provide many of the well-known paths on
>> windows as facts.
>>
>> file { "${::systemdrive}/somepath/bob": ... }
>>
>> Not an obvious improvement.
>>
>> A different question: is %PROGRAMFILES% always on %SYSTEMDRIVE% and
>> will people tend to write
>>
>> file { "/Program Files/...": }
>> file { "/Windows/...": }
>>
>> expecting it to work?
>
> Its not and thats what this discussion is about. This is what makes
> it
> non-deterministic. And makes it possibly an undesirable change.
>
> The big question is how often do folks usually move things from the
> default system drive with how often would those same folks fall into
> the category of using /Program Files and expecting it to work?

After this reframe of the question, I can answer with my
opinionated-module-author-hat on that abbreviating ${::systemdrive} to
slash-at-the-beginning-of-a-path is a feature that I wouldn't touch with
a long stick.

Besides the implicit-magic argument, I posit this snippet from one of
my (admittedly linux) modules:


https://github.com/DavidS/dasz-configuration/blob/master/modules/hosting/manifests/customer.pp#L122

all paths there are based on some $base_dir which is a parameter to
this type. This is a common pattern for me to reduce repetitiveness and
enable reuse in different scenarios.

Considering use cases:

* Many files on $systemdrive are within well-known directories. Those
have their own envvar/fact that should be preferred.
* a "custom" installation of something. Can be DRY'ed[1] by using
$base_dir and/or requires (external) parametrization anyways.
* fiddle in some "foreign"/third-party directory on $systemdrive.
Already getting into thin-ice territory, arguments from previous point
apply.

but then I've yet to use puppet on windows for more than the most basic
things, so I might be missing important use cases that just haven't
surfaced over here yet.


Regards, David

[1] http://c2.com/cgi/wiki?DontRepeatYourself

>> So Im leaning more on the side of requiring explicit paths and
>> against magic.
>>
>> Regards, David
>>
>> On 2014-07-01 21:28, Rob Reynolds wrote:
>>
>>> Context,
>>> Awhile ago I thought it might be a good idea to allow for some
>>> more
>>> consistency in manifests where you would not need to specify the
>>> drive
>>> letter if you were going to the system drive on windows (usually
>>> c: as
>>> in c:/).
>>>
>>> This is encapsulated in PUP-855[1].
>>>
>>> This would allow for the ability to specify paths in somewhat the
>>> same
>>> way as they are specified on other systems, with the knowledge
>>> that on
>>> Windows, the "/" on the front of the path ("/somepath/bob") would
>>> actually be translated to SYSTEMDRIVE, most times c:/
>>> ("c:/somepath/bob").
>>>
>>> There is concern that this is non-deterministic and could
>>> possibly be
>>> a problem, but this could potentially be useful for most folks.
>>>
>>> Thoughts? Feedback?
>>>
>>> [1] https://tickets.puppetlabs.com/browse/PUP-855 [1] [1]
>>>
>>> --
>>>
>>> Rob Reynolds
>>>
>>> Developer, Puppet Labs
>>>
>>> JOIN US AT , SEPTEMBER 20-24 IN SAN FRANCISCO
>>>
>>> _Register by July 31st to take advantage of the Early Bird
>>> discount
>>> [2] __--__save $249!_
>>>
>>> --
>>> You received this message because you are subscribed to the
>>> Google
>>> Groups "Puppet Developers" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send an email to puppet-dev+...@googlegroups.com [2] [3].
>>> [3]
>>> [4].
>>> For more options, visit https://groups.google.com/d/optout [4]
>>> [5].
>>>
>>> Links:
>>> ------
>>> [1] https://tickets.puppetlabs.com/browse/PUP-855 [5]
>>> [2] https://puppetconf2014.eventbrite.com/?discount=EarlyBird [6]
>>> [3] mailto:puppet-dev+...@googlegroups.com [7]
>>> [4]
>>>
>>>
>>
>
> https://groups.google.com/d/msgid/puppet-dev/CAMJiBK6YGz42hFL3JJ%2B%3D4nXriZ69ZcPYo1dQA6znpfxCU%2BRG5w%40mail.gmail.com?utm_medium=email&utm_source=footer
>>> [8]
>>> [5] https://groups.google.com/d/optout [9]
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Puppet Developers" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to puppet-dev+...@googlegroups.com [10].
>> To view this discussion on the web visit
>>
>
> https://groups.google.com/d/msgid/puppet-dev/4f489b7dd0e881b2c7ccf00f02cf04dd%40hosting.edv-bus.at
>> [11].
>>
>> For more options, visit https://groups.google.com/d/optout [12].
>
> --
>
> Rob Reynolds
>
> Developer, Puppet Labs
>
> JOIN US AT , SEPTEMBER 20-24 IN SAN FRANCISCO
>
> _Register by July 31st to take advantage of the Early Bird discount
> [14] __--__save $249!_
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Developers" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to puppet-dev+...@googlegroups.com [15].
> To view this discussion on the web visit
>
> https://groups.google.com/d/msgid/puppet-dev/CAMJiBK4X-Abbg6CD%2BJ5CoTcWzQomLaO19wmwrMtxWgf%2BXqwMSQ%40mail.gmail.com
> [16].
> For more options, visit https://groups.google.com/d/optout [17].
> [2] mailto:puppet-dev%2Bunsu...@googlegroups.com
> [3]
>
> https://groups.google.com/d/msgid/puppet-dev/CAMJiBK6YGz42hFL3JJ%2B%3D4nXriZ69ZcPYo1dQA6znpfxCU%2BRG5w%40mail.gmail.com
> [4] https://groups.google.com/d/optout
> [5] https://tickets.puppetlabs.com/browse/PUP-855
> [6] https://puppetconf2014.eventbrite.com/?discount=EarlyBird
> [7] mailto:puppet-dev%2Bunsu...@googlegroups.com
> [8]
>
> https://groups.google.com/d/msgid/puppet-dev/CAMJiBK6YGz42hFL3JJ%2B%3D4nXriZ69ZcPYo1dQA6znpfxCU%2BRG5w%40mail.gmail.com?utm_medium=email&amp;utm_source=footer
> [9] https://groups.google.com/d/optout
> [10] mailto:puppet-dev%2Bunsu...@googlegroups.com
> [11]
>
> https://groups.google.com/d/msgid/puppet-dev/4f489b7dd0e881b2c7ccf00f02cf04dd%40hosting.edv-bus.at
> [12] https://groups.google.com/d/optout
> [13] mailto:da...@dasz.at
> [14] https://puppetconf2014.eventbrite.com/?discount=EarlyBird
> [15] mailto:puppet-dev+...@googlegroups.com
> [16]
>
> https://groups.google.com/d/msgid/puppet-dev/CAMJiBK4X-Abbg6CD%2BJ5CoTcWzQomLaO19wmwrMtxWgf%2BXqwMSQ%40mail.gmail.com?utm_medium=email&utm_source=footer
> [17] https://groups.google.com/d/optout

Rob Reynolds

unread,
Jul 3, 2014, 10:59:55 AM7/3/14
to puppe...@googlegroups.com
No, I think you are onto something. For external modules it wouldn't be a good idea. But interestingly enough, before reading this I sort of came to the same conclusion. https://tickets.puppetlabs.com/browse/PUP-855?focusedCommentId=79712&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-79712 so glad to see that it is already a pattern. :) 

I'll update my comment to reflect your notes here.
 
send an email to puppet-dev+unsubscribe@googlegroups.com [2] [3].


To view this discussion on the web visit


[8]
[5] https://groups.google.com/d/optout [9]

--
You received this message because you are subscribed to the Google
Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it,

To view this discussion on the web visit


https://groups.google.com/d/msgid/puppet-dev/4f489b7dd0e881b2c7ccf00f02cf04dd%40hosting.edv-bus.at
[11].

For more options, visit https://groups.google.com/d/optout [12].

--

Rob Reynolds

Developer, Puppet Labs

JOIN US AT , SEPTEMBER 20-24 IN SAN FRANCISCO

_Register by July 31st to take advantage of the Early Bird discount
[14] __--__save $249!_


 --
 You received this message because you are subscribed to the Google
Groups "Puppet Developers" group.
 To unsubscribe from this group and stop receiving emails from it,
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/0df064f971a02c17659a1881a4713144%40hosting.edv-bus.at.

For more options, visit https://groups.google.com/d/optout.



--
Rob Reynolds
Developer, Puppet Labs

Join us at PuppetConf 2014September 20-24 in San Francisco
Register by July 31st to take advantage of the Early Bird discount save $249!

David Schmitt

unread,
Jul 3, 2014, 4:01:51 PM7/3/14
to puppe...@googlegroups.com
On 2014-07-03 16:59, Rob Reynolds wrote:
> but then I've yet to use puppet on windows for more than the most
> basic things, so I might be missing important use cases that just
> haven't surfaced over here yet.
>
>
> No, I think you are onto something. For external modules it wouldn't
> be a good idea. But interestingly enough, before reading this I sort
> of came to the same conclusion.
> https://tickets.puppetlabs.com/browse/PUP-855?focusedCommentId=79712&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-79712
> so glad to see that it is already a pattern. :)
>
> I'll update my comment to reflect your notes here.

Regarding

> 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?
> https://tickets.puppetlabs.com/browse/PUP-855?focusedCommentId=79712&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-79712

$::systemdrive is empty on non-windows nodes, so "${::systemdrive}/tmp"
would "always" be a "valid" path.

My developer soul just died a little bit saying that.


Regards, David

Rob Reynolds

unread,
Jul 3, 2014, 4:04:22 PM7/3/14
to puppe...@googlegroups.com
Unless someone defines it as a custom fact :(
Most likely they wouldn't, so that would less branching.
 


Regards, David


--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

David Schmitt

unread,
Jul 4, 2014, 4:06:04 PM7/4/14
to puppe...@googlegroups.com
On 2014-07-03 22:04, Rob Reynolds wrote:
> Regarding
>
> 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?
> https://tickets.puppetlabs.__com/browse/PUP-855?__focusedCommentId=79712&page=__com.atlassian.jira.plugin.__system.issuetabpanels:comment-__tabpanel#comment-79712
> <https://tickets.puppetlabs.com/browse/PUP-855?focusedCommentId=79712&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-79712>
>
>
> $::systemdrive is empty on non-windows nodes, so "${::systemdrive}/tmp"
> would "always" be a "valid" path.
>
> My developer soul just died a little bit saying that.
>
>
> Unless someone defines it as a custom fact :(
> Most likely they wouldn't, so that would less branching.

There is a special place where people who redefine core facts should go.



Regards, David

Rob Reynolds

unread,
Jul 17, 2014, 8:23:46 PM7/17/14
to puppe...@googlegroups.com
So based on the conversation here, there is already an acceptable pattern for defining root path that can be converted for Windows/non-Windows systems that is deterministic and wouldn't suffer from possible inexperience with Windows resources.

Based on that, I don't think this is something we should move forward with.






Regards, David

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages