Skip to content

Commit

Permalink
[COOK-3436] Fix mysql::ruby when using percona packages
Browse files Browse the repository at this point in the history
When using percona packages, make sure percona repo is configured before installing client packages in mysql::ruby.

Signed-off-by: Seth Vargo <sethvargo@gmail.com>
  • Loading branch information
abecciu authored and sethvargo committed Oct 3, 2013
1 parent 3a87637 commit 13bb54c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions recipes/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
include_recipe "build-essential"
include_recipe "mysql::client"

if run_context.loaded_recipes.include?('mysql::percona_repo')

This comment has been minimized.

Copy link
@daniellockard

daniellockard Oct 7, 2013

This doesn't work on older chef versions, I don't think.

This comment has been minimized.

Copy link
@sethvargo

sethvargo Oct 7, 2013

Contributor

This cookbook requires Chef 0.10.10+. You can use an older version of this cookbook for older version of Chef support.

This comment has been minimized.

Copy link
@jwitrick

jwitrick Oct 7, 2013

Correct. I am running chef 10.16.6 and it fails.

This comment has been minimized.

Copy link
@sethvargo

sethvargo Oct 7, 2013

Contributor

What is the error?

This comment has been minimized.

Copy link
@jwitrick

jwitrick Oct 7, 2013

NoMethodError
-------------
undefined method `loaded_recipes' for #<Chef::RunContext:0x0000000112a0d8>

Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/mysql/recipes/ruby.rb:27:in `from_file'
  /var/chef/cache/cookbooks/rsapps-databases/recipes/default.rb:27:in `from_file'
  /var/chef/cache/cookbooks/rsapps-databases/recipes/ldif.rb:10:in `from_file'
  /var/chef/cache/cookbooks/mailstorage-provisioning-ldif/recipes/default.rb:53:in `from_file'

Relevant File Content:
----------------------
/var/chef/cache/cookbooks/mysql/recipes/ruby.rb:

 20:  # limitations under the License.
 21:  #
 22:
 23:  node.set['build_essential']['compiletime'] = true
 24:  include_recipe 'build-essential::default'
 25:  include_recipe 'mysql::client'
 26:
 27>> if run_context.loaded_recipes.include?('mysql::percona_repo')
 28:    case node['platform_family']
 29:    when 'debian'
 30:      resources('apt_repository[percona]').run_action(:add)
 31:    when 'rhel'
 32:      resources('yum_key[RPM-GPG-KEY-percona]').run_action(:add)
 33:      resources('yum_repository[percona]').run_action(:add)
 34:    end
 35:  end
 36:

[2013-10-07T15:03:14-04:00] ERROR: Running exception handlers

This comment has been minimized.

Copy link
@sethvargo

sethvargo Oct 7, 2013

Contributor

Okay, I'll have an internal conversation, but for now I'll update the README requirements.

This comment has been minimized.

Copy link
@sethvargo

sethvargo Oct 7, 2013

Contributor

This comment has been minimized.

Copy link
@jwitrick

jwitrick Oct 7, 2013

Any chance you can release a new version of the cookbook with this change?

This comment has been minimized.

Copy link
@sethvargo

sethvargo via email Oct 7, 2013

Contributor

This comment has been minimized.

Copy link
@jwitrick

jwitrick Oct 7, 2013

awesome thanks

case node['platform']
when "ubuntu", "debian"
resources("apt_repository[percona]").run_action(:add)
when "centos", "amazon", "redhat"
resources("yum_key[RPM-GPG-KEY-percona]").run_action(:add)
resources("yum_repository[percona]").run_action(:add)
end
end

node['mysql']['client']['packages'].each do |mysql_pack|
resources("package[#{mysql_pack}]").run_action(:install)
end
Expand Down

0 comments on commit 13bb54c

Please sign in to comment.