Query for knife exec

Hello folks,

Able to do this:
-knife exec -E “nodes.all {|n| puts n}” //SHOW

Notable to do this:
-knife exec -E “data_bag_item(‘build’, ‘var’) {|n| puts n}”
-knife exec -E “data_bag_item(‘build’, ‘var’).all {|n| puts n}” // ERROR
-knife exec -E “data_bag(‘build’). {|n| puts n}”
-knife exec -E “data_bag(‘build’).all {|n| puts n}” // ERROR

any reason?

How can i list data bag content by knife exec.


Regards
Mayank Verma

What’s wrong with “knife data bag show build var”?

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com | (512) 731-2218
Twitter, IRC, GitHub: mattray


From: mayank verma [mayank.023@gmail.com]
Sent: Thursday, February 14, 2013 2:28 PM
To: chef@lists.opscode.com
Subject: [chef] Query for knife exec

Hello folks,

Able to do this:
-knife exec -E “nodes.all {|n| puts n}” //SHOW

Notable to do this:
-knife exec -E “data_bag_item(‘build’, ‘var’) {|n| puts n}”
-knife exec -E “data_bag_item(‘build’, ‘var’).all {|n| puts n}” // ERROR
-knife exec -E “data_bag(‘build’). {|n| puts n}”
-knife exec -E “data_bag(‘build’).all {|n| puts n}” // ERROR

any reason?

How can i list data bag content by knife exec.


Regards
Mayank Verma

On Feb 14, 2013, at 12:28 PM, mayank verma wrote:

Hello folks,

Able to do this:
-knife exec -E "nodes.all {|n| puts n}" //SHOW

Notable to do this:
-knife exec -E "data_bag_item('build', 'var') {|n| puts n}"
-knife exec -E "data_bag_item('build', 'var').all {|n| puts n}" // ERROR
-knife exec -E "data_bag('build'). {|n| puts n}"
-knife exec -E "data_bag('build').all {|n| puts n}" // ERROR

any reason?

How can i list data bag content by knife exec.

pp api.get("data")
pp api.get("data/fruit")
pp api.get("data/fruit/citrus")

after getting the item in data_bag, i hv to edit the values for attribute.
thats why i am using "knife exec" in place of show or search.

On Fri, Feb 15, 2013 at 3:19 AM, Seth Falcon seth@opscode.com wrote:

On Feb 14, 2013, at 12:28 PM, mayank verma wrote:

Hello folks,

Able to do this:
-knife exec -E "nodes.all {|n| puts n}" //SHOW

Notable to do this:
-knife exec -E "data_bag_item('build', 'var') {|n| puts n}"
-knife exec -E "data_bag_item('build', 'var').all {|n| puts n}" // ERROR
-knife exec -E "data_bag('build'). {|n| puts n}"
-knife exec -E "data_bag('build').all {|n| puts n}" //
ERROR

any reason?

How can i list data bag content by knife exec.

pp api.get("data")
pp api.get("data/fruit")
pp api.get("data/fruit/citrus")

--
Regards
Mayank Verma
mob: 7829775425
RHCE

If you want to use the more sugary chef-shell syntax, it's something like this:

databags("cookbook-up-log").show("20130210191615") 

You can access some docs via chef-shell (nee shef) by running the help command; for in-depth help on a topic, use something like help :databags.

--
Daniel DeLeo

On Thursday, February 14, 2013 at 10:06 PM, mayank verma wrote:

after getting the item in data_bag, i hv to edit the values for attribute.
thats why i am using "knife exec" in place of show or search.

On Fri, Feb 15, 2013 at 3:19 AM, Seth Falcon <seth@opscode.com (mailto:seth@opscode.com)> wrote:

On Feb 14, 2013, at 12:28 PM, mayank verma wrote:

Hello folks,

Able to do this:
-knife exec -E "nodes.all {|n| puts n}" //SHOW

Notable to do this:
-knife exec -E "data_bag_item('build', 'var') {|n| puts n}"
-knife exec -E "data_bag_item('build', 'var').all {|n| puts n}" // ERROR
-knife exec -E "data_bag('build'). {|n| puts n}"
-knife exec -E "data_bag('build').all {|n| puts n}" // ERROR

any reason?

How can i list data bag content by knife exec.

pp api.get("data")
pp api.get("data/fruit")
pp api.get("data/fruit/citrus")

--
Regards
Mayank Verma
mob: 7829775425
RHCE