On Fri, Jul 18, 2014 at 11:56 AM, Jim Richard <jimr6...@gmail.com> wrote:

> Yep, a custom fact. In case someone else happens upon this looking for a
> similar answer, here's my custom fact to override Facter's default path
> fact:
>
> Facter.add('path') do
>   confine :kernel => 'windows'
>   setcode do
>    my_fact = Facter::Util::Resolution.exec('C:\Windows\system32\cmd.exe /C
> "reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session
> Manager\Environment" /v Path""')
>    my_fact.rpartition('REG_EXPAND_SZ').slice(2).strip
>   end
> end
>
> Thanks Rob !
>

Don't forget about file system redirection and that there is also registry
redirection -
http://puppetlabs.com/blog/how-avoid-common-windows-gotchas-puppet

Also, you need to combine the HKCU values as well to get the full path.


>
>
>
> On Thursday, July 17, 2014 3:37:03 PM UTC-4, Jim Richard wrote:
>>
>> Facter on a Windows 2008R2 server is doing something weird. Version of
>> facter is 2.0.2.
>>
>> If I, from the Puppet command prompt, do a "echo %Path%", I see exactly
>> what I expect. But if I say "facter Path", it shows me all of the Puppet
>> added path stuff twice, ie. the output is almost twice as much text.
>>
>> Oddly, the original pre: puppet agent install path data is still reported
>> by facter, correctly, not doubled up, but all of the path items added by
>> the puppet agent install process show up twice when I issue a "facter
>> Path".
>>
>> My "real" path:
>>
>> E:\oracle\product\11.2.0\db_1\bin;%SystemRoot%\system32;%
>> SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\
>> System32\WindowsPowerShell\v1.0\;C:\Unix;E:\oracle\product\
>> 11.2.0\db_1\OPatch;C:\jdk_release\bin;F:\RATEWARE
>>
>> What facter thinks is my Path:
>>
>> C:\Program Files (x86)\Puppet Labs\Puppet\puppet\bin;C:\Program Files
>> (x86)\Puppet 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 
>> Labs\Puppet\sys\ruby\bin;C:\Program
>> Files (x86)\Puppet Labs\Puppet\sys\tools\bin;C:\Program Files
>> (x86)\Puppet Labs\Puppet\puppet\bin;C:\Program Files (x86)\Puppet
>> 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 Labs\Puppet\sys\ruby\bin;C:\
>> ProgramFiles(x86)\PuppetLabs\Puppet\sys\tools\bin;E:\
>> oracle\product\11.2.0\db_1\bin;C:\Windows\system32;C:\
>> Windows;C:\Windows\System32\Wbem;C:\Windows\System32\
>> WindowsPowerShell\v1.0\;C:\Unix;E:\oracle\product\11.2.0\
>> db_1\OPatch;C:\jdk_release\bin;F:\RATEWARE
>>
>>
>> Any ideas what might cause this?
>>
>  --
> 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 puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/a244e99f-3c11-4052-a0d4-f491089a1764%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/a244e99f-3c11-4052-a0d4-f491089a1764%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Rob Reynolds
Developer, Puppet Labs

*Join us at PuppetConf 2014 <http://www.puppetconf.com/>, September
20-24 in San Francisco*
*Register by July 31st to take advantage of the Early Bird discount
<https://puppetconf2014.eventbrite.com/?discount=EarlyBird> **--**save $249!*

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAMJiBK6tdWHnyxPDMO2ZmrkC6KtKDV60qaYqc3bbv-mphOWsHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to