Sorry,
Was trying something..
A clear snippet.
require 'facter'
Facter.add(:is_javaversion) do
setcode do
a = File.readlines('javaversion.txt').map { |x| x.chomp }.join
if Facter.value(:java_known_weblogic_version1) == a
true
else
false
end
end
end
On Thursday 20 November 2014 09:45 AM, Ashish Jaiswal wrote:
Hi,
Just a quick hack.
<!-- HTML generated using hilite.me --><div style="background:
#ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em
.1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height:
125%"> javaversion.rb
<span style="color: #00aaaa">require</span> <span style="color:
#aa5500">'facter'</span>
<span style="color: #aa0000">Facter</span>.add(<span style="color:
#0000aa">:is_javaversion</span>) <span style="color: #0000aa">do</span>
setcode <span style="color: #0000aa">do</span>
a = <span style="color:
#aa0000">File</span>.readlines(<span style="color:
#aa5500">'javaversion.txt'</span>).map { |x| x.chomp }.join
<span style="color: #0000aa">if</span> <span style="color:
#aa0000">Facter</span>.value(<span style="color:
#0000aa">:java_known_weblogic_version1</span>) == a
<span style="color: #0000aa">true</span>
<span style="color: #0000aa">else</span>
<span style="color: #0000aa">false</span>
<span style="color: #0000aa">end</span>
<span style="color: #0000aa">end</span>
<span style="color: #0000aa">end</span>
</pre></div>
On Wednesday 19 November 2014 10:06 PM, Spriya wrote:
Hi,
Yes .txt can be on agent.
The fact is already displayed on agent
Let me know
On Wednesday, November 19, 2014 8:57:17 AM UTC-5, Felix.Frank wrote:
Hi,
so the .txt file is on the agent?
Where is the fact from?
On 11/18/2014 02:36 PM, Spriya wrote:
> Hi,
>
> I have a requirement how to compare facts using variables which
are in a
> txt file
>
> For example i have a facts
> java_known_weblogic_version1 1.7.0_72
>
>
> I have txt file javaversion.txt file
> 1.7.0_72
>
> I want to comapare these files java_known_weblogic_version !=
> javaversion.txt file?
>
> How can i do that
>
> Anyone please help me
>
> Thank you
--
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
<mailto:puppet-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/65a00b97-982c-4de7-af48-39f0839095c8%40googlegroups.com
<https://groups.google.com/d/msgid/puppet-users/65a00b97-982c-4de7-af48-39f0839095c8%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/546D6B6A.1050707%40gmail.com.
For more options, visit https://groups.google.com/d/optout.