木偶:testing虚拟资源是否存在或被定义?
以前在ServerFault上,它显示了如何testing是否定义了一个资源: Puppet:testing是否定义了资源,或创build它 if defined(File["/tmp/foo"]) { alert("/tmp/foo is defined") } else { alert("/tmp/foo is not defined") } 我想testing一个虚拟资源是否被定义或存在,然后通过收集器实现它,但它似乎不工作在相同的语法。 create_resource('@package',hiera_hash('packages',{}),{}) if !defined(@Package['foo']) { alert('Hiera screwed up, critical virtual package is missing') } # Realize the critical packages Package<| groups == critical |> 这让我: Error: Could not parse for environment production: Virtual (@) can only be applied to […]