If Puppet is not managing the Java package, then how is it supposed to
know when the package name or version changes except by inquiring of
the system? With all the constraints you have set, I don't see any
alternative to running a command such as the one you specified during
every Puppet run. If you indeed pursue that general direction then I
would recommend wrapping the command into a custom fact.
HOWEVER, be it known that you are engaging in a Puppet antipattern.
It is better for Puppet to know how a node *should* be configured and
to make it so, than to adapt to node configuration details managed by
some other entity. In particular, it seems horribly backwards to say
that Puppet needs to know the name of some installed package while
denying it the ability to manage that package.
Additionally, your particular solution to identifying the Java binary
seems strange. Linux systems with which I work all employ the
"alternatives" facility to make such issues transparent to ordinary
users and services. That allows, for example, one of possibly many
installed Java runtimes to be elected as the default, to be run as /
usr/bin/java. That is normally handled for you automatically via
package scripts, but you can use 'alternatives' manually, too. Are
you sure you aren't making needless work for yourself?
John