我是 puppet 和 ruby 的新手,只是尝试编写自定义事实,但是......遇到以下问题
Facter.add("vsphere_installed") do
confine :operatingsystem => :windows
setcode do
if Facter::Util::Resolution.exec('c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command "Get-WmiObject -Class Win32_Product | Select-Object -DisplayName | ? {$_.DisplayName -Match "vsphere"}"') = true
result = "vSphere installed"
else
result = "false"
end
end
end
我不知道该怎么做,我想列出已安装的程序并搜索一个,如果为 true(find) 则返回它已安装。到目前为止,此示例仅返回 false ....