Skip to content

Commit

Permalink
Change enclosure slots to ints, add Vendor() and Model() to Enclosure…
Browse files Browse the repository at this point in the history
…, which naively returns the first path's version of the named attribute
  • Loading branch information
bensallen committed May 1, 2017
1 parent 0e038ce commit 7c58fbf
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/enclosure.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// Enclosure is a SCSI Enclosure Device
type Enclosure struct {
MultiPathDevice *MultiPathDevice
Slots map[string]*MultiPathDevice
Slots map[int]*MultiPathDevice
}

func (d *Device) updateEnclosureSerial() (err error) {
Expand Down Expand Up @@ -105,3 +105,19 @@ func (e *Enclosure) Serial() string {
}
return ""
}

// Vendor returns the first vendor attribute from the Enclosure Device
func (e *Enclosure) Vendor() string {
for device := range e.MultiPathDevice.Paths {
return device.Vendor
}
return ""
}

// Model returns the first model attribute from the Enclosure Device
func (e *Enclosure) Model() string {
for device := range e.MultiPathDevice.Paths {
return device.Model
}
return ""
}

0 comments on commit 7c58fbf

Please sign in to comment.