Skip to content

[sonic-mgmt docker]Specify the pytest-ansible version for the python3 in sonic-mgmt docker#15814

Closed
nhe-NV wants to merge 1 commit intosonic-net:masterfrom
nhe-NV:pytest_anasible_version
Closed

[sonic-mgmt docker]Specify the pytest-ansible version for the python3 in sonic-mgmt docker#15814
nhe-NV wants to merge 1 commit intosonic-net:masterfrom
nhe-NV:pytest_anasible_version

Conversation

@nhe-NV
Copy link
Copy Markdown

@nhe-NV nhe-NV commented Jul 13, 2023

  1. For python 3.8.10, pytest-ansible dose not recommend to use the version upper than 3.0.0.
  2. There is a bug in the latest pytest-ansible:Even no extra-inventory is specified, extra_inventory_manager will still be initialized. ansible/pytest-ansible#135

(env-python3) root@63d996c03291:~# pip install pytest-ansible==
ERROR: Ignored the following versions that require a different python version: 3.0.0 Requires-Python >=3.9; 3.1.0 Requires-Python >=3.9
ERROR: Could not find a version that satisfies the requirement pytest-ansible== (from versions: 1.1, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.0, 1.3.1, 2.0.1, 2.0.2, 2.1.1, 2.2.2, 2.2.3, 2.2.4, 3.1.2, 3.1.4, 3.1.5)
ERROR: No matching distribution found for pytest-ansible==

(env-python3) root@63d996c03291:~# python --version
Python 3.8.10

(env-python3) root@63d996c03291:~# pip list | grep pytest-ansible
pytest-ansible 3.1.5

Why I did it

  1. There is a bug in the latest pytest-ansible:Even no extra-inventory is specified, extra_inventory_manager will still be initialized. ansible/pytest-ansible#135
  2. For python 3.8.10, pytest-ansible dose not recommend to use the version upper than 3.0.0.
Work item tracking
  • Microsoft ADO (number only):

How I did it

Specify the pytest-ansible verion to always use 2.2.4 instead of latest one.

How to verify it

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

1. For python 3.8.10, pytest-ansible dose not recommend to use the version upper than 3.0.0.
2. There is a bug in the latest pytest-ansible:ansible/pytest-ansible#135
@nhe-NV nhe-NV requested a review from lguohan as a code owner July 13, 2023 06:53
@liat-grozovik
Copy link
Copy Markdown
Collaborator

@yxieca could you please review?

@wangxin
Copy link
Copy Markdown
Contributor

wangxin commented Aug 16, 2023

@nhe-NV Your fix should work. However, my concern is that this will cause us stuck with a pretty old pytest-ansible plugin. It would be difficult to move forward with newer ansible and pytest-ansible versions.

Sometimes, vulnerability could be identified with old packages and we need to upgrade them to address those security issues. I am about to hack it from sonic-mgmt side. I’ll send out the PR soon. It would be great if you could help review.

@wangxin
Copy link
Copy Markdown
Contributor

wangxin commented Aug 17, 2023

I agree that it is a good idea to specify a fixed version of dependent packages. However, instead of using pytest-ansible v2.2.4, maybe it is a better idea to use later version like v4.0.0.
I just submitted a workaround fix for the pytest-ansible issue: sonic-net/sonic-mgmt#9530
With this fix, we can move forward before the pytest-ansible bug is fixed.

@liat-grozovik
Copy link
Copy Markdown
Collaborator

@nhe-NV can you please followup on the failures?

@nhe-NV
Copy link
Copy Markdown
Author

nhe-NV commented Sep 11, 2023

HI @liat-grozovik I will close this PR since Xin already have a fix in the sonic-mgmt: sonic-net/sonic-mgmt#9530

@nhe-NV nhe-NV closed this Sep 11, 2023
@nhe-NV
Copy link
Copy Markdown
Author

nhe-NV commented Sep 11, 2023

There is already a PR in the sonic-mgmt to fix the issue: sonic-net/sonic-mgmt#9530

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants