在木偶EXEC锤命令失败(工头1.20.1)

问题描述 投票:0回答:1

我试图用锤子在工头1.20.1在CentOS 7.6刷新代理功能(或只是比其他--version任何其他命令)在木偶EXEC。我使用的命令在shell工作正常。它未能在木偶Exec用:

错误:注意未定义局部变量或方法`dotfile”:/舞台[主] /概况::测试/执行[测试] /回报:你是什么意思? @@ dotfile说明:/阶段[主要] /概况::测试/执行[测试] /返回:错误:没有这样的子命令“代理”。

我使用的代码是:

class profiles::test{
  exec {'test':
    command => '/usr/bin/hammer proxy refresh-features --name $(hostname)',
  }
}
include profiles::test

我不关心幂等,因为这将有refreshonly,我只想得到命令的工作。

我曾尝试加入其他选项,如路径,用户,环境等也没有用。任何帮助表示赞赏。

puppet foreman hammer
1个回答
1
投票

从线索,我发现在https://github.com/awesome-print/awesome_print/issues/316https://grokbase.com/t/gg/puppet-users/141mrjg2bw/problems-with-onlyif-in-exec,事实证明,HOME环境必须设置。因此,工作代码为:

  exec {'test':
    command     => '/usr/bin/hammer proxy refresh-features --name $(hostname)',
    environment => ["HOME=/root"],
    refreshonly => true,
  }

f'ing红宝石!

© www.soinside.com 2019 - 2024. All rights reserved.