Use state.GetContainerRoot in nvidia-ctk hook subcommands

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2022-05-10 09:57:57 +02:00
parent 395f6cecb2
commit 55efdc8765
2 changed files with 4 additions and 14 deletions

View File

@ -87,14 +87,9 @@ func (m command) run(c *cli.Context, cfg *config) error {
return fmt.Errorf("failed to load container state: %v", err)
}
spec, err := s.LoadSpec()
containerRoot, err := s.GetContainerRoot()
if err != nil {
return fmt.Errorf("failed to load OCI spec: %v", err)
}
var containerRoot string
if spec.Root != nil {
containerRoot = spec.Root.Path
return fmt.Errorf("failed to determined container root: %v", err)
}
csvFiles := cfg.filenames.Value()

View File

@ -79,14 +79,9 @@ func (m command) run(c *cli.Context, cfg *config) error {
return fmt.Errorf("failed to load container state: %v", err)
}
spec, err := s.LoadSpec()
containerRoot, err := s.GetContainerRoot()
if err != nil {
return fmt.Errorf("failed to load OCI spec: %v", err)
}
var containerRoot string
if spec.Root != nil {
containerRoot = spec.Root.Path
return fmt.Errorf("failed to determined container root: %v", err)
}
err = m.createConfig(containerRoot, cfg.folders.Value())