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

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
主站蜘蛛池模板: 东源县| 集安市| 涪陵区| 方城县| 平顺县| 美姑县| 昌乐县| 锡林郭勒盟| 宾阳县| 浦江县| 鄢陵县| 平泉县| 高陵县| 庆安县| 龙山县| 神池县| 潜山县| 始兴县| 盐津县| 苏尼特右旗| 兴海县| 武乡县| 临汾市| 修水县| 荔浦县| 花莲县| 顺昌县| 营山县| 黄大仙区| 越西县| 丹江口市| 永顺县| 容城县| 双鸭山市| 临漳县| 鹰潭市| 巢湖市| 兴安盟| 蓝山县| 兴国县| 洮南市|