From dca17853d8a9321653ff5dbf96b27381c9806bf9 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Wed, 17 Jul 2019 20:19:24 +0000 Subject: [PATCH] Add WithLinuxDevices Opt Signed-off-by: Michael Crosby --- oci/spec_opts.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/oci/spec_opts.go b/oci/spec_opts.go index ce756108a..b94388c11 100644 --- a/oci/spec_opts.go +++ b/oci/spec_opts.go @@ -1139,3 +1139,12 @@ func WithAnnotations(annotations map[string]string) SpecOpts { return nil } } + +// WithLinuxDevices adds the provided linux devices to the spec +func WithLinuxDevices(devices []specs.LinuxDevice) SpecOpts { + return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error { + setLinux(s) + s.Linux.Devices = append(s.Linux.Devices, devices...) + return nil + } +}