Skip to content

Commit

Permalink
azure tests: Allow setting ansible_python_interpreter
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rjeffman committed Feb 10, 2024
1 parent 4321478 commit 4a7b409
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/azure/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions tests/azure/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
Expand All @@ -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: []
Expand All @@ -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: []
Expand All @@ -203,6 +206,7 @@ stages:
build_number: $(Build.BuildNumber)
scenario: c8s
ansible_version: ""
python_interpreter: "/usr/libexec/platform-python"

# CentOS 7

Expand Down
1 change: 1 addition & 0 deletions tests/azure/pr-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions tests/azure/templates/group_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ parameters:
- name: ansible_version
type: string
default: ""
- name: python_interpreter
type: string
default: ""

jobs:
- template: playbook_tests.yml
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/azure/templates/playbook_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions tests/azure/templates/playbook_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4a7b409

Please sign in to comment.