diff --git a/cmd/nvidia-cdi-hook/commands/commands.go b/cmd/nvidia-cdi-hook/commands/commands.go index 3f80ba9b..c840f939 100644 --- a/cmd/nvidia-cdi-hook/commands/commands.go +++ b/cmd/nvidia-cdi-hook/commands/commands.go @@ -36,3 +36,8 @@ func New(logger logger.Interface) []*cli.Command { cudacompat.NewCommand(logger), } } + +func WarnOnUnsupportedSubcommand(logger logger.Interface, c *cli.Context) error { + logger.Warningf("Unsupported hook or arguments %v", c.Args()) + return nil +} diff --git a/cmd/nvidia-cdi-hook/main.go b/cmd/nvidia-cdi-hook/main.go index d7b7c271..d5341433 100644 --- a/cmd/nvidia-cdi-hook/main.go +++ b/cmd/nvidia-cdi-hook/main.go @@ -51,6 +51,11 @@ func main() { c.Usage = "Command to structure files for usage inside a container, called as hooks from a container runtime, defined in a CDI yaml file" c.Version = info.GetVersionString() + // We add an action to the hook + c.Action = func(ctx *cli.Context) error { + return commands.WarnOnUnsupportedSubcommand(logger, ctx) + } + // Setup the flags for this command c.Flags = []cli.Flag{ &cli.BoolFlag{ diff --git a/cmd/nvidia-ctk/hook/hook.go b/cmd/nvidia-ctk/hook/hook.go index a638d2a7..f958dc79 100644 --- a/cmd/nvidia-ctk/hook/hook.go +++ b/cmd/nvidia-ctk/hook/hook.go @@ -41,6 +41,9 @@ func (m hookCommand) build() *cli.Command { hook := cli.Command{ Name: "hook", Usage: "A collection of hooks that may be injected into an OCI spec", + Action: func(ctx *cli.Context) error { + return commands.WarnOnUnsupportedSubcommand(m.logger, ctx) + }, } hook.Subcommands = commands.New(m.logger)