Issue #19318 has been updated by Josh Cooper.

Status changed from Accepted to Needs More Information
Assignee set to Andrew Dunkman

In 3.0.1, we did not handle loading code from gems reliably. The error below 
occurs because facter didn't load rubygems, and then loaded puppet, which 
assumed rubygems had been loaded prior to accessing the win32 specific gems:

<pre>
C:\Program Files (x86)\Puppet Labs\Puppet\bin>facter.bat
Cannot run on Microsoft Windows without the sys-admin, win32-process, win32-dir,
win32-service and win32-taskscheduler gems: no such file to load -- sys/admin
Could not retrieve puppetversion: Cannot determine basic system flavour
</pre>

This was resolved in 3.1, as each of the application entry points 
`bin/{puppet,facter}` handle this now.

With that said, I don't think this has anything to do with the problem you are 
seeing. Since the type is getting loaded, and the operatingsystem fact is 
windows, then the provider is almost certainly not suitable, because of the 
command:

<pre>
commands :cmd => "#{Dir::WINDOWS}\\system32\\cmd.exe"
</pre>

Either the win32-dir gem isn't loaded (which adds the `WINDOWS` constant to 
`Dir`), or there's an issue with filesystem redirection, or for some reason 
`Puppet::Util.which` is returning `false`. Try replacing the command with the 
literal string 'c:\windows\system32\cmd.exe'.

----------------------------------------
Bug #19318: Resource providers don't recognize Windows Server 2012 as windows
https://projects.puppetlabs.com/issues/19318#change-89653

* Author: Andrew Dunkman
* Status: Needs More Information
* Priority: Normal
* Assignee: Andrew Dunkman
* Category: 
* Target version: 
* Affected Puppet version: 3.0.1
* Keywords: windows 2012
* Branch: 
----------------------------------------
Facter seems to recognize the machine as windows, but "operatingsystem" doesn't 
seem to be set to windows when the puppet run is completing. 

The type and provider in question run as expected on Windows Server 2008 R2 and 
Windows 7, but does not on Windows Server 2012.

Output from the puppet agent showing the error (some irrelevant output omitted):

    C:\Program Files (x86)\Puppet Labs\Puppet\bin>puppet.bat agent -t
    Info: Retrieving plugin
    ...
    Info: Caching catalog for illum-app-sftk-ks
    Info: Applying configuration version '1361197550'
    Error: Could not find a suitable provider for env
    Finished catalog run in 2.54 seconds

The "env" type in question:

    Puppet::Type.newtype(:env) do
      @doc = "Manages environmental variables."

      ensurable do
        desc "Environmental variable state."

        defaultvalues

        newvalue(:present) do
          provider.create
        end

        newvalue(:absent) do
          provider.destroy
        end
      end

      newparam(:name, :namevar=>true) do
        desc "The environmental variable name."
      end

      newparam(:value) do
        desc "The value of the environmental variable."
      end
    end

The resource provider that should be running: 

    Puppet::Type.type(:env).provide(:windows) do
      @doc = "Manages Windows environmental variables."

      confine    :operatingsystem => :windows
      defaultfor :operatingsystem => :windows

      commands :cmd => "#{Dir::WINDOWS}\\system32\\cmd.exe"

      def create
        cmd '/C', 'setx', '/M', resource[:name], resource[:value]
      end

      def destroy
        cmd '/C', 'setx', '/M', resource[:name], ''
      end

      def exists?
        ENV[resource[:name]] == resource[:value]
      end
    end

Output from Facter:
    
    ruby 1.8.7 (2012-06-29 patchlevel 370) [i386-mingw32]
    C:\Program Files (x86)\Puppet Labs\Puppet\bin>facter.bat
    Cannot run on Microsoft Windows without the sys-admin, win32-process, 
win32-dir,
    win32-service and win32-taskscheduler gems: no such file to load -- 
sys/admin
    Could not retrieve puppetversion: Cannot determine basic system flavour
    architecture => x64
    dir => C:\Program Files (x86)\Puppet Labs\Puppet\facter
    domain => softek.local
    env_windows_installdir => C:\Program Files (x86)\Puppet Labs\Puppet
    facterversion => 1.6.13
    fqdn => illum-app.softek.local
    hardwaremodel => x64
    hostname => illum-app
    id => illum-app\administrator
    interfaces => Loopback_Pseudo_Interface_1,Ethernet
    ipaddress => 10.80.97.25
    ipaddress_ethernet => 10.80.97.25
    ipaddress_loopback_pseudo_interface_1 => 127.0.0.1
    kernel => windows
    kernelmajversion => 6.2
    kernelrelease => 6.2.9200
    kernelversion => 6.2.9200
    macaddress => 00:0C:29:A3:25:67
    manufacturer => Phoenix Technologies LTD
    memoryfree => 14.47 GB
    memorysize => 16.00 GB
    memorytotal => 16.00 GB
    netmask_ethernet => 255.255.240.0
    netmask_loopback_pseudo_interface_1 => 255.0.0.0
    network_ethernet => 10.80.96.0
    network_loopback_pseudo_interface_1 => 127.0.0.0
    operatingsystem => windows
    operatingsystemrelease => 6.2.9200
    osfamily => windows
    path => C:\Program Files (x86)\Puppet Labs\Puppet\puppet\bin;C:\Program 
Files (x
    86)\Puppet Labs\Puppet\facter\bin;C:\Program Files (x86)\Puppet 
Labs\Puppet\hier
    a\bin;C:\Program Files (x86)\Puppet Labs\Puppet\bin;C:\Program Files 
(x86)\Puppe
    t Labs\Puppet\sys\ruby\bin;C:\Program Files (x86)\Puppet 
Labs\Puppet\sys\tools\b
    in;C:\Program Files (x86)\Puppet Labs\Puppet\puppet\bin;C:\Program Files 
(x86)\P
    uppet Labs\Puppet\facter\bin;C:\Program Files (x86)\Puppet 
Labs\Puppet\hiera\bin
    ;C:\Program Files (x86)\Puppet Labs\Puppet\bin;C:\Program Files 
(x86)\Puppet Lab
    s\Puppet\sys\ruby\bin;C:\Program Files (x86)\Puppet 
Labs\Puppet\sys\tools\bin;C:
    
\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Window
    sPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL 
Server\110\Tools\Binn\;C:
    \Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program 
Files\Microsoft S
    QL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL 
Server\110\Tools\Bi
    nn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL 
Server\110\DTS\Binn\;C
    :\Program Files\Microsoft\Web Platform Installer\;c:\Program Files 
(x86)\Microso
    ft ASP.NET\ASP.NET Web Pages\v1.0\
    physicalprocessorcount => 2
    processor0 => Intel(R) Xeon(R) CPU X5570 @ 2.93GHz
    processor1 => Intel(R) Xeon(R) CPU X5570 @ 2.93GHz
    processor2 => Intel(R) Xeon(R) CPU X5570 @ 2.93GHz
    processor3 => Intel(R) Xeon(R) CPU X5570 @ 2.93GHz
    processor4 => Intel(R) Xeon(R) CPU X5570 @ 2.93GHz
    processor5 => Intel(R) Xeon(R) CPU X5570 @ 2.93GHz
    processor6 => Intel(R) Xeon(R) CPU X5570 @ 2.93GHz
    processor7 => Intel(R) Xeon(R) CPU X5570 @ 2.93GHz
    processorcount => 8
    productname => VMware Virtual Platform
    ps => tasklist.exe
    rubysitedir => C:/Program Files (x86)/Puppet 
Labs/Puppet/sys/ruby/lib/ruby/site_
    ruby/1.8
    rubyversion => 1.8.7
    serialnumber => VMware-56 4d 8e 69 ac b6 56 37-5b 98 8b f1 3c a3 25 67
    timezone => Pacific Standard Time
    uptime => 0:01 hours
    uptime_days => 0
    uptime_hours => 0
    uptime_seconds => 88

Puppet agent version: 3.0.1
Puppet master version: 3.0.1


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to