fixes for not needed fields in output

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-01-20 18:19:36 +01:00
parent f7ebea6972
commit 74a06ac414
3 changed files with 13 additions and 20 deletions

View File

@ -7,7 +7,6 @@ import (
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
"github.com/docker/distribution/digest"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/image" "github.com/docker/docker/image"
"github.com/docker/docker/opts" "github.com/docker/docker/opts"
@ -40,11 +39,9 @@ type manifestFetcher interface {
} }
type imageInspect struct { type imageInspect struct {
V1ID string `json:"V1Id"`
Tag string Tag string
RepoTags []string RepoTags []string
RepoDigests []string //RepoDigests []string
Parent string
Comment string Comment string
Created string Created string
Container string Container string
@ -247,18 +244,11 @@ func validateRepoName(name string) error {
return nil return nil
} }
func makeImageInspect(repoInfo *registry.RepositoryInfo, img *image.Image, tag string, tagList []string, dgst digest.Digest) *imageInspect { func makeImageInspect(img *image.Image, index, tag string, tagList []string) *imageInspect {
var repoDigests = make([]string, 0, 1)
if err := dgst.Validate(); err == nil {
repoDigests = append(repoDigests, dgst.String())
}
return &imageInspect{ return &imageInspect{
V1ID: img.V1Image.ID,
Tag: tag, Tag: tag,
RepoTags: tagList, RepoTags: tagList,
RepoDigests: repoDigests, //RepoDigests: repoDigests,
Parent: img.Parent.String(),
Comment: img.Comment, Comment: img.Comment,
Created: img.Created.Format(time.RFC3339Nano), Created: img.Created.Format(time.RFC3339Nano),
Container: img.Container, Container: img.Container,
@ -269,7 +259,7 @@ func makeImageInspect(repoInfo *registry.RepositoryInfo, img *image.Image, tag s
Architecture: img.Architecture, Architecture: img.Architecture,
Os: img.OS, Os: img.OS,
Size: img.Size, Size: img.Size,
Registry: repoInfo.Index.Name, Registry: index,
} }
} }

View File

@ -145,7 +145,7 @@ func (mf *v1ManifestFetcher) fetchWithSession(ctx context.Context, askedTag stri
return nil, fmt.Errorf("No such image %s:%s", mf.repoInfo.FullName(), askedTag) return nil, fmt.Errorf("No such image %s:%s", mf.repoInfo.FullName(), askedTag)
} }
return makeImageInspect(mf.repoInfo, pulledImg, askedTag, tagList, ""), nil return makeImageInspect(pulledImg, mf.repoInfo.Index.Name, askedTag, tagList), nil
} }
func (mf *v1ManifestFetcher) pullImageJSON(imgID, endpoint string, token []string) (*image.Image, error) { func (mf *v1ManifestFetcher) pullImageJSON(imgID, endpoint string, token []string) (*image.Image, error) {

View File

@ -146,7 +146,10 @@ func (mf *v2ManifestFetcher) fetchWithRepository(ctx context.Context, ref refere
return nil, errors.New("unsupported manifest format") return nil, errors.New("unsupported manifest format")
} }
return makeImageInspect(mf.repoInfo, image, tag, tagList, manifestDigest), nil // TODO(runcom): why show manifest digest from remote?
_ = manifestDigest
return makeImageInspect(image, mf.repoInfo.Index.Name, tag, tagList), nil
} }
func (mf *v2ManifestFetcher) pullSchema1(ctx context.Context, ref reference.Named, unverifiedManifest *schema1.SignedManifest) (img *image.Image, manifestDigest digest.Digest, err error) { func (mf *v2ManifestFetcher) pullSchema1(ctx context.Context, ref reference.Named, unverifiedManifest *schema1.SignedManifest) (img *image.Image, manifestDigest digest.Digest, err error) {