Skip to content
This repository was archived by the owner on Jan 28, 2020. It is now read-only.
This repository was archived by the owner on Jan 28, 2020. It is now read-only.

Pass invalid cookbook name to "application" cookbook #5

@nnt

Description

@nnt

Here is the error message when I use application and application_nodejs cookbooks:

================================================================================
Error executing action `before_restart` on resource 'application_nodejs_nodejs[mynodejs]'
================================================================================


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


Cookbook Trace:
---------------
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application_nodejs/providers/nodejs.rb:76:in `block (2 levels) in class_from_file'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application_nodejs/providers/nodejs.rb:73:in `block in class_from_file'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:179:in `block in run_actions_with_context'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:176:in `each'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:176:in `run_actions_with_context'
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:167:in `block (2 levels) in run_deploy'


Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/resources/default.rb

115:       resource = super(resource_name.to_sym, self.name, &block)
116:       break



Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/resources/default.rb:115:in `block in method_missing'

application_nodejs_nodejs("mynodejs") do
  action [:nothing]
  retries 0
  retry_delay 2
  cookbook_name :mynodejs
  recipe_name "default"
  template "nodejs_pm2.upstart.conf.erb"
  type :nodejs
  npm true
  restart_command #<Proc:0x00000002923c98@/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application_nodejs/providers/nodejs.rb:32>
  environment {"NODE_ENV"=>"local"}
end

I got the issue fixed by went to application_nodejs/providers/nodejs.rb and edit this line:

cookbook new_resource.template ? new_resource.cookbook_name : 'application_nodejs'

to this:

cookbook new_resource.template ? new_resource.cookbook_name.to_s : 'application_nodejs'

Hope that there will be an official fix soon. Thank you :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions