Skip to content

Commit 499447f

Browse files
committed
WIP
1 parent c045075 commit 499447f

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

internal/redfishwrapper/power.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ func (c *Client) SystemForceOff(ctx context.Context) (ok bool, err error) {
212212

213213
system.DisableEtagMatch(c.disableEtagMatch)
214214

215+
215216
err = system.Reset(rf.ForceOffResetType)
216217
if err != nil {
217218
return false, err

providers/supermicro/supermicro.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ type bmcQueryor interface {
115115
deviceModel() (model string)
116116
supportsInstall(component string) error
117117
inventory(ctx context.Context) (*common.Device, error)
118-
powerSet(ctx context.Context, state string) (ok bool, err error)
119118
}
120119

121120
// New returns connection with a Supermicro client initialized
@@ -201,6 +200,10 @@ func (c *Client) PowerStateGet(ctx context.Context) (state string, err error) {
201200

202201
// PowerSet sets the power state of a server
203202
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+
204207
return c.serviceClient.redfish.PowerSet(ctx, state)
205208
}
206209

@@ -359,16 +362,6 @@ func (c *Client) initScreenPreview(ctx context.Context) error {
359362
return nil
360363
}
361364

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-
372365
type serviceClient struct {
373366
host string
374367
port string

0 commit comments

Comments
 (0)