/chef/lib/chef/provider/ohai.rb

http://github.com/opscode/chef · Ruby · 42 lines · 21 code · 4 blank · 17 comment · 1 complexity · 4629ea860aeca8879f7714d98accb23c MD5 · raw file

  1. #
  2. # Author:: Michael Leianrtas (<mleinartas@gmail.com>)
  3. # Copyright:: Copyright (c) 2010 Michael Leinartas
  4. # License:: Apache License, Version 2.0
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. require 'ohai'
  19. class Chef
  20. class Provider
  21. class Ohai < Chef::Provider
  22. def load_current_resource
  23. true
  24. end
  25. def action_reload
  26. ohai = ::Ohai::System.new
  27. if @new_resource.plugin
  28. ohai.require_plugin @new_resource.plugin
  29. else
  30. ohai.all_plugins
  31. end
  32. node.automatic_attrs.merge! ohai.data
  33. Chef::Log.info("#{@new_resource} reloaded")
  34. @new_resource.updated_by_last_action(true)
  35. end
  36. end
  37. end
  38. end