# Chef

**URL:** <https://discourse.chef.io/t/chef/5292>\
**Category:** Chef Infra (archive)\
**Created:** [May 12, 2014, 1:44pm UTC](https://discourse.chef.io/t/chef/5292 "2014-05-12T13:44:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Indra\_k](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@Indra\_k](https://discourse.chef.io/u/Indra_k)\
**Post date:** [May 12, 2014, 1:44pm UTC](https://discourse.chef.io/t/chef/5292/1 "2014-05-12T13:44:26Z")

</div>

Hi,

```
I am working in chef.My queries are:::::::::::

	  a) when iam running a chef-client in a target node and

```

passing attribute values in a json file for overriding like:

```
	   chef-client -j sample.json

```

here sample.json is something an attribute which we need to override in our  
recipe .Its working fine

But my question is Is this possible to run chef-client json attributes by  
passing as a json runtime parameters without creating attributes in a json file  
why am asking is if we want to pass a single attribute we need to create a json  
file and need to pass those just for a single [attributes.so](http://attributes.so) only asking is  
there any option in that for running a chef client override attributes as a  
runtime parameters.

Thanks,  
Indra

---

<div class="post-metadata">

**Author:** ![Bryan\_McLellan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_mclellan/32/81_2.png) [@Bryan\_McLellan](https://discourse.chef.io/u/Bryan_McLellan)\
**Post date:** [May 12, 2014, 5:22pm UTC](https://discourse.chef.io/t/chef/5292/2 "2014-05-12T17:22:47Z")

</div>

On Mon, May 12, 2014 at 9:44 AM, [indra.k@cloudenablers.com](mailto:indra.k@cloudenablers.com) wrote:

> But my question is Is this possible to run chef-client json attributes by  
> passing as a json runtime parameters without creating attributes in a json file  
> why am asking is if we want to pass a single attribute we need to create a json  
> file and need to pass those just for a single attributes.so only asking is  
> there any option in that for running a chef client override attributes as a  
> runtime parameters.

[https://tickets.opscode.com/browse/CHEF-1918](https://tickets.opscode.com/browse/CHEF-1918)

No, you cannot pass JSON on the command line. CHEF-1918 represents the  
feature request.

I think this was originally the design because it would be a bit of a  
complicated syntax to type and quote, so it wouldn't be easy to use,  
and making another syntax, e.g. foo=bar, baz[faz][jaz]=stuff, would  
also be complicated and probably limiting.

Is the attribute value that you're trying to pass changing often? Is  
it something you could dynamically configure from other information?

If it's something only a human could provide that always goes into the  
same attribute, maybe read it out of an environment variable in a  
recipe and run like this:

MY\_VALUE=bob chef-client -r recipe[my\_thing]

Bryan

---

<div class="post-metadata">

**Author:** ![Cassiano\_Leal](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/cassiano_leal/32/86_2.png) [@Cassiano\_Leal](https://discourse.chef.io/u/Cassiano_Leal)\
**Post date:** [May 12, 2014, 6:22pm UTC](https://discourse.chef.io/t/chef/5292/3 "2014-05-12T18:22:30Z")

</div>

You can actually pass the JSON without creating it in a file using a bit of shell-fu.

See my answer on StackOverflow here:

> <https://stackoverflow.com/questions/21986477/how-to-pass-attributes-in-chef-client-without-json-file/21987638#21987638>

--  
Cassiano Leal

On Monday, May 12, 2014 at 18:22, Bryan McLellan wrote:

> On Mon, May 12, 2014 at 9:44 AM, \<[indra.k@cloudenablers.com](mailto:indra.k@cloudenablers.com) ([mailto:indra.k@cloudenablers.com](mailto:indra.k@cloudenablers.com))\> wrote:
> 
> > But my question is Is this possible to run chef-client json attributes by  
> > passing as a json runtime parameters without creating attributes in a json file  
> > why am asking is if we want to pass a single attribute we need to create a json  
> > file and need to pass those just for a single attributes.so only asking is  
> > there any option in that for running a chef client override attributes as a  
> > runtime parameters.
> 
> [https://tickets.opscode.com/browse/CHEF-1918](https://tickets.opscode.com/browse/CHEF-1918)
> 
> No, you cannot pass JSON on the command line. CHEF-1918 represents the  
> feature request.
> 
> I think this was originally the design because it would be a bit of a  
> complicated syntax to type and quote, so it wouldn't be easy to use,  
> and making another syntax, e.g. foo=bar, baz[faz][jaz]=stuff, would  
> also be complicated and probably limiting.
> 
> Is the attribute value that you're trying to pass changing often? Is  
> it something you could dynamically configure from other information?
> 
> If it's something only a human could provide that always goes into the  
> same attribute, maybe read it out of an environment variable in a  
> recipe and run like this:
> 
> MY\_VALUE=bob chef-client -r recipe[my\_thing]
> 
> Bryan
