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

时间:2015-04-17 13:43:40

标签: puppet

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

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

请建议克服这个问题。

1 个答案:

答案 0 :(得分:2)

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

而不是

/opt/softwares/ant/bin/ant

您需要指定

/opt/softwares/ant/bin

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