[chef] Searching a data bag


Chronological Thread 
  • From: ItsMikeE < >
  • To:
  • Subject: [chef] Searching a data bag
  • Date: Tue, 5 Jul 2011 07:07:55 -0700 (PDT)

I have created a databag called demo_databag
I then loaded up a json file as detailed below:
{"id":"demo_value",
  "hosts":[
    {"host":"host0.pinnacle.co.uk", "ip":"3.2.3.4", "aliases":["host1"]},
    {"host":"host1.pinnacle.co.uk", "ip":"3.2.3.5", "aliases":["host2"]},
    {"host":"host2.pinnacle.co.uk", "ip":"3.2.3.6", "aliases":["host3"]},
    {"host":"host3.pinnacle.co.uk", "ip":"3.2.3.7", "aliases":["host4"]}
  ]
}

In my recipe I am doing a search on the databag
I will probably use a node attribute for the search, but for the moment it is
just a string

I have tried:

  allhosts = search("demo_databag", "id:demo_value")

  searchstring = "id:demo_value" 
  allhosts = search("demo_databag", searchstring)

  allhosts = search("demo_databag", "demo_value)

In all cases I get a return code of 256 and the loop I have written to process
the values in the databag does not run

What am I doing wrong?


  • [chef] Searching a data bag, ItsMikeE, 07/05/2011

Archive powered by MHonArc 2.6.16.

§