0

我是木偶新手,我很困惑。

我正在安装 gcc、gcc-c++、openssl 和 openssl-devel。

在显示的代码中,$openssl_devel 有效,但 $c_plus 未定义。

为什么 puppet 将 $c_plus 设置为 'undef' ?

美分操作系统 6

class torque::prerequisites {
case $operatingsystem {
      centos,redhat: {$openssl_devel    = 'openssl-devel'}
      centos,redhat: {$c_plus           = 'gcc-c++'}

      debian,ubuntu: {$openssl_devel    = 'libssl-dev'}
      debian,ubuntu: {$c_plus           = 'build-essential'}

      default:{fail("Unable identify opperating system. $operatingsytem not recognized") }
    }

    package {'openssl':
      ensure => latest,
    }
    package {$openssl_devel:
      ensure   => latest,
      require => Package['openssl'],
    }
    package {'gcc':
        ensure => installed,
    }
    package {$c_plus:
        ensure => installed,
        require => Package['gcc'],
    }
}

class {'torque::prerequisites':}

木偶应用扭矩_先决条件

错误:/Stage[main]/Torque::Prerequisites/Package[undef]/ensure:从不存在更改为存在失败:找不到包 undef

4

1 回答 1

0

我仍然不知道为什么原始语法不起作用,但是这种语法确实有效:

class torque::prerequisites {
case $::osfamily {
    Redhat: {
      $openssl_devel = 'openssl-devel'
      $c_plus_compiler  = 'gcc-c++'
    }
    Debian: {
      $openssl_devel = 'libssl-dev'
      $c_plus_compiler = 'build-essential'
    }

  default:{fail("Unable identify opperating system. $operatingsytem not recognized") }
}

package {'openssl':
  ensure => latest,
}
package {$openssl_devel:
  ensure   => latest,
  require => Package['openssl'],
}
package {'gcc':
    ensure => installed,
}
package {$c_plus_compiler:
    ensure => installed,
    require => Package['gcc'],
}
}

class {'torque::prerequisites':}
于 2013-05-11T05:36:35.290 回答