External facts and the Vagrant Puppet Provider

157 views
Skip to first unread message

Fraser Goffin

unread,
Nov 13, 2015, 1:00:55 PM11/13/15
to Puppet Users
Puppet: 4.2.1
Facter: 3.0.2
OS: Windows

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"

... and just 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 mush more than that :-

...
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.

Any ideas what is going on here and how I can fix it.

Kind Regards

Fraser.


Peter Huene

unread,
Nov 13, 2015, 1:48:48 PM11/13/15
to puppet...@googlegroups.com
Hi Fraser,

This failure (ERROR_NOT_SUPPORTED) is coming from Facter before the Powershell script is being executed.  There is code to canonicalize the directory's path (because relative paths are supported) and the failure is coming the library Facter uses to do that canonicalization.

Do you know if 'C:/tmp/vagrant-puppet/modules-d002123d6028e7e12b22cf92698d76f5/sonatype_nexus/facts.d' is a NTFS reparse point by chance?  Those aren't always supported well in third party libraries.

Regardless of the issue in the underlying library Facter uses, Facter should probably debug/warn that the directory could not be canonicalized (or skip canonicalization if the path is already absolute) and try to search for files in it anyway, rather than "skipping" the directory entirely.

If possible, could you create a ticket at https://tickets.puppetlabs.com describing the issue and provide all the great information you've included in this post and we'll try to get this fixed in Facter.

Thanks!

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c65eac12-80ff-4aa3-bb0d-82cc6a824ca9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fraser Goffin

unread,
Nov 13, 2015, 3:22:20 PM11/13/15
to Puppet Users
Yep, will do. Since the folder names are created by the Puppet provisioner in the tmp directory as was the case for earlier versions (which worked successfully) perhaps it's has been introduced with the later version of Puppet and Facter or there is now an underlying incompatibility between these three components.

Thanks for the fast response.

Fraser.

Fraser Goffin

unread,
Nov 14, 2015, 2:03:16 AM11/14/15
to Puppet Users
Jira ticket :-

Module level external facts not resolved when using the Vagrant Puppet provider : https://tickets.puppetlabs.com/browse/FACT-1276
Reply all
Reply to author
Forward
0 new messages