util

package
v1.7.0-tar Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBadMntOption indicates that an invalid mount option was passed.
	ErrBadMntOption = errors.Errorf("invalid mount option")
	// ErrDupeMntOption indicates that a duplicate mount option was passed.
	ErrDupeMntOption = errors.Errorf("duplicate mount option passed")
)

Functions

func ExitCode

func ExitCode(err error) int

ExitCode reads the error message when failing to executing container process and then returns 0 if no error, 126 if command does not exist, or 127 for all other errors

func FindDeviceNodes

func FindDeviceNodes() (map[string]string, error)

FindDeviceNodes parses /dev/ into a set of major:minor -> path, where [major:minor] is the device's major and minor numbers formatted as, for example, 2:0 and path is the path to the device node. Symlinks to nodes are ignored.

func GetContainerPidInformationDescriptors

func GetContainerPidInformationDescriptors() ([]string, error)

GetContainerPidInformationDescriptors returns a string slice of all supported format descriptors of GetContainerPidInformation.

func GetGlobalOpts

func GetGlobalOpts(c *cliconfig.RunlabelValues) string

GetGlobalOpts checks all global flags and generates the command string

func GetRootlessConfigHomeDir

func GetRootlessConfigHomeDir() (string, error)

GetRootlessConfigHomeDir returns the config home directory when running as non root

func GetRootlessPauseProcessPidPath

func GetRootlessPauseProcessPidPath() (string, error)

GetRootlessPauseProcessPidPath returns the path to the file that holds the pid for the pause process

func GetRuntimeDir

func GetRuntimeDir() (string, error)

GetRuntimeDir returns the runtime directory

func HomeDir

func HomeDir() (string, error)

HomeDir returns the home directory for the current user.

func OpenExclusiveFile

func OpenExclusiveFile(path string) (*os.File, error)

OpenExclusiveFile opens a file for writing and ensure it doesn't already exist

func ParseIDMapping

func ParseIDMapping(mode namespaces.UsernsMode, UIDMapSlice, GIDMapSlice []string, subUIDMap, subGIDMap string) (*storage.IDMappingOptions, error)

ParseIDMapping takes idmappings and subuid and subgid maps and returns a storage mapping

func ParseInputTime

func ParseInputTime(inputTime string) (time.Time, error)

ParseInputTime takes the users input and to determine if it is valid and returns a time format and error. The input is compared to known time formats or a duration which implies no-duration

func ParseRegistryCreds

func ParseRegistryCreds(creds string) (*types.DockerAuthConfig, error)

ParseRegistryCreds takes a credentials string in the form USERNAME:PASSWORD and returns a DockerAuthConfig

func ParseSignal

func ParseSignal(rawSignal string) (syscall.Signal, error)

Parse and validate a signal name or number

func ProcessOptions

func ProcessOptions(options []string, isTmpfs bool, defaults *DefaultMountOptions) ([]string, error)

ProcessOptions parses the options for a bind or tmpfs mount and ensures that they are sensible and follow convention. The isTmpfs variable controls whether extra, tmpfs-specific options will be allowed. The defaults variable controls default mount options that will be set. If it is not included, they will be set unconditionally.

func StringInSlice

func StringInSlice(s string, sl []string) bool

StringInSlice determines if a string is in a string slice, returns bool

func WriteStorageConfigFile

func WriteStorageConfigFile(storageOpts *storage.StoreOptions, storageConf string) error

WriteStorageConfigFile writes the configuration to a file

Types

type DefaultMountOptions

type DefaultMountOptions struct {
	Noexec bool
	Nosuid bool
	Nodev  bool
}

DefaultMountOptions sets default mount options for ProcessOptions.

type ImageConfig

type ImageConfig struct {
	v1.ImageConfig
	OnBuild []string
}

ImageConfig is a wrapper around the OCIv1 Image Configuration struct exported by containers/image, but containing additional fields that are not supported by OCIv1 (but are by Docker v2) - notably OnBuild.

func GetImageConfig

func GetImageConfig(changes []string) (ImageConfig, error)

GetImageConfig produces a v1.ImageConfig from the --change flag that is accepted by several Podman commands. It accepts a (limited subset) of Dockerfile instructions.

type PullType

type PullType int

PullType whether to pull new image

const (
	// PullImageAlways always try to pull new image when create or run
	PullImageAlways PullType = iota
	// PullImageMissing pulls image if it is not locally
	PullImageMissing
	// PullImageNever will never pull new image
	PullImageNever
)

func ValidatePullType

func ValidatePullType(pullType string) (PullType, error)

ValidatePullType check if the pullType from CLI is valid and returns the valid enum type if the value from CLI is invalid returns the error

Jump to

Keyboard shortcuts

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