Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-1875

Unable to use "confine" with structured facts -- documentation is incorrect

    XMLWordPrintable

Details

    • Bug
    • Status: Accepted
    • Normal
    • Resolution: Unresolved
    • FACT 3.11.3
    • None
    • DOCS
    • Tested with Facter 3.6.7 running on VirtuozzoLinux 7

      Also tested with Facter 3.11.3 on Debian Stretch

    • Platform OS
    • Needs Assessment
    • Needs Assessment

    Description

      I've been attempting to confine some facts using structured facts, as described in the documentation here. However, the first method described in the documentation using Facter.value does not seem to work:

       
      ==> oscheck_factervalue.rb <==
      Facter.add(:oscheck_factervalue) do
      	confine Facter.value(:os)['distro']['id'] => 'Debian'
       
      	setcode do
      		'fact value'
      	end
      end
      

      Running facter with FACTERLIB pointed at the location of the above file gives:

      2018-08-17 13:28:22.140537 INFO  puppetlabs.facter - executed with command line: --debug oscheck_factervalue.
      2018-08-17 13:28:22.140979 DEBUG leatherman.ruby:504 - ruby was found at "/usr/bin/ruby".
      2018-08-17 13:28:22.141139 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)
      2018-08-17 13:28:22.295315 DEBUG | - /usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3.0
      2018-08-17 13:28:22.295528 DEBUG leatherman.execution:559 - process exited with status code 0.
      2018-08-17 13:28:22.299951 INFO  leatherman.ruby:137 - ruby loaded from "/usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3.0".
      2018-08-17 13:28:22.300503 DEBUG leatherman.dynamic_library:77 - symbol rb_data_object_alloc not found in library /usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3.0, trying alias rb_data_object_wrap.
      2018-08-17 13:28:22.418246 INFO  leatherman.ruby:186 - using ruby version 2.3.3
      2018-08-17 13:28:22.418408 INFO  puppetlabs.facter - requested queries: oscheck_factervalue.
      2018-08-17 13:28:22.418488 DEBUG puppetlabs.facter - fact "facterversion" has resolved to "3.11.3".
      2018-08-17 13:28:22.418857 DEBUG leatherman.file_util:65 - Error reading file: No such file or directory
      2018-08-17 13:28:22.419635 DEBUG puppetlabs.facter - loading all custom facts.
      2018-08-17 13:28:22.419683 DEBUG puppetlabs.facter - loading custom fact directories from config file
      2018-08-17 13:28:22.419733 DEBUG puppetlabs.facter - searching for custom facts in /home/chrisb.
      2018-08-17 13:28:22.419890 INFO  puppetlabs.facter - loading custom facts from /home/chrisb/oscheck_factervalue.rb.
      2018-08-17 13:28:22.420223 DEBUG puppetlabs.facter - searching for custom fact "os".
      2018-08-17 13:28:22.420281 DEBUG puppetlabs.facter - searching for os.rb in /home/chrisb.
      2018-08-17 13:28:22.420403 DEBUG puppetlabs.facter - resolving operating system facts.
      2018-08-17 13:28:22.420506 DEBUG puppetlabs.facter - resolving kernel facts.
      2018-08-17 13:28:22.420623 DEBUG puppetlabs.facter - fact "kernel" has resolved to "Linux".
      2018-08-17 13:28:22.420711 DEBUG puppetlabs.facter - fact "kernelrelease" has resolved to "2.6.32-042stab123.9".
      2018-08-17 13:28:22.420906 DEBUG puppetlabs.facter - fact "kernelmajversion" has resolved to "2.6".
      2018-08-17 13:28:22.421009 DEBUG puppetlabs.facter - fact "kernelversion" has resolved to "2.6.32".
      2018-08-17 13:28:22.421155 DEBUG leatherman.execution:93 - executing command: /usr/bin/lsb_release -a
      2018-08-17 13:28:22.525733 DEBUG !!! - No LSB modules are available.
      2018-08-17 13:28:22.525855 DEBUG | - Distributor ID:	Debian
      2018-08-17 13:28:22.525932 DEBUG | - Description:	Debian GNU/Linux 9.5 (stretch)
      2018-08-17 13:28:22.525987 DEBUG | - Release:	9.5
      2018-08-17 13:28:22.526038 DEBUG | - Codename:	stretch
      2018-08-17 13:28:22.536786 DEBUG leatherman.execution:559 - process exited with status code 0.
      2018-08-17 13:28:22.539651 DEBUG puppetlabs.facter - fact "osfamily" has resolved to "Debian".
      2018-08-17 13:28:22.539761 DEBUG puppetlabs.facter - fact "operatingsystemmajrelease" has resolved to "9".
      2018-08-17 13:28:22.539843 DEBUG puppetlabs.facter - fact "operatingsystemrelease" has resolved to "9.5".
      2018-08-17 13:28:22.539919 DEBUG puppetlabs.facter - fact "hardwaremodel" has resolved to "x86_64".
      2018-08-17 13:28:22.539994 DEBUG puppetlabs.facter - fact "architecture" has resolved to "amd64".
      2018-08-17 13:28:22.540069 DEBUG puppetlabs.facter - fact "lsbdistid" has resolved to "Debian".
      2018-08-17 13:28:22.540154 DEBUG puppetlabs.facter - fact "lsbdistcodename" has resolved to "stretch".
      2018-08-17 13:28:22.540230 DEBUG puppetlabs.facter - fact "lsbdistdescription" has resolved to "Debian GNU/Linux 9.5 (stretch)".
      2018-08-17 13:28:22.540310 DEBUG puppetlabs.facter - fact "lsbmajdistrelease" has resolved to "9".
      2018-08-17 13:28:22.540387 DEBUG puppetlabs.facter - fact "lsbminordistrelease" has resolved to "5".
      2018-08-17 13:28:22.540465 DEBUG puppetlabs.facter - fact "lsbdistrelease" has resolved to "9.5".
      2018-08-17 13:28:22.540541 DEBUG puppetlabs.facter - fact "operatingsystem" has resolved to "Debian".
      2018-08-17 13:28:22.540634 DEBUG puppetlabs.facter - fact "selinux" has resolved to false.
      2018-08-17 13:28:22.540732 DEBUG puppetlabs.facter - fact "os" has resolved to {
        architecture => "amd64",
        distro => {
          codename => "stretch",
          description => "Debian GNU/Linux 9.5 (stretch)",
          id => "Debian",
          release => {
            full => "9.5",
            major => "9",
            minor => "5"
          }
        },
        family => "Debian",
        hardware => "x86_64",
        name => "Debian",
        release => {
          full => "9.5",
          major => "9",
          minor => "5"
        },
        selinux => {
          enabled => false
        }
      }.
      2018-08-17 13:28:22.541146 DEBUG puppetlabs.facter - custom fact "debian" was not found.
      2018-08-17 13:28:22.541242 DEBUG puppetlabs.facter - fact "oscheck_factervalue" resolved to null and will not be added.
      2018-08-17 13:28:22.541403 DEBUG puppetlabs.facter - skipping external facts for "/home/chrisb/.puppetlabs/opt/facter/facts.d": No such file or directory
      2018-08-17 13:28:22.541484 DEBUG puppetlabs.facter - skipping external facts for "/home/chrisb/.facter/facts.d": No such file or directory
      2018-08-17 13:28:22.541537 DEBUG puppetlabs.facter - no external facts were found.
      2018-08-17 13:28:22.541659 DEBUG puppetlabs.facter - fact "oscheck_factervalue" does not exist.
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            chrisbzc Chris Butler
            Votes:
            2 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated:

              Zendesk Support