From b9a2d8698a22c4b267e252caad56d8b31fcadd38 Mon Sep 17 00:00:00 2001 From: esendjer Date: Wed, 19 Jan 2022 14:56:37 +0500 Subject: Handlers for `generate systemd` with custom dependencies This commit includes: * Handlers for generate systemd unit with manually defined dependencies such as: Wants=, After= and Requires= * The new unit and e2e tests for checking generated systemd units for container and pod with custom dependencies * Documented descriptions for custom dependencies options Signed-off-by: Eugene (Evgenii) Shubin --- cmd/podman/generate/systemd.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cmd') diff --git a/cmd/podman/generate/systemd.go b/cmd/podman/generate/systemd.go index 5ad42ebc0..0dab6299d 100644 --- a/cmd/podman/generate/systemd.go +++ b/cmd/podman/generate/systemd.go @@ -25,6 +25,9 @@ const ( restartPolicyFlagName = "restart-policy" restartSecFlagName = "restart-sec" newFlagName = "new" + wantsFlagName = "wants" + afterFlagName = "after" + requiresFlagName = "requires" ) var ( @@ -97,6 +100,15 @@ func init() { flags.StringVar(&format, formatFlagName, "", "Print the created units in specified format (json)") _ = systemdCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(nil)) + flags.StringArrayVar(&systemdOptions.Wants, wantsFlagName, nil, "Add (weak) requirement dependencies to the generated unit file") + _ = systemdCmd.RegisterFlagCompletionFunc(wantsFlagName, completion.AutocompleteNone) + + flags.StringArrayVar(&systemdOptions.After, afterFlagName, nil, "Add dependencies order to the generated unit file") + _ = systemdCmd.RegisterFlagCompletionFunc(afterFlagName, completion.AutocompleteNone) + + flags.StringArrayVar(&systemdOptions.Requires, requiresFlagName, nil, "Similar to wants, but declares stronger requirement dependencies") + _ = systemdCmd.RegisterFlagCompletionFunc(requiresFlagName, completion.AutocompleteNone) + flags.SetNormalizeFunc(utils.TimeoutAliasFlags) } -- cgit v1.2.3-54-g00ecf