Skip to content

Commit

Permalink
fix alloy bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Alva8756 authored and joelrebel committed Jun 20, 2024
1 parent 400b194 commit 19b98e6
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 1 deletion.
24 changes: 24 additions & 0 deletions internal/fixtures/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,30 @@ var (
ID: "",
PowerCapacityWatts: 550,
},
&common.PSU{
Common: common.Common{
Oem: false,
Description: "PS2 Status",
Vendor: "DELL",
Model: "PWR SPLY,550W,RDNT,DELTA",
Serial: "To Be Filled By O.E.M.",
ProductName: "",
Firmware: &common.Firmware{
Installed: "00.0C.7D",
Available: "",
SoftwareID: "",
Previous: nil,
},
Status: &common.Status{
Health: "OK",
State: "Enabled",
PostCode: 0,
PostCodeStatus: "",
},
},
ID: "",
PowerCapacityWatts: 550,
},
},
Enclosures: []*common.Enclosure{
&common.Enclosure{
Expand Down
168 changes: 168 additions & 0 deletions internal/fixtures/fleetdb_components_R6515_f0c8e4ac.go
Original file line number Diff line number Diff line change
Expand Up @@ -4698,6 +4698,174 @@ var (
ComponentTypeName: "Power-Supply",
ComponentTypeSlug: "power-supply",
},
fleetdbapi.ServerComponent{
Name: "Power-Supply",
Vendor: "dell",
Model: "PWR SPLY,550W,RDNT,DELTA",
Serial: "2",
Attributes: []fleetdbapi.Attributes{
fleetdbapi.Attributes{
Namespace: "sh.hollow.alloy.outofband.metadata",
Data: json.RawMessage{
123,
34,
100,
101,
115,
99,
114,
105,
112,
116,
105,
111,
110,
34,
58,
34,
80,
83,
50,
32,
83,
116,
97,
116,
117,
115,
34,
44,
34,
112,
111,
119,
101,
114,
95,
99,
97,
112,
97,
99,
105,
116,
121,
95,
119,
97,
116,
116,
115,
34,
58,
53,
53,
48,
125,
},
},
},
VersionedAttributes: []fleetdbapi.VersionedAttributes{
fleetdbapi.VersionedAttributes{
Namespace: "sh.hollow.alloy.outofband.firmware",
Data: json.RawMessage{
123,
34,
102,
105,
114,
109,
119,
97,
114,
101,
34,
58,
123,
34,
105,
110,
115,
116,
97,
108,
108,
101,
100,
34,
58,
34,
48,
48,
46,
48,
67,
46,
55,
68,
34,
125,
125,
},
Tally: 0,
},
fleetdbapi.VersionedAttributes{
Namespace: "sh.hollow.alloy.outofband.status",
Data: json.RawMessage{
91,
123,
34,
115,
116,
97,
116,
117,
115,
34,
58,
123,
34,
72,
101,
97,
108,
116,
104,
34,
58,
34,
79,
75,
34,
44,
34,
83,
116,
97,
116,
101,
34,
58,
34,
69,
110,
97,
98,
108,
101,
100,
34,
125,
125,
93,
},
Tally: 0,
},
},
ComponentTypeID: "",
ComponentTypeName: "Power-Supply",
ComponentTypeSlug: "power-supply",
},
fleetdbapi.ServerComponent{
Name: "CPU",
Vendor: "amd",
Expand Down
3 changes: 2 additions & 1 deletion internal/store/fleetdb/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ func (r *Store) psus(deviceVendor string, psus []*common.PSU) []*fleetdbapi.Serv
components := make([]*fleetdbapi.ServerComponent, 0, len(psus))

for idx, c := range psus {
if strings.TrimSpace(c.Serial) == "" {
trimedSerial := strings.TrimSpace(c.Serial)
if trimedSerial == "" || strings.Contains(trimedSerial, "To Be Filled By O.E.M.") {
c.Serial = strconv.Itoa(idx)
}

Expand Down

0 comments on commit 19b98e6

Please sign in to comment.