cookbook_template.py

Cookbooks are sets of recipes to apply to a server to create systems made up of subsystems.

Cookbook

class frycook.cookbook_template.Cookbook(settings, environment, ok_to_be_rude, no_prompt)[source]

The Cookbook class is the base class for all cookbooks to be created from. If you over-ride any of the built-in functions, be sure to call the base class functions so that all the good stuff still happens. You will probably not need to sub-class any of the base functions in your cookbooks, though. They will all be called by frycooker as necessary. All you need to do is to fill the class-level variable recipe_list with class objects for recipes that you want to run when applying the cookbook. The recipes will be applied in the order they’re defined in the list.

Example:

from frycook import Cookbook

from recipes import RecipeNginx
from recipes import RecipeExampleCom

class CookbookWeb(Cookbook):
    recipe_list = [RecipeNginx,
                   RecipeExampleCom]
apply(computer)[source]

Run the apply functions for all the recipes defined in recipe_list. Override this if there’s something you need to do besides just running all the recipes. Be sure to call the base class if you override this.

Parameters:computer (string) – name of computer to apply recipe to
handle_post_apply_messages()[source]

Run the post_apply_message functions for all the recipes defined in recipe_list. Override this if there are cookbook-level messages you would like to add. Be sure to call the base if you override this.

handle_pre_apply_messages()[source]

Run the pre_apply_message functions for all the recipes defined in recipe_list. Override this if there are cookbook-level messages you would like to add. Be sure to call the base if you override this.

pre_apply_checks(computer)[source]

Run the pre_apply_checks functions for all the recipes defined in recipe_list. Override this if there’s something you need to check above and beyond the recipe-level data. Be sure to call the base if you override this.

Parameters:computer (string) – name of computer to apply recipe checks to
run_apply(computer)[source]

Run the apply process for the computer. This is usually just called from frycooker.

Parameters:computer (string) – name of computer to apply recipe to
run_messages()[source]

Run the handle_pre_apply_messages and handle_post_apply_messages functions for all the recipes defined in recipe_list. This is useful to display all the possible messages to the user without actually applying the cookbook. This is usually just called from frycooker.

Table Of Contents

Previous topic

recipe_template.py

Next topic

frycooker.py

This Page