diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2020-10-14 11:43:38 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2020-10-14 11:43:38 -0700 |
commit | 6d351c90b22f804f5cbc00c43a10ca464397fbbd (patch) | |
tree | 9a49907ed38d96d090b9c8d235a78b790af47306 /lib/chef/client.rb | |
parent | 7ea5d629ed94da45ef41f98f102fb0bb7da95749 (diff) | |
download | chef-6d351c90b22f804f5cbc00c43a10ca464397fbbd.tar.gz |
Remote ohai support for chef-client
This replaces the existing hacked up platform detection via inspec
that was added to chef-client with proper support from ohai.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/client.rb')
-rw-r--r-- | lib/chef/client.rb | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb index 04d907634b..41e3846812 100644 --- a/lib/chef/client.rb +++ b/lib/chef/client.rb @@ -251,11 +251,7 @@ class Chef logger.debug("#{ChefUtils::Dist::Infra::CLIENT.capitalize} request_id: #{request_id}") ENV["PATH"] = ChefUtils::DSL::DefaultPaths.default_paths if Chef::Config[:enforce_default_paths] || Chef::Config[:enforce_path_sanity] - if Chef::Config.target_mode? - get_ohai_data_remotely - else - run_ohai - end + run_ohai unless Chef::Config[:solo_legacy_mode] register @@ -576,32 +572,6 @@ class Chef end # - # Populate the minimal ohai attributes defined in #run_ohai with data train collects. - # - # Eventually ohai may support colleciton of data. - # - def get_ohai_data_remotely - ohai.data[:fqdn] = if transport_connection.respond_to?(:hostname) - transport_connection.hostname - else - Chef::Config[:target_mode][:host] - end - if transport_connection.respond_to?(:os) - ohai.data[:platform] = transport_connection.os.name - ohai.data[:platform_version] = transport_connection.os.release - ohai.data[:os] = transport_connection.os.family_hierarchy[1] - ohai.data[:platform_family] = transport_connection.os.family - end - # train does not collect these specifically - # ohai.data[:machinename] = nil - # ohai.data[:hostname] = nil - # ohai.data[:os_version] = nil # kernel version - - ohai.data[:ohai_time] = Time.now.to_f - events.ohai_completed(node) - end - - # # Run ohai plugins. Runs all ohai plugins unless minimal_ohai is specified. # # Sends the ohai_completed event when finished. @@ -613,6 +583,7 @@ class Chef # def run_ohai filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version ohai_time os os_version init_package} : nil + ohai.transport_connection = transport_connection if Chef::Config.target_mode? ohai.all_plugins(filter) events.ohai_completed(node) end |