以此为例: https://serverfault.com/questions/471995/how-do-i-check-if-a-user-exists-in-puppet
我有一些似乎不常见的问题。如果我:
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
从 /etc/puppetlabs/code/environments/production/modules/facts/lib/facter/user_exists_dmadmin.rb
require 'facter'
Facter.add(:user_exists_dmadmin) do
setcode do
name = "dmadmin"
Facter::Util::Resolution.exec("/usr/bin/id -u #{name} 2>/dev/null")
#puts "inside user_exists_dmadmin"
end
end
并且site.pp包含
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
}
}
当我编译目录
时[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
非常感谢知道错误的原因。
非常感谢
凯文
答案 0 :(得分:1)
当您使用puppet master --compile
时,会使用该节点的最后一组缓存事实,这意味着在最后一次实际代理运行puppet时,不得发送此事实。从cs1.home运行puppet agent --test
,以便可以同步插件并缓存新的事实值。