chefspec/fauxhai

Fauxhai lacks the empty virtualization hash

tas50 opened this issue · 5 comments

tas50 commented

A non-virtualized Chef system still includes the empty hash. A lot of the time people do checks like:

unless node['virtualization']['systems']['docker'] && node['virtualization']['systems']['docker'] == 'guest'

This will fail on fauxhai with a nil error. node['virtualization']['systems'] should exist which would prevent those failures.

Hrm - was that always true or is that a recent addition to Ohai?

tas50 commented

7.20 so chef 11.14

Ah okay. Fauxhai exists pre-that. We could probably do a quick thing like:

Dir.glob("**/*.json).each do |file|
  x = JSON.parse(File.read(file))
  x["virtualization"] = {}
  File.open(file, "w") { |f| f.write(JSON.generate(x) }
end

Yes please. It's currently causing chefspec tests to fail, if the latest build-essential cookbook is used.

tas50 commented

Merged to master