Closed jburns24 closed 3 years ago
We actually no longer support Ubuntu 16.04 since it's going EOL very soon. I just updated the README to ensure that's now stated.
This happens on Ubuntu 20.04 as well. If default['apparmor']['disable']
is not set in the consumer's attributes, node['apparmor']
will evaluate to nil
and cause this undefined method error.
@mehagar unfortunately I'm not able to replicate the issue on my end, even following your detailed (thanks!) instructions. Also, I see you have Chef 14 listed, but this cookbook only supports >= 15. I'm not sure how you were able to run this cookbook with Chef 14.
The metadata allows Chef >= 12.7: https://github.com/sous-chefs/mysql/blob/f7c92af098bca2936a6189aec1344c63f8ad5c2d/metadata.rb#L8
I'm also hitting this with Chef 14.15.6 and temporarily solved it by adding the following before calling mysql_service
:
node.default['apparmor']['disable'] = true
The fact that some tests have this same "fix" is a bit suspect to me: https://github.com/sous-chefs/mysql/blob/844036bde95721c401ce5309007787babdfc412d/test/cookbooks/test/recipes/smoke.rb#L9-L10
I don't have access to Chef 15 at the moment to confirm, but if it's working there, that'd imply to me that either Chef 15 changed nodes to allow deep access through undefined keys (ie. node['foo']['bar']['baz']
doesn't error even if node['foo']
is never set), or Chef 15 started setting a node['apparmor']
key on it's own.
Apologies, I had forgotten that my cookbook generator template adds a requirement for Chef >=15. I also realized I was testing this using dokken which bypasses the problem completely. I was able to reproduce the problem and will work on a PR to address it soon.
@cgunther I believe #662 resolves this. Can you please verify?
:speaking_head: Foreword
Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.
:ghost: Brief Description
Unable to create mysql service v5.7 on Ubuntu 16.04
:pancakes: Cookbook version
10.0.1
:woman_cook: Chef-Infra Version
14.15.6
:tophat: Platform details
ubuntu 16.04
Steps To Reproduce
Steps to reproduce the behavior: 1) Generate a new test cookbook
chef generate cookbook mysql_test -b
2) Add the following dependencies to the berksfile and thedepends
statement to metadata.rbcookbook 'apt', '~> 7.4.0'
cookbook 'mysql', '~> 10.0.1'
3) Updatekitchen.yml
to target chef 14 and ubuntu 16.04provisioner: name: chef_zero product_name: chef product_version: 14 always_update_cookbooks: false
verifier: name: inspec
platforms:
suites:
include_recipe 'apt'
mysql_service 'default' do port '3306' version '5.7' initial_root_password 'changeme' action [:create, :start] end