Skip to content

Commit

Permalink
Revert "Handle empty devices in OCI spec"
Browse files Browse the repository at this point in the history
This reverts commit a9c4a82.
  • Loading branch information
zvonkok committed Jun 12, 2024
1 parent a9c4a82 commit 9e84b98
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/generate/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,15 @@ impl Generator {
self.init_config_linux_resources();
if let Some(linux) = self.config.as_mut().unwrap().linux_mut() {
if let Some(resource) = linux.resources_mut() {

let add_device = |allow, dev_type, major, minor, access| {
if let Some(devices) = resource.devices_mut() {
let mut device = LinuxDeviceCgroup::default();
device.set_allow(allow);
device.set_typ(Some(dev_type));
device.set_major(major);
device.set_minor(minor);
device.set_access(access);
device
};

let device = add_device(allow, dev_type, major, minor, access);

if let Some(devices) = resource.devices_mut() {
devices.push(device);
} else {
let mut devices = Vec::new();
devices.push(device);
resource.set_devices(Some(devices));
}
}
}
Expand Down

0 comments on commit 9e84b98

Please sign in to comment.