如何在人偶清单中格式化巧克力参数
How to format chocolatey params in puppet manifest
以下 choco 安装命令运行良好:
choco Install 'InstallTest' -y --source 'C:\installtest' --params="'/serverinstance:MyServer /buildtype:OTP'"
我现在在 Puppet 清单中有以下内容:
package { 'InstallTest':
ensure => installed,
install_options => ['-params','"', /serverinstance:MyServer, /buildtype:OTP, '"'],
source => 'c:\installtest',
}
我以为我用逗号等正确地覆盖了空格,但是 puppet 解析器抛出了以下错误:
puppet : [1;31mError: Could not parse for environment production: invalid byte sequence in UTF-8[0m
没有 install_options 行,它可以正常编译。
正确的语法应该是什么?
问题出在这里:
install_options => ['-params','"', /serverinstance:MyServer, /buildtype:OTP, '"'],
虽然 Puppet 可以接受 bare words as strings,但对此类字符串的内容有限制。这里相关的是他们必须
Begin with a lower case letter, and contain only letters, digits, hyphens (-
), and underscores (_
).
因此,您正在寻找这个:
install_options => ['-params', '"', '/serverinstance:MyServer', '/buildtype:OTP', '"'],
总的来说,引用所有字符串是更好的风格,无论它们是否需要。这样更清楚,也能让你远离麻烦。
以下 choco 安装命令运行良好:
choco Install 'InstallTest' -y --source 'C:\installtest' --params="'/serverinstance:MyServer /buildtype:OTP'"
我现在在 Puppet 清单中有以下内容:
package { 'InstallTest':
ensure => installed,
install_options => ['-params','"', /serverinstance:MyServer, /buildtype:OTP, '"'],
source => 'c:\installtest',
}
我以为我用逗号等正确地覆盖了空格,但是 puppet 解析器抛出了以下错误:
puppet : [1;31mError: Could not parse for environment production: invalid byte sequence in UTF-8[0m
没有 install_options 行,它可以正常编译。
正确的语法应该是什么?
问题出在这里:
install_options => ['-params','"', /serverinstance:MyServer, /buildtype:OTP, '"'],
虽然 Puppet 可以接受 bare words as strings,但对此类字符串的内容有限制。这里相关的是他们必须
Begin with a lower case letter, and contain only letters, digits, hyphens (
-
), and underscores (_
).
因此,您正在寻找这个:
install_options => ['-params', '"', '/serverinstance:MyServer', '/buildtype:OTP', '"'],
总的来说,引用所有字符串是更好的风格,无论它们是否需要。这样更清楚,也能让你远离麻烦。