0

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.

Zama Ques
  • 523
  • 1
  • 9
  • 24
  • I don't think you've included all of your `subversion.pp` class given the Puppet error is referencing an `Exec` resource in that class. – bodgit Jul 20 '16 at 17:58

1 Answers1

3

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.

bodgit
  • 4,751
  • 16
  • 27
  • Yeah..I have not included the exec thing just to make it short... My concern is why the file is not getting copied – Zama Ques Jul 20 '16 at 18:07
  • So what you've done is actually remove the pertinent information. – bodgit Jul 20 '16 at 18:15
  • ok..I just updated with the Exec information. Thanks – Zama Ques Jul 20 '16 at 18:27
  • Ok, so the `Exec` does require the `File` resource for `/home/agile/svncheckout.sh`. However, it's still not going to work until you apply the fix in my answer. Do that and see what happens next. – bodgit Jul 20 '16 at 18:39
  • I updated the test command with full path as you suggested . The error is gone. But the main the files are not getting copied ..Please suggest... – Zama Ques Jul 20 '16 at 18:39
  • Error is gone.. But the files are not getting copied.. Is it any issue where I have put the source directories as mentioned in original description – Zama Ques Jul 20 '16 at 18:52
  • What errors are logged? If Puppet can't find the source for the file I'd expect it to log something. I would also put your modules under `.../code/modules/` or `.../code/environments/production/modules/`. – bodgit Jul 20 '16 at 18:57
  • Tried putting modules under production/modules/ but no luck – Zama Ques Jul 21 '16 at 09:41