Skip to content

Commit d42fe74

Browse files
Mortom123martinbpg-dev
authored
fix(hwmapping): enable nested USB hubs (#2636)
Signed-off-by: martin <menzelm98+bpg_terraform@gmail.com> Signed-off-by: Pavel Boldyrev <pavel@bpg.sh> Co-authored-by: martin <menzelm98+bpg_terraform@gmail.com> Co-authored-by: Pavel Boldyrev <pavel@bpg.sh>
1 parent 53cce6f commit d42fe74

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

fwprovider/types/hardwaremapping/path.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var (
4444
PathPCIValueRegEx = regexp.MustCompile(`^[a-f0-9]{4,}:[a-f0-9]{2}:[a-f0-9]{2}(\.[a-f0-9])?$`)
4545

4646
// PathUSBValueRegEx is the regular expression for a USB hardware mapping path.
47-
PathUSBValueRegEx = regexp.MustCompile(`^\d+-(\d+)(\.\d+)?$`)
47+
PathUSBValueRegEx = regexp.MustCompile(`^\d+-(\d+)(\.\d+)*$`)
4848
)
4949

5050
// PathType is a type that represents a path of a hardware mapping.

fwprovider/types/hardwaremapping/path_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ func TestPathValueFromTerraform(t *testing.T) {
4444
return val.ValueString() == "1-5.2"
4545
},
4646
},
47+
"Valid for USB Hub": {
48+
val: tftypes.NewValue(tftypes.String, "1-5.2.4"),
49+
expected: func(val PathValue) bool {
50+
return val.ValueString() == "1-5.2.4"
51+
},
52+
},
4753
}
4854

4955
for name, test := range tests {

0 commit comments

Comments
 (0)