Puppet 错误:服务器上出现 400:语法错误

Puppet 错误:服务器上出现 400:语法错误

运行 Puppet 时出现语法错误,但我不知道原因:

错误:无法从远程服务器检索目录:服务器上的错误 400:'String' 处的语法错误;预期为 ')',位于 /etc/puppet/modules/riak/manifests/init.pp:17

这是 init.pp 文件:

# == Class: riak
#
# Deploy and manage Riak.
#
# === Parameters
#
# [*$package_name*]
# [*$service_name*]
# [*$manage_package*]
# [*$manage_repo*]
# [*$version*]
# [*$ulimits_nofile_soft*]
# [*$ulimits_nofile_hard*]


class riak ( 
  String[1] $package_name       = $::riak::params::package_name,
  String[1] $service_name       = $::riak::params::service_name,
  Boolean $manage_package       = $::riak::params::manage_package,
  Boolean $manage_repo          = $::riak::params::manage_repo,
  String[1] $version            = $::riak::params::version,
  Integer $ulimits_nofile_soft  = $::riak::params::ulimits_nofile_soft,
  Integer $ulimits_nofile_hard  = $::riak::params::ulimits_nofile_hard,
  Hash[String, Variant[String, Boolean, Integer]] $settings = {},
)
inherits ::riak::params {
  if $manage_repo and $manage_package {
    include ::riak::repository
  }
  if $manage_package {
    include ::riak::install
    Package[$::riak::package_name] ~> File[$::riak::params::riak_conf]
  }
  class { '::riak::config': } ~>
  class { '::riak::service': } ->
  Class['::riak']
}

知道语法错误从何而来吗?

答案1

数据类型声明对于 Puppet 4 来说是新的;您是否试图在 Puppet 3.x 或更早版本的 Puppet Master 上使用它?

答案2

我认为您应该删除参数声明中的最后一个“,”例如:

class riak ( 
  String[1] $package_name       = $::riak::params::package_name,
  String[1] $service_name       = $::riak::params::service_name,
  Boolean $manage_package       = $::riak::params::manage_package,
  Boolean $manage_repo          = $::riak::params::manage_repo,
  String[1] $version            = $::riak::params::version,
  Integer $ulimits_nofile_soft  = $::riak::params::ulimits_nofile_soft,
  Integer $ulimits_nofile_hard  = $::riak::params::ulimits_nofile_hard,
  Hash[String, Variant[String, Boolean, Integer]] $settings = {}
)

相关内容