在 Puppet 的 exec 资源中指定正确的搜索路径

Specifying the correct search paths in Puppet's exec resource

我一直致力于 Puppet 的工作,以自动化我们的部署过程。我们使用 Ant 工具将代码部署到 Tomcat 服务器,我正在尝试为这些东西开发清单

Puppet 无法识别路径变量中提到的命令,我可以手动 运行 我的 ant 命令,它位于 /opt/softwares/ant/bin/ant 中。

这是我面临的错误

exec { "ant themes":
  command =>  "ant build-themes",
   cwd => "/opt/liferay6/portal/portal-web",
   path => [ "/usr/bin", "/bin", "/opt/softwares/ant/bin/ant" ],
    }


Notice: Compiled catalog for liferay in environment production in 0.04 seconds
Notice: /Stage[main]/Main/Exec[ant themes]/returns: current_value notrun, should be 0 (noop)
Notice: Class[Main]: Would have triggered 'refresh' from 1 events
Notice: Stage[main]: Would have triggered 'refresh' from 1 events
Notice: Finished catalog run in 13.63 seconds
vidyayug@liferay:~/puppet/modules/liferay6/manifests$ sudo puppet apply 1.pp
Notice: Compiled catalog for liferay in environment production in 0.04 seconds
Error: Could not find command 'ant'
Error: /Stage[main]/Main/Exec[ant themes]/returns: change from notrun to 0 failed: Could not find command 'ant'
Notice: Finished catalog run in 13.59 seconds

请指教解决问题。

您使用的搜索路径不正确。

而不是

/opt/softwares/ant/bin/ant

您需要指定

/opt/softwares/ant/bin

以便在该目录中找到 ant 命令。