saltext.bmc.utils.redfish¶
Redfish HTTP transport for the saltext-bmc extension.
A small Redfish client built directly on requests. It exposes the
minimum primitives the higher-level layers need:
RedfishClient— context-managed session with GET / POST / PATCH / DELETE.get_system_path()andget_reset_action()— Redfish service discovery helpers.get_config(),resolve_conn(),open_client()— pillar → connection-config plumbing shared with the IPMI backend.
The protocol-neutral operations (power / boot / inventory / sensors) are
in saltext.bmc.utils.backend; raw passthrough lives in
saltext.bmc.modules.bmc_redfish.
Configuration is read from Salt opts/pillar under saltext.bmc:
saltext.bmc:
host: 192.168.1.100
username: root
password: calvin
verify_ssl: false
Or, when multiple targets are managed by a single minion:
saltext.bmc:
profiles:
bmc-host-01:
host: 10.0.0.5
username: root
password: calvin
verify_ssl: false
bmc-host-02:
host: 10.0.0.6
username: root
password: calvin
verify_ssl: false
Auth strategy: a session is opened against
/redfish/v1/SessionService/Sessions to obtain an X-Auth-Token for
subsequent requests, and DELETE’d on close. If session creation fails
(older BMCs, or BMCs with the session service disabled), the client
falls back to HTTP Basic for the request lifetime.
- exception saltext.bmc.utils.redfish.RedfishAuthError[source]¶
Authentication against the Redfish endpoint failed.
- saltext.bmc.utils.redfish.get_config(opts: dict, profile: str | None = None) dict[source]¶
Extract BMC connection config from opts/pillar.
- Searches in order:
saltext.bmc:profiles:<profile>(whenprofileis given)saltext.bmctop-level keys (fallback / single-host config)
- saltext.bmc.utils.redfish.resolve_conn(opts: dict, name: str | None = None, **overrides) dict[source]¶
Resolve a connection config from opts/pillar plus explicit kwargs.
Explicit kwargs (
host=,username=,password=,verify_ssl=) take precedence over the resolved profile.
- class saltext.bmc.utils.redfish.RedfishClient(host: str, username: str, password: str, *, verify_ssl: bool = True, timeout: int = 30)[source]¶
Thin Redfish HTTP client.
Use as a context manager:
with RedfishClient(host, user, password, verify_ssl=False) as c: data = c.get("/redfish/v1/Systems")
- saltext.bmc.utils.redfish.get_system_path(client: RedfishClient) str[source]¶
Return the
@odata.idof the (typically single) ComputerSystem.Raises
RedfishErrorif no system is exposed or multiple systems are present without an obvious default.
- saltext.bmc.utils.redfish.get_reset_action(system: dict) tuple[str, list[str]][source]¶
Return
(target_path, allowable_values)forComputerSystem.Reset.Parses the
Actionsblock of a ComputerSystem resource to find the reset action target and the list of acceptedResetTypevalues.
- saltext.bmc.utils.redfish.open_client(opts: dict, name: str | None = None, **overrides) RedfishClient[source]¶
Build a
RedfishClientfrom opts/pillar plus optional overrides.Caller is responsible for using it as a context manager.