Hi everyone, Does anyone knows how to use attribute with the use of chef-apply ? I have the following structure: generator/metadata.rb generator/attributes/default.rb generator/templates/default/test.erb generator/recipes/default.rb cat generator/attributes/default.rb default[‘generator’][’test’] = ’test’ cat generator/recipe/default.rb puts node[‘generator’][’test’] Of course by running in another directory: /tmp/generator $ chef-apply recipes/default.rb -l debug [2015-02-04T01:10:47+01:00] DEBUG: Building node object for XXXXXXXX [2015-02-04T01:10:47+01:00] DEBUG: Extracting run list from JSON attributes provided on command line [2015-02-04T01:10:47+01:00] DEBUG: Applying attributes from json file [2015-02-04T01:10:47+01:00] DEBUG: Platform is debian version 8.0 [2015-02-04T01:10:47+01:00] INFO: Run List is [] [2015-02-04T01:10:47+01:00] INFO: Run List expands to [] [2015-02-04T01:10:47+01:00] INFO: Unable to access cache at /var/chef. Switching cache to /home/jmauro/.chef [2015-02-04T01:10:47+01:00] INFO: Unable to access cache at /var/chef. Switching cache to /home/jmauro/.chef [2015-02-04T01:10:47+01:00] FATAL: Stacktrace dumped to /home/jmauro/.chef/cache/chef-stacktrace.out [2015-02-04T01:10:47+01:00] DEBUG: NoMethodError: undefined method `[]' for nil:NilClass recipes/default.rb:20:in `run_chef_recipe' /home/jmauro/.gem/ruby/2.1.0/gems/chef-11.18.0/lib/chef/application/apply.rb:141:in `instance_eval' /home/jmauro/.gem/ruby/2.1.0/gems/chef-11.18.0/lib/chef/application/apply.rb:141:in `run_chef_recipe' /home/jmauro/.gem/ruby/2.1.0/gems/chef-11.18.0/lib/chef/application/apply.rb:153:in `run_application' /home/jmauro/.gem/ruby/2.1.0/gems/chef-11.18.0/lib/chef/application/apply.rb:166:in `run' /home/jmauro/.gem/ruby/2.1.0/gems/chef-11.18.0/bin/chef-apply:25:in `<top (required)>' /home/jmauro/.gem/ruby/2.1.0/bin/chef-apply:23:in `load' /home/jmauro/.gem/ruby/2.1.0/bin/chef-apply:23:in `<main>' [2015-02-04T01:10:47+01:00] FATAL: NoMethodError: undefined method `[]' for nil:NilClass Is there a way to use attribute or this is simply an anti-pattern? |
Archive powered by MHonArc 2.6.16.