lundi 28 septembre 2020

Facing issue with createing one to one mapping in ruby

I want to parse 3 arrays in ruby. For example

Array1 =[server1, server2]
array2 = [server3, server4, server5]
array3 = [server6, server7, server8]

Here in my case length of array2 and array3 will be always same. I want to use this in cookbook to execute in server where i want to make one to one mapping with array2 and array3 and search only for that particular server only. For example if i am execting this on server7 then it will return server4 and server7 only from one to one mapping and always pick first value from array1.

I am using this logic to make one to one mapping

array1 = ['a1', 'a2', 'a3']
array2 = ['b1', 'b2', 'b3']
array1.zip(array2)

But not able to parse with hostname where my cookbook is executing.

Aucun commentaire:

Enregistrer un commentaire