docker: uninitialized constant DockerHelpers::Container

I am getting this fail during my usage of the docker cookbook.

                          [2015-11-06T11:14:25-08:00] INFO: Storing updated cookbooks/compat_resource/files/spec/data/cookbooks/test/recipes/test.rb in the cache.
                          [2015-11-06T11:14:25-08:00] INFO: Storing updated cookbooks/compat_resource/files/spec/data/config.rb in the cache.
                          [2015-11-06T11:14:25-08:00] INFO: Storing updated cookbooks/compat_resource/files/spec/data/cookbooks/test/recipes/default.rb in the cache.
                          [2015-11-06T11:14:25-08:00] INFO: Storing updated cookbooks/compat_resource/files/spec/cookbook_spec.rb in the cache.
                          [2015-11-06T11:14:25-08:00] INFO: Storing updated cookbooks/compat_resource/CHANGELOG.md in the cache.
                          [2015-11-06T11:14:25-08:00] INFO: Storing updated cookbooks/compat_resource/metadata.json in the cache.
                          [2015-11-06T11:14:25-08:00] INFO: Storing updated cookbooks/compat_resource/README.md in the cache.
                            - compat_resource
                          Compiling Cookbooks...

                          ================================================================================
                          Recipe Compile Error in /var/chef/cache/cookbooks/docker/libraries/provider_docker_container.rb
                          ================================================================================

                          NameError
                          ---------
                          uninitialized constant DockerHelpers::Container

                          Cookbook Trace:
                          ---------------
                            /var/chef/cache/cookbooks/docker/libraries/provider_docker_container.rb:13:in `<class:DockerContainer>'
                            /var/chef/cache/cookbooks/docker/libraries/provider_docker_container.rb:9:in `<class:Provider>'
                            /var/chef/cache/cookbooks/docker/libraries/provider_docker_container.rb:8:in `<class:Chef>'
                            /var/chef/cache/cookbooks/docker/libraries/provider_docker_container.rb:7:in `<top (required)>'

                          Relevant File Content:
                          ----------------------
                          /var/chef/cache/cookbooks/docker/libraries/provider_docker_container.rb:

                            6:  
                            7:  class Chef
                            8:    class Provider
                            9:      class DockerContainer < Chef::Provider::LWRPBase
                           10:        # register with the resource resolution system
                           11:        provides :docker_container if Chef::Provider.respond_to?(:provides)
                           12:  
                           13>>       include DockerHelpers::Container
                           14:        include DockerHelpers::Connection
                           15:        use_inline_resources
                           16:  
                           17:        def initialize(*args)
                           18:          super
                           19:          @conn = Docker::Connection.new(parsed_connect_host, parsed_connect_options)
                           20:        end
                           21:  
                           22:        def load_current_resource


                          Running handlers:
                          [2015-11-06T11:14:26-08:00] ERROR: Running exception handlers
                          Running handlers complete
                          [2015-11-06T11:14:26-08:00] ERROR: Exception handlers complete
                          Chef Client failed. 0 resources updated in 11.96879567 seconds

I am using docker_image and docker_container. If you need to see them I can cleanse them of any secure information and post it up. I honestly can’t tell what is going on, cookbooks/docker/libraries/helpers_container.rb is definitely there.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 24 (12 by maintainers)

Most upvoted comments

@chasebolt Figured it out. I’m an idiot. Was uploading like this:

knife cookbook upload -o "$HOME/.berkshelf/cookbooks" docker
WARNING: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
WARNING: The cookbooks: docker, docker exist in multiple places in your cookbook_path.
A composite version of these cookbooks has been compiled for uploading.

The key of course is that message A composite version of these cookbooks has been compiled for uploading., and the libraries/provider_* files are simply from an older version that happened to be in my berkshelf.

I learned berks upload is the better way to do this.