genvid.toolbox.ConsulTemplateTool
- class genvid.toolbox.ConsulTemplateTool(**kwargs)
Bases:
VaultToolWrapper around
ConsulTemplateto integrate with the toolbox.The API defined by this class offer parameters to seemlessly integrate with
ConsulandVaultwhile giving full flexibility to the user to customize the underlyingconsul-templateinvocations.Changed in version 1.22.0:
Rewrote the API to make it stable enough for wide-spread usage.
Now using
ConsulTemplateunder the hood.
- property consul_template
Access the underlying
ConsulTemplateinstance.The
ConsulTemplateinstance is lazily instantiated on the first invocation.- Raises:
ExecutableNotInPathError – If the tool was unable to find an executable for
consul-template.
Note
This method can only raise an exception on its first invocation. Subsequent invocations are guaranteed not to raise anything.
- consul_template_once(*, use_consul: bool = False, use_vault: bool = False, env: Optional[Mapping[str, str]] = None, **kwargs) ConsulTemplateOutput
Invoke
consul-templatein non-daemon mode.- Parameters:
use_consul –
Customize
consul-templateinvocation so that it is able to send requests to Consul.Important
This is accomplished by setting
consul_addrautomatically.use_vault –
Customize
consul-templateinvocation so that it is able to send requests to Vault.Important
This is accomplished by setting
vault-tokenandvault-renew-tokenautomatically.env – If provided, will run the subprocess with the provided environment. This is particularly useful if the template depends on a lot on environment variables.
kwargs –
Options to pass to
consul-templatedirectly.Important
User-specified options will always take precedence on the value set by this tool to have
consulandvaultwork properly.See also
ConsulTemplatefor more information on the supported options.
- Raises:
Any exception defined by
ConsulTemplate.once(). Some Vault-related exceptions may also be thrown ifuse_vaultis set toTrue.- Returns:
The
ConsulTemplateOutputreturned by the invocation ofConsulTemplate.once().
- class consul_template.ConsulTemplateTool
Implementation of
genvid.toolbox.ConsulTemplateTool