ruby 厨师中级班的Ohai模块重构
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby 厨师中级班的Ohai模块重构相关的知识,希望对你有一定的参考价值。
Ohai.plugin(:Apache) do
provides "apache/modules"
collect_data(:default) do
apache Mash.new
apache[:modules] = {:static => [], :shared => []}
modules = shell_out("apachectl -t -D DUMP_MODULES")
modules.stdout.each_line do |line|
fullkey, value = line.split(/\(/, 2).map {|i| i.strip}
apache_mod = fullkey.gsub(/_module/,"")
dso_type = value.to_s.chomp("\)")
if dso_type.match(/shared/)
apache[:modules][:shared] << apache_mod
elsif dso_type.match(/static/)
apache[:modules][:static] << apache_mod
end
end
end
end
以上是关于ruby 厨师中级班的Ohai模块重构的主要内容,如果未能解决你的问题,请参考以下文章