treewide: add missing error handling
Change-Id: I55ccf3ff490b58f6af93e665c668428acddc8d65
Reviewed-on: https://review.monogon.dev/c/monogon/+/3019
Vouch-Run-CI: Tim Windelschmidt <tim@monogon.tech>
Tested-by: Jenkins CI
Reviewed-by: Serge Bazanski <serge@monogon.tech>
diff --git a/metropolis/installer/main.go b/metropolis/installer/main.go
index 6313548..a35a734 100644
--- a/metropolis/installer/main.go
+++ b/metropolis/installer/main.go
@@ -89,6 +89,9 @@
// Use the partition's name to find and return the name of its parent
// device. It will be excluded from the list of suitable target devices.
srcDev, err := sysfs.ParentBlockDevice(espDev)
+ if err != nil{
+ return nil, fmt.Errorf("failed to fetch parent device: %w", err)
+ }
// Build the exclusion list containing forbidden handle prefixes.
exclude := []string{"dm-", "zram", "ram", "loop", srcDev}
diff --git a/metropolis/installer/test/main.go b/metropolis/installer/test/main.go
index 3c2460a..b2fb8dc 100644
--- a/metropolis/installer/test/main.go
+++ b/metropolis/installer/test/main.go
@@ -273,6 +273,9 @@
}
// Verify that GPT exists.
ti, err := storage.GetPartitionTable()
+ if err != nil {
+ t.Fatalf("Couldn't read the installer image partition table: %s", err)
+ }
if ti.Type() != "gpt" {
t.Error("Couldn't verify that the resulting node image contains a GPT.")
}