将 Puppet 代码迁移到 Puppet 4:类问题

将 Puppet 代码迁移到 Puppet 4:类问题

我们正在将 Puppet 代码从 迁移3.5.74.5.2

在应用清单时我收到以下错误

  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

主要代码如下:

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
    }
  }

subversion.pp如下

  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",
 }

}

看起来它svncheckout.sh尚未被复制到/home/agile/svncheckout.sh位置。

puppet.conf中的代码配置如下:codedir = /app/zama/puppetlabs/code

根据我复制的参数scripts,files and templates定义source到以下位置

   $ls
  environments  files  modules  scripts templates
   $pwd
   /app/zama/puppetlabs/code

我认为我不确定根据source上述清单将这些文件放在哪里。

答案1

您没有包含所有的 subversion.pp,但看起来您有类似以下内容:

exec { 'sh /home/agile/svncheckout.sh':
  unless => 'test -f /home/agile/subversion.done',
  ...
}

错误是test命令不合格。请将其更改为,或者在命令中包含或/bin/test添加参数。path => .../bintest

相关内容