NoMethodError when data bag is not set
The default.rb
checks if node['omnibus-gitlab']['data_bag']
is set, and if not, it assigns environment_secrets
to an empty hash. However, at line 41, the hash set is accessed assuming it has entries. This results in the following error:
==> default: Recipe Compile Error in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/cookbook-omnibus-gitlab/recipes/default.rb
==> default: ================================================================================
==> default:
==> default: NoMethodError
==> default: -------------
==> default: undefined method `[]' for nil:NilClass
==> default:
==> default: Cookbook Trace:
==> default: ---------------
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/cookbook-omnibus-gitlab/recipes/default.rb:41:in `from_file'
You should either fail fast by stating that the data_bag is required, or avoid that error.