salopensource / sal-scripts

Apache License 2.0
23 stars 31 forks source link

ohai - respect organizations client.rb settings #29

Closed erikng closed 6 years ago

erikng commented 6 years ago

This changes the behavior of Ohai to match the settings honored in a full-chef run.

Right now, ohai will collect the full set of plugins. If you are blocking (say passwords) this will come in.

This also fixes an issue I have found with 10.13.4b3, in where ohai is causing macOS to kernel panic. This fix, in conjunction to a client.rb fix will allow munki/sal to run without kernel panicking a 10.13.4b3 VM.

For people watching the fix in your client.rb file is this: ohai.disabled_plugins = [:CPU]

A new key is available: OhaiClientConfigPath

If this is passed, it will use whatever path someone wants, otherwise it defaults to /private/etc/chef/client.rb. If this path doesn't exist, it will use the current ohai behavior.

johnnyramos commented 6 years ago

Will it handle error if config file does not exist?

erikng commented 6 years ago

No of course not. :)

grahamgilbert commented 6 years ago

If I understand this right, you are assuming a file to be present there. How does ohai deal with the missing file? If it pukes, you should test for the file and adjust the command accordingly.

erikng commented 6 years ago

I've addressed all the concerns and added a new sal preference = OhaiClientConfigPath.

If this is passed, it will use whatever path someone wants, otherwise it defaults to /private/etc/chef/client.rb. If this path doesn't exist, it will use the current ohai behavior.