diff --git a/cmd/soci/commands/convert.go b/cmd/soci/commands/convert.go index 01c1a0a2d..f6537a385 100644 --- a/cmd/soci/commands/convert.go +++ b/cmd/soci/commands/convert.go @@ -35,7 +35,7 @@ import ( ) const ( - standaloneFlag = "standalone" + StandaloneFlag = "standalone" outputFormatFlag = "format" outputFormatOCIArchive = "oci-archive" @@ -81,7 +81,7 @@ var ConvertCommand = &cli.Command{ internal.PrefetchFlags, []cli.Flag{ &cli.BoolFlag{ - Name: standaloneFlag, + Name: StandaloneFlag, Usage: "Run in standalone mode without containerd runtime. In this mode, the command reads an OCI image layout (tar or directory) and writes a converted OCI image layout without requiring a running containerd instance.", }, &cli.StringFlag{ @@ -107,7 +107,7 @@ var ConvertCommand = &cli.Command{ return errors.New("destination needs to be specified") } - if cmd.Bool(standaloneFlag) { + if cmd.Bool(StandaloneFlag) { return runStandaloneConvert(ctx, cmd, src, dst) } diff --git a/cmd/soci/main.go b/cmd/soci/main.go index daaf0d840..185e11183 100644 --- a/cmd/soci/main.go +++ b/cmd/soci/main.go @@ -62,6 +62,10 @@ func main() { commands.RebuildDBCommand, }, Before: func(ctx context.Context, cmd *cli.Command) (context.Context, error) { + // Standalone convert doesn't need the snapshotter root path. + if cmd.Command(commands.ConvertCommand.Name).Bool(commands.StandaloneFlag) { + return ctx, nil + } return ctx, soci.EnsureSnapshotterRootPath(cmd.String(global.RootFlag)) }, }