(authIndex string)
| 213 | } |
| 214 | |
| 215 | func (h *Host) authByIndex(authIndex string) (*coreauth.Auth, error) { |
| 216 | authIndex = strings.TrimSpace(authIndex) |
| 217 | if authIndex == "" { |
| 218 | return nil, fmt.Errorf("auth_index is required") |
| 219 | } |
| 220 | manager := h.currentAuthManager() |
| 221 | if manager == nil { |
| 222 | return nil, fmt.Errorf("core auth manager unavailable") |
| 223 | } |
| 224 | for _, auth := range manager.List() { |
| 225 | if auth == nil { |
| 226 | continue |
| 227 | } |
| 228 | auth.EnsureIndex() |
| 229 | if auth.Index == authIndex { |
| 230 | return auth, nil |
| 231 | } |
| 232 | } |
| 233 | return nil, fmt.Errorf("auth not found for auth_index %s", authIndex) |
| 234 | } |
| 235 | |
| 236 | func (h *Host) authPhysicalJSONByIndex(authIndex string) (*coreauth.Auth, []byte, error) { |
| 237 | auth, errGet := h.authByIndex(authIndex) |
no test coverage detected