diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6331909..087d062 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,6 +7,10 @@ exclude: | (?x)( ^docs/conf.py$ ) +default_language_version: + # make linting predictable, especially as we know that current pylint is not + # working well with py311. + python: python3.8 repos: - repo: https://github.com/PyCQA/isort rev: 5.10.1 @@ -50,11 +54,12 @@ repos: - ansible-compat>=2.2.0 - molecule>=4.0.0 - packaging - - repo: https://github.com/pre-commit/mirrors-pylint - rev: v3.0.0a5 + - repo: https://github.com/pycqa/pylint + rev: v2.14.5 hooks: - id: pylint additional_dependencies: + # - astroid<=v2.11.6 # - ansible-core>=2.13 - molecule>=4.0.0 - repo: https://github.com/ansible/ansible-lint.git diff --git a/src/molecule_podman/driver.py b/src/molecule_podman/driver.py index 9d3f98a..84ea464 100644 --- a/src/molecule_podman/driver.py +++ b/src/molecule_podman/driver.py @@ -26,7 +26,6 @@ from shutil import which from typing import Dict -from ansible_compat.ports import cache from ansible_compat.runtime import Runtime from molecule import logger, util from molecule.api import Driver, MoleculeRuntimeWarning @@ -167,6 +166,7 @@ def __init__(self, config=None): # An example could be MOLECULE_PODMAN_EXECUTABLE=podman-remote self.podman_exec = os.environ.get("MOLECULE_PODMAN_EXECUTABLE", "podman") self._podman_cmd = None + self._sanity_passed = False @property def podman_cmd(self): @@ -214,9 +214,11 @@ def ansible_connection_options(self, instance_name): "ansible_podman_executable": f"{self.podman_exec}", } - @cache def sanity_checks(self): """Implement Podman driver sanity checks.""" + if self._sanity_passed: + return + log.info("Sanity checks: '%s'", self._name) # TODO(ssbarnea): reuse ansible runtime instance from molecule once it # fully adopts ansible-compat @@ -237,6 +239,7 @@ def sanity_checks(self): "Do not raise any bugs if your tests are failing with current configuration.", category=MoleculeRuntimeWarning, ) + self._sanity_passed = True @property def required_collections(self) -> Dict[str, str]: