From 1f28b5224269c13fb428b332d79b8289a1f1ced1 Mon Sep 17 00:00:00 2001 From: Sergey Date: Sun, 15 Aug 2021 19:40:07 +0300 Subject: [PATCH] Fix modules for newest pylint in ansible-test (#286) --- contrib/ansible-lint.sh | 11 +++++++++++ plugins/module_utils/podman/podman_pod_lib.py | 4 ++-- plugins/modules/podman_containers.py | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100755 contrib/ansible-lint.sh diff --git a/contrib/ansible-lint.sh b/contrib/ansible-lint.sh new file mode 100755 index 00000000..88ed7ac1 --- /dev/null +++ b/contrib/ansible-lint.sh @@ -0,0 +1,11 @@ +#!/bin/bash +mkdir -p /tmp/ansible-lint-installs +mkdir -p /tmp/ansible-lint-collection +rm -rf /tmp/ansible-lint-collection/* +ansible-galaxy collection build --output-path /tmp/ansible-lint-collection --force +pushd /tmp/ansible-lint-collection/ +ansible-galaxy collection install -vvv --force $(ls /tmp/ansible-lint-collection/) -p /tmp/ansible-lint-installs +pushd /tmp/ansible-lint-installs/ansible_collections/containers/podman +ansible-test sanity --docker --color --truncate 0 --no-redact --no-pip-check --python 3.9 -v plugins/ tests/ +popd +popd diff --git a/plugins/module_utils/podman/podman_pod_lib.py b/plugins/module_utils/podman/podman_pod_lib.py index e5a8804d..b752b881 100644 --- a/plugins/module_utils/podman/podman_pod_lib.py +++ b/plugins/module_utils/podman/podman_pod_lib.py @@ -312,8 +312,8 @@ def diffparam_infra_image(self): after = self.params['infra_image'] before = before.replace(":latest", "") after = after.replace(":latest", "") - before = before.split("/")[-1] - after = after.split("/")[-1] + before = before.split("/")[-1] # pylint: disable=W,C,R + after = after.split("/")[-1] # pylint: disable=W,C,R return self._diff_update_and_compare('infra_image', before, after) # TODO(sshnaidm): https://github.com/containers/podman/pull/6956 diff --git a/plugins/modules/podman_containers.py b/plugins/modules/podman_containers.py index 9b41f7c1..eddb7cc9 100644 --- a/plugins/modules/podman_containers.py +++ b/plugins/modules/podman_containers.py @@ -53,8 +53,8 @@ def combine(results): - changed = any([i.get('changed', False) for i in results]) - failed = any([i.get('failed', False) for i in results]) + changed = any(i.get('changed', False) for i in results) + failed = any(i.get('failed', False) for i in results) actions = [] podman_actions = [] containers = []