/Users/saddam/cookbooks/apache/recipes/configure_apache.rb中的配方编译错误

时间:2016-03-03 14:55:59

标签: chef chef-solo chefspec

Chef::Exceptions::ValidationFailed
----------------------------------
Option cookbook_name must be a kind of [String]!  You passed :apache.

Relevant File Content:
----------------------
/Users/saddam/cookbooks/apache/recipes/configure_apache.rb:

 24:  if java_version == "7u55"
 25:    java_home = "/usr/java/jdk1.7.0_55"
 26:  else
 27:    Chef::Application.fatal!("Sorry, JAVA_HOME details not present in cookbook for the Java Version #{java_version}", 100)   
 28:  end
 29:  
 30:  
 31>> company_java_install "Installing Java #{java_version}" do
 32:    version java_version
 33:    user "vagrant"
 34:    group "vagrant"
 35:    cookbook_name "company_java"
 36:    action :install
 37:  end
 38:  Failures:

  1) apache::configure_apache removes a package with httpd
     Failure/Error: let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) }

     Chef::Exceptions::ValidationFailed:
       Option cookbook_name must be a kind of [String]!  You passed :apache.
     # ./recipes/configure_apache.rb:31:in `from_file'
     # ./spec/configure_apache_spec.rb:4:in `block (2 levels) in <top (required)>'
     # ./spec/configure_apache_spec.rb:7:in `block (2 levels) in <top (required)>'

Finished in 0.08475 seconds (files took 2.22 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/configure_apache_spec.rb:6 # apache::configure_apache removes a package with httpd

1 个答案:

答案 0 :(得分:0)

考虑查看LWRP中的默认值。它设置为:apache?我会将此作为评论添加,但我没有足够的声誉。