Problem: When I run puppet to provision the box the first time, I will have dependency failed errors and the files with these errors (apache-solr-dataimporthandler-3.6.1.jar) are not copied to their target destination. However doing the provisioning a second time there are no longer the dependency errors and all files seem to be copied correctly.
How can the dependency errors be solved without re-provisioning? Why is this happening?
Manifest
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'],
}
Error
←[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
Directory Structure

it seems to me that puppet complains that the directory
/var/lib/tomcat6/webapps/solr/WEB-INF/lib/does not exist when it tries to create/var/lib/tomcat6/webapps/solr/WEB-INF/lib/apache-solr-dataimporthandler-3.6.1.jar.I suspect that this directory is created when the new
.warget detected by tomcat, but it happens too late and you have to relaunch puppet.So you may want to explicitely ensure creation of this dir with :
(omitting the “require” because it seems that puppet creates them in the order they are defined)
I’m not a tomcat expert, but you may want to ensure that creating the dirs manually will not interfere with tomcat .war auto-detection system.