Issue #11714 has been updated by Josh Cooper.

Changing line 42 to the folllowing in `lib/puppet/util/command_line.rb` solved 
the problem for me (explicitly calling Dir.glob with only forward slashes). 
Apparently Dir[...] doesn't like backslashes in the LOAD_PATH:

<pre>
-          commands + Dir[File.join(dir, '*.rb')].map{|fn| File.basename(fn, 
'.rb')}
+          commands + Dir[File.join(File.expand_path(dir), '*.rb')].map{|fn| 
File.basename
</pre>

Simple test seems to confirm this:

<pre>
irb(main):001:0> Dir['c:\*.txt']                                                
=> []                                                                           
irb(main):002:0> Dir['c:/*.txt']                                                
=> ["c:/foo.txt"]                                                               
irb(main):003:0> Dir[File.expand_path('c:\*.txt')]                              
=> ["c:/foo.txt"]                                                         
</pre>

This could explain some issues we've seeing with later versions of ruby 1.8.7 
on Windows. But what's concerning is that there are many places where we do 
Dir.glob'ing, which would fail on any Windows path with backslashes
----------------------------------------
Bug #11714: puppet --version returns Error: Unknown Puppet subcommand 'apply' 
on windows
https://projects.puppetlabs.com/issues/11714

Author: Jeff McCune
Status: Needs Decision
Priority: Normal
Assignee: Daniel Pittman
Category: windows
Target version: 2.7.x
Affected Puppet version: 2.7.9
Keywords: windows apply subcommand puppet
Branch: 


# Overview #

I'm getting this error with Puppet 2.7.9, Facter 1.6.x, and Ruby 1.9.7p334 on 
Windows 2003 x64.

<pre>
C:\>envpuppet puppet --version --debug --trace                                
Error: Unknown Puppet subcommand 'apply'                                        
See 'puppet help' for help on available puppet subcommands
</pre>

# Expected Behavior #

I'd expect this error not to be raised and the version string 2.7.9 to be 
printed.

# Actual Behavior #

See above error message

# Steps to reproduce #

I'm running Puppet from source using this envpuppet.bat wrapper script in my 
PATH.  Facter and Puppet are located on a windows mapped drive readable by my 
security context and process.

<pre>
@echo off
SETLOCAL

SET RUBYLIB=Z:\vagrant\src\facter\lib;Z:\vagrant\src\puppet\lib;%RUBYLIB%
SET PATH=Z:\vagrant\src\facter\bin;Z:\vagrant\src\puppet\bin;%PATH%

ruby -S %*
</pre>

 * Windows 2003 x64 patched up.
 * Ruby 1.8.7 p334
 * Gems:

<pre>
C:\>gem list                                                         
                                                                             
*** LOCAL GEMS ***                                                             
                                                                             
sys-admin (1.5.6 x86-mingw32)                                                  
win32-api (1.4.8 x86-mingw32)                                                   
win32-dir (0.3.7)                                                            
win32-process (0.6.5)                                                          
win32-security (0.1.2)                                                         
win32-service (0.7.1 x86-mswin32-60)                                         
win32-taskscheduler (0.2.1)                                                    
windows-api (0.4.0)                                                            
windows-pr (1.2.1)
</pre>

# Additional Information #

Using this envpuppet wrapper script, Facter appears to work just fine running 
out of source leading me to believe my RUBYLIB and PATH are setup correctly:

<pre>
C:\>envpuppet facter --version                                                
1.6.4                                                                           
C:\>envpuppet facter operatingsystem                                          
windows
</pre>



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to