"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/github.com/containers/common/libimage/image.go" between
podman-3.2.2.tar.gz and podman-3.2.3.tar.gz

About: podman (previous name "libpod") provides a library for applications looking to use the Container Pod concept, popularized by Kubernetes. Podman manages pods, containers, container images, and container volumes.

image.go  (podman-3.2.2):image.go  (podman-3.2.3)
skipping to change at line 301 skipping to change at line 301
// should be the *only* place to extend the removal logic so we keep it // should be the *only* place to extend the removal logic so we keep it
// sealed in one place. Make sure to add verbose comments to leave // sealed in one place. Make sure to add verbose comments to leave
// some breadcrumbs for future readers. // some breadcrumbs for future readers.
logrus.Debugf("Removing image %s", i.ID()) logrus.Debugf("Removing image %s", i.ID())
if i.IsReadOnly() { if i.IsReadOnly() {
return errors.Errorf("cannot remove read-only image %q", i.ID()) return errors.Errorf("cannot remove read-only image %q", i.ID())
} }
if i.runtime.eventChannel != nil { if i.runtime.eventChannel != nil {
i.runtime.writeEvent(&Event{ID: i.ID(), Name: referencedBy, Time: time.Now(), Type: EventTypeImageRemove}) defer i.runtime.writeEvent(&Event{ID: i.ID(), Name: referencedBy, Time: time.Now(), Type: EventTypeImageRemove})
} }
// Check if already visisted this image. // Check if already visisted this image.
report, exists := rmMap[i.ID()] report, exists := rmMap[i.ID()]
if exists { if exists {
// If the image has already been removed, we're done. // If the image has already been removed, we're done.
if report.Removed { if report.Removed {
return nil return nil
} }
} else { } else {
skipping to change at line 453 skipping to change at line 453
// Tag the image with the specified name and store it in the local containers // Tag the image with the specified name and store it in the local containers
// storage. The name is normalized according to the rules of NormalizeName. // storage. The name is normalized according to the rules of NormalizeName.
func (i *Image) Tag(name string) error { func (i *Image) Tag(name string) error {
ref, err := NormalizeName(name) ref, err := NormalizeName(name)
if err != nil { if err != nil {
return errors.Wrapf(err, "error normalizing name %q", name) return errors.Wrapf(err, "error normalizing name %q", name)
} }
logrus.Debugf("Tagging image %s with %q", i.ID(), ref.String()) logrus.Debugf("Tagging image %s with %q", i.ID(), ref.String())
if i.runtime.eventChannel != nil { if i.runtime.eventChannel != nil {
i.runtime.writeEvent(&Event{ID: i.ID(), Name: name, Time: time.No w(), Type: EventTypeImageTag}) defer i.runtime.writeEvent(&Event{ID: i.ID(), Name: name, Time: t ime.Now(), Type: EventTypeImageTag})
} }
newNames := append(i.Names(), ref.String()) newNames := append(i.Names(), ref.String())
if err := i.runtime.store.SetNames(i.ID(), newNames); err != nil { if err := i.runtime.store.SetNames(i.ID(), newNames); err != nil {
return err return err
} }
return i.reload() return i.reload()
} }
skipping to change at line 487 skipping to change at line 487
} }
ref, err := NormalizeName(name) ref, err := NormalizeName(name)
if err != nil { if err != nil {
return errors.Wrapf(err, "error normalizing name %q", name) return errors.Wrapf(err, "error normalizing name %q", name)
} }
name = ref.String() name = ref.String()
logrus.Debugf("Untagging %q from image %s", ref.String(), i.ID()) logrus.Debugf("Untagging %q from image %s", ref.String(), i.ID())
if i.runtime.eventChannel != nil { if i.runtime.eventChannel != nil {
i.runtime.writeEvent(&Event{ID: i.ID(), Name: name, Time: time.No w(), Type: EventTypeImageUntag}) defer i.runtime.writeEvent(&Event{ID: i.ID(), Name: name, Time: t ime.Now(), Type: EventTypeImageUntag})
} }
removedName := false removedName := false
newNames := []string{} newNames := []string{}
for _, n := range i.Names() { for _, n := range i.Names() {
if n == name { if n == name {
removedName = true removedName = true
continue continue
} }
newNames = append(newNames, n) newNames = append(newNames, n)
skipping to change at line 629 skipping to change at line 629
} }
sort.Strings(repoDigests) sort.Strings(repoDigests)
return repoDigests, nil return repoDigests, nil
} }
// Mount the image with the specified mount options and label, both of which // Mount the image with the specified mount options and label, both of which
// are directly passed down to the containers storage. Returns the fully // are directly passed down to the containers storage. Returns the fully
// evaluated path to the mount point. // evaluated path to the mount point.
func (i *Image) Mount(ctx context.Context, mountOptions []string, mountLabel str ing) (string, error) { func (i *Image) Mount(ctx context.Context, mountOptions []string, mountLabel str ing) (string, error) {
if i.runtime.eventChannel != nil { if i.runtime.eventChannel != nil {
i.runtime.writeEvent(&Event{ID: i.ID(), Name: "", Time: time.Now( ), Type: EventTypeImageMount}) defer i.runtime.writeEvent(&Event{ID: i.ID(), Name: "", Time: tim e.Now(), Type: EventTypeImageMount})
} }
mountPoint, err := i.runtime.store.MountImage(i.ID(), mountOptions, mount Label) mountPoint, err := i.runtime.store.MountImage(i.ID(), mountOptions, mount Label)
if err != nil { if err != nil {
return "", err return "", err
} }
mountPoint, err = filepath.EvalSymlinks(mountPoint) mountPoint, err = filepath.EvalSymlinks(mountPoint)
if err != nil { if err != nil {
return "", err return "", err
} }
skipping to change at line 674 skipping to change at line 674
return "", err return "", err
} }
return mountPoint, nil return mountPoint, nil
} }
// Unmount the image. Use force to ignore the reference counter and forcefully // Unmount the image. Use force to ignore the reference counter and forcefully
// unmount. // unmount.
func (i *Image) Unmount(force bool) error { func (i *Image) Unmount(force bool) error {
if i.runtime.eventChannel != nil { if i.runtime.eventChannel != nil {
i.runtime.writeEvent(&Event{ID: i.ID(), Name: "", Time: time.Now( ), Type: EventTypeImageUnmount}) defer i.runtime.writeEvent(&Event{ID: i.ID(), Name: "", Time: tim e.Now(), Type: EventTypeImageUnmount})
} }
logrus.Debugf("Unmounted image %s", i.ID()) logrus.Debugf("Unmounted image %s", i.ID())
_, err := i.runtime.store.UnmountImage(i.ID(), force) _, err := i.runtime.store.UnmountImage(i.ID(), force)
return err return err
} }
// MountPoint returns the fully-evaluated mount point of the image. If the // MountPoint returns the fully-evaluated mount point of the image. If the
// image isn't mounted, an empty string is returned. // image isn't mounted, an empty string is returned.
func (i *Image) MountPoint() (string, error) { func (i *Image) MountPoint() (string, error) {
counter, err := i.runtime.store.Mounted(i.TopLayer()) counter, err := i.runtime.store.Mounted(i.TopLayer())
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)