Puppet “傀儡”;无法将定义转换为数字";问题定义+;要求+;变量

Puppet “傀儡”;无法将定义转换为数字";问题定义+;要求+;变量,puppet,Puppet,我创建了define。 在“require”中使用define实例(define+参数)之前,一切都很好 比如: ------在这之前一切都很好------ 当我在'require'子句中使用这个foo[“这是我的${major\u version}-${minor\u version}”的标题]时,我得到了: Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error:

我创建了define。 在“require”中使用define实例(define+参数)之前,一切都很好

比如:

------在这之前一切都很好------

当我在'require'子句中使用这个foo[“这是我的${major\u version}-${minor\u version}”的标题]时,我得到了:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: The value 'this is title of my major-version-minor-version' **cannot be converted to Numeric**. on node 
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
行动!这很简单(愚蠢!)

  • 不要使用“-”作为变量之间的分隔符-它被解释为数字负号 比如:
    $http\u port=9999-${instance\u number}
  • 在'require'子句中使用“Foo”而不是“Foo”-也可以在使用“Foo:Foo”(子类/定义)时使用

  • 如果您有一个非大写的资源引用,也会发生这种情况,即

    require => package['ehs']
    
    将导致

    服务器上的错误400:评估错误:无法将值“ehs”转换为数字。在节点上

    因此,我的解决办法是将包中的“p”大写,如下所示:

    require => Package['ehs']
    

    是的,Puppet试图在类型和数字操作方面提供帮助。但是当您将表达式嵌入双引号字符串中时,您可以避免使用算术。
    Puppet apply-e'$foo=1$bar=2 notify{foo:message=>“$foo-$bar”}'
    require => Package['ehs']