Thank you for the Reply Josh, I am new to working with types and providers.
This module is me trying to learn because winad module is something we really need. I was thinking if i could tell the winad module to use powershell module for its commands that would be great but i am not sure how to do that. The module i am trying to get working for us is https://forge.puppet.com/shoneslab/winad Any help or directions is greatly appreciated. On Wednesday, April 4, 2018 at 4:47:47 PM UTC-5, Josh Cooper wrote: > > 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] > <javascript:>> 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] <javascript:>. >> 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] <javascript:> | @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/acec8542-a0fd-4bd0-ac69-dc2956390a01%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
