saltext.vault.utils.vault.helpers

Several utility functions for the Vault modules

saltext.vault.utils.vault.helpers.iso_to_timestamp(iso_time: str) int[source]

Most endpoints respond with RFC3339-formatted strings This is a hacky way to use inbuilt tools only for converting to a timestamp

saltext.vault.utils.vault.helpers.expand_pattern_lists(pattern: str, **mappings) list[str][source]

Expands the pattern for any list-valued mappings, such that for any list of length N in the mappings present in the pattern, N copies of the pattern are returned, each with an element of the list substituted.

pattern

A pattern to expand, for example by-role/{pillar[roles]}

mappings

A dictionary of variables that can be expanded into the pattern.

Example: Given the pattern `` by-role/{pillar[roles]}`` and the below pillar

roles:
  - web
  - database

This function expands into two patterns, [by-role/web, by-role/database].

Note that this method does not expand any non-list patterns.

saltext.vault.utils.vault.helpers.timestring_map(val: int | float | str, cast: type[int]) int[source]
saltext.vault.utils.vault.helpers.timestring_map(val: int | float | str, cast: type[float] = float) float
saltext.vault.utils.vault.helpers.timestring_map(val: int | float | str) float
saltext.vault.utils.vault.helpers.timestring_map(val: int | float | str | None, cast: type[int]) int | None
saltext.vault.utils.vault.helpers.timestring_map(val: int | float | str | None) float | None
saltext.vault.utils.vault.helpers.timestring_map(val: int | float | str | None, cast: type[float] = float) float | None

Turn a time string (like 60m) into a float with seconds as a unit.

saltext.vault.utils.vault.helpers.filter_state_internal_kwargs(kwargs: dict[str, Any]) dict[str, Any][source]

Removes state-internal kwargs from a kwargs dict.

saltext.vault.utils.vault.helpers.deserialize_csl(data: None) None[source]
saltext.vault.utils.vault.helpers.deserialize_csl(data: str | list[str]) list[str]

Ensure a value is a proper Python list, not a string containing a comma-separated list.