Regardless of the fact that this is on the developer's list, it's worth 
mentioning that from a use-case perspective it may not actually be 
necessary to worry about that too much. Even though the entire contents of 
the directory may be synced (and Michael correct me if I'm wrong about 
this), when it actually comes time to execute external facts Puppet is 
already intelligent enough to execute only certain kinds of scripts on 
Windows, and others on Posix systems. Given that your use case sounds like 
it's just for Windows vs. Linux, this should be sufficient to run facts 
cleanly and return values only for relevant platforms, even though all 
systems will have a copy of all facts including the ones they can't and 
won't evaluate due to platform incompatibility.

https://docs.puppet.com/facter/3.1/custom_facts.html#executable-facts-----unix
https://docs.puppet.com/facter/3.1/custom_facts.html#executable-facts-----windows

If you need to worry about fine-grained differences like between RHEL and 
Debian, then today at least the bash scripts themselves would need to 
contain that logic.

~Reid

On Wednesday, July 27, 2016 at 5:55:57 PM UTC+1, Michael Smith wrote:
>
> There currently isn't a way.
>
> ----
>
> Since this is the developer's list, I'll go into some details about what 
> would be required for it to work:
>
> Currently pluginsync happens before any facts are returned to the system. 
> This makes it difficult to do anything based on OS version. I've had chats 
> about changing Puppet's communication a bit so it sends some core facts 
> (this might have a lot of overlap with things that could be trusted facts - 
> osfamily probably isn't going to change without requiring a new 
> certificate) before pluginsync so they can be used to determine the 
> environment during node classification; using them to do more precise 
> pluginsync also makes sense.
>
> Then you need a way to determine which plugins to sync. I see three options
> - have a way to query Facter for platform-specific criteria for external 
> facts, and send that to the master to be used in evaluating which facts to 
> sync
> - have a hierarchy in external facts, so you can explicitly target facts 
> at certain classes of machines based on the core facts sent before 
> pluginsync; that might interact in useful ways with Facter's upcoming 
> config file, but would need some way in each module to also specify what 
> facts are synced where. Something simple might be syncing based on 
> osfamily, so you'd have
> <MODULEPATH>/<MODULE>/facts.d/windows
> <MODULEPATH>/<MODULE>/facts.d/redhat
> etc.
>
>
> On Wed, Jul 27, 2016 at 1:45 AM, Aditya Gupta <aditya...@gmail.com 
> <javascript:>> wrote:
>
>> Hello All,
>>
>> I have created two types of external facts :
>>
>> 1. windows based on powershell
>> 2. Linux based on bash
>>
>> And i have placed these in <MODULEPATH>/<MODULE>/facts.d/ folder.
>>
>> I have to copy everything whatever is present in this folder to the all 
>> client.So i am using pluginsync=true
>>
>> is there a way to transfer external facts scripts based on operating 
>> system.
>>
>> Thanks,
>> Aditya
>>
>> --
>>
>
 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/837f042a-a366-41b6-ae57-8a883d375091%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to