rackspace-cookbooks / platformstack

Rackspace Base Stack via Chef
Other
4 stars 6 forks source link

Version 4.2.0 of git cookbook conflicts with mysql cookbook LWRP #198

Closed schwing closed 9 years ago

schwing commented 9 years ago
Recipe: git::default
  * git_client[default] action install

    ================================================================================
    Error executing action `install` on resource 'git_client[default]'
    ================================================================================

    NoMethodError
    -------------
    undefined method `package_version' for Chef::Resource::AptPackage

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/mysql/libraries/resource_mysql_service.rb:59:in `parsed_package_version'
    /var/chef/cache/cookbooks/git/libraries/provider_git_client_package.rb:16:in `block (2 levels) in <class:Package>'
    /var/chef/cache/cookbooks/git/libraries/provider_git_client_package.rb:14:in `block in <class:Package>'

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/git/recipes/default.rb

     19: git_client 'default' do
     20:   action :install
     21: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/git/recipes/default.rb:19:in `from_file'

    git_client("default") do
      action [:install]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :git_client
      cookbook_name "git"
      recipe_name "default"
    end

This is caused by https://github.com/chef-cookbooks/mysql/blob/v5.6.1/libraries/resource_mysql_service.rb#L58-L60 and https://github.com/jssjr/git/blob/4733ad3f574680f900c44eddffb6081ab4ca7106/libraries/helpers.rb#L11-L13 conflicting, from the look of it. Conflicting version 4.2.0 of the git cookbook was released yesterday.

Including the git::default recipe seems overkill just to install the package at https://github.com/rackspace-cookbooks/platformstack/blob/master/recipes/ohai_plugins.rb#L12 and nothing else. This dependency should be removed and replaced with a simple package install, unless there's some pressing reason not to.

martinb3 commented 9 years ago

It appears to be a bug of the mysql cookbook, described at https://github.com/chef-cookbooks/mysql/issues/328 and fixed in https://github.com/chef-cookbooks/mysql/commit/93d6467670a98fefc4471a2f082cd236c085eefa.

martinb3 commented 9 years ago

It seems like the main point of the upstream git cookbook is to aid in configuring a git server/daemon. I'd be okay with reverting to just using the package resource here. It seems the only interesting logic in the provider is configuring EPEL if the OS is old enough to not have a git package (RHEL/CentOS <= 5).

My one concern is that by ditching the git cookbook, we're just playing whack-a-mole, since the actual defect (helper methods polluting other cookbooks) is from the mysql cookbook. I'd love to see it fixed at the root of the problem.

schwing commented 9 years ago

Good catch on EPEL for RHEL/CentOS 5, I completely overlooked that. Agreed that it appears to be fixed in newer versions.

martinb3 commented 9 years ago

Looks like they released upstream to give us the fix backported to the versions we're using. https://github.com/chef-cookbooks/mysql/issues/328

someara commented 9 years ago

PS: The main point of the git cookbook (as far as I'm concerned) is to abstract package names and handle repo activation when needed on various platforms.

https://github.com/jssjr/git/blob/master/libraries/helpers.rb#L3-L9

The service stuff can probably be removed... I can't imagine anyone is actually using the raw git protocol from xinetd.

The recent refactor was just to shove recipes into resources as a start.

-s

schwing commented 9 years ago

Thanks all, especially for the additional context and clarification. This was resolved in https://github.com/chef-cookbooks/mysql/issues/328 and I agree that leaving the git cookbook in is the best option to avoid that package naming weirdness. Closing this out.