mirror of
https://github.com/containers/skopeo.git
synced 2025-06-26 14:52:36 +00:00
Migrate --dest-ostree-tmp-dir to imageDestOptions
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
parent
88c748f47a
commit
72a3dc17ee
@ -84,11 +84,6 @@ func copyCmd(global *globalOptions) cli.Command {
|
|||||||
Usage: "Sign the image using a GPG key with the specified `FINGERPRINT`",
|
Usage: "Sign the image using a GPG key with the specified `FINGERPRINT`",
|
||||||
Destination: &opts.signByFingerprint,
|
Destination: &opts.signByFingerprint,
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
|
||||||
Name: "dest-ostree-tmp-dir",
|
|
||||||
Value: "",
|
|
||||||
Usage: "`DIRECTORY` to use for OSTree temporary files",
|
|
||||||
},
|
|
||||||
cli.GenericFlag{
|
cli.GenericFlag{
|
||||||
Name: "format, f",
|
Name: "format, f",
|
||||||
Usage: "`MANIFEST TYPE` (oci, v2s1, or v2s2) to use when saving image to directory using the 'dir:' transport (default is manifest type of source)",
|
Usage: "`MANIFEST TYPE` (oci, v2s1, or v2s2) to use when saving image to directory using the 'dir:' transport (default is manifest type of source)",
|
||||||
|
@ -65,13 +65,14 @@ func imageFlags(global *globalOptions, flagPrefix, credsOptionAlias string) ([]c
|
|||||||
}, &opts
|
}, &opts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// contextFromImageOptions returns a *types.SystemContext corresponding to opts.
|
||||||
|
// It is guaranteed to return a fresh instance, so it is safe to make additional updates to it.
|
||||||
func contextFromImageOptions(c *cli.Context, opts *imageOptions) (*types.SystemContext, error) {
|
func contextFromImageOptions(c *cli.Context, opts *imageOptions) (*types.SystemContext, error) {
|
||||||
ctx := &types.SystemContext{
|
ctx := &types.SystemContext{
|
||||||
RegistriesDirPath: opts.global.registriesDirPath,
|
RegistriesDirPath: opts.global.registriesDirPath,
|
||||||
ArchitectureChoice: opts.global.overrideArch,
|
ArchitectureChoice: opts.global.overrideArch,
|
||||||
OSChoice: opts.global.overrideOS,
|
OSChoice: opts.global.overrideOS,
|
||||||
DockerCertPath: opts.dockerCertPath,
|
DockerCertPath: opts.dockerCertPath,
|
||||||
OSTreeTmpDirPath: c.String(opts.flagPrefix + "ostree-tmp-dir"),
|
|
||||||
OCISharedBlobDirPath: opts.sharedBlobDir,
|
OCISharedBlobDirPath: opts.sharedBlobDir,
|
||||||
DirForceCompress: c.Bool(opts.flagPrefix + "compress"),
|
DirForceCompress: c.Bool(opts.flagPrefix + "compress"),
|
||||||
AuthFilePath: c.String("authfile"),
|
AuthFilePath: c.String("authfile"),
|
||||||
@ -101,6 +102,7 @@ func contextFromImageOptions(c *cli.Context, opts *imageOptions) (*types.SystemC
|
|||||||
// imageDestOptions is a superset of imageOptions specialized for iamge destinations.
|
// imageDestOptions is a superset of imageOptions specialized for iamge destinations.
|
||||||
type imageDestOptions struct {
|
type imageDestOptions struct {
|
||||||
*imageOptions
|
*imageOptions
|
||||||
|
osTreeTmpDir string // A directory to use for OSTree temporary files
|
||||||
}
|
}
|
||||||
|
|
||||||
// imageDestFlags prepares a collection of CLI flags writing into imageDestOptions, and the managed imageDestOptions structure.
|
// imageDestFlags prepares a collection of CLI flags writing into imageDestOptions, and the managed imageDestOptions structure.
|
||||||
@ -108,15 +110,24 @@ func imageDestFlags(global *globalOptions, flagPrefix, credsOptionAlias string)
|
|||||||
genericFlags, genericOptions := imageFlags(global, flagPrefix, credsOptionAlias)
|
genericFlags, genericOptions := imageFlags(global, flagPrefix, credsOptionAlias)
|
||||||
opts := imageDestOptions{imageOptions: genericOptions}
|
opts := imageDestOptions{imageOptions: genericOptions}
|
||||||
|
|
||||||
return append(genericFlags, []cli.Flag{}...), &opts
|
return append(genericFlags, []cli.Flag{
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: flagPrefix + "ostree-tmp-dir",
|
||||||
|
Usage: "`DIRECTORY` to use for OSTree temporary files",
|
||||||
|
Destination: &opts.osTreeTmpDir,
|
||||||
|
},
|
||||||
|
}...), &opts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// contextFromImageDestOptions returns a *types.SystemContext corresponding to opts.
|
||||||
|
// It is guaranteed to return a fresh instance, so it is safe to make additional updates to it.
|
||||||
func contextFromImageDestOptions(c *cli.Context, opts *imageDestOptions) (*types.SystemContext, error) {
|
func contextFromImageDestOptions(c *cli.Context, opts *imageDestOptions) (*types.SystemContext, error) {
|
||||||
ctx, err := contextFromImageOptions(c, opts.imageOptions)
|
ctx, err := contextFromImageOptions(c, opts.imageOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.OSTreeTmpDirPath = opts.osTreeTmpDir
|
||||||
return ctx, err
|
return ctx, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,6 @@ func TestContextFromImageOptions(t *testing.T) {
|
|||||||
}, []string{
|
}, []string{
|
||||||
"--authfile", "/srv/authfile",
|
"--authfile", "/srv/authfile",
|
||||||
"--dest-cert-dir", "/srv/cert-dir",
|
"--dest-cert-dir", "/srv/cert-dir",
|
||||||
"--dest-ostree-tmp-dir", "/srv/ostree-tmp-dir",
|
|
||||||
"--dest-shared-blob-dir", "/srv/shared-blob-dir",
|
"--dest-shared-blob-dir", "/srv/shared-blob-dir",
|
||||||
"--dest-compress=true",
|
"--dest-compress=true",
|
||||||
"--dest-daemon-host", "daemon-host.example.com",
|
"--dest-daemon-host", "daemon-host.example.com",
|
||||||
@ -105,7 +104,6 @@ func TestContextFromImageOptions(t *testing.T) {
|
|||||||
DockerCertPath: "/srv/cert-dir",
|
DockerCertPath: "/srv/cert-dir",
|
||||||
DockerInsecureSkipTLSVerify: types.OptionalBoolTrue,
|
DockerInsecureSkipTLSVerify: types.OptionalBoolTrue,
|
||||||
DockerAuthConfig: &types.DockerAuthConfig{Username: "creds-user", Password: "creds-password"},
|
DockerAuthConfig: &types.DockerAuthConfig{Username: "creds-user", Password: "creds-password"},
|
||||||
OSTreeTmpDirPath: "/srv/ostree-tmp-dir",
|
|
||||||
DockerDaemonCertPath: "/srv/cert-dir",
|
DockerDaemonCertPath: "/srv/cert-dir",
|
||||||
DockerDaemonHost: "daemon-host.example.com",
|
DockerDaemonHost: "daemon-host.example.com",
|
||||||
DockerDaemonInsecureSkipTLSVerify: true,
|
DockerDaemonInsecureSkipTLSVerify: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user