Skip to content

Commit

Permalink
Fix a regression with Chef 10 in Ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvargo committed Oct 7, 2013
1 parent afd8dcf commit 574afcb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions recipes/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Author:: Jesse Howarth (<him@jessehowarth.com>)
# Author:: Jamie Winsor (<jamie@vialstudios.com>)
#
# Copyright 2008-2012, Opscode, Inc.
# Copyright 2008-2013, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,13 @@
include_recipe 'build-essential::default'
include_recipe 'mysql::client'

if run_context.loaded_recipes.include?('mysql::percona_repo')
loaded_recipes = if run_context.respond_to?(:loaded_recipes)
run_context.loaded_recipes
else
run_context.run_state[:seen_recipes]

This comment has been minimized.

Copy link
@jwitrick

jwitrick Oct 7, 2013

Unfortunately this still does not work:

NoMethodError

undefined method `run_state' for #Chef::RunContext:0x000000020fa0f8

Cookbook Trace:

/var/chef/cache/cookbooks/mysql/recipes/ruby.rb:30:in `from_file'

Relevant File Content:

/var/chef/cache/cookbooks/mysql/recipes/ruby.rb:

23: node.set['build_essential']['compiletime'] = true
24: include_recipe 'build-essential::default'
25: include_recipe 'mysql::client'
26:
27: loaded_recipes = if run_context.respond_to?(:loaded_recipes)
28: run_context.loaded_recipes
29: else
30>> run_context.run_state[:seen_recipes]
31: end

This comment has been minimized.

Copy link
@jwitrick

jwitrick Oct 7, 2013

I think the line needs to be: 'node.run_state[:seen_recipes]' ?

This comment has been minimized.

Copy link
@sethvargo

sethvargo via email Oct 7, 2013

Author Contributor
end

if loaded_recipes.include?('mysql::percona_repo')
case node['platform_family']
when 'debian'
resources('apt_repository[percona]').run_action(:add)
Expand Down

0 comments on commit 574afcb

Please sign in to comment.