From 4a7b409f2e66a13967c1f3b37d0d6fd2f3756d00 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman Date: Fri, 9 Feb 2024 21:06:24 -0300 Subject: [PATCH] azure tests: Allow setting ansible_python_interpreter Since RHEL 8.6, ansible-core may not set '/usr/libexec/platform-python' an the python interpreter, falling back to 'python3.11', which is not supported by FreeIPA. This patch allows to override ansible_python_interpreter as shown in https://access.redhat.com/solutions/6726561 --- tests/azure/azure-pipelines.yml | 1 + tests/azure/nightly.yml | 4 ++++ tests/azure/pr-pipeline.yml | 1 + tests/azure/templates/group_tests.yml | 6 ++++++ tests/azure/templates/playbook_fast.yml | 4 ++++ tests/azure/templates/playbook_tests.yml | 4 ++++ tests/utils.py | 7 +++++++ 7 files changed, 27 insertions(+) diff --git a/tests/azure/azure-pipelines.yml b/tests/azure/azure-pipelines.yml index ab28bb1108..d652f7c8cc 100644 --- a/tests/azure/azure-pipelines.yml +++ b/tests/azure/azure-pipelines.yml @@ -72,6 +72,7 @@ stages: build_number: $(Build.BuildNumber) scenario: c8s ansible_version: "-core >=2.14,<2.15" + python_interpreter: "/usr/libexec/platform-python" # CentOS 7 diff --git a/tests/azure/nightly.yml b/tests/azure/nightly.yml index 89914f8e4b..be209c3359 100644 --- a/tests/azure/nightly.yml +++ b/tests/azure/nightly.yml @@ -176,6 +176,7 @@ stages: build_number: $(Build.BuildNumber) scenario: c8s ansible_version: "-core >=2.13,<2.14" + python_interpreter: "/usr/libexec/platform-python" - stage: c8s_Ansible_Core_2_14 dependsOn: [] @@ -185,6 +186,7 @@ stages: build_number: $(Build.BuildNumber) scenario: c8s ansible_version: "-core >=2.14,<2.15" + python_interpreter: "/usr/libexec/platform-python" - stage: c8s_Ansible_Core_2_15 dependsOn: [] @@ -194,6 +196,7 @@ stages: build_number: $(Build.BuildNumber) scenario: c8s ansible_version: "-core >=2.15,<2.16" + python_interpreter: "/usr/libexec/platform-python" - stage: c8s_Ansible_latest dependsOn: [] @@ -203,6 +206,7 @@ stages: build_number: $(Build.BuildNumber) scenario: c8s ansible_version: "" + python_interpreter: "/usr/libexec/platform-python" # CentOS 7 diff --git a/tests/azure/pr-pipeline.yml b/tests/azure/pr-pipeline.yml index 2345347db4..3f7af7155b 100644 --- a/tests/azure/pr-pipeline.yml +++ b/tests/azure/pr-pipeline.yml @@ -50,6 +50,7 @@ stages: build_number: $(Build.BuildNumber) scenario: c8s ansible_version: "-core >=2.14,<2.15" + python_interpreter: "/usr/libexec/platform-python" # CentOS 7 diff --git a/tests/azure/templates/group_tests.yml b/tests/azure/templates/group_tests.yml index 38f183dd97..2ab4650149 100644 --- a/tests/azure/templates/group_tests.yml +++ b/tests/azure/templates/group_tests.yml @@ -8,6 +8,9 @@ parameters: - name: ansible_version type: string default: "" + - name: python_interpreter + type: string + default: "" jobs: - template: playbook_tests.yml @@ -18,6 +21,7 @@ jobs: scenario: ${{ parameters.scenario }} ansible_version: ${{ parameters.ansible_version }} python_version: '< 3.12' + python_interpreter: ${{ parameters.python_interpreter }} - template: playbook_tests.yml parameters: @@ -27,6 +31,7 @@ jobs: scenario: ${{ parameters.scenario }} ansible_version: ${{ parameters.ansible_version }} python_version: '< 3.12' + python_interpreter: ${{ parameters.python_interpreter }} - template: playbook_tests.yml parameters: @@ -36,6 +41,7 @@ jobs: scenario: ${{ parameters.scenario }} ansible_version: ${{ parameters.ansible_version }} python_version: '< 3.12' + python_interpreter: ${{ parameters.python_interpreter }} # Temporarily disabled due to ansible docker plugin issue. #- template: pytest_tests.yml diff --git a/tests/azure/templates/playbook_fast.yml b/tests/azure/templates/playbook_fast.yml index a01d2c348f..69c4c5bb76 100644 --- a/tests/azure/templates/playbook_fast.yml +++ b/tests/azure/templates/playbook_fast.yml @@ -17,6 +17,9 @@ parameters: default: 3.x - name: build_number type: string + - name: python_interpreter + type: string + default: "" jobs: - job: Test_Group${{ parameters.group_number }} @@ -84,6 +87,7 @@ jobs: IPA_DISABLED_MODULES: ${{ variables.ipa_disabled_modules }} IPA_DISABLED_TESTS: ${{ variables.ipa_disabled_tests }} IPA_VERBOSITY: "-vvv" + PYTHON_INTERPRETER: ${{ parameters.python_interpreter }} - task: PublishTestResults@2 inputs: diff --git a/tests/azure/templates/playbook_tests.yml b/tests/azure/templates/playbook_tests.yml index c65c955fb1..4b07b0a587 100644 --- a/tests/azure/templates/playbook_tests.yml +++ b/tests/azure/templates/playbook_tests.yml @@ -17,6 +17,9 @@ parameters: default: 3.x - name: build_number type: string + - name: python_interpreter + type: string + default: "" jobs: - job: Test_Group${{ parameters.group_number }} @@ -80,6 +83,7 @@ jobs: IPA_ENABLED_MODULES: ${{ variables.ipa_enabled_modules }} IPA_ENABLED_TESTS: ${{ variables.ipa_enabled_tests }} IPA_VERBOSITY: "-vvv" + PYTHON_INTERPRETER: ${{ parameters.python_interpreter }} - task: PublishTestResults@2 inputs: diff --git a/tests/utils.py b/tests/utils.py index 9e3d5e83be..fd27637ef7 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -39,6 +39,10 @@ def get_docker_env(): return docker_env +def get_python_interpreter(): + return os.getenv("PYTHON_INTERPRETER", None) + + def get_ssh_password(): return os.getenv("IPA_SSH_PASSWORD") @@ -92,6 +96,9 @@ def get_inventory_content(): container_engine = get_docker_env() if container_engine is not None: ipa_server_host += f" ansible_connection={container_engine}" + python_interpreter = get_python_interpreter() + if python_interpreter is not None: + ipa_server_host += f" ansible_python_interpreter={python_interpreter}" sshpass = get_ssh_password() if sshpass: