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

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
主站蜘蛛池模板: 双江| 顺义区| 临清市| 涞水县| 分宜县| 湘潭市| 泸溪县| 清新县| 乐安县| 宁安市| 顺平县| 平原县| 喀喇| 安陆市| 溧水县| 南华县| 太和县| 邮箱| 新田县| 辽宁省| 察隅县| 和顺县| 陆河县| 内乡县| 西宁市| 肇州县| 宁明县| 富川| 射阳县| 会同县| 阳西县| 保靖县| 玛纳斯县| 绥宁县| 吉隆县| 紫阳县| 乡宁县| 临江市| 海晏县| 元阳县| 息烽县|