Skip to content

Commit

Permalink
Fix pylint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Jul 18, 2022
1 parent 56079a7 commit 191b72f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/molecule_podman/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand All @@ -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]:
Expand Down

0 comments on commit 191b72f

Please sign in to comment.