Using databag in recipe


Hello experts,

I have a databag named "os" and here is the structure of it.

"id": "config",
"6.3": {
"ver": "6.3.00",
"kernel": "2.6.32-279.el6.x86_64",
"date": "2012-11"
"6.6": {
"ver": "6.6.00",
"kernel": "2.6.32-504.el6.x86_64",
"date": "2015-06"
"6.8": {
"ver": "6.8.00",
"kernel": "2.6.32-642.15.1.el6.x86_64",
"date": "2017-03"

I am trying to acheive following things.

If a node kernel matches with databag kernel it append a file with following information. For example on a given node if the installed kernel is 2.6.32-504.el6.x86_64 than,
following line will be added to the file.


If installed kernel didn't match with kernels in the databag, the file will be appened as below