0
votes

I am running the below command in powershell to perform chef operations.

chef-client -o 'recipe[cookbook]' -j attributes-file.json

Contents of the json file is as below

{
    "param1": {
               "param2":["value1","value2","value3"]
     }
}

When we run the chef-client, for the first time, there attributes are set in the chef-node and are successful. But we run the same command for the second time with different "param2" contents, eg. "param2":["value4","value5"], it still picks up ["value1","value2","value3"] as the value.

How do we override the existing values in chef-client? and/or unset the node values, after execution?

Please Note: we cannot execute knife commands as the chef is run remotely triggered via Cloudify.

3
Are you sure that's the command you are using, specifically -o vs. -r? - coderanger

3 Answers

0
votes

when you override the runlist with option -o node attribute will not be updated.

please check -o RUN_LIST_ITEM in the below link

https://docs.chef.io/ctl_chef_client.html

0
votes

As per Chef-client documentation, "-j PATH, --json-attributes PATH" The path to a file that contains JSON data. Used to setup **

the first client run

**. For all the future runs with option -i the attributes are expected to be **

persisted in the chef-server

**.

0
votes

We arrived at a work around for this issue. At the end of recipe execution, we are setting the node variables to an empty array [].