在 puppet 模块下运行时出现以下错误。我有 2 个代理,一个是 ubuntu 18.04 和 centos7
下面的代码在 ubuntu 中工作并停止防火墙,但在 centos 中我得到了以下错误。
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: {"message":"Server Error: Evaluation Error: A substring operation does not accept a String as a character index. Expected an Integer (file: /etc/puppetlabs/code/modules/service_disable_firewall/manifests/init.pp, line: 9, column: 21) on node node-01.home86.com","issue_kind":"RUNTIME_ERROR"} Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run
第 9 行是
case $facts['os']['family'] {
我的代码是
class service_disable_firewall {
case $facts['os']['family'] {
'Debian': {
service { 'ufw':
ensure => stopped,
}
}
'RedHat': {
service { 'firewalld':
ensure => stopped,
}
}
}
}
提前致谢
最佳答案
更改“案例”后问题得到解决,如下所示
case $::operatingsystem {
但仍然不确定为什么我的第一个代码会失败。
关于ubuntu - centos 上的 puppet fact 失败但在 ubuntu 中有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54952517/