Hi All,

I am trying to get all the java versions and paths where it is located. I 
got all java_paths in a fact called java_path. Now i need those versions in 
each custom facts.

I wrote a code but this not executing .

Please help me

*require 'rexml/document'*
*require 'facter'*

*Facter.add("java_path") do*
*  setcode do*
*    Facter::Util::Resolution.exec('/home/suppalapati/java.sh')*
*    end*
*end*




*logfile = '/home/suppalapati/java.txt'*

*line_num=0*

*log = Facter::Util::FileRead.read(logfile)*
*unless log.nil?*
*  log.each_line do |line|*
*    if line.include?('java')*
*       line_num += 1*
*       javaid, val =  %x[ #{log} ]*
*    Facter.add("java_#{javaid}") do*
*      setcode do*
*         val*
*        end*
*       end*
*     end*
*   end*

* Facter.add("java_version_count") do*
*  setcode do*
*    line_num*
*  end*
* end*
*end*


Here is my java.txt file

*/usr/java/jre1.7.0_51/bin/java*
*/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java*
*/opt/CLM-Web-Tools/im/linux.gtk.x86_64/jre_6.0.0.sr9_20110208_03/jre/bin/java*
*/opt/CLM-Web-Tools/im/linux.gtk.x86/jre_6.0.0.sr9_20110208_03/jre/bin/java*
*/opt/IBM/TeamConcertBuild/jre/bin/java*
*/opt/IBM/InstallationManager/eclipse/jre_6.0.0.sr9_20110208_03/jre/bin/java*
*/opt/IBM/InstallationManager_old/InstallationManager_old/eclipse/jre_6.0.0.sr9_20110208_03/jre/bin/java*
*/opt/IBM/TeamConcertBuild_old/jre/bin/java*
*/opt/itm/v6.2.2/JRE/lx8266/bin/java*
*/var/lib/alternatives/java*
*/u01/app/oracle/product/jdk1.7.0_25/jre/bin/java*
*/u01/app/oracle/product/jdk1.7.0_25/bin/java*


*Please help me*

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/c09b4d3a-fab9-47fd-a820-7b754f43db9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to