frycooker.py

Frycooker is the program that takes all your carefully coded recipes and cookbooks and applies them to computers.

exception frycooker.InvalidTarget[source]

An InvalidTarget exception is raised for exceptional conditions encountered while generating target lists.

frycooker.apply_recipes_cookbooks(enviro, settings, args, host_list, run_list)[source]

Apply all specified recipes and cookbooks to the requested hosts.

Parameters:
  • enviro (dictionary) – environment dictionary
  • settings (dictionary) – settings dictionary
  • args (args object) – object containing attributes for all possible command-line parameters
  • host_list (list of strings) – list of hosts to run against
  • run_list (dictionary) – dictionary of lists
frycooker.generate_run_list(enviro, args)[source]

Get the lists of computers, recipes, cookbooks, and run list to run against. A run list is a dictionary containing a list of recipes and cookbooks to run against each specified computer. Typically the run list will just specify the same recipes and cookbooks for each computer, unless a list of computers was given and the apply (-a) command-line argument was specified. In that case each computer could have different things run against them.

Parameters:
  • enviro (dictionary) – environment to read group lists and computer components from
  • args (args object) – object containing attributes for all possible command-line parameters
Return type:

tuple of (dictionary, list, list, list)

Returns:

(run list, host list, recipe list, cookbook list)

frycooker.generate_target_list(enviro, args)[source]

Get a list of computers to run against from the command-line arguments. Translate group names into lists of computers.

Parameters:
  • enviro (dictionary) – environment to read group lists from
  • args (args object) – object containing attributes for all possible command-line parameters
Return type:

list of strings

Returns:

list of computer names to run against

frycooker.get_args()[source]

Parse the command-line arguments, using python’s argparse library.

Return type:argparse args object
Returns:object containing attributes for all possible command-line arguments
frycooker.load_enviro(filename)[source]

Load the environment json file, loading additionaly imported environment files and massaging environment paths in the process.

Parameters:filename (string) – filename of environment file to read
Return type:dictionary
Returns:dictionary representation of environment
frycooker.load_settings(filename, params)[source]

Load the settings json file, massaging its environment paths in the process.

Parameters:
  • filename (string) – filename of settings file to read
  • args (args object) – object containing attributes for all possible command-line parameters
Return type:

dictionary

Returns:

dictionary representation of settings

frycooker.main()[source]

Main function for the frycooker program.

frycooker.massage_enviro_paths(env)[source]

Recursively iterate through all the keys in the environment dictionary and look for any that contain the strings ‘path’ or ‘dir’ in them. For the values corresponding to the keys that do, replace any instances of the ‘~’ character with the running user’s home directory path.

Parameters:env (dictionary) – environment dictionary
frycooker.output_post_apply_messages(recipe_list, cookbook_list, enviro, settings, args)[source]

Ouptput all the post-apply messages for the specified recipes and cookbooks.

Parameters:
  • recipe_list (list) – list of recipes to process
  • cookbook_list (list) – list of cookbooks to process
  • enviro (dictionary) – environment dictionary
  • settings (dictionary) – settings dictionary
  • args (args object) – object containing attributes for all possible command-line parameters
frycooker.output_pre_apply_messages(recipe_list, cookbook_list, enviro, settings, args)[source]

Ouptput all the pre-apply messages for the specified recipes and cookbooks.

Parameters:
  • recipe_list (list) – list of recipes to process
  • cookbook_list (list) – list of cookbooks to process
  • enviro (dictionary) – environment dictionary
  • settings (dictionary) – settings dictionary
  • args (args object) – object containing attributes for all possible command-line parameters

Previous topic

cookbook_template.py

This Page