Puppet Facts - Finding Java paths

18 views
Skip to first unread message

sara2345678

unread,
Jan 31, 2022, 4:20:36 PM1/31/22
to Puppet Users
Good Day Puppet Experts, 

am running a facter code in puppet master something like this to run a jar file. 

if servertype == 'app' or servertype == 'java'
 Facter.add('monitor_javaversion') do
   setcode do
       Facter::Core::Execution.execute('java -jar /appl/monitor/monitor.jar -v')
  end
 end

in this case, java path is not set across all systems. is there a better way to code this something like.. 

1. find for "bin/java" and use that path to find the version. 

something like below but instead of "which", looking for "find or locate" 

   if Facter::Util::Resolution.which('httpd')
      apache_version = Facter::Util::Resolution.exec('httpd -V 2>&1')

any help would be much appreciated. 



Reply all
Reply to author
Forward
0 new messages