mirror of
https://github.com/containers/podman.git
synced 2026-03-13 08:01:19 +08:00
Make ocipull.Pull and PullOptions private
There are no external users, so make that clearer. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
@@ -39,7 +39,7 @@ type OCIArtifactDisk struct {
|
||||
imageEndpoint string
|
||||
machineVersion *OSVersion
|
||||
diskArtifactFileName string
|
||||
pullOptions *PullOptions
|
||||
pullOptions *pullOptions
|
||||
vmType define.VMType
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ func NewOCIArtifactPull(ctx context.Context, dirs *define.MachineDirs, endpoint
|
||||
imageEndpoint: endpoint,
|
||||
machineVersion: artifactVersion,
|
||||
name: vmName,
|
||||
pullOptions: &PullOptions{
|
||||
SkipTLSVerify: skipTlsVerify,
|
||||
pullOptions: &pullOptions{
|
||||
skipTLSVerify: skipTlsVerify,
|
||||
},
|
||||
vmType: vmType,
|
||||
}
|
||||
@@ -230,7 +230,7 @@ func (o *OCIArtifactDisk) getDestArtifact() (types.ImageReference, digest.Digest
|
||||
}
|
||||
fmt.Printf("Looking up Podman Machine image at %s to create VM\n", imgRef.DockerReference())
|
||||
sysCtx := &types.SystemContext{
|
||||
DockerInsecureSkipTLSVerify: o.pullOptions.SkipTLSVerify,
|
||||
DockerInsecureSkipTLSVerify: o.pullOptions.skipTLSVerify,
|
||||
}
|
||||
imgSrc, err := imgRef.NewImageSource(o.ctx, sysCtx)
|
||||
if err != nil {
|
||||
@@ -274,7 +274,7 @@ func (o *OCIArtifactDisk) pull(destRef types.ImageReference, artifactDigest dige
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return Pull(o.ctx, destRef, destFile, o.pullOptions)
|
||||
return pull(o.ctx, destRef, destFile, o.pullOptions)
|
||||
}
|
||||
|
||||
func (o *OCIArtifactDisk) unpack(diskArtifactHash digest.Digest) error {
|
||||
|
||||
@@ -16,23 +16,23 @@ import (
|
||||
"go.podman.io/image/v5/types"
|
||||
)
|
||||
|
||||
// PullOptions includes data to alter certain knobs when pulling a source
|
||||
// pullOptions includes data to alter certain knobs when pulling a source
|
||||
// image.
|
||||
type PullOptions struct {
|
||||
type pullOptions struct {
|
||||
// Skip TLS verification when accessing the registry.
|
||||
SkipTLSVerify types.OptionalBool
|
||||
skipTLSVerify types.OptionalBool
|
||||
// [username[:password] to use when connecting to the registry.
|
||||
Credentials string
|
||||
credentials string
|
||||
// Quiet the progress bars when pushing.
|
||||
Quiet bool
|
||||
quiet bool
|
||||
}
|
||||
|
||||
// noSignaturePolicy is a default policy if policy.json is not found on
|
||||
// the host machine.
|
||||
var noSignaturePolicy string = `{"default":[{"type":"insecureAcceptAnything"}]}`
|
||||
|
||||
// Pull `imageInput` from a container registry to `sourcePath`.
|
||||
func Pull(ctx context.Context, imageInput types.ImageReference, localDestPath *define.VMFile, options *PullOptions) error {
|
||||
// pull `imageInput` from a container registry to `sourcePath`.
|
||||
func pull(ctx context.Context, imageInput types.ImageReference, localDestPath *define.VMFile, options *pullOptions) error {
|
||||
var policy *signature.Policy
|
||||
destRef, err := layout.ParseReference(localDestPath.GetPath())
|
||||
if err != nil {
|
||||
@@ -40,10 +40,10 @@ func Pull(ctx context.Context, imageInput types.ImageReference, localDestPath *d
|
||||
}
|
||||
|
||||
sysCtx := &types.SystemContext{
|
||||
DockerInsecureSkipTLSVerify: options.SkipTLSVerify,
|
||||
DockerInsecureSkipTLSVerify: options.skipTLSVerify,
|
||||
}
|
||||
if options.Credentials != "" {
|
||||
authConf, err := parse.AuthConfig(options.Credentials)
|
||||
if options.credentials != "" {
|
||||
authConf, err := parse.AuthConfig(options.credentials)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -80,7 +80,7 @@ func Pull(ctx context.Context, imageInput types.ImageReference, localDestPath *d
|
||||
copyOpts := copy.Options{
|
||||
SourceCtx: sysCtx,
|
||||
}
|
||||
if !options.Quiet {
|
||||
if !options.quiet {
|
||||
copyOpts.ReportWriter = os.Stderr
|
||||
}
|
||||
if _, err := copy.Image(ctx, policyContext, destRef, imageInput, ©Opts); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user