diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..11d9d578 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,4 @@ +FROM mcr.microsoft.com/devcontainers/go:1-1.21-bullseye +RUN apt update +RUN apt install ipmitool -y + diff --git a/bmc/sel.go b/bmc/sel.go index 8135e06e..002a25d1 100644 --- a/bmc/sel.go +++ b/bmc/sel.go @@ -5,7 +5,6 @@ import ( "fmt" "time" - "github.com/bmc-toolbox/bmclib/v2/internal" "github.com/hashicorp/go-multierror" "github.com/pkg/errors" ) @@ -22,13 +21,7 @@ type systemEventLogProviders struct { systemEventLogProvider SystemEventLog } -type SystemEventLogEntries []SystemEventLogEntry - -type SystemEventLogEntry struct { - ID int32 - Values []string - Raw string -} +type SystemEventLogEntries [][]string func clearSystemEventLog(ctx context.Context, timeout time.Duration, s []systemEventLogProviders) (metadata Metadata, err error) { var metadataLocal Metadata @@ -80,7 +73,6 @@ func ClearSystemEventLogFromInterfaces(ctx context.Context, timeout time.Duratio } func getSystemEventLog(ctx context.Context, timeout time.Duration, s []systemEventLogProviders) (sel SystemEventLogEntries, metadata Metadata, err error) { - var selLocal SystemEventLogEntries var metadataLocal Metadata for _, elem := range s { @@ -97,33 +89,19 @@ func getSystemEventLog(ctx context.Context, timeout time.Duration, s []systemEve ctx, cancel := context.WithTimeout(ctx, timeout) defer cancel() - selRawEntries, selErr := elem.systemEventLogProvider.GetSystemEventLog(ctx) + sel, selErr := elem.systemEventLogProvider.GetSystemEventLog(ctx) if selErr != nil { err = multierror.Append(err, errors.WithMessagef(selErr, "provider: %v", elem.name)) continue } - for i, v := range selRawEntries { - - // In most cases, the first value is the ID, but not always - k, err := internal.ParseInt32(v[0]) - if err != nil { - k = int32(i) - } - - selLocal = append(selLocal, SystemEventLogEntry{ - ID: k, - Values: v, - }) - } - metadataLocal.SuccessfulProvider = elem.name - return selLocal, metadataLocal, nil + return sel, metadataLocal, nil } } - return selLocal, metadataLocal, multierror.Append(err, errors.New("failed to get System Event Log")) + return nil, metadataLocal, multierror.Append(err, errors.New("failed to get System Event Log")) } func GetSystemEventLogFromInterfaces(ctx context.Context, timeout time.Duration, generic []interface{}) (sel SystemEventLogEntries, metadata Metadata, err error) { diff --git a/internal/utils.go b/internal/utils.go index c73d6b19..a8ce848c 100644 --- a/internal/utils.go +++ b/internal/utils.go @@ -1,7 +1,6 @@ package internal import ( - "fmt" "unicode" ) @@ -22,12 +21,3 @@ func StringInSlice(str string, sl []string) bool { } return false } - -func ParseInt32(i32 string) (int32, error) { - var i int32 - _, err := fmt.Sscanf(i32, "%d", &i) - if err != nil { - return 0, err - } - return i, nil -}