Hi,

I am have java text file which contains versions and as well as paths. Now 
i need each facts for java_path and java_version.

here is my text file where all my java information is there
/*usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/jre/bin/java*
*java version "1.7.0_25"*
*OpenJDK Runtime Environment (rhel-2.3.10.3.el6_4-x86_64)*
*OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)*
*/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java*
*java version "1.6.0_24"*
*OpenJDK Runtime Environment (IcedTea6 1.11.11) 
(rhel-1.61.1.11.11.el6_4-x86_64)*
*OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)*

*/opt/apps/installs/srvr/source/java/jre/bin/java*
*java version "1.6.0_45"*
*Java(TM) SE Runtime Environment (build 1.6.0_45-b06)*
*Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)*
*/opt/apps/installs/srvr/source/java/bin/java*
*java version "1.6.0_45"*
*Java(TM) SE Runtime Environment (build 1.6.0_45-b06)*
*Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)*

Here is my puppet facts

cat java_path.rb
*require 'rexml/document'*
*require 'facter/util/file_read'*
*require 'facter'*
*require 'open3'*


*logfile = "/home/suppalapati/java.txt"*
*java_count = 0*

*log = Facter::Util::FileRead.read(logfile)*
*unless log.nil?*
* log.each_line do |line|*
*  if line.include?('/java')*
*  java_count += 1*
* java_path = line.split(/ /)[0]*
*#if line.include?("java version")*
* #stdin,stdout,stderr = Open3.popen3(line)*
*  #java_version = stderr.readlines[0].split(/"/)[1]*
*  Facter.add("java_version#{java_count}_path") do*
*     setcode do*
*        java_path*
*       end*
*      end*
*     end*
*     end*
*    # end*
*  Facter.add("java_location_count") do*
*    setcode do*
*      java_count*
*     end*
*    end*
*    end*
*    #end*
*#Facter.add("java_version#{java_count}") do*
* #     setcode do*
*  #        java_version*
*   #     end*
*    #    end*
*     #  end*

Here is my java facts
java_version10_path => 
/opt/apps/tmp/install.dir.24660/Linux/resource/jre/bin/java
java_version11_path => 
/opt/apps/tmp/install.dir.2499/Linux/resource/jre/bin/java
java_version12_path => 
/opt/apps/tmp/install.dir.6157/Linux/resource/jre/bin/java
java_version13_path => 
/opt/apps/tmp/install.dir.27976/Linux/resource/jre/bin/java

*How can i get java version? is there i can another if statement if 
line.include?('java version') or i can use use another string*

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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/7db47cb9-5397-441c-911f-9f0c46f007b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to