mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-03-17 02:38:40 +00:00
FIX: Use MountSpec* constants
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
df7c064257
commit
5a416bc99c
@ -55,17 +55,18 @@ func NewMountSpecFromLine(line string) (*MountSpec, error) {
|
|||||||
|
|
||||||
// NewMountSpec creates a MountSpec with the specified type and path. An error is returned if the type is invalid.
|
// NewMountSpec creates a MountSpec with the specified type and path. An error is returned if the type is invalid.
|
||||||
func NewMountSpec(mountType string, path string) (*MountSpec, error) {
|
func NewMountSpec(mountType string, path string) (*MountSpec, error) {
|
||||||
switch mountType {
|
mt := MountSpecType(mountType)
|
||||||
case "dev", "lib", "sym", "dir":
|
switch mt {
|
||||||
|
case MountSpecDev, MountSpecLib, MountSpecSym, MountSpecDir:
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unexpected mount type: %v", mountType)
|
return nil, fmt.Errorf("unexpected mount type: %v", mt)
|
||||||
}
|
}
|
||||||
if path == "" {
|
if path == "" {
|
||||||
return nil, fmt.Errorf("invalid path: %v", path)
|
return nil, fmt.Errorf("invalid path: %v", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
mount := MountSpec{
|
mount := MountSpec{
|
||||||
Type: MountSpecType(mountType),
|
Type: mt,
|
||||||
Path: path,
|
Path: path,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user