我有一个基于Beaker的带有验收测试的Puppet模块。该模块工作正常,当在本地运行时,所有验收测试都运行良好。但是当我在Travis上运行测试时,我在模块执行中得到了以下错误:
/Stage[main]/Alfred::Services/Service[alfred]: Could not evaluate: undefined method `[]' for nil:NilClassAlfred是一个基于upstart的系统服务,它是我模块的一部分。我使用的是Puppet 4.3.2。这是travis的构建:https://travis-ci.org/nicopaez/alfred-puppet
有什么想法吗?
发布于 2016-04-03 03:04:00
看一下代码,有几个问题。
其一是您在Travis中使用的环境变量没有设置Puppet版本。您需要将该代码添加到spec_helper_acceptance.rb中
hosts.each do |host|
install_puppet_on(host,
:puppet => ENV['PUPPET_VERSION'] || '4.3.2',
)
end现在它还在安装Puppet 3.8 (默认的最新版本)
有关Travis,I forked your repo and did a build中实际导致问题的原因的更多信息,其中我启用了beaker的调试和跟踪选项:
result = apply_manifest(pp, :trace => true, :debug => true)因此,看一下Travis构建,git克隆exec有一个问题:
Debug: Exec[clone-repo](provider=posix): Executing 'git clone https://github.com/fiuba/alfred.git /var/www/alfred'
Debug: Executing 'git clone https://github.com/fiuba/alfred.git /var/www/alfred'
Notice: /Stage[main]/Alfred::App/Exec[clone-repo]/returns: fatal: Could not change back to '/root': Permission denied
Error: git clone https://github.com/fiuba/alfred.git /var/www/alfred returned 128 instead of one of [0]您可以通过使用vcsrepo模块来修复此问题,该模块以一种更强大的方式执行git克隆:
vcsrepo { '/var/www/alfred':
ensure => present,
source => 'https://github.com/fiuba/alfred.git',
provider => git,
user => 'deployer',
}还有一些其他的修复,我正在PRing你的模块的一些修复来修复它们,并将在您检查和合并后在堆栈溢出答案中添加一个摘要,因为其中一些是通过几种不同的方法进行的重要重构。
https://stackoverflow.com/questions/36356858
复制相似问题