ubuntu - centos 上的 puppet fact 失败但在 ubuntu 中有效

标签 ubuntu puppet centos7 puppet-enterprise fact

在 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/

相关文章:

git - 将 git 配置从 Windows 移动到 Ubuntu

puppet - 如何避免 hiera 数据中出现 "write everything twice"?

puppet - 在 puppet 类之间传递变量

python - 使用 Centos 7 和 Python 3.4 的 PIL

ubuntu - 替换终端中的字符

docker - 从 Microsoft 商店安装的 ubuntu20.04 的 shell 脚本中出现 pushd 错误

php - 以另一个用户身份运行 shell 命令或更改 Apache 的用户?

ubuntu-12.04 - vagrant puppet 模块路径

linux - bash ffmpeg 命令未找到

linux - 如何在 CentOS7 中更改 crontab 的默认编辑器?