chef / chef/chef-server

Add ability to specify top level node attributes in Chef Search

Open
#303 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: opscode-erchef Status: move to jira Status: To be prioritized Triage: Confirmed Type: Enhancement
Dominant language
Erlang
Stars
303
Forks
211
Avg merge
1d 8h
Merged PRs (30d)
5

Description

Customers want to be able to specify top level attributes in Chef Search to avoid the problems caused by extracting nested fields to the top level.

When nested fields are present in a JSON structure, the chef-client [actually opscode-expander right?] will extract those nested fields to the top-level, flattening them into compound fields that support wildcard search patterns.

Some very important attributes are at the top level such as chef_environment. Customers have cookbooks or other tools that rely on Chef Search to return all nodes in a particular chef_environment but all it takes to cause unexpected results (and a production outage) is having another chef_environment attribute with a different value nested anywhere at all in the node data.

I discussed this briefly with one of the developers and thought it could be possible (maybe not even hard) to enable this functionality for users but that a feature request for it would likely get triaged as a low priority. I would like to see this kind of improvement in reliability be made a much higher priority. Especially if it isn't even that hard to do.

I've seen time and time again that two separate Chef Server features can give completely correct results and yet cause customers serious trouble when those results aren't at all what they expected. The two features are Cookbook Depsolver and Chef Search. Currently all we can say is the server is "right" even though you're not getting what you expect. And then we have to train the customer to learn how to do their best to avoid these problems in the future.

I love the direction Policyfiles is taking to make it easier for customers to explicitly declare what set of recipes will be run on a node ahead of time rather than being bitten by the complexity of cookbook depsolving during a deploy. I think adding the ability to specify top level attributes in a Chef Search would be another great win in the battle to make things more sane for customers.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points; start by locating Chef Search's handling of nested-field extraction and node attribute queries. Clarify the user-facing way to specify top-level attributes and the expected behavior when nested values conflict, then add coverage showing that searches use only the specified top-level values.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.