Not sure what's the issue is... but could you use the powershell module instead https://github.com/puppetlabs/puppetlabs-powershell?
On Wed, Apr 4, 2018 at 2:09 PM, Jason McMahan <[email protected]> wrote: > 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 > <https://groups.google.com/d/msgid/puppet-users/dc8c6918-683d-4d1f-ae2c-b94761c79239%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Josh Cooper | Software Engineer [email protected] | @coopjn -- 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/CA%2Bu97unm0mpK3_0D_fs8TcOYdNHuiBubYh0BSUr4_ESDES7P_Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
