Search code examples
puppet

Specifying the correct search paths in Puppet's exec resource


I have been working on Puppet in order to automate our deployment process. We use Ant tool to deploy the code in to Tomcat server and I am trying to develop manifests for this stuff

Puppet is unable to recognize the command mentioned in the path variable where I can run my ant commands manually which is in /opt/softwares/ant/bin/ant.

This is the error I am facing

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

please advise to overcome the issue.


Solution

  • Your use of search paths is incorrect.

    Instead of

    /opt/softwares/ant/bin/ant
    

    you will need to specify

    /opt/softwares/ant/bin
    

    so that the ant command is found in that directory.