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

Commit e9a49f8

Browse files
Merge pull request #73 from r2d4/remove-hack
Remove fake sourceCtx
2 parents 9714f8f + 3b36884 commit e9a49f8

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

utils/image_prep_utils.go

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030

3131
"github.com/containers/image/docker"
3232
"github.com/containers/image/docker/tarfile"
33-
"github.com/containers/image/types"
3433
"github.com/docker/docker/client"
3534

3635
"github.com/golang/glog"
@@ -134,23 +133,14 @@ func (p CloudPrepper) getFileSystem() (string, error) {
134133
return "", err
135134
}
136135

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

153-
imgSrc, err := ref.NewImageSource(ctx, nil)
143+
imgSrc, err := ref.NewImageSource(nil, nil)
154144
if err != nil {
155145
glog.Error(err)
156146
return "", err
@@ -184,16 +174,7 @@ func (p CloudPrepper) getConfig() (ConfigSchema, error) {
184174
return ConfigSchema{}, err
185175
}
186176

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

0 commit comments

Comments
 (0)