Other Class Definitions

Wrapper

class curator.classdef.Wrapper(cls)

Bases: object

Wrapper Class

Instantiate with passed Class (not instance or object)

Parameters:cls – A class (not an instance of the class)
class_instance = None

An instance of class_object

class_object = None

The class itself (not an instance of it), passed from cls

get_instance(*args, **kwargs)

Return the instance with *args and **kwargs

set_instance(*args, **kwargs)

Set up class_instance from class_object

ActionsFile

class curator.classdef.ActionsFile(action_file)

Bases: object

Class to parse and verify entire actions file

Individual actions are ActionDef objects

actions = None

A dict of all actions in the provided configuration. Each original key name is preserved and the value is now an ActionDef, rather than a dict.

fullconfig = None

The full, validated configuration from action_file.

get_validated(action_file)
Parameters:action_file (str) – The path to a valid YAML action configuration file
Returns:The result from passing action_file to validate_actions()
parse_actions(all_actions)

Parse the individual actions found in all_actions['actions']

Parameters:all_actions (dict) – All actions, each its own dictionary behind a numeric key. Making the keys numeric guarantees that if they are sorted, they will always be executed in order.
Returns:
Return type:list of ActionDef
set_actions(all_actions)

Set the actions via parse_actions()

Parameters:all_actions (dict) – All actions, each its own dictionary behind a numeric key. Making the keys numeric guarantees that if they are sorted, they will always be executed in order.
Return type:None

ActionDef

class curator.classdef.ActionDef(action_dict)

Bases: object

Individual Action Definition Class

Instances of this class represent an individual action from an action file.

action = None

The action name

action_cls = None

The action’s class (Alias, Allocation, etc.)

action_dict = None

The whole action dictionary

alias_adds = None

Only when action is alias will this be a IndexList

alias_removes = None

Only when action is alias will this be a IndexList

allow_ilm = None

The action option allow_ilm_indices

cif = None

The action option continue_if_exception

description = None

The action description

disabled = None

The action option disable_action

filters = None

The action filters list

get_action_class()

Get the action class from CLASS_MAP

Do extra setup when action is alias

Set list_obj to SnapshotList when action is delete_snapshots or restore

get_obj_instance(wrapper, *args, **kwargs)

Get the class instance wrapper identified by wrapper Pass all other args and kwargs to the get_instance() method.

Returns:An instance of the class that Wrapper is wrapping
iel = None

The action option ignore_empty_list

instantiate(attribute, *args, **kwargs)

Convert attribute from being a Wrapper of a Class to an instantiated object of that Class.

This is madness or genius. You decide. This entire method plus the Wrapper class came about because I couldn’t cleanly instantiate a class variable into a class object. It works, and that’s good enough for me.

Parameters:attribute (str) – The name of an attribute that references a Wrapper class instance
list_obj = None

The list class, either IndexList or SnapshotList. Default is IndexList

log_the_options()

Log options at initialization time

options = None

The action options dict

set_alias_extras()

Populate the alias_adds and alias_removes attributes

set_option_attrs()

Iteratively get the keys and values from options and set the attributes

set_root_attrs()

Iteratively get the keys and values from action_dict and set the attributes

timeout_override = None

The action option timeout_override