24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/chef_apply/telemeter.rb', line 24
def self.timed_action_capture(action, &block)
target = action.target_host
target_data = { platform: {}, hostname_sha1: nil, transport_type: nil }
if target
target_data[:platform][:name] = target.base_os
target_data[:platform][:version] = target.version
target_data[:platform][:architecture] = target.architecture
target_data[:hostname_sha1] = Digest::SHA1.hexdigest(target.hostname.downcase)
target_data[:transport_type] = target.transport_type
end
Chef::Telemeter.timed_capture(:action, { action: action.name, target: target_data }, &block)
end
|