Skip to content

Commit 38b3f83

Browse files
committed
refactor
1 parent eb50243 commit 38b3f83

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

internal/orchestrator/orchestrator.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,12 +1043,12 @@ func getCurrentUser() string {
10431043
}
10441044

10451045
type deviceResult struct {
1046-
devicePaths []string
1047-
deviceCgroupRules []string
1048-
additionalDeviceVolumes []string
1049-
hasVideoDevice bool
1050-
hasSoundDevice bool
1051-
hasGPUDevice bool
1046+
devicePaths []string
1047+
deviceCgroupRules []string
1048+
deviceVolumes []string
1049+
hasVideoDevice bool
1050+
hasSoundDevice bool
1051+
hasGPUDevice bool
10521052
}
10531053

10541054
func getDevices() (*deviceResult, error) {
@@ -1068,17 +1068,17 @@ func getDevices() (*deviceResult, error) {
10681068
}
10691069
// Verify if there are real video devices (cameras) in /dev/v4l/by-id
10701070
if camDevices := getVideoDevices(); len(camDevices) > 0 {
1071-
res.deviceCgroupRules = append(res.deviceCgroupRules, "\"c 81:* rwm\"") // rule for V4L devices
1071+
res.deviceCgroupRules = append(res.deviceCgroupRules, "c 81:* rwm") // rule for V4L devices
10721072
if paths.New("/dev/v4l").Exist() {
1073-
res.additionalDeviceVolumes = append(res.additionalDeviceVolumes, "/dev/v4l")
1073+
res.deviceVolumes = append(res.deviceVolumes, "/dev/v4l")
10741074
}
10751075
res.hasVideoDevice = true
10761076
}
10771077
// Verify if there are real sound devices in /dev/snd/by-id
10781078
if sndDev := getSoundDevices(); len(sndDev) > 0 {
1079-
res.deviceCgroupRules = append(res.deviceCgroupRules, "\"c 116:* rwm\"") // rule for ALSA devices
1079+
res.deviceCgroupRules = append(res.deviceCgroupRules, "c 116:* rwm") // rule for ALSA devices
10801080
if paths.New("/dev/snd").Exist() {
1081-
res.additionalDeviceVolumes = append(res.additionalDeviceVolumes, "/dev/snd")
1081+
res.deviceVolumes = append(res.deviceVolumes, "/dev/snd")
10821082
}
10831083
res.hasSoundDevice = true
10841084
}

internal/orchestrator/provision.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ func generateMainComposeFile(
326326
if err = validateDevices(devices, requiredDeviceClasses); err != nil {
327327
return fmt.Errorf("missing required device: %w", err)
328328
}
329-
if len(devices.additionalDeviceVolumes) > 0 {
330-
for _, devVolume := range devices.additionalDeviceVolumes {
329+
if len(devices.deviceVolumes) > 0 {
330+
for _, devVolume := range devices.deviceVolumes {
331331
volumes = append(volumes, volume{
332332
Type: "bind",
333333
Source: devVolume,

0 commit comments

Comments
 (0)