Hi, I tried that also whether the fact is returing nil or by writing into separate facts
Here is the code: Facter.add("java_foundversion#{java_count}_foundversion") do setcode do java_version[1] end end #end #end #end #end Facter.add("java_foundversion#{java_count}_path") do setcode do java_path end end end end My facts java_foundversion1_foundversion => 1.7.0_65 java_foundversion1_path => /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/bin/java java_foundversion2_foundversion => 1.6.0_32 java_foundversion2_path => /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java java_foundversion3_foundversion => 1.6.0_43 java_foundversion3_path => /opt/oracle/agent12c/core/12.1.0.4.0/jdk/bin/java But when i am concatenating the java_path is not returning. Let me know your thoughts On Wednesday, November 26, 2014 1:57:23 PM UTC-5, Zachary Stern wrote: > > If that's happening, then one of the facts must be returning nil. > > On Wed, Nov 26, 2014 at 10:25 AM, Spriya <supriya.u...@gmail.com > <javascript:>> wrote: > >> Hi, >> >> When i am concatenating using your method. Its only returning one values. >> It should have version in front of path >> >> Facter.add("java_foundversion#{java_count}_foundversion#{java_count}_path") >> do >> setcode do >> java_version[1] + java_path >> end >> end >> >> >> The output of facts >> /opt/puppet/bin/facter -p | grep -i java_* java_foundversion1_path >> => /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/bin/java >> java_foundversion2_path => >> /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java >> java_foundversion3_path => >> /opt/oracle/agent12c/core/12.1.0.4.0/jdk/bin/java >> java_foundversion4_path => >> /opt/oracle/agent12c/core/12.1.0.4.0/jdk/jre/bin/java >> java_foundversion5_path => /opt/itm/v6.2.2/JRE/lx8266/bin/java >> java_foundversion6_path => /u01/java/jdk1.7.0_72/jre/bin/java >> java_foundversion7_path => /u01/java/jdk1.7.0_72/bin/java >> java_foundversion8_path => /u01/java/jdk1.7.0_65/jre/bin/java >> java_foundversion9_path => /u01/java/jdk1.7.0_65/bin/java >> >> >> >> >> On Friday, November 21, 2014 1:41:16 PM UTC-5, Zachary Stern wrote: >> >>> If you have a fact called factA and a fact called factB, and you need >>> factC to be a combination of both values, sure, that can be done. >>> >>> I don't know what version of Facter you're using, but if you're using PE >>> 3.7 + Facter 2.2.0, you can simply use Facter.value. >>> >>> E.g: >>> >>> Facter.add(:factC) do >>> setcode do >>> factC = "#{Facter.value('factA')}#{Facter.value('factB')}" >>> factC >>> end >>> end >>> >>> That would return a factC that was the combined values of factA and >>> factB. >>> >>> For more, see the docs https://docs.puppetlabs. >>> com/facter/2.2/custom_facts.html#using-other-facts >>> >>> You could of course just combine the fact values in your puppet code as >>> well, if that's appropriate... >>> >>> `$value = "${one}${two}"` is perfectly valid Puppet code. >>> >>> On Friday, November 21, 2014 6:40:44 AM UTC-8, Spriya wrote: >>>> >>>> >>>> Hi, >>>> >>>> The purpose is i want to compare using the value to a txt file which >>>> contains 1.7.0_72//u01/java/jdk1.7.0_72/jre/bin/java this reason for >>>> that i want to concatenate. >>>> >>>> Let me know your thoughts >>>> On Friday, November 21, 2014 8:58:53 AM UTC-5, jcbollinger wrote: >>>>> >>>>> >>>>> >>>>> On Thursday, November 20, 2014 12:21:09 PM UTC-6, Spriya wrote: >>>>>> >>>>>> Hi , >>>>>> >>>>>> Is there any way to merge two facts into single facts. >>>>>> >>>>>> Here is my facts >>>>>> java_known_weblogic_version11.7.0_72java_known_weblogic_version1_path >>>>>> /u01/java/jdk1.7.0_72/jre/bin/java >>>>>> >>>>>> I want to merge these two facts into single one >>>>>> >>>>>> I mean >>>>>> >>>>>> java_known_weblogic_version1 = 1.7.0_72//u01/java/jdk1.7.0_ >>>>>> 72/jre/bin/java >>>>>> >>>>>> Like this >>>>>> >>>>>> Anyone please help me >>>>>> >>>>> >>>>> >>>>> In what context, for what purpose? >>>>> >>>>> Generally speaking, I'd say you should just concatenate the two fact >>>>> values in the scope where the aggregate value is wanted, as opposed to >>>>> modifying fact implementations to change what facter reports. Is that >>>>> unsuitable for some reason? >>>>> >>>>> >>>>> John >>>>> >>>>> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Puppet Users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/puppet-users/CgskLngu_yY/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> puppet-users...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/puppet-users/742fb742-5020-4cad-863a-aeaf05af1f34%40googlegroups.com >> >> <https://groups.google.com/d/msgid/puppet-users/742fb742-5020-4cad-863a-aeaf05af1f34%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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/fc2d86f6-e1c4-4c31-aeb6-8a3408a777d4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.