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

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
主站蜘蛛池模板: 左贡县| 鄂伦春自治旗| 龙南县| 隆昌县| 全州县| 茌平县| 肇州县| 吴堡县| 桐城市| 江北区| 崇州市| 瑞丽市| 宝山区| 舞阳县| 苍梧县| 上林县| 府谷县| 新疆| 利川市| 隆化县| 上蔡县| 阜康市| 辽宁省| 门头沟区| 高阳县| 通州区| 东方市| 扶沟县| 仙居县| 普陀区| 翼城县| 庆城县| 万载县| 隆尧县| 湖南省| 阳城县| 嘉祥县| 嘉义县| 博爱县| 高阳县| 垫江县|