From af40dfc2bf614aeb4191916cc2420068696eb776 Mon Sep 17 00:00:00 2001 From: José Guilherme Vanz Date: Tue, 29 Jun 2021 16:39:11 -0300 Subject: --infra-name command line argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the new --infra-name command line argument allowing users to define the name of the infra container Issue #10794 Signed-off-by: José Guilherme Vanz --- libpod/options.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'libpod/options.go') diff --git a/libpod/options.go b/libpod/options.go index bc563d60c..17a36008d 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -459,6 +459,19 @@ func WithDefaultInfraCommand(cmd string) RuntimeOption { } } +// WithDefaultInfraName sets the infra container name for a single pod. +func WithDefaultInfraName(name string) RuntimeOption { + return func(rt *Runtime) error { + if rt.valid { + return define.ErrRuntimeFinalized + } + + rt.config.Engine.InfraImage = name + + return nil + } +} + // WithRenumber instructs libpod to perform a lock renumbering while // initializing. This will handle migrations from early versions of libpod with // file locks to newer versions with SHM locking, as well as changes in the @@ -1787,6 +1800,19 @@ func WithInfraCommand(cmd []string) PodCreateOption { } } +// WithInfraName sets the infra container name for a single pod. +func WithInfraName(name string) PodCreateOption { + return func(pod *Pod) error { + if pod.valid { + return define.ErrPodFinalized + } + + pod.config.InfraContainer.InfraName = name + + return nil + } +} + // WithPodName sets the name of the pod. func WithPodName(name string) PodCreateOption { return func(pod *Pod) error { -- cgit v1.2.3-54-g00ecf