Good day, 
I am reviewing a type and provider and would like input or help to better 
understand.

The provider is 
require 'puppet/util'
Puppet::Type.type(:winad_group).provide(:powershell) do
    confine :operatingsystem => :windows
    defaultfor :operatingsystem => :windows

    commands :powershell => Puppet::Util::Powershell.getPowershellCommand

The type is 
Puppet::Type.newtype(:winad_group) do

Then lastly there is a file /puppet/util/powershell.rb
class Powershell
  def self.getPowershellCommand()
    if 
File.exists?("#{ENV['SYSTEMROOT']}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe")
      
"#{ENV['SYSTEMROOT']}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe"
    elsif 
File.exists?("#{ENV['SYSTEMROOT']}\\system32\\WindowsPowershell\\v1.0\\powershell.exe")
      
"#{ENV['SYSTEMROOT']}\\system32\\WindowsPowershell\\v1.0\\powershell.exe"
    else
      'powershell.exe'
    end
  end
end

If i copy the syntax 
    commands :powershell => 
    if 
File.exist?("#{ENV['SYSTEMROOT']}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe")
      
"#{ENV['SYSTEMROOT']}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe"
    elsif 
File.exist?("#{ENV['SYSTEMROOT']}\\system32\\WindowsPowershell\\v1.0\\powershell.exe")
      
"#{ENV['SYSTEMROOT']}\\system32\\WindowsPowershell\\v1.0\\powershell.exe"
    else
      'powershell.exe'
    end

Into my provider i am able to run the command correctly, why can i not 
autoload the powershell.rb file and properly use it across multiple 
providers?

Thank you for any help.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/dc8c6918-683d-4d1f-ae2c-b94761c79239%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to