mirror of
https://github.com/docker/cli.git
synced 2026-01-26 15:41:42 +03:00
cli/command/container: inline parseWindowsDevice
It's not parsing anything, so we may as well inline it to be more clear what's done. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -997,9 +997,11 @@ func parseDevice(device, serverOS string) (container.DeviceMapping, error) {
|
||||
case "linux":
|
||||
return parseLinuxDevice(device)
|
||||
case "windows":
|
||||
return parseWindowsDevice(device)
|
||||
// Windows doesn't support mapping, so passing the given value as-is.
|
||||
return container.DeviceMapping{PathOnHost: device}, nil
|
||||
default:
|
||||
return container.DeviceMapping{}, fmt.Errorf("unknown server OS: %s", serverOS)
|
||||
}
|
||||
return container.DeviceMapping{}, fmt.Errorf("unknown server OS: %s", serverOS)
|
||||
}
|
||||
|
||||
// parseLinuxDevice parses a device mapping string to a container.DeviceMapping struct
|
||||
@@ -1030,18 +1032,11 @@ func parseLinuxDevice(device string) (container.DeviceMapping, error) {
|
||||
dst = src
|
||||
}
|
||||
|
||||
deviceMapping := container.DeviceMapping{
|
||||
return container.DeviceMapping{
|
||||
PathOnHost: src,
|
||||
PathInContainer: dst,
|
||||
CgroupPermissions: permissions,
|
||||
}
|
||||
return deviceMapping, nil
|
||||
}
|
||||
|
||||
// parseWindowsDevice parses a device mapping string to a container.DeviceMapping struct
|
||||
// knowing that the target is a Windows daemon
|
||||
func parseWindowsDevice(device string) (container.DeviceMapping, error) {
|
||||
return container.DeviceMapping{PathOnHost: device}, nil
|
||||
}, nil
|
||||
}
|
||||
|
||||
// validateDeviceCgroupRule validates a device cgroup rule string format
|
||||
|
||||
Reference in New Issue
Block a user