Puppet Windows: Spaces in file paths a problem?

779 views
Skip to first unread message

Mohamed Lrhazi

unread,
Nov 28, 2011, 4:11:10 PM11/28/11
to puppet...@googlegroups.com
I thought I read somewhere in Puppet docs/wiki... that it is
"recommended" to avoid spaces in file paths, or some similar verbiage,
but now I cant find it.

Does Puppet have any known issues with spaces in file paths? It would
of course scare Windows admins away... So I hope I am wrong in
thinking I read that.

Thanks a lot,
Mohamed.

Mohamed Lrhazi

unread,
Nov 28, 2011, 4:15:51 PM11/28/11
to puppet...@googlegroups.com
I found where I read what I read... not directly Puppet, but Ruby:

https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting:

"If you notice those directories contain spaces, it might be because
you installed Ruby in a folder with spaces (highly not recommended)
or..."

Thanks,
Mohamed.

Josh Cooper

unread,
Nov 28, 2011, 6:28:47 PM11/28/11
to puppet...@googlegroups.com
Hi Mohamed,

I ran into trouble with spaces in file paths when setting RUBYLIB (in batch files that run our windows rspec tests). I had to convert the paths to their short names and convert backslashes to forward slashes. Without this, ruby would not load from files in directories with spaces.

set PWD=%CD%
for %%f in ("%PWD%") do set SHORT_PWD=%%~sf
set RUBYLIB=%RUBYLIB%;%SHORT_PWD%/vendor/facter/lib
set RUBYLIB=%RUBYLIB:\=/%

Josh
--
Josh Cooper
Developer, Puppet Labs

Mohamed Lrhazi

unread,
Nov 28, 2011, 6:56:54 PM11/28/11
to puppet...@googlegroups.com
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>

Thanks Josh.

I run into an issue where this Exec would fail if the variable has a
space in it:

command => "$splunk_home\\bin\\splunk.exe start",

but then again that could happen in Unix just as well, not really
Windows specific.

I had to write:

command => "\"$splunk_home\\bin\\splunk.exe\" start",

So I am concluding that from the Puppet end-user perspective, there no
special issue with spaces in path names, at least not as a Windows
specific concern.

Thanks a lot,
Mohamed.

Josh Cooper

unread,
Nov 28, 2011, 11:39:16 PM11/28/11
to puppet...@googlegroups.com
On Mon, Nov 28, 2011 at 3:56 PM, Mohamed Lrhazi <lrh...@gmail.com> wrote:

Thanks Josh.

I run into an issue where this Exec would fail if the variable has a
space in it:

command => "$splunk_home\\bin\\splunk.exe start",

but then again that could happen in Unix just as well, not really
Windows specific.

I had to write:

command => "\"$splunk_home\\bin\\splunk.exe\" start",

So I am concluding that from the Puppet end-user perspective, there no
special issue with spaces in path names, at least not as a Windows
specific concern.

Yep, the command needs to be quoted because it is a string with potentially multiple arguments. I don't know of any specific Windows issues with spaces, aside from the RUBYLIB issue mentioned earlier, but do let us know if you run into something.

Josh
Reply all
Reply to author
Forward
0 new messages