title: Unknown variable error compiling puppet script with facter/ruby dependency
body: <p>facter --version
  3.0.2 (commit 5dc120fa9db4c19150466b1bbd1d0cf42c87c6bd)</p>
  
  <p>puppet --version
  4.2.1</p>
  
  <p>Using this as an example:
  <a href="https://serverfault.com/questions/471995/how-do-i-check-if-a-user-exists-in-puppet">https://serverfault.com/questions/471995/how-do-i-check-if-a-user-exists-in-puppet</a></p>
  
  <p>I'm having some issues which do not seem to be common. If I:</p>
  
  <pre><code>root@puppet manifests]# puppet master --compile cs1.home
  Error: Evaluation Error: Unknown variable: '::user_exists_dmadmin'. at /etc/puppetlabs/code/environments/production/manifests/site.pp:28:5 on node cs1.home
  </code></pre>
  
  <p>From
  /etc/puppetlabs/code/environments/production/modules/facts/lib/facter/user_exists_dmadmin.rb</p>
  
  <pre><code>require 'facter'
  Facter.add(:user_exists_dmadmin) do
    setcode do
      name = "dmadmin"
      Facter::Util::Resolution.exec("/usr/bin/id -u #{name} 2&gt;/dev/null")
      #puts "inside user_exists_dmadmin"
    end
  end
  </code></pre>
  
  <p>And site.pp contains</p>
  
  <pre><code>node "cs1.home" {
  if ($::user_exists_dmadmin)  {
     notify {"Documentum Installation Owner exists - NOT  making an installation 
      at this time!" : }
   }else
   {
     notify {"Calling the Documentum Class for installation of Documentum":}
     include documentum
   }
  }
  </code></pre>
  
  <p>And when I compile the catalog</p>
  
  <pre><code>[root@puppet production]# puppet master --compile cs1.home
  Error: Evaluation Error: Unknown variable: '::user_exists_dmadmin'. at /etc/puppetlabs/code/environments/production/manifests/site.pp:29:6 on node cs1.home
  </code></pre>
  
  <p>Will be very grateful to know why the error.</p>
  
  <p>Many thanks</p>
  
  <p>Kevin</p>