Migrate --*daemon-host to imageOptions

This was previously only supported in (skopeo copy).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač
2018-07-07 05:34:26 +02:00
parent 694f915003
commit 7e8c89d619
2 changed files with 13 additions and 17 deletions

View File

@@ -98,16 +98,6 @@ func copyCmd(global *globalOptions) cli.Command {
Name: "dest-compress", Name: "dest-compress",
Usage: "Compress tarball image layers when saving to directory using the 'dir' transport. (default is same compression type as source)", Usage: "Compress tarball image layers when saving to directory using the 'dir' transport. (default is same compression type as source)",
}, },
cli.StringFlag{
Name: "src-daemon-host",
Value: "",
Usage: "use docker daemon host at `HOST` (docker-daemon sources only)",
},
cli.StringFlag{
Name: "dest-daemon-host",
Value: "",
Usage: "use docker daemon host at `HOST` (docker-daemon destinations only)",
},
}, srcFlags...), destFlags...), }, srcFlags...), destFlags...),
} }
} }

View File

@@ -13,12 +13,13 @@ import (
// imageOptions collects CLI flags which are the same across subcommands, but may be different for each image // imageOptions collects CLI flags which are the same across subcommands, but may be different for each image
// (e.g. may differ between the source and destination of a copy) // (e.g. may differ between the source and destination of a copy)
type imageOptions struct { type imageOptions struct {
global *globalOptions // May be shared across several imageOptions instances. global *globalOptions // May be shared across several imageOptions instances.
flagPrefix string // FIXME: Drop this eventually. flagPrefix string // FIXME: Drop this eventually.
credsOption optionalString // username[:password] for accessing a registry credsOption optionalString // username[:password] for accessing a registry
dockerCertPath string // A directory using Docker-like *.{crt,cert,key} files for connecting to a registry or a daemon dockerCertPath string // A directory using Docker-like *.{crt,cert,key} files for connecting to a registry or a daemon
tlsVerify optionalBool // Require HTTPS and verify certificates (for docker: and docker-daemon:) tlsVerify optionalBool // Require HTTPS and verify certificates (for docker: and docker-daemon:)
sharedBlobDir string // A directory to use for OCI blobs, shared across repositories sharedBlobDir string // A directory to use for OCI blobs, shared across repositories
dockerDaemonHost string // docker-daemon: host to connect to
} }
// imageFlags prepares a collection of CLI flags writing into imageOptions, and the managed imageOptions structure. // imageFlags prepares a collection of CLI flags writing into imageOptions, and the managed imageOptions structure.
@@ -56,6 +57,11 @@ func imageFlags(global *globalOptions, flagPrefix, credsOptionAlias string) ([]c
Usage: "`DIRECTORY` to use to share blobs across OCI repositories", Usage: "`DIRECTORY` to use to share blobs across OCI repositories",
Destination: &opts.sharedBlobDir, Destination: &opts.sharedBlobDir,
}, },
cli.StringFlag{
Name: flagPrefix + "daemon-host",
Usage: "use docker daemon host at `HOST` (docker-daemon: only)",
Destination: &opts.dockerDaemonHost,
},
}, &opts }, &opts
} }
@@ -69,7 +75,7 @@ func contextFromImageOptions(c *cli.Context, opts *imageOptions) (*types.SystemC
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"),
DockerDaemonHost: c.String(opts.flagPrefix + "daemon-host"), DockerDaemonHost: opts.dockerDaemonHost,
DockerDaemonCertPath: opts.dockerCertPath, DockerDaemonCertPath: opts.dockerCertPath,
} }
if opts.tlsVerify.present { if opts.tlsVerify.present {