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

FACTER_ environmental facts overrides don't work with external facts

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • FACT 3.14.16
    • None
    • PE 2019.8.4

    • Hide

      as to other facts, environmental facts should be able to overwrite for external facts as well for puppet run.

      facter -p and puppet facts should return the same output

      Show
      as to other facts, environmental facts should be able to overwrite for external facts as well for puppet run. facter -p and puppet facts should return the same output
    • Night's Watch
    • 3
    • NW - 2021-02-03, NW - 2021-02-17
    • Needs Assessment
    • 42719
    • 1
    • Bug Fix
    • Hide
      When running puppet facts, environment facts were overwritten
      by external facts.
      Now the flow was set to default facts -> external facts -> environment facts
      Show
      When running puppet facts, environment facts were overwritten by external facts. Now the flow was set to default facts -> external facts -> environment facts
    • Needs Assessment

    Description

      Using cli, overriding external facts from the cli works with facter but not in puppet.

      Reproducing steps:

      when the external fact things don't exist:

      [root@goat01 facts.d]# pwd
      /etc/puppetlabs/facter/facts.d
      [root@goat01 facts.d]# ll things.txt
      ls: cannot access things.txt: No such file or directory
      [root@goat01 facts.d]# facter -p things
      [root@goat01 facts.d]# FACTER_things=stuff facter -p things
      stuff
      [root@goat01 facts.d]# FACTER_things=stuff puppet facts|grep things
      "things": "stuff",
      [root@goat01 facts.d]# FACTER_things=stuff puppet apply -e 'notify{"things=>${facts.get(things)}<":}'
      Notice: Compiled catalog for goat01.unix.gsm1900.org in environment production in 0.02 seconds
      Notice: things=>stuff<
      Notice: /Stage[main]/Main/Notify[things=>stuff<]/message: defined 'message' as 'things=>stuff<'
      Notice: Applied catalog in 0.06 seconds

      however, when external facts exist. create external fact things with value 'NOT_STUFF':

      [root@goat01 facts.d]# echo things=NOT_STUFF > things.txt[root@goat01 facts.d]# facter -p things
      NOT_STUFF[root@goat01 facts.d]# FACTER_things=stuff facter -p things #<-- works
      stuff[root@goat01 facts.d]# FACTER_things=stuff puppet facts|grep things #<-- doesnt
      "things": "NOT_STUFF",[root@goat01 facts.d]# FACTER_things=stuff puppet apply -e 'notify{"things=>${facts.get(things)}<":}'
      Notice: Compiled catalog for goat01.unix.gsm1900.org in environment production in 0.02 seconds
      Notice: things=>NOT_STUFF<
      Notice: /Stage[main]/Main/Notify[things=>NOT_STUFF<]/message: defined 'message' as 'things=>NOT_STUFF<'
      Notice: Applied catalog in 0.06 seconds 

      Conclusion: using cli, when external facts exist, environment facts FACTER_<fact> will not overwrite the external facts in Puppet run. facter -p can display the overwritten value but puppet facts and puppet run can't.

      Attachments

        Issue Links

          Activity

            People

              dorin.pleava Dorin Pleava
              henry.wang Henry Wang
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support