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

Module level external facts not resolved when using the Vagrant Puppet provider

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: FACT 3.0.2
    • Fix Version/s: FACT 3.1.6
    • Component/s: Community, Windows
    • Environment:

      Puppet: 4.2.1
      Facter: 3.0.2
      Vagrant: 1.7.4
      OS: Windows 7 Enterprise + 2012R2

    • Template:
    • Story Points:
      2
    • Sprint:
      Client 2016-03-23
    • CS Priority:
      Normal
    • CS Frequency:
      2 - 5-25% of Customers
    • CS Severity:
      3 - Serious
    • CS Business Value:
      3 - $$$$
    • CS Impact:
      Users that want to test their external facts using Vagrant on Windows can't do so easily. This issue essential breaks the Vagrant "share".
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Facter can now resolve external facts across NTFS reparse points

      Description

      Puppet: 4.2.1
      Facter: 3.0.2
      Vagrant: 1.7.4
      OS: Windows 7 Enterprise + 2012R2

      See comment by Peter Huene (PuppetLabs) on the community forum : https://groups.google.com/forum/#!topic/puppet-users/i66sAsQjNwA

      I have a module with a facts.d folder containing a simple yaml file and a powershell script :-

      sonatype_nexus
          - puppet
              - modules
                  - sonatype_nexus
                      - facts.d
                           facts.yaml
                           alpha.ps1
      

      facts.yaml :-

             baz: baz
      

      alpha.ps1 :-

          Write-Host "alpha=alpha"
      

      ... for the purpose of illustration, the puppet class just tries to emit the two facts :-

        notice($::baz)
        notice($::alpha)
      

      When I run this on my laptop using a simple 'puppet apply' all is well :-

      Notice: Scope(Class[Sonatype_nexus]): CLASS: sonatype_nexus
      Notice: Scope(Class[Sonatype_nexus]):
      Notice: Scope(Class[Sonatype_nexus::Windows::Install]): baz
      Notice: Scope(Class[Sonatype_nexus::Windows::Install]): alpha
      Notice: Compiled catalog for lt032064.avivagroup.com in environment production in 1.78 seconds
      Notice: Applied catalog in 3.03 seconds
      

      Furthermore, If I switch debug on I can see facter resolving those very facts too :-

      Debug: Facter: searching "E:/Data\git\sonatype_nexus\puppet\modules\sonatype_nexus\facts.d" for external facts.
      Debug: Facter: checking execution on E:/Data\git\sonatype_nexus\puppet\modules\sonatype_nexus\facts.d\alpha.ps1
      Debug: Facter: resolving facts from powershell script "E:/Data\git\sonatype_nexus\puppet\modules\sonatype_nexus\facts.d\alpha.ps1".
      Debug: Facter: executing command: C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -File E:/Data\git\sonatype_nexus\puppet\modules\sonatype_nexus\facts.d\alpha.ps1
      Debug: Facter: alpha=alpha
      Debug: Facter: fact "alpha" has resolved to "alpha".
      Debug: Facter: process exited with exit code 0.
      Debug: Facter: completed resolving facts from powershell script "E:/Data\git\sonatype_nexus\puppet\modules\sonatype_nexus\facts.d\alpha.ps1".
      Debug: Facter: resolving facts from YAML file "E:/Data\git\sonatype_nexus\puppet\modules\sonatype_nexus\facts.d\facts.yaml".
      Debug: Facter: fact "baz" has resolved to "baz".
      Debug: Facter: completed resolving facts from YAML file "E:/Data\git\sonatype_nexus\puppet\modules\sonatype_nexus\facts.d\facts.yaml".
      ...
      

      However, when I run the same code on Vagrant using the Puppet provisioner, I get a very different result :-

      Warning: Facter: skipping external facts for "C:/tmp/vagrant-puppet/modules-d002123d6028e7e12b22cf92698d76f5/sonatype_nexus/facts.d": The request is not supported
      

      and neither of the facts are available to the class.

      Debug output, doesn't really provide any more usefult information (elided for brevity) :-

      ...
      Debug: Runtime environment: puppet_version=4.2.1, ruby_version=2.1.6, run_mode=user, default_encoding=CP850
      Debug: Evicting cache entry for environment 'production'
      Debug: Caching environment 'production' (ttl = 0 sec)
      Debug: Evicting cache entry for environment 'production'
      Debug: Caching environment 'production' (ttl = 0 sec)
      Debug: Loading external facts from C:/tmp/vagrant-puppet/modules-d002123d6028e7e12b22cf92698d76f5/sonatype_nexus/facts.d
      Debug: Loading external facts from C:/ProgramData/PuppetLabs/puppet/cache/facts.d
      Info: Loading facts
      Debug: Loading facts from C:/tmp/vagrant-puppet/modules-d002123d6028e7e12b22cf92698d76f5/chocolatey/lib/facter/chocolateyversion.rb
      Debug: Loading facts from C:/tmp/vagrant-puppet/modules-d002123d6028e7e12b22cf92698d76f5/chocolatey/lib/facter/choco_install_path.rb
      Info: Loading facts
      Debug: Loading facts from C:/tmp/vagrant-puppet/modules-d002123d6028e7e12b22cf92698d76f5/stdlib/lib/facter/facter_dot_d.rb
      Debug: Loading facts from C:/tmp/vagrant-puppet/modules-d002123d6028e7e12b22cf92698d76f5/stdlib/lib/facter/pe_version.rb
      Debug: Loading facts from C:/tmp/vagrant-puppet/modules-d002123d6028e7e12b22cf92698d76f5/stdlib/lib/facter/puppet_vardir.rb
      Debug: Loading facts from C:/tmp/vagrant-puppet/modules-d002123d6028e7e12b22cf92698d76f5/stdlib/lib/facter/root_home.rb
      Debug: Loading facts from C:/tmp/vagrant-puppet/modules-d002123d6028e7e12b22cf92698d76f5/stdlib/lib/facter/service_provider.rb
      Debug: Facter: fact "facterversion" has resolved to "3.0.2".
      Debug: Facter: initializing WMI
      Debug: Facter: searching "C:/ProgramData\PuppetLabs\facter\facts.d" for external facts.
      Warning: Facter: skipping external facts for "C:/tmp/vagrant-puppet/modules-d002123d6028e7e12b22cf92698d76f5/sonatype_nexus/facts.d": The request is not supported
      

      If I log into the Vagrant box and run pupply apply I get the same result.

      The folders containing the Puppet modules are created by the Vagrant Puppet provisioner. The folder TYPE shows these as SYMLINKs to the virtualbox shares (see assertion from Peter Huene above about this) :-

      C:\tmp\vagrant-puppet>dir
       Volume in drive C is Windows 2012 R2
       Volume Serial Number is D62B-DF9F
       
       Directory of C:\tmp\vagrant-puppet
       
      14/11/2015  06:22    <DIR>          .
      14/11/2015  06:22    <DIR>          ..
      14/11/2015  06:22    <SYMLINKD>     environments [\\vboxsrv\tmp_vagrant-puppet_environments]
      09/11/2015  18:28               462 hiera.yaml
      14/11/2015  06:22    <SYMLINKD>     manifests-f1d820646039d9c95ba4807bc822de1a [\\vboxsrv\tmp_vagrant-puppet_manifests-f1d820646039d9c95ba4807bc822de1a]
      14/11/2015  06:22    <SYMLINKD>     modules-d002123d6028e7e12b22cf92698d76f5 [\\vboxsrv\tmp_vagrant-puppet_modules-d002123d6028e7e12b22cf92698d76f5]
      

      Example section of VagrantFile :-

          nexus.vm.provision "puppet" do |puppet|
            puppet.module_path = "#{puppet_module_path}"
            puppet.manifests_path = "#{puppet_manifests_path}"
            puppet.environment="production"
            puppet.environment_path="#{puppet_environment_path}"
            puppet.manifest_file = "sonatype_nexus_facter.pp"
            puppet.hiera_config_path = "#{puppet_hiera_config_path}"
            puppet.options = "--node_name_value=sonatype_nexus_facter --debug"
          # puppet.options = "--verbose --debug --trace"
          end
      

      Workaround:

      If the executable/structured facts files (aplha.ps1, facts.yaml) are located in the defualt OS location (in this case: C:\ProgramData\PuppetLabs\facter\facts.d) then the values are resolved correctly and thus available to the class.

      HTHs

      Kind Regards

      Fraser Goffin

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                goffinf Fraser Goffin
                QA Contact:
                Eric Thompson
              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support