Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Remove fake sourceCtx #73

Merged
merged 1 commit into from
Sep 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 3 additions & 22 deletions utils/image_prep_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (

"github.com/containers/image/docker"
"github.com/containers/image/docker/tarfile"
"github.com/containers/image/types"
"github.com/docker/docker/client"

"github.com/golang/glog"
Expand Down Expand Up @@ -134,23 +133,14 @@ func (p CloudPrepper) getFileSystem() (string, error) {
return "", err
}

// By default, the image library will try to look at /etc/docker/certs.d
// As a non-root user, this would result in a permissions error, so we avoid this
// by looking in a temporary directory we create in the container-diff home directory
cwd, _ := os.Getwd()
tmpCerts, _ := ioutil.TempDir(cwd, "certs")
defer os.RemoveAll(tmpCerts)
ctx := &types.SystemContext{
DockerCertPath: tmpCerts,
}
img, err := ref.NewImage(ctx)
img, err := ref.NewImage(nil)
if err != nil {
glog.Error(err)
return "", err
}
defer img.Close()

imgSrc, err := ref.NewImageSource(ctx, nil)
imgSrc, err := ref.NewImageSource(nil, nil)
if err != nil {
glog.Error(err)
return "", err
Expand Down Expand Up @@ -184,16 +174,7 @@ func (p CloudPrepper) getConfig() (ConfigSchema, error) {
return ConfigSchema{}, err
}

// By default, the image library will try to look at /etc/docker/certs.d
// As a non-root user, this would result in a permissions error, so we avoid this
// by looking in a temporary directory we create in the container-diff home directory
cwd, _ := os.Getwd()
tmpCerts, _ := ioutil.TempDir(cwd, "certs")
defer os.RemoveAll(tmpCerts)
ctx := &types.SystemContext{
DockerCertPath: tmpCerts,
}
img, err := ref.NewImage(ctx)
img, err := ref.NewImage(nil)
if err != nil {
glog.Errorf("Error referencing image %s from registry: %s", p.Source, err)
return ConfigSchema{}, errors.New("Could not obtain image config")
Expand Down