有谁知道我为什么会遇到这个问题。
我不知道我在ubuntu机器上做这件事的原因。
如果遇到类似的问题,请帮助我。
机器配置: Ruby 2.2.1 厨师12服务器 OS Ubuntu
Running verification for component 'berkshelf'
Running verification for component 'test-kitchen'
Running verification for component 'tk-policyfile-provisioner'
Running verification for component 'chef-client'
Running verification for component 'chef-dk'
Running verification for component 'chef-provisioning'
Running verification for component 'knife-spork'
Running verification for component 'delivery-cli'
Running verification for component 'git'
Running verification for component 'opscode-pushy-client'
Running verification for component 'chef-sugar'
..............
Generating cookbook example
- Ensuring correct cookbook file content
================================================================================
Error executing action `create_if_missing` on resource 'template[/tmp/d20160922-20221-1do1qzg/example/spec/unit/recipes/default_spec.rb]'
================================================================================
Chef::Mixin::Template::TemplateError
------------------------------------
undefined method `gsub' for nil:NilClass
Resource Declaration:
---------------------
# In /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.17.17/lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb
84: template "#{cookbook_dir}/spec/unit/recipes/default_spec.rb" do
85: source "recipe_spec.rb.erb"
86: helpers(ChefDK::Generator::TemplateHelper)
87: action :create_if_missing
88: end
89:
Compiled Resource:
------------------
# Declared in /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.17.17/lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb:84:in `from_file'
template("/tmp/d20160922-20221-1do1qzg/example/spec/unit/recipes/default_spec.rb") do
action [:create_if_missing]
retries 0
retry_delay 2
default_guard_interpreter :default
source "recipe_spec.rb.erb"
helper_modules [ChefDK::Generator::TemplateHelper]
declared_type :template
cookbook_name :code_generator
recipe_name "cookbook"
atomic_update true
path "/tmp/d20160922-20221-1do1qzg/example/spec/unit/recipes/default_spec.rb"
end
Template Context:
-----------------
on line #5
3: # Spec:: default
4: #
5: <%= license_description('#') %>
6:
7: require 'spec_helper'
Platform:
---------
x86_64-linux
ERROR: Chef failed to converge:
Chef::Mixin::Template::TemplateError (undefined method `gsub' for nil:NilClass) on line #5:
3: # Spec:: default
4: #
5: <%= license_description('#') %>
6:
7: require 'spec_helper'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.17.17/lib/chef-dk/generator.rb:155:in `license_description'
(erubis):5:in `block in evaluate'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/erubis-2.7.0/lib/erubis/evaluator.rb:74:in `instance_eval'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/erubis-2.7.0/lib/erubis/evaluator.rb:74:in `evaluate'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/mixin/template.rb:161:in `_render_template'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/mixin/template.rb:147:in `render_template'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/provider/template/content.rb:53:in `file_for_provider'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/file_content_management/content_base.rb:40:in `tempfile'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/provider/file.rb:462:in `tempfile'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/provider/file.rb:339:in `do_generate_content'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/provider/file.rb:150:in `action_create'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/provider/file.rb:162:in `action_create_if_missing'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/provider.rb:145:in `run_action'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/resource.rb:603:in `run_action'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/runner.rb:69:in `run_action'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/runner.rb:97:in `block (2 levels) in converge'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/runner.rb:97:in `each'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/runner.rb:97:in `block in converge'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
/opt/chefdk/embedded/lib/ruby/2.1.0/forwardable.rb:183:in `execute_each_resource'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37/lib/chef/runner.rb:96:in `converge'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.17.17/lib/chef-dk/chef_runner.rb:43:in `converge'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.17.17/lib/chef-dk/command/generator_commands/cookbook.rb:82:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.17.17/lib/chef-dk/command/generate.rb:88:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.17.17/lib/chef-dk/command/base.rb:58:in `run_with_default_options'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.17.17/lib/chef-dk/cli.rb:73:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.17.17/bin/chef:25:in `<top (required)>'
/opt/chefdk/bin/chef:74:in `load'
/opt/chefdk/bin/chef:74:in `<main>'
Caused by: (Chef::Mixin::Template::TemplateError) undefined method `gsub' for nil:NilClass
......................................
---------------------------------------------
Verification of component 'rubocop' succeeded.
Verification of component 'kitchen-vagrant' succeeded.
Verification of component 'openssl' succeeded.
Verification of component 'delivery-cli' succeeded.
Verification of component 'opscode-pushy-client' succeeded.
Verification of component 'berkshelf' succeeded.
Verification of component 'tk-policyfile-provisioner' succeeded.
Verification of component 'fauxhai' succeeded.
Verification of component 'inspec' succeeded.
Verification of component 'chef-sugar' succeeded.
Verification of component 'test-kitchen' succeeded.
Verification of component 'chef-dk' failed.
Verification of component 'chefspec' succeeded.
Verification of component 'knife-spork' succeeded.
Verification of component 'chef-client' succeeded.
Verification of component 'generated-cookbooks-pass-chefspec' succeeded.
Verification of component 'chef-provisioning' succeeded.
Verification of component 'package installation' succeeded.
Verification of component 'git' succeeded.