Skip to content

Commit

Permalink
Fix logic that chefstyle busted =)
Browse files Browse the repository at this point in the history
Signed-off-by: Miah Johnson <miah@chia-pet.org>
  • Loading branch information
miah committed May 31, 2019
1 parent a1b96e2 commit 9e95c82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/train/platforms/detect/helpers/os_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ def unix_uuid

def unix_uuid_from_chef
file = @backend.file("/var/chef/cache/data_collector_metadata.json")
if file.exist? && !file.size == 0
if file.exist? && file.size != 0
json = ::JSON.parse(file.content)
return json["node_uuid"] if json["node_uuid"]
end
end

def unix_uuid_from_machine_file
# require 'pry';binding.pry
%W{
/etc/chef/chef_guid
#{ENV['HOME']}/.chef/chef_guid
Expand All @@ -110,7 +111,7 @@ def unix_uuid_from_machine_file
/var/db/dbus/machine-id
}.each do |path|
file = @backend.file(path)
next unless file.exist? && !file.size == 0
next unless file.exist? && file.size != 0
return file.content.chomp if path =~ /guid/
return uuid_from_string(file.content.chomp)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/train/platforms/detect/helpers/os_windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def windows_uuid_from_machine_file
#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}\\.chef\\chef_guid
}.each do |path|
file = @backend.file(path)
return file.content.chomp if file.exist? && !file.size == 0
return file.content.chomp if file.exist? && file.size != 0
end
nil
end
Expand Down

0 comments on commit 9e95c82

Please sign in to comment.