官术网_书友最值得收藏!

Debugging facts

You can debug Facter by using a facter.debug statement anywhere in your custom fact's Ruby code, as shown in the following:

Facter::Type.newtype(:mycustomfact) do
...
Facter.debug "foo is the value: #{foo}"
...
end

During debugging, running Facter by itself won't pick up your new custom fact since it would usually require the pluginsync process to distribute it. You must set the FACTERLIB environment variable to shortcut this process when you are developing and debugging the new code on your development node. Let's say you have the some_facts and some_other_facts subdirectories in your personal working directory, where you are editing the Ruby code for a new fact you are developing. You would set the code up as follows:

$ ls ~/some_facts
mycustomfact.rb
$ ls ~/some_other_facts
myothercustomfact.rb
$ export FACTERLIB="~/some_facts: ~/some_other_facts"
$ facter mycustomfact myothercustomfact –debug
主站蜘蛛池模板: 海城市| 广西| 静宁县| 莲花县| 明溪县| 铁岭县| 陵水| 桓仁| 新泰市| 昌江| 乐业县| 安阳市| 黑龙江省| 克什克腾旗| 泽库县| 常德市| 汾阳市| 宣汉县| 永新县| 吴堡县| 扎赉特旗| 民和| 星子县| 武冈市| 钟山县| 丹凤县| 嘉兴市| 龙陵县| 明光市| 屯昌县| 嵩明县| 赤城县| 滁州市| 武夷山市| 都匀市| 山丹县| 石嘴山市| 庆阳市| 东方市| 平和县| 长乐市|