From e704f1362abc416786076a932d8e2ca930b9fa2e Mon Sep 17 00:00:00 2001 From: Luap99 Date: Thu, 21 May 2020 17:36:41 +0200 Subject: Added new flags to 'podman generate systemd' to change the unit name prefix --container-prefix - default 'container' Systemd unit name prefix for containers --pod-prefix - default 'pod' Systemd unit name prefix for pods --separator - default '-' Systemd unit name seperator between name/id and prefix Signed-off-by: Paul Holzinger --- pkg/domain/infra/abi/generate.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pkg/domain/infra') diff --git a/pkg/domain/infra/abi/generate.go b/pkg/domain/infra/abi/generate.go index be5d452bd..abb5e2911 100644 --- a/pkg/domain/infra/abi/generate.go +++ b/pkg/domain/infra/abi/generate.go @@ -159,14 +159,14 @@ func (ic *ContainerEngine) generateSystemdgenContainerInfo(nameOrID string, pod func generateServiceName(ctr *libpod.Container, pod *libpod.Pod, options entities.GenerateSystemdOptions) (string, string) { var kind, name, ctrName string if pod == nil { - kind = "container" + kind = options.ContainerPrefix //defaults to container name = ctr.ID() if options.Name { name = ctr.Name() } ctrName = name } else { - kind = "pod" + kind = options.PodPrefix //defaults to pod name = pod.ID() ctrName = ctr.ID() if options.Name { @@ -174,7 +174,7 @@ func generateServiceName(ctr *libpod.Container, pod *libpod.Pod, options entitie ctrName = ctr.Name() } } - return ctrName, fmt.Sprintf("%s-%s", kind, name) + return ctrName, fmt.Sprintf("%s%s%s", kind, options.Separator, name) } func (ic *ContainerEngine) GenerateKube(ctx context.Context, nameOrID string, options entities.GenerateKubeOptions) (*entities.GenerateKubeReport, error) { -- cgit v1.2.3-54-g00ecf