0

问题:当我第一次运行 puppet 来配置 box 时,我会遇到依赖失败错误,并且带有这些错误 ( 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

目录结构

在此处输入图像描述

4

1 回答 1

0

在我看来,puppet/var/lib/tomcat6/webapps/solr/WEB-INF/lib/在尝试创建时抱怨该目录不存在/var/lib/tomcat6/webapps/solr/WEB-INF/lib/apache-solr-dataimporthandler-3.6.1.jar

我怀疑这个目录是在.wartomcat检测到新目录时创建的,但它发生得太晚了,你必须重新启动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 专家,但您可能希望确保手动创建目录不会干扰 tomcat .war 自动检测系统。

于 2012-10-10T13:44:31.847 回答