Ask Your Question
0

is there a way to compare facts with all other facts

asked 2014-12-10 14:49:22 -0500

supriya gravatar image

Hi,

I have list of two different facts

javafoundversion1path1
javafoundversion2path2
javafoundversion3path3
javafoundversion4path4

and javaauthorizedversion1path1
java
authorizedversion2path2
javaauthorizedversion3path3
java
authorizedversion4path4

and i am trying to compare each facts with all facts i.e javafoundversion1path1 to all the list of javaauthorized*. And if it founds any facts equal to javafound1version1path. It should notify us.

For example : if $javafoundversion1path1 != ($javaauthversion2) or ($javaauthversion3) or ($java_authversion4) notify {'"the found version did not match in the list"}

Can we do that?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-12-10 21:45:34 -0500

GregLarkin gravatar image

There is an "in" operator in the Puppet DSL so you can check for set membership, if that helps: https://docs.puppetlabs.com/puppet/latest/reference/lang_expressions.html#in.

You might also want to code up a custom fact that performs these checks in Ruby code and then simply returns a true/false value that you use in your manifests.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-12-10 14:49:22 -0500

Seen: 37 times

Last updated: Dec 10 '14