Skip to content

Commit

Permalink
Fix quadlet parameters for restart policy (#798)
Browse files Browse the repository at this point in the history
Fix #797
Signed-off-by: Sagi Shnaidman <[email protected]>
  • Loading branch information
sshnaidm authored Jul 11, 2024
1 parent d25cf57 commit 4e65a7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions plugins/module_utils/podman/podman_container_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ def addparam_env_host(self, c):
self.check_version('--env-host', minv='1.5.0')
return c + ['--env-host=%s' % self.params['env_host']]

# Exception for etc_hosts and add-host
def addparam_etc_hosts(self, c):
for host_ip in self.params['etc_hosts'].items():
c += ['--add-host', ':'.join(host_ip)]
Expand Down Expand Up @@ -510,6 +511,7 @@ def addparam_group_add(self, c):
def addparam_group_entry(self, c):
return c + ['--group-entry', self.params['group_entry']]

# Exception for healthcheck and healthcheck-command
def addparam_healthcheck(self, c):
return c + ['--healthcheck-command', self.params['healthcheck']]

Expand Down Expand Up @@ -644,6 +646,7 @@ def addparam_network(self, c):
return c
return c + ['--network', ",".join(self.params['network'])]

# Exception for network_aliases and network-alias
def addparam_network_aliases(self, c):
for alias in self.params['network_aliases']:
c += ['--network-alias', alias]
Expand Down Expand Up @@ -729,6 +732,7 @@ def addparam_read_only_tmpfs(self, c):
def addparam_requires(self, c):
return c + ['--requires', ",".join(self.params['requires'])]

# Exception for restart_policy and restart
def addparam_restart_policy(self, c):
return c + ['--restart=%s' % self.params['restart_policy']]

Expand Down Expand Up @@ -757,6 +761,7 @@ def addparam_sdnotify(self, c):
def addparam_seccomp_policy(self, c):
return c + ['--seccomp-policy', self.params['seccomp_policy']]

# Exception for secrets and secret
def addparam_secrets(self, c):
for secret in self.params['secrets']:
c += ['--secret', secret]
Expand Down Expand Up @@ -801,6 +806,7 @@ def addparam_systemd(self, c):
def addparam_timeout(self, c):
return c + ['--timeout', self.params['timeout']]

# Exception for timezone and tz
def addparam_timezone(self, c):
return c + ['--tz=%s' % self.params['timezone']]

Expand Down
2 changes: 1 addition & 1 deletion plugins/module_utils/podman/quadlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def custom_prepare_params(self, params: dict) -> dict:
if params["requires"]:
params["podman_args"].append(f"--requires {','.join(params['requires'])}")
if params["restart_policy"]:
params["podman_args"].append(f"--restart-policy {params['restart_policy']}")
params["podman_args"].append(f"--restart {params['restart_policy']}")
if params["retry"]:
params["podman_args"].append(f"--retry {params['retry']}")
if params["retry_delay"]:
Expand Down

0 comments on commit 4e65a7b

Please sign in to comment.