module Chef::DataCollector::MessageHelpers
This is for shared code between the run_start_message and run_end_message modules.
No external code should call this module directly
@api private
Private Instance Methods
organization()
click to toggle source
The organization name the node is associated with. For Chef
Solo runs the default is “chef_solo” which can be overridden by the user.
@return [String] Chef
organization associated with the node
# File lib/chef/data_collector/message_helpers.rb, line 35 def organization if solo_run? # configurable fake organization name for chef-solo users Chef::Config[:data_collector][:organization] else Chef::Config[:chef_server_url].match(%r{/+organizations/+([^\s/]+)}).nil? ? "unknown_organization" : $1 end end
solo_run?()
click to toggle source
@return [Boolean] True if we're in a chef-solo/chef-zero or legacy chef-solo run
# File lib/chef/data_collector/message_helpers.rb, line 45 def solo_run? Chef::Config[:solo_legacy_mode] || Chef::Config[:local_mode] end