Skip to content

Commit 1a0edeb

Browse files
authored
Add additional device naming formats to formatPartition template func (#771)
## Description This allows for using the formatPartition func for more device types. `vd*` is a device created by virtio. `hd*` for legacy IDE hard disks. Also use `hello-world` image instead of `alpine` in the `TestDockerImageNotPresent` unit test. ## Why is this needed Fixes: #770 ## How Has This Been Tested? ## How are existing users impacted? What migration steps/scripts do we need? ## Checklist: I have: - [ ] updated the documentation and/or roadmap (if required) - [ ] added unit or e2e tests - [ ] provided instructions on how to upgrade
2 parents 7c4c6a0 + 7b5ba2b commit 1a0edeb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

internal/agent/runtime/docker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestDockerImageNotPresent(t *testing.T) {
2727
t.Fatalf("Received unexpected error: %v", err)
2828
}
2929

30-
image := "alpine"
30+
image := "hello-world"
3131

3232
images, err := clnt.ImageList(context.Background(), types.ImageListOptions{
3333
Filters: filters.NewArgs(filters.Arg("reference", image)),

internal/workflow/template_funcs.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ var templateFuncs = map[string]interface{}{
2020
//
2121
// formatPartition("/dev/nvme0n1", 0) -> /dev/nvme0n1p1
2222
// formatPartition("/dev/sda", 1) -> /dev/sda1
23+
// formatPartition("/dev/vda", 2) -> /dev/vda2
2324
func formatPartition(dev string, partition int) string {
2425
switch {
2526
case strings.HasPrefix(dev, "/dev/nvme"):
2627
return fmt.Sprintf("%vp%v", dev, partition)
27-
case strings.HasPrefix(dev, "/dev/sd"):
28+
case strings.HasPrefix(dev, "/dev/sd"), strings.HasPrefix(dev, "/dev/vd"), strings.HasPrefix(dev, "/dev/hd"):
2829
return fmt.Sprintf("%v%v", dev, partition)
2930
}
3031
return dev

0 commit comments

Comments
 (0)