func (pl *ProfileLoader) handleContainerExited(event *model.ContainerEvent) error {
	// select container
	container, ok := pl.RunningContainers[event.ContainerID]
	if !ok {
		// Nothing to delete
		return nil
	}
	// select profile
	profile, ok := pl.LoadedProfiles[container.ProfileVersion]
	if ok {
		// Unset the binding between the container and its profile
		if err := pl.DeleteProfileMappings(profile, container); err != nil {
			return errors.Wrap(err, "couldn't delete profile mappings")
		}
		// Delete container from the list of containers of the profile
		profile.RemoveContainerID(container.ContainerID)
		if len(profile.ContainerIDs) <= 0 {
			// Delete profile from kernel
			if err := pl.DeleteSecurityProfile(profile.Profile); err != nil {
				return errors.Wrapf(err, "couldn't delete security profile %s", profile.ProfileVersion.UID)
			}
			delete(pl.LoadedProfiles, container.ProfileVersion)
		}
	}
	// Delete container ID
	delete(pl.RunningContainers, event.ContainerID)
	return nil
}
// handleContainerExited - Handles a container running event
Handles a container running event
// handleContainerExited - Handles a container running event
func (pl *ProfileLoader) handleContainerExited(event *model.ContainerEvent) error {
	container, ok := pl.RunningContainers[event.ContainerID]
	if !ok {
		return nil
	}
	profile, ok := pl.LoadedProfiles[container.ProfileVersion]
	if ok {
		if err := pl.DeleteProfileMappings(profile, container); err != nil {
			return errors.Wrap(err, "couldn't delete profile mappings")
		}
		profile.RemoveContainerID(container.ContainerID)
		if len(profile.ContainerIDs) <= 0 {
			if err := pl.DeleteSecurityProfile(profile.Profile); err != nil {
				return errors.Wrapf(err, "couldn't delete security profile %s", profile.ProfileVersion.UID)
			}
			delete(pl.LoadedProfiles, container.ProfileVersion)
		}
	}
	delete(pl.RunningContainers, event.ContainerID)
	return nil
}
func ( pl * ProfileLoader ) handleContainerExited ( event * model . ContainerEvent ) error { container , ok := pl . RunningContainers [ event . ContainerID ] if ! ok { return nil } profile , ok := pl . LoadedProfiles [ container . ProfileVersion ] if ok { if err := pl . DeleteProfileMappings ( profile , container ) ; err != nil { return errors . Wrap ( err , " " ) } profile . RemoveContainerID ( container . ContainerID ) if len ( profile . ContainerIDs ) <= 0 { if err := pl . DeleteSecurityProfile ( profile . Profile ) ; err != nil { return errors . Wrapf ( err , " " , profile . ProfileVersion . UID ) } delete ( pl . LoadedProfiles , container . ProfileVersion ) } } delete ( pl . RunningContainers , event . ContainerID ) return nil }
Handles a container running event
Handles a container running event
// select container // Nothing to delete // select profile // Unset the binding between the container and its profile // Delete container from the list of containers of the profile // Delete profile from kernel // Delete container ID