Module config

  • License: Inmanta EULA

  • Version: 0.3.0

Typedefs

typedef config::inmanta_path
  • Base type string

  • Type constraint std::validate_type('pydantic.constr',self,Dict())

typedef config::inmanta_source_path
  • Base type string

  • Type constraint std::validate_type('pydantic.constr',self,Dict())

typedef config::inmanta_template_path
  • Base type string

  • Type constraint std::validate_type('pydantic.constr',self,Dict())

typedef config::path
  • Base type string

  • Type constraint (((std::validate_type('pydantic.constr',self,Dict()) or std::validate_type('pydantic.constr',self,Dict())) or std::validate_type('pydantic.constr',self,Dict())) or std::validate_type('pydantic.constr',self,Dict()))

typedef config::system_path
  • Base type string

  • Type constraint std::validate_type('pydantic.constr',self,Dict())

Plugins

config.absolute_path(path: 'string') 'string'

Transform the input path into its absolute counterpart.

Parameters:

path – The path, relative or not, for which we wish to resolve the absolute path.

config.get_config_template_value(config: 'dict', dict_path: 'string', instance: 'std::Entity?' = None, kwargs: 'any' = None) 'any'

Get an element from the config using its dict_path. If the value is a template path, the template will be rendered using the instance passed in argument and the additional values in kwargs.

Parameters:
  • config – The config dict that the value should be taken from.

  • dict_path – The dict_path to the desired value

  • instance – The instance that can be accessed during the template rendering

  • kwargs – Additional values that can be accessed during the template rendering.

config.get_config_template_value_as_bool(config: 'dict', dict_path: 'string', instance: 'std::Entity?' = None, kwargs: 'any' = None) 'bool'

Get an element from the config using its dict_path. If the value is a template path, the template will be rendered using the instance passed in argument and the additional values in kwargs. The element returned will be of type bool. If the value we got from the configuration is not a boolean, an exception is raised.

Parameters:
  • config – The config dict that the value should be taken from.

  • dict_path – The dict_path to the desired value

  • instance – The instance that can be accessed during the template rendering

  • kwargs – Additional values that can be accessed during the template rendering

config.get_config_template_value_as_int(config: 'dict', dict_path: 'string', instance: 'std::Entity?' = None, kwargs: 'any' = None) 'int'

Get an element from the config using its dict_path. If the value is a template path, the template will be rendered using the instance passed in argument and the additional values in kwargs. The element returned will be of type int. If the value we got from the configuration is not an integer, an exception is raised.

Parameters:
  • config – The config dict that the value should be taken from.

  • dict_path – The dict_path to the desired value

  • instance – The instance that can be accessed during the template rendering

  • kwargs – Additional values that can be accessed during the template rendering

config.get_config_template_value_as_number(config: 'dict', dict_path: 'string', instance: 'std::Entity?' = None, kwargs: 'any' = None) 'number'

Get an element from the config using its dict_path. If the value is a template path, the template will be rendered using the instance passed in argument and the additional values in kwargs. The element returned will be of type number. If the value we got from the configuration is not a float nor an integer, an exception is raised.

Parameters:
  • config – The config dict that the value should be taken from.

  • dict_path – The dict_path to the desired value

  • instance – The instance that can be accessed during the template rendering

  • kwargs – Additional values that can be accessed during the template rendering

config.get_config_template_value_as_string(config: 'dict', dict_path: 'string', instance: 'std::Entity?' = None, kwargs: 'any' = None) 'string'

Get an element from the config using its dict_path. If the value is a template path, the template will be rendered using the instance passed in argument and the additional values in kwargs. The element returned will be of type string. If the value we got from the configuration is not a string, an exception is raised.

Parameters:
  • config – The config dict that the value should be taken from.

  • dict_path – The dict_path to the desired value

  • instance – The instance that can be accessed during the template rendering

  • kwargs – Additional values that can be accessed during the template rendering

config.get_config_value(config: 'dict', dict_path: 'string') 'any'

Get an element from the config using its dict_path.

config.get_config_value_as_bool(config: 'dict', dict_path: 'string') 'bool'

Get an element from the config using its dict_path. The element returned will be of type bool. If the value we got from the configuration is not a boolean, an exception is raised.

config.get_config_value_as_int(config: 'dict', dict_path: 'string') 'int'

Get an element from the config using its dict_path. The element returned will be of type int. If the value we got from the configuration is not an integer, an exception is raised.

config.get_config_value_as_number(config: 'dict', dict_path: 'string') 'number'

Get an element from the config using its dict_path. The element returned will be of type number. If the value we got from the configuration is not a float nor an integer, an exception is raised.

config.get_config_value_as_string(config: 'dict', dict_path: 'string') 'string'

Get an element from the config using its dict_path. The element returned will be of type string. If the value we got from the configuration is not a string, an exception is raised.

config.get_const(name: 'string') 'any'

Get a value defined in the const python module (inmanta_plugins/config/const.py)

config.get_template_value(config: 'dict', dict_path: 'string', **kwargs: 'any') 'any'

Get an element from the config using its dict_path. If the value is a template path, the template will be rendered using the instance passed in argument and the additional values in kwargs.

Parameters:
  • config – The config dict that the value should be taken from.

  • dict_path – The dict_path pointing to the desired value

  • kwargs – Any entity or primitive value that should be accessible to the template.

config.get_template_value_as_bool(config: 'dict', dict_path: 'string', **kwargs: 'any') 'bool'

Get an element from the config using its dict_path. If the value is a template path, the template will be rendered using the instance passed in argument and the additional values in kwargs. The element returned will be of type bool. If the value we got from the configuration is not a boolean, an exception is raised.

Parameters:
  • config – The config dict that the value should be taken from.

  • dict_path – The dict_path pointing to the desired value

  • kwargs – Any entity or primitive value that should be accessible to the template.

config.get_template_value_as_float(config: 'dict', dict_path: 'string', **kwargs: 'any') 'float'

Get an element from the config using its dict_path. If the value is a template path, the template will be rendered using the instance passed in argument and the additional values in kwargs. The element returned will be of type int. If the value we got from the configuration is not an integer, an exception is raised.

Parameters:
  • config – The config dict that the value should be taken from.

  • dict_path – The dict_path pointing to the desired value

  • kwargs – Any entity or primitive value that should be accessible to the template.

config.get_template_value_as_int(config: 'dict', dict_path: 'string', **kwargs: 'any') 'int'

Get an element from the config using its dict_path. If the value is a template path, the template will be rendered using the instance passed in argument and the additional values in kwargs. The element returned will be of type int. If the value we got from the configuration is not an integer, an exception is raised.

Parameters:
  • config – The config dict that the value should be taken from.

  • dict_path – The dict_path pointing to the desired value

  • kwargs – Any entity or primitive value that should be accessible to the template.

config.get_template_value_as_string(config: 'dict', dict_path: 'string', **kwargs: 'any') 'string'

Get an element from the config using its dict_path. If the value is a template path, the template will be rendered using the instance passed in argument and the additional values in kwargs. The element returned will be of type string. If the value we got from the configuration is not a string, an exception is raised.

Parameters:
  • config – The config dict that the value should be taken from.

  • dict_path – The dict_path pointing to the desired value

  • kwargs – Any entity or primitive value that should be accessible to the template.

config.resolve_path(raw_path: 'config::path') 'string'

Takes a string representation of a path, prefixed with one of the following: file://, inmanta:// and convert it to a valid path on the host. The different inmanta types are never guaranteed to return an absolute path. If you wish to resolve the absolute path, transform the returned value with config::absolute_path plugin.

The path should start with a prefix, specifying how to resolve it. The supported prefixes are:
  • file://: The rest of the string is the absolute path to the file.

  • inmanta://: The rest of the string is a path to a file in an inmanta files folder.
    If the path starts with /, the path is in the project’s folder. For example,

    inmanta:///files/example/inventory.yaml points to a file located in files/example/inventory.yaml at the root of the project using this module.

    If the path doesn’t start with /, the part of the string before the first / is

    the name of the module in the files of which the inventory is located. For example, inmanta://example/files/inventory.yaml points to a file located in files/inventory.yaml at the root of the module named example.

  • template://: Similar to std::template plugin

  • source://: Similar to std::source plugin

If the provided path doesn’t match any of the previous format, an ValueError is raised.