Fwd: Search in environment file?

Hi all,

Is there a way to run a search call within an environment file(ruby version not json)? If anyone can point me toward a doc or a snippet it would be a huge help to me.

I know this is not a great or recommended way to do this, but I’m stuck unwinding a pre-existing chef setup, and it’s getting tedious to add each entry manually when we’re adding 30-40 nodes to a cluster at a time.

Thanks for any help you can give,
Greg

Sent by magical ones and zeros

you can do it, but it will be hack. The environment file thats being
uploaded to chef server is not in ruby, its infact a serializable file
(json), ruby -> json conversion is done by knife from the triggering point
(workstation from where knife environment from file is being used).
now the hack:

q = Chef::Search::Query.new
nodes = q.search(:node, ‘foo:bar’ )

we can provide more detailed example if you can tell us exactly what search
you want…

hth

On Wed, Jun 24, 2015 at 10:12 AM, Gregory Patmore gregorypatmore@gmail.com
wrote:

Hi all,

Is there a way to run a search call within an environment file(ruby
version not json)? If anyone can point me toward a doc or a snippet it
would be a huge help to me.

I know this is not a great or recommended way to do this, but I’m stuck
unwinding a pre-existing chef setup, and it’s getting tedious to add each
entry manually when we’re adding 30-40 nodes to a cluster at a time.

Thanks for any help you can give,
Greg

Sent by magical ones and zeros