Skip to content

Commit

Permalink
Some more clean ups (#161)
Browse files Browse the repository at this point in the history
### What does this PR do

#### Silences examples/inventory

I was getting corrupted stdout/json when I tried to run
examples/inventory because flashrom would print to stdout and make it
invalid json. I also got rid of inventory.json from the directory since
it doesn't seem to belong in source control.

#### Refactor models files

Files had contents that did not match the filenames so I broke them out
to more appropriately named files. Not a big deal if coming from an
editor and using go-to-definition but annoying when trying to open a
file from the cli and there was no obvious file.

#### Save LogicalName to Drive if we have it

No real reason to not store this, its actually very helpful when trying
to act on Drives if it knows what its LogicalName/device-name is. There
was a worry about alloy possibly uploading a value that isn't guaranteed
to be stable from multiple boots but alloy only uploads specific fields
and not the whole Drive, so we're ok.

#### Store discovered nvme capabilities in Drive.Capabilities

Similar to LogicalName, there's not really a good reason to drop this
information and its necessary for clients to be able to choose
appropriate actions so don't make them re-run the scan.

#### Clean up Hdparm capabilities a little bit

Just some small refactors for better readability. Moved some variable
definitions closer to where they first get use so we don't have to keep
the context in our minds unnecessarily. Also tweaked the way a
common.Capability is instantiated so that they are indented and we avoid
long blocks of similar looking texts.

### The HW vendor this change applies to (if applicable)

N.A.

### The HW model number, product name this change applies to (if
applicable)

N.A.

### The BMC firmware and/or BIOS versions that this change applies to
(if applicable)

N.A.

### What version of tooling - vendor specific or opensource does this
change depend on (if applicable)

N.A.

### How can this change be tested by a PR reviewer?

:eyes: 

### Description for changelog/release notes

* `Drive`s now carry the `LogicalName` if one is handy
* nvme `Drive`s now carry the discovered `Capabilities`
  • Loading branch information
mmlb authored Jun 7, 2024
2 parents 41022f4 + 871ff67 commit a5c2608
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 978 deletions.
1 change: 0 additions & 1 deletion examples/inventory/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
func main() {
logger := logrus.New()
logger.Formatter = new(logrus.JSONFormatter)
logger.SetLevel(logrus.TraceLevel)
device, err := ironlib.New(logger)
if err != nil {
logger.Fatal(err)
Expand Down
Loading

0 comments on commit a5c2608

Please sign in to comment.