mirror of
https://github.com/containers/podman.git
synced 2025-07-04 10:10:32 +08:00
remove unused method references
Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com>
This commit is contained in:
@ -118,31 +118,3 @@ func (l ListContainer) USERNS() string {
|
|||||||
func (l ListContainer) UTS() string {
|
func (l ListContainer) UTS() string {
|
||||||
return l.Namespaces.UTS
|
return l.Namespaces.UTS
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l ListContainer) Commands() []string {
|
|
||||||
return l.Command
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l ListContainer) ContainerID() string {
|
|
||||||
return l.ID
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l ListContainer) LabelsList() map[string]string {
|
|
||||||
return l.Labels
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l ListContainer) NamesList() []string {
|
|
||||||
return l.Names
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l ListContainer) ImageInfo() (string, string) {
|
|
||||||
return l.ImageID, l.Image
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l ListContainer) CreatedTime() time.Time {
|
|
||||||
return l.Created
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l ListContainer) StatusInfo() string {
|
|
||||||
return l.Status
|
|
||||||
}
|
|
||||||
|
@ -327,12 +327,12 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
|
|||||||
switch filter {
|
switch filter {
|
||||||
case "id":
|
case "id":
|
||||||
return func(listContainer *types.ListContainer) bool {
|
return func(listContainer *types.ListContainer) bool {
|
||||||
return filters.FilterID(listContainer.ContainerID(), filterValues)
|
return filters.FilterID(listContainer.ID, filterValues)
|
||||||
}, nil
|
}, nil
|
||||||
case "name":
|
case "name":
|
||||||
// we only have to match one name
|
// we only have to match one name
|
||||||
return func(listContainer *types.ListContainer) bool {
|
return func(listContainer *types.ListContainer) bool {
|
||||||
namesList := listContainer.NamesList()
|
namesList := listContainer.Names
|
||||||
|
|
||||||
for _, f := range filterValues {
|
for _, f := range filterValues {
|
||||||
f = strings.ReplaceAll(f, "/", "")
|
f = strings.ReplaceAll(f, "/", "")
|
||||||
@ -345,26 +345,25 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
|
|||||||
}, nil
|
}, nil
|
||||||
case "command":
|
case "command":
|
||||||
return func(listContainer *types.ListContainer) bool {
|
return func(listContainer *types.ListContainer) bool {
|
||||||
return util.StringMatchRegexSlice(listContainer.Commands()[0], filterValues)
|
return util.StringMatchRegexSlice(listContainer.Command[0], filterValues)
|
||||||
}, nil
|
}, nil
|
||||||
case "ancestor":
|
case "ancestor":
|
||||||
// This needs to refine to match docker
|
// This needs to refine to match docker
|
||||||
// - ancestor=(<image-name>[:tag]|<image-id>| ⟨image@digest⟩) - containers created from an image or a descendant.
|
// - ancestor=(<image-name>[:tag]|<image-id>| ⟨image@digest⟩) - containers created from an image or a descendant.
|
||||||
return func(listContainer *types.ListContainer) bool {
|
return func(listContainer *types.ListContainer) bool {
|
||||||
for _, filterValue := range filterValues {
|
for _, filterValue := range filterValues {
|
||||||
rootfsImageID, rootfsImageName := listContainer.ImageInfo()
|
|
||||||
var imageTag string
|
var imageTag string
|
||||||
var imageNameWithoutTag string
|
var imageNameWithoutTag string
|
||||||
// Compare with ImageID, ImageName
|
// Compare with ImageID, ImageName
|
||||||
// Will match ImageName if running image has tag latest for other tags exact complete filter must be given
|
// Will match ImageName if running image has tag latest for other tags exact complete filter must be given
|
||||||
name, tag, hasColon := strings.Cut(rootfsImageName, ":")
|
name, tag, hasColon := strings.Cut(listContainer.Image, ":")
|
||||||
if hasColon {
|
if hasColon {
|
||||||
imageNameWithoutTag = name
|
imageNameWithoutTag = name
|
||||||
imageTag = tag
|
imageTag = tag
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rootfsImageID == filterValue) ||
|
if (listContainer.ImageID == filterValue) ||
|
||||||
util.StringMatchRegexSlice(rootfsImageName, filterValues) ||
|
util.StringMatchRegexSlice(listContainer.Image, filterValues) ||
|
||||||
(util.StringMatchRegexSlice(imageNameWithoutTag, filterValues) && imageTag == "latest") {
|
(util.StringMatchRegexSlice(imageNameWithoutTag, filterValues) && imageTag == "latest") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -390,7 +389,7 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return func(listContainer *types.ListContainer) bool {
|
return func(listContainer *types.ListContainer) bool {
|
||||||
return createTime.After(listContainer.CreatedTime())
|
return createTime.After(listContainer.Created)
|
||||||
}, nil
|
}, nil
|
||||||
case "since":
|
case "since":
|
||||||
var createTime time.Time
|
var createTime time.Time
|
||||||
@ -411,7 +410,7 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return func(listContainer *types.ListContainer) bool {
|
return func(listContainer *types.ListContainer) bool {
|
||||||
return createTime.Before(listContainer.CreatedTime())
|
return createTime.Before(listContainer.Created)
|
||||||
}, nil
|
}, nil
|
||||||
case "until":
|
case "until":
|
||||||
until, err := filters.ComputeUntilTimestamp(filterValues)
|
until, err := filters.ComputeUntilTimestamp(filterValues)
|
||||||
@ -419,7 +418,7 @@ func GenerateExternalContainerFilterFuncs(filter string, filterValues []string,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return func(listContainer *types.ListContainer) bool {
|
return func(listContainer *types.ListContainer) bool {
|
||||||
if !until.IsZero() && listContainer.CreatedTime().Before(until) {
|
if !until.IsZero() && listContainer.Created.Before(until) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
Reference in New Issue
Block a user