mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-03-22 02:29:08 +00:00
Fix idempotency for RestartPolicy when MaximumRetryCount > 0 (#607)
Before this change, this task:
```ansible
- containers.podman.podman_container:
# ...
restart_policy: on-failure:3
# ...
```
always caused this diff:
```diff
--- before
+++ after
@@ -1 +1 @@
-restart_policy - on-failure
+restart_policy - on-failure:3
```
Signed-off-by: Sebastian Endres <sebastian.endres@dlr.de>
Co-authored-by: Sebastian Endres <sebastian.endres@dlr.de>
This commit is contained in:
parent
0932809c6a
commit
0ae6baac3d
1 changed files with 8 additions and 0 deletions
|
|
@ -1166,7 +1166,15 @@ class PodmanContainerDiff:
|
|||
|
||||
def diffparam_restart_policy(self):
|
||||
before = self.info['hostconfig']['restartpolicy']['name']
|
||||
before_max_count = int(self.info['hostconfig']['restartpolicy'].get('maximumretrycount', 0))
|
||||
after = self.params['restart_policy'] or ""
|
||||
if ':' in after:
|
||||
after, after_max_count = after.rsplit(':', 1)
|
||||
after_max_count = int(after_max_count)
|
||||
else:
|
||||
after_max_count = 0
|
||||
before = "%s:%i" % (before, before_max_count)
|
||||
after = "%s:%i" % (after, after_max_count)
|
||||
return self._diff_update_and_compare('restart_policy', before, after)
|
||||
|
||||
def diffparam_rm(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue