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

Commit 95c25f9

Browse files
committed
remove docker client dependency for local images. fix tar extension check
1 parent 46ffad9 commit 95c25f9

File tree

6 files changed

+409
-16
lines changed

6 files changed

+409
-16
lines changed

Godeps/Godeps.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/util/daemon_prepper.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ package util
1818

1919
import (
2020
"context"
21-
"os"
2221
"regexp"
2322

23+
"github.com/containers/image/docker/daemon"
2424
"github.com/golang/glog"
2525
)
2626

@@ -45,29 +45,19 @@ func (p DaemonPrepper) SupportsImage() bool {
4545
}
4646

4747
func (p DaemonPrepper) GetFileSystem() (string, error) {
48-
tarPath, err := saveImageToTar(p.Client, p.Source, p.Source)
48+
ref, err := daemon.ParseReference(p.Source)
4949
if err != nil {
5050
return "", err
5151
}
52-
53-
defer os.Remove(tarPath)
54-
return getImageFromTar(tarPath)
52+
return getFileSystemFromReference(ref, p.Source)
5553
}
5654

5755
func (p DaemonPrepper) GetConfig() (ConfigSchema, error) {
58-
inspect, _, err := p.Client.ImageInspectWithRaw(context.Background(), p.Source)
56+
ref, err := daemon.ParseReference(p.Source)
5957
if err != nil {
6058
return ConfigSchema{}, err
6159
}
62-
63-
config := ConfigObject{
64-
Env: inspect.Config.Env,
65-
}
66-
history := p.GetHistory()
67-
return ConfigSchema{
68-
Config: config,
69-
History: history,
70-
}, nil
60+
return getConfigFromReference(ref, p.Source)
7161
}
7262

7363
func (p DaemonPrepper) GetHistory() []ImageHistoryItem {

pkg/util/tar_utils.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ func UnTar(filename string, target string) error {
106106
}
107107

108108
func IsTar(path string) bool {
109-
return filepath.Ext(path) == ".tar"
109+
return filepath.Ext(path) == ".tar" ||
110+
filepath.Ext(path) == ".tar.gz" ||
111+
filepath.Ext(path) == ".tgz"
110112
}
111113

112114
func CheckTar(image string) bool {

vendor/github.com/containers/image/docker/daemon/daemon_dest.go

Lines changed: 128 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/containers/image/docker/daemon/daemon_src.go

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)