Skip to content
This repository has been archived by the owner on Jan 8, 2023. It is now read-only.

Commit

Permalink
Ensure that containers.podman collection is present (#40)
Browse files Browse the repository at this point in the history
Adds check for presence of containers.podman collection and requires
the latest known version to present. This means that this driver
will no longer work with podman modules shipped with Ansible 2.9.

Still, installing the collection on 2.9 will make it work but that
must be run by the user.
  • Loading branch information
ssbarnea authored Jun 16, 2021
1 parent ebf23cf commit 0fcb9da
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ repos:
entry: mypy lib/
pass_filenames: false
additional_dependencies:
- ansible-lint>=5.1.0a0
- molecule
- packaging
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.6.0
hooks:
- id: pylint
additional_dependencies:
- ansible-base
- ansible-core>=2.11.1
- ansible-lint>=5.1.0a0
- molecule
6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ Molecule Podman Plugin
:target: LICENSE
:alt: Repository License

Molecule podman Plugin is designed to allow use Podman containers for
Molecule Podman Plugin is designed to allow use Podman containers for
provisioning test resources.

This plugin requires `containers.podman` collection to be present:

ansible-galaxy collection install containers.podman

Please note that this driver is currently in its early stage of development.

.. _get-involved:
Expand Down
2 changes: 2 additions & 0 deletions lib/molecule_podman/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import os

from ansiblelint.prerun import require_collection
from molecule import logger
from molecule.api import Driver
from molecule.util import lru_cache
Expand Down Expand Up @@ -189,3 +190,4 @@ def ansible_connection_options(self, instance_name):
def sanity_checks(self):
"""Implement Podman driver sanity checks."""
log.info("Sanity checks: '{}'".format(self._name))
require_collection("containers.podman", "1.6.1")
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ setup_requires =

# These are required in actual runtime:
install_requires =
# we need require_collection from ansiblelint.prerun
ansible-lint >= 5.1.0a0
molecule >= 3.2.0
# selinux python module is needed as least by ansible-podman modules
# and allows us of isolated (default) virtualenvs. It does not avoid need
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ deps =
dockerfile: ansible>=2.9.12
selinux
commands =
ansibledevel: ansible-galaxy install git+https://github.com/ansible-collections/community.general.git
ansibledevel: ansible-galaxy collection install git+https://github.com/containers/ansible-podman-collections
# this should mention oldest version we find acceptable for runtime
ansible-galaxy collection install 'containers.podman:==1.6.1'
# failsafe as pip may install incompatible dependencies
pip check
# failsafe for preventing changes that may break pytest collection
Expand Down

0 comments on commit 0fcb9da

Please sign in to comment.