0

I know nothing about Ruby, just started exploring Puppet and want to create custom fact, for a start, used fact found on internet to see how it works:

copied code below to /etc/puppetlabs/code/environments/production/modules/dsc/lib/facter/windows.rb (dsc is module name)

Facter.add(:ismsclusternode) do  
  confine :kernel => 'windows'

  sysnativedir = Facter.value(:system32)
  setcode do
    if Facter::Util::Resolution.exec(sysnativedir +
        '\WindowsPowerShell\v1.0\powershell.exe "(get-windowsfeature 
        -Name Failover-Clustering).Installed"') == "True"
      true
    else
      false
    end
  end
end  

from agent output:

Info: Facter: loading custom facts from C:/ProgramData\PuppetLabs\puppet\cache\lib\facter\windows.rb.
Debug: Facter: executing command: C:\Windows\system32\cmd.exe /c C:\Windows\System32\Wbem\wmic.exe ComputerSystem get SystemType | FindStr /i x
Debug: Facter: x64-based PC
Debug: Facter: process exited with exit code 0.
Debug: Facter: searching for custom facts in C:/ProgramData\PuppetLabs\puppet\cache\lib\facter.
Debug: Facter: custom fact "common_appdata" was not found.
Error: Facter: error while resolving custom fact "_puppet_inventory_1": no implicit conversion of nil into String
Debug: Facter: fact "_puppet_inventory_1" resolved to null and will not be added.
Error: Facter: error while resolving custom fact "_puppet_inventory_1": no implicit conversion of nil into String
Error: Failed to apply catalog: Parameter path failed on File[/PuppetLabs/pxp-agent/etc/pxp-agent.conf]: File paths must be fully qualified, not '/PuppetLabs/pxp-agent/etc/pxp-agent.conf' (file: /opt/puppetlabs/puppet/modules/puppet_enterprise/manifests/pxp_agent.pp, line: 87)

/opt/puppetlabs/puppet/modules/puppet_enterprise/manifests/pxp_agent.pp, line: 87

file { "${puppet_enterprise::params::pxp_agent_etc}/pxp-agent.conf":


puppetserver version: 2018.1.0.54
 puppet --version
5.5.2
  • The error is for the fact `_puppet_inventory_1`, but the code shown is for `ismsclusternode`. Is there a reason to believe the two are connected? – Matthew Schuchard Nov 14 '18 at 14:12
  • no, i'm getting same error no matter which ruby code i'm running –  Nov 14 '18 at 14:57
  • Have you actually purchased Puppet Enterprise? That would entitle you to support. You are free to ask here in any case, but the issue appears to revolve around some PE-specific bits, and those are not as well covered here as the bits that are also in OS Puppet. – John Bollinger Nov 14 '18 at 15:51
  • Not yet, we still evaluate it. –  Nov 14 '18 at 20:38

0 Answers0