Puppet:使用 validate_cmd 时如何为临时文件强制执行特定文件扩展名

Puppet: how to enforce a certain file extension for the tempfile when using validate_cmd

我正在使用 puppet 生成 consul 配置文件。我还想使用 validate_cmd 验证文件。不幸的是,puppet 生成的文件名类似于 my-service.json20171026-6787-5on04g,但 consul validate 需要 .json 扩展名。

如何强制 Puppet 生成扩展名为 .json 的临时文件?

file { "${consul_clientconfig_dir}/${name}.json":
  ...
  content      => template("${module_name}/template.json.erb"),
  validate_cmd => "${consul_binary_dir}/consul validate %",
  notify       => Exec['consul_reload']
}

我使用的是 consul 1.0.0 和一个相当古老的木偶版本 3.8。

目前似乎不可能(请参阅上面的@MattSchuchard 评论)。

幸运的是,consul 1.0.1 带来了 -config-format 选项,它没有回答我最初的问题,但解决了我的问题。