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

Commit

Permalink
Merge branch 'main' into ensure_provider2
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Jan 6, 2023
2 parents 4b325ee + 7369365 commit 14cb0ce
Show file tree
Hide file tree
Showing 30 changed files with 56 additions and 80 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ jobs:
TOX_PARALLEL_NO_SPINNER: 1

steps:
- name: Switch to using Python 3.8 by default
uses: actions/setup-python@v2
- name: Switch to using Python 3.9 by default
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
python-version: 3.9
- name: Install tox
run: >-
python3 -m
pip install
--user
tox
- name: Check out src from Git
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0 # needed by setuptools-scm
- name: Build dists
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ jobs:
- tox_env: lint
platform: ubuntu-latest
skip_vagrant: true
- tox_env: py38,py38-devel
PREFIX: PYTEST_REQPASS=13
platform: macos-12
python_version: "3.8"
- tox_env: py39,py39-devel
PREFIX: PYTEST_REQPASS=13
platform: macos-12
Expand All @@ -55,27 +51,24 @@ jobs:
if: ${{ ! matrix.skip_vagrant }}

- name: Check out src from Git
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0 # needed by setuptools-scm

- name: Enable vagrant box caching
uses: actions/cache@v2
uses: actions/cache@v3
if: ${{ ! matrix.skip_vagrant }}
with:
path: |
~/.vagrant.d/boxes
key: ${{ runner.os }}-${{ hashFiles('tools/Vagrantfile') }}

- name: Install a default Python
uses: actions/setup-python@v2

# Be sure to install the version of python needed by a specific test, if necessary
- name: Set up Python version
uses: actions/setup-python@v2
if: ${{ matrix.python_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
python-version: ${{ matrix.python_version || '3.9' }}
cache: pip

- name: Install dependencies
run: |
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ default_language_version:
minimum_pre_commit_version: "1.14.0"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -26,12 +26,12 @@ repos:
hooks:
- id: doc8
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 22.12.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
Expand Down Expand Up @@ -68,7 +68,7 @@ repos:
# use jinja templating, this will often fail and the syntax
# error will be discovered in execution anyway)
- repo: https://github.com/ansible/ansible-lint.git
rev: v6.8.2
rev: v6.10.0
hooks:
- id: ansible-lint
always_run: true
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ Here's a full example with the libvirt provider:
# Defaults to true
parallel: true
# vagrant box to use by default
# Defaults to 'generic/alpine310'
default_box: 'generic/alpine310'
# Defaults to 'generic/alpine316'
default_box: 'generic/alpine316'
platforms:
- name: instance
Expand Down
Empty file removed conftest.py
Empty file.
4 changes: 2 additions & 2 deletions molecule_vagrant/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
gather_facts: false
no_log: "{{ molecule_no_log }}"
tasks:
- name: Create molecule instance(s)
- name: Create molecule instance(s) # noqa fqcn[action]
vagrant:
instances: "{{ molecule_yml.platforms }}"
default_box: "{{ molecule_yml.driver.default_box | default('generic/alpine310') }}"
default_box: "{{ molecule_yml.driver.default_box | default('generic/alpine316') }}"
provider_name: "{{ molecule_yml.driver.provider.name | default(omit, true) }}"
provision: "{{ molecule_yml.driver.provision | default(omit) }}"
cachier: "{{ molecule_yml.driver.cachier | default(omit) }}"
Expand Down
4 changes: 2 additions & 2 deletions molecule_vagrant/playbooks/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
gather_facts: false
no_log: "{{ molecule_no_log }}"
tasks:
- name: Destroy molecule instance(s)
- name: Destroy molecule instance(s) # noqa fqcn[action]
vagrant:
instances: "{{ molecule_yml.platforms }}"
default_box: "{{ molecule_yml.driver.default_box | default('generic/alpine310') }}"
default_box: "{{ molecule_yml.driver.default_box | default('generic/alpine316') }}"
provider_name: "{{ molecule_yml.driver.provider.name | default(omit, true) }}"
cachier: "{{ molecule_yml.driver.cachier | default(omit) }}"
force_stop: "{{ item.force_stop | default(true) }}"
Expand Down
2 changes: 1 addition & 1 deletion molecule_vagrant/playbooks/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
(test -e /usr/bin/apt && (apt -y update && apt install -y python3-minimal)) ||
(test -e /usr/bin/yum && sudo yum -y -qq install python3) ||
(test -e /usr/sbin/pkg && sudo env ASSUME_ALWAYS_YES=yes pkg update && sudo env ASSUME_ALWAYS_YES=yes pkg install python3) ||
(test -e /usr/sbin/pkg_add && sudo /usr/sbin/pkg_add -U -I -x python%3.8) ||
(test -e /usr/sbin/pkg_add && sudo /usr/sbin/pkg_add -U -I -x python%3.9) ||
echo "Warning: Python not bootstrapped due to unknown platform."
)
become: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
- name: Sample task # noqa command-instead-of-shell
ansible.builtin.shell:
cmd: uname
warn: false
changed_when: false
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
- name: Sample task # noqa command-instead-of-shell
ansible.builtin.command:
cmd: uname
warn: false
changed_when: false
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
gather_facts: false
no_log: "{{ molecule_no_log }}"
tasks:
- name: Create molecule instance(s)
- name: Create molecule instance(s) # noqa fqcn[action]
vagrant:
instance_name: "{{ item.name }}"
instance_interfaces: "{{ item.interfaces | default(omit) }}"
instance_raw_config_args: "{{ item.instance_raw_config_args | default(omit) }}"

config_options: "{{ item.config_options | default(omit) }}"

platform_box: "{{ item.box | default('generic/alpine310') }}"
platform_box: "{{ item.box | default('generic/alpine316') }}"
platform_box_version: "{{ item.box_version | default(omit) }}"
platform_box_url: "{{ item.box_url | default(omit) }}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
gather_facts: false
no_log: "{{ molecule_no_log }}"
tasks:
- name: Destroy molecule instance(s)
- name: Destroy molecule instance(s) # noqa fqcn[action]
vagrant:
instance_name: "{{ item.name }}"
platform_box: "{{ item.box | default(omit) }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
- name: Sample task # noqa command-instead-of-shell
ansible.builtin.shell:
cmd: uname
warn: false
changed_when: false
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
- name: Sample task # noqa command-instead-of-shell
ansible.builtin.shell:
cmd: uname
warn: false
changed_when: false
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
- name: Sample task # noqa command-instead-of-shell
ansible.builtin.shell:
cmd: uname
warn: false
changed_when: false
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
- name: Sample task # noqa command-instead-of-shell
ansible.builtin.shell:
cmd: uname
warn: false
changed_when: false
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
- name: Ping instance-2 # noqa command-instead-of-shell
ansible.builtin.shell:
cmd: ping -c3 192.168.56.3
warn: false
changed_when: false

- name: Change instance-2
Expand All @@ -18,5 +17,4 @@
- name: Ping instance-1 # noqa command-instead-of-shell
ansible.builtin.shell:
cmd: ping -c3 192.168.56.2
warn: false
changed_when: false
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
- name: Sample task # noqa command-instead-of-shell
ansible.builtin.shell:
cmd: uname
warn: false
changed_when: false
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
- name: Sample task # noqa command-instead-of-shell
ansible.builtin.shell:
cmd: uname
warn: false
changed_when: false
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
- name: Sample task # noqa command-instead-of-shell
ansible.builtin.shell:
cmd: uname
warn: false
changed_when: false
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
- workdir.stat.exists | bool

- name: Get /tmp/workdir file content
ansible.builtin.command: cat /tmp/workdir
ansible.builtin.command:
cmd: cat /tmp/workdir
changed_when: false
register: workdir_content

Expand Down
12 changes: 8 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
[build-system]
requires = [
"setuptools >= 42.0.0", # required by pyproject+setuptools_scm integration
"setuptools_scm[toml] >= 3.5.0", # required for "no-local-version" scheme
"setuptools_scm_git_archive >= 1.0",
"wheel",
"setuptools >= 45.0.0", # required by pyproject+setuptools_scm integration
"setuptools_scm[toml] >= 7.0.0", # required for "no-local-version" scheme
]
build-backend = "setuptools.build_meta"

[tool.pytest]
addopts = "-v -rxXs --doctest-modules --durations 10 --no-cov-on-fail --cov=molecule_vagrant --cov-report term-missing:skip-covered"
doctest_optionflags = "ALLOW_UNICODE ELLIPSIS"
junit_suite_name = "molecule_test_suite"
norecursedirs = "dist doc build .tox .eggs test/scenarios test/resources"

[tool.setuptools_scm]
local_scheme = "no-local-version"
5 changes: 0 additions & 5 deletions pytest.ini

This file was deleted.

5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
molecule >= 3.4.1
pyyaml >= 5.1
Jinja2 >= 2.11.3
selinux
python-vagrant >= 1.0.0
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ classifiers =
Operating System :: OS Independent

Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10

Expand All @@ -46,7 +45,7 @@ keywords =

[options]
use_scm_version = True
python_requires = >=3.8
python_requires = >=3.9
packages = find:
include_package_data = True
zip_safe = False
Expand Down
2 changes: 1 addition & 1 deletion tools/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Vagrant.configure("2") do |config|
config.vm.box = "generic/alpine310"
config.vm.box = "generic/alpine316"
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.provider :libvirt do |l|
l.memory = 512
Expand Down
4 changes: 2 additions & 2 deletions tools/create_testbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# Used to test that Vagrant is usable and also to pre-download the image
# we will use during testing.
cd $DIR
cd "${DIR}"

vagrant box list |grep -qw testbox && exit 0
vagrant box list | grep -qw testbox && exit 0

rm -f testbox.box
vagrant up --no-tty --debug
Expand Down
16 changes: 8 additions & 8 deletions tools/test-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set -euxo pipefail
sudo dd if=/dev/zero of=/swap.img bs=1024 count=1048576
sudo chmod 600 /swap.img
sudo losetup -f /swap.img
sudo mkswap $(sudo losetup --associated /swap.img|sed 's,:.*,,')
sudo swapon $(sudo losetup --associated /swap.img|sed 's,:.*,,')
sudo mkswap "$(sudo losetup --associated /swap.img|sed 's,:.*,,')"
sudo swapon "$(sudo losetup --associated /swap.img|sed 's,:.*,,')"

# Platforms coverage:
# Fedora 30 : has vagrant-libvirt no compilation needed
Expand All @@ -22,7 +22,7 @@ command -v python3 python
PYTHON=$(command -v python3 python|head -n1)
PKG_CMD=$(command -v dnf yum apt-get|head -n1)

sudo $PYTHON -m pip install -U tox
sudo "${PYTHON}" -m pip install -U tox

# === LIBVIRT SETUP ===
sudo systemctl enable --now libvirtd
Expand Down Expand Up @@ -52,8 +52,8 @@ sudo virt-host-validate qemu || true
VAGRANT_VERSION=2.2.19

which vagrant || \
sudo $PKG_CMD install -y vagrant-libvirt || {
sudo $PKG_CMD install -y https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_x86_64.rpm
sudo "${PKG_CMD}" install -y vagrant-libvirt || {
sudo "${PKG_CMD}" install -y https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_x86_64.rpm
}

if [ -f /etc/os-release ]; then
Expand All @@ -75,7 +75,7 @@ if [ -f /etc/os-release ]; then
case "$VERSION_ID" in
31)
# https://bugzilla.redhat.com/show_bug.cgi?id=1839651
sudo $PKG_CMD upgrade -y --enablerepo=updates-testing --advisory=FEDORA-2020-09c472786c
sudo "${PKG_CMD}" upgrade -y --enablerepo=updates-testing --advisory=FEDORA-2020-09c472786c
;;
*)
;;
Expand All @@ -85,7 +85,7 @@ if [ -f /etc/os-release ]; then
# https://github.com/hashicorp/vagrant/issues/11020
if grep -qi '^CentOS Linux release 8.2.*' /etc/centos-release ; then
# https://bugs.centos.org/view.php?id=17120
relver="$(cat /etc/centos-release | awk '{print $4}')"
relver="$(grep -v '^#' /etc/centos-release | awk '{print $4}')"
sudo sed -i /etc/yum.repos.d/CentOS-Sources.repo -e 's,$contentdir/,,g'
sudo sed -i /etc/yum.repos.d/CentOS-Sources.repo -e "s,\$releasever,$relver,g"

Expand Down Expand Up @@ -130,7 +130,7 @@ vagrant plugin list | grep vagrant-libvirt || {

if [ -f /etc/debian_version ]; then
dpkg -l | grep libselinux
[ -x /usr/bin/aa-enabled ] && echo "Apparmor: `/usr/bin/aa-enabled`"
[ -x /usr/bin/aa-enabled ] && echo "Apparmor: $(/usr/bin/aa-enabled)"
else
rpm -qa | grep libselinux
fi
Expand Down
Loading

0 comments on commit 14cb0ce

Please sign in to comment.