From 500682e4f6f83729018a37ea4f8fc3beef031a5a Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 26 Sep 2017 16:13:35 +0200 Subject: [PATCH] ohai: Skip saving etc/passwd entries (bsc#1058017) These can be a really large subtree that prevents indexing, so don't save it. --- chef/cookbooks/ohai/recipes/default.rb | 9 + .../default/crowbar_join.suse.sh.erb | 3 + .../offline_chef/node_admin.crowbar.com.json | 506 ------------------ 3 files changed, 12 insertions(+), 506 deletions(-) diff --git a/chef/cookbooks/ohai/recipes/default.rb b/chef/cookbooks/ohai/recipes/default.rb index 7e7a0c6c89..cead8d3464 100644 --- a/chef/cookbooks/ohai/recipes/default.rb +++ b/chef/cookbooks/ohai/recipes/default.rb @@ -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 diff --git a/chef/cookbooks/provisioner/templates/default/crowbar_join.suse.sh.erb b/chef/cookbooks/provisioner/templates/default/crowbar_join.suse.sh.erb index 128e10a1ce..a73dcc5635 100644 --- a/chef/cookbooks/provisioner/templates/default/crowbar_join.suse.sh.erb +++ b/chef/cookbooks/provisioner/templates/default/crowbar_join.suse.sh.erb @@ -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() { diff --git a/crowbar_framework/spec/fixtures/offline_chef/node_admin.crowbar.com.json b/crowbar_framework/spec/fixtures/offline_chef/node_admin.crowbar.com.json index 4c6d17f4fc..77463d07e2 100644 --- a/crowbar_framework/spec/fixtures/offline_chef/node_admin.crowbar.com.json +++ b/crowbar_framework/spec/fixtures/offline_chef/node_admin.crowbar.com.json @@ -1377,512 +1377,6 @@ "deployer-client", "crowbar" ], - "etc": { - "group": { - "lpadmin": { - "gid": 107, - "members": [ - "crowbar" - ] - }, - "utmp": { - "gid": 43, - "members": [ - - ] - }, - "dip": { - "gid": 30, - "members": [ - - ] - }, - "audio": { - "gid": 29, - "members": [ - - ] - }, - "uucp": { - "gid": 10, - "members": [ - - ] - }, - "sambashare": { - "gid": 108, - "members": [ - "crowbar" - ] - }, - "syslog": { - "gid": 103, - "members": [ - - ] - }, - "nogroup": { - "gid": 65534, - "members": [ - - ] - }, - "games": { - "gid": 60, - "members": [ - - ] - }, - "list": { - "gid": 38, - "members": [ - - ] - }, - "kmem": { - "gid": 15, - "members": [ - - ] - }, - "shadow": { - "gid": 42, - "members": [ - - ] - }, - "sudo": { - "gid": 27, - "members": [ - - ] - }, - "sys": { - "gid": 3, - "members": [ - - ] - }, - "couchdb": { - "gid": 111, - "members": [ - - ] - }, - "tty": { - "gid": 5, - "members": [ - - ] - }, - "admin": { - "gid": 109, - "members": [ - "crowbar" - ] - }, - "libuuid": { - "gid": 101, - "members": [ - - ] - }, - "staff": { - "gid": 50, - "members": [ - - ] - }, - "src": { - "gid": 40, - "members": [ - - ] - }, - "irc": { - "gid": 39, - "members": [ - - ] - }, - "backup": { - "gid": 34, - "members": [ - - ] - }, - "www-data": { - "gid": 33, - "members": [ - - ] - }, - "tape": { - "gid": 26, - "members": [ - - ] - }, - "man": { - "gid": 12, - "members": [ - - ] - }, - "lp": { - "gid": 7, - "members": [ - - ] - }, - "fuse": { - "gid": 104, - "members": [ - - ] - }, - "proxy": { - "gid": 13, - "members": [ - - ] - }, - "mail": { - "gid": 8, - "members": [ - - ] - }, - "chef": { - "gid": 113, - "members": [ - - ] - }, - "operator": { - "gid": 37, - "members": [ - - ] - }, - "cdrom": { - "gid": 24, - "members": [ - "crowbar" - ] - }, - "root": { - "gid": 0, - "members": [ - - ] - }, - "plugdev": { - "gid": 46, - "members": [ - "crowbar" - ] - }, - "sasl": { - "gid": 45, - "members": [ - - ] - }, - "video": { - "gid": 44, - "members": [ - - ] - }, - "fax": { - "gid": 21, - "members": [ - - ] - }, - "bin": { - "gid": 2, - "members": [ - - ] - }, - "ssh": { - "gid": 106, - "members": [ - - ] - }, - "users": { - "gid": 100, - "members": [ - - ] - }, - "news": { - "gid": 9, - "members": [ - - ] - }, - "daemon": { - "gid": 1, - "members": [ - - ] - }, - "mlocate": { - "gid": 105, - "members": [ - - ] - }, - "crontab": { - "gid": 102, - "members": [ - - ] - }, - "gnats": { - "gid": 41, - "members": [ - - ] - }, - "floppy": { - "gid": 25, - "members": [ - - ] - }, - "voice": { - "gid": 22, - "members": [ - - ] - }, - "disk": { - "gid": 6, - "members": [ - - ] - }, - "jetty": { - "gid": 112, - "members": [ - - ] - }, - "rabbitmq": { - "gid": 110, - "members": [ - - ] - }, - "crowbar": { - "gid": 1000, - "members": [ - - ] - }, - "dialout": { - "gid": 20, - "members": [ - "crowbar" - ] - }, - "adm": { - "gid": 4, - "members": [ - "crowbar" - ] - } - }, - "passwd": { - "uucp": { - "dir": "\/var\/spool\/uucp", - "gecos": "uucp", - "gid": 10, - "uid": 10, - "shell": "\/bin\/sh" - }, - "syslog": { - "dir": "\/home\/syslog", - "gecos": "", - "gid": 103, - "uid": 101, - "shell": "\/bin\/false" - }, - "list": { - "dir": "\/var\/list", - "gecos": "Mailing List Manager", - "gid": 38, - "uid": 38, - "shell": "\/bin\/sh" - }, - "games": { - "dir": "\/usr\/games", - "gecos": "games", - "gid": 60, - "uid": 5, - "shell": "\/bin\/sh" - }, - "sys": { - "dir": "\/dev", - "gecos": "sys", - "gid": 3, - "uid": 3, - "shell": "\/bin\/sh" - }, - "couchdb": { - "dir": "\/var\/lib\/couchdb", - "gecos": "CouchDB Administrator,,,", - "gid": 111, - "uid": 104, - "shell": "\/bin\/bash" - }, - "nobody": { - "dir": "\/nonexistent", - "gecos": "nobody", - "gid": 65534, - "uid": 65534, - "shell": "\/bin\/sh" - }, - "libuuid": { - "dir": "\/var\/lib\/libuuid", - "gecos": "", - "gid": 101, - "uid": 100, - "shell": "\/bin\/sh" - }, - "irc": { - "dir": "\/var\/run\/ircd", - "gecos": "ircd", - "gid": 39, - "uid": 39, - "shell": "\/bin\/sh" - }, - "backup": { - "dir": "\/var\/backups", - "gecos": "backup", - "gid": 34, - "uid": 34, - "shell": "\/bin\/sh" - }, - "www-data": { - "dir": "\/var\/www", - "gecos": "www-data", - "gid": 33, - "uid": 33, - "shell": "\/bin\/sh" - }, - "lp": { - "dir": "\/var\/spool\/lpd", - "gecos": "lp", - "gid": 7, - "uid": 7, - "shell": "\/bin\/sh" - }, - "man": { - "dir": "\/var\/cache\/man", - "gecos": "man", - "gid": 12, - "uid": 6, - "shell": "\/bin\/sh" - }, - "proxy": { - "dir": "\/bin", - "gecos": "proxy", - "gid": 13, - "uid": 13, - "shell": "\/bin\/sh" - }, - "mail": { - "dir": "\/var\/mail", - "gecos": "mail", - "gid": 8, - "uid": 8, - "shell": "\/bin\/sh" - }, - "sync": { - "dir": "\/bin", - "gecos": "sync", - "gid": 65534, - "uid": 4, - "shell": "\/bin\/sync" - }, - "chef": { - "dir": "\/var\/lib\/chef", - "gecos": "Chef Daemon,,,", - "gid": 113, - "uid": 106, - "shell": "\/bin\/false" - }, - "sshd": { - "dir": "\/var\/run\/sshd", - "gecos": "", - "gid": 65534, - "uid": 102, - "shell": "\/usr\/sbin\/nologin" - }, - "root": { - "dir": "\/root", - "gecos": "root", - "gid": 0, - "uid": 0, - "shell": "\/bin\/bash" - }, - "bin": { - "dir": "\/bin", - "gecos": "bin", - "gid": 2, - "uid": 2, - "shell": "\/bin\/sh" - }, - "news": { - "dir": "\/var\/spool\/news", - "gecos": "news", - "gid": 9, - "uid": 9, - "shell": "\/bin\/sh" - }, - "daemon": { - "dir": "\/usr\/sbin", - "gecos": "daemon", - "gid": 1, - "uid": 1, - "shell": "\/bin\/sh" - }, - "gnats": { - "dir": "\/var\/lib\/gnats", - "gecos": "Gnats Bug-Reporting System (admin)", - "gid": 41, - "uid": 41, - "shell": "\/bin\/sh" - }, - "jetty": { - "dir": "\/usr\/share\/jetty", - "gecos": "", - "gid": 112, - "uid": 105, - "shell": "\/bin\/false" - }, - "rabbitmq": { - "dir": "\/var\/lib\/rabbitmq", - "gecos": "RabbitMQ messaging server,,,", - "gid": 110, - "uid": 103, - "shell": "\/bin\/false" - }, - "crowbar": { - "dir": "\/home\/crowbar", - "gecos": "Admin Account,,,", - "gid": 1000, - "uid": 1000, - "shell": "\/bin\/bash" - } - } - }, "macaddress": "00:0c:29:d2:45:69", "crowbar": { "detected": {