I have an attribute file titled
default.rb
default['current']
# Run database migrations
execute 'database migrations' do
user 'ubuntu'
cwd "#{default['current']}"
command 'sudo php artisan down && sudo php artisan migrate --force && sudo php artisan up'
end
NameError
---------
No resource, method, or local variable named `default' for `Chef::Recipe "deploy"'
When attributes are referenced in a recipe, we need to prefix them with node.default
, like this:
cwd "#{node.default['current']}"
See also: Overriding attributes in the recipe