utils

package
v5.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AliasFlags

func AliasFlags(f *pflag.FlagSet, name string) pflag.NormalizedName

AliasFlags is a function to handle backwards compatibility with old flags

func ExitCodeFromBuildError

func ExitCodeFromBuildError(errorMsg string) (int, error)

For remote client, server does not return error with exit code

instead returns a message and we cast it to a new error.

Following function performs parsing on build error and returns
exit status which was expected for this current build

func FileExists

func FileExists(path string) bool

FileExists returns true if path refers to an existing file.

func HandleOSExecError

func HandleOSExecError(err error) error

HandleOSExecError checks the given error for an exec.ExitError error and sets the same podman exit code as the error. No error will be returned in this case to make sure things like podman unshare false work correctly without extra output. When the exec file does not exist we set the exit code to 127, for permission errors 126 is used as exit code. In this case we still return the error so the user gets an error message. If the error is nil it returns nil.

func IsCheckpointImage

func IsCheckpointImage(ctx context.Context, namesOrIDs []string) (bool, error)

IsCheckpointImage returns true with no error only if all values in namesOrIDs correspond to checkpoint images AND these images are compatible with the container runtime that is currently in use, e.g., crun or runc.

IsCheckpointImage returns false with no error when none of the values in namesOrIDs corresponds to an ID or name of an image.

Otherwise, IsCheckpointImage returns false with appropriate error.

func IsDir

func IsDir(path string) bool

IsDir returns true if the specified path refers to a directory.

func PrintContainerPruneResults

func PrintContainerPruneResults(containerPruneReports []*reports.PruneReport, heading bool) error

func PrintImagePruneResults

func PrintImagePruneResults(imagePruneReports []*reports.PruneReport, heading bool) error

func PrintNetworkPruneResults

func PrintNetworkPruneResults(networkPruneReport []*entities.NetworkPruneReport, heading bool) error

func PrintPodPruneResults

func PrintPodPruneResults(podPruneReports []*entities.PodPruneReport, heading bool) error

func PrintVolumePruneResults

func PrintVolumePruneResults(volumePruneReport []*reports.PruneReport, heading bool) error

func RemoveSlash

func RemoveSlash(input []string) []string

func TimeoutAliasFlags

func TimeoutAliasFlags(f *pflag.FlagSet, name string) pflag.NormalizedName

TimeoutAliasFlags is a function to handle backwards compatibility with old timeout flags

Types

type OutputErrors

type OutputErrors []error

func (OutputErrors) PrintErrors

func (o OutputErrors) PrintErrors() (lastError error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL