Skip to content

Commit

Permalink
Merge pull request #1340 from dirkmueller/skip_passwd
Browse files Browse the repository at this point in the history
ohai: Skip saving etc/passwd entries (bsc#1058017)
  • Loading branch information
dirkmueller authored Sep 27, 2017
2 parents 9bb08f0 + 500682e commit 264b1f1
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 264b1f1

Please sign in to comment.