congress.datasources.cfgvalidator_driver module¶
Datasource for configuration options
- 
class 
congress.datasources.cfgvalidator_driver.ValidatorAgentClient(topic='congress-validator-agent')¶ Bases:
objectRPC Proxy to access the agent from the datasource.
- 
get_config(context, cfg_hash, server)¶ Retrieves a config from a server given a hash
- 
get_namespace(context, ns_hash, server)¶ Retrieves an explicit namespace from a server given a hash.
- 
get_template(context, tpl_hash, server)¶ Retrieves an explicit template from a server given a hash
- 
publish_configs_hashes(context)¶ Asks for config hashes
- 
publish_templates_hashes(context)¶ Asks for template hashes
- 
 
- 
class 
congress.datasources.cfgvalidator_driver.ValidatorDriver(name=None, args=None)¶ Bases:
congress.datasources.datasource_driver.PollingDataSourceDriverDriver for the Configuration validation datasource
- 
DS_NAME= 'config'¶ 
- 
get_context()¶ context for RPC. To define
- 
static 
get_datasource_info()¶ Gives back a standardized description of the datasource
- 
classmethod 
get_schema()¶ Get mapping of table name to column names.
Returns a dictionary mapping tablenames to the list of column names for that table. Both tablenames and columnnames are strings.
- 
poll()¶ Periodically called to update new info.
Function called periodically to grab new information, compute deltas, and publish those deltas.
- 
process_config(file_hash, config, host)¶ Manages all translations related to a config file.
Publish tables to PE. :param file_hash: Hash of the configuration file :param config: object representing the configuration :param host: Remote host name :return: True if config was processed
- 
process_config_hashes(hashes, host)¶ Handles a list of config files hashes and their retrieval.
If the driver can process the parsing and translation of the config, it registers the configs to the driver.
- Parameters
 hashes – A list of config files hashes
host – Name of the node hosting theses config files
- 
process_template_hashes(hashes, host)¶ Handles a list of template hashes and their retrieval.
Uses lock to avoid multiple sending of the same data. :param hashes: A list of templates hashes :param host: Name of the node hosting theses config files
- 
translate_conf(conf, file_id)¶ Translates a config manager to the datasource state.
- Parameters
 conf – A config manager ConfigOpts, containing the parsed values and the options metadata to read them
file_id – Id of the file, which contains the parsed values
- 
translate_file(file_id, host_id, template_id, file_name)¶ Translates a file infos to FILE table.
- Parameters
 file_id – File ID
host_id – Host ID, should reference HOST.ID
template_id – Template ID, should reference TEMPLATE.ID
- 
translate_host(host_id, host_name)¶ Translates a host infos to HOST table.
- Parameters
 host_id – Host ID
host_name – A host name
- 
translate_option(option, group_name)¶ Translates an option metadata to datasource tables.
Modifies tables : OPTION, OPTION_INFO :param option: An IdentifiedOpt object :param group_name: Associated section name
- 
translate_service(host_id, service, version)¶ Translates a service infos to SERVICE table.
- Parameters
 host_id – Host ID, should reference HOST.ID
service – A service name
version – A version name, can be None
- 
translate_template_namespace(template_id, name, ns_ids)¶ Translates a template infos and its namespaces infos.
Modifies tables : TEMPLATE, NAMESPACE and TEMPLATE_NS
- Parameters
 template_id – Template ID
name – A template name
ns_ids – List of namespace IDs, defining this template, should reference NAMESPACE.ID
- 
translate_type(opt_id, cfg_type)¶ Translates a type to the appropriate type table.
- Parameters
 opt_id – Option ID, should reference OPTION.ID
cfg_type – An oslo ConfigType for the referenced option
- 
translate_value(file_id, option_id, value)¶ Translates a value to the VALUE table.
If value is a list, a table entry is added for every list item. If value is a dict, a table entry is added for every key-value. :param file_id: File ID, should reference FILE.ID :param option_id: Option ID, should reference OPTION.ID :param value: A value, can be None
- 
 
- 
class 
congress.datasources.cfgvalidator_driver.ValidatorDriverEndpoints(driver)¶ Bases:
objectRPC endpoint on the datasource driver for use by the agents
- 
process_configs_hashes(context, **kwargs)¶ Process the config hashes received from a server
- 
process_templates_hashes(context, **kwargs)¶ Process the template hashes received from a server
-