mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 08:18:32 +00:00
Add NewContainerEdits utility function
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
046d761f4c
commit
3140810c95
@ -64,9 +64,7 @@ func FromDiscoverer(d discover.Discover) (*cdi.ContainerEdits, error) {
|
||||
return nil, fmt.Errorf("failed to discover hooks: %v", err)
|
||||
}
|
||||
|
||||
c := cdi.ContainerEdits{
|
||||
ContainerEdits: &specs.ContainerEdits{},
|
||||
}
|
||||
c := NewContainerEdits()
|
||||
for _, d := range devices {
|
||||
edits, err := device(d).toEdits()
|
||||
if err != nil {
|
||||
@ -83,7 +81,15 @@ func FromDiscoverer(d discover.Discover) (*cdi.ContainerEdits, error) {
|
||||
c.Append(hook(h).toEdits())
|
||||
}
|
||||
|
||||
return &c, nil
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// NewContainerEdits is a utility function to create a CDI ContainerEdits struct.
|
||||
func NewContainerEdits() *cdi.ContainerEdits {
|
||||
c := cdi.ContainerEdits{
|
||||
ContainerEdits: &specs.ContainerEdits{},
|
||||
}
|
||||
return &c
|
||||
}
|
||||
|
||||
// Modify applies the defined edits to the incoming OCI spec
|
||||
|
Loading…
Reference in New Issue
Block a user