Chef

@@seen_recipes is a class variable, this makes chef-client and chef-solo *not* run any recipes after the first run in daemon mode

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.5.1, 0.5.2, 0.5.4
  • Fix Version/s: 0.5.4
  • Component/s: Chef Client, Chef Solo
  • Labels:
    None
  • Environment:

    Gentoo linux, but this affects all platforms

Description

In Chef::Recipe we store @@seen_recipes in a class variable. THis means when you run chef in daemon mode it will only execute the recipes the first time they are run. Ever run after that will skip all recipes as previously seen recipes.

I discovered this while making a chef nanite agent for chef-solo. My hacky fix was to monkey patch :

class Chef::Recipe
def self.reset_seen_recipes!
@@seen_recipes = {}
end
end

And then call:
Chef::Recipe.reset_seen_recipes!

Before each time I make a new client and run or run_solo.

Not sure if this is the proper fix or if we should refactor @@seen_recipes to not be a global class variable

Activity

Hide
Adam Jacob added a comment - 12/Feb/09 5:03 PM

This is fixed - we moved from @@seen_recipes to @node.run_state[:seen_recipes], which is as it should be (the node object carts around it's state as it progresses through the run, since it's the thing thats being 'acted upon'.)

Pushed to opscode/master.

Show
Adam Jacob added a comment - 12/Feb/09 5:03 PM This is fixed - we moved from @@seen_recipes to @node.run_state[:seen_recipes], which is as it should be (the node object carts around it's state as it progresses through the run, since it's the thing thats being 'acted upon'.) Pushed to opscode/master.

People

Vote (0)
Watch (0)

Dates

  • Created:
    08/Feb/09 10:36 PM
    Updated:
    12/Feb/09 5:03 PM
    Resolved:
    12/Feb/09 5:03 PM