sous-chefs/tomcat

[chef13][bug] tomcat systemd service not working anymore with default values

Closed this issue · 5 comments

Cookbook version

2.4.0

Chef-client version

chef-13.0.113-1.el7.x86_64.rpm

Platform Details

OS: CentOS7
Cloud Provider: Google Cloud

Scenario:

Trying to setup a service resource for tomcat using this cookbook's provider with default properties

# Enable tomcat service
  tomcat_service 'tomcat8' do
    action       :enable
    tomcat_user  'tomcat'
    tomcat_group 'tomcat'
  end

This end up with the following error:

RuntimeError
------------
tomcat_service_systemd[tomcat8] had an error: RuntimeError: can't modify frozen Array

Cookbook Trace:
---------------
[PATH]/cookbooks/tomcat/libraries/tomcat.rb:31:in `unshift'
[PATH]/cookbooks/tomcat/libraries/tomcat.rb:31:in `ensure_catalina_base'
[PATH]/cookbooks/tomcat/resources/service_systemd.rb:84:in `create_init'
[PATH]/cookbooks/tomcat/resources/service_systemd.rb:72:in `block in class_from_file'

Steps to Reproduce:

Use the tomcat resource and use the tomcat_service resource without specifying the env_vars property.

Expected Result:

Service gets created

Actual Result:

Service isn't created

Workaround:

  • Specify manually the env_vars property
  • Use chef 12

Where is the bug

/tomcat/libraries/tomcat.rb:31:in `unshift' : You're trying to unshift an array that is considered as frozen as it is a property. I think this is new in Chef 13.

Other Info

Since I found a work around, I'm not gonna submit a PR very quickly. but I'll probably correct it in the next refactor on my side and mak a PR for it if it isn't solved yet.

tas50 commented

Thanks for reporting this one. We're aware and we have a fix in the works

Thanks for reporting this. I also just discovered it by removing the example env_vars property. I will add it back.

yep, matching the example tomcat_service resource call (altering the path of the pid file of course) and the recipe runs fine.

tas50 commented

This was fixed in the 2.5.0 release. Give that a try and feel free to open this back up if you're still having problems

lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.