Skip to content

Commit

Permalink
ohai: Skip saving etc/passwd entries (bsc#1058017)
Browse files Browse the repository at this point in the history
These can be a really large subtree that prevents indexing, so
don't save it.
  • Loading branch information
dirkmueller committed Sep 26, 2017
1 parent 9bb08f0 commit 500682e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 506 deletions.
9 changes: 9 additions & 0 deletions chef/cookbooks/ohai/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@
# drop relatively big attributes that we know we won't use
node.automatic_attrs["kernel"].delete("modules")

# drop the collected Etc.passwd entries, these can be huge
if node.automatic_attrs.key?("etc") && node.automatic_attrs["etc"].key?("passwd")
node.automatic_attrs["etc"].delete("passwd")
end

# Temporary workaround for nova cookbook dependency, remove after 2017/12
node.automatic_attrs["etc"] ||= Mash.new
node.automatic_attrs["etc"]["passwd"] ||= Mash.new

# duplicates the cpu data
node.automatic_attrs["dmi"].delete("processor")
# when looking at cpu data, we're happy looking at the first one only; removing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ EOF
line='Encoding.default_external = Encoding::UTF_8 if RUBY_VERSION > "1.9"'
grep -q -e "^$line$" /etc/chef/client.rb || echo "$line" >> /etc/chef/client.rb

# work around: avoid excessively large node attributes due to large number of accounts
line='Ohai::Config[:disabled_plugins] << "passwd"'
grep -q -e "^$line$" /etc/chef/client.rb || echo "$line" >> /etc/chef/client.rb
}

do_chef_client_after_setup() {
Expand Down
Loading

0 comments on commit 500682e

Please sign in to comment.