Romain, I am confused.
In your first post you said you need to check if a package exists on the "Agent", the Puppet client.
Now below you say you need the check executed on the Master.
Facts are executed on the Agents and only ever on Agents. If you want to check for something on a client/agent machine, you use a Fact, like the one you posted below.
If you want to execute arbitrary code on the Master (during catalogue compilation) probably the simplest thing you are after is the Generate function:
On linux, I would use something that looks a bit like this:
class woof {
$file_exists = generate('/bin/test', '-f', '/softw4pc/Misc/pfoleproxy/pfoleproxy*.txt')
if $file_exists {
...
}
}
There are other ways you can execute arbitrary code, like embedded Ruby with the inline_template() function, pure Ruby manifests, or bury the code somehow in a custom type and provider.
Does that help?
-Luke