congress.cfg_validator.parsing module

Unmarshaling of options sent by the agent.

class congress.cfg_validator.parsing.IdentifiedOpt(id_, ns_id, **kwargs)

Bases: oslo_config.cfg.Opt

A subclass of option that adds a unique id and a namespace id

ids are based on hashes

congress.cfg_validator.parsing.add_namespace(conf, ns_dict, ns_hash)

Add options from a kind to an already existing config

congress.cfg_validator.parsing.add_parsed_conf(conf, normalized)

Add a normalized values container to a config manager.

Parameters
  • conf – A cfg.ConfigOpts object.

  • normalized – A normalized values container, as introduced by oslo cfg._Namespace.

congress.cfg_validator.parsing.construct_conf_manager(namespaces)

Construct a config manager from a list of namespaces data.

Register options of given namespaces into a cfg.ConfigOpts object. A namespaces dict is typically cfg_validator.generator output. Options are provided an hash as an extra field.

Parameters

namespaces – A list of dict, containing options metadata.

Returns

A cfg.ConfigOpts.

congress.cfg_validator.parsing.make_group(name, title, help_msg)

Declares a new group

Parameters
  • name – group name

  • title – group title

  • help_msg – descriptive help message

Returns

an oslo config group representation or None for default.

congress.cfg_validator.parsing.make_opt(option, opt_hash, ns_hash)

Declares a new group

Parameters
  • name – an option retrieved from json.

  • opt_hash – the option hash

  • ns_hash – the hash of the namespace defining it.

Returns

an oslo config option representation augmented with the hashes.

congress.cfg_validator.parsing.make_type(type_descr)

Declares a new type

Parameters

type_descr – a type description read from json.

Returns

an oslo config type

congress.cfg_validator.parsing.parse_config_file(namespaces, path)

Parse a config file from its pre-loaded namespaces.

Parameters
  • namespaces – A list of dict, containing namespaces data.

  • path – Path to the configuration file to parse.

Returns

congress.cfg_validator.parsing.parse_value(cfgtype, value)

Parse and validate a value’s type, raising error if check fails.

Raises

ValueError, TypeError