Validators

SchemaCheck

class curator.validators.SchemaCheck(config, schema, test_what, location)

Validate config with the provided Schema from schema. test_what and location are for reporting the results, in case of failure. If validation is successful, result() returns config a valid Schema.

Parameters:
  • config (dict) – A configuration dictionary.
  • schema (Schema) – A voluptuous schema definition
  • test_what (str) – which configuration block is being validated
  • location (str) – A string to report which configuration sub-block is being tested.
badvalue = None

Object attribute that is only populated in __parse_error()

config = None

Object attribute that gets the value of param config

error = None

Object attribute that is only populated in result() if an Exception is raised

location = None

Object attribute that gets the value of param location

result()

Evaluate config using schema. Try to parse and log the error if validation fails, then raise a ConfigurationError

Returns:A validated Schema based on config
schema = None

Object attribute that gets the value of param schema

test_what = None

Object attribute that gets the value of param test_what

Actions

Validate root actions and individual action Schemas

curator.validators.actions.root()

Return a valid Schema definition which is a dictionary with actions Required to be the root key with another dictionary as the value.

curator.validators.actions.structure(data, location)

Return a valid Schema definition which tests data, which is ostensibly an individual action dictionary. If it is a valid_action(), then it will update() the base Schema with other options, based on the what the value of data['action'] is.

Parameters:
  • data (dict) – The configuration dictionary, or sub-dictionary, being validated
  • location (str) – A string to report which configuration sub-block is being tested.
Returns:

A Schema object

curator.validators.actions.valid_action()

Return a valid Schema definition which is that the value of key action is Required to be In the value returned by all_actions().

Options

Set up voluptuous Schema defaults for various actions

curator.validators.options.action_specific(action)
Parameters:action (str) – The name of an action
Returns:A list containing one or more Optional or Required options from option_defaults, defining acceptable values for each for the given action
Return type:list
curator.validators.options.get_schema(action)

Return a Schema of acceptable options and their default values as returned by action_specific(), passing along the value of action.

Parameters:action (str) – The name of an action
Returns:A valid Schema of the options for action

Filter Functions

Functions validating the filter Schema of an action

curator.validators.filter_functions.filterstructure()

Return a Schema object that uses the return value from structural_filter_elements() to populate acceptable values and updates/merges the Schema object with the return value from filtertype()

Returns:A Schema object
curator.validators.filter_functions.filtertype()

Return a Schema object that uses all_filtertypes() to populate acceptable values

Returns:A Schema object
curator.validators.filter_functions.singlefilter(action, data)

Return a Schema object that is created using the return value from filtertype() to create a local variable ftype. The values from action and data are used to update ftype based on matching function names in filtertypes.

structural_filter_elements() to populate acceptable values and updates/merges the Schema object with the return value from filtertype()

Parameters:
  • action (str) – The Curator action name
  • data – The filter block of the action
Returns:

A Schema object

curator.validators.filter_functions.validfilters(action, location=None)

Validate the filters in a list

Log Config

Logging Schema definition

curator.validators.logconfig.logging()

Pulls value from config_logging()

Returns:{Optional('logging'): logging_defaults.config_logging()}
Return type:Schema