| https://puppet.com/docs/puppet/6/external_facts.html says > Due to parse order, you can reference an external fact from a Ruby fact. But this does not seem to work: $ cat external/ext.yaml — shouting: 'HELLO' $ cat custom/cust.rb Facter.add('not_shouting') do setcode do Facter.value('shouting').downcase() end end $ facter --external-dir external shouting HELLO $ facter --external-dir external --custom-dir custom not_shouting 2021-09-28 05:08:08.686159 ERROR puppetlabs.facter - error while resolving custom fact "not_shouting": undefined method `downcase' for nil:NilClass The custom fact is loaded before external facts, and cannot resolve it: $ facter --debug --external-dir external --custom-dir custom not_shouting 2021-09-28 05:08:14.428428 INFO puppetlabs.facter - executed with command line: --debug --external-dir external --custom-dir custom not_shouting. 2021-09-28 05:08:14.428594 DEBUG leatherman.ruby:513 - ruby was found at "/usr/bin/ruby". 2021-09-28 05:08:14.428740 DEBUG leatherman.execution:93 - executing command: /usr/bin/ruby -e print(['libdir', 'archlibdir', 'sitearchlibdir', 'bindir'].find do |name|dir = RbConfig::CONFIG[name];next unless dir;file = File.join(dir, RbConfig::CONFIG['LIBRUBY_SO']);break file if File.exist? file;false end) 2021-09-28 05:08:14.498854 DEBUG | - /usr/lib/x86_64-linux-gnu/libruby-2.7.so.2.7.4 2021-09-28 05:08:14.499154 DEBUG leatherman.execution:610 - process exited with status code 0. 2021-09-28 05:08:14.501242 INFO leatherman.ruby:139 - ruby loaded from "/usr/lib/x86_64-linux-gnu/libruby-2.7.so.2.7.4". 2021-09-28 05:08:14.501408 DEBUG leatherman.dynamic_library:77 - symbol rb_data_object_alloc not found in library /usr/lib/x86_64-linux-gnu/libruby-2.7.so.2.7.4, trying alias rb_data_object_wrap. 2021-09-28 05:08:14.568781 INFO leatherman.ruby:195 - using ruby version 2.7.4 2021-09-28 05:08:14.568945 INFO puppetlabs.facter - requested queries: not_shouting. 2021-09-28 05:08:14.569048 DEBUG puppetlabs.facter - fact "facterversion" has resolved to "3.14.12". 2021-09-28 05:08:14.569266 DEBUG leatherman.file_util:65 - Error reading file: No such file or directory 2021-09-28 05:08:14.569634 DEBUG puppetlabs.facter - loading all custom facts. 2021-09-28 05:08:14.569711 DEBUG puppetlabs.facter - loading custom fact directories from config file 2021-09-28 05:08:14.569779 DEBUG puppetlabs.facter - searching for custom facts in /tmp/custom. 2021-09-28 05:08:14.569886 INFO puppetlabs.facter - loading custom facts from /tmp/custom/cust.rb. 2021-09-28 05:08:14.570123 DEBUG puppetlabs.facter - loading external fact directories from config file 2021-09-28 05:08:14.570214 DEBUG leatherman.file_util:65 - Error reading file: No such file or directory 2021-09-28 05:08:14.570334 DEBUG puppetlabs.facter - custom fact "shouting" was not found. 2021-09-28 05:08:14.570957 ERROR puppetlabs.facter - error while resolving custom fact "not_shouting": undefined method `downcase' for nil:NilClass 2021-09-28 05:08:14.571054 DEBUG puppetlabs.facter - fact "not_shouting" resolved to null and will not be added. 2021-09-28 05:08:14.571150 DEBUG puppetlabs.facter - skipping external facts for "/usr/local/google/home/raa/.puppetlabs/opt/facter/facts.d": No such file or directory 2021-09-28 05:08:14.571256 DEBUG puppetlabs.facter - skipping external facts for "/usr/local/google/home/raa/.facter/facts.d": No such file or directory 2021-09-28 05:08:14.571334 DEBUG puppetlabs.facter - searching "/tmp/external" for external facts. 2021-09-28 05:08:14.571434 DEBUG puppetlabs.facter - resolving facts from YAML file "/tmp/external/ext.yaml". 2021-09-28 05:08:14.571696 DEBUG puppetlabs.facter - fact "shouting" has resolved to "HELLO". 2021-09-28 05:08:14.571780 DEBUG puppetlabs.facter - completed resolving facts from YAML file "/tmp/external/ext.yaml". 2021-09-28 05:08:14.571883 DEBUG puppetlabs.facter - fact "not_shouting" does not exist. |