Module: Chef::ResourceHelpers::PathHelpers
- Extended by:
- PathHelpers
- Includes:
- Mixin::Which
- Included in:
- Chef::Resource::ChefClientCron, Chef::Resource::ChefClientLaunchd, Chef::Resource::ChefClientScheduledTask, Chef::Resource::ChefClientSystemdTimer, PathHelpers
- Defined in:
- lib/chef/resource/helpers/path_helpers.rb
Overview
Helpers for path manipulation
Instance Method Summary collapse
-
#chef_client_hab_binary_path ⇒ String
This method returns the absolute path to the chef-client binary that is currently executing.
- #hab_executable_binary_path ⇒ Object
Instance Method Details
#chef_client_hab_binary_path ⇒ String
This method returns the absolute path to the chef-client binary that is currently executing. In a Habitat environment, you might have multiple versions of chef-client installed, we want to ensure we get the path to the one currently running.
21 22 23 24 25 26 27 28 |
# File 'lib/chef/resource/helpers/path_helpers.rb', line 21 def chef_client_hab_binary_path path = File.realpath($PROGRAM_NAME) bin = File.basename(path) return path if bin == "#{ChefUtils::Dist::Infra::CLIENT}" # Return empty string if no valid path is found "" end |
#hab_executable_binary_path ⇒ Object
30 31 32 33 |
# File 'lib/chef/resource/helpers/path_helpers.rb', line 30 def hab_executable_binary_path # Find hab in PATH which("hab") || "" end |