poise / poise-python

A Chef cookbook to provide a unified interface for installing Python, managing Python packages, and creating virtualenvs.
Apache License 2.0
124 stars 108 forks source link

Recipe compile error with Chef client 14.3.37 on Centos and Amazon EMR #122

Closed giant-atomic-monster closed 6 years ago

giant-atomic-monster commented 6 years ago

I just started testing with 14.3.37 and I get the following error on both CentOS7 and Amazon Linux (well, the EMR flavor of it).

Here's the error message on EMR:

       Thank you for installing Chef!
       Transferring files to <default-emr>
       Starting Chef Client, version 14.3.37
       Creating a new client identity for default-emr using the validator key.
       resolving cookbooks for run list: ["nucleus::default"]
       Synchronizing Cookbooks:
[ snip local cookbooks ]
         - line (2.0.2)
         - poise-python (1.7.0)
         - users (4.0.3)
         - poise (2.8.1)
         - poise-languages (2.1.2)
         - poise-archive (1.5.0)
       Installing Cookbook Gems:
       Compiling Cookbooks...

       ================================================================================
       Recipe Compile Error in /tmp/kitchen/cache/cookbooks/poise-python/libraries/default.rb
       ================================================================================

       FrozenError
       -----------
       can't modify frozen Array

       Cookbook Trace:
       ---------------
         /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise/helpers/subresources/container.rb:220:in `included'
         /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise/resource.rb:51:in `include'
         /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise/resource.rb:51:in `poise_subresource_container'
         /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise.rb:93:in `block in Poise'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:34:in `include'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:34:in `<class:Resource>'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:33:in `<module:PythonRuntime>'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:25:in `<module:Resources>'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:22:in `<module:PoisePython>'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:21:in `<top (required)>'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources.rb:19:in `<top (required)>'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/cheftie.rb:17:in `<top (required)>'
         /tmp/kitchen/cache/cookbooks/poise-python/libraries/default.rb:19:in `<top (required)>'

       Relevant File Content:
       ----------------------
       /tmp/kitchen/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) << :@subcontexts
       221:              klass.const_get(:FORBIDDEN_IVARS) << :@subcontexts
       222:            end
       223:          end
       224:
       225:          extend ClassMethods
       226:        end
       227:      end
       228:    end
       229:  end

       Additional 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.3.37
       platform=amazon
       platform_version=2017.09
       ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
       program_name=/opt/chef/bin/chef-client
       executable=/opt/chef/bin/chef-client

       Running handlers:
       [2018-07-11T20:14:58+00:00] ERROR: Running exception handlers
       [2018-07-11T20:14:58+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2018-07-11T20:14:58+00:00] ERROR: Exception handlers complete
       [2018-07-11T20:14:58+00:00] ERROR: Exception handlers complete
       Chef Client failed. 0 resources updated in 02 seconds
       [2018-07-11T20:14:58+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2018-07-11T20:14:58+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2018-07-11T20:14:58+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2018-07-11T20:14:58+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2018-07-11T20:14:58+00:00] FATAL: FrozenError: can't modify frozen Array
       [2018-07-11T20:14:58+00:00] FATAL: FrozenError: can't modify frozen Array
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Converge failed on instance <default-emr>.  Please see .kitchen/logs/default-emr.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

And here's CentOS 7:

       resolving cookbooks for run list: ["nucleus::default"]
       Synchronizing Cookbooks:
[ snip internal cookbooks ]
         - line (2.0.2)
         - users (4.0.3)
         - poise-python (1.7.0)
         - poise-languages (2.1.2)
         - poise-archive (1.5.0)
         - poise (2.8.1)
       Installing Cookbook Gems:
       Compiling Cookbooks...

       ================================================================================
       Recipe Compile Error in /tmp/kitchen/cache/cookbooks/poise-python/libraries/default.rb
       ================================================================================

       FrozenError
       -----------
       can't modify frozen Array

       Cookbook Trace:
       ---------------
         /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise/helpers/subresources/container.rb:220:in `included'
         /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise/resource.rb:51:in `include'
         /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise/resource.rb:51:in `poise_subresource_container'
         /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise.rb:93:in `block in Poise'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:34:in `include'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:34:in `<class:Resource>'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:33:in `<module:PythonRuntime>'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:25:in `<module:Resources>'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:22:in `<module:PoisePython>'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:21:in `<top (required)>'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources.rb:19:in `<top (required)>'
         /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/cheftie.rb:17:in `<top (required)>'
         /tmp/kitchen/cache/cookbooks/poise-python/libraries/default.rb:19:in `<top (required)>'

       Relevant File Content:
       ----------------------
       /tmp/kitchen/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) << :@subcontexts
       221:              klass.const_get(:FORBIDDEN_IVARS) << :@subcontexts
       222:            end
       223:          end
       224:
       225:          extend ClassMethods
       226:        end
       227:      end
       228:    end
       229:  end

       Additional 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.3.37
       platform=centos
       platform_version=7.5.1804
       ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
       program_name=/opt/chef/bin/chef-client
       executable=/opt/chef/bin/chef-client

       Running handlers:
       [2018-07-11T20:26:02+00:00] ERROR: Running exception handlers
       [2018-07-11T20:26:02+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2018-07-11T20:26:02+00:00] ERROR: Exception handlers complete
       [2018-07-11T20:26:02+00:00] ERROR: Exception handlers complete
       Chef Client failed. 0 resources updated in 02 seconds
       [2018-07-11T20:26:02+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2018-07-11T20:26:02+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2018-07-11T20:26:02+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2018-07-11T20:26:02+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2018-07-11T20:26:02+00:00] FATAL: FrozenError: can't modify frozen Array
       [2018-07-11T20:26:02+00:00] FATAL: FrozenError: can't modify frozen Array
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Converge failed on instance <default-centos-7>.  Please see .kitchen/logs/default-centos-7.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

Works fine on both platforms with client 14.2.0.

coderanger commented 6 years ago

Leaving this one open in the hopes that other people actually check before filing more, #120.