genvid.toolbox.ConsulTemplateTool
- class genvid.toolbox.ConsulTemplateTool(**kwargs)
Bases:
VaultTool
Wrapper around
ConsulTemplate
to integrate with the toolbox.The API defined by this class offer parameters to seemlessly integrate with
Consul
andVault
while giving full flexibility to the user to customize the underlyingconsul-template
invocations.Changed in version 1.22.0:
Rewrote the API to make it stable enough for wide-spread usage.
Now using
ConsulTemplate
under the hood.
- property consul_template
Access the underlying
ConsulTemplate
instance.The
ConsulTemplate
instance 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-template
in non-daemon mode.- Parameters:
use_consul –
Customize
consul-template
invocation so that it is able to send requests to Consul.Important
This is accomplished by setting
consul_addr
automatically.use_vault –
Customize
consul-template
invocation so that it is able to send requests to Vault.Important
This is accomplished by setting
vault-token
andvault-renew-token
automatically.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-template
directly.Important
User-specified options will always take precedence on the value set by this tool to have
consul
andvault
work properly.See also
ConsulTemplate
for more information on the supported options.
- Raises:
Any exception defined by
ConsulTemplate.once()
. Some Vault-related exceptions may also be thrown ifuse_vault
is set toTrue
.- Returns:
The
ConsulTemplateOutput
returned by the invocation ofConsulTemplate.once()
.
- class consul_template.ConsulTemplateTool
Implementation of
genvid.toolbox.ConsulTemplateTool