Skip to content

fix: fall back to Redfish session token auth in baremetal agent#24995

Open
mvanhorn wants to merge 1 commit into
yunionio:masterfrom
mvanhorn:fix/24911-baremetal-redfish-session-auth
Open

fix: fall back to Redfish session token auth in baremetal agent#24995
mvanhorn wants to merge 1 commit into
yunionio:masterfrom
mvanhorn:fix/24911-baremetal-redfish-session-auth

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Jun 8, 2026

Copy link
Copy Markdown

Summary

The baremetal agent's Redfish client now falls back to Session-token (X-Auth-Token) authentication when Basic Auth is rejected, so Redfish endpoints that require session auth work instead of failing the probe.

Why this matters

Some Redfish/BMC implementations reject Basic Auth and require a session token (#24911). The client only tried Basic Auth, so those endpoints failed. This reuses the existing Login/SessionToken machinery in pkg/util/redfish/redfish.go: when the initial probe returns an authentication error (401/403), it logs in for a session token and retries. Non-auth failures (404/500) fast-fail as before and never create an unnecessary session, detected via errors.As on the wrapped JSONClientError rather than a type assertion through errors.Cause.

This covers the authentication half of the issue; the non-standard System ID navigation path is already handled by the existing index-based Members traversal.

Testing

  • Added tests: a 401 probe falls back to Login and retries; 404 and 500 do not fall back and create no session.
  • go build and go test pass for pkg/util/redfish.

Refs #24911

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants