polevault package

Submodules

polevault.config module

Helper functions to deal with configuration files

class polevault.config.OrderedDictYAMLLoader(*args, **kwargs)[source]

Bases: yaml.loader.Loader

A YAML loader that loads mappings into ordered dictionaries.

construct_mapping(node, deep=False)[source]
construct_yaml_map(node)[source]
polevault.config.get_config(path_with_name, file_type, default=True)[source]
polevault.config.get_file_type_and_mtime(path_with_name)[source]
polevault.config.load_config_ini(full_path, default=True)[source]

Load configuration file with the option of ignoring the DEFAULT section.

Parameters:
  • full_path (str) – File path to the configuration file.
  • default (bool, optional) – Whether to allow the python ConfigParser to expand the contents of the DEFAULT section into the other sections. (the default is True, which expands copies all the attributes inside the DEFAULT section into the other sections inside which they don’t exist already.)
Returns:

config – The configuration dictionary resulting from parsing the configuration file. It is a collections.OrderedDict dictionary so that the order of the sections and attributes is preserved in the resulting dictionary.

Return type:

collections.OrderedDict

polevault.config.load_config_json(full_path, default=True)[source]
polevault.config.load_config_yaml(full_path, default=True)[source]
polevault.config.merge_default(config)[source]

Merge the values of the DEFAULT item into the other items.

Merge a dictionary that has an item with a “DEFAULT” key, if that item is itself a dictionary, then merge that item’s subitems with all the other items in the dictionary that are also themselves dictionaries.

The purpose is to mimic the behaviour of the [DEFAULT] sections of .ini or .conf files when using .json or .yaml files, or when using OrderedDict or dict data structures.

Parameters:config (dict or OrderedDict) – The dictionary that is to have its “DEFAULT” key merged with the other keys.
Returns:The merged version of the dictionary as an OrderedDict, or the original config (be it a dict or an OrderedDict) if it had no “DEFAULT” key to begin with, or it was not a dict or an OrderedDict.
Return type:OrderedDict or dict
polevault.config.write_yaml(f, data)[source]

polevault.encryption module

Abstract away the usage of encryption libraries.

polevault.encryption.decrypt(key, nonce, data)[source]
polevault.encryption.decrypt_credentials(data, key)[source]
polevault.encryption.encrypt(key, nonce, data)[source]
polevault.encryption.encrypt_credentials(data, key=None)[source]
polevault.encryption.generate_key(bit_length=256)[source]

Module contents

Pole Vault package

class polevault.Client(key=None)[source]

Bases: object

Client class that mimics the behavior of the Client class of the hvac package, which is used to access credentials stored in Hashicorp’s Vault.

read(*args)[source]
polevault.main()[source]