Skip to content

Commit 7bc6c6c

Browse files
committed
Fix PowerCycle() on Fujitsu
1 parent 6b1c48c commit 7bc6c6c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

internal/redfish/redfish.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,27 @@ func New(url, user, password string, insecure bool, log logger.Logger, connectio
8989
return apiClient, nil
9090
}
9191

92+
func (r *APIClient) GetSystem() (*schemas.ComputerSystem, error) {
93+
g := r.client.WithContext(context.Background())
94+
95+
if g.Service == nil {
96+
return nil, fmt.Errorf("gofish service root is not available")
97+
}
98+
service := g.Service
99+
100+
systems, err := service.Systems()
101+
if err != nil {
102+
return nil, err
103+
}
104+
105+
for _, s := range systems {
106+
if s.ID == r.systemID {
107+
return s, nil
108+
}
109+
}
110+
return nil, fmt.Errorf("system with ID %q not found", r.systemID)
111+
}
112+
92113
func (c *APIClient) SetETagRequired(required bool) {
93114
c.ETagRequired = required
94115
}

0 commit comments

Comments
 (0)