sethvargo/chef-sugar — pull request #60 by martinb3 (2014-09-14 18:35:49+00:00)
Title: Guard lxc? with a check that the `node['virtualization']...` hash keys exist

#50 adds support for checking for being run inside an LXC container, but it does not actually verify that `node['virtualization']` doesn't exists. This yields the dreaded `undefined method '[]' for nil:NilClass`.

Perhaps `lxc?` could perform some sanity checks so that it can generate a more useful error message, such as, "You must use the Ohai virtualization plugin to call these methods." I don't think these plugins are normally included, so this functionality breaks by default.

See also #20.