mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
Issue warning on unsupported CDI hook
Some checks failed
Some checks failed
To allow for CDI hooks to be added gradually we provide a generic no-op hook for unrecognised subcommands. This will log a warning instead of erroring out. An unsupported hook could be the result of a CDI specification referring to a new hook that is not yet supported by an older NVIDIA Container Toolkit version or a hook that has been removed in newer version. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
@@ -36,3 +36,16 @@ func New(logger logger.Interface) []*cli.Command {
|
||||
cudacompat.NewCommand(logger),
|
||||
}
|
||||
}
|
||||
|
||||
// IssueUnsupportedHookWarning logs a warning that no hook or an unsupported
|
||||
// hook has been specified.
|
||||
// This happens if a subcommand is provided that does not match one of the
|
||||
// subcommands that has been explicitly specified.
|
||||
func IssueUnsupportedHookWarning(logger logger.Interface, c *cli.Context) {
|
||||
args := c.Args().Slice()
|
||||
if len(args) == 0 {
|
||||
logger.Warningf("No CDI hook specified")
|
||||
} else {
|
||||
logger.Warningf("Unsupported CDI hook: %v", args[0])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user