Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-10136

premature loading of module-provided facts under `-p`

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 6.4.0, PUP 6.10.1
    • Fix Version/s: PUP 6.4.5, PUP 6.12.0
    • Component/s: None
    • Environment:

      ciscopuppet module, facter 3.13.2 (commit a34181878), windows 2016 x64 (gnocchi.platform9.puppet.net)

    • Template:
      PUP Bug Template
    • Team:
      Night's Watch
    • Story Points:
      5
    • Sprint:
      NW - 2019-10-30, NW - 2019-11-13, 2019-11-27
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      When running facter -p on windows, if there are custom facts or module
      facts that require some additional files that that are not yet present
      in $LOAD_PATH, it will cause an error.

      This error is caused by the way base modules/vendor paths are generated.
      When running facter -p, puppet needs to set $LOAD_PATH so that facter
      will know where to check for module facts. When loading the module path,
      puppet will call Facter.value of a non core fact, and this will start
      the re-evaluation of all custom/plugin facts without setting the
      $LOAD_PATH. This step fails if a fact requires some additional file not
      yet in $LOAD_PATH.

      Now the $LOAD_PATH will be set without using Facter, getting it
      directly from the system environment.
      Show
      When running facter -p on windows, if there are custom facts or module facts that require some additional files that that are not yet present in $LOAD_PATH, it will cause an error. This error is caused by the way base modules/vendor paths are generated. When running facter -p, puppet needs to set $LOAD_PATH so that facter will know where to check for module facts. When loading the module path, puppet will call Facter.value of a non core fact, and this will start the re-evaluation of all custom/plugin facts without setting the $LOAD_PATH. This step fails if a fact requires some additional file not yet in $LOAD_PATH. Now the $LOAD_PATH will be set without using Facter, getting it directly from the system environment.
    • QA Risk Assessment:
      Needs Assessment

      Description

      When running facter -p on windows with the puppetlabs/ciscopuppet module pluginsynced to the agent, facter is loading facter/cisco.rb from C:/ProgramData/PuppetLabs/puppet/cache/lib before setting up the $LOAD_PATH to load that file's dependencies from there. Please see the attached screenshot for the debug modifications I did and the results on the machine showing the issue.

      To make sure there is nothing wonky with the facter/cisco_nexus file itself, a require within a setcode worked fine.

      Regular agent runs work fine and do not show any errors.

      Desired Behaviour

      facter -p loads files from puppet's cache only once, after $LOAD_PATH has been properly initialised.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dorin.pleava Dorin Pleava
                Reporter:
                david.schmitt David Schmitt
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support