diff options
author | baude <bbaude@redhat.com> | 2018-03-08 15:45:52 -0600 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-03-14 20:21:31 +0000 |
commit | b85b217f55993955da9ad0cae7735747b2f24390 (patch) | |
tree | 3e633600e50bf3bedc9bdc59abe789fa01f55601 /libpod/image/docker_registry_options.go | |
parent | bc358eb396aa87f3122f0449945efc03ed64bfd2 (diff) | |
download | podman-b85b217f55993955da9ad0cae7735747b2f24390.tar.gz podman-b85b217f55993955da9ad0cae7735747b2f24390.tar.bz2 podman-b85b217f55993955da9ad0cae7735747b2f24390.zip |
Stage3 Image Library
This represents the stage3 implementation for the image library. At this point, we
are moving the image-centric functions to pkg/image including migration of args and
object-oriented references. This is a not a one-for-one migration of funcs and some
funcs will need to continue to reside in runtime_img as they are overly specific to
libpod and probably not useful to others.
Signed-off-by: baude <bbaude@redhat.com>
Closes: #484
Approved by: baude
Diffstat (limited to 'libpod/image/docker_registry_options.go')
-rw-r--r-- | libpod/image/docker_registry_options.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/libpod/image/docker_registry_options.go b/libpod/image/docker_registry_options.go new file mode 100644 index 000000000..bbb49df28 --- /dev/null +++ b/libpod/image/docker_registry_options.go @@ -0,0 +1,46 @@ +package image + +import "github.com/containers/image/types" + +// DockerRegistryOptions encapsulates settings that affect how we connect or +// authenticate to a remote registry. +type DockerRegistryOptions struct { + // DockerRegistryCreds is the user name and password to supply in case + // we need to pull an image from a registry, and it requires us to + // authenticate. + DockerRegistryCreds *types.DockerAuthConfig + // DockerCertPath is the location of a directory containing CA + // certificates which will be used to verify the registry's certificate + // (all files with names ending in ".crt"), and possibly client + // certificates and private keys (pairs of files with the same name, + // except for ".cert" and ".key" suffixes). + DockerCertPath string + // DockerInsecureSkipTLSVerify turns off verification of TLS + // certificates and allows connecting to registries without encryption. + DockerInsecureSkipTLSVerify bool +} + +// GetSystemContext constructs a new system context from the given signaturePolicy path and the +// values in the DockerRegistryOptions +func (o DockerRegistryOptions) GetSystemContext(signaturePolicyPath, authFile string, forceCompress bool) *types.SystemContext { + sc := &types.SystemContext{ + SignaturePolicyPath: signaturePolicyPath, + DockerAuthConfig: o.DockerRegistryCreds, + DockerCertPath: o.DockerCertPath, + DockerInsecureSkipTLSVerify: o.DockerInsecureSkipTLSVerify, + AuthFilePath: authFile, + DirForceCompress: forceCompress, + } + return sc +} + +// GetSystemContext Constructs a new containers/image/types.SystemContext{} struct from the given signaturePolicy path +func GetSystemContext(signaturePolicyPath, authFilePath string, forceCompress bool) *types.SystemContext { + sc := &types.SystemContext{} + if signaturePolicyPath != "" { + sc.SignaturePolicyPath = signaturePolicyPath + } + sc.AuthFilePath = authFilePath + sc.DirForceCompress = forceCompress + return sc +} |