Migrating Puppet Code to Puppet 4: Issue with Classes
We are migrating our Puppet Code from 3.5.7
to 4.5.2
While applying manifests I am getting following error
Error: Failed to apply catalog: Parameter unless failed on Exec[sh /home/agile/svncheckout.sh]: 'test -f /home/agile/subversion.done' is not qualified and no path was specified. Please qualify the command or specify a path. at /apps/wps/puppetlabs/code/environments/production/manifests/classes/subversion.pp:17
The main code is as follows:
node 'Node-002' {
include user_default
include standard
include subversion
# include java
include sybase
# include eclipse
# include oxygen
$fqdn="Node-002.wiley.com"
file { "/home/agile/properties":
ensure => present,
owner => agile,
group => agile,
source => "puppet://puppet/templates/${fqdn}/properties",
}
file { "/home/agile/.bashrc":
ensure => present,
owner => agile,
group => agile,
source => "puppet://puppet/files/.bashrc",
require => Class['sybase'],
}
file { "/home/agile/setup_firefox3v622.sh":
ensure => present,
owner => agile,
mode => "755",
require => Class['subversion'],
source => "puppet://puppet/scripts/setup_firefox3v622.sh
}
}
Class subversion.pp
is as follows
class subversion {
package {'subversion':
ensure => installed,
}
file {'/home/agile/svncheckout.sh':
ensure => present,
group => agile,
mode => "755",
source => "puppet://puppet/scripts/svncheckout.sh",
require => [ Package['subversion'], Class['user_default'] ],
before => [Class['apache1'], Class['sybase']],
}
exec { "sh /home/agile/svncheckout.sh":
user => agile,
timeout => 0,
logoutput => true,
#path => "/usr/sbin:/usr/bin:/bin",
require => [ Package['subversion'], Class['user_default'], File['/home/agile/svncheckout.sh'] ],
before => [ Class['apache1'], Class['sybase'] ],
unless => "test -f /home/agile/subversion.done",
}
}
It looks like svncheckout.sh
is not getting copied to /home/agile/svncheckout.sh
location.
Code Configuration is as follows in puppet.conf: codedir = /app/zama/puppetlabs/code
Based on that I copied scripts,files and templates
as defined in source
parameter to the following location
$ls
environments files modules scripts templates
$pwd
/app/zama/puppetlabs/code
I think I am not sure exactly where to place thoe files as per source
manifests above.
You've not included all of your subversion.pp but it looks like you have something like the following:
exec { 'sh /home/agile/svncheckout.sh':
unless => 'test -f /home/agile/subversion.done',
...
}
The error is that the test
command is not qualified. Either change it to /bin/test
or add a path => ...
parameter that includes /bin
or wherever test
is.