@@ -115,7 +115,6 @@ type bmcQueryor interface {
115
115
deviceModel () (model string )
116
116
supportsInstall (component string ) error
117
117
inventory (ctx context.Context ) (* common.Device , error )
118
- powerSet (ctx context.Context , state string ) (ok bool , err error )
119
118
}
120
119
121
120
// New returns connection with a Supermicro client initialized
@@ -201,6 +200,10 @@ func (c *Client) PowerStateGet(ctx context.Context) (state string, err error) {
201
200
202
201
// PowerSet sets the power state of a server
203
202
func (c * Client ) PowerSet (ctx context.Context , state string ) (ok bool , err error ) {
203
+ if c .serviceClient == nil || c .serviceClient .redfish == nil {
204
+ return false , errors .Wrap (bmclibErrs .ErrLoginFailed , "client not initialized" )
205
+ }
206
+
204
207
return c .serviceClient .redfish .PowerSet (ctx , state )
205
208
}
206
209
@@ -359,16 +362,6 @@ func (c *Client) initScreenPreview(ctx context.Context) error {
359
362
return nil
360
363
}
361
364
362
- // PowerSet sets the power state of a server
363
- func (c * Client ) PowerSet (ctx context.Context , state string ) (ok bool , err error ) {
364
- switch strings .ToLower (state ) {
365
- case "cycle" :
366
- return c .powerCycle (ctx )
367
- default :
368
- return false , errors .New ("action not implemented for provider" )
369
- }
370
- }
371
-
372
365
type serviceClient struct {
373
366
host string
374
367
port string
0 commit comments