Skip to content

Commit

Permalink
Assume all nodes matching the search query are valid nodes
Browse files Browse the repository at this point in the history
Previously we checked if nodes were matching search query AND had an existing chef key.
This patch assumes that all nodes have exiting chef keys.

Experience I have with chef is that nodes without proper keys are bugs and needs
to be fixed anyway (either have a key or be removed).

This patch allows to make usage of --clean-unknown-clients much faster (avoid
querying chef-server for each node) especially on secrets encrypted for many
nodes (where search query time is small compared to querying all clients)

Change-Id: If45da1faec5c36026a75762afe4bad08cab97f64
Signed-off-by: Grégoire Seux <g.seux@criteo.com>
  • Loading branch information
kamaradclimber committed Apr 26, 2017
1 parent ddb3700 commit 173093f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/chef-vault/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -411,15 +411,11 @@ def remove_unknown_nodes

# checks if a node exists on the Chef server by performing
# a search against the node index. If the search returns no
# results, the node does not exist. If it does return results,
# check if there is a matching client
# results, the node does not exist.
# @param nodename [String] the name of the node
# @return [Boolean] whether the node exists or not
def node_exists?(nodename)
# if we don't have a client it really doesn't matter if we have a node.
if client_exists?(nodename)
search_results.include?(nodename)
end
search_results.include?(nodename)
end

# checks if a client exists on the Chef server. If we get back
Expand Down

0 comments on commit 173093f

Please sign in to comment.