Skip to content

Commit

Permalink
generate_systemd: implement --wants, --after and --requires (containe…
Browse files Browse the repository at this point in the history
…rsGH-431)

Signed-off-by: dada513 <[email protected]>
  • Loading branch information
dada513 committed May 28, 2022
1 parent 15dae0d commit 6812804
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/module_utils/podman/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ def generate_systemd(module, module_params, name):
command.extend(['--pod-prefix=%s' % sysconf['pod_prefix']])
if sysconf.get('separator') is not None:
command.extend(['--separator=%s' % sysconf['separator']])
if sysconf.get('after') is not None:
for after in sysconf['after']:
command.extend(['--after=%s' % after])
if sysconf.get('wants') is not None:
for want in sysconf['wants']:
command.extend(['--wants=%s' % want])
if sysconf.get('requires') is not None:
for require in sysconf['requires']:
command.extend(['--requires=%s' % require])
if module.params['debug'] or module_params['debug']:
module.log("PODMAN-CONTAINER-DEBUG: systemd command: %s" %
" ".join(command))
Expand Down
15 changes: 15 additions & 0 deletions plugins/modules/podman_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,21 @@
Refer to podman-generate-systemd(1) for more information.
type: bool
default: false
after:
type: list
required: false
description:
- Add the systemd unit after (After=) option, that ordering dependencies between the list of dependencies and this service.
wants:
type: list
required: false
description:
- Add the systemd unit wants (Wants=) option, that this service is (weak) dependent on.
requires:
type: list
required: false
description:
- Set the systemd unit requires (Requires=) option. Similar to wants, but declares a stronger requirement dependency.
gidmap:
description:
- Run the container in a new user namespace using the supplied mapping.
Expand Down
15 changes: 15 additions & 0 deletions plugins/modules/podman_pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,21 @@
Refer to podman-generate-systemd(1) for more information.
type: bool
default: false
after:
type: list
required: false
description:
- Add the systemd unit after (After=) option, that ordering dependencies between the list of dependencies and this service.
wants:
type: list
required: false
description:
- Add the systemd unit wants (Wants=) option, that this service is (weak) dependent on.
requires:
type: list
required: false
description:
- Set the systemd unit requires (Requires=) option. Similar to wants, but declares a stronger requirement dependency.
gidmap:
description:
- GID map for the user namespace. Using this flag will run the container with
Expand Down

0 comments on commit 6812804

Please sign in to comment.