saltext.formula.utils._types

class saltext.formula.utils._types.LoadedMod[source]

Type representing a specific module loaded by the Salt Loader.

class saltext.formula.utils._types.SaltLoader(*args: Any, **kwargs: Any)[source]

Type representing a dict of modules loaded by the Salt Loader.

At runtime, these objects are salt.loader.context.NamedLoaderContext instances. Its untyped mapping methods take precedence in the MRO, hence redeclare them here. get is left untyped because ty rejects any typed override of Mapping.get, even one mirroring typeshed’s signature exactly (as of ty 0.0.84).

class saltext.formula.utils._types.SaltLogger(name, level=0)[source]

Adds Salt-specific log levels to logging.Logger type.

# Note the type: ignore comment, which silences invalid assignment warnings.
log: "SaltLogger" = logging.getLogger(__name__)  # type: ignore
debug(msg, *args, exc_info: None | bool | tuple[type[BaseException], BaseException, TracebackType | None] | tuple[None, None, None] | BaseException = None, stack_info: bool = False, stacklevel: int = 1, extra: Mapping[str, object] | None = None, exc_info_on_loglevel: Literal[0, 1, 5, 10, 15, 20, 30, 40, 50, 1000] | Literal['all', 'garbage', 'trace', 'debug', 'profile', 'info', 'warning', 'error', 'critical', 'quiet'] | None = None)[source]

Log ‘msg % args’ with severity ‘DEBUG’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.debug(“Houston, we have a %s”, “thorny problem”, exc_info=True)

info(msg, *args, exc_info: None | bool | tuple[type[BaseException], BaseException, TracebackType | None] | tuple[None, None, None] | BaseException = None, stack_info: bool = False, stacklevel: int = 1, extra: Mapping[str, object] | None = None, exc_info_on_loglevel: Literal[0, 1, 5, 10, 15, 20, 30, 40, 50, 1000] | Literal['all', 'garbage', 'trace', 'debug', 'profile', 'info', 'warning', 'error', 'critical', 'quiet'] | None = None)[source]

Log ‘msg % args’ with severity ‘INFO’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.info(“Houston, we have a %s”, “notable problem”, exc_info=True)

warning(msg, *args, exc_info: None | bool | tuple[type[BaseException], BaseException, TracebackType | None] | tuple[None, None, None] | BaseException = None, stack_info: bool = False, stacklevel: int = 1, extra: Mapping[str, object] | None = None, exc_info_on_loglevel: Literal[0, 1, 5, 10, 15, 20, 30, 40, 50, 1000] | Literal['all', 'garbage', 'trace', 'debug', 'profile', 'info', 'warning', 'error', 'critical', 'quiet'] | None = None)[source]

Log ‘msg % args’ with severity ‘WARNING’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.warning(“Houston, we have a %s”, “bit of a problem”, exc_info=True)

error(msg, *args, exc_info: None | bool | tuple[type[BaseException], BaseException, TracebackType | None] | tuple[None, None, None] | BaseException = None, stack_info: bool = False, stacklevel: int = 1, extra: Mapping[str, object] | None = None, exc_info_on_loglevel: Literal[0, 1, 5, 10, 15, 20, 30, 40, 50, 1000] | Literal['all', 'garbage', 'trace', 'debug', 'profile', 'info', 'warning', 'error', 'critical', 'quiet'] | None = None)[source]

Log ‘msg % args’ with severity ‘ERROR’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.error(“Houston, we have a %s”, “major problem”, exc_info=True)

critical(msg, *args, exc_info: None | bool | tuple[type[BaseException], BaseException, TracebackType | None] | tuple[None, None, None] | BaseException = None, stack_info: bool = False, stacklevel: int = 1, extra: Mapping[str, object] | None = None, exc_info_on_loglevel: Literal[0, 1, 5, 10, 15, 20, 30, 40, 50, 1000] | Literal['all', 'garbage', 'trace', 'debug', 'profile', 'info', 'warning', 'error', 'critical', 'quiet'] | None = None)[source]

Log ‘msg % args’ with severity ‘CRITICAL’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.critical(“Houston, we have a %s”, “major disaster”, exc_info=True)

class saltext.formula.utils._types.SaltResource[source]

The __resource__ dunder, describing the resource currently being operated on. Available in resource modules on Salt 3008.0+.

class saltext.formula.utils._types.StateRet[source]

Dictionary returned by all state functions.

name

Name of the state.

result

Success indicator. Boolean. if __opts__["test"] is true, can be None if the state cannot determine whether the result would be false or true, e.g. when changes need to be applied or a necessary resource is missing, but might have been created by another state if the run had not been executed in test mode.

comment

String describing the result.

changes

Arbitrary dict of applied changes.

saltext.formula.utils._types.__active_provider_name__: str

Cloud

Type:

The current cloud provider as <alias>:<driver>. Defined in

saltext.formula.utils._types.__context__: dict[str, Any]

Context dict for caching. Preserved across all module calls of a state run.

saltext.formula.utils._types.__env__: str

State

Type:

Fileserver saltenv. Defined in

saltext.formula.utils._types.__events__: list[dict[str, Any]]

Thorium

Type:

List of events since the last loop. Defined in

saltext.formula.utils._types.__executors__: SaltLoader

Executor

Type:

Loader of Executor modules. Defined in

saltext.formula.utils._types.__ext_pillar__: SaltLoader

Loader of Pillar modules. Defined in: Pillar Note: This is a FilterDictWrapper, suffixing all lookups with .ext_pillar.

saltext.formula.utils._types.__file_client__: salt.fileclient.Client

Execution, Matcher, Renderer, State, SSH Wrapper

Type:

Fileserver client. Defined in

saltext.formula.utils._types.__grains__: dict[str, Any]

Minion grains/Resource grains (Resource override modules only). Filled in for: Execution, Pillar, Renderer, Resource connection, Resource override, Returner, SSH Wrapper, State

saltext.formula.utils._types.__instance_id__: str

State class instance ID. Can differ in the same run when parallel states are used with spawning. Defined in: State

saltext.formula.utils._types.__jid__: str

Runner, Wheel

Type:

Job ID to run under. Defined in (?)

saltext.formula.utils._types.__jid_event__: salt.utils.event.NamespacedEvent

Runner, Wheel

Type:

Send events with current run’s tag as prefix. WeakRef. Defined in (?)

saltext.formula.utils._types.__low__: Mapping[str, Any]

State

Type:

Currently executing low chunk (immutable). Defined in

saltext.formula.utils._types.__lowstate__: Sequence[dict[str, Any]]

State

Type:

List of all chunks in the current state run (immutable). Defined in

saltext.formula.utils._types.__minion__: SaltLoader

Resource override modules

Type:

Loader of regular Execution modules. Defined in

saltext.formula.utils._types.__opts__: dict[str, Any]

All master/minion configuration options. For SSH Wrappers, additionally contains __master_opts__. Always filled in.

saltext.formula.utils._types.__pillar__: dict[str, Any]

Pillar data for the minion. According to docs, filled in for: Execution, Renderer, Returner, SSH Wrapper, State Likely filled in for many more that are loaded in a minion context, e.g. Matcher, Pillar, Resource override

saltext.formula.utils._types.__proxy__: SaltLoader

Loader of Proxy modules. Defined in: Beacon, Engine, Execution, Executor, Proxy, Renderer, Returner, State

saltext.formula.utils._types.__reg__: dict[str, Any]

Thorium

Type:

Register returner data. Defined in

saltext.formula.utils._types.__resource__: SaltResource

The Resource type/id currently being operated on. Defined in: Resource connection and override modules

saltext.formula.utils._types.__resource_funcs__: SaltLoader

Resource override modules

Type:

Loader of Resource connection modules. Defined in

saltext.formula.utils._types.__ret__: SaltLoader

Proxy

Type:

Loader of Returner modules. Defined in

saltext.formula.utils._types.__runner__: SaltLoader

Roster, Thorium

Type:

Loader of Runner modules (note the singular in the dunder name). Defined in

saltext.formula.utils._types.__runners__: SaltLoader

Engine, Matcher (?)

Type:

Loader of Runner modules (note the plural in the dunder name). Defined in

saltext.formula.utils._types.__running__: Mapping[str, Mapping[str, Any]]

Mapping of executed state ID to ret dict. Can contain salt.utils.process.Process instances when parallel states are executed. (immutable)

saltext.formula.utils._types.__salt__: SaltLoader

Loader of several module types, depending on the module type referencing it.

Usually: Loader of Execution modules. Defined in: Auth, Beacon, Engine, Execution, Executor, Pillar, Proxy, Renderer, Returner, SDB, State, Thorium

Also defined in:

  • Outputter (contains Outputter modules) (Note: This is a FilterDictWrapper, suffixing all lookups with .output)

  • Resource override (contains Resource override modules)

  • Runner (contains Runner modules)

  • SSH Wrapper (contains other SSH Wrappers, unknown lookups run on the remote via SSH)

saltext.formula.utils._types.__salt_system_encoding__: str

Return value of sys.getdefaultencoding().

saltext.formula.utils._types.__sdb__: SaltLoader

SDB

Type:

Loader of SDB modules. Defined in

saltext.formula.utils._types.__serializers__: SaltLoader

State

Type:

Loader of Serializer modules. Defined in

saltext.formula.utils._types.__states__: SaltLoader

State, Renderer (during state run only)

Type:

Loader of State modules. Defined in

saltext.formula.utils._types.__tag__: str

Runner, Wheel

Type:

Tag to run under. Defined in (?)

saltext.formula.utils._types.__thorium__: SaltLoader

Thorium

Type:

Loader of Thorium modules. Defined in

saltext.formula.utils._types.__user__: str

User running the command In State: Configured minion user (__opts__["user"])

Type:

In Runner/Wheel (?)