问题:当我第一次运行puppet配置盒子时,我将遇到依赖性失败错误,并且包含这些错误的文件(apache-solr-dataimporthandler-3.6.1.jar
)不会复制到目标目标。但是,第二次进行配置时,不再存在依赖性错误,并且所有文件似乎都被正确复制。
如何在不重新配置的情况下解决依赖性错误?为什么会这样?
清单
file { '/var/lib/tomcat6/webapps/solr.war':
ensure => present,
owner => root,
group => root,
mode => 644,
source => 'puppet:///modules/solr/apache-solr-3.6.1.war',
notify => Service['tomcat'],
}
file { '/usr/share/solr':
ensure => present,
source => 'puppet:///modules/solr/solr',
recurse => true,
require => File['/var/lib/tomcat6/webapps/solr.war'],
notify => Service['tomcat'],
}
file { '/var/lib/tomcat6/webapps/solr/WEB-INF/web.xml':
ensure => present,
owner => root,
group => root,
mode => 644,
source => 'puppet:///modules/solr/web.xml',
require => [ File['/var/lib/tomcat6/webapps/solr.war'], File['/usr/share/solr'] ],
}
file { '/var/lib/tomcat6/webapps/solr/WEB-INF/lib/apache-solr-dataimporthandler-3.6.1.jar':
ensure => present,
owner => root,
group => root,
mode => 644,
source => 'puppet:///modules/solr/apache-solr-dataimporthandler-3.6.1.jar',
require => File['/var/lib/tomcat6/webapps/solr.war'],
notify => Service['tomcat'],
}
错误
←[0;36mnotice: /Stage[main]/Solr/File[/var/lib/tomcat6/webapps/solr.war]/ensure: defined content as'{md5}ae7997a401f9d223b097f8a88259689e'←[0m
←[1;35merr: /Stage[main]/Solr/File[/var/lib/tomcat6/webapps/solr/WEB-INF/lib/apache-solr-dataimporthandler-3.6.1.jar]/ensure: change from absent to file failed: Could not set 'file on ensure: No such file or directory - /var/lib/tomcat6/webapps/solr/WEB-INF/lib/apache-solr-dataimporthandler-3.6.1.jar.puppettmp_4049 at /tmp/vagrant-puppet/modules-0/solr/manifests/init.pp:37←[0m
←[0;36mnotice: /Stage[main]/Solr/File[/usr/share/solr]/ensure: created←[0m
...
...
...
←[0;36mnotice: /Stage[main]/Tomcat/Service[tomcat]: Dependency File[/var/lib/tomcat6/webapps/solr/WEB-INF/lib/apache-solr-dataimporthandler-3.6.1.jar] has failures: true←[0m
←[0;33mwarning: /Stage[main]/Tomcat/Service[tomcat]: Skipping because of failed dependencies←[0m
←[0;36mnotice: /Stage[main]/Tomcat/Service[tomcat]: Triggered 'refresh' from 6 events←[0m
←[0;36mnotice: /Stage[main]/Solr/File[/var/lib/tomcat6/webapps/solr/WEB-INF/web.xml]/content: content changed '{md5}1b3a494d9ddefb9bef08caa5146cfd32' to '{md5}f3b9d07f7585ef8008f2bcf0407596f2'←[0m
←[0;36mnotice: /Stage[main]/Solr/File[/var/lib/tomcat6/webapps/solr/WEB-INF/web.xml]/owner: owner changed 'tomcat6' to 'root'←[0m
←[0;36mnotice: /Stage[main]/Solr/File[/var/lib/tomcat6/webapps/solr/WEB-INF/web.xml]/group: group changed 'tomcat6' to 'root'←[0m
←[0;36mnotice: Finished catalog run in 18.90 seconds←[0m
目录结构
答案 0 :(得分:0)
在我看来,木偶抱怨目录/var/lib/tomcat6/webapps/solr/WEB-INF/lib/
在尝试创建/var/lib/tomcat6/webapps/solr/WEB-INF/lib/apache-solr-dataimporthandler-3.6.1.jar
时不存在。
我怀疑这个目录是在tomcat检测到新的.war
时创建的,但是发生得太晚了,你必须重新启动puppet。
因此,您可能希望通过以下方式明确确保创建此目录:
file
{
'/var/lib/tomcat6/webapps/solr':
ensure => directory,
;
'/var/lib/tomcat6/webapps/solr/WEB-INF':
ensure => directory,
;
'/var/lib/tomcat6/webapps/solr/WEB-INF/lib':
ensure => directory,
;
}
(省略“要求”,因为木偶似乎按照定义的顺序创建它们)
我不是tomcat专家,但您可能希望确保手动创建dirs不会干扰tomcat .war自动检测系统。