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

FACTER_ environmental facts overrides don't work with external facts

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: FACT 3.14.16
    • Component/s: None
    • Environment:

      PE 2019.8.4

    • Template:
    • Acceptance Criteria:
      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
    • Team:
      Night's Watch
    • Story Points:
      3
    • Sprint:
      NW - 2021-02-03, NW - 2021-02-17
    • Method Found:
      Needs Assessment
    • Zendesk Ticket IDs:
      42719
    • Zendesk Ticket Count:
      1
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      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
    • QA Risk Assessment:
      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

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

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support