From 4e98e1f5975a686d6860f534f64e92f4be9e8918 Mon Sep 17 00:00:00 2001 From: gardar Date: Fri, 27 Sep 2024 13:32:19 +0000 Subject: [PATCH] fix: make sure old versions of pytest find helper Signed-off-by: gardar --- .config/molecule/config.yml | 2 ++ .testinfra/testinfra_helpers.py | 3 +++ roles/prometheus/molecule/default/tests/test_default.py | 1 + roles/snmp_exporter/tasks/configure.yml | 1 - 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.config/molecule/config.yml b/.config/molecule/config.yml index 5bb016d9..8b9c8566 100644 --- a/.config/molecule/config.yml +++ b/.config/molecule/config.yml @@ -63,6 +63,8 @@ verifier: name: testinfra additional_files_or_dirs: - "../../../../../.testinfra/testinfra_helpers.py" + env: + PYTHONPATH: "${MOLECULE_PROJECT_DIRECTORY}/../../.testinfra:${PYTHONPATH}" provisioner: playbooks: converge: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/converge.yml" diff --git a/.testinfra/testinfra_helpers.py b/.testinfra/testinfra_helpers.py index 962f465e..ba93ef33 100644 --- a/.testinfra/testinfra_helpers.py +++ b/.testinfra/testinfra_helpers.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import testinfra diff --git a/roles/prometheus/molecule/default/tests/test_default.py b/roles/prometheus/molecule/default/tests/test_default.py index 518bcfd8..f5a392c4 100644 --- a/roles/prometheus/molecule/default/tests/test_default.py +++ b/roles/prometheus/molecule/default/tests/test_default.py @@ -3,6 +3,7 @@ __metaclass__ = type import yaml from testinfra_helpers import get_target_hosts +import os import pytest testinfra_hosts = get_target_hosts() diff --git a/roles/snmp_exporter/tasks/configure.yml b/roles/snmp_exporter/tasks/configure.yml index 7db0c4d4..bf52bd5e 100644 --- a/roles/snmp_exporter/tasks/configure.yml +++ b/roles/snmp_exporter/tasks/configure.yml @@ -13,7 +13,6 @@ ansible.builtin.get_url: url: "https://raw.githubusercontent.com/prometheus/snmp_exporter/v{{ snmp_exporter_version }}/snmp.yml" dest: /etc/snmp_exporter/snmp.yml - validate_certs: false owner: root group: root mode: 0644