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



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

Puppet无法识别路径变量中提到的命令,我可以在其中手动运行我的ant命令,该命令位于/opt/softwares/ant/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 命令。

最新更新