This module has been deprecated. Although the code is still working for our oldest model, it is not expected to work with the new Bastion API. Please use the new genvid-sdk tool.
Tool for managing project files.
Return a project file.
The argument can be either a directory or a project file. If it is a directory, the following files will be searched in this order inside the directory:
load_config_folder(source: typing.Union[pathlib.Path, str], *, env: typing.Union[typing.Mapping[str, str], NoneType] = None, job_template_dir: typing.Union[pathlib.Path, str, NoneType] = None, with_consul_template: bool = False) → dict¶
Loads the configuration file(s) (all files in a directory or a specific file) from the source and returns it.
- source – Path to the configuration file/folder.
- with_consul_template – Execute consul-template on the configuration file(s) (if source is a directory) before using it only if it is set to true.
- job_template_dir – Path to Folder from where nomad templates should be loaded. If not mentioned, no jobs will be loaded.
- env – An optional environment to use with
consul-template. If None, the default environment will be used.
The configuration as a dictionary that can be used directly with
- :raises FileNotFoundError : If the
- is not a valid directory.
New in version 1.30.0.
load_nomad_job_template(name, job_folder: typing.Union[pathlib.Path, str])¶
Read nomad job templates from the specific directory. Files only with extension of .nomad.tmpl are read.
- name – Name of the file without extension.
- job_folder – Path to directory containing jobs.
New in version 1.30.0: Add support for
load_project(dir_or_file: str, **kwargs)¶
Load a project file.
A project file is either a JSON or HCL file (called either
genvid.hcl) which may or may not contain templating directives to be resolved using
This method sets
PROJECTDIRto the directory containing the project file as a side effect.
- dir_or_file – The specified path is going to be recursively
searched to locate a
- kwargs – All additional keyword parameters are going to be
passed directly to
The Consul server doesn’t need to run if your file doesn’t require anything from Consul. The result is parsed as either a JSON file if the extension is .json or an HCL file, otherwise.
Changed in version 1.21.0:
Adjusted to use the new version of
- dir_or_file – The specified path is going to be recursively searched to locate a
This method tries to update a project to the newer Genvid version.
The update runs after the template engines are run, so could lose some information.