You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was deploying a cookbook which included recipes from chef-proxysql and there were some issues, as you see in the stack trace and the logs below:
Compiling Cookbooks...
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/proxysql/libraries/base_service.rb
================================================================================
FrozenError
-----------
can't modify frozen ArrayCookbook Trace:--------------- /var/chef/cache/cookbooks/poise/files/halite_gem/poise/helpers/subresources/container.rb:220:in `included'
/var/chef/cache/cookbooks/poise/files/halite_gem/poise/resource.rb:51:in `include' /var/chef/cache/cookbooks/poise/files/halite_gem/poise/resource.rb:51:in `poise_subresource_container' /var/chef/cache/cookbooks/poise/files/halite_gem/poise.rb:93:in `block in Poise' /var/chef/cache/cookbooks/proxysql/libraries/base_service.rb:8:in `include'
/var/chef/cache/cookbooks/proxysql/libraries/base_service.rb:8:in `<class:ProxysqlBaseService>' /var/chef/cache/cookbooks/proxysql/libraries/base_service.rb:7:in `<class:Resource>' /var/chef/cache/cookbooks/proxysql/libraries/base_service.rb:6:in `<class:Chef>' /var/chef/cache/cookbooks/proxysql/libraries/base_service.rb:5:in `<top (required)>'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/poise/files/halite_gem/poise/helpers/subresources/container.rb:
213: @container_default
214: end
215: end
216:
217: def included(klass)
218: super
219: klass.extend(ClassMethods)
220>> klass.const_get(:HIDDEN_IVARS) <<:@subcontexts221: klass.const_get(:FORBIDDEN_IVARS) << :@subcontexts222: end223: end224:225: extend ClassMethods226: end227: end228: end229: endAdditional information:----------------------- Ruby objects are often frozen to prevent further modifications when they would negatively impact the process (e.g. values inside Ruby's ENV class) or to prevent polluting other objects when default values are passed by reference to many instances of an object (e.g. the empty Array as a Chef resource default, passed by reference to every instance of the resource). Chef uses Object#freeze to ensure the default values of properties inside Chef resources are not modified, so that when a new instance of a Chef resource is created, and Object#dup copies values by reference, the new resource is not receiving a default value that has been by a previous instance of that resource. Instead of modifying an object that contains a default value for all instances of a Chef resource, create a new object and assign it to the resource's parameter, e.g.: fruit_basket = resource(:fruit_basket, 'default') # BAD: modifies 'contents' object for all new fruit_basket instances fruit_basket.contents << 'apple' # GOOD: allocates new array only owned by this fruit_basket instance fruit_basket.contents %w(apple)System Info:------------chef_version=14.14.29platform=ubuntuplatform_version=18.04ruby=ruby 2.5.7p206 (2019-10-01 revision 67816) [x86_64-linux]program_name=chef-client worker: ppid=974;start=08:36:34;executable=/opt/chef/bin/chef-client
As I looked this issue up, it appears that this was an issue with Poise 2.8.1 which is a dependency of this cookbook, as somebody asked the Poise maintainer in this issue and that issue was fixed in this commit which is a part of Poise 2.8.2 Release, so long story short, I will make a PR to bump the poise version in this cookbook's requirements to 2.8.2
Thanks.
The text was updated successfully, but these errors were encountered:
I was deploying a cookbook which included recipes from chef-proxysql and there were some issues, as you see in the stack trace and the logs below:
As I looked this issue up, it appears that this was an issue with Poise 2.8.1 which is a dependency of this cookbook, as somebody asked the Poise maintainer in this issue and that issue was fixed in this commit which is a part of Poise 2.8.2 Release, so long story short, I will make a PR to bump the poise version in this cookbook's requirements to 2.8.2
Thanks.
The text was updated successfully, but these errors were encountered: