Windows的Puppet exec返回了2,而不是0中的一个
我正在尝试以静默模式安装,目标是Windows代理,示例代码如下:Windows的Puppet exec返回了2,而不是0中的一个,windows,puppet,Windows,Puppet,我正在尝试以静默模式安装,目标是Windows代理,示例代码如下: if ($::operatingsystem == "Windows") { file { "C:\\tmp": ensure => directory, } file { "C:\\tmp\fusioninventory-agent_windows_x64_2_3_12.exe": ensure => file, #provider => windows,
if ($::operatingsystem == "Windows") {
file {
"C:\\tmp": ensure => directory,
}
file {
"C:\\tmp\fusioninventory-agent_windows_x64_2_3_12.exe":
ensure => file,
#provider => windows,
source => "puppet:///modules/${module_name}/fusioninventory-agent_windows-x64_2_3_12.exe",
source_permissions => ignore,
mode => 755,
require => File["C:\\tmp"],
}
exec {
"run-fusion-exe": path => "${::path};C:\\tmp",
provider => windows,
command => "cmd.exe /c c:\\tmp\fusioninventory-agent_windows_x64_2_3_12.exe /S /acceptlicense /debug=1 /server=http://10.1.64.149/mi-latte/plugins/fusioninventory /runnow",
require => File["C:\\tmp\fusioninventory-agent_windows_x64_2_3_12.exe"],
logoutput => true,
}
}
前两部分很好,除了当Windows代理到达最后一部分时,它会尝试执行运行安装程序静默模式的命令,而不是运行GUI界面,但通常会显示
返回2而不是0中的一个
据我理解:
我们称之为$path,因为Puppet没有用于Windows的内置shell。
路径目录通常使用双反斜杠指定为
单斜杠用其他东西处理。
Windows命令通常以cmd.exe/C开头
某些计算机不允许在主C:\root文件夹中保存文件
出于安全原因。
如果代码中定义的内容被认为是正确的,包括使用双引号而不是单引号,那么我有点不明白为什么命令在这里不断返回2,在我们等待版本4的时候,如果有什么东西可以说明它的话
顺便说一句,这个傀儡主机使用的是3.6.0,目标机器是Windows 2008 R2 64位。如果logoutput=>true,理想情况下,傀儡输出中应该有更多的命令输出。你仔细看过了吗?您是否能够找出返回代码2在Windows上可能意味着什么?没有错误消息,但Windows中的错误代码2通常指出为未找到文件/可执行文件。通过进一步挖掘,我的案例似乎与大多数其他案例都有一定的关系,这就是Ruby 1.8/1.9的Puppet捆绑包的旧版本中存在一个bug,它经常导致cmd.exe使用32位而不是64位。根据文档,版本3.7.0包括Ruby 2.0,它也有64位的东西。或者在最坏的情况下,将为此目的编写自定义factor文件。