1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-04-30 04:48:49 +00:00

Improve idempotency for devices mount of rootless podman (#487)

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
Sergey 2022-09-28 12:39:15 +03:00 committed by GitHub
parent 5f74d5b4fb
commit bf67c7e078
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 71 additions and 0 deletions

View file

@ -855,7 +855,16 @@ class PodmanContainerDiff:
def diffparam_device(self):
before = [":".join([i['pathonhost'], i['pathincontainer']])
for i in self.info['hostconfig']['devices']]
if not before and 'createcommand' in self.info['config']:
cr_com = self.info['config']['createcommand']
if '--device' in cr_com:
before = [cr_com[k + 1].lower()
for k, i in enumerate(cr_com) if i == '--device']
before = [":".join((i, i))
if len(i.split(":")) == 1 else i for i in before]
after = [":".join(i.split(":")[:2]) for i in self.params['device']]
after = [":".join((i, i))
if len(i.split(":")) == 1 else i for i in after]
before, after = sorted(list(set(before))), sorted(list(set(after)))
return self._diff_update_and_compare('devices', before, after)