congress.cfg_validator.agent.agent module

congress.cfg_validator.agent.agent module

Agent is the main entry point for the configuration validator agent.

The agent is executed on the different nodes of the cloud and sends back configuration values and metadata to the configuration validator datasource driver.

class congress.cfg_validator.agent.agent.Config(path, template, service_name)

Bases: object

Encapsulates a configuration file and its meta-data.

Attributes:
ivar path:Path to the configuration on the local file system.
ivar template:A Template object to use for parsing the configuration.
ivar data:The normalized Namespace loaded by oslo-config, contains the parsed values.
ivar hash:Hash of the configuration file, salted with the hostname and the template hash
ivar service_name:
 The associated service name
get_info()

Information on the configuration file.

Returns:a quadruple made of: * the hash of the template, * the path to the file, * the content * the service name.
parse(host)

Parses the config at the path given. Updates data and hash.

host: the name of the host where the config is. Used for building a unique hash.

static sanitize_config(conf)

Sanitizes some cfg.ConfigOpts values, given its options meta-data.

Parameters:conf – A cfg.ConfigOpts object, pre-loaded with its options meta-data and with its configurations values.
class congress.cfg_validator.agent.agent.ConfigManager(host, services_files)

Bases: object

Manages the services configuration files on a node and their meta-data.

Attributes:
ivar host:A hostname.
ivar configs:A dict mapping config hashes to their associated Config object.
ivar templates:A dict mapping template hashes to their associated Template object.
ivar namespaces:
 A dict mapping namespace hashes to their associated Namespace object.
add_template(template_path)

Adds a new template (loads it from path).

Parameters:template_path – a valid path to the template file.
get_template_by_path(template_path)

Given a path finds the corresponding template if it is registered

Parameters:template_path – the path of the searched template
Returns:None or the template
register_config(config_path, template_path, service_name)

Register a configuration file and its associated template.

Template and config are actually parsed and loaded.

Parameters:
  • config_path – a valid path to the config file.
  • template_path – a valid path to the template file.
register_service(service_name, files)

Register all configs for an identified service.

Inaccessible files are ignored and files registration pursues.

Parameters:
  • service_name – The name of the service
  • files – A dict, mapping a configuration path to its associated template path
class congress.cfg_validator.agent.agent.Namespace(name)

Bases: object

Encapsulates a namespace, as defined by oslo-config-generator.

It contains the actual meta-data of the options. The data is loaded from the service source code, by means of oslo-config-generator.

Attributes:
name: The name, as used by oslo-config-generator. data: The meta-data of the configuration options. hash: Hash of the namespace.
get_info()

Information on the namespace

Returns:a tuple containing * data: the content of the namespace * name: the name of the namespace
static load(name)

Loads a namespace from disk

Parameters:name – the name of namespace to load.
Returns:a fully configured namespace.
class congress.cfg_validator.agent.agent.Template(path, output_file)

Bases: object

Describes a template, as defined by oslo-config-generator.

Attributes:
ivar name:The name, as used by oslo-config-generator.
ivar path:The path to the template configuration file, as defined by oslo-config-generator, on the local file system.
ivar output_file:
 The default output path for this template.
ivar namespaces:
 A set of Namespace objects, which make up this template.
get_info()

Info on the template

Returns:a quadruple made of: * path: the path to the template path * name: the name of the template * output_fle: * namespaces: an array of namespace hashes.
static load(template_path)

Loads a template configuration file

Parameters:template_path – path to the template
Returns:a fully configured Template object.
class congress.cfg_validator.agent.agent.ValidatorAgentEndpoint(conf=None)

Bases: object

Validator Agent.

It is used as an RPC endpoint.

Attributes:
config_manager: ConfigManager object. driver_api: RPC client to communicate with the driver.
get_config(context, **kwargs)

“Sends back a config

Parameters:
  • context – the RPC context
  • hash – the hash of the config to send
Returns:

the config or None if not found

get_namespace(context, **kwargs)

“Sends back a namespace

Parameters:
  • context – the RPC context
  • hash – the hash of the namespace to send
Returns:

the namespace or None if not found

get_template(context, **kwargs)

“Sends back a template

Parameters:
  • context – the RPC context
  • hash – the hash of the template to send
Returns:

the template or None if not found

publish_configs_hashes(context, **kwargs)

“Sends back all configuration hashes

publish_templates_hashes(context, **kwargs)

“Sends back all template hashes

congress.cfg_validator.agent.agent.main()

Agent entry point

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.