On Wed, Oct 8, 2014 at 11:26 AM, Supriya Uppalapati <
supriya.uppalap...@gmail.com> wrote:

> 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 .
>
>
Can you provide more details about how it isn't  executing? Is it producing
an error? Are any of your facts showing up (java_version_count for
example)? Are you sure that you've put the custom fact file in the correct
location? Have you followed the guide at
https://docs.puppetlabs.com/facter/2.2/custom_facts.html for how to write
and use custom facts?


> 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 Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-dev/fe7859b3-2eac-4e9c-b495-d4e20dc6dac1%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-dev/fe7859b3-2eac-4e9c-b495-d4e20dc6dac1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Andrew Parker
a...@puppetlabs.com
Freenode: zaphod42
Twitter: @aparker42
Software Developer

*Join us at **PuppetConf 2014, **September 20-24 in San Francisco - *
www.puppetconf.com

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/CANhgQXuHw%2BVWX47Knw6tNeY2A0c0y5P%3DpRo1%2BWC5gK_ipvXh1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to