Fix generation of default config

This change ensures that the nvidia-ctk config default command
generates a config file that is compatible with the official documentation
to, for example, disable cgroups in the NVIDIA Container CLI.

This requires that whitespace around comments is stripped before outputing the
contets.

This also adds an option to load a config and modify it in-place instead. This can
be triggered as a post-install step, for example.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2023-06-30 12:47:19 +02:00
parent ba24338122
commit 65ae6f1dab
6 changed files with 217 additions and 35 deletions

View File

@@ -192,7 +192,7 @@ func TestGetConfig(t *testing.T) {
t.Run(tc.description, func(t *testing.T) {
reader := strings.NewReader(strings.Join(tc.contents, "\n"))
cfg, err := loadConfigFrom(reader)
cfg, err := LoadFrom(reader)
if tc.expectedError != nil {
require.Error(t, err)
} else {