-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get and put only certain fields from node #203
Comments
@rejo-oommen There's nothing in go-chef/chef that allows for retrieving partial information from a node. I looked through the er-chef API code. I'm pretty sure no option exists there to get the node data without the automatic attributes. Sorry that's not more help, |
Thank You for the response @MarkGibbons . I don't see the option in the chef server api too. |
You can set: The json generated and sent with the PUT request to the api ignores the empty AutomaticAttributes field. The Chef Server however sets the automatic attributes for the node to nil in this case. So, you can do that if you don't mind wiping out the values. The next chef-client run will repopulate the values. |
Ok. I would need to evaluate if I can afford making it nil. Was basically looking at skipping that attribute in PUT. Anyways thanks for clarifying. |
good luck. |
Hi @RejoOommen |
@MarkGibbons Yes, wanted to check if I could do something similar to the example given below(using knife ) which I believe will avoid the node PUT call thereby not touching the other parameters for my current use case. Add a role to a node runlist Remove a role from a node runlist |
knife node add and remove do a get and put under the covers. When you make a change to the run_list knife first loads the node then does a node.save which is in essence a put. If you want to use the API. get the node and populate a node strucuture Set the automatic attributes to nil first if you want to eliminate some of the data transfer back. I don't see any other options in the server api. That's what knife does too. |
Currently the get node(Nodes.Get) / put node(Nodes.Put) call gets and puts the complete node struct in json format from and to the chef server.
I have noticed that the get node brings in a lot of data, around 4000+ lines for my environment for me to update just one field. Was looking at an efficient way of doing it by getting only specific data.
Example Use Case:
Is there a something where I could get only certain field like name and RunList only and update only the RunList field and put it back to the chef server
I looked up, but wasnt able to find something to do this, if already present. Would appreciate help on this.
The text was updated successfully, but these errors were encountered: