summaryrefslogtreecommitdiff
path: root/pkg/spec/config_linux.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-08-17 18:17:44 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-20 13:42:07 +0000
commit462c503a4762a0f20023d937a5fb05a55d4183a3 (patch)
tree5c82069a9e41364107f0b7b0134cee2c15d8037c /pkg/spec/config_linux.go
parente40c99a19ecc0edf5d45ea3c861cd48ce2e22448 (diff)
downloadpodman-462c503a4762a0f20023d937a5fb05a55d4183a3.tar.gz
podman-462c503a4762a0f20023d937a5fb05a55d4183a3.tar.bz2
podman-462c503a4762a0f20023d937a5fb05a55d4183a3.zip
Fix handling of devices
Devices are supposed to be able to be passed in via the form of --device /dev/foo --device /dev/foo:/dev/bar --device /dev/foo:rwm --device /dev/foo:/dev/bar:rwm Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #1299 Approved by: umohnani8
Diffstat (limited to 'pkg/spec/config_linux.go')
-rw-r--r--pkg/spec/config_linux.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/spec/config_linux.go b/pkg/spec/config_linux.go
index cd633bc69..ea04b95bd 100644
--- a/pkg/spec/config_linux.go
+++ b/pkg/spec/config_linux.go
@@ -28,10 +28,15 @@ func Device(d *configs.Device) spec.LinuxDevice {
}
func addDevice(g *generate.Generator, device string) error {
- dev, err := devices.DeviceFromPath(device, "rwm")
+ src, dst, permissions, err := parseDevice(device)
if err != nil {
- return errors.Wrapf(err, "%s is not a valid device", device)
+ return err
+ }
+ dev, err := devices.DeviceFromPath(src, permissions)
+ if err != nil {
+ return errors.Wrapf(err, "%s is not a valid device", src)
}
+ dev.Path = dst
linuxdev := spec.LinuxDevice{
Path: dev.Path,
Type: string(dev.Type),