Skip to content

Commit 49c51ce

Browse files
committed
Skip snapshotter root path creation for standalone convert mode
Signed-off-by: Praful Gupta <prafulgupta6@gmail.com>
1 parent dc2ed58 commit 49c51ce

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

cmd/soci/commands/convert.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
)
3636

3737
const (
38-
standaloneFlag = "standalone"
38+
StandaloneFlag = "standalone"
3939
outputFormatFlag = "format"
4040

4141
outputFormatOCIArchive = "oci-archive"
@@ -81,7 +81,7 @@ var ConvertCommand = &cli.Command{
8181
internal.PrefetchFlags,
8282
[]cli.Flag{
8383
&cli.BoolFlag{
84-
Name: standaloneFlag,
84+
Name: StandaloneFlag,
8585
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.",
8686
},
8787
&cli.StringFlag{
@@ -107,7 +107,7 @@ var ConvertCommand = &cli.Command{
107107
return errors.New("destination needs to be specified")
108108
}
109109

110-
if cmd.Bool(standaloneFlag) {
110+
if cmd.Bool(StandaloneFlag) {
111111
return runStandaloneConvert(ctx, cmd, src, dst)
112112
}
113113

cmd/soci/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ func main() {
6262
commands.RebuildDBCommand,
6363
},
6464
Before: func(ctx context.Context, cmd *cli.Command) (context.Context, error) {
65+
// Standalone convert doesn't need the snapshotter root path.
66+
if cmd.Command(commands.ConvertCommand.Name).Bool(commands.StandaloneFlag) {
67+
return ctx, nil
68+
}
6569
return ctx, soci.EnsureSnapshotterRootPath(cmd.String(global.RootFlag))
6670
},
6771
}

0 commit comments

Comments
 (0)